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 |
|---|---|---|---|---|---|---|
GET /post_parts/1 GET /post_parts/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @post_parts = PostPart.all\n end",
"def show\n @part = @product.parts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part }\n end\n end",
"def parts\n @audio_file = AudioFile.find(params[:id])\n @parts = @audio_file.parts\n\n respond_to do |format|\n format.html # parts.html.erb\n format.xml { render :xml => @parts }\n format.json { render :json => @parts }\n end\n end",
"def show\n @part = Part.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part }\n end\n end",
"def show\n @job = Job.find(params[:job_id])\n @part = @job.parts.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json {render json: @part}\n end\n end",
"def show\n @medium_body_part = MediumBodyPart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_body_part }\n end\n end",
"def create\n @post_part = PostPart.new(post_part_params)\n\n respond_to do |format|\n if @post_part.save\n format.html { redirect_to @post_part, notice: 'Post part was successfully created.' }\n format.json { render :show, status: :created, location: @post_part }\n else\n format.html { render :new }\n format.json { render json: @post_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_post_part\n @post_part = PostPart.find(params[:id])\n end",
"def parts\n body.parts\n end",
"def show\n @part_name = PartName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part_name }\n end\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part }\n end\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @part }\n end\n end",
"def index\n @parts = @chaper.parts\n end",
"def path_part(part)\n @_path_parts ||= app.blog.drafts.path_matcher.match(path).captures\n\n @_path_parts[app.blog.drafts.matcher_indexes[part]]\n end",
"def show\n @used_part = UsedPart.find(params[:id])\n prepFormVariables\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @used_part}\n end\n end",
"def render\n parts.map(&:content)\n end",
"def show\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @theoretical_part }\r\n end\r\n end",
"def get_part_by_company_part\n @parts = PartsController::PartService.get_part_by_company_part(params[:param_part])\n if !@parts.nil?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend",
"def show\n if can?(:>=, \"3\")\n @part = Kitting::Part.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def index\n story_parts_words = {}\n story_parts = StoryPart.where(params[:story_id])\n # iterate through story parts to find word. Create story_part/word association to be passed into json data\n story_parts.each do |story_part|\n story_word_array = []\n story_word_array.push(story_part)\n story_word_array.push(story_part.word)\n story_parts_words[story_part.id] = story_word_array\n end\n \n render :json => story_parts_words\n end",
"def index\n #@parts = Part.find(:all, :order => 'part_number')\n\t@used_parts = UsedPart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @used_parts }\n end\n end",
"def get_part\n @part\n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def get_part_by_category\n @categorys = PartsController::PartService.get_part_by_category(params[:param]);\n respond_to do |format|\n format.json { render json: @categorys }\n end \n end",
"def parts\n @parts\n end",
"def fetch_page_part(name, part, options = {})\n fetch('/page/%s/%s' % [name, part], options)\n end",
"def get_part(args)\n return send(args[:page]).send(args[:part][:locate])[args[:part][:num]] if part_plural?(args)\n\n send(args[:page]).send(args[:part])\n end",
"def new\n @medium_body_part = MediumBodyPart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_body_part }\n end\n end",
"def show\n @medium_body_part_inv = MediumBodyPartInv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_body_part_inv }\n end\n end",
"def update\n respond_to do |format|\n if @post_part.update(post_part_params)\n format.html { redirect_to @post_part, notice: 'Post part was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_part }\n else\n format.html { render :edit }\n format.json { render json: @post_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @reports_part = ReportsPart.find(params[:id])\n\n render json: @reports_part\n end",
"def index\n if params[:part_id]\n @materials = Material.find(:all, :conditions => [\"part_id = ?\", params[:part_id]])\n else\n @materials = Material.all\n end\n respond_to do |format|\n format.html\n format.json { render :json => @materials }\n end\n end",
"def index\n @parts = Part.preload(:job)\n end",
"def show\n\t\t@part = Part.find(params[:id])\n# \t\t@product = Product.find(@part.product_id)\n\t\t@supplier = Supplier.find(@part.supplier_id)\n\t\t\n\t\trespond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render json: @part }\n\t\tend\n\tend",
"def create\n @part = Part.new(params[:part])\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to @part, :notice => 'Part was successfully created.' }\n format.json { render :json => @part, :status => :created, :location => @part }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @part.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @post = find_post\n @post_sections = @post.sections\n end",
"def get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end",
"def get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end",
"def content_for(part_slug)\n part_with_slug(part_slug).try(:body)\n end",
"def post_part_params\n params.require(:post_part).permit(:heading, :body, :price, :neighborhood, :external_url, :timestamp)\n end",
"def show\n @vendor_part = VendorPart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vendor_part }\n end\n end",
"def path_part(part)\n @_path_parts ||= Blog::UriTemplates.extract_params(blog_data.source_template, path)\n @_path_parts[part.to_s]\n end",
"def show\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_list_child }\n end\n end",
"def show\n @voice_part = VoicePart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voice_part }\n end\n end",
"def show\n #@parts = Part.find_by(id: @technique.part_id)\n @parts = Part.find(@technique.part_id)\n end",
"def set_part\n @part = Part.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render json: {:status => 404, :message => \"Couldn't find part with ID #{params[:id]}\"}, :status => 404\n end",
"def list_parts(options = {})\n result = client.bucket_list_parts(upload_id, key, options)\n .parsed_response\n\n parts_keys = %w(ListPartsResult Part)\n Utils.wrap(Utils.dig_value(result, *parts_keys)).map do |part|\n Struct::Part.new(part)\n end\n end",
"def new\r\n @theoretical_part = TheoreticalPart.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @theoretical_part }\r\n end\r\n end",
"def part\n \"#{path.chomp('.part')}.part\"\n end",
"def index\n if params[:fulldoc].nil? then\n @singleparts = Singlepart.all\n else\n @singleparts = Singlepart.where(['fulldoc_id = ?', params[:fulldoc]])\n end\n end",
"def index\n #@part_names = PartName.find(:all, :order => 'name')\n\t@part_names = PartName.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @part_names }\n end\n end",
"def read_post(post_list, id)\n post = post_list['data']['children'][id]['data']\nend",
"def __endpoint_parts\n parts = @spec['url']['paths'].select do |a|\n a.keys.include?('parts')\n end.map do |path|\n path&.[]('parts')\n end\n (parts.inject(&:merge) || [])\n end",
"def create\n @part = Part.new(params[:part])\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to @part, notice: 'Part was successfully created.' }\n format.json { render json: @part, status: :created, location: @part }\n else\n format.html { render action: \"new\" }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @part = @product.parts.new(params[:part])\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to [@product,@part], notice: 'Part was successfully created.' }\n format.json { render json: [@product,@part], status: :created, location: [@product,@part] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def part_params\n params.require(:part).permit(:name, :body, :user_id)\n end",
"def show\n @part_three_predict = PartThreePredict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part_three_predict }\n end\n end",
"def index\n @parts = Part.where(job_id: params[:job_id])\n @job_id = params[:job_id]\n end",
"def destroy\n @post_part.destroy\n respond_to do |format|\n format.html { redirect_to post_parts_url, notice: 'Post part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @page = Page.find(params[:id], include: [:attachments, :business])\n @posts = @page.posts.select('id, title, slug, price, photo, created_at')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @paper_word = PaperWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_word }\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render :json => @post.to_json(:include => { :assets => {:only => [:file_file_name, :file_content_type],:methods => :file_url }, :categories => {:only => [:name]}}, :methods => [:author, :author_avatar, :favorites_quantity, :comments, :comments_quantity])}\n end\n end",
"def get(path_part, additional_headers = {}, &block)\n api_request { @rest.get('/REST/' + path_part, nil, additional_headers, &block) }\n end",
"def show\n @part = Part.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @part }\n end\n end",
"def new\n @topic = Topic.new\n @topic.part_id=params[:part]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def create\n @part = Part.new(part_params)\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to \"/parts?search=#{@part.part_number}\", notice: 'Part was successfully created.' }\n format.json { render :show, status: :created, location: @part }\n else\n format.html { render :new }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @pre_step = PreStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pre_step }\n end\n end",
"def index\n @part_details = PartDetail.all\n end",
"def new\n @part_name = PartName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part_name }\n end\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def part(index)\n @parts[index]\n end",
"def parts\n product.parts\n end",
"def parts\n product.parts\n end",
"def show\n @foobar = Foobar.find(params[:id])\n \n @paragraphbuilder = @foobar.content.split(\"\\r\\n\")\n \n @paragraphbuilder.each do |paragraph|\n puts paragraph\n end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foobar }\n \n \n end\n end",
"def create\n story_part = StoryPart.create(story_part_params)\n \n\n story_part_id = story_part.id\n render :json => story_part_id\n \n # @story = Story.create() \n # story_id = @story.id\n # render :json => story_id\n\n # respond_to do |format|\n # if @story_part.save\n # format.html { redirect_to @story_part, notice: 'Story part was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @story_part }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @story_part.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def part_params\n params[:part].permit(\"part_id\", \"name\")\n end",
"def new\n\t\t@part = Part.new\n# \t\t@product = Product.find(@part.product_id)\n\t\t@supplier = Supplier.find(params[:supplier_id])\n\t\t\n\t\trespond_to do |format|\n\t\tformat.html # new.html.erb\n\t\tformat.json { render json: @part }\n\t\tend\n\tend",
"def new\n @used_part = UsedPart.new\n prepFormVariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @used_part}\n end\n end",
"def index\n @post_ingredients = @post.post_ingredients\n end",
"def create\n @medium_body_part = MediumBodyPart.new(params[:medium_body_part])\n\n respond_to do |format|\n if @medium_body_part.save\n format.html { redirect_to @medium_body_part, notice: 'Medium body part was successfully created.' }\n format.json { render json: @medium_body_part, status: :created, location: @medium_body_part }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_body_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n respond_to do |format|\n par = []\n @blogger.paragraphs.each do |para|\n para_details = {\n id: para.id,\n data: para.data,\n comments: para.comments.collect{ |dat| dat.body } \n }\n par << para_details\n end\n blog_json = {\n id: @blogger[:id],\n title: @blogger[:title],\n author: @blogger[:author],\n paragraph_details: par\n }\n \n format.json { render json: blog_json, status: :ok, location: @blogger }\n \n end\n end",
"def show\n @pattachment = Pattachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pattachment }\n end\n end",
"def show\n @micorpost = Micorpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micorpost }\n end\n end",
"def create\n @singlepart = Singlepart.new(singlepart_params)\n\n respond_to do |format|\n if @singlepart.save\n format.html { redirect_to @singlepart, notice: 'Singlepart was successfully created.' }\n format.json { render :show, status: :created, location: @singlepart }\n else\n format.html { render :new }\n format.json { render json: @singlepart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @pluto_process_definition = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @pluto_process_definition }\n end\n end",
"def show\n render json: @post_prod_dpt\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def new\n @vendor_part = VendorPart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @vendor_part }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def index\n @job_parts = JobPart.all\n end",
"def show\n @part_company = PartCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part_company }\n end\n end",
"def index\n @subparts = Subpart.all\n end",
"def parts\n @descriptive_detail.parts\n end",
"def show\n render json: @post\n end",
"def new\n @medium_body_part_inv = MediumBodyPartInv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_body_part_inv }\n end\n end",
"def index\n @art_posts = ArtPost.all\n\n render json: @art_posts\n end",
"def copy_part(part)\n response = client.upload_part_copy(part)\n\n { \"part_number\" => part[:part_number], \"etag\" => response.copy_part_result.etag }\n end",
"def get_page\n render_page_sections_json\n end",
"def index\n @order_parts = OrderPart.all\n end"
] |
[
"0.68984956",
"0.65087146",
"0.63962877",
"0.6380265",
"0.63696945",
"0.623836",
"0.62131286",
"0.60302943",
"0.6027642",
"0.59151167",
"0.59129286",
"0.59075886",
"0.5878882",
"0.58508",
"0.5835164",
"0.58065295",
"0.58054554",
"0.5793242",
"0.57920194",
"0.578543",
"0.57146096",
"0.5702944",
"0.5695847",
"0.5695847",
"0.5695847",
"0.5692177",
"0.56884366",
"0.5657378",
"0.5629985",
"0.5626992",
"0.5612356",
"0.55671614",
"0.5558023",
"0.5557088",
"0.5526949",
"0.5510629",
"0.5509713",
"0.55072534",
"0.5506258",
"0.5506258",
"0.5498673",
"0.5498456",
"0.5498062",
"0.54525447",
"0.54494315",
"0.54284257",
"0.54262275",
"0.5425702",
"0.5415914",
"0.5405568",
"0.5402546",
"0.5398523",
"0.5397527",
"0.5392047",
"0.5383144",
"0.5366772",
"0.5355454",
"0.5349233",
"0.5340781",
"0.53327817",
"0.5327329",
"0.53143716",
"0.5301718",
"0.5297139",
"0.5292156",
"0.5288409",
"0.52824724",
"0.52813673",
"0.52711296",
"0.52497345",
"0.5246917",
"0.5234926",
"0.5228784",
"0.52256286",
"0.52256286",
"0.5214571",
"0.5201189",
"0.51994056",
"0.5197956",
"0.5192008",
"0.5190696",
"0.51851153",
"0.51807165",
"0.51682025",
"0.5157885",
"0.5156976",
"0.51447564",
"0.5138294",
"0.5137661",
"0.5134965",
"0.51296127",
"0.5115105",
"0.51145405",
"0.51134866",
"0.5112349",
"0.5103198",
"0.50999933",
"0.5084175",
"0.5082343",
"0.50787455",
"0.50781155"
] |
0.0
|
-1
|
POST /post_parts POST /post_parts.json
|
def create
@post_part = PostPart.new(post_part_params)
respond_to do |format|
if @post_part.save
format.html { redirect_to @post_part, notice: 'Post part was successfully created.' }
format.json { render :show, status: :created, location: @post_part }
else
format.html { render :new }
format.json { render json: @post_part.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_part_params\n params.require(:post_part).permit(:heading, :body, :price, :neighborhood, :external_url, :timestamp)\n end",
"def create\n @part = Part.new(params[:part])\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to @part, :notice => 'Part was successfully created.' }\n format.json { render :json => @part, :status => :created, :location => @part }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @part.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @part = @product.parts.new(params[:part])\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to [@product,@part], notice: 'Part was successfully created.' }\n format.json { render json: [@product,@part], status: :created, location: [@product,@part] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.post('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end",
"def create\n @part = Part.new(params[:part])\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to @part, notice: 'Part was successfully created.' }\n format.json { render json: @part, status: :created, location: @part }\n else\n format.html { render action: \"new\" }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def part_params\n params.require(:part).permit(:name, :body, :user_id)\n end",
"def add_multipart_body(parts)\n body = []\n body << \"--#{BOUNDARY}\\r\\n\"\n parts.each do |property, value|\n body << \"Content-Disposition: form-data; name=\\\"#{property}\\\"\\r\\n\\r\\n#{value}\"\n body << \"\\r\\n--#{BOUNDARY}\\r\\n\"\n end\n @body = body.join\n @headers[\"Content-Type\"] = \"multipart/form-data; boundary=#{BOUNDARY}\"\n end",
"def create\n @singlepart = Singlepart.new(singlepart_params)\n\n respond_to do |format|\n if @singlepart.save\n format.html { redirect_to @singlepart, notice: 'Singlepart was successfully created.' }\n format.json { render :show, status: :created, location: @singlepart }\n else\n format.html { render :new }\n format.json { render json: @singlepart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @part = Part.new(part_params)\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to \"/parts?search=#{@part.part_number}\", notice: 'Part was successfully created.' }\n format.json { render :show, status: :created, location: @part }\n else\n format.html { render :new }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auto_part = AutoPart.new(auto_part_params)\n\n respond_to do |format|\n if @auto_part.save\n format.html { redirect_to @auto_part, notice: 'Auto part was successfully created.' }\n format.json { render :show, status: :created, location: @auto_part }\n else\n format.html { render :new }\n format.json { render json: @auto_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @part = @assessment.parts.build(part_params)\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to @part, notice: 'Part was successfully created.' }\n format.json { render :show, status: :created, location: @part }\n format.js { }\n else\n format.html { render :new }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end",
"def create\n @medium_body_part = MediumBodyPart.new(params[:medium_body_part])\n\n respond_to do |format|\n if @medium_body_part.save\n format.html { redirect_to @medium_body_part, notice: 'Medium body part was successfully created.' }\n format.json { render json: @medium_body_part, status: :created, location: @medium_body_part }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_body_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def part_params\n params[:part].permit(\"part_id\", \"name\")\n end",
"def bodypart_params\n params.require(:bodypart).permit(:name, :img)\n end",
"def create\n @part_detail = PartDetail.new(part_detail_params)\n\n respond_to do |format|\n if @part_detail.save\n format.html { redirect_to @part_detail, notice: 'Part detail was successfully created.' }\n format.json { render :show, status: :created, location: @part_detail }\n else\n format.html { render :new }\n format.json { render json: @part_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n @subpart = Subpart.new(subpart_params)\n\n respond_to do |format|\n if @subpart.save\n format.html { redirect_to @subpart, notice: 'Subpart was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subpart }\n else\n format.html { render action: 'new' }\n format.json { render json: @subpart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t \n @part = @chaper.parts.create(part_params)\n @part.user_id = current_user.id \n respond_to do |format|\n if @part.save\n format.html { redirect_to chaper_path(@chaper), notice: 'Part was successfully created.' }\n format.json { render action: 'show', status: :created, location: @part }\n else\n format.html { render action: 'new' }\n format.json { render json: chaper_path(@chaper).errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n parms = document_part_params.to_h.deep_dup.symbolize_keys\n parms[:document_id] = @document_section.document_id\n parms[:type] = 'DocumentPart::HtmlContent' if parms[:type].blank?\n @document_part = @document_section.parts.create(parms)\n redirect_to edit_admin_document_document_section_document_part_path(@document, @document_section, @document_part), notice: 'Content was successfully updated.' if @document_part.valid?\n end",
"def create\n @job = Job.find(params[:job_id])\n @part = @job.parts.build(part_params)\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to edit_job_path(@job), notice: 'Part was successfully created.' }\n format.json { render json: @job, action:edit, status: :created, location: @part }\n else\n format.html { render :new }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @part = Part.new(params[:part])\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to(admin_part_path(@part), :notice => 'Part was successfully created.') }\n format.xml { render :xml => @part, :status => :created, :location => @part }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @part.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n story_part = StoryPart.create(story_part_params)\n \n\n story_part_id = story_part.id\n render :json => story_part_id\n \n # @story = Story.create() \n # story_id = @story.id\n # render :json => story_id\n\n # respond_to do |format|\n # if @story_part.save\n # format.html { redirect_to @story_part, notice: 'Story part was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @story_part }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @story_part.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def part_params\n params.require(:part).permit(:name, :description, :value, :assessment_id)\n end",
"def part_params\n params.require(:part).permit(:description, :image_url, :pdf_url, :manufacturer, :part_number, :part_type, :quantity_in_stock, :specs)\n end",
"def part_params\n params.require(:part).permit(:partNum, :description, :quantity, :totalQuantity, :workOrder, :finish, :job_id, :item_num)\n end",
"def create\n @part = Part.new(part_params)\n authorize! :create, @part\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to @part, notice: 'Part was successfully created.' }\n format.json { render action: 'show', status: :created, location: @part }\n else\n format.html { render action: 'new' }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, form_data=nil)\n parse_json do |parser|\n @http_client.post(path, form_data) {|chunk| parser << chunk }\n end\n end",
"def put_multipart!(data, boundary, part_index, part_data)\n data << \"\\r\\n--#{boundary}\\r\\n\"\n if part_index > 0\n data << \"Content-Disposition: form-data; name=\\\"file#{part_index}\\\";filename=\\\"file#{part_index}\\\"\\r\\n\"\n data << \"Content-Type: application/octet-stream\\r\\n\"\n elsif\n data << \"Content-Disposition: form-data; name=\\\"data\\\"\\r\\n\"\n data << \"Content-Type: text/json\\r\\n\"\n end\n data << \"Content-Length: #{part_data.length}\\r\\n\"\n data << \"\\r\\n\"\n data << part_data\n end",
"def create\n @part = Part.new(part_params.merge(job_id: params[:job_id].to_i))\n\n respond_to do |format|\n if @part.save\n format.html { redirect_to @part, notice: 'Part was successfully created.' }\n format.json { render :show, status: :created, location: @part }\n else\n format.html { render :new }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parts\n body.parts\n end",
"def part_params\n params.require(:part).permit(:nr, :custom_nr, :type, :cross_section,:strip_length,:component_type,\n :resource_group_id, :measure_unit_id, :description,:color,:color_desc,:unit,:desc1,:pno,:nick_name)\n end",
"def create\n @part_name = PartName.new(params.require(:part_name).permit(:name))\n ok = validatePartName?(@part_name)\n okUrl, errAction = setSaveAction('new', part_names_url)\n\n respond_to do |format|\n if ok and @part_name.save\n format.html { redirect_to okUrl,\n notice: 'PartName was successfully created.' }\n format.json { render json: @part_name, status: :created,\n location: @part_name }\n else\n format.html { render action: errAction }\n format.json { render json: @part_name.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image_to_part = ImageToPart.new(image_to_part_params)\n\n respond_to do |format|\n if @image_to_part.save\n format.html { redirect_to @image_to_part, notice: 'Image to part was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image_to_part }\n else\n format.html { render action: 'new' }\n format.json { render json: @image_to_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part }\n end\n end",
"def create\n @reports_part = ReportsPart.new(params[:reports_part])\n\n if @reports_part.save\n render json: @reports_part, status: :created, location: @reports_part\n else\n render json: @reports_part.errors, status: :unprocessable_entity\n end\n end",
"def image_to_part_params\n params.require(:image_to_part).permit(:image_id, :part_id)\n end",
"def create\r\n @theoretical_part = TheoreticalPart.new(params[:theoretical_part])\r\n\r\n respond_to do |format|\r\n if @theoretical_part.save\r\n format.html { redirect_to @theoretical_part, notice: 'Theoretical part was successfully created.' }\r\n format.json { render json: @theoretical_part, status: :created, location: @theoretical_part }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @theoretical_part.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @part }\n end\n end",
"def part_params\n params.require(:part).permit(:name, :ldraw_id, :bl_id, :lego_id, :check_bricklink, :check_rebrickable, :alternate_nos, :is_obsolete, :year_from, :year_to, :brickowl_ids, :is_lsynth)\n end",
"def create\n @inventory_part = InventoryPart.new(params.require(:inventory_part).permit(:part_actual_price, :part_id, :purchase_order_id, :quantity)\n)\n\n respond_to do |format|\n if @inventory_part.save\n format.html { redirect_to inventory_parts_url,\n notice: 'Inventory part was successfully created.' }\n format.json { render json: @inventory_part,\n status: :created,\n location: @inventory_part }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @inventory_part.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n if can?(:>=, \"3\")\n @cup_count = params[:cup_count].to_boolean\n @part = Kitting::Part.new(params[:part])\n @part_response = get_part_numbers current_user, params[:part][:part_number].upcase\n if @part_response\n if @part_response[\"errCode\"] == \"1\"\n flash.now[:notice] = @part_response[\"errMsg\"]\n render :new\n else\n @part.name = @part_response['partName']\n @part.prime_pn = @part_response[\"primePNList\"].reject(&:blank?).first\n # @part.customer_name = session[:customer_Name]\n # @part.customer_number = session[:customer_number]\n respond_to do |format|\n if @part.save\n flash.now[:message] = \"Part #{@part.part_number} created successfully.\"\n format.html { redirect_to part_path(@part.id) }\n else\n format.js\n format.html { render action: \"new\" }\n end\n end\n\n end\n else\n flash.now[:notice] = \"Service temporary unavailable\"\n render :new\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def create\n @vendor_part = VendorPart.new(params[:vendor_part])\n\n respond_to do |format|\n if @vendor_part.save\n format.html { redirect_to @vendor_part, :notice => 'Vendor part was successfully created.' }\n format.json { render :json => @vendor_part, :status => :created, :location => @vendor_part }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @vendor_part.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @parts_for_proposal = PartsForProposal.new(parts_for_proposal_params)\n\n respond_to do |format|\n if @parts_for_proposal.save\n curr_id = @parts_for_proposal.proposal_id\n format.html { redirect_to proposal_url(:id => curr_id), notice: 'Part added to this proposal successfully.' }\n format.json { render :show, status: :created, location: @parts_for_proposal }\n else\n format.html { render :new }\n format.json { render json: @parts_for_proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_post_part\n @post_part = PostPart.find(params[:id])\n end",
"def thing_part_params\n params.require(:thing_part).permit(:name, :field1, :field2, :field3)\n end",
"def create\n\t\t@part = Part.new(params[:part])\n# \t\t@product = Product.find(@part.product_id)\n\t\t@supplier = Supplier.find(params[:supplier_id])\n\t\t\n\t\trespond_to do |format|\n\t\tif @part.save\n\t\t\tformat.html { redirect_to @supplier, notice: t('actions.part.notice.created') }\n\t\t\tformat.json { render json: @part, status: :created, location: @supplier }\n\t\telse\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @part.errors, status: :unprocessable_entity }\n\t\tend\n\t\tend\n\tend",
"def create\n @part_order = PartOrder.new(part_order_params)\n\n respond_to do |format|\n if @part_order.save\n format.html { redirect_to @part_order, notice: \"Part order was successfully created.\" }\n format.json { render :show, status: :created, location: @part_order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @part_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @post_parts = PostPart.all\n end",
"def create\n @part_attribute = PartAttribute.new(part_attribute_params)\n\n respond_to do |format|\n if @part_attribute.save\n format.html { redirect_to @part_attribute, notice: 'Part attribute was successfully created.' }\n format.json { render :show, status: :created, location: @part_attribute }\n else\n format.html { render :new }\n format.json { render json: @part_attribute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def part_params\n params[:part].permit(:name, :price)\n end",
"def create\n # TODO: refactor\n conf = {:path=>\"#{RAILS_ROOT}/index/#{RAILS_ENV}/rip\"}\n index = Ferret::Index::Index.new(conf)\n\n for p in params[:parts][:part]\n part = Part.find_or_create_by_mrokhash(p[:mrokhash])\n unless logged_in_user.parts.include? part\n logged_in_user.parts << part\n remove_cache_pages(part.rip_id) if part.rip_id\n update_user_in_field(:index => index, :part => part, :add => true)\n end\n end\n head :created\n end",
"def add_part\n room = Room.find(params[:room_id])\n story = Story.find(room.story_id)\n passage = story.passage\n passage << ' ' << params[:part]\n story.update(passage: passage)\n\n ActionCable.server.broadcast(\"room_#{params[:room_id]}\", {part: params[:part], action: 'room_add_part'})\n end_turn(params[:room_id])\n\n render json: { status: :ok }\n end",
"def post_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params, only: [:content] )\n end",
"def update\n respond_to do |format|\n if @post_part.update(post_part_params)\n format.html { redirect_to @post_part, notice: 'Post part was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_part }\n else\n format.html { render :edit }\n format.json { render json: @post_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, **args); end",
"def singlepart_params\n params.require(:singlepart).permit(:experimental, :describe, :ea, :hnmr, :cnmr, :calch, :calcc, :value, :fnmr, :pnmr, :bnmr, :nnmr, :mass1, :ir, :raman, :mass2, :mass3, :uv, :givenc, :givenh, :fill1, :oka, :okb, :okc, :okd, :fulldoc_id)\n end",
"def addPart (method, url, headers, body, contentId = \"\")\n part = { :method => method, :url => url, :headers => headers, :body => body, :contentId => contentId }\n @parts.push(part)\n end",
"def parts\n @audio_file = AudioFile.find(params[:id])\n @parts = @audio_file.parts\n\n respond_to do |format|\n format.html # parts.html.erb\n format.xml { render :xml => @parts }\n format.json { render :json => @parts }\n end\n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def create\n @part = Part.new(part_params)\n if params[:v] == 0\n pu = MaintenanceItem.find(params[:mid])\n else\n pu = Vehicle.find(params[:vid])\n end\n \n if @part.save\n pu.parts << @part\n pu.save\n redirect_to controller: \"parts\", action: \"index\", v: params[:v], mid: params[:mid], vid: params[:vid]\n end\n end",
"def html_part_params\n params.require(:html_part).permit(:index, :template_element_id, :text, :is_last)\n end",
"def create\n\t\t@part = Part.new(params[:part])\n\t\t@types = Part.get_types_part\n\t\t@status = Statusobject.find_for(\"part\")\n\t\trespond_to do |format|\n\t\t\tif params[:fonct] == \"new_dup\"\n\t\t\t\tobject_orig=Part.find(params[:object_orig_id])\n\t\t\tst = @part.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @part.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tst = ctrl_duplicate_links(params, @part, current_user)\n\t\t\t\tflash[:notice] = t(:ctrl_object_created,:typeobj =>t(:ctrl_part),:ident=>@part.ident)\n\t\t\t\tformat.html { redirect_to(@part) }\n\t\t\t\tformat.xml { render :xml => @part, :status => :created, :location => @part }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created,:typeobj =>t(:ctrl_part), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @part.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def upload_part(body, key, upload_id, part_number)\n multipart_upload = object(key).multipart_upload(upload_id)\n multipart_part = multipart_upload.part(part_number)\n\n response = multipart_part.upload(body: body)\n\n { \"part_number\" => part_number, \"etag\" => response.etag }\n end",
"def create\n @order_part = OrderPart.new(order_part_params)\n\n respond_to do |format|\n if @order_part.save\n format.html { redirect_to @order_part, notice: '配件信息创建成功!' }\n format.json { render :show, status: :created, location: @order_part }\n else\n format.html { render :new }\n format.json { render json: @order_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parts_for_proposal_params\n params.require(:parts_for_proposal).permit(:frequency, :quantity, :quantity_per_visit, :cost, :proposal_id, :part_id)\n end",
"def create\n msg = Message.new\n @part = Part.new(part_params)\n # authorize(@part)\n\n respond_to do |format|\n if @part.save\n msg.result = true\n msg.content = @part\n format.html { redirect_to @part, notice: 'Part was successfully created.' }\n format.json { render json: msg }\n else\n msg.result = false\n msg.content = @part.errors\n format.html { render :new }\n format.json { render json: msg, status: :unprocessable_entity }\n end\n end\n end",
"def part_params\n params.require(:part).permit(:name, :job_id).merge(user_id: current_user.id)\n end",
"def create\n @company_part = CompanyPart.new(company_part_params)\n\n respond_to do |format|\n if @company_part.save\n format.html { redirect_to company_parts_path, notice: 'Company part was successfully created.' }\n format.json { render :show, status: :created, location: @company_part }\n else\n format.html { render :new }\n format.json { render json: @company_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def story_part_params\n params.require(:story_part).permit(:x, :y, :word_id, :story_id)\n end",
"def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end",
"def create\n @voice_part = VoicePart.new(params[:voice_part])\n\n respond_to do |format|\n if @voice_part.save\n format.html { redirect_to @voice_part, notice: 'Voice part was successfully created.' }\n format.json { render json: @voice_part, status: :created, location: @voice_part }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voice_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_multipart(params)\n boundary = (0...8).map { rand(255).to_s 16 }.join '_'\n data = expand_params(params).map do |key, value|\n [ \"--#{boundary}\",\n \"Content-Disposition: form-data; name=\\\"#{key}\\\"\",\n nil,\n value]\n end\n\n data << \"--#{boundary}--\"\n return [boundary, data.join(\"\\r\\n\")]\n end",
"def create\n\n # params[:post][:step4] = \"TESTING4\";\n params[:post][:steps] = \"\"\n \n if params[:post][:step]\n params[:post][:step].each do |k, v|\n if params[:post][:step].length == k.to_i\n params[:post][:steps] << v\n else\n params[:post][:steps] << v + '|'\n end\n end\n params[:post].delete(\"step\")\n end\n\n #return render :text => params[:post]\n @post = current_user.posts.create(params[:post])\n\n if @post.save\n flash[:success] = 'Post was successfully created.'\n redirect_to @post\n else\n render :new\n end\n\n end",
"def create\n\n # retrieve page part attributes from params and assign it to a variable\n page_parts = params[:page][:page_parts_attributes]\n\n # sort the page_parts and reassign it to the params\n params[:page][:page_parts_attributes] = Hash[page_parts.sort]\n\n #creating the page object with its own and child attributes\n @page = Page.new(params[:page])\n\n #retrieving layout id from params and assigning to a variable\n @layout = params[:page][:layout_id]\n\n # calling method to find all pages and page parts\n find_pages_and_parts(@layout)\n\n # sends the data in different formats\n respond_to do |format|\n\n if @page.save #page saved successfully\n\n format.html { redirect_to admin_pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n\n else #page saving failed, re-render the form\n\n format.html { render action: \"new\", :template => 'mcms_pages/admin/pages/new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n\n end # end if\n\n end # end respond_to block\n\n end",
"def create\n @bikepart = Bikepart.new(bikepart_params)\n\n respond_to do |format|\n if @bikepart.save\n format.html { redirect_to @bikepart, notice: 'Bikepart was successfully created.' }\n format.json { render :show, status: :created, location: @bikepart }\n else\n format.html { render :new }\n format.json { render json: @bikepart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n @part_detail = PartDetail.new(params[:part_detail])\n\n respond_to do |format|\n if @part_detail.save\n flash[:notice] = 'PartDetail was successfully created.'\n format.html { redirect_to(@part_detail) }\n format.xml { render :xml => @part_detail, :status => :created, :location => @part_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @part_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.new(params[:toyota_epc_part_number_list_child])\n\n respond_to do |format|\n if @toyota_epc_part_number_list_child.save\n format.html { redirect_to @toyota_epc_part_number_list_child, :notice => 'Part number list child was successfully created.' }\n format.json { render :json => @toyota_epc_part_number_list_child, :status => :created, :location => @toyota_epc_part_number_list_child }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @toyota_epc_part_number_list_child.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def part_order_params\n params.require(:part_order).permit(:part_name, :part_description, :status, :delivery_date, :vendor_id, :po_number, :vendor, :vendor_contact, :vendor_address, :quantity, :total, part_items_attributes: [:id, :description, :name, :quantity, :received, :rate, :_destroy])\n end",
"def multipart_build(params, boundary)\n flat = []\n flatten_hash(params) do | keys, value |\n if keys[-1].nil? # warn the user that Camping will never see that\n raise Mosquito::SageAdvice, \n \"Camping will only show you the last element of the array when using multipart forms\"\n end\n \n flat_key = [esc(keys.shift), keys.map{|k| \"[%s]\" % esc(k) }].flatten.join\n if value.respond_to?(:original_filename)\n flat << uploaded_file_segment(flat_key, value, boundary)\n else\n flat << conventional_segment(flat_key, value, boundary)\n end\n end\n flat.sort.join(\"\")+\"--#{boundary}--\\r\"\n end",
"def auto_part_params\n params.require(:auto_part).permit(:name, :description, :price, :vehicle_make, :vehicle_model)\n end",
"def post_attachment_params\n json = params.require(:post_attachment)\n { posting_id: JSON.parse(json).permit(:posting_id), image: JSON.parse(json).permit(:original_filename)}\n #params.require(:post_attachment).permit(:posting_id, :image, :description )\n end",
"def post(path, params)\n parse_response @client[path].post(params)\n end",
"def create\n @medium_body_part_inv = MediumBodyPartInv.new(params[:medium_body_part_inv])\n\n respond_to do |format|\n if @medium_body_part_inv.save\n format.html { redirect_to @medium_body_part_inv, notice: 'Medium body part inv was successfully created.' }\n format.json { render json: @medium_body_part_inv, status: :created, location: @medium_body_part_inv }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_body_part_inv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bikepart_params\n params.require(:bikepart).permit(:product_name, :description, :image_url)\n end",
"def index\n story_parts_words = {}\n story_parts = StoryPart.where(params[:story_id])\n # iterate through story parts to find word. Create story_part/word association to be passed into json data\n story_parts.each do |story_part|\n story_word_array = []\n story_word_array.push(story_part)\n story_word_array.push(story_part.word)\n story_parts_words[story_part.id] = story_word_array\n end\n \n render :json => story_parts_words\n end",
"def create\n @partida = Partida.new(partida_params)\n\n respond_to do |format|\n if @partida.save\n format.html { redirect_to @partida, notice: 'Partida was successfully created.' }\n format.json { render :show, status: :created, location: @partida }\n else\n format.html { render :new }\n format.json { render json: @partida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def part_detail_params\n params.require(:part_detail).permit(:price_cents, :negotiabel, :quantity, :company_part_id)\n end",
"def multipart_post(path, options={})\n make_http_request(path, options) do |path|\n request = Net::HTTP::Post.new(path)\n bodies = [yield(path)]\n delimiter = create_mime_delimiter\n request['Content-Type'] = \"multipart/form-data; boundary=\\\"#{delimiter}\\\"\"\n separator = \"\\r\\n--#{delimiter}\\r\\n\"\n request.body = \"\\r\\n#{separator}#{bodies.join(separator)}\\r\\n--#{delimiter}--\\r\\n\"\n request['Content-Length'] = request.body.length.to_s # will need to change to bytesize for 1.9\n request\n end\n end",
"def new\n @used_part = UsedPart.new\n prepFormVariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @used_part}\n end\n end",
"def multipart_post(path, params = {}, env = {}, &block)\n env[:request_method] = \"POST\"\n env[:test_with_multipart] = true\n mock_request(path, params, env, &block)\n end",
"def create_test_page(options = {})\n no_part = options.delete(:no_part)\n page = super(options)\n unless no_part\n part = PagePart.new part_params(:name => 'body', :content => 'test')\n page.parts << part\n page.save\n part.save\n end\n page\n end",
"def job_part_params\n params.require(:job_part).permit(:job_id, :part_id, :quantity)\n end",
"def create\n @tool_part = ToolPart.new(params[:tool_part])\n\n respond_to do |format|\n if @tool_part.save\n format.html { redirect_to @tool_part, notice: I18n.t('controllers.create_success', name: @tool_part.class.model_name.human) }\n format.json { render json: @tool_part, status: :created, location: @tool_part }\n format.xml { render xml: @tool_part, status: :created, location: @tool_part }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tool_part.errors, status: :unprocessable_entity }\n format.xml { render xml: @tool_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_part_params\n params.fetch(:document_part, {}).permit!\n end",
"def post_json(path, body)\n url = [base_url, path].join\n resp = HTTParty.post(url, headers: standard_headers, body: body.to_json)\n parse_json(url, resp)\n end",
"def destroy\n @post_part.destroy\n respond_to do |format|\n format.html { redirect_to post_parts_url, notice: 'Post part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.65953344",
"0.6349316",
"0.6316498",
"0.62887037",
"0.6256853",
"0.6085176",
"0.6083",
"0.5998084",
"0.59869564",
"0.5984582",
"0.5923192",
"0.5888448",
"0.58645827",
"0.58626896",
"0.5847761",
"0.5845177",
"0.5843476",
"0.57635933",
"0.5706779",
"0.56969863",
"0.56921834",
"0.5652169",
"0.5635397",
"0.5634573",
"0.56275785",
"0.55795664",
"0.55717784",
"0.5564403",
"0.5563394",
"0.5562767",
"0.55563116",
"0.5521848",
"0.54903966",
"0.54705334",
"0.5468633",
"0.5468424",
"0.5466359",
"0.545347",
"0.54529315",
"0.54516",
"0.544419",
"0.5439564",
"0.5431526",
"0.5425284",
"0.5424426",
"0.54172367",
"0.54113764",
"0.5410277",
"0.54088694",
"0.53991795",
"0.53876644",
"0.5375282",
"0.53646773",
"0.5352202",
"0.53498226",
"0.5341194",
"0.53380245",
"0.5336453",
"0.5332291",
"0.5332291",
"0.5332291",
"0.5322167",
"0.5319383",
"0.53055376",
"0.5295384",
"0.5276921",
"0.5274559",
"0.52694595",
"0.5261392",
"0.52487",
"0.52473253",
"0.5241379",
"0.52375674",
"0.52315915",
"0.52268076",
"0.52211255",
"0.5214379",
"0.5208566",
"0.51816374",
"0.5180715",
"0.5180459",
"0.5171043",
"0.51702034",
"0.5166661",
"0.5135121",
"0.5133826",
"0.51173335",
"0.5113775",
"0.51116896",
"0.51072025",
"0.5106921",
"0.50933325",
"0.5091713",
"0.5086564",
"0.508083",
"0.5080763",
"0.50710535",
"0.50653255",
"0.5061618",
"0.5060328"
] |
0.7007685
|
0
|
PATCH/PUT /post_parts/1 PATCH/PUT /post_parts/1.json
|
def update
respond_to do |format|
if @post_part.update(post_part_params)
format.html { redirect_to @post_part, notice: 'Post part was successfully updated.' }
format.json { render :show, status: :ok, location: @post_part }
else
format.html { render :edit }
format.json { render json: @post_part.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @part = Part.find(params[:id])\n\n respond_to do |format|\n if @part.update_attributes(params[:part])\n format.html { redirect_to @part, :notice => 'Part was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @part.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @part = @product.parts.find(params[:id])\n\n respond_to do |format|\n if @part.update_attributes(params[:part])\n format.html { redirect_to [@product,@part], notice: 'Part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @part = Part.find(params[:id])\n\n respond_to do |format|\n if @part.update_attributes(params[:part])\n format.html { redirect_to @part, notice: 'Part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to chaper_path(@chaper), notice: 'Part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: chaper_path(@chaper).errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:part][:image_url] = Cloudinary::Uploader.upload(params[:part][:image])[\"url\"] if params[:part][:image]\n params[:part][:pdf_url] = Cloudinary::Uploader.upload(params[:part][:pdf])[\"url\"] if params[:part][:pdf]\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to \"/parts?search=#{@part.part_number}\", notice: 'Part was successfully updated.' }\n format.json { render :show, status: :ok, location: @part }\n else\n format.html { render :edit }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @part\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to @part, notice: 'Part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @body = args[:body] unless args[:body].nil?\n @filename = args[:filename] unless args[:filename].nil?\n @headers = args[:headers] unless args[:headers].nil?\n @mime_type = args[:mime_type] unless args[:mime_type].nil?\n @part_id = args[:part_id] unless args[:part_id].nil?\n @parts = args[:parts] unless args[:parts].nil?\n end",
"def update\n respond_to do |format|\n if @singlepart.update(singlepart_params)\n format.html { redirect_to @singlepart, notice: 'Singlepart was successfully updated.' }\n format.json { render :show, status: :ok, location: @singlepart }\n else\n format.html { render :edit }\n format.json { render json: @singlepart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize @part\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to @part, notice: 'Part was successfully updated.' }\n format.json { render :show, status: :ok, location: @part }\n else\n format.html { render :edit }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @medium_body_part = MediumBodyPart.find(params[:id])\n\n respond_to do |format|\n if @medium_body_part.update_attributes(params[:medium_body_part])\n format.html { redirect_to @medium_body_part, notice: 'Medium body part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_body_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:job_id])\n @part = @job.parts.find(params[:id])\n\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to edit_job_path(@job.id), notice: 'Part was successfully updated.' }\n format.json { render :show, status: :ok, location: @part }\n else\n format.html { render edit_job_part_path(@job) }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @part_detail.update(part_detail_params)\n format.html { redirect_to @part_detail, notice: 'Part detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @part_detail }\n else\n format.html { render :edit }\n format.json { render json: @part_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n old_post = Post.find(params[:id])\n\n if post_params[:upload_file]\n data = post_params.delete(:upload_file)\n file_content = data.read.force_encoding(\"UTF-8\");\n post_params[:content] << file_content\n end\n\n if old_post.content == post_params[:content]\n save_success = old_post.update_attributes(post_params)\n @post = old_post\n else\n @post = old_post.create_version(post_params)\n save_success = @post.save\n unless save_success\n old_post.errors = @post.errors\n @post = old_post\n end\n end\n\n respond_to do |format|\n if save_success\n format.html {\n redirect_to @post, notice: 'New version of snippet was created.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @auto_part.update(auto_part_params)\n format.html { redirect_to @auto_part, notice: 'Auto part was successfully updated.' }\n format.json { render :show, status: :ok, location: @auto_part }\n else\n format.html { render :edit }\n format.json { render json: @auto_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if can?(:>=, \"3\")\n @cup_count = params[:cup_count].to_boolean\n @part = Kitting::Part.find(params[:id])\n if @part.name.blank? || @part.prime_pn.blank?\n get_part_name_rbo = get_part_numbers current_user, params[:part][:part_number].try(:upcase)\n @get_part_name = get_part_name_rbo['partName'] || \"\"\n @part.update_attribute(:name, @get_part_name)\n @part.update_attribute(:prime_pn, get_part_name_rbo[\"primePNList\"].reject(&:blank?).first)\n end\n\n respond_to do |format|\n if @part.update_attributes(params[:part])\n format.html { redirect_to(@part,:notice => \"Part #{@part.part_number} is updated successfully.\") }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @part.errors,\n :status => :unprocessable_entity }\n end\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def update\n @part = Part.find(params[:id])\n\n respond_to do |format|\n if @part.update_attributes(params[:part])\n format.html { redirect_to(admin_part_path(@part), :notice => 'Part was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @part.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subpart.update(subpart_params)\n format.html { redirect_to @subpart, notice: 'Subpart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subpart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to @part, notice: 'Part was successfully updated.' }\n format.json { render :show, status: :ok, location: @part }\n else\n format.html { render :edit }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pic.update(part_update_params)\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { render :show, status: :ok, location: @pic }\n else\n format.html { render :edit }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @story_part.update(story_part_params)\n format.html { redirect_to @story_part, notice: 'Story part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.put('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end",
"def update\n\t\t@part = Part.find(params[:id])\n# \t\t@product = Product.find(@part.product_id)\n\t\t@supplier = Supplier.find(@part.supplier_id)\n\t\t\n\t\trespond_to do |format|\n\t\tif @part.update_attributes(params[:part])\n\t\t\tformat.html { redirect_to @supplier, notice: t('actions.part.notice.updated') }\n\t\t\tformat.json { head :no_content }\n\t\telse\n\t\t\tformat.html { render action: \"edit\" }\n\t\t\tformat.json { render json: @part.errors, status: :unprocessable_entity }\n\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to @part, notice: 'Part was successfully updated.' }\n format.json { render :show, status: :ok, location: @part }\n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end",
"def update\n @post.short_body = post_params[:body].split('</p>')[0] + '</p>'\n @post.tags.delete_all\n set_tags\n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @theoretical_part.update_attributes(params[:theoretical_part])\r\n format.html { redirect_to @theoretical_part, notice: 'Theoretical part was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @theoretical_part.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @answer.post.update(embedded_post_params)\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image_to_part.update(image_to_part_params)\n format.html { redirect_to @image_to_part, notice: 'Image to part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image_to_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def set_post_part\n @post_part = PostPart.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @slashdot_posting.update(slashdot_posting_params)\n format.html { redirect_to @slashdot_posting, notice: 'Slashdot posting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slashdot_posting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def update\n respond_to do |format|\n if @part_attribute.update(part_attribute_params)\n format.html { redirect_to @part_attribute, notice: 'Part attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @part_attribute }\n else\n format.html { render :edit }\n format.json { render json: @part_attribute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page_chunk = PageChunk.find(params[:id])\n #TODO: Not sure why \"undefined\" is a key.\n #TODO: multiple editable section on one page not working; the content for the last\n # is always \n @page_chunk.content = params[:content][:undefined][:value]\n @page_chunk.save!\n\n render text: \"\"\n=begin\n respond_to do |format|\n if @page_chunk.update(page_chunk_params)\n format.html { redirect_to @page_chunk, notice: 'Page chunk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page_chunk.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def update\n respond_to do |format|\n if @parts_for_proposal.update(parts_for_proposal_params)\n curr_id = @parts_for_proposal.proposal_id\n format.html { redirect_to proposal_url(:id => curr_id), notice: 'Part configuration update was successfull.' }\n format.json { render :show, status: :ok, location: @parts_for_proposal }\n else\n format.html { render :edit }\n format.json { render json: @parts_for_proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @part_types = Constants::PART_TYPES\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pre_step = PreStep.find(params[:id])\n\n respond_to do |format|\n if @pre_step.update_attributes(params[:pre_step])\n format.html { redirect_to @pre_step, notice: 'Pre step was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n \n @previous_content = @post[:content]\n respond_to do |format|\n if @post.update_attributes(params[:post])\n \t\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n respond_with Post.update(params[:id],post_params)\n end",
"def update\n return request_aes_key if decrypt_sym!(:post).nil?\n pp = post_params\n pp[:tags] = pp[:tags].split(/,\\s*/) if pp[:tags].is_a? String\n\n respond_to do |format|\n if @post.update(pp)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @medium_body_part_inv = MediumBodyPartInv.find(params[:id])\n\n respond_to do |format|\n if @medium_body_part_inv.update_attributes(params[:medium_body_part_inv])\n format.html { redirect_to @medium_body_part_inv, notice: 'Medium body part inv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_body_part_inv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @derived_struct_data = args[:derived_struct_data] if args.key?(:derived_struct_data)\n @id = args[:id] if args.key?(:id)\n @json_data = args[:json_data] if args.key?(:json_data)\n @name = args[:name] if args.key?(:name)\n @parent_document_id = args[:parent_document_id] if args.key?(:parent_document_id)\n @schema_id = args[:schema_id] if args.key?(:schema_id)\n @struct_data = args[:struct_data] if args.key?(:struct_data)\n end",
"def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end",
"def partial_update_object(object, objectID = nil, create_if_not_exits = true, request_options = {})\n client.post(Protocol.partial_object_uri(name, get_objectID(object, objectID), create_if_not_exits), object.to_json, :write, request_options)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @parts = args[:parts] if args.key?(:parts)\n @times_added_count = args[:times_added_count] if args.key?(:times_added_count)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @parts = args[:parts] if args.key?(:parts)\n @times_added_count = args[:times_added_count] if args.key?(:times_added_count)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n # respond_to do |format|\n # if @kitchen.update_attributes(post_params)\n # format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @kitchen.errors, status :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @company_part.update(company_part_params)\n format.html { redirect_to company_parts_path, notice: 'Company part was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_part }\n else\n format.html { render :edit }\n format.json { render json: @company_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n req.patch?\n end",
"def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n @service.add_parts(params[:parts])\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end",
"def update\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n \n if @cookbook.update_attributes_individually params[:cookbook]\n flash[:notice] = 'The template was updated.'\n end\n respond_to do |format|\n format.js { render :update, content_type: \"text/plain\" }\n end\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def update!(**args)\n @http_body = args[:http_body] if args.key?(:http_body)\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def update!(**args)\n @body_location = args[:body_location] if args.key?(:body_location)\n @chunk_number = args[:chunk_number] if args.key?(:chunk_number)\n @content_range = args[:content_range] if args.key?(:content_range)\n @e_tag = args[:e_tag] if args.key?(:e_tag)\n @fetch_id = args[:fetch_id] if args.key?(:fetch_id)\n @is_final_response = args[:is_final_response] if args.key?(:is_final_response)\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend",
"def patch_params\n params.require(:post_comment).permit(:body).\n merge!({\"updated_by\" => current_user})\n end",
"def update\n @part_name = PartName.find(params[:id])\n\n respond_to do |format|\n @part_name.assign_attributes(params.require(:part_name).permit(:name))\n parok = validatePartName?(@part_name)\n okUrl, errAction = setSaveAction('edit', part_names_url)\n saveok = false\n if parok\n saveok = @part_name.save\n end\n if parok and saveok\n format.html { redirect_to okUrl,\n notice: 'PartName was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: errAction }\n format.json { render json: @part_name.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def post_part_params\n params.require(:post_part).permit(:heading, :body, :price, :neighborhood, :external_url, :timestamp)\n end",
"def update\n respond_to do |format|\n if @tool_part.update_attributes(params[:tool_part])\n format.html { redirect_to @tool_part, notice: I18n.t('controllers.update_success', name: @tool_part.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tool_part.errors, status: :unprocessable_entity }\n format.xml { render xml: @tool_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_params\n #json_data = request.raw_post()\n #params.require(:reference_number).permit(:name, :email, :twitter)\n params.permit(:dependents)\n end",
"def update!(**args)\n @app_engine_routing = args[:app_engine_routing] if args.key?(:app_engine_routing)\n @body = args[:body] if args.key?(:body)\n @headers = args[:headers] if args.key?(:headers)\n @http_method = args[:http_method] if args.key?(:http_method)\n @relative_uri = args[:relative_uri] if args.key?(:relative_uri)\n end",
"def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def patch\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.patch do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end",
"def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end",
"def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n respond_to do |format|\n if @part_inst.update(part_inst_params)\n log( \"Part instance is adjusted\", @user )\n \n format.html { redirect_to @part_inst, notice: 'Part inst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @part_inst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def part_params\n params.require(:part).permit(:name, :body, :user_id)\n end",
"def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @part_order.update(part_order_params)\n format.html { redirect_to part_order_receipt_path(@part_order), notice: \"Part order was successfully updated.\" }\n format.json { render :show, status: :ok, location: @part_order }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @part_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_update_params\n params.require(:post).permit(:content)\n end",
"def update\n\n if params[:commit] == 'Submit Post To Class' \n @post.submitted = true\n @post.draft2 = @post.draft1\n end\n \n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to edit_post_path(@post), notice: 'Post was successfully updated.' }\n format.json { render :edit, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n @vendor_part = VendorPart.find(params[:id])\n\n respond_to do |format|\n if @vendor_part.update_attributes(params[:vendor_part])\n format.html { redirect_to @vendor_part, :notice => 'Vendor part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vendor_part.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @document_part.update(document_part_params)\n redirect_to admin_document_path(@document), notice: 'Content was successfully updated.'\n else\n render :edit\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update\n @post = Post.find(params[:id])\n\n params[:post][:steps] = \"\"\n if params[:post][:step] \n params[:post][:step].each do |k, v|\n if params[:post][:step].length == k.to_i\n params[:post][:steps] << v\n else\n params[:post][:steps] << v + '|'\n end\n end\n end\n params[:post].delete(\"step\")\n\n if @post.update_attributes(params[:post])\n flash[:success] = 'Post was successfully created.'\n redirect_to @post \n else\n render action: \"edit\"\n end\n end"
] |
[
"0.63045335",
"0.62945646",
"0.62745637",
"0.6199231",
"0.6176063",
"0.614541",
"0.6142998",
"0.6119238",
"0.6098641",
"0.6059295",
"0.60423285",
"0.6035777",
"0.5911059",
"0.59043455",
"0.5902983",
"0.5900299",
"0.5880431",
"0.58686185",
"0.58664715",
"0.5860878",
"0.5857453",
"0.5849426",
"0.58409333",
"0.58403194",
"0.58197457",
"0.57739955",
"0.57714576",
"0.576183",
"0.57566744",
"0.5756376",
"0.5756376",
"0.5750239",
"0.5739532",
"0.57043004",
"0.5697217",
"0.5681489",
"0.5676721",
"0.5650299",
"0.56489307",
"0.5642377",
"0.56406516",
"0.5617274",
"0.56078196",
"0.56057894",
"0.55958337",
"0.55858845",
"0.5577338",
"0.5558286",
"0.5544027",
"0.5542256",
"0.5539068",
"0.55284256",
"0.5524834",
"0.5524771",
"0.5520602",
"0.5513551",
"0.55114055",
"0.55083567",
"0.55058956",
"0.5498422",
"0.5477725",
"0.5476968",
"0.5467753",
"0.5453583",
"0.5444418",
"0.54403836",
"0.54380554",
"0.54366153",
"0.5432631",
"0.54295206",
"0.5426485",
"0.54255813",
"0.54247147",
"0.5421132",
"0.5410095",
"0.5406226",
"0.54050434",
"0.5397994",
"0.53947634",
"0.5393742",
"0.5387135",
"0.53868383",
"0.5385042",
"0.53695035",
"0.53691185",
"0.53683317",
"0.53671175",
"0.5366464",
"0.53602225",
"0.53551924",
"0.5355121",
"0.5351965",
"0.5345008",
"0.53447586",
"0.5336665",
"0.5330436",
"0.5329468",
"0.53287697",
"0.5328056",
"0.53257924"
] |
0.68431634
|
0
|
DELETE /post_parts/1 DELETE /post_parts/1.json
|
def destroy
@post_part.destroy
respond_to do |format|
format.html { redirect_to post_parts_url, notice: 'Post part was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @medium_body_part = MediumBodyPart.find(params[:id])\n @medium_body_part.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_body_parts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part = Part.find(params[:id])\n @part.destroy\n\n respond_to do |format|\n format.html { redirect_to parts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part = Part.find(params[:id])\n @part.destroy\n\n respond_to do |format|\n format.html { redirect_to parts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @singlepart.destroy\n respond_to do |format|\n format.html { redirect_to singleparts_url, notice: 'Singlepart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subpart.destroy\n respond_to do |format|\n format.html { redirect_to subparts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_to_part.destroy\n respond_to do |format|\n format.html { redirect_to image_to_parts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part.destroy\n respond_to do |format|\n format.html { redirect_to chaper_path(@chaper) }\n format.json { head :no_content }\n end\n end",
"def destroy\n story_part_id = @story_part.id\n @story_part.destroy\n render :json => story_part_id\n end",
"def destroy\n @part.destroy\n respond_to do |format|\n format.html { redirect_to parts_url, notice: 'Part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part.destroy\n respond_to do |format|\n format.html { redirect_to parts_url, notice: 'Part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @partextra.destroy\n respond_to do |format|\n format.html { redirect_to extras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part = @product.parts.find(params[:id])\n @part.destroy\n\n respond_to do |format|\n format.html { redirect_to product_parts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part = Part.find(params[:id])\n @part.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_parts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auto_part.destroy\n respond_to do |format|\n format.html { redirect_to auto_parts_url, notice: 'Auto part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_post\n\t \n \tend",
"def destroy\n @part_detail.destroy\n respond_to do |format|\n format.html { redirect_to part_details_url, notice: 'Part detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json do\n render :json => { :notice => \"Snippet deleted\" }\n end\n end\n end",
"def destroy\n post = @post_block.post\n @post_block.destroy\n respond_to do |format|\n format.html { redirect_to url_for(controller: 'cm/post_blocks', action: :index, post_id: post.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n @theoretical_part.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to theoretical_parts_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post413 = Post413.find(params[:id])\n @post413.destroy\n\n respond_to do |format|\n format.html { redirect_to(post413s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @medium_body_part_inv = MediumBodyPartInv.find(params[:id])\n @medium_body_part_inv.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_body_part_invs_url }\n format.json { head :no_content }\n end\n end",
"def delete_file_parts\n #TODO implementation\n end",
"def destroy\n secureEnter @step\n @step.destroy\n respond_to do |format|\n format.html { redirect_to edit_post_path(@step.post.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voice_part = VoicePart.find(params[:id])\n @voice_part.destroy\n\n respond_to do |format|\n format.html { redirect_to voice_parts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post445 = Post445.find(params[:id])\n @post445.destroy\n\n respond_to do |format|\n format.html { redirect_to(post445s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @match_part = MatchPart.find(params[:id])\n @match_part.destroy\n\n respond_to do |format|\n format.html { redirect_to(match_parts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @used_part = UsedPart.find(params[:id])\n @used_part.destroy\n\n respond_to do |format|\n format.html { redirect_to used_parts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_post.destroy\n respond_to do |format|\n format.html { redirect_to admin_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to post_attachments_url, notice: 'Post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part_detail = PartDetail.find(params[:id])\n @part_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(part_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vendor_part = VendorPart.find(params[:id])\n @vendor_part.destroy\n\n respond_to do |format|\n format.html { redirect_to vendor_parts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.find(params[:job_id])\n @part = @job.parts.find(params[:id])\n @part.destroy\n respond_to do |format|\n format.html { redirect_to edit_job_path(@job), notice: 'Part was successfully destroyed.' }\n format.json { head :ok }\n end\n end",
"def destroy\n @post446 = Post446.find(params[:id])\n @post446.destroy\n\n respond_to do |format|\n format.html { redirect_to(post446s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post493 = Post493.find(params[:id])\n @post493.destroy\n\n respond_to do |format|\n format.html { redirect_to(post493s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pre_step = PreStep.find(params[:id])\n @pre_step.destroy\n\n respond_to do |format|\n format.html { redirect_to pre_steps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cultural_heritage_part = CulturalHeritage::Part.find(params[:id])\n @cultural_heritage_part.deleted = 1\n @cultural_heritage_part.save\n\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_parts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post451 = Post451.find(params[:id])\n @post451.destroy\n\n respond_to do |format|\n format.html { redirect_to(post451s_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n @document_part.destroy\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n @part_name = PartName.find(params[:id])\n @part_name.destroy\n\n respond_to do |format|\n format.html { redirect_to part_names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if can?(:>=, \"5\")\n @part = Kitting::Part.find(params[:id])\n @part.destroy\n respond_to do |format|\n format.html { redirect_to parts_url }\n format.json { head :no_content }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def destroy\n @part.destroy\n respond_to do |format|\n format.html { redirect_to [@part.assessment], notice: 'Part was successfully destroyed.' }\n format.json { head :no_content }\n format.js { }\n end\n end",
"def destroy\n @topic = Topic.find(params[:id])\n\n @part_id=@topic.part_id\n @topic.destroy\n\n respond_to do |format|\n format.html { redirect_to '/parts/'+@part_id.to_s }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @portion = Portion.find(params[:id])\n @portion.destroy\n\n respond_to do |format|\n format.html { redirect_to portions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micorpost = Micorpost.find(params[:id])\n @micorpost.destroy\n\n respond_to do |format|\n format.html { redirect_to micorposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = @save.post\n @save.destroy\n respond_to do |format|\n format.html { redirect_to post_url(@post), notice: 'Save was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # binding.pry\n job_id = Part.find(params[:id]).job_id\n @part.destroy\n respond_to do |format|\n format.html { redirect_to job_parts_url(job_id), notice: 'Part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to travel_post_attachments_url, notice: 'Travel post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_file.destroy\n respond_to do |format|\n format.html { redirect_to post_files_url, notice: 'Post file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post139 = Post139.find(params[:id])\n @post139.destroy\n\n respond_to do |format|\n format.html { redirect_to(post139s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post54 = Post54.find(params[:id])\n @post54.destroy\n\n respond_to do |format|\n format.html { redirect_to(post54s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n # find the page with with\n @page = Page.find(params[:id])\n\n # calling class method of PagePart model to delete page parts of a page\n PagePart.delete_page_parts(@page)\n\n #destroy the page\n @page.destroy\n\n #sends in data in different format to index action\n respond_to do |format|\n\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n\n end # end respond_to block\n\n end",
"def destroy\n @post326 = Post326.find(params[:id])\n @post326.destroy\n\n respond_to do |format|\n format.html { redirect_to(post326s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post_entry.destroy\n respond_to do |format|\n format.html { redirect_to post_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bikepart.destroy\n respond_to do |format|\n format.html { redirect_to bikeparts_url, notice: 'Bikepart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def destroy\n @part_order.destroy\n respond_to do |format|\n format.html { redirect_to part_orders_url, notice: \"Part order was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @post419 = Post419.find(params[:id])\n @post419.destroy\n\n respond_to do |format|\n format.html { redirect_to(post419s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @paperpost.destroy\n respond_to do |format|\n format.html { redirect_to paperposts_url, notice: 'Paperpost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_part.destroy\n respond_to do |format|\n format.html { redirect_to company_parts_url, notice: 'Company part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post489 = Post489.find(params[:id])\n @post489.destroy\n\n respond_to do |format|\n format.html { redirect_to(post489s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @svgpost = Svgpost.find(params[:id])\n @svgpost.destroy\n\n respond_to do |format|\n format.html { redirect_to svgposts_url }\n format.json { head :no_content }\n end\n end",
"def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def destroy\n @post436 = Post436.find(params[:id])\n @post436.destroy\n\n respond_to do |format|\n format.html { redirect_to(post436s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n respond_with @post.destroy\n end",
"def destroy\n @postmodernism.destroy\n respond_to do |format|\n format.html { redirect_to postmodernisms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part_attribute.destroy\n respond_to do |format|\n format.html { redirect_to part_attributes_url, notice: 'Part attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post405 = Post405.find(params[:id])\n @post405.destroy\n\n respond_to do |format|\n format.html { redirect_to(post405s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_post_detail.destroy\n respond_to do |format|\n format.html { redirect_to admin_post_details_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post41 = Post41.find(params[:id])\n @post41.destroy\n\n respond_to do |format|\n format.html { redirect_to(post41s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @posto = Posto.find(params[:id])\n @posto.destroy\n\n respond_to do |format|\n format.html { redirect_to postos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part_transaction.destroy\n respond_to do |format|\n format.html { redirect_to part_transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7135184",
"0.7089026",
"0.7049856",
"0.7041977",
"0.69963825",
"0.69424635",
"0.6924231",
"0.689641",
"0.6895302",
"0.6895302",
"0.6882251",
"0.6858963",
"0.6845252",
"0.6836659",
"0.6821784",
"0.675517",
"0.6708233",
"0.6667735",
"0.66397136",
"0.6577632",
"0.6572953",
"0.657294",
"0.6547128",
"0.6540077",
"0.6515584",
"0.65145105",
"0.6499538",
"0.64948153",
"0.64707476",
"0.6468497",
"0.6466372",
"0.64537585",
"0.6442592",
"0.6442249",
"0.64384794",
"0.64369255",
"0.6424095",
"0.6423077",
"0.64146364",
"0.6404784",
"0.6400053",
"0.6395751",
"0.6391663",
"0.6391663",
"0.638963",
"0.63804173",
"0.63798106",
"0.63789153",
"0.63758916",
"0.6374613",
"0.6374253",
"0.6367868",
"0.6360802",
"0.635251",
"0.6351531",
"0.63506615",
"0.63461065",
"0.6335097",
"0.6334752",
"0.63306063",
"0.6329317",
"0.6328497",
"0.632484",
"0.6313254",
"0.63096786",
"0.63076276",
"0.63001364",
"0.6295975",
"0.6293554",
"0.6285628",
"0.6279501",
"0.627834",
"0.6276674",
"0.6272789",
"0.62722456",
"0.6271845",
"0.6270865",
"0.6269724",
"0.62654036",
"0.62632227",
"0.625833",
"0.62498254",
"0.62455714",
"0.62422293",
"0.6241206",
"0.62409776",
"0.62406486",
"0.6239991",
"0.6238316",
"0.62373805",
"0.6236102",
"0.62319165",
"0.6230569",
"0.6230569",
"0.6230569",
"0.6230569",
"0.6230569",
"0.6230569",
"0.6230569",
"0.6230569"
] |
0.75699514
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_post_part
@post_part = PostPart.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def post_part_params
params.require(:post_part).permit(:heading, :body, :price, :neighborhood, :external_url, :timestamp)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Convert the string returned by the server into Date class
|
def due_date
if @values[:due_date] != nil && @values[:due_date] != ""
@date_due_date ||= Date.parse(@values[:due_date])
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_date(string)\n Date.parse(string)\n rescue\n nil\n end",
"def convert_to_date(str_date)\n Date.parse(str_date) if str_date\n end",
"def string_to_date(string)\n super(handle_date_parse_input(string))\n end",
"def d(date_string)\n Date.parse(date_string)\nend",
"def parse_date(date_str)\n new_date = Date.parse(date_str)\nend",
"def date\n Date.parse(@obj['date'])\n end",
"def to_date\n return self.to_i.to_date if self =~ DIGIT_ONLY_REGEX\n if self =~ US_DATE_REGEX\n Date.strptime(self.tr(DATE_TR,'-'), US_DATE_FORMAT)\n elsif self =~ JSON_DATE_REGEX\n json_date_to_time.to_date\n else\n Date.strptime(self.tr(DATE_TR,'-'), ISO_DATE_FORMAT)\n end\n end",
"def date\n parse!\n @date\n end",
"def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end",
"def to_date string\n \n end",
"def parse_date(value)\n ::Date.parse(value)\n end",
"def to_date(date)\n return date if date.is_a?(Date)\n Date.parse(date)\n end",
"def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end",
"def date\n Date.parse(@data['date'])\n end",
"def parse_date(string)\n Date.strptime(string.to_s, '%m/%d/%Y') rescue nil\n end",
"def typecast_to_primitive(value)\n if value.respond_to?(:to_date)\n value.to_date\n elsif value.is_a?(::Hash) || value.respond_to?(:to_mash)\n typecast_hash_to_date(value)\n else\n ::Date.parse(value.to_s)\n end\n rescue ArgumentError\n value\n end",
"def extract_date(str)\n\t\tDate.strptime(str, '%m/%d/%Y')\n\tend",
"def to_date\n begin\n Date.parse(self)\n rescue => e\n raise Sequel::Error::InvalidValue, \"Invalid date value '#{self}' (#{e.message})\"\n end\n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def convert_day_to_date string\r\n Date.strptime(string.to_s,\"%Y%m%d\")\r\n end",
"def parse_date(date_string)\n result = sugarcube_detect(date_string).first\n if result\n return result.date\n else\n return iso8601(date_string)\n end\n end",
"def ruby_value\n ::Date.parse(@date_time_value.strftime(\"%Y%m%d\"))\n end",
"def parse_date(date)\n Icalendar::Values::DateOrDateTime.new(date)\n end",
"def entity_date(str)\n Time.at(str[/\\d{6,}/].to_i / 1000)\n end",
"def typecast_to_date(value)\n if value.kind_of?(Hash)\n typecast_hash_to_date(value)\n else\n Date.parse(value.to_s)\n end\n end",
"def to_date\n @to_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end",
"def to_date\n @to_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end",
"def typecast_to_date(value)\n if value.is_a?(Hash)\n typecast_hash_to_date(value)\n elsif value.is_a?(Time) # sometimes people think date is time!\n value.to_date\n elsif value.to_s =~ /ˆ(\\d{4})[\\-|\\/](\\d{2})[\\-|\\/](\\d{2})$/\n # Faster than parsing the date\n Date.new($1.to_i, $2.to_i, $3.to_i)\n else\n Date.parse(value)\n end\n rescue ArgumentError\n nil\n end",
"def convert_to_date(string)\n return nil if (string.nil? || string.class != String)\n tmp = Chronic.parse(string)\n tmp ? tmp.to_date : nil\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def to_date\n ::Date.parse(self, false) unless blank?\n end",
"def post_process_date( val )\n\t\t\treturn Date.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def date_string_to_object(db_date)\n\n # Current time to get the proper zone\n now = DateTime.now\n\n # Get raw DateTime object\n raw_date = DateTime.strptime(db_date, '%Y-%m-%d %H:%M:%S')\n\n # Get all info needed for the new obj\n year = raw_date.year\n month = raw_date.month\n day = raw_date.day\n hour = raw_date.hour\n min = raw_date.minute\n sec = raw_date.second\n zone = now.zone\n\n # Return the processed date\n date = DateTime.new(year, month, day, hour, min, sec, zone)\n return date\nend",
"def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end",
"def date(string)\n return if string.blank?\n return string if string.is_a?(Date)\n\n Date.parse(string)\n rescue Date::Error\n components = string\n .split(\"-\")\n .map(&:to_i)\n .reject(&:zero?)\n .compact\n\n return if components.empty?\n\n Date.new(*components)\n rescue ArgumentError\n nil\n end",
"def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end",
"def coerce_date(value)\n case value\n when Date\n value\n when String\n Date.parse(value)\n else\n raise ArgumentError, \"expected: Date or String, got: \" +\n value.inspect\n end\n end",
"def parse_date( day )\n day.is_a?(Date) ? day : Date.parse( day.to_s )\n end",
"def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend",
"def convertStrToDate(str, format)\n return Date.strptime(str, format)\nend",
"def parse_date(date_str)\n split = date_str.split('-')\n Date.new(split[0].to_i, split[1].to_i, split[2].to_i)\nend",
"def from_wcf(date_string)\n matchdata = /\\/Date\\((\\d*).*/.match(date_string)\n unix = matchdata[1].to_i/1000\n datetime = Time.at(unix).iso8601\n return datetime\n end",
"def time_converter(string)\n # need to convert to UTC first before converting to date\n date = Time.at(string.to_i).utc.to_date\nend",
"def safe_datetime_string\n safe_date = nil\n if self =~ US_DATE_REGEX\n safe_date = us_date_to_iso_str\n elsif self =~ JSON_DATE_REGEX\n safe_date = json_date_to_time.to_s\n else\n safe_date = self\n end\n safe_date\n end",
"def parse_date(string)\n begin\n Date.parse(string)\n rescue ArgumentError\n nil\n end\n end",
"def typecast_value_date(value)\n case value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when Date\n value\n when String\n Sequel.string_to_date(value)\n when Hash\n Date.new(*[:year, :month, :day].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise InvalidValue, \"invalid value for Date: #{value.inspect}\"\n end\n end",
"def parse_date(date)\n date.to_date\n rescue\n Date.strptime(date, '%m/%d/%Y') rescue nil\n end",
"def date\n if value = self['date']\n begin\n # Rely on Ruby's standard time.rb to parse the time.\n (Time.rfc2822(value) rescue Time.parse(value)).localtime\n rescue\n # Exceptions during time parsing just cause nil to be\n # returned.\n end\n end\n end",
"def parse_date(date_string)\n match = date_string.match(/([0-9]{1,2})\\/([0-9]{1,2})\\/([0-9]{4})/)\n month = match[1].to_i\n day = match[2].to_i\n year = match[3].to_i\n Date.new(year, month, day)\nend",
"def to_date( value )\n effectively_empty( value ) ? nil : Date.parse( value.to_s )\n end",
"def get_date_actualizacion\n Date.strptime(self.fecha_actualizacion,'%s')\n end",
"def match_date( val )\n\t\treturn Date.parse( val ) rescue nil\n\tend",
"def to_date(value)\n if value.nil? or value.strip.empty?\n nil\n else\n Date.strptime(value, date_format)\n end\n end",
"def make_date(input, start, _end, elements)\n value = elements.first\n\n case value\n when String\n DateTime.parse(value)\n when Numeric\n Time.at(value)\n else\n raise ArgumentError,\n \"Internal parser error. Unknown date atom type #{value.class}\"\n end\n end",
"def date_parsed\n if created_at?\n Date.parse(valid_params[\"created_at\"])\n elsif updated_at?\n Date.parse(valid_params[\"updated_at\"])\n end\n end",
"def handle_date_parse_input(string)\n string\n end",
"def parse_date(date)\n parsed = @date_cache[date]\n if parsed\n parsed\n else\n if date =~ /^(\\d{4})(\\d{2})(\\d{2})$/\n parsed = Date.new($1.to_i, $2.to_i, $3.to_i)\n elsif date =~ /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/\n parsed = Date.new($3.to_i, $1.to_i, $2.to_i)\n else\n raise \"unknown format\"\n end\n if :month == date_type\n parsed = Date.new(parsed.year, parsed.month)\n end\n @date_cache[date] = parsed\n end\n end",
"def to_date(value)\n # return(date($this->DateFormat,value))\n end",
"def decode_date(value)\n return nil if value.blank?\n value.is_a?(String) ? value.gsub(' ', '0').to_date : value.to_date\n rescue\n nil\n end",
"def parse_date(date_string)\n selected_format = DATE_FORMATS.select{|date_format| date_string =~ date_format[:format]}[0]\n Date.strptime(date_string, selected_format[:type]) if selected_format\n end",
"def parse_datetime_string\r\n dt = String.new\r\n self.date_of_birth.split('/').each{|x| dt = dt + (x.to_i < 10 ? '0'+ x + '/' : x + \"/\")}\r\n self.date_of_birth = DateTime.strptime(dt, \"%m/%d/%Y/\")\r\n self\r\n end",
"def datetime(date)\n if date.class == String\n date = Time.parse(date)\n end\n date\n end",
"def parse_date\n REGEX_DATE.match(@request[FTIME]) ? Date.parse($1) : nil\n end",
"def convert_date( date )\n\n date_format = '%Y-%m-%d'\n begin\n return DateTime.strptime( date, date_format )\n rescue => e\n return nil\n end\n end",
"def coerce_date(value, options = {})\n value = coerce(value, String)\n begin\n Date.strptime(value, \"%Y-%m-%d\")\n rescue ArgumentError\n nil\n end\n end",
"def date\n date_parser(self[:date])\n end",
"def date\n date_parser(self[:date])\n end",
"def parse_date(date)\n month, day, year = date.split(\"/\")\n\n DateTime.new year.to_i, month.to_i, day.to_i\n end",
"def get_date(d)\n return nil if d.nil?\n return d.to_time if d.is_a? DateTime\n\n if d.is_a? String\n\n begin\n dt = DateTime.parse(d).to_time\n rescue Exception => e\n raise \"invalid param #{d} - date should be in yyyy-mm-dd format\"\n end\n end\n end",
"def parsed_date(date_string, default)\n Date.parse(date_string)\n rescue ArgumentError, TypeError # Help out to find what issue - user typing issues.eg date instead of sentence\n default\n end",
"def string_to_time(string)\n super(handle_date_parse_input(string))\n end",
"def parse_date(str)\n return nil if str.nil? || str.empty?\n return \"#{str}-01-01\" if str =~ /^\\d{4}/\n format = str =~ /^\\d{2}\\./ ? '%d.%m.%Y' : '%m-%d-%Y'\n begin\n return Date.strptime(str, format).to_date\n rescue\n logger.warn \"Failed to parse date [#{str}] with [#{format}] format\"\n return nil\n end\n end",
"def to_datetime\n begin\n DateTime.parse(self)\n rescue => e\n raise Sequel::Error::InvalidValue, \"Invalid date value '#{self}' (#{e.message})\"\n end\n end",
"def make_date(_input, _starts_at, _ends_at, elements)\n value = elements.first\n\n case value\n when String\n _date_from_string(value)\n when Numeric\n Time.at(value)\n else\n raise ArgumentError,\n \"Internal parser error. Unknown date atom type #{value.class}\"\n end\n end",
"def coerce_date(value, options = {})\n value = coerce_string(value)\n begin\n Date.strptime(value, options.fetch(:format, \"%Y-%m-%d\"))\n rescue ArgumentError\n nil\n end\n end",
"def to_class(s)\n if valid_date_time?(s)\n Time.strptime(s, '%Y-%m-%d.%H:%M:%S').to_i\n elsif valid_date?(s)\n Date.strptime(s, '%Y-%m-%d').to_i\n elsif valid_time?(s)\n Time.strptime(s, '%H:%M:%S').to_i\n elsif valid_integer?(s)\n s.to_i\n elsif valid_float?(s)\n s.to_f\n else\n s\n end\n end",
"def parse_date(date_string)\n datetime = Time.zone.parse(date_string) if date_string.present?\n return datetime.to_date unless datetime.nil?\n nil\n end",
"def parse_date(date)\n date = DateTime.parse(date.to_s)\n rescue ArgumentError\n raise ArgumentError, \"#{date} is not a valid date\"\n end",
"def _date_parse(string)\n super(handle_date_parse_input(string))\n end",
"def parse_date(date_string)\n datetime = Time.zone.parse(date_string) if date_string.present?\n return datetime.to_date unless datetime.nil?\n nil\n end",
"def change_date(date)\n require 'date'\n date = DateTime.parse(date)\nend",
"def date(date)\n Date.strptime(date,\"%m/%d/%y\")\n rescue ArgumentError => e \n raise unless e.to_s =~ /invalid date/\n raise BadTime, e.to_s\n end",
"def decode_json(json_str)\n convert_dates_from(JSON.parse(json_str, symbolize_names: true))\n end",
"def parse_date_str (d)\r\n\t\t## Preconditions:\r\n\t\t# check format of date\r\n\t\tdate_arr = d.split(DATE_SPLIT_REGEX)\r\n\t\trtassert(date_arr.size() == 3, ArgumentError,\r\n\t\t\t\"cant recognise format of date '#{d}'\")\r\n\t\t# convert to hyphens as Ruby gets confused with slashes\r\n\t\tdate_str = date_arr.join('-')\r\n\t\t## Main:\r\n\t\t# try each of the supplied date formats\r\n\t\tDATE_FMTS.each { |fmt|\r\n\t\t\tbegin\r\n\t\t\t\tdate_obj = Date.strptime(date_str, fmt)\r\n\t\t\t\treturn date_obj\r\n\t\t\trescue ArgumentError\r\n\t\t\t\t# pass\r\n\t\t\tend\r\n\t\t}\r\n\t\t# try a brute force approach\r\n\t\tbegin\r\n\t\t\tdate_obj = Date.parse(date_str)\r\n\t\t\treturn date_obj \r\n\t\trescue\r\n\t\t\tpp date_arr\r\n\t\t\traise ArgumentError, \"can't recognise format of date '#{d}'\" \r\n\t\tend\r\n\tend",
"def set_date_string(input)\n\n now = Time.new\n date = Time.new\n\n #Handle minute notation.\n if input.downcase[-1] == \"m\" then\n date = now - (60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle hour notation.\n if input.downcase[-1] == \"h\" then\n date = now - (60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle day notation.\n if input.downcase[-1] == \"d\" then\n date = now - (24 * 60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle PowerTrack format, YYYYMMDDHHMM\n if input.length == 12 and numeric?(input) then\n return input\n end\n\n #Handle \"YYYY-MM-DD 00:00\"\n if input.length == 16 then\n return input.gsub!(/\\W+/, '')\n end\n\n #Handle ISO 8601 timestamps, as in Twitter payload \"2013-11-15T17:16:42.000Z\"\n if input.length > 16 then\n date = Time.parse(input)\n return get_date_string(date)\n end\n\n return 'Error, unrecognized timestamp.'\n\n end",
"def date_value\n Time.parse(value) if value.present?\n end",
"def typecast_hash_to_date(value)\n ::Date.new(*extract_time(value)[0, 3])\n end",
"def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end",
"def parse_iso_8601_date(string)\n if string =~ ISO_8601_DATE\n Date.parse(string) rescue nil\n end\n end",
"def coerce_date(value, options = {})\n value = coerce_string(value, options)\n return if value.nil?\n begin\n Date.strptime(value, \"%Y-%m-%d\")\n rescue ArgumentError\n nil\n end\n end",
"def parse_date(input, msg = T.unsafe(nil)); end",
"def datetime_data(object)\n return object unless object.present?\n\n DateTime.strptime(object, '%Y-%m-%d').to_s\n rescue ArgumentError => e\n rescue_and_retry_datetime(object, e)\n end",
"def convertDate(date)\n dateHash = date\n dateFormat = Date.parse dateHash\n dateString = dateFormat.strftime('%A, %b %d')\n return dateString \nend",
"def parse_date(content)\n return content.lstrip.rstrip\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end",
"def start_date_as_date\n return USDateParse(self.start_date)\n end",
"def parsed_start_date\n Date.parse(start_date)\n end"
] |
[
"0.7291145",
"0.72274095",
"0.7181739",
"0.71117675",
"0.69330734",
"0.6898816",
"0.68822765",
"0.6876746",
"0.6817308",
"0.6772966",
"0.6750544",
"0.67447513",
"0.6712245",
"0.6660963",
"0.6608982",
"0.6604013",
"0.6586998",
"0.65821093",
"0.6576907",
"0.6576907",
"0.6562331",
"0.65390253",
"0.65296304",
"0.6525107",
"0.6502382",
"0.65016496",
"0.6477251",
"0.64685637",
"0.64663386",
"0.64424926",
"0.6422875",
"0.6422875",
"0.6420142",
"0.64011824",
"0.63883525",
"0.63628364",
"0.6357369",
"0.633312",
"0.6321503",
"0.6308454",
"0.6305576",
"0.62931144",
"0.6292814",
"0.628598",
"0.6285782",
"0.6280242",
"0.6279927",
"0.6269289",
"0.62305975",
"0.62289727",
"0.6227817",
"0.62271357",
"0.6224889",
"0.62159985",
"0.62083817",
"0.61974406",
"0.6191102",
"0.6185862",
"0.6184904",
"0.6151007",
"0.61389697",
"0.6132798",
"0.6107267",
"0.61027366",
"0.61022",
"0.6091641",
"0.6085582",
"0.60846025",
"0.60846025",
"0.60771525",
"0.60611296",
"0.6053759",
"0.60425043",
"0.6027553",
"0.60219663",
"0.6015973",
"0.60058016",
"0.599252",
"0.5991841",
"0.5991693",
"0.5981946",
"0.59798807",
"0.59696966",
"0.5963648",
"0.5962404",
"0.5957206",
"0.59535813",
"0.5946913",
"0.59376806",
"0.59354174",
"0.59230924",
"0.5922491",
"0.59216744",
"0.5913359",
"0.59051555",
"0.5903325",
"0.5900302",
"0.5900302",
"0.5898952",
"0.589329",
"0.5882689"
] |
0.0
|
-1
|
check if user is last active admin user
|
def before_destory
if User.count(:all, :conditions => ["is_superuser = 1 and active = 1"]) <= 1
errors.add_to_base "Cannot delete #{self.username.upcase} because it is the last admin user"
return false
else
return true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_last_admin?(user)\r\n fail \"Missing user\" if (user == nil)\r\n\r\n is_admin?(user) && self.admin_count == 1\r\n end",
"def last_admin?\n admin_was && self.class.count(:all, :conditions => { :admin => true }) == 1\n end",
"def last_admin?\n num_admins = Person.count(:conditions => [\"admin = ? AND deactivated = ?\",\n true, false])\n admin? and num_admins == 1\n end",
"def is_last_admin?\n count = 0\n users = Chef::WebUIUser.list\n users.each do |u, url|\n user = Chef::WebUIUser.load(u)\n if user.admin\n count = count + 1\n return false if count == 2\n end\n end\n true\n end",
"def admin_user\n # get current user for session and check if they are an administrator\n check_admin_user = current_user\n return check_admin_user.admin?\n end",
"def admin_user?\n session[:user][:uid] == APP_CONFIG[:admin]\n end",
"def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def current_user_is_admin\n\t\ttrue if current_user.admin == 't'\n\tend",
"def admin_user\n (current_user.present? && current_user.admin?)\n end",
"def admin_user\n @current_user.admin?\n end",
"def admin?\n self == User.first\n end",
"def current_admin?(user)\n current_user.admin?\n end",
"def current_admin?(admin)\n admin == current_admin\n end",
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end",
"def is_admin?(user)\n user.admin > 0\n end",
"def user?(admin)\n admin&.id == self.admin_id\n end",
"def admin_user?\n (current_user.role == 'admin') if logged_in?\n end",
"def is_admin?\n current_user ? current_user.login == 'admin' : false\n end",
"def current_user_admin?\n current_user && current_user.admin?\n end",
"def is_admin\n user = UserAdmin.find_by_user_id(current_user.id)\n if user and user.level > 1\n return true || false\n end\n end",
"def avoid_to_demote_last_admin\n if User.where(admin: true).size == 1 && !self.admin && self.admin_was\n raise LastAdminError\n end\n end",
"def admin?\n if(@current_user)\n @current_user.admin?\n end\n end",
"def is_user_admin?\n user_active && user_active.permission_level == 2\n end",
"def user_is_admin?\n\tbegin\n\t `gpresult /r /scope user`.split.include? \"Admin\"\n\trescue\n\t false\n\tend\n end",
"def check_admin\n # using the function above by grabbing the id\n @current_user = find_current_user\n # cross checking to see if user is also an admin\n unless @current_user.present? and @current_user.is_admin?\n #they're find so no additional code needed\n #if they're not admin\n redirect_to root_path\n end\n end",
"def isuseradmin?\n if $credentials != nil\n isadminornot = User.where(:username => $credentials[0]).to_a.first\n @adminuser = \"#{isadminornot.username}\"\n if @adminuser == \"Admin\"\n return true\n else \n return false\n end\n end\n end",
"def logged_admin?\n !current_admin.nil?\n end",
"def admin_user?\n current_user.admin\n end",
"def admin_logged_in?\n User.admin_logged_in?\n end",
"def admin_logged_in?\n User.admin_logged_in?\n end",
"def admin?\n self == User.first\n end",
"def is_admin?\n if valid_session?\n current_user.admin == true\n end\n end",
"def current_user?(user)\n (user == self.current_user) || admin?\n end",
"def is_admin?\n return false unless logged_in?\n user = User.find_by_id(current_user)\n user.userstatus.status == \"admin\" ? true : false\n end",
"def user_admin?\n unless current_user.present? && current_user.admin?\n redirect_to home_welcome_path and return\n end \n end",
"def is_admin?\n current_user && current_user.try(:admin?)\n end",
"def admin?\n\t\tuser_session.admin?\n\tend",
"def admin?\n return false\n # return (session[:user_id] && User.find(session[:user_id])[:login] == '') ? true : false\n end",
"def admin?\n\t\tcurrent_user.try(:admin)\n\tend",
"def checkAdmin\n current_user.present? && current_user.isAdmin\n end",
"def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend",
"def admin_logged_in?\n !current_admin.nil?\n end",
"def adminlogged_in?\n !!current_administrator\n end",
"def current_user_is_admin?\n current_user && current_user.is_admin\n end",
"def admin_loggedin?\r\n @logged_in_user and @logged_in_user.admin?\r\n end",
"def current_user_admin?\n current_user&.admin?\n end",
"def logged_in_as_admin?\n current_admin != :false\n end",
"def check_admin\n @user = find_current_user\n\n unless @user.present? and @user.is_admin?\n redirect_to root_path\n end\n end",
"def check_admin_of\n redirect_to root_path if current_user &&\n @user != current_user &&\n !current_user.admin_of?(@user, \"can_manage_users\")\n end",
"def admin?\n @user = current_user.is_admin?\n end",
"def admin_user?\n self.admin ==true\n end",
"def is_admin\n return Admin.find_by(email: session[:email]) != nil\n end",
"def normal_user?\n self.admin ==false\n end",
"def admin_logged_in?\n current_user && current_user.admin?\n end",
"def current_admin\n \tcurrent_user && current_user.has_role?(:admin)\n\tend",
"def user_is_admin?\n ALLOWED_USERS.include? current_user.email\n end",
"def is_admin?\n\t current_account.user.is_a?(Administrator)\n\tend",
"def logged_in_as_admin?\n !current_admin.nil?\n end",
"def is_admin? (user)\n get_admins.any? {|admin|\n user =~ admin\n } && user.authed?\n end",
"def current_admin\n if session[:admin_id]\n Admin.find(session[:admin_id])\n else\n false\n end\n end",
"def admin?\n self.admin_user\n end",
"def admin?\n @current_user.admin?\n end",
"def check_if_admin\n unless current_user.admin\n redirect_to \"/login\"\n end\n end",
"def record_first_admin\n return unless User.count.zero?\n\n self.admin = true\n end",
"def admin?\n User.admin_logged_in?\n end",
"def admin?\n current_user.admin?\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end",
"def check_if_admin\n redirect_to root_path unless @current_user.present? && @current_user.admin?\n end",
"def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\n end",
"def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\n end",
"def admin_user?\n member_type == MEMBER_TYPE[:admin]\n end",
"def is_admin_user?\n if user_signed_in? == false\n @is_admin = false\n else\n @is_admin = (current_user.email == \"jpwendt@asu.edu\")\n end\n end",
"def is_administrator?(user)\n user.admin == 2\n end",
"def admin_logged_in?\n !current_admin_user.nil?\n end",
"def admin?\n logged_in? && current_user.login == \"ej0c\"\n end",
"def is_admin?\n current_user && current_user.admin\n end",
"def check_user\n if self.admin?\n return 1\n end\n return (session[:user_id] && User.find(session[:user_id])) ? 1 : nil\n end",
"def admin?\n return ( self.user_type == User::USER_TYPE_ADMIN )\n end",
"def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\n end",
"def admin?\n user = check_user\n user.role == User.role_types['Admin']\n end",
"def isAdmin?\n return current_usuario != nil && current_usuario.admin\n end",
"def admin?\n user.class.name == Admin.name\n end",
"def admin?\n if user_signed_in? && current_user.user_level == 1\n return true\n end\n return false\n end",
"def is_admin?(user)\r\n self.admins.one? { |email, admin| email == user.email }\r\n end",
"def user_is_owner_or_admin?\n record.user == user || user.try(:admin?)\n end",
"def is_admin?\n current_user && current_user.site=='admin'\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def admin?\n return !new_record? && login == 'admin'\n end",
"def admin?\n if self.login == \"admin\"\n return true\n else\n return false\n end\n end",
"def admin?\n\t self.profile == \"admin\"\n\tend",
"def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end",
"def admin_user?\n\t\treturn self.user_category == \"admin\"\n\tend",
"def is_admin?\n @user = User.find(session[:user])\n @user.is_admin?\n# @session[:user]\n# @session[:is_admin]\n end",
"def has_admin?\n has_auth? && current_person.is_admin\n end",
"def is_admin?\n current_user and current_user.is_admin?\n end",
"def admin?\n logged_in? && current_user.admin\n end",
"def check_admin\n if current_user && current_user.admin\n logger.info \"[auth] Allowed for #{current_user.email}\"\n true\n else\n logger.info (\"[auth] Access Denied\")\n redirect_to new_user_session\n end\n end",
"def admin?\n current_user.admin?\n end",
"def admin?\n self.user_type == TYPES[:admin]\n end"
] |
[
"0.81331223",
"0.8098282",
"0.79163855",
"0.7865159",
"0.74681765",
"0.7453188",
"0.7423883",
"0.73102945",
"0.7305622",
"0.7300194",
"0.728531",
"0.72675323",
"0.7251611",
"0.7251168",
"0.7213384",
"0.72081536",
"0.7194273",
"0.71564114",
"0.7153468",
"0.7147708",
"0.71464103",
"0.71440923",
"0.7141361",
"0.71397215",
"0.7133674",
"0.7129102",
"0.7128491",
"0.7121747",
"0.7118338",
"0.71049744",
"0.71049744",
"0.71037036",
"0.7094965",
"0.7091672",
"0.70891374",
"0.7062926",
"0.70621663",
"0.70597506",
"0.70379496",
"0.70288646",
"0.7024446",
"0.7021418",
"0.7018541",
"0.7017815",
"0.7017574",
"0.7014589",
"0.7013743",
"0.70133984",
"0.700886",
"0.7004503",
"0.6997298",
"0.6995944",
"0.69936186",
"0.69843376",
"0.6981538",
"0.69770354",
"0.6976981",
"0.6976815",
"0.6976521",
"0.69752765",
"0.69675606",
"0.695087",
"0.69369924",
"0.6936694",
"0.69349754",
"0.6930296",
"0.6909305",
"0.690922",
"0.6895213",
"0.6894885",
"0.68905324",
"0.68905324",
"0.68880385",
"0.68867517",
"0.688251",
"0.6877023",
"0.687589",
"0.6875738",
"0.6869918",
"0.68695825",
"0.68657047",
"0.68647873",
"0.6863918",
"0.6862226",
"0.6860902",
"0.6858488",
"0.6858104",
"0.6849324",
"0.68457264",
"0.6843184",
"0.6841875",
"0.6839061",
"0.6838816",
"0.6838669",
"0.68359584",
"0.68349284",
"0.6834909",
"0.683332",
"0.68270963",
"0.6826723",
"0.6825462"
] |
0.0
|
-1
|
Create a new account Creates a new account
|
def create_account(budget_id, data, opts = {})
data, _status_code, _headers = create_account_with_http_info(budget_id, data, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_account\n\n end",
"def create(body = {})\n @client.account.create(body)\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def create_account\n if new_record? && !self.account_id\n account = Account.new\n account.name = \"Preecha o nome da sua empresa\"\n account.save\n self.account_id = account.id\n self.admin = true\n end\n end",
"def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end",
"def create\n @account = current_user.accounts.new(account_params)\n if @account.save\n redirect_to @account, notice: 'Account was successfully created.'\n else\n render :new\n end\n end",
"def new_account(name)\n account(name)\n end",
"def create_account(account_name)\r\n\t\taccount = Account.new\r\n\t\taccount.name = account_name\r\n\t\taccount.user = self\r\n\r\n\t\tif account.valid?\r\n\t\t\taccount.save\r\n\t\t\treload\r\n\t\tend\r\n\r\n\t\treturn account\r\n\tend",
"def create\n @account = current_user.accounts.new(params[:account])\n\n respond_to do |format|\n if @account.save\n flash[:notice] = 'Account was successfully created.'\n format.html { redirect_to([current_user, @account]) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_account(account_create_model, fields = '')\n if account_create_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('account_create_model')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n unless isNullOrWhiteSpace(fields)\n query_parameters['fields'] = fields\n end\n\n resource_path = 'identity/v2/manage/account'\n post_request(resource_path, query_parameters, account_create_model)\n end",
"def create\n printf(\"create : %s/%s \\n\", params[\"name\"], params[\"password\"])\n @account = Account.new(:name => params[\"name\"], :email => params[\"email\"], :password => params[\"password\"])\n \n respond_to do |format|\n if @account.save\n printf(\"save OK\\n\")\n format.html { redirect_to(@account, :notice => 'Account was successfully created.') }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n printf(\"save FAIL\\n\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n if @account.save\n redirect_to root_path, notice: 'Account was successfully created.'\n else\n redirect_to root_path, alert: 'Some thing went wrong! try more...'\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.user_id = current_user.id\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.user_created_id = current_user.id\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: I18n.t('account.controller.create') }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = UserAccount::Create.call(user_account_params)\n if response.success?\n success_response(message: response.status_message, http_status: 202, data: response.data)\n else\n error_response(message: response.status_message, data: response.data)\n end\n end",
"def create\n @account = Account.create(params[:account])\n @user = User.create(params[:user])\n @user.password = params[:user][:password] # Because we don't mass assign password\n @user.password_confirmation = params[:user][:password_confirmation]\n @user.account_admin = true # Account creator is always account administrator\n Account.transaction do\n @account.save! \n @account.users << @user\n @user.save!\n end\n flash[:notice] = I18n.t('accounts.new_account.created')\n redirect_to the_new_account_url\n \n rescue ActiveRecord::RecordInvalid\n flash.now[:error] = I18n.t('accounts.new_account.creation_error')\n render :new\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def create\n @account = Account.new(params[:account])\n \n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def create\n @account = Account.new(account_params)\n @account.user = @user\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account\n account = Account.new(:email => email, :subdomain => subdomain)\n account.save!\n end",
"def create(params)\n put('v1/account', params)\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n if @account.save\n AccountMailer.welcome(@account).deliver_later\n\n if current_user && @account.owner == current_user\n # User is already signed in and owns the account\n redirect_to @account, notice: 'Welcome to your new account!'\n else\n # User is not signed in or specified another user as the account owner\n redirect_to account_created_path\n end\n else\n @plans = Plan.all\n render :new\n end\n end",
"def create_account_user(options = {})\n post('accountuser?_method=PUT', options)\n end",
"def create_account\n unless authenticated?\n payload = encode( { :user => { :github_account => github_user } } )\n response = site['users.json'].post payload, :content_type => :json\n !response.nil?\n end\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: 'account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n create_account = CreateAccount.new(@account, super_and_current_users)\n if create_account.save\n format.html { redirect_to [:proprietor, @account], notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account.cname }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # authorize @accounts\n @account = Account.new(account_params)\n @account.user_id=current_user.id\n if @account.save\n redirect_to @account, notice: \"Account was successfully created.\" \n else\n render :new\n end\n end",
"def create_accounts\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_url, notice: 'Account was successfully created.' }\n format.json { render action: 'show', status: :created, location: @account }\n else\n format.html { render action: 'new' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_account = UserAccount.new(user_account_params)\n\n respond_to do |format|\n if @user_account.save\n format.html { redirect_to @user_account, notice: 'User account was successfully created.' }\n format.json { render :show, status: :created, location: @user_account }\n else\n format.html { render :new }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(params[:account])\n @account.owner = current_user\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @account = Account.new(params[:account])\r\n\r\n respond_to do |format|\r\n if @account.save\r\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\r\n format.json { render json: @account, status: :created, location: @account }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @account.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create_account\n @customer = Customer.find params[:id]\n fail unless @customer.email == params[:customer][:email]\n @customer.update_attributes!(customer_params)\n @customer_session = Authentication::CustomerSession.new(\n email: @customer.email,\n password: customer_params[:password]\n )\n @customer_session.save!\n end",
"def create_new_account(email, full_name=nil, password=nil)\n return call('User.create', {'email' => email, 'full_name' => full_name,\\\n 'password' => password})\n end",
"def create\n @user.account = Account.new if @user.account.nil?\n\n if @user.account.save_with_stripe(params)\n redirect_to user_url(@user), notice: 'Account was successfully created.'\n else\n handle_account_errors(@user, params)\n render :new\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end",
"def create\n @account = Account.new(account_params)\n @account.zip = Account.random_zip\n @account.user_id = @current_user.id if @current_user\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.username, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n @account = Account.new(params[:account])\n @account.role = 1\n\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to(new_account_session_path, :notice => 'アカウントの作成に成功しました。下記フォームからログインして下さい。') }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@account = Account.new(:name => params[:name])\n\t\trespond_to do |format|\n\t\t\tif @account.save\n\t\t\t\tformat.json { render json: @account, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n user = User.create!(user_params)\n response = { message: Message.account_created }\n json_response(response, :created)\n end",
"def create\n flash[:notice] = 'The account was successfully created.' if account.save\n respond_with(account)\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n\n if params[:commit] == \"Create and Go To Account\"\n url = account_path(@account)\n else\n url = new_account_path\n end\n\n flash[:notice] = \"Account was successfully created\"\n format.html { redirect_to url }\n format.json { render :show, status: :created, location: @account }\n else\n flash[:error] = \"Unable to save account: #{@account.errors.full_messages.to_sentence}\"\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@account = Account.new(params[:account])\n\n\t\trespond_to do |format|\n\t\t\tif @account.save\n\t\t\t\t# If we provide tokens (manually)\n\t\t\t\tif !@account.tokens?\n\t\t\t\t\tredirect_to '/auth/twitter?screen_name=' + @account.username\n\t\t\t\t\treturn\n\t\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @account, notice: 'Account was successfully created.' }\n\t\t\t\t\tformat.json { render json: @account, status: :created, location: @account }\t\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @account_user = AccountUser.new(account_user_params)\n respond_to do |format|\n if @account_user.save\n format.html { redirect_to @account_user, notice: 'Account user was successfully created.' }\n format.json { render :show, status: :created, location: @account_user }\n else\n format.html { render :new }\n format.json { render json: @account_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.username, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to dashboard_path, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = current_account\n\n respond_to do |format|\n if @account.save\n flash[:notice] = 'User::Account was successfully created.'\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def newaccount\n if params[:commit] == \"Cancel\"\n session[:authhash] = nil\n session.delete :authhash\n redirect_to root_url\n else # create account\n @newuser = User.new\n @newuser.name = session[:authhash][:name]\n @newuser.email = session[:authhash][:email]\n @newuser.services.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n \n if @newuser.save!\n # signin existing user\n # in the session his user id and the service id used for signing in is stored\n session[:user_id] = @newuser.id\n session[:service_id] = @newuser.services.first.id\n \n flash[:notice] = 'Your account has been created and you have been signed in!'\n\tif session[:authhash][:provider] == 'facebook'\n\t\tredirect_to services_facebook_redirect_path\n\telse\n \tredirect_to services_path\n\tend\n else\n flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n redirect_to root_url\n end \n end\n end",
"def create_initial_account_and_profile!\n account = accounts.create!(name: I18n.t('.default.account.name'))\n profiles.create!(name: I18n.t('.default.profile.name'), account_id: account.id)\n end",
"def new_account(res)\n account = Account.new\n account.new(res)\n end",
"def create\n @user = User.new(username: params[:username], email: params[:email], password: params[:password])\n\n if @user.save\n render json: {status: 'SUCCESS', message: 'Account successfully created', accessToken: @user.access_token}.to_json\n else\n render json: {errors: [\"Sign up failed!\"], status: 422}.to_json\n end\n\n end",
"def create\n @account = Account.new(account_params.merge({ user_id: @current_user.id }))\n\n if @account.save\n render :show, status: :created, location: @account\n else\n render json: @account.errors, status: :unprocessable_entity\n end\n end",
"def create_user_account\n Account.cache_or_create_by! @current_user\n rescue => e\n log_error(e, account: 'cannot_create_unique_account_record')\n end",
"def create\n @account = Admin::Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n flash[:notice] = 'Admin::Account was successfully created.'\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_account = Api::V1::Account.new(api_v1_account_params)\n\n respond_to do |format|\n if @api_v1_account.save\n format.html { redirect_to @api_v1_account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_account }\n else\n format.html { render :new }\n format.json { render json: @api_v1_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end",
"def create\n \n @account = Account.new(params[:account])\n\n respond_to do |format|\n \n if @account.save\n sign_in(@account)\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(account: nil, **params)\n post account, \"email\", params\n end",
"def create\n @account = Account.new(params[:account])\n respond_to do |format|\n if @account.save\n \n format.html { redirect_to \"http://#{@account.name}.#{request.domain}#{request.port_string}/login\", notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_account = UserAccount.new(params[:user_account])\n\n respond_to do |format|\n if @user_account.save\n format.html { redirect_to user_account_url(@user_account.user, @user_account), notice: 'User account was successfully created.' }\n format.json { render json: @user_account, status: :created, location: @user_account }\n format.xml { render xml: @user_account, status: :created, location: @user_account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n format.xml { render xml: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(params[:account])\n @account.member = current_member\n logger.info @account.inspect\n \n respond_to do |format|\n if @account.save\n flash[:notice] = 'Thanks for signing up!' \n format.html { \n redirect_back_or_default('/')\n }\n format.xml do\n headers[\"Location\"] = account_url(@account)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n flash[:notice] = 'There was a problem creating your account, but we can address that later. If you need to sell something right now, please contact support.'\n redirect_back_or_default('/')\n format.xml { render :xml => @account.errors.to_xml }\n end\n end\n end",
"def make_account(email: 'jdoe@emmoco.com', password: 'aba456',\n admin: false, first: 'John', last: 'Doe') # system admin, not lock admin\n # account is a devise model, must set properties at instance level and not in constructor\n Account.create!(:first_name => first,\n :last_name => last,\n :email => email,\n :password => password,\n :password_confirmation => password,\n :admin => admin,\n :confirmed_at => DateTime.now.utc.iso8601(9),\n :confirmation_sent_at => DateTime.now.utc.iso8601(9)\n )\n end",
"def create\n @user_account = UserAccount.new(params[:user_account])\n\n respond_to do |format|\n if @user_account.save\n format.html { redirect_to(@user_account, :notice => 'User account was successfully created.') }\n format.xml { render :xml => @user_account, :status => :created, :location => @user_account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_account(body, opts = {})\n data, _status_code, _headers = create_account_with_http_info(body, opts)\n data\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: t('common.created', model: human_name) }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account(lead)\n Account.create({\n company_id: lead.company_id,\n user_id: lead.user_id\n })\n end",
"def create\n @my_account = MyAccount.new(my_account_params)\n\n respond_to do |format|\n if @my_account.save\n format.html { redirect_to @my_account, notice: 'My account was successfully created.' }\n format.json { render :show, status: :created, location: @my_account }\n else\n format.html { render :new }\n format.json { render json: @my_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token , uid: user.id }\n json_response(response, :created)\n end",
"def create\n @account = Account.new(:name=>params[:account_name].downcase, :password=>params[:password], :password_confirmation =>params[:password_confirmation], :account_type=>params[:account_type])\n user = User.new\n user.nick_name = params[:nick_name]\n @account.user = user\n\n respond_to do |format|\n if @account.save\n session[:user_id] = @account.user.id\n format.html { redirect_to(:controller=>'yueyue_objects', :action => \"index\") }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n instance_variable_set(:\"@#{controller_name.singularize}\", controller_name.classify.constantize.new(account_params))\n\n respond_to do |format|\n if account.save\n format.html { redirect_to account, notice: \"#{controller_name.singularize.humanize} was successfully created.\" }\n format.json { render :show, status: :created, location: account }\n else\n format.html { render :new }\n format.json { render json: account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.create!(user_params) # will raise an error if creation fails\n # call the authentication service\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token}\n json_response(response, :created)\n end",
"def create\n @a_account = AAccount.new(a_account_params)\n\n respond_to do |format|\n if @a_account.save\n format.html { redirect_to @a_account, notice: 'AAccount was successfully created.' }\n format.json { render :show, status: :created, location: @a_account }\n else\n format.html { render :new }\n format.json { render json: @a_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@current_account = CurrentAccount.new(current_account_params)\n @current_account = current_user.current_accounts.new(current_account_params)\n\n respond_to do |format|\n if @current_account.save\n format.html { redirect_to @current_account, flash: { success: \"AccountPayable was successfully created.\" } }\n format.json { render :show, status: :created, location: @current_account }\n else\n format.html { render :new }\n format.json { render json: @current_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @t_user_account = TUserAccount.new(t_user_account_params)\n\n respond_to do |format|\n if @t_user_account.save\n format.html { redirect_to @t_user_account, notice: 'T user account was successfully created.' }\n format.json { render :show, status: :created, location: @t_user_account }\n else\n format.html { render :new }\n format.json { render json: @t_user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @transaction = Transaction.new(account_params)\n #@account.user_id = current_user.id\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(name: account_params[:name])\n \n respond_to do |format|\n if @account.save\n user = @account.users.build(account_params[:users_attributes])\n if user.save\n session[:user_id] = user.id\n format.html { redirect_to samples_path, notice: 'account was successfully created.' }\n format.json { render samples_path, status: :created, location: @account }\n else\n format.html { redirect_to register_path, notice: 'Error, in user save' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new, notice: 'Error, in account save' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account_create(account_create, opts = {})\n data, _status_code, _headers = account_create_with_http_info(account_create, opts)\n data\n end",
"def create\n @account = @project.accounts.build(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n @record = [@project, @account]\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = current_user.accounts.build params[:account]\n \n account_array = accounts_from_credentials @account.api_email, @account.api_password\n \n accounts = account_array.map do |account_info|\n account = current_user.accounts.build params[:account]\n \n account.api_id = account_info.accountID\n account.api_name = account_info.accountName\n account.api_user_id = account_info.userID\n \n account\n end\n\n respond_to do |format|\n if !accounts.blank? && accounts.map(&:valid?).all? && accounts.map(&:save).all?\n flash[:notice] = \"#{accounts.size == 1 ? 'Account was' : \"#{accounts.size} accounts were\"} successfully created.\"\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @account = Account.new(params[:account])\r\n @account.updating_password = true\r\n\r\n\r\n @family_type = FamilyType.find(params[:family_type])\r\n @account.family_type = @family_type\r\n\r\n\r\n if @account.save\r\n sign_in @account\r\n flash[:success] = \"Account created successfully!\"\r\n redirect_to @account\r\n else\r\n @account.creating_account = true\r\n @family_types = FamilyType.all\r\n @family_type = FamilyType.find(params[:family_type])\r\n render 'new'\r\n end\r\n end",
"def create\n user = User.find_by_email(params[:email])\n if !user.present?\n user = User.create!(user_params)\n user.account_active = false\n user.save!\n accountHash = AccountHash.create(:hashcode => create_hashcode, :user_id => user.id, :password => user.password, :temp_email => nil)\n AppropMailer.account_created(user, accountHash).deliver\n render json: { message: Message.account_created, hashcode: accountHash.hashcode }\n else\n json_response({error: 'El email ya se encuentra registrado en Approp'}, :unprocessable_entity)\n end\n end",
"def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end",
"def create\n @core_account = Core::Account.new(core_account_params)\n\n respond_to do |format|\n if @core_account.save\n format.html { redirect_to @core_account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @core_account }\n else\n format.html { render :new }\n format.json { render json: @core_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newaccount\n\t if params[:commit] == \"Cancel\"\n\t session[:authhash] = nil\n\t session.delete :authhash\n\t redirect_to root_url\n\t else # create account\n\t @newuser = User.find_by_email(session[:authhash][:email]) || User.new(:name => session[:authhash][:name], :email => session[:authhash][:email], :password => Devise.friendly_token[0,20])\n\t @newuser.authentications.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n\t \n\t if @newuser.save!\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = @newuser.id\n\t session[:authentication_id] = @newuser.authentications.first.id\n\t \n\t flash[:notice] = 'Your account has been created and you have been signed in!'\n\t redirect_to root_url\n\t else\n\t flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n\t redirect_to root_url\n\t end \n\t end\n\t end",
"def create\n respond_to do |format|\n if CreateAccount.new(@account).save\n format.html { redirect_to first_user_registration_url, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account.cname }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.8257312",
"0.82239836",
"0.80831707",
"0.8010991",
"0.79454243",
"0.77753085",
"0.7699585",
"0.7690828",
"0.76399446",
"0.7629188",
"0.76224715",
"0.7622097",
"0.7615733",
"0.7614438",
"0.76122206",
"0.7606574",
"0.7590418",
"0.7589648",
"0.7586393",
"0.75724083",
"0.7571732",
"0.75560737",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.75373006",
"0.75301534",
"0.75298876",
"0.7523413",
"0.75223064",
"0.7516112",
"0.7515522",
"0.75148016",
"0.751352",
"0.7492337",
"0.74635214",
"0.74420625",
"0.742902",
"0.7421104",
"0.74205863",
"0.7417557",
"0.73872554",
"0.738621",
"0.7384037",
"0.73667675",
"0.7357543",
"0.7349838",
"0.73484904",
"0.73388606",
"0.7330906",
"0.7325793",
"0.73152435",
"0.73152435",
"0.73152435",
"0.7300218",
"0.7292745",
"0.7289576",
"0.7279639",
"0.7264771",
"0.72643536",
"0.72566223",
"0.7255666",
"0.7246681",
"0.72409433",
"0.7239259",
"0.7234117",
"0.72275484",
"0.7227107",
"0.72249305",
"0.7219468",
"0.7212247",
"0.7210296",
"0.719197",
"0.71732616",
"0.7171282",
"0.7167626",
"0.7159136",
"0.71574265",
"0.7156748",
"0.7154368",
"0.7137492",
"0.713518",
"0.71336186",
"0.7131927",
"0.71316284",
"0.71239203",
"0.71127784",
"0.7107761",
"0.7105078",
"0.7103286",
"0.709392",
"0.7081899",
"0.70604193",
"0.70516664",
"0.7041489"
] |
0.0
|
-1
|
Create a new account Creates a new account
|
def create_account_with_http_info(budget_id, data, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountsApi.create_account ...'
end
# verify the required parameter 'budget_id' is set
if @api_client.config.client_side_validation && budget_id.nil?
fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.create_account"
end
# verify the required parameter 'data' is set
if @api_client.config.client_side_validation && data.nil?
fail ArgumentError, "Missing the required parameter 'data' when calling AccountsApi.create_account"
end
# resource path
local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', budget_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(data)
auth_names = ['bearer']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'AccountResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AccountsApi#create_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_account\n\n end",
"def create(body = {})\n @client.account.create(body)\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def create_account\n if new_record? && !self.account_id\n account = Account.new\n account.name = \"Preecha o nome da sua empresa\"\n account.save\n self.account_id = account.id\n self.admin = true\n end\n end",
"def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end",
"def create\n @account = current_user.accounts.new(account_params)\n if @account.save\n redirect_to @account, notice: 'Account was successfully created.'\n else\n render :new\n end\n end",
"def new_account(name)\n account(name)\n end",
"def create_account(account_name)\r\n\t\taccount = Account.new\r\n\t\taccount.name = account_name\r\n\t\taccount.user = self\r\n\r\n\t\tif account.valid?\r\n\t\t\taccount.save\r\n\t\t\treload\r\n\t\tend\r\n\r\n\t\treturn account\r\n\tend",
"def create\n @account = current_user.accounts.new(params[:account])\n\n respond_to do |format|\n if @account.save\n flash[:notice] = 'Account was successfully created.'\n format.html { redirect_to([current_user, @account]) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_account(account_create_model, fields = '')\n if account_create_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('account_create_model')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n unless isNullOrWhiteSpace(fields)\n query_parameters['fields'] = fields\n end\n\n resource_path = 'identity/v2/manage/account'\n post_request(resource_path, query_parameters, account_create_model)\n end",
"def create\n printf(\"create : %s/%s \\n\", params[\"name\"], params[\"password\"])\n @account = Account.new(:name => params[\"name\"], :email => params[\"email\"], :password => params[\"password\"])\n \n respond_to do |format|\n if @account.save\n printf(\"save OK\\n\")\n format.html { redirect_to(@account, :notice => 'Account was successfully created.') }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n printf(\"save FAIL\\n\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n if @account.save\n redirect_to root_path, notice: 'Account was successfully created.'\n else\n redirect_to root_path, alert: 'Some thing went wrong! try more...'\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.user_id = current_user.id\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.user_created_id = current_user.id\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: I18n.t('account.controller.create') }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = UserAccount::Create.call(user_account_params)\n if response.success?\n success_response(message: response.status_message, http_status: 202, data: response.data)\n else\n error_response(message: response.status_message, data: response.data)\n end\n end",
"def create\n @account = Account.create(params[:account])\n @user = User.create(params[:user])\n @user.password = params[:user][:password] # Because we don't mass assign password\n @user.password_confirmation = params[:user][:password_confirmation]\n @user.account_admin = true # Account creator is always account administrator\n Account.transaction do\n @account.save! \n @account.users << @user\n @user.save!\n end\n flash[:notice] = I18n.t('accounts.new_account.created')\n redirect_to the_new_account_url\n \n rescue ActiveRecord::RecordInvalid\n flash.now[:error] = I18n.t('accounts.new_account.creation_error')\n render :new\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def create\n @account = Account.new(params[:account])\n \n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def create\n @account = Account.new(account_params)\n @account.user = @user\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account\n account = Account.new(:email => email, :subdomain => subdomain)\n account.save!\n end",
"def create(params)\n put('v1/account', params)\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n if @account.save\n AccountMailer.welcome(@account).deliver_later\n\n if current_user && @account.owner == current_user\n # User is already signed in and owns the account\n redirect_to @account, notice: 'Welcome to your new account!'\n else\n # User is not signed in or specified another user as the account owner\n redirect_to account_created_path\n end\n else\n @plans = Plan.all\n render :new\n end\n end",
"def create_account_user(options = {})\n post('accountuser?_method=PUT', options)\n end",
"def create_account\n unless authenticated?\n payload = encode( { :user => { :github_account => github_user } } )\n response = site['users.json'].post payload, :content_type => :json\n !response.nil?\n end\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: 'account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n create_account = CreateAccount.new(@account, super_and_current_users)\n if create_account.save\n format.html { redirect_to [:proprietor, @account], notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account.cname }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # authorize @accounts\n @account = Account.new(account_params)\n @account.user_id=current_user.id\n if @account.save\n redirect_to @account, notice: \"Account was successfully created.\" \n else\n render :new\n end\n end",
"def create_accounts\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_url, notice: 'Account was successfully created.' }\n format.json { render action: 'show', status: :created, location: @account }\n else\n format.html { render action: 'new' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_account = UserAccount.new(user_account_params)\n\n respond_to do |format|\n if @user_account.save\n format.html { redirect_to @user_account, notice: 'User account was successfully created.' }\n format.json { render :show, status: :created, location: @user_account }\n else\n format.html { render :new }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(params[:account])\n @account.owner = current_user\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @account = Account.new(params[:account])\r\n\r\n respond_to do |format|\r\n if @account.save\r\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\r\n format.json { render json: @account, status: :created, location: @account }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @account.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create_account\n @customer = Customer.find params[:id]\n fail unless @customer.email == params[:customer][:email]\n @customer.update_attributes!(customer_params)\n @customer_session = Authentication::CustomerSession.new(\n email: @customer.email,\n password: customer_params[:password]\n )\n @customer_session.save!\n end",
"def create_new_account(email, full_name=nil, password=nil)\n return call('User.create', {'email' => email, 'full_name' => full_name,\\\n 'password' => password})\n end",
"def create\n @user.account = Account.new if @user.account.nil?\n\n if @user.account.save_with_stripe(params)\n redirect_to user_url(@user), notice: 'Account was successfully created.'\n else\n handle_account_errors(@user, params)\n render :new\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end",
"def create\n @account = Account.new(account_params)\n @account.zip = Account.random_zip\n @account.user_id = @current_user.id if @current_user\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.username, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n @account = Account.new(params[:account])\n @account.role = 1\n\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to(new_account_session_path, :notice => 'アカウントの作成に成功しました。下記フォームからログインして下さい。') }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@account = Account.new(:name => params[:name])\n\t\trespond_to do |format|\n\t\t\tif @account.save\n\t\t\t\tformat.json { render json: @account, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n user = User.create!(user_params)\n response = { message: Message.account_created }\n json_response(response, :created)\n end",
"def create\n flash[:notice] = 'The account was successfully created.' if account.save\n respond_with(account)\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n\n if params[:commit] == \"Create and Go To Account\"\n url = account_path(@account)\n else\n url = new_account_path\n end\n\n flash[:notice] = \"Account was successfully created\"\n format.html { redirect_to url }\n format.json { render :show, status: :created, location: @account }\n else\n flash[:error] = \"Unable to save account: #{@account.errors.full_messages.to_sentence}\"\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@account = Account.new(params[:account])\n\n\t\trespond_to do |format|\n\t\t\tif @account.save\n\t\t\t\t# If we provide tokens (manually)\n\t\t\t\tif !@account.tokens?\n\t\t\t\t\tredirect_to '/auth/twitter?screen_name=' + @account.username\n\t\t\t\t\treturn\n\t\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @account, notice: 'Account was successfully created.' }\n\t\t\t\t\tformat.json { render json: @account, status: :created, location: @account }\t\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @account_user = AccountUser.new(account_user_params)\n respond_to do |format|\n if @account_user.save\n format.html { redirect_to @account_user, notice: 'Account user was successfully created.' }\n format.json { render :show, status: :created, location: @account_user }\n else\n format.html { render :new }\n format.json { render json: @account_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.username, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to dashboard_path, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = current_account\n\n respond_to do |format|\n if @account.save\n flash[:notice] = 'User::Account was successfully created.'\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def newaccount\n if params[:commit] == \"Cancel\"\n session[:authhash] = nil\n session.delete :authhash\n redirect_to root_url\n else # create account\n @newuser = User.new\n @newuser.name = session[:authhash][:name]\n @newuser.email = session[:authhash][:email]\n @newuser.services.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n \n if @newuser.save!\n # signin existing user\n # in the session his user id and the service id used for signing in is stored\n session[:user_id] = @newuser.id\n session[:service_id] = @newuser.services.first.id\n \n flash[:notice] = 'Your account has been created and you have been signed in!'\n\tif session[:authhash][:provider] == 'facebook'\n\t\tredirect_to services_facebook_redirect_path\n\telse\n \tredirect_to services_path\n\tend\n else\n flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n redirect_to root_url\n end \n end\n end",
"def create_initial_account_and_profile!\n account = accounts.create!(name: I18n.t('.default.account.name'))\n profiles.create!(name: I18n.t('.default.profile.name'), account_id: account.id)\n end",
"def new_account(res)\n account = Account.new\n account.new(res)\n end",
"def create\n @user = User.new(username: params[:username], email: params[:email], password: params[:password])\n\n if @user.save\n render json: {status: 'SUCCESS', message: 'Account successfully created', accessToken: @user.access_token}.to_json\n else\n render json: {errors: [\"Sign up failed!\"], status: 422}.to_json\n end\n\n end",
"def create\n @account = Account.new(account_params.merge({ user_id: @current_user.id }))\n\n if @account.save\n render :show, status: :created, location: @account\n else\n render json: @account.errors, status: :unprocessable_entity\n end\n end",
"def create_user_account\n Account.cache_or_create_by! @current_user\n rescue => e\n log_error(e, account: 'cannot_create_unique_account_record')\n end",
"def create\n @account = Admin::Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n flash[:notice] = 'Admin::Account was successfully created.'\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_account = Api::V1::Account.new(api_v1_account_params)\n\n respond_to do |format|\n if @api_v1_account.save\n format.html { redirect_to @api_v1_account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_account }\n else\n format.html { render :new }\n format.json { render json: @api_v1_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end",
"def create\n \n @account = Account.new(params[:account])\n\n respond_to do |format|\n \n if @account.save\n sign_in(@account)\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(account: nil, **params)\n post account, \"email\", params\n end",
"def create\n @account = Account.new(params[:account])\n respond_to do |format|\n if @account.save\n \n format.html { redirect_to \"http://#{@account.name}.#{request.domain}#{request.port_string}/login\", notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_account = UserAccount.new(params[:user_account])\n\n respond_to do |format|\n if @user_account.save\n format.html { redirect_to user_account_url(@user_account.user, @user_account), notice: 'User account was successfully created.' }\n format.json { render json: @user_account, status: :created, location: @user_account }\n format.xml { render xml: @user_account, status: :created, location: @user_account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n format.xml { render xml: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(params[:account])\n @account.member = current_member\n logger.info @account.inspect\n \n respond_to do |format|\n if @account.save\n flash[:notice] = 'Thanks for signing up!' \n format.html { \n redirect_back_or_default('/')\n }\n format.xml do\n headers[\"Location\"] = account_url(@account)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n flash[:notice] = 'There was a problem creating your account, but we can address that later. If you need to sell something right now, please contact support.'\n redirect_back_or_default('/')\n format.xml { render :xml => @account.errors.to_xml }\n end\n end\n end",
"def make_account(email: 'jdoe@emmoco.com', password: 'aba456',\n admin: false, first: 'John', last: 'Doe') # system admin, not lock admin\n # account is a devise model, must set properties at instance level and not in constructor\n Account.create!(:first_name => first,\n :last_name => last,\n :email => email,\n :password => password,\n :password_confirmation => password,\n :admin => admin,\n :confirmed_at => DateTime.now.utc.iso8601(9),\n :confirmation_sent_at => DateTime.now.utc.iso8601(9)\n )\n end",
"def create\n @user_account = UserAccount.new(params[:user_account])\n\n respond_to do |format|\n if @user_account.save\n format.html { redirect_to(@user_account, :notice => 'User account was successfully created.') }\n format.xml { render :xml => @user_account, :status => :created, :location => @user_account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_account(body, opts = {})\n data, _status_code, _headers = create_account_with_http_info(body, opts)\n data\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: t('common.created', model: human_name) }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account(lead)\n Account.create({\n company_id: lead.company_id,\n user_id: lead.user_id\n })\n end",
"def create\n @my_account = MyAccount.new(my_account_params)\n\n respond_to do |format|\n if @my_account.save\n format.html { redirect_to @my_account, notice: 'My account was successfully created.' }\n format.json { render :show, status: :created, location: @my_account }\n else\n format.html { render :new }\n format.json { render json: @my_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end",
"def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token , uid: user.id }\n json_response(response, :created)\n end",
"def create\n @account = Account.new(:name=>params[:account_name].downcase, :password=>params[:password], :password_confirmation =>params[:password_confirmation], :account_type=>params[:account_type])\n user = User.new\n user.nick_name = params[:nick_name]\n @account.user = user\n\n respond_to do |format|\n if @account.save\n session[:user_id] = @account.user.id\n format.html { redirect_to(:controller=>'yueyue_objects', :action => \"index\") }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n instance_variable_set(:\"@#{controller_name.singularize}\", controller_name.classify.constantize.new(account_params))\n\n respond_to do |format|\n if account.save\n format.html { redirect_to account, notice: \"#{controller_name.singularize.humanize} was successfully created.\" }\n format.json { render :show, status: :created, location: account }\n else\n format.html { render :new }\n format.json { render json: account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.create!(user_params) # will raise an error if creation fails\n # call the authentication service\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token}\n json_response(response, :created)\n end",
"def create\n @a_account = AAccount.new(a_account_params)\n\n respond_to do |format|\n if @a_account.save\n format.html { redirect_to @a_account, notice: 'AAccount was successfully created.' }\n format.json { render :show, status: :created, location: @a_account }\n else\n format.html { render :new }\n format.json { render json: @a_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@current_account = CurrentAccount.new(current_account_params)\n @current_account = current_user.current_accounts.new(current_account_params)\n\n respond_to do |format|\n if @current_account.save\n format.html { redirect_to @current_account, flash: { success: \"AccountPayable was successfully created.\" } }\n format.json { render :show, status: :created, location: @current_account }\n else\n format.html { render :new }\n format.json { render json: @current_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @t_user_account = TUserAccount.new(t_user_account_params)\n\n respond_to do |format|\n if @t_user_account.save\n format.html { redirect_to @t_user_account, notice: 'T user account was successfully created.' }\n format.json { render :show, status: :created, location: @t_user_account }\n else\n format.html { render :new }\n format.json { render json: @t_user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @transaction = Transaction.new(account_params)\n #@account.user_id = current_user.id\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(name: account_params[:name])\n \n respond_to do |format|\n if @account.save\n user = @account.users.build(account_params[:users_attributes])\n if user.save\n session[:user_id] = user.id\n format.html { redirect_to samples_path, notice: 'account was successfully created.' }\n format.json { render samples_path, status: :created, location: @account }\n else\n format.html { redirect_to register_path, notice: 'Error, in user save' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new, notice: 'Error, in account save' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account_create(account_create, opts = {})\n data, _status_code, _headers = account_create_with_http_info(account_create, opts)\n data\n end",
"def create\n @account = @project.accounts.build(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n @record = [@project, @account]\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = current_user.accounts.build params[:account]\n \n account_array = accounts_from_credentials @account.api_email, @account.api_password\n \n accounts = account_array.map do |account_info|\n account = current_user.accounts.build params[:account]\n \n account.api_id = account_info.accountID\n account.api_name = account_info.accountName\n account.api_user_id = account_info.userID\n \n account\n end\n\n respond_to do |format|\n if !accounts.blank? && accounts.map(&:valid?).all? && accounts.map(&:save).all?\n flash[:notice] = \"#{accounts.size == 1 ? 'Account was' : \"#{accounts.size} accounts were\"} successfully created.\"\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @account = Account.new(params[:account])\r\n @account.updating_password = true\r\n\r\n\r\n @family_type = FamilyType.find(params[:family_type])\r\n @account.family_type = @family_type\r\n\r\n\r\n if @account.save\r\n sign_in @account\r\n flash[:success] = \"Account created successfully!\"\r\n redirect_to @account\r\n else\r\n @account.creating_account = true\r\n @family_types = FamilyType.all\r\n @family_type = FamilyType.find(params[:family_type])\r\n render 'new'\r\n end\r\n end",
"def create\n user = User.find_by_email(params[:email])\n if !user.present?\n user = User.create!(user_params)\n user.account_active = false\n user.save!\n accountHash = AccountHash.create(:hashcode => create_hashcode, :user_id => user.id, :password => user.password, :temp_email => nil)\n AppropMailer.account_created(user, accountHash).deliver\n render json: { message: Message.account_created, hashcode: accountHash.hashcode }\n else\n json_response({error: 'El email ya se encuentra registrado en Approp'}, :unprocessable_entity)\n end\n end",
"def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end",
"def create\n @core_account = Core::Account.new(core_account_params)\n\n respond_to do |format|\n if @core_account.save\n format.html { redirect_to @core_account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @core_account }\n else\n format.html { render :new }\n format.json { render json: @core_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newaccount\n\t if params[:commit] == \"Cancel\"\n\t session[:authhash] = nil\n\t session.delete :authhash\n\t redirect_to root_url\n\t else # create account\n\t @newuser = User.find_by_email(session[:authhash][:email]) || User.new(:name => session[:authhash][:name], :email => session[:authhash][:email], :password => Devise.friendly_token[0,20])\n\t @newuser.authentications.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n\t \n\t if @newuser.save!\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = @newuser.id\n\t session[:authentication_id] = @newuser.authentications.first.id\n\t \n\t flash[:notice] = 'Your account has been created and you have been signed in!'\n\t redirect_to root_url\n\t else\n\t flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n\t redirect_to root_url\n\t end \n\t end\n\t end",
"def create\n respond_to do |format|\n if CreateAccount.new(@account).save\n format.html { redirect_to first_user_registration_url, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account.cname }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.8257312",
"0.82239836",
"0.80831707",
"0.8010991",
"0.79454243",
"0.77753085",
"0.7699585",
"0.7690828",
"0.76399446",
"0.7629188",
"0.76224715",
"0.7622097",
"0.7615733",
"0.7614438",
"0.76122206",
"0.7606574",
"0.7590418",
"0.7589648",
"0.7586393",
"0.75724083",
"0.7571732",
"0.75560737",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.7544474",
"0.75373006",
"0.75301534",
"0.75298876",
"0.7523413",
"0.75223064",
"0.7516112",
"0.7515522",
"0.75148016",
"0.751352",
"0.7492337",
"0.74635214",
"0.74420625",
"0.742902",
"0.7421104",
"0.74205863",
"0.7417557",
"0.73872554",
"0.738621",
"0.7384037",
"0.73667675",
"0.7357543",
"0.7349838",
"0.73484904",
"0.73388606",
"0.7330906",
"0.7325793",
"0.73152435",
"0.73152435",
"0.73152435",
"0.7300218",
"0.7292745",
"0.7289576",
"0.7279639",
"0.7264771",
"0.72643536",
"0.72566223",
"0.7255666",
"0.7246681",
"0.72409433",
"0.7239259",
"0.7234117",
"0.72275484",
"0.7227107",
"0.72249305",
"0.7219468",
"0.7212247",
"0.7210296",
"0.719197",
"0.71732616",
"0.7171282",
"0.7167626",
"0.7159136",
"0.71574265",
"0.7156748",
"0.7154368",
"0.7137492",
"0.713518",
"0.71336186",
"0.7131927",
"0.71316284",
"0.71239203",
"0.71127784",
"0.7107761",
"0.7105078",
"0.7103286",
"0.709392",
"0.7081899",
"0.70604193",
"0.70516664",
"0.7041489"
] |
0.0
|
-1
|
Single account Returns a single account
|
def get_account_by_id(budget_id, account_id, opts = {})
data, _status_code, _headers = get_account_by_id_with_http_info(budget_id, account_id, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account\n find('Account', account_id)\n end",
"def account\n get('account')\n end",
"def get_account(account_id)\n get(\"/account/#{account_id}\")\n end",
"def get_account(account_id)\n @accounts[account_id]\n end",
"def get_account(account_id)\n @accounts[account_id]\n end",
"def account_user(id)\n get(\"accountuser/#{id}\")\n end",
"def get_single_account(id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/accounts/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n Account.new(response)\n end",
"def find_account\n @account = current_user.accounts.find(params[:account_id])\n end",
"def account(params = {})\n make_get_request('/account', params)\n end",
"def account\n @account ||= Authentication::Account.find_by(email: username)\n end",
"def find_account\n @account = current_account\n end",
"def get_user\n\t\treturn Account.find(self.account_id)\n\tend",
"def id\n @account\n end",
"def account\n @account ||= Account.find(accountRef)\n end",
"def show_account(id)\n get(\"accounts/#{id}\")\n end",
"def account\n Atheme::User.new(@session, match(/\\(account\\s([^\\(]+)\\):/))\n end",
"def find_account\n @account = Account.find(params[:account_id])\n end",
"def find_account\n @account = Account.find(params[:account_id])\n end",
"def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end",
"def account\n @details ||= fetch_details\n @details[:account]\n end",
"def get_account_id\n if user\n return user.get_account_id\n end\n end",
"def user_account_instance\n Account.new\n end",
"def account\n self\n end",
"def account(&block)\n response = _get(\"accounts/current\")\n yield(response) if block_given?\n response[\"account\"]\n end",
"def account\n @account ||= AccountContext.new(self, @domain.client.account_sid)\n end",
"def account(fields: nil)\n params = build_fields_params fields\n res = @connection.get account_path, params\n Account.new res.body, self\n end",
"def get_account\n as_json(get_results('/account'))\n end",
"def account\n \t\t\tZapi::Models::Account.new\n \tend",
"def account\n @account = current_account_settings\n end",
"def find_account(name)\n return (accounts.select { |a| a[:name] == name }).first\n end",
"def current_account(raise_on_not_found = true)\n @current_account ||= Account.find_by_full_domain(request.host) || (Rails.env.development? ? Account.first : nil)\n raise ActiveRecord::RecordNotFound if !@current_account && raise_on_not_found\n @current_account\n end",
"def show\n @account = Account.find(params[:account_id])\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find(session[:account_id]) \n end\n end",
"def account\n @account ||= Harvest::API::Account.new(credentials)\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find_by_id(session[:account_id])\n end\n end",
"def current_account\n @current_account ||= company.accounts.find_by(id: self.id)\n end",
"def get_account(token, account_number)\n result = get_user_from_token(token)\n user_id = result.raw['userID']\n\n # Find the correct account\n accounts = result.raw['accounts'].select do |account|\n account['accountNo'] == account_number\n end\n\n if accounts.count > 0\n # Get the details of the account\n account = accounts[0]\n\n return {\n user_id: user_id,\n account: account\n }\n else\n raise Trading::Errors::LoginException.new(\n type: :error,\n code: '403',\n description: 'Account could not be found',\n messages: ['Account could not be found']\n )\n end\n end",
"def account\n @account ||= current_customer.account\n end",
"def current_account\n Account.find_by(id: session[:account_id])\n end",
"def current_account\n Account.find(session[:account_id]) if session[:account_id]\n end",
"def current_account\n Account.find(session[:account_id]) if session[:account_id]\n end",
"def getaccount(coinaddress)\n coind.getaccount coinaddress\n end",
"def find_account\n @to_find = Account.find(params[:id])\n end",
"def find_account\n @to_find = Account.find(params[:id])\n end",
"def user_account\n return @user_account\n end",
"def show\n response = @account_api.find(params[:id])\n @account = response[:account]\n # @user = RubyBank::CustomerApi.new(session[:token]).find(@account.customer_id)[:user]\n end",
"def show\n account = resource\n if params[:id].present?\n account = User.find_by_id(params[:id])\n end\n render json: account, status: 200\n end",
"def current_account\n @current_account\n end",
"def find_account_by_id(account_id)\n account = @accounts.find { |a| a.id == account_id }\n unless account || populated?\n account = Account.new(:id => account_id, :institution => self)\n @accounts << account\n end\n account\n end",
"def card_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/card_accounts\").body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end",
"def set_account\n response = @account_api.find(params[:id])\n @account = response[:account]\n end",
"def getaccount(bitcoinaddress)\n @api.request 'getaccount', bitcoinaddress\n end",
"def show\n @account = Account.find_by_id(params[:id])\n if (@account)\n Rabl.render(@account, 'api/accounts/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid account\"}\n end\n end",
"def getaccount(namecoin_address)\n request :getaccount, namecoin_address\n end",
"def show\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n account = Account.find_by(id: params[:id], user_id: user[\"id\"])\n if ( account != nil )\n render json: account, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def account\n\n end",
"def get_account(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return nil\n end\n\n return find_account(accounts, options[:email])\nend",
"def current_account\n if session[:account_id]\n @current_account ||= Account.find_by(id: session[:account_id])\n end\n end",
"def account\n @user = current_user\n add_breadcrumb @user.name, :backend_account_path\n\n render :show\n end",
"def show\n @account = current_account\n end",
"def get_account(acct)\n\t\t$DB.where(account_name: acct).each do |t|\n\t\t\tputs \"#{t[:account_name]}: #{t[:balance]}\"\n\t\tend\n\tend",
"def set_account\n @account = current_user.accounts.find(params[:id])\n end",
"def set_account\n @account = current_user.accounts.find(params[:id])\n end",
"def get_account(params, transferred=false)\n return Account.get_from_name(params[:account], @current_user) unless params[:type] == 'transfer'\n\n if transferred\n return Account.get_from_name(params[:to_account], @current_user)\n else\n return Account.get_from_name(params[:from_account], @current_user)\n end\n end",
"def get(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n account = @accounts.select{|a| a.id == id}\n account = account.nil? || account.empty? ? nil : account[0]\n return account\n end",
"def account_name\n self.current_account.try :name\n end",
"def my_account\n accounts.currency_code_is(\"flc\").first\n end",
"def portfolio_accounts\n data = call_api(method: \"get\", url: \"/portfolio/accounts\" )\n @accountId = data.first[\"accountId\"]\n @accountId\n end",
"def account_by_address(address)\n account_name = request('getaccount', address)\n if account_name.present?\n account(account_name)\n else\n nil\n end\n end",
"def set_account\n @account = current_user.accounts.find(params[:account_id])\n end",
"def current_account\n @current_account ||= Account.find(session[:account_id]) if session[:account_id]\n end",
"def account_from; Account.get(self.account_from_id); end",
"def account_from; Account.get(self.account_from_id); end",
"def current_account\n load_session\n @current_account\n end",
"def find_account\n @current_account = Account.find_by_short_name(account_subdomain)\n if !@current_account\n logger.info(\"There's no account with short name #{account_subdomain}, redirecting to the home\")\n redirect_to public_home_page_url\n elsif @current_account.blocked?\n logger.info(\"Access attempt by blocked account #{account_subdomain}, redirecting to the home\")\n redirect_to public_home_page_url\n else\n logger.info(\"Request for account #{@current_account.short_name}\")\n handle_direct_login if @current_account.direct_login?\n end\n end",
"def show\n\t\t@account = Account.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def get_user(id, accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n get(path, options, AvaTax::VERSION) end",
"def bank_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/bank_accounts\").body)\n Promisepay::BankAccount.new(@client, response['bank_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end",
"def get_customer_account\n http_response = payment_get('/virtual_bank/accounts/self.json')\n \n if (http_response.code === 200)\n return {\n response_code: Shop::Transaction::API_RESPONSE_OK,\n response_data: {\n amount: http_response.parsed_response['amount'],\n }\n }\n else\n return {response_code: Shop::Transaction::API_RESPONSE_ERROR}\n end\n end"
] |
[
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.79495734",
"0.7806883",
"0.7634226",
"0.758146",
"0.758146",
"0.7475047",
"0.7367855",
"0.7353887",
"0.7311101",
"0.73054814",
"0.7285499",
"0.72487086",
"0.7248065",
"0.724525",
"0.7217176",
"0.7189942",
"0.7175459",
"0.7175459",
"0.7135971",
"0.70778173",
"0.70598924",
"0.70338637",
"0.69951",
"0.69877857",
"0.69765323",
"0.69618213",
"0.6959722",
"0.6949013",
"0.68992156",
"0.6878098",
"0.68745923",
"0.68481636",
"0.6816771",
"0.6806529",
"0.67907965",
"0.6757064",
"0.67435974",
"0.6741619",
"0.67259634",
"0.67166674",
"0.67166674",
"0.67134565",
"0.66966593",
"0.66966593",
"0.6688588",
"0.66882205",
"0.6667757",
"0.6663375",
"0.66579646",
"0.6652565",
"0.66490793",
"0.6629416",
"0.6628199",
"0.662386",
"0.6623318",
"0.6622896",
"0.6611046",
"0.6602327",
"0.65996385",
"0.659574",
"0.6595003",
"0.6587796",
"0.6568363",
"0.6547921",
"0.6543092",
"0.65050036",
"0.64996034",
"0.6490573",
"0.64846563",
"0.64833975",
"0.64769816",
"0.64619124",
"0.64619124",
"0.64559966",
"0.644264",
"0.64265686",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.64165586",
"0.6413385",
"0.6411678"
] |
0.0
|
-1
|
Single account Returns a single account
|
def get_account_by_id_with_http_info(budget_id, account_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountsApi.get_account_by_id ...'
end
# verify the required parameter 'budget_id' is set
if @api_client.config.client_side_validation && budget_id.nil?
fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_account_by_id"
end
# verify the required parameter 'account_id' is set
if @api_client.config.client_side_validation && account_id.nil?
fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_by_id"
end
# resource path
local_var_path = '/budgets/{budget_id}/accounts/{account_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'account_id' + '}', account_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['bearer']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'AccountResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AccountsApi#get_account_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account\n find('Account', account_id)\n end",
"def account\n get('account')\n end",
"def get_account(account_id)\n get(\"/account/#{account_id}\")\n end",
"def get_account(account_id)\n @accounts[account_id]\n end",
"def get_account(account_id)\n @accounts[account_id]\n end",
"def account_user(id)\n get(\"accountuser/#{id}\")\n end",
"def get_single_account(id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/accounts/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n Account.new(response)\n end",
"def find_account\n @account = current_user.accounts.find(params[:account_id])\n end",
"def account(params = {})\n make_get_request('/account', params)\n end",
"def account\n @account ||= Authentication::Account.find_by(email: username)\n end",
"def find_account\n @account = current_account\n end",
"def get_user\n\t\treturn Account.find(self.account_id)\n\tend",
"def id\n @account\n end",
"def account\n @account ||= Account.find(accountRef)\n end",
"def show_account(id)\n get(\"accounts/#{id}\")\n end",
"def account\n Atheme::User.new(@session, match(/\\(account\\s([^\\(]+)\\):/))\n end",
"def find_account\n @account = Account.find(params[:account_id])\n end",
"def find_account\n @account = Account.find(params[:account_id])\n end",
"def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end",
"def account\n @details ||= fetch_details\n @details[:account]\n end",
"def get_account_id\n if user\n return user.get_account_id\n end\n end",
"def user_account_instance\n Account.new\n end",
"def account\n self\n end",
"def account(&block)\n response = _get(\"accounts/current\")\n yield(response) if block_given?\n response[\"account\"]\n end",
"def account\n @account ||= AccountContext.new(self, @domain.client.account_sid)\n end",
"def account(fields: nil)\n params = build_fields_params fields\n res = @connection.get account_path, params\n Account.new res.body, self\n end",
"def get_account\n as_json(get_results('/account'))\n end",
"def account\n \t\t\tZapi::Models::Account.new\n \tend",
"def account\n @account = current_account_settings\n end",
"def find_account(name)\n return (accounts.select { |a| a[:name] == name }).first\n end",
"def current_account(raise_on_not_found = true)\n @current_account ||= Account.find_by_full_domain(request.host) || (Rails.env.development? ? Account.first : nil)\n raise ActiveRecord::RecordNotFound if !@current_account && raise_on_not_found\n @current_account\n end",
"def show\n @account = Account.find(params[:account_id])\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find(session[:account_id]) \n end\n end",
"def account\n @account ||= Harvest::API::Account.new(credentials)\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find_by_id(session[:account_id])\n end\n end",
"def current_account\n @current_account ||= company.accounts.find_by(id: self.id)\n end",
"def get_account(token, account_number)\n result = get_user_from_token(token)\n user_id = result.raw['userID']\n\n # Find the correct account\n accounts = result.raw['accounts'].select do |account|\n account['accountNo'] == account_number\n end\n\n if accounts.count > 0\n # Get the details of the account\n account = accounts[0]\n\n return {\n user_id: user_id,\n account: account\n }\n else\n raise Trading::Errors::LoginException.new(\n type: :error,\n code: '403',\n description: 'Account could not be found',\n messages: ['Account could not be found']\n )\n end\n end",
"def account\n @account ||= current_customer.account\n end",
"def current_account\n Account.find_by(id: session[:account_id])\n end",
"def current_account\n Account.find(session[:account_id]) if session[:account_id]\n end",
"def current_account\n Account.find(session[:account_id]) if session[:account_id]\n end",
"def getaccount(coinaddress)\n coind.getaccount coinaddress\n end",
"def find_account\n @to_find = Account.find(params[:id])\n end",
"def find_account\n @to_find = Account.find(params[:id])\n end",
"def user_account\n return @user_account\n end",
"def show\n response = @account_api.find(params[:id])\n @account = response[:account]\n # @user = RubyBank::CustomerApi.new(session[:token]).find(@account.customer_id)[:user]\n end",
"def show\n account = resource\n if params[:id].present?\n account = User.find_by_id(params[:id])\n end\n render json: account, status: 200\n end",
"def current_account\n @current_account\n end",
"def find_account_by_id(account_id)\n account = @accounts.find { |a| a.id == account_id }\n unless account || populated?\n account = Account.new(:id => account_id, :institution => self)\n @accounts << account\n end\n account\n end",
"def card_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/card_accounts\").body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end",
"def set_account\n response = @account_api.find(params[:id])\n @account = response[:account]\n end",
"def getaccount(bitcoinaddress)\n @api.request 'getaccount', bitcoinaddress\n end",
"def show\n @account = Account.find_by_id(params[:id])\n if (@account)\n Rabl.render(@account, 'api/accounts/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid account\"}\n end\n end",
"def getaccount(namecoin_address)\n request :getaccount, namecoin_address\n end",
"def show\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n account = Account.find_by(id: params[:id], user_id: user[\"id\"])\n if ( account != nil )\n render json: account, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def account\n\n end",
"def get_account(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return nil\n end\n\n return find_account(accounts, options[:email])\nend",
"def current_account\n if session[:account_id]\n @current_account ||= Account.find_by(id: session[:account_id])\n end\n end",
"def account\n @user = current_user\n add_breadcrumb @user.name, :backend_account_path\n\n render :show\n end",
"def show\n @account = current_account\n end",
"def get_account(acct)\n\t\t$DB.where(account_name: acct).each do |t|\n\t\t\tputs \"#{t[:account_name]}: #{t[:balance]}\"\n\t\tend\n\tend",
"def set_account\n @account = current_user.accounts.find(params[:id])\n end",
"def set_account\n @account = current_user.accounts.find(params[:id])\n end",
"def get_account(params, transferred=false)\n return Account.get_from_name(params[:account], @current_user) unless params[:type] == 'transfer'\n\n if transferred\n return Account.get_from_name(params[:to_account], @current_user)\n else\n return Account.get_from_name(params[:from_account], @current_user)\n end\n end",
"def get(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n account = @accounts.select{|a| a.id == id}\n account = account.nil? || account.empty? ? nil : account[0]\n return account\n end",
"def account_name\n self.current_account.try :name\n end",
"def my_account\n accounts.currency_code_is(\"flc\").first\n end",
"def portfolio_accounts\n data = call_api(method: \"get\", url: \"/portfolio/accounts\" )\n @accountId = data.first[\"accountId\"]\n @accountId\n end",
"def account_by_address(address)\n account_name = request('getaccount', address)\n if account_name.present?\n account(account_name)\n else\n nil\n end\n end",
"def set_account\n @account = current_user.accounts.find(params[:account_id])\n end",
"def current_account\n @current_account ||= Account.find(session[:account_id]) if session[:account_id]\n end",
"def account_from; Account.get(self.account_from_id); end",
"def account_from; Account.get(self.account_from_id); end",
"def current_account\n load_session\n @current_account\n end",
"def find_account\n @current_account = Account.find_by_short_name(account_subdomain)\n if !@current_account\n logger.info(\"There's no account with short name #{account_subdomain}, redirecting to the home\")\n redirect_to public_home_page_url\n elsif @current_account.blocked?\n logger.info(\"Access attempt by blocked account #{account_subdomain}, redirecting to the home\")\n redirect_to public_home_page_url\n else\n logger.info(\"Request for account #{@current_account.short_name}\")\n handle_direct_login if @current_account.direct_login?\n end\n end",
"def show\n\t\t@account = Account.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def set_account\n @account = Account.find(params[:id])\n end",
"def get_user(id, accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n get(path, options, AvaTax::VERSION) end",
"def bank_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/bank_accounts\").body)\n Promisepay::BankAccount.new(@client, response['bank_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end",
"def get_customer_account\n http_response = payment_get('/virtual_bank/accounts/self.json')\n \n if (http_response.code === 200)\n return {\n response_code: Shop::Transaction::API_RESPONSE_OK,\n response_data: {\n amount: http_response.parsed_response['amount'],\n }\n }\n else\n return {response_code: Shop::Transaction::API_RESPONSE_ERROR}\n end\n end"
] |
[
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.7991588",
"0.79495734",
"0.7806883",
"0.7634226",
"0.758146",
"0.758146",
"0.7475047",
"0.7367855",
"0.7353887",
"0.7311101",
"0.73054814",
"0.7285499",
"0.72487086",
"0.7248065",
"0.724525",
"0.7217176",
"0.7189942",
"0.7175459",
"0.7175459",
"0.7135971",
"0.70778173",
"0.70598924",
"0.70338637",
"0.69951",
"0.69877857",
"0.69765323",
"0.69618213",
"0.6959722",
"0.6949013",
"0.68992156",
"0.6878098",
"0.68745923",
"0.68481636",
"0.6816771",
"0.6806529",
"0.67907965",
"0.6757064",
"0.67435974",
"0.6741619",
"0.67259634",
"0.67166674",
"0.67166674",
"0.67134565",
"0.66966593",
"0.66966593",
"0.6688588",
"0.66882205",
"0.6667757",
"0.6663375",
"0.66579646",
"0.6652565",
"0.66490793",
"0.6629416",
"0.6628199",
"0.662386",
"0.6623318",
"0.6622896",
"0.6611046",
"0.6602327",
"0.65996385",
"0.659574",
"0.6595003",
"0.6587796",
"0.6568363",
"0.6547921",
"0.6543092",
"0.65050036",
"0.64996034",
"0.6490573",
"0.64846563",
"0.64833975",
"0.64769816",
"0.64619124",
"0.64619124",
"0.64559966",
"0.644264",
"0.64265686",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.6424142",
"0.64165586",
"0.6413385",
"0.6411678"
] |
0.0
|
-1
|
Account list Returns all accounts
|
def get_accounts(budget_id, opts = {})
data, _status_code, _headers = get_accounts_with_http_info(budget_id, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def accounts\n account_data = request('listaccounts')\n account_data.map do |account_name, account_value|\n Account.new(self, account_name, account_value, false)\n end\n end",
"def get_accounts\n @accounts = Account.all\n end",
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def accounts\n Management::Account.all(self)\n end",
"def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end",
"def list_accounts\n\ttp Account.all\nend",
"def accounts\n get('/accounts')['accounts']\n end",
"def accounts\n response = query_api(\"/rest/accounts\")\n return response[\"accounts\"].map {|account| Account.new(self, account)}\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end",
"def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end",
"def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end",
"def index\n @user_accounts = UserAccount.all\n end",
"def index\n @api_v1_accounts = Api::V1::Account.all\n end",
"def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend",
"def all\n result = @dealing_platform.session.get('accounts').fetch :accounts\n\n @dealing_platform.instantiate_models Account, result\n end",
"def accounts\n\t\treturn @accounts\n\tend",
"def index\n @a_accounts = AAccount.all\n end",
"def index\n @accounts = current_user.accounts\n end",
"def index\n @accounts = current_user.accounts\n end",
"def index\n @accountables = Accountable.all\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def index\n\t\t@accounts = Account.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @accounts }\n\t\tend\n\tend",
"def index\n @account_users = AccountUser.account_users_for(current_user.id)\n end",
"def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end",
"def list_all\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n respond_to do |format|\n format.html { render 'account/index' }\n format.json { render 'account/index' }\n format.xml { render 'account/index' }\n end\n end",
"def list_of_accounts_online\n Stripe.api_key = Rails.application.credentials.stripe[Rails.env.to_sym][:secret_key]\n return Stripe::Account.list\n end",
"def index\n @t_user_accounts = TUserAccount.all\n end",
"def all_accounts\n with_exclusive_scope { self.all }\n end",
"def index\n @accounts = Account.where(:user_id => current_user.id)\n end",
"def index\n @account_logins = AccountLogin.all\n end",
"def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end",
"def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end",
"def index\n @core_accounts = Core::Account.all\n end",
"def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end",
"def index\n @accounts = Account.where(user_id: @current_user.id)\n end",
"def get_accounts_list(load_on_init = true)\n AccountsList.new(self, load_on_init)\n end",
"def get_accounts\n response_xml = http_get(@client, \"#{xero_url}/Accounts\")\n parse_response(response_xml, {}, {:request_signature => 'GET/accounts'})\n end",
"def index\n @accounts = Account.page(params[:page])\n end",
"def fetch_accounts\n log 'fetch_accounts'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n cuentas = data['datosSalidaCuentas']['cuentas'].zip(data['datosSalidaCodIban']['datosIban'])\n cuentas.map{ |data| build_account(data) }\n end",
"def index\n @baka_accounts = BakaAccount.all\n end",
"def index\n @b_accounts = BAccount.all\n end",
"def account_list\n return [] unless company\n [company] + company.sibling_accounts\n end",
"def render_accounts\n\t accounts = []\n\t self.accounts.each do |acc|\n\t \taccounts.push acc.render_detail\n\t end\n\t \n\t accounts\n\tend",
"def accounts\n period.accounts\n end",
"def index\n response = @account_api.find_all\n if response[:status].to_i == 403\n redirect_to home_index_path\n flash[:alert] = \"You are not allowed to access this page\"\n end\n\n @accounts = response[:accounts]\n end",
"def accounts\n @browser.lis(data_semantic: 'account-item')\n end",
"def index\n @account_records = AccountRecord.all\n end",
"def sub_accounts(conditions = {})\n client.accounts.list(conditions)\n end",
"def index\n @ad_accounts = AdAccount.all\n end",
"def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end",
"def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end",
"def index\n @insta_accounts = InstaAccount.all\n end",
"def all\n Message::Statement.display_all_account_data(raw_data_to_a)\n end",
"def accounts(query = nil)\n exec(\"accounts #{query if query}\").split(\"\\n\")\n end",
"def index\n @current_accounts = CurrentAccount.all\n\n \n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @accounts.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def all\n @account = Account.new\n @page[:per_page] = Account.count\n @accounts = Account.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @accounts, callback: params[:callback] }\n format.xml { render xml: @accounts }\n format.rss { render 'feed' }\n end\n end",
"def index\n @accounts = @project.accounts\n end",
"def index\n @accountants = Accountant.all\n end",
"def index\n @accounts = Account.where(user_id = session[:user_id])\n end",
"def index\n @oauth_accounts = OauthAccount.all\n end",
"def index\n @accounts = User::Account.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_accounts }\n end\n end",
"def index\n if current_user and Account.find_by_user_id(current_user[:id])\n @accounts = Account.where(current_user[:id])\n else\n flash[:notice] = 'No accounts to view. Request one.'\n redirect_to user_path, {:id => current_user[:id]}\n end\n end",
"def index\n @accounts = current_user.accounts\n @help = \"Account List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end",
"def index\n @accounts = Account.all\n Rabl.render(@accounts, 'api/accounts/index', view_path: 'app/views')\n end",
"def index\n @account_links = AccountLink.all\n end",
"def index\n if is_branch_manager?\n @user_accounts = UserAccount.all\n success_response(message: 'All Accounts', data: { user_accounts: @user_accounts })\n else\n error_response(message: response.status_message, data: response.data)\n end\n end",
"def accounts\n @transactions.collect(&:account).uniq\n end",
"def index\n @admin_account_types = AccountType.all\n end",
"def index\n @platform_accounts = PlatformAccount.all\n end",
"def index\n @inc_stable_accounts = IncStableAccount.all\n end",
"def accounts\n end",
"def index\n @scouts_accounts = ScoutsAccount.all\n end",
"def index\n @synthetic_accounts = SyntheticAccount.all\n end",
"def fetch_accounts\n acc_obj_arr = []\n accounts.each do |link|\n link.click\n puts \"Accessing account: #{acc_name}\"\n wait_to_load\n puts 'Loading transactions data'\n scroll_to_bottom\n puts '>Transactions data successfully loaded'\n puts 'Fetching transactions'\n tr = TransFetch.new(@bank_page).fetch_trans\n acc_obj_arr << Account.new(acc_name, acc_currency, acc_balance,\n 'Credit Card', tr)\n puts \">Successfully retrieved data for #{acc_name} account\"\n end\n acc_obj_arr\n end",
"def index\n @analytic_accounts = AnalyticAccount.all\n\n\n end",
"def index\n @accounts = Account.alumni.paginate(:page => params[:page], :per_page => 50)\n end",
"def index\n @bank_accounts = BankAccount.all\n end",
"def index\n @bank_accounts = BankAccount.all\n end",
"def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end",
"def accounts\n return @accounts if @accounts\n @accounts = [ brokerage_account, bank_account ].compact\n end",
"def list_accounts(id: nil, alias_name:nil)\n params = {}\n params = {id: id} if id\n params = {alias: alias_name} if alias_name\n client.make_request('/list-accounts', 'post', params: params)\n end",
"def index\n if params[:tag]\n @accounts = Account.tagged_with(params[:tag])\n else\n @accounts = Account.all\n end\n end",
"def index\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n accounts = Account.where(user_id: user[\"id\"])\n render json: accounts, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def index\n @heroku_accounts = Heroku::Account.all\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"Accounts.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.accounts.each do |plumbing_item|\n g.yield Plumbing::convert_account_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def index\n @connected_accounts = ConnectedAccount.all\n # list = list_of_accounts_online\n # @accounts = list_of_accounts_online[\"data\"]\n end",
"def list(q=nil)\n _params = {:q => q}\n return @master.call 'subaccounts/list', _params\n end",
"def index\n @admin_accounts = Admin::Account.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @admin_accounts }\n end\n end"
] |
[
"0.8230852",
"0.80566627",
"0.79811406",
"0.7957752",
"0.78999263",
"0.78936106",
"0.78550804",
"0.78464746",
"0.77886575",
"0.7787846",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.7753174",
"0.7737287",
"0.7631079",
"0.76187927",
"0.7598658",
"0.758949",
"0.7588896",
"0.75792086",
"0.75495744",
"0.7510461",
"0.7510461",
"0.75084066",
"0.7506957",
"0.74810463",
"0.7430283",
"0.7415482",
"0.74063593",
"0.73667276",
"0.73583335",
"0.7333615",
"0.7332699",
"0.73006797",
"0.7277094",
"0.7275499",
"0.7267288",
"0.72667414",
"0.72654575",
"0.72630143",
"0.7233973",
"0.7225173",
"0.72172564",
"0.72167474",
"0.7194513",
"0.7186535",
"0.71814305",
"0.71806604",
"0.7161302",
"0.71591073",
"0.71476674",
"0.714204",
"0.7141123",
"0.7134693",
"0.71282506",
"0.71203893",
"0.7117244",
"0.7095961",
"0.70859355",
"0.7079387",
"0.70636415",
"0.703399",
"0.70279425",
"0.70266503",
"0.70097786",
"0.7009574",
"0.7003651",
"0.6995755",
"0.6984881",
"0.6977016",
"0.6966856",
"0.695663",
"0.69390404",
"0.6930592",
"0.69181603",
"0.6914874",
"0.68956953",
"0.6893465",
"0.68771684",
"0.687117",
"0.68607634",
"0.6855476",
"0.6855476",
"0.6852365",
"0.6847649",
"0.6840642",
"0.6840026",
"0.68355054",
"0.6829328",
"0.6820669",
"0.6805931",
"0.68044287",
"0.6799791"
] |
0.0
|
-1
|
Account list Returns all accounts
|
def get_accounts_with_http_info(budget_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'
end
# verify the required parameter 'budget_id' is set
if @api_client.config.client_side_validation && budget_id.nil?
fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_accounts"
end
# resource path
local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', budget_id.to_s)
# query parameters
query_params = {}
query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['bearer']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'AccountsResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AccountsApi#get_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def accounts\n account_data = request('listaccounts')\n account_data.map do |account_name, account_value|\n Account.new(self, account_name, account_value, false)\n end\n end",
"def get_accounts\n @accounts = Account.all\n end",
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def accounts\n Management::Account.all(self)\n end",
"def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end",
"def list_accounts\n\ttp Account.all\nend",
"def accounts\n get('/accounts')['accounts']\n end",
"def accounts\n response = query_api(\"/rest/accounts\")\n return response[\"accounts\"].map {|account| Account.new(self, account)}\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def index\n @accounts = Account.all\n end",
"def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end",
"def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end",
"def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end",
"def index\n @user_accounts = UserAccount.all\n end",
"def index\n @api_v1_accounts = Api::V1::Account.all\n end",
"def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend",
"def all\n result = @dealing_platform.session.get('accounts').fetch :accounts\n\n @dealing_platform.instantiate_models Account, result\n end",
"def accounts\n\t\treturn @accounts\n\tend",
"def index\n @a_accounts = AAccount.all\n end",
"def index\n @accounts = current_user.accounts\n end",
"def index\n @accounts = current_user.accounts\n end",
"def index\n @accountables = Accountable.all\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def index\n\t\t@accounts = Account.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @accounts }\n\t\tend\n\tend",
"def index\n @account_users = AccountUser.account_users_for(current_user.id)\n end",
"def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end",
"def list_all\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n respond_to do |format|\n format.html { render 'account/index' }\n format.json { render 'account/index' }\n format.xml { render 'account/index' }\n end\n end",
"def list_of_accounts_online\n Stripe.api_key = Rails.application.credentials.stripe[Rails.env.to_sym][:secret_key]\n return Stripe::Account.list\n end",
"def index\n @t_user_accounts = TUserAccount.all\n end",
"def all_accounts\n with_exclusive_scope { self.all }\n end",
"def index\n @accounts = Account.where(:user_id => current_user.id)\n end",
"def index\n @account_logins = AccountLogin.all\n end",
"def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end",
"def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end",
"def index\n @core_accounts = Core::Account.all\n end",
"def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end",
"def index\n @accounts = Account.where(user_id: @current_user.id)\n end",
"def get_accounts_list(load_on_init = true)\n AccountsList.new(self, load_on_init)\n end",
"def get_accounts\n response_xml = http_get(@client, \"#{xero_url}/Accounts\")\n parse_response(response_xml, {}, {:request_signature => 'GET/accounts'})\n end",
"def index\n @accounts = Account.page(params[:page])\n end",
"def fetch_accounts\n log 'fetch_accounts'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n cuentas = data['datosSalidaCuentas']['cuentas'].zip(data['datosSalidaCodIban']['datosIban'])\n cuentas.map{ |data| build_account(data) }\n end",
"def index\n @baka_accounts = BakaAccount.all\n end",
"def index\n @b_accounts = BAccount.all\n end",
"def account_list\n return [] unless company\n [company] + company.sibling_accounts\n end",
"def render_accounts\n\t accounts = []\n\t self.accounts.each do |acc|\n\t \taccounts.push acc.render_detail\n\t end\n\t \n\t accounts\n\tend",
"def accounts\n period.accounts\n end",
"def index\n response = @account_api.find_all\n if response[:status].to_i == 403\n redirect_to home_index_path\n flash[:alert] = \"You are not allowed to access this page\"\n end\n\n @accounts = response[:accounts]\n end",
"def accounts\n @browser.lis(data_semantic: 'account-item')\n end",
"def index\n @account_records = AccountRecord.all\n end",
"def sub_accounts(conditions = {})\n client.accounts.list(conditions)\n end",
"def index\n @ad_accounts = AdAccount.all\n end",
"def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end",
"def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end",
"def index\n @insta_accounts = InstaAccount.all\n end",
"def all\n Message::Statement.display_all_account_data(raw_data_to_a)\n end",
"def accounts(query = nil)\n exec(\"accounts #{query if query}\").split(\"\\n\")\n end",
"def index\n @current_accounts = CurrentAccount.all\n\n \n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @accounts.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def all\n @account = Account.new\n @page[:per_page] = Account.count\n @accounts = Account.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @accounts, callback: params[:callback] }\n format.xml { render xml: @accounts }\n format.rss { render 'feed' }\n end\n end",
"def index\n @accounts = @project.accounts\n end",
"def index\n @accountants = Accountant.all\n end",
"def index\n @accounts = Account.where(user_id = session[:user_id])\n end",
"def index\n @oauth_accounts = OauthAccount.all\n end",
"def index\n @accounts = User::Account.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_accounts }\n end\n end",
"def index\n if current_user and Account.find_by_user_id(current_user[:id])\n @accounts = Account.where(current_user[:id])\n else\n flash[:notice] = 'No accounts to view. Request one.'\n redirect_to user_path, {:id => current_user[:id]}\n end\n end",
"def index\n @accounts = current_user.accounts\n @help = \"Account List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end",
"def index\n @accounts = Account.all\n Rabl.render(@accounts, 'api/accounts/index', view_path: 'app/views')\n end",
"def index\n @account_links = AccountLink.all\n end",
"def index\n if is_branch_manager?\n @user_accounts = UserAccount.all\n success_response(message: 'All Accounts', data: { user_accounts: @user_accounts })\n else\n error_response(message: response.status_message, data: response.data)\n end\n end",
"def accounts\n @transactions.collect(&:account).uniq\n end",
"def index\n @admin_account_types = AccountType.all\n end",
"def index\n @platform_accounts = PlatformAccount.all\n end",
"def index\n @inc_stable_accounts = IncStableAccount.all\n end",
"def accounts\n end",
"def index\n @scouts_accounts = ScoutsAccount.all\n end",
"def index\n @synthetic_accounts = SyntheticAccount.all\n end",
"def fetch_accounts\n acc_obj_arr = []\n accounts.each do |link|\n link.click\n puts \"Accessing account: #{acc_name}\"\n wait_to_load\n puts 'Loading transactions data'\n scroll_to_bottom\n puts '>Transactions data successfully loaded'\n puts 'Fetching transactions'\n tr = TransFetch.new(@bank_page).fetch_trans\n acc_obj_arr << Account.new(acc_name, acc_currency, acc_balance,\n 'Credit Card', tr)\n puts \">Successfully retrieved data for #{acc_name} account\"\n end\n acc_obj_arr\n end",
"def index\n @analytic_accounts = AnalyticAccount.all\n\n\n end",
"def index\n @accounts = Account.alumni.paginate(:page => params[:page], :per_page => 50)\n end",
"def index\n @bank_accounts = BankAccount.all\n end",
"def index\n @bank_accounts = BankAccount.all\n end",
"def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end",
"def accounts\n return @accounts if @accounts\n @accounts = [ brokerage_account, bank_account ].compact\n end",
"def list_accounts(id: nil, alias_name:nil)\n params = {}\n params = {id: id} if id\n params = {alias: alias_name} if alias_name\n client.make_request('/list-accounts', 'post', params: params)\n end",
"def index\n if params[:tag]\n @accounts = Account.tagged_with(params[:tag])\n else\n @accounts = Account.all\n end\n end",
"def index\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n accounts = Account.where(user_id: user[\"id\"])\n render json: accounts, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def index\n @heroku_accounts = Heroku::Account.all\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"Accounts.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.accounts.each do |plumbing_item|\n g.yield Plumbing::convert_account_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def index\n @connected_accounts = ConnectedAccount.all\n # list = list_of_accounts_online\n # @accounts = list_of_accounts_online[\"data\"]\n end",
"def list(q=nil)\n _params = {:q => q}\n return @master.call 'subaccounts/list', _params\n end",
"def index\n @admin_accounts = Admin::Account.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @admin_accounts }\n end\n end"
] |
[
"0.8230852",
"0.80566627",
"0.79811406",
"0.7957752",
"0.78999263",
"0.78936106",
"0.78550804",
"0.78464746",
"0.77886575",
"0.7787846",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.77548766",
"0.7753174",
"0.7737287",
"0.7631079",
"0.76187927",
"0.7598658",
"0.758949",
"0.7588896",
"0.75792086",
"0.75495744",
"0.7510461",
"0.7510461",
"0.75084066",
"0.7506957",
"0.74810463",
"0.7430283",
"0.7415482",
"0.74063593",
"0.73667276",
"0.73583335",
"0.7333615",
"0.7332699",
"0.73006797",
"0.7277094",
"0.7275499",
"0.7267288",
"0.72667414",
"0.72654575",
"0.72630143",
"0.7233973",
"0.7225173",
"0.72172564",
"0.72167474",
"0.7194513",
"0.7186535",
"0.71814305",
"0.71806604",
"0.7161302",
"0.71591073",
"0.71476674",
"0.714204",
"0.7141123",
"0.7134693",
"0.71282506",
"0.71203893",
"0.7117244",
"0.7095961",
"0.70859355",
"0.7079387",
"0.70636415",
"0.703399",
"0.70279425",
"0.70266503",
"0.70097786",
"0.7009574",
"0.7003651",
"0.6995755",
"0.6984881",
"0.6977016",
"0.6966856",
"0.695663",
"0.69390404",
"0.6930592",
"0.69181603",
"0.6914874",
"0.68956953",
"0.6893465",
"0.68771684",
"0.687117",
"0.68607634",
"0.6855476",
"0.6855476",
"0.6852365",
"0.6847649",
"0.6840642",
"0.6840026",
"0.68355054",
"0.6829328",
"0.6820669",
"0.6805931",
"0.68044287",
"0.6799791"
] |
0.0
|
-1
|
GET /pricing_sections or /pricing_sections.json
|
def index
@pricing_sections = PricingSection.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def pricing\n request('pricing', :get)\n end",
"def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end",
"def show\n render json: @pricing\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def set_pricing_section\n @pricing_section = PricingSection.find(params[:id])\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def show\n @pricing_structure = PricingStructure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pricing_structure }\n end\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def show\n if params[:short_url]\n @shop_section = ShopSection.find_by_short_url(params[:short_url])\n else\n @shop_section = ShopSection.find(params[:id])\n end\n\n raise NotFound unless @shop_section\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_section }\n end\n end",
"def update\n respond_to do |format|\n if @pricing_section.update(pricing_section_params)\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pricing_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def list_sections\n \n end",
"def show\n @sections = Section.find(params[:id])\n end",
"def list_sections(opts = {})\n data, _status_code, _headers = list_sections_with_http_info(opts)\n data\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def licenses\n publisher_id = current_user.id\n @licenses = PowerChip.where(:publisher_id=>publisher_id)\n respond_to do |format|\n format.html # licenses.html.erb\n format.json { render json: @licenses }\n end\n end",
"def index\n @menu = Menu.find(params[:menu_id])\n @sections = @menu.sections\n render json: SectionSerializer.new(@sections)\n end",
"def show\n respond_to do |format|\n format.html { render html: @section }\n format.json { render json: @section }\n end\n end",
"def price(options)\n request :public, :get, :price, options\n end",
"def create\n @pricing_section = PricingSection.new(pricing_section_params)\n\n respond_to do |format|\n if @pricing_section.save\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully created.\" }\n format.json { render :show, status: :created, location: @pricing_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prices (currency='TWD')\n get '/prices/' + currency\n end",
"def pricing_section_params\n params.require(:pricing_section).permit(:section_id, :description)\n end",
"def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def index\n @sections = Section.all.paginate(:page => params[:page], :per_page => 100)\n end",
"def get_sections (subdomain,course_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/courses/#{course_id}/sections\"\n )\n end",
"def show\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def index\n @product_sections = ProductSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sections }\n end\n end",
"def show\n @section_category = SectionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_category }\n end\n end",
"def show\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_section }\n end\n end",
"def show\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu_section }\n end\n end",
"def destroy\n @pricing_section.destroy\n respond_to do |format|\n format.html { redirect_to pricing_sections_url, notice: \"Pricing section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def index\n @page_sections = PageSection.all\n end",
"def show\n @page = Page.find(params[:id])\n @section = @page.section\n\n respond_to do |format|\n format.html { render :template => 'sections/show' }\n format.xml { render :xml => @page }\n end\n end",
"def show\n @encyclopaedia = Encyclopaedia.find(params[:id])\n @sections = @encyclopaedia.sections.all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encyclopaedia}\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def show\n if !params.has_key?(:section)\n redirect_to courses_path and return\n end\n\n @course = Course.find(params[:id])\n authorize! :read, @course\n @section = Section.find(params[:section])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_price }\n end\n end",
"def show\n @price_level = PriceLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price_level }\n end\n end",
"def list_sections_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.list_sections ...'\n end\n if @api_client.config.client_side_validation && opts[:'enforced_on'] && !['VIF', 'LOGICALROUTER', 'BRIDGEENDPOINT', 'DHCP_SERVICE', 'METADATA_PROXY', 'L2VPN_SESSION', 'NONE'].include?(opts[:'enforced_on'])\n fail ArgumentError, 'invalid value for \"enforced_on\", must be one of VIF, LOGICALROUTER, BRIDGEENDPOINT, DHCP_SERVICE, METADATA_PROXY, L2VPN_SESSION, NONE'\n end\n if @api_client.config.client_side_validation && opts[:'exclude_applied_to_type'] && !['NSGroup', 'LogicalSwitch', 'LogicalRouter', 'LogicalPort'].include?(opts[:'exclude_applied_to_type'])\n fail ArgumentError, 'invalid value for \"exclude_applied_to_type\", must be one of NSGroup, LogicalSwitch, LogicalRouter, LogicalPort'\n end\n if @api_client.config.client_side_validation && opts[:'filter_type'] && !['FILTER', 'SEARCH'].include?(opts[:'filter_type'])\n fail ArgumentError, 'invalid value for \"filter_type\", must be one of FILTER, SEARCH'\n end\n if @api_client.config.client_side_validation && opts[:'include_applied_to_type'] && !['NSGroup', 'LogicalSwitch', 'LogicalRouter', 'LogicalPort'].include?(opts[:'include_applied_to_type'])\n fail ArgumentError, 'invalid value for \"include_applied_to_type\", must be one of NSGroup, LogicalSwitch, LogicalRouter, LogicalPort'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesFirewallApi.list_sections, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesFirewallApi.list_sections, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'type'] && !['LAYER2', 'LAYER3'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of LAYER2, LAYER3'\n end\n # resource path\n local_var_path = '/firewall/sections'\n\n # query parameters\n query_params = {}\n query_params[:'applied_tos'] = opts[:'applied_tos'] if !opts[:'applied_tos'].nil?\n query_params[:'context_profiles'] = opts[:'context_profiles'] if !opts[:'context_profiles'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'deep_search'] = opts[:'deep_search'] if !opts[:'deep_search'].nil?\n query_params[:'destinations'] = opts[:'destinations'] if !opts[:'destinations'].nil?\n query_params[:'enforced_on'] = opts[:'enforced_on'] if !opts[:'enforced_on'].nil?\n query_params[:'exclude_applied_to_type'] = opts[:'exclude_applied_to_type'] if !opts[:'exclude_applied_to_type'].nil?\n query_params[:'extended_sources'] = opts[:'extended_sources'] if !opts[:'extended_sources'].nil?\n query_params[:'filter_type'] = opts[:'filter_type'] if !opts[:'filter_type'].nil?\n query_params[:'include_applied_to_type'] = opts[:'include_applied_to_type'] if !opts[:'include_applied_to_type'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'locked'] = opts[:'locked'] if !opts[:'locked'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'search_invalid_references'] = opts[:'search_invalid_references'] if !opts[:'search_invalid_references'].nil?\n query_params[:'search_scope'] = opts[:'search_scope'] if !opts[:'search_scope'].nil?\n query_params[:'services'] = opts[:'services'] if !opts[:'services'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sources'] = opts[:'sources'] if !opts[:'sources'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSectionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#list_sections\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @product_section = ProductSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_section }\n end\n end",
"def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end",
"def index\n @sections=Section.all\n end",
"def index\n @admin_pricing_foams = Admin::Pricing::Foam.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_foams.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end",
"def index\n get_sparepart\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n format.js\n end\n end",
"def show\n @section = Section.includes(:profile).find(params[:id])\n # @teachers = @section.teachers.page(params[:page])\n @users = @section.students.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def show\n @price = Price.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price }\n end\n end",
"def show\n @price = Price.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price }\n end\n end",
"def all_prices\n request :public, :get, :price\n end",
"def show\n @course_enrollments = @course_offering.course_enrollments.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render :json => @course_offering }\n end\n end",
"def show\n @cp_score_sheet_section = CpScoreSheetSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cp_score_sheet_section }\n end\n end",
"def insurance_prices(params = {})\n scope 'default'\n get('prices/insurance', params)\n end",
"def show\n render json: @price_field\n end",
"def detail\n if params[:category] == \"materials\"\n sections_detail\n elsif current_user.try(:admin?) || @api_user.try(:admin?) \n if params[:category] == \"jobs\"\n jobs_detail\n elsif params[:category] == \"fabrication_orders\"\n forders_detail\n elsif params[:category] == \"tasks\"\n products_detail\n elsif params[:category] == \"rooms\"\n rooms_detail \n end\n else\n render json: api_response(:failed, \"you are not authorized to access this page\", nil) and return\n end\n \n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_company_price }\n end\n end",
"def index\n @prices = Price.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"def url\n '/api/invoices'\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n option = params[:option]\n @courses = Course.all\n\n respond_to do |format|\n if option == \"2\" # La opcion 2 corresponde a la administracion de cursos.\n format.html # index.html.erb\n format.json { render json: @courses }\n else #opcion 1 u otra\n # Corresponde a la visualizacion de los cursos y sus OA's asociados\n format.html { render 'index_common' }\n end\n end\n end",
"def get_all_data_by_pricing_plan_id\n if request.xhr?\n @features = Feature.get_all_data_by_pricing_plan_id(params[:id])\n render :json => @features\n end\n end",
"def index\n @sections = @page.sections.sorted\n end",
"def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def court_sports\n render json: @venue.supported_sports_options\n end",
"def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end",
"def index\n @survey_sections = SurveySection.page(params[:page]).per(100)\n end",
"def show\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_section }\n end\n end",
"def show\n flash.keep\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @service_pricing_scheme }\n end\n end",
"def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"def index\n @prices = @prices.includes(:good).paginate( :page => params[:page])\n end",
"def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end",
"def index\n @licenses = License.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @licenses }\n end\n end",
"def index\n #@sections = Section.find(params[:course_id])\n #@sections = Section.all\n end",
"def show\n @product_price = ProductPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_price }\n end\n end",
"def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end",
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def show\n @license = License.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @license }\n end\n end",
"def playset_pricing_ajax\n card = Mtg::Card.joins(:set).includes(:statistics).active.where(\"mtg_cards.name LIKE ? AND mtg_sets.code LIKE ?\", \"#{params[:name]}\", \"#{params[:set]}\").first\n listing = card.listings.build(:condition => params[:condition], :playset => true)\n respond_to do |format|\n format.json do\n recommended_pricing = listing.product_recommended_pricing\n playset_price_low = recommended_pricing[:price_low].dollars\n playset_price_med = recommended_pricing[:price_med].dollars\n playset_price_high = recommended_pricing[:price_high].dollars\n label_low = generate_pricing_label \"Low\", recommended_pricing[:price_low].dollars\n label_med = generate_pricing_label \"Average\", recommended_pricing[:price_med].dollars\n label_high = generate_pricing_label \"High\", recommended_pricing[:price_high].dollars\n render :json => [[label_low, playset_price_low], [label_med, playset_price_med], [label_high, playset_price_high], [\"Other\", \"other\"]].to_json\n end\n end\n end"
] |
[
"0.650615",
"0.64592797",
"0.6401837",
"0.63283855",
"0.6098201",
"0.6098201",
"0.60506755",
"0.6044163",
"0.59810024",
"0.59753543",
"0.58807594",
"0.58678555",
"0.57875943",
"0.57875943",
"0.57875943",
"0.5787582",
"0.57462263",
"0.5741422",
"0.56877404",
"0.56698936",
"0.56445",
"0.5584658",
"0.5567374",
"0.55666745",
"0.55459476",
"0.5521882",
"0.5515806",
"0.5515806",
"0.5515806",
"0.5515806",
"0.5515806",
"0.5515806",
"0.5515806",
"0.5515317",
"0.54952115",
"0.5488289",
"0.5483201",
"0.546611",
"0.543689",
"0.5430788",
"0.54102725",
"0.54001784",
"0.5389008",
"0.5372833",
"0.5365967",
"0.53633165",
"0.53539795",
"0.5352376",
"0.5344247",
"0.53369594",
"0.5327082",
"0.53078926",
"0.529704",
"0.52953166",
"0.5292228",
"0.52840245",
"0.5271977",
"0.52593887",
"0.5247166",
"0.52449715",
"0.524207",
"0.52307355",
"0.52302754",
"0.52248317",
"0.5221851",
"0.5216622",
"0.5197264",
"0.5197264",
"0.5192926",
"0.5192926",
"0.5192433",
"0.5191806",
"0.51872045",
"0.5165011",
"0.5164557",
"0.5163656",
"0.516134",
"0.5157322",
"0.5156238",
"0.51451063",
"0.5134609",
"0.5122148",
"0.51212406",
"0.51189727",
"0.5118518",
"0.5117914",
"0.51176643",
"0.5117445",
"0.51155883",
"0.5107149",
"0.5107149",
"0.5105158",
"0.5104833",
"0.5100474",
"0.509583",
"0.50946456",
"0.5090654",
"0.50894415",
"0.50840753",
"0.5074554"
] |
0.709728
|
0
|
GET /pricing_sections/1 or /pricing_sections/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @pricing_sections = PricingSection.all\n end",
"def pricing\n request('pricing', :get)\n end",
"def show\n render json: @pricing\n end",
"def set_pricing_section\n @pricing_section = PricingSection.find(params[:id])\n end",
"def show\n @pricing_structure = PricingStructure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pricing_structure }\n end\n end",
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def update\n respond_to do |format|\n if @pricing_section.update(pricing_section_params)\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pricing_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def show\n if params[:short_url]\n @shop_section = ShopSection.find_by_short_url(params[:short_url])\n else\n @shop_section = ShopSection.find(params[:id])\n end\n\n raise NotFound unless @shop_section\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_section }\n end\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def create\n @pricing_section = PricingSection.new(pricing_section_params)\n\n respond_to do |format|\n if @pricing_section.save\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully created.\" }\n format.json { render :show, status: :created, location: @pricing_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def licenses\n publisher_id = current_user.id\n @licenses = PowerChip.where(:publisher_id=>publisher_id)\n respond_to do |format|\n format.html # licenses.html.erb\n format.json { render json: @licenses }\n end\n end",
"def pricing_section_params\n params.require(:pricing_section).permit(:section_id, :description)\n end",
"def show\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def show\n @sections = Section.find(params[:id])\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_price }\n end\n end",
"def show\n @section_category = SectionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_category }\n end\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def price(options)\n request :public, :get, :price, options\n end",
"def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def show\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_section }\n end\n end",
"def show\n respond_to do |format|\n format.html { render html: @section }\n format.json { render json: @section }\n end\n end",
"def show\n @price = Price.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price }\n end\n end",
"def show\n @price = Price.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price }\n end\n end",
"def show\n @price_level = PriceLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price_level }\n end\n end",
"def destroy\n @pricing_section.destroy\n respond_to do |format|\n format.html { redirect_to pricing_sections_url, notice: \"Pricing section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def show\n render json: @price_field\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def show\n if !params.has_key?(:section)\n redirect_to courses_path and return\n end\n\n @course = Course.find(params[:id])\n authorize! :read, @course\n @section = Section.find(params[:section])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_company_price }\n end\n end",
"def show\n @product_price = ProductPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_price }\n end\n end",
"def show\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu_section }\n end\n end",
"def show\n @cp_score_sheet_section = CpScoreSheetSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cp_score_sheet_section }\n end\n end",
"def show\n @license = License.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @license }\n end\n end",
"def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end",
"def index\n @admin_pricing_foams = Admin::Pricing::Foam.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_foams.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end",
"def index\n @menu = Menu.find(params[:menu_id])\n @sections = @menu.sections\n render json: SectionSerializer.new(@sections)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end",
"def prices (currency='TWD')\n get '/prices/' + currency\n end",
"def show\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_section }\n end\n end",
"def show\n @product_section = ProductSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_section }\n end\n end",
"def list_sections\n \n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def playset_pricing_ajax\n card = Mtg::Card.joins(:set).includes(:statistics).active.where(\"mtg_cards.name LIKE ? AND mtg_sets.code LIKE ?\", \"#{params[:name]}\", \"#{params[:set]}\").first\n listing = card.listings.build(:condition => params[:condition], :playset => true)\n respond_to do |format|\n format.json do\n recommended_pricing = listing.product_recommended_pricing\n playset_price_low = recommended_pricing[:price_low].dollars\n playset_price_med = recommended_pricing[:price_med].dollars\n playset_price_high = recommended_pricing[:price_high].dollars\n label_low = generate_pricing_label \"Low\", recommended_pricing[:price_low].dollars\n label_med = generate_pricing_label \"Average\", recommended_pricing[:price_med].dollars\n label_high = generate_pricing_label \"High\", recommended_pricing[:price_high].dollars\n render :json => [[label_low, playset_price_low], [label_med, playset_price_med], [label_high, playset_price_high], [\"Other\", \"other\"]].to_json\n end\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def show\n @page = Page.find(params[:id])\n @section = @page.section\n\n respond_to do |format|\n format.html { render :template => 'sections/show' }\n format.xml { render :xml => @page }\n end\n end",
"def show\n @course_enrollments = @course_offering.course_enrollments.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render :json => @course_offering }\n end\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def show\n @invoice = Invoice.find(params[:id])\n @subtotals = producto_subtotal(params[:id])\n @cantidades = producto_cantidad(params[:id])\n @precio_unitario = precio_unitario(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end",
"def show\n @collection_invoice = CollectionInvoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection_invoice }\n end\n end",
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def get_all_data_by_pricing_plan_id\n if request.xhr?\n @features = Feature.get_all_data_by_pricing_plan_id(params[:id])\n render :json => @features\n end\n end",
"def index\n @product_sections = ProductSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sections }\n end\n end",
"def insurance_prices(params = {})\n scope 'default'\n get('prices/insurance', params)\n end",
"def show\n flash.keep\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @service_pricing_scheme }\n end\n end",
"def index\n @prices = Price.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"def index\n @admin_pricing_fabrics = Admin::Pricing::Fabric.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_fabrics.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end",
"def show\n @gold_price = GoldPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gold_price }\n end\n end",
"def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end",
"def all_prices\n request :public, :get, :price\n end",
"def show\n @self_drive_price = SelfDrivePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @self_drive_price }\n end\n end",
"def index\n @sections = Section.all.paginate(:page => params[:page], :per_page => 100)\n end",
"def get_part_by_category\n @categorys = PartsController::PartService.get_part_by_category(params[:param]);\n respond_to do |format|\n format.json { render json: @categorys }\n end \n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def show\n @terms_of_use = TermsOfUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def show\n @crop_pricing = CropPricing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crop_pricing }\n end\n end",
"def commission\n get 'commission'\n end",
"def show\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_price }\n end\n end",
"def get_sections (subdomain,course_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/courses/#{course_id}/sections\"\n )\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def index\n get_sparepart\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n format.js\n end\n end",
"def show\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proof_cost }\n end\n end",
"def index\n @licenses = License.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @licenses }\n end\n end",
"def show\n @license = License.find(params[:id])\n respond_with(@license)\n end",
"def show\n @ecommerceplan = Ecommerceplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ecommerceplan }\n end\n end",
"def show\n @plate_cost = PlateCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plate_cost }\n end\n end",
"def index\n @prices = @prices.includes(:good).paginate( :page => params[:page])\n end"
] |
[
"0.7129712",
"0.6749928",
"0.66061246",
"0.6418318",
"0.62437844",
"0.62264353",
"0.6179155",
"0.609767",
"0.593823",
"0.5931946",
"0.5931946",
"0.5931946",
"0.5893725",
"0.5858189",
"0.5815258",
"0.5803959",
"0.57934517",
"0.57934517",
"0.5759789",
"0.57518184",
"0.5701516",
"0.5650282",
"0.56195486",
"0.56091267",
"0.56024855",
"0.56021214",
"0.55796653",
"0.5567288",
"0.55650014",
"0.5548058",
"0.554753",
"0.554753",
"0.554753",
"0.5534807",
"0.553435",
"0.5514094",
"0.5505923",
"0.5502335",
"0.5501162",
"0.5501162",
"0.5497819",
"0.5486529",
"0.5451127",
"0.54481775",
"0.5447894",
"0.5435577",
"0.5433794",
"0.54331136",
"0.5429391",
"0.54218256",
"0.54051375",
"0.53969216",
"0.5383817",
"0.5375277",
"0.5363359",
"0.5361795",
"0.5356962",
"0.53527844",
"0.5336082",
"0.5336082",
"0.5336082",
"0.5336082",
"0.5336082",
"0.5336082",
"0.5336082",
"0.53305507",
"0.5328501",
"0.53155804",
"0.5315102",
"0.5313047",
"0.5313047",
"0.528037",
"0.5269142",
"0.5269086",
"0.5263572",
"0.5258349",
"0.52578026",
"0.5254479",
"0.52513015",
"0.52508616",
"0.52477527",
"0.52434367",
"0.5238202",
"0.52369964",
"0.52243996",
"0.52202886",
"0.52121115",
"0.5208082",
"0.5206525",
"0.52035457",
"0.5198603",
"0.51940864",
"0.519287",
"0.5192824",
"0.5190976",
"0.5190879",
"0.51897585",
"0.5183588",
"0.5179429",
"0.51777124",
"0.5177103"
] |
0.0
|
-1
|
POST /pricing_sections or /pricing_sections.json
|
def create
@pricing_section = PricingSection.new(pricing_section_params)
respond_to do |format|
if @pricing_section.save
format.html { redirect_to @pricing_section, notice: "Pricing section was successfully created." }
format.json { render :show, status: :created, location: @pricing_section }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @pricing_section.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pricing_section_params\n params.require(:pricing_section).permit(:section_id, :description)\n end",
"def set_pricing_section\n @pricing_section = PricingSection.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @pricing_section.update(pricing_section_params)\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pricing_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pricing_sections = PricingSection.all\n end",
"def create\n \n\n if Pricing.varient_split_add params\n #audit(@pricing, current_user)\n render json: @pricing, status: :created\n else\n render json: @pricing.errors, status: :unprocessable_entity\n end\n end",
"def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end",
"def create\n @section = Section.new(section_params)\n if @section.save\n render json: SectionSerializer.new(@section)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @pricing_section.destroy\n respond_to do |format|\n format.html { redirect_to pricing_sections_url, notice: \"Pricing section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def create\n @section = Section.new(params[:section])\n @section.page = @page\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @page, :notice => 'Section was successfully created.' }\n format.json { render :json => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def createSection(section)\r\n uri = sprintf(\"/api/v1/courses/%d/sections/\", $tocid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"course_section[name]=#{section[\"name\"]}\")\r\n newSection = $canvas.post(uri, {'course_section[name]' => section[\"name\"]})\r\n dbg(newSection)\r\n return newSection\r\nend",
"def create \n @pricing = Pricing.new(pricing_params)\n respond_to do |format|\n if @pricing.save\n format.html { redirect_to @pricing.item, :flash => { success: 'Pricing was successfully created.' } }\n format.json { render action: 'show', status: :created, location: @pricing }\n else\n format.html { render action: 'new' }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_section = ShopSection.new(params[:shop_section])\n\n respond_to do |format|\n if @shop_section.save\n format.html { redirect_to shop_section_products_path(@shop_section.short_url), notice: 'Shop section was successfully created.' }\n format.json { render json: @shop_section, status: :created, location: @shop_section }\n else\n format.html { render action: \"new\", layout: \"editor\" }\n format.json { render json: @shop_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_section = PostSection.new(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to @post_section, notice: 'Post section was successfully created.' }\n format.json { render :show, status: :created, location: @post_section }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end",
"def create\n @post = find_post\n @post_section = @post.sections.build(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if params[:section][:add_section]\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @section = Section.new(params[:section])\r\n\r\n respond_to do |format|\r\n if @section.save\r\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\r\n format.json { render json: @section, status: :created, location: @section }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @pricing_structure = PricingStructure.new(params[:pricing_structure])\n\n respond_to do |format|\n if @pricing_structure.save\n format.html { redirect_to session.delete(:return_to), notice: 'Pricing structure was successfully created.' }\n format.json { render json: @pricing_structure, status: :created, location: @pricing_structure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pricing_structure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @form_section = FormSection.new(form_section_params)\n @form_section.save\n respond_with( [ :admin, @form_section] )\n end",
"def create\n @manage_section = Manage::Section.new(manage_section_params)\n\n respond_to do |format|\n if @manage_section.save\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @manage_section }\n else\n format.html { render :new }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page_section = PageSection.new(page_section_params)\n\n respond_to do |format|\n if @page_section.save\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :created, location: @page_section }\n else\n format.html { render :new }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n @section.title = @section.title || \"\"\n\n document = @section.document\n @section.order = 1\n unless document.sections.blank?\n @section.order = document.sections.last.order + 1\n end\n\n @section.visibility = document.visibility\n @section.status = document.status\n\n update_user_attribution @section, true\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.any(:json, :js) { render :show, status: :created, location: @section }\n else\n puts @section.errors.full_messages\n format.html { render :new }\n format.any(:json, :js) { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n # Add section to course.\n if params.has_key?('course_id')\n course_id = params['course_id']\n add_section_to_course(@section, course_id)\n end\n \n format.js { render \"\", json: @section }\n else\n format.js { render json: @section.errors, status: :unprocessable_entity }\n end\n # if add_section_to_course(@section, course_id)\n # # Use the sections helper to create the relation between the section and its course.\n # format.html { redirect_to Course.find(course_id), notice: 'Section was successfully created.' }\n # format.json { render :show, status: :created, location: @section }\n # else\n # format.html { render :new }\n # format.json { render json: @section.errors, status: :unprocessable_entity }\n # end\n end\n end",
"def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section,\n notice: 'Section was successfully created.' }\n format.json { render :show,\n status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n pricing_rule = application_plan.pricing_rules.create(pricing_rule_params)\n\n respond_with(pricing_rule)\n end",
"def show\n render json: @pricing\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey_section = SurveySection.new(survey_section_params)\n\n respond_to do |format|\n if @survey_section.save\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully created.' }\n format.json { render :show, status: :created, location: @survey_section }\n else\n format.html { render :new }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"/api/v1/elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def pricing_params\n params.require(:pricing).permit(:price, :price_cents, :item_id, :menu_id)\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(params[:section])\n @section.account = @account\n \n # This serves to retreive any article attached to this new section so we can access that article's apge\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.js { redirect_to(account_article_sortings_url(@account, @article, :format=>:js)) if @article}\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { render :xml => [@account, @section], :status => :created, :location =>[@account, @section] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def create\n @portfolio_section = PortfolioSection.new(portfolio_section_params)\n\n respond_to do |format|\n if @portfolio_section.save\n format.html { redirect_to @portfolio_section, notice: \"Portfolio section was successfully created.\" }\n format.json { render :show, status: :created, location: @portfolio_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def create\n @cms_page_section = Cms::PageSection.new(cms_page_section_params)\n\n respond_to do |format|\n if @cms_page_section.save\n format.html { redirect_to :controller => \"/pages\", :action => \"show\", :id => @cms_page_section.page_id, notice: 'Page section was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page_section }\n else\n format.html { render :new }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pricing.update(pricing_params)\n format.html { redirect_to @pricing, notice: 'Pricing was successfully updated.' }\n format.json { render :show, status: :ok, location: @pricing }\n else\n format.html { render :edit }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.fetch(:section, {}).permit(:name, :eng, :jpn)\n end",
"def create\n @home = Home.first\n @about = About.first\n\n @section = Section.new(section_params)\n @section.order = Section.all.count+1\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to [:admin, @section], notice: 'Section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def create\n @store_section = StoreSection.new(params[:store_section])\n\n respond_to do |format|\n if @store_section.save\n format.html { redirect_to @store_section, notice: 'Store section was successfully created.' }\n format.json { render json: @store_section, status: :created, location: @store_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options))\n end",
"def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def create\n @section = Section.new(section_params.merge!({ document: Document.find(params[:document_id]) }))\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n if @section.save\n redirect_to sections_path, primary: 'Section was successfully created.'\n else\n render :new\n end\n end",
"def create\n product_category = ProductCategory.find(params[:product_section][:product_category_id])\n @product_section = product_category.product_sections.create(params[:product_section])\n \n #@product_section = ProductSection.new(params[:product_section])\n\n respond_to do |format|\n if @product_section.save\n format.html { redirect_to(@product_section, :notice => 'ProductSection was successfully created.') }\n format.xml { render :xml => @product_section, :status => :created, :location => @product_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def change_shape\n return unless request.xhr?\n @quotation_line = QuotationLine.new(params[:quotation_line])\n @openings = params[:openings]\n @section_height = params[:section_height] || {}\n @section_width = params[:section_width] || {}\n @serie = Serie.includes(:options => [:pricing_method, :options_minimum_unit]).find(@quotation_line.serie_id)\n initialize_options_for_series()\n end",
"def create\n # Instantiate new object using form params\n @section = Section.new(section_params) #use private method below to get permited data for mass assignment\n @section.page = @page\n # Save object\n if @section.save\n # If successful, redirect to index action\n flash[:notice] = \"Section created successfully.\"\n redirect_to(sections_path(:page_id => @page.id))\n else\n # Else, redisplay form so user can fix problems\n render('new') # renders form template with original user data pre-populated\n end\n end",
"def add_section(project_id, data = {})\n post(\"add_section/#{project_id}\", body: data.to_json)\n end",
"def pricing\n request('pricing', :get)\n end",
"def create_section_with_http_info(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.create_section ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'section_name' is set\n if @api_client.config.client_side_validation && section_name.nil?\n fail ArgumentError, \"Missing the required parameter 'section_name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.create_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'sectionName'] = @api_client.prepare_for_query(section_name) unless section_name.nil?\n query_params[:'slideIndex'] = @api_client.prepare_for_query(slide_index) unless slide_index.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def section_params\n params.fetch(:section, {}).permit(:title, :headless)\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @service_offering = ServiceOffering.new(service_offering_params)\n\n respond_to do |format|\n if @service_offering.save\n format.html { redirect_to @service_offering, notice: 'Service offering was successfully created.' }\n format.json { render :show, status: :created, location: @service_offering }\n else\n format.html { render :new }\n format.json { render json: @service_offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sell_shop_item_section_add(item_id, section_name, params={})\r\n url = api_url \"/sell/shop/items/#{item_id}/add_section\"\r\n req = request_params({currency: @currency, locale: @locale}.merge(params))\r\n load = MultiJson.dump section: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end",
"def create\n @section = Section.new(section_params)\n @course = Course.find(params[:course_id])\n @section.course_id = @course.id\n respond_to do |format|\n if @section.save\n format.html { redirect_to course_section_url(@section.course_id, @section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def change_series\n return unless request.xhr?\n serie_id = params[:serie_id]\n @quotation_line = QuotationLine.new(params[:quotation_line])\n @openings = {} #params[:openings]\n @section_height = params[:section_height] || {}\n @section_width = params[:section_width] || {}\n @serie = Serie.includes(:options => [:pricing_method, :options_minimum_unit]).find(serie_id)\n initialize_options_for_series()\n end",
"def create\n @cp_score_sheet_section = CpScoreSheetSection.new(params[:cp_score_sheet_section])\n\n respond_to do |format|\n if @cp_score_sheet_section.save\n format.html { redirect_to @cp_score_sheet_section, notice: 'Cp score sheet section was successfully created.' }\n format.json { render json: @cp_score_sheet_section, status: :created, location: @cp_score_sheet_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cp_score_sheet_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @join_section = JoinSection.new(params[:join_section])\n\n respond_to do |format|\n if @join_section.save\n format.html { redirect_to(@join_section, :notice => 'JoinSection was successfully created.') }\n format.xml { render :xml => @join_section, :status => :created, :location => @join_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @join_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pricing = Pricing.find(params[:id])\n\n if @pricing.update(pricing_params)\n #audit(@pricing, current_user)\n head :no_content\n else\n render json: @pricing.errors, status: :unprocessable_entity\n end\n end",
"def new\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end",
"def create\n hotel = current_user.hotel\n if hotel.pricing\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.where(hotel_id: hotel.id).first\n price = Hash.new\n price = pricing.price\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n\n\n\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n else\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.new\n pricing.hotel_id = hotel.id\n price = Hash.new\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n pricing.price = {}\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n end\n \n \n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n create_first_line_item unless @invoice.booking.pricing_structure.rate_per_person.nil?\n format.html { redirect_to invoice_path(@invoice.id), notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_section = AHomeSection.new(admin_section_params)\n\n respond_to do |format|\n if @admin_section.save\n format.html { redirect_to @admin_section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @admin_section }\n else\n format.html { render :new }\n format.json { render json: @admin_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_section = TimeSection.new(params[:time_section])\n\n respond_to do |format|\n if @time_section.save\n format.html { redirect_to @time_section, notice: 'Time section was successfully created.' }\n format.json { render json: @time_section, status: :created, location: @time_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.require(:section).permit(:course_id, :year_id, :term_id, :block_id)\n end",
"def create\n if current_user.has_role? :admin\n @sectionalization = Sectionalization.new(sectionalization_params)\n\n respond_to do |format|\n if @sectionalization.save\n format.html { redirect_to @sectionalization, notice: 'Sectionalization was successfully created.' }\n format.json { render :show, status: :created, location: @sectionalization }\n else\n format.html { render :new }\n format.json { render json: @sectionalization.errors, status: :unprocessable_entity }\n end\n end\n else\n @sectionalization = Sectionalization.new(sectionalization_params)\n @sectionalization.user_id = current_user.id\n @sectionalization.classroom_id = session[:classroom_id]\n respond_to do |format|\n if @sectionalization.save\n format.html { redirect_to @sectionalization, notice: 'Sectionalization was successfully created.' }\n format.json { render :show, status: :created, location: @sectionalization }\n else\n format.html { render :new }\n format.json { render json: @sectionalization.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @about_us_section = AboutUsSection.new(about_us_section_params)\n\n respond_to do |format|\n if @about_us_section.save\n format.html { redirect_to @about_us_section, notice: \"About us section was successfully created.\" }\n format.json { render :show, status: :created, location: @about_us_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @about_us_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_section_p\n @section = Section.find(params[:section_id])\n end",
"def create\n @pricing = Pricing.new(pricing_params)\n @pricing.job_id = @job.id\n @pricing.current_status_id = @job.status_id\n\n respond_to do |format|\n if @pricing.save\n @job.track 'Pricing Created', current_user, @pricing\n JobMailer.pricing_created(@job.job_coordinator, current_user, @pricing, @job).deliver if @job.job_coordinator.present?\n format.html { redirect_to @job, notice: 'Pricing was successfully created.' }\n format.json { render :show, status: :created, location: @pricing }\n else\n format.html { render :new }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def create\n @section_category = SectionCategory.new(params[:section_category])\n\n respond_to do |format|\n if @section_category.save\n format.html { redirect_to section_category_products_path(@section_category.shop_section.short_url, @section_category.short_url), notice: 'Section category was successfully created.' }\n format.json { render json: @section_category, status: :created, location: @section_category }\n else\n format.html { render action: \"new\", layout: \"editor\" }\n format.json { render json: @section_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def portfolio_section_params\n params.require(:portfolio_section).permit(:section_id, :description)\n end",
"def create\n @course_section = CourseSection.new(course_section_params)\n\n respond_to do |format|\n if @course_section.save\n format.html { redirect_to @course_section, notice: 'Course section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course_section }\n else\n format.html { render action: 'new' }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def about_us_section_params\n params.require(:about_us_section).permit(:section_id, :left_side, :right_side, :happy_clients_counter, :projects_counter, :years_counter, :awards_counter, :happy_clients_text, :projects_text, :years_text, :awards_text, :happy_clients_class, :projects_class, :years_class, :awards_class)\n end",
"def create\n @institution_app_pages_section = InstitutionAppPagesSection.new(institution_app_pages_section_params)\n\n respond_to do |format|\n if @institution_app_pages_section.save\n format.html { redirect_to @institution_app_pages_section, notice: 'Institution app pages section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @institution_app_pages_section }\n else\n format.html { render action: 'new' }\n format.json { render json: @institution_app_pages_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @section = Section.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def create\n if !has_right?(:create)\n redirect_to :unauthorized\n return\n end\n @section_preview = SectionPreview.new(params[:section_preview])\n create_new_objects(:property => params[:property],\n \t\t\t\t\t\t\t\t\t :image_storage => params[:image_storage],\n \t\t\t\t\t\t\t\t\t :asset => params[:asset],\n \t\t\t\t\t\t\t\t\t :resource => @section_preview) ### Add to all resources\n end",
"def new\n @section = Section.new\n @section.page = @page\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render :json => @section }\n end\n end",
"def create\n @lab_section = LabSection.new(lab_section_params)\n\n respond_to do |format|\n if @lab_section.save\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully created.' }\n format.json { render :show, status: :created, location: @lab_section }\n else\n format.html { render :new }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_sections\n @sections = if @options.configure_sections?\n parse_sections(@options[:configure_sections])\n elsif @options.add_sections?\n default_sections.concat parse_sections(@options[:add_sections])\n else\n default_sections\n end\n nil\n end",
"def create\n @section_row = SectionRow.new(section_row_params)\n\n respond_to do |format|\n if @section_row.save\n flash[:success] = \"Section row was successfully created.\"\n format.html { redirect_to @section_row }\n format.json { render :show, status: :created, location: @section_row }\n else\n format.html { render :new }\n format.json { render json: @section_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.require(:section).permit(:start_date, :end_date, :meeting_scheme, :meeting_time, :section_hours, :course_id)\n end",
"def update\n respond_to do |format|\n if @pricing.update(pricing_params)\n format.html { redirect_to @pricing.item, :flash => { success: 'Pricing was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @discipline_section = DisciplineSection.new(discipline_section_params)\n respond_to do |format|\n if @discipline_section.save\n #format.html { redirect_to @discipline_section, notice: 'Discipline section was successfully created.' }\n #format.json { render :show, status: :created, location: @discipline_section }\n format.js { render('discipline_sections/create')}\n else\n #raise @discipline_section.errors.inspect\n #format.html { render :new }\n #format.json { render json: @discipline_section.errors, status: :unprocessable_entity }\n format.js { render ('discipline_sections/error')}\n end\n end\n end"
] |
[
"0.6557482",
"0.6444953",
"0.6319671",
"0.6223495",
"0.6102098",
"0.6065209",
"0.59367275",
"0.59097797",
"0.57917225",
"0.5772799",
"0.5720925",
"0.5674241",
"0.5656817",
"0.5643312",
"0.5618706",
"0.5611128",
"0.55987465",
"0.55884993",
"0.55769545",
"0.5563262",
"0.55628586",
"0.5562529",
"0.5551454",
"0.55425996",
"0.55379206",
"0.55293226",
"0.5521437",
"0.5519399",
"0.5519399",
"0.5519399",
"0.5519399",
"0.54983675",
"0.5454465",
"0.54441243",
"0.5436561",
"0.54166996",
"0.5390736",
"0.53879434",
"0.53846496",
"0.5361837",
"0.5357541",
"0.5355725",
"0.5354446",
"0.5354446",
"0.53443086",
"0.5329689",
"0.53132164",
"0.52804834",
"0.52649343",
"0.5257343",
"0.5257343",
"0.52571595",
"0.52567554",
"0.52414477",
"0.52374035",
"0.52374035",
"0.52374035",
"0.5231582",
"0.5222117",
"0.5221168",
"0.519064",
"0.5164623",
"0.51611996",
"0.5153721",
"0.5144906",
"0.5135391",
"0.5131582",
"0.51273227",
"0.5123478",
"0.51128453",
"0.510954",
"0.5102137",
"0.50930196",
"0.5087924",
"0.5086179",
"0.5084121",
"0.50810426",
"0.5074077",
"0.5071912",
"0.50717807",
"0.50674033",
"0.50575215",
"0.5054017",
"0.5053886",
"0.5052289",
"0.5039283",
"0.5038136",
"0.5027367",
"0.5017606",
"0.50143313",
"0.5007934",
"0.5001464",
"0.50013536",
"0.4989911",
"0.49879125",
"0.49861094",
"0.4984485",
"0.49841398",
"0.49827614",
"0.49826494"
] |
0.7201398
|
0
|
PATCH/PUT /pricing_sections/1 or /pricing_sections/1.json
|
def update
respond_to do |format|
if @pricing_section.update(pricing_section_params)
format.html { redirect_to @pricing_section, notice: "Pricing section was successfully updated." }
format.json { render :show, status: :ok, location: @pricing_section }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @pricing_section.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_pricing_section\n @pricing_section = PricingSection.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @pricing.update(pricing_params)\n format.html { redirect_to @pricing, notice: 'Pricing was successfully updated.' }\n format.json { render :show, status: :ok, location: @pricing }\n else\n format.html { render :edit }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pricing = Pricing.find(params[:id])\n\n if @pricing.update(pricing_params)\n #audit(@pricing, current_user)\n head :no_content\n else\n render json: @pricing.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @pricing.update(pricing_params)\n format.html { redirect_to @pricing.item, :flash => { success: 'Pricing was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pricing_section_params\n params.require(:pricing_section).permit(:section_id, :description)\n end",
"def update\n @pricing_structure = PricingStructure.find(params[:id])\n\n respond_to do |format|\n if @pricing_structure.update_attributes(params[:pricing_structure])\n format.html { redirect_to pricing_structures_path, notice: 'Pricing structure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pricing_structure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @introductory_pricing_specs = args[:introductory_pricing_specs] if args.key?(:introductory_pricing_specs)\n end",
"def create\n @pricing_section = PricingSection.new(pricing_section_params)\n\n respond_to do |format|\n if @pricing_section.save\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully created.\" }\n format.json { render :show, status: :created, location: @pricing_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @section.update(section_params)\n render :show, status: :ok, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_section = ShopSection.find(params[:id])\n\n respond_to do |format|\n if @shop_section.update_attributes(params[:shop_section])\n format.html { redirect_to shop_section_products_path(@shop_section.short_url), notice: 'Shop section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @shop_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sell_shop_section_update (section_id, section_name, params={})\r\n url = api_url \"/sell/shop/sections/#{section_id}\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.put url, load, req\r\n end \r\n end",
"def update\r\n @section = Section.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @section.update_attributes(params[:section])\r\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @home = Home.first\n @about = About.first\n\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to admin_section_path(@section), notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = @account.sections.find(params[:id])\n @section.account = @account\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n flash[:notice] = 'Section updated'\n format.js\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @portfolio_section.update(portfolio_section_params)\n format.html { redirect_to @portfolio_section, notice: \"Portfolio section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @portfolio_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lab_section.update(lab_section_params)\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_section }\n else\n format.html { render :edit }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pricing_sections = PricingSection.all\n end",
"def update\n respond_to do |format|\n params[:product_section][:audit_user_name] = current_user.full_name\n @fo = @product_section.product.room.fabrication_order_id\n if @product_section.update(product_section_params)\n\n params_redirect = {id: @fo}\n params_redirect.merge!({scroll: true}) if params[:scroll]\n\n format.html { redirect_to edit_fabrication_order_path(params_redirect), notice: 'Section was successfully updated.' }\n format.json do\n flash[:notice] = \"status for #{@product_section.name} was successfully updated\"\n sects = {id: @product_section.id, name: @product_section.name, status: @product_section.status, size_type: @product_section.size_type, size_a: @product_section.size_a, fraction_size_a: @product_section.fraction_size_a, size_b: @product_section.size_b, fraction_size_b: @product_section.fraction_size_a, edge_type_a_id: @product_section.edge_type_a_id, edge_type_a: @product_section.edge_type_a.to_s, edge_type_b: @product_section.edge_type_b.to_s, edge_type_b_id: @product_section.edge_type_b_id, edge_type_c: @product_section.edge_type_c.to_s, edge_type_c_id: @product_section.edge_type_c_id, edge_type_d: @product_section.edge_type_d.to_s, edge_type_d_id: @product_section.edge_type_d_id}\n render json: api_response(:success, nil, sects)\n end \n format.js {render layout: false}\n else\n format.html {\n set_edge_type\n renderr = product_section_params.has_key?(:size_a) ? :size : :edit\n render renderr, :layout => \"application\" \n }\n format.json { render json: api_response(:failed, @product_section.errors.full_messages.join(' '), @product_section.errors), status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n # { subsection:\n # {\n # \"id\" : id\n # \"subsection_datum_id\":references\n # }\n # }\n if @subsection.update_attributes(params[:module])\n head :no_content\n else\n render json: @subsection.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @section.update(section_params)\n render json: SectionSerializer.new(@section)\n else\n render json: @menu.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render json: @section }\n else\n format.html { render action: 'edit' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_section = ProductSection.find(params[:id])\n\n respond_to do |format|\n if @product_section.update_attributes(params[:product_section])\n format.html { redirect_to(@product_section, :notice => 'ProductSection was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @soa_section.update(soa_section_params.merge({serial_number: @soa_section.serial_number += 1, revision: @soa_section.revision += 1 }))\n format.html { redirect_to domain_dns_zone_path(@soa_section.dns_zone.domain, @soa_section.dns_zone), notice: 'Soa section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html do\n flash[:alert] = \"SoaSection validation failed: #{@soa_section.errors.messages}\"\n render action: :edit\n end\n format.json { render json: @soa_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section,\n notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(admin_section_params)\n format.html { redirect_to admin_sections_path, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_section }\n else\n format.html { render :edit }\n format.json { render json: @admin_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subsection.update(subsection_params)\n format.html { redirect_to @subsection, notice: 'Subsection was successfully updated.' }\n format.json { render :show, status: :ok, location: @subsection }\n else\n format.html { render :edit }\n format.json { render json: @subsection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sectionalization.update(sectionalization_params)\n format.html { redirect_to @sectionalization, notice: 'Sectionalization was successfully updated.' }\n format.json { render :show, status: :ok, location: @sectionalization }\n else\n format.html { render :edit }\n format.json { render json: @sectionalization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def update\n @section = Section.find(params[:id])\n @page = @section.page\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @page, :notice => 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:pk])\n @section.update_attributes( params[:name] => params[:value] )\n \n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n \n end",
"def update\n if section.update_attributes(params[:section_datum])\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @survey_section.update(survey_section_params)\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_section }\n else\n format.html { render :edit }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n section_chunks = get_chunks(params)\n\n puts params\n redirect_to @course\n\n return\n\n sections = params['sections']\n if sections.nil?\n # Loop through course's existing sections.\n @course.sections.each do |section|\n\n end\n end\n \n respond_to do |format|\n # Update subcontents\n if update_section_chunks(section_chunks)\n format.html { redirect_to @course }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # render json:params\n # return \n\n\n respond_to do |format|\n if @manage_section.update(manage_section_params)\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @manage_section }\n else\n format.html { render :edit }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n if @store_section.update_attributes(params[:store_section])\n format.html { redirect_to @store_section, notice: 'Store section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post_section.update(post_section_params)\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :edit }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page_section.update(cms_page_section_params)\n format.html { redirect_to @cms_page_section, notice: 'Page section was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page_section }\n else\n format.html { render :edit }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sections = Section.find(:all)\n @section = Section.find(params[:section_id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n flash[:notice] = 'Section was successfully updated.'\n format.html { redirect_to(@section) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @form_section.update(form_section_params)\n respond_with( [ :admin, @form_section] )\n end",
"def update\n respond_to do |format|\n if @page_section.update(page_section_params)\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :ok, location: @page_section }\n else\n format.html { render :edit }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crop_pricing = CropPricing.find(params[:id])\n\n respond_to do |format|\n if @crop_pricing.update_attributes(params[:crop_pricing])\n format.html { redirect_to(@crop_pricing, :notice => 'CropPricing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @crop_pricing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n if @section_heading.update_attributes(params[:section_heading])\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @prices = Price.all\n @strains = Strain.all\n @regions = Region.all\n respond_to do |format|\n if @price.update(price_params)\n format.html { redirect_to \"/\", notice: 'Price was successfully updated.' }\n format.json { render :show, status: :ok, location: @price }\n else\n format.html { render :edit }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_section.update(course_section_params)\n format.html { redirect_to @course_section, notice: 'Course section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_offering.update(service_offering_params)\n format.html { redirect_to @service_offering, notice: 'Service offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_offering }\n else\n format.html { render :edit }\n format.json { render json: @service_offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if !has_right?(:edit)\n redirect_to :unauthorized\n return\n end\n @section_preview = SectionPreview.find(params[:id])\n update_objects(@section_preview, params[:section_preview]) ### Add to all resources\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def update\n respond_to do |format|\n if @purchase_option.update(purchase_option_params)\n format.html { redirect_to @purchase_option, notice: 'Purchase option was successfully updated.' }\n format.json { render :show, status: :ok, location: @purchase_option }\n else\n format.html { render :edit }\n format.json { render json: @purchase_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_heading.update(section_heading_params)\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_heading }\n else\n format.html { render :edit }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_configuration.update(section_configuration_params)\n format.html { redirect_to @section_configuration, notice: 'Section configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_configuration }\n else\n format.html { render :edit }\n format.json { render json: @section_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_category = SectionCategory.find(params[:id])\n\n respond_to do |format|\n if @section_category.update_attributes(params[:section_category])\n format.html { redirect_to section_category_products_path(@section_category.shop_section.short_url, @section_category.short_url), notice: 'Section category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @section_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_section(section_id, data = {})\n post(\"update_section/#{section_id}\", body: data.to_json)\n end",
"def destroy\n @pricing_section.destroy\n respond_to do |format|\n format.html { redirect_to pricing_sections_url, notice: \"Pricing section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @admin_price.update(admin_price_params)\n format.html { redirect_to @admin_price, notice: 'Price was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_price }\n else\n format.html { render :edit }\n format.json { render json: @admin_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize Section\n\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section.article, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n @section_count = article.sections.count\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(@section, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(@section, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @price = Price.find(params[:id])\n\n respond_to do |format|\n if @price.update_attributes(params[:price])\n format.html { redirect_to admin_price_path(@price), notice: 'Price was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end",
"def update\n respond_to do |format|\n if @language_section.update(language_section_params)\n format.html { redirect_to @language_section, notice: 'Language section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @language_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @course_section\n respond_to do |format|\n if @course_section.update(course_section_params)\n format.html { redirect_to @course_section, notice: 'Course section was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_section }\n else\n format.html { render :edit }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cp_score_sheet_section = CpScoreSheetSection.find(params[:id])\n\n respond_to do |format|\n if @cp_score_sheet_section.update_attributes(params[:cp_score_sheet_section])\n format.html { redirect_to @cp_score_sheet_section, notice: 'Cp score sheet section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cp_score_sheet_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_user_attribution @section, false, true\n respond_to do |format|\n if @section.update(section_params)\n format.js do\n flash[:notice] = \"Section was successfully updated\"\n render layout: false\n end\n format.html { redirect_to edit_document_path(@section.document), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { redirect_to edit_document_path(@section.document), notice: 'Failed to update section.' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_row.update(section_row_params)\n flash[:success] = \"Section row was successfully updated.\"\n format.html { redirect_to @section_row }\n format.json { render :show, status: :ok, location: @section_row }\n else\n format.html { render :edit }\n format.json { render json: @section_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @play = Play.find(params[:play_id])\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to edit_play_url(@play), notice: 'section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_play_url(@play) }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @guide_section.update(guide_section_params)\n format.html { redirect_to guide_sections_url, notice: 'Guide section was successfully updated.' }\n format.json { render :show, status: :ok, location: @guide_section }\n else\n format.html { render :edit }\n format.json { render json: @guide_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n if @product\n if @product.update(price: params[:price])\n render 'api/products/show'\n else\n render json: [\"Can only update price\"], status: 422\n end\n else\n render json: [\"Product not found\"], status: 422\n end\n end",
"def update\n @shop_claim = ShopClaim.find(params[:id])\n\n if @shop_claim.update(shop_claim_params)\n head :no_content\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end",
"def update\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n if @time_section.update_attributes(params[:time_section])\n format.html { redirect_to @time_section, notice: 'Time section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @choice = Choice.find(params[:id])\n\n if @choice.update(choice_params)\n head :no_content\n else\n render json: @choice.errors, status: :unprocessable_entity\n end\n end",
"def update\n @pricing_plan = PricingPlan.find(params[:id])\n\n respond_to do |format|\n if @pricing_plan.update_attributes(params[:pricing_plan])\n flash[:notice] = 'PricingPlan was successfully updated.'\n format.html { redirect_to(@pricing_plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pricing_plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # Find new object using form params\n @section = Section.find(params[:id])\n # Update object\n if @section.update_attributes(section_params) #use private method below to get permited data for mass assignment\n # If successful, redirect to show action\n flash[:notice] = \"Section updated successfully.\"\n redirect_to(section_path(@section, :page_id => @page.id))\n else\n # Else, redisplay form so user can fix problems\n render('edit') # renders form template with original pre-populated\n end\n end",
"def update\n @price = Price.find(params[:id])\n\n respond_to do |format|\n if @price.update_attributes(params[:price])\n format.html { redirect_to @price, notice: 'Price was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_setting = ProductSetting.find(params[:id])\n\n respond_to do |format|\n if @product_setting.update_attributes(params[:product_setting])\n if @product_setting.multilevel_pricing? && @company.product_pricing_levels.blank?\n ProductPricingLevel.create_pricing_levels(@company)\n end\n format.html { redirect_to @product_setting, :notice => 'Product setting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product_setting.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n if @menu_section.update_attributes(params[:menu_section])\n format.html { redirect_to @menu_section, notice: 'Menu section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @menu_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @price_schema.update(price_schema_params)\n format.html { redirect_to @price_schema, notice: 'Price schema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @price_schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @about_us_section.update(about_us_section_params)\n format.html { redirect_to @about_us_section, notice: \"About us section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @about_us_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @about_us_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_section_p\n @section = Section.find(params[:section_id])\n end",
"def update\n @price_field = PriceField.find(params[:id])\n\n if @price_field.update(price_field_params)\n audit(@price_field, current_user)\n head :no_content\n else\n render json: @price_field.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @price.update(price_params)\n format.html { redirect_to @price, notice: 'Price was successfully updated.' }\n format.json { render :show, status: :ok, location: @price }\n else\n format.html { render :edit }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @price.update(price_params)\n format.html { redirect_to @price, notice: 'Price was successfully updated.' }\n format.json { render :show, status: :ok, location: @price }\n else\n format.html { render :edit }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @institution_app_pages_section.update(institution_app_pages_section_params)\n format.html { redirect_to @institution_app_pages_section, notice: 'Institution app pages section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @institution_app_pages_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n sections = params[:sections]\n\n respond_to do |format|\n if @feedback.update(feedback_params)\n for section in sections\n if section[\"id\"] == 0 || section[\"id\"] == \"\"\n feedbackSection = FeedbackSection.new\n elsif\n feedbackSection = FeedbackSection.find(section[\"id\"])\n end\n\n feedbackSection.feedback_id = @feedback.id\n feedbackSection.question = section[\"question\"]\n feedbackSection.answer = section[\"answer\"]\n\n feedbackSection.rating = 0\n feedbackSection.question_type = 1\n feedbackSection.action_plan = ''\n feedbackSection.category = ''\n feedbackSection.save\n end\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @category = args[:category] if args.key?(:category)\n @description = args[:description] if args.key?(:description)\n @name = args[:name] if args.key?(:name)\n @pricing_info = args[:pricing_info] if args.key?(:pricing_info)\n @service_provider_name = args[:service_provider_name] if args.key?(:service_provider_name)\n @service_regions = args[:service_regions] if args.key?(:service_regions)\n @sku_id = args[:sku_id] if args.key?(:sku_id)\n end"
] |
[
"0.70158684",
"0.67984235",
"0.6566068",
"0.6531886",
"0.6475",
"0.6372816",
"0.63443524",
"0.6183952",
"0.6149243",
"0.6140965",
"0.6136654",
"0.6130516",
"0.61077875",
"0.60778105",
"0.6011418",
"0.59976536",
"0.59958106",
"0.599171",
"0.59874487",
"0.5952463",
"0.5949511",
"0.59464383",
"0.5946295",
"0.59421116",
"0.59294105",
"0.59294105",
"0.59294105",
"0.59294105",
"0.59294105",
"0.59294105",
"0.59267914",
"0.59241796",
"0.591493",
"0.5914702",
"0.5914436",
"0.59062254",
"0.590158",
"0.590158",
"0.590158",
"0.5892604",
"0.58751506",
"0.5872766",
"0.5867883",
"0.5826177",
"0.58243275",
"0.5814442",
"0.57996696",
"0.57873315",
"0.5771514",
"0.5756125",
"0.5753091",
"0.5737231",
"0.57245404",
"0.5722032",
"0.57200825",
"0.5707753",
"0.56977135",
"0.5695292",
"0.56680983",
"0.56629324",
"0.56592035",
"0.56592035",
"0.56568944",
"0.5652112",
"0.5640568",
"0.5639731",
"0.5638135",
"0.56370676",
"0.5629621",
"0.5629556",
"0.5629315",
"0.5629315",
"0.56153184",
"0.56068975",
"0.5596432",
"0.5592718",
"0.55898786",
"0.5589147",
"0.55761075",
"0.55717564",
"0.5560692",
"0.55600774",
"0.5559912",
"0.55585194",
"0.55400074",
"0.55369437",
"0.55236906",
"0.55169505",
"0.55120504",
"0.55077946",
"0.55044544",
"0.549534",
"0.5489661",
"0.5481913",
"0.5478102",
"0.5474557",
"0.5474557",
"0.54675764",
"0.5462765",
"0.5458761"
] |
0.7647509
|
0
|
DELETE /pricing_sections/1 or /pricing_sections/1.json
|
def destroy
@pricing_section.destroy
respond_to do |format|
format.html { redirect_to pricing_sections_url, notice: "Pricing section was successfully destroyed." }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @pricing.destroy\n\n head :no_content\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @home = Home.first\n @about = About.first\n \n @section = Section.find(params[:id])\n \n @section.destroy\n respond_to do |format|\n format.html { redirect_to admin_sections_url }\n format.json { head :no_content }\n end\n end",
"def sell_shop_section_delete (section_id, params={})\r\n url = api_url \"/sell/shop/sections/#{section_id}\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.delete url, req\r\n end \r\n end",
"def destroy\n @pricing_structure = PricingStructure.find(params[:id])\n @pricing_structure.destroy\n\n respond_to do |format|\n format.html { redirect_to pricing_structures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_section = ShopSection.find(params[:id])\n @shop_section.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_section.destroy\n respond_to do |format|\n format.html { redirect_to edit_fabrication_order_path(params[:fabrication_order_id]), notice: 'Section was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sections = Section.find(:all)\n @section = Section.find(params[:section_id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n render nothing: true\n end",
"def destroy\n @section = @account.sections.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_section = ProductSection.find(params[:id])\n @product_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @section_heading = SectionHeading.find(params[:id])\n @section_heading.destroy\n\n respond_to do |format|\n format.html { redirect_to section_headings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @page = @section.page\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to @page, :notice => 'Section was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n render json: SectionSerializer.new(@section)\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store_section = StoreSection.find(params[:id])\n @store_section.destroy\n\n respond_to do |format|\n format.html { redirect_to store_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_section.destroy\n respond_to do |format|\n format.html { redirect_to admin_sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_page_section.destroy\n respond_to do |format|\n format.html { redirect_to cms_page_sections_url, notice: 'Page section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sectionalization.destroy\n respond_to do |format|\n format.html { redirect_to sectionalizations_url, notice: 'Sectionalization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @menu_section = MenuSection.find(params[:id])\n @menu_section.destroy\n\n respond_to do |format|\n format.html { redirect_to menu_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Test this query on rail console for menu section that has food\n ActiveRecord::Base.connection.exec_query(\n \"DELETE FROM menu_sections\n WHERE url_id = #{params[:id]}\n AND NOT EXISTS (\n SELECT 1\n FROM Foods\n WHERE ms_url_id = #{params[:id]}\n );\"\n ) \n\n menu_section = ActiveRecord::Base.connection.exec_query(\n \"SELECT 1\n FROM menu_sections\n WHERE url_id = #{params[:id]}\"\n )\n\n if (!menu_section.empty?)\n render json: {errors: \"Cannot delete menu section that has dish in it!\"}, status: 500\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url,\n notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n section = SectionDatum.find(params[:id])\n if section.destroy\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def destroy\n @purchase_option.destroy\n respond_to do |format|\n format.html { redirect_to purchase_options_url, notice: 'Purchase option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @domicile_type_section = DomicileTypeSection.find(params[:id])\n @domicile_type_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_type_sections_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @section = Section.find(params[:id])\n end",
"def destroy\n @item = @pricing.item\n @pricing.destroy\n respond_to do |format|\n format.html { redirect_to @item, :flash => { success: 'Pricing was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_section.destroy\n respond_to do |format|\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @section = Section.find(params[:id])\r\n @section.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @page_section.destroy\n respond_to do |format|\n format.html { redirect_to page_sections_url,\n notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_section = TimeSection.find(params[:id])\n @time_section.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @price = Price.find(params[:id])\n @price.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_prices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @institution_app_pages_section.destroy\n respond_to do |format|\n format.html { redirect_to institution_app_pages_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_section.destroy\n respond_to do |format|\n format.html { redirect_to survey_sections_url, notice: 'Survey section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_section.destroy\n respond_to do |format|\n format.html { redirect_to lab_sections_url, notice: 'Lab section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio_section.destroy\n respond_to do |format|\n format.html { redirect_to portfolio_sections_url, notice: \"Portfolio section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @example_section = ExampleSection.find(params[:id])\n @example_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(example_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @language_section.destroy\n respond_to do |format|\n format.html { redirect_to language_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_section.destroy\n respond_to do |format|\n format.html { redirect_to admin_post_sections_url(@post), notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end",
"def destroy\n @section_category = SectionCategory.find(params[:id])\n @section_category.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_heading.destroy\n respond_to do |format|\n format.html { redirect_to section_headings_url, notice: 'Section heading was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @section_test = SectionTest.find(params[:id])\n @section_test.destroy\n\n respond_to do |format|\n format.html { redirect_to section_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @shop_claim.destroy\n\n head :no_content\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize Section\n \n @section.destroy\n respond_to do |format|\n format.html { redirect_to @section.article, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_section_with_http_info(name, section_index, with_slides = nil, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.delete_section ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.delete_section\"\n end\n # verify the required parameter 'section_index' is set\n if @api_client.config.client_side_validation && section_index.nil?\n fail ArgumentError, \"Missing the required parameter 'section_index' when calling SlidesApi.delete_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections/{sectionIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'sectionIndex', section_index)\n\n # query parameters\n query_params = {}\n query_params[:'withSlides'] = @api_client.prepare_for_query(with_slides) unless with_slides.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def destroy\n @about_us_section.destroy\n respond_to do |format|\n format.html { redirect_to about_us_sections_url, notice: \"About us section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n\t\ttemp = @section.name\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_sections_path, :notice => \"Section '#{temp}' was deleted.\" }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crop_pricing = CropPricing.find(params[:id])\n @crop_pricing.destroy\n\n respond_to do |format|\n format.html { redirect_to(crop_pricings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pricing_plan = PricingPlan.find(params[:id])\n @pricing_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(pricing_plans_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_price.destroy\n respond_to do |format|\n format.html { redirect_to admin_prices_url, notice: 'Price was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @subsection.destroy\n head :no_content\n else\n render json: @subsection.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def api_remove\n data_hash = make_hash\n delete_hash = { division: data_hash[:division][:value] }\n handler.remove(delete_hash, path, subscriber_id)\n end",
"def destroy\n @service_offering.destroy\n respond_to do |format|\n format.html { redirect_to service_offerings_url, notice: 'Service offering was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pricing.destroy\n respond_to do |format|\n format.html { redirect_to job_pricings_url(params[:job_id]), notice: 'Pricing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_row.destroy\n respond_to do |format|\n flash[:success] = \"Section row was successfully destroyed.\"\n format.html { redirect_to section_rows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_row.destroy\n respond_to do |format|\n format.html { redirect_to invoice_rows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extractions_extraction_forms_projects_sections_type1.destroy\n respond_to do |format|\n format.html do\n redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n 'panel-tab': @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction_forms_projects_section\n .id),\n notice: t('removed')\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @price_level = PriceLevel.find(params[:id])\n @price_level.destroy\n\n respond_to do |format|\n format.html { redirect_to price_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bpsection = Bpsection.find(params[:id])\n @bpsection.destroy\n\n respond_to do |format|\n format.html { redirect_to(bpsections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @guide_section.destroy\n respond_to do |format|\n format.html { redirect_to guide_sections_url, notice: 'Guide section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portion = Portion.find(params[:id])\n @portion.destroy\n\n respond_to do |format|\n format.html { redirect_to portions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_configuration.destroy\n respond_to do |format|\n format.html { redirect_to section_configurations_url, notice: 'Section configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @price = Price.find(params[:id])\n @price.destroy\n\n respond_to do |format|\n format.html { redirect_to prices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discipline_section.destroy\n respond_to do |format|\n #format.html { redirect_to discipline_sections_url, notice: 'Раздел дисциплины был успешно удален' }\n #format.json { head :no_content }\n format.js { render ('discipline_sections/delete')}\n end\n end",
"def destroy\n @license_plate.destroy\n respond_to do |format|\n format.html { redirect_to license_plates_url, notice: 'License plate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @price_schema.destroy\n respond_to do |format|\n format.html { redirect_to price_schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @make_section = MakeSection.find(params[:id])\n @make_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(make_sections_url) }\n format.xml { head :ok }\n end\n \n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extractions_extraction_forms_projects_sections_type1.destroy\n respond_to do |format|\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section.id }\"),\n notice: t('removed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @form_section.destroy\n respond_with( [ :admin, @form_section] )\n end",
"def destroy\n @plate_cost = PlateCost.find(params[:id])\n @plate_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to plate_costs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cp_score_sheet_section = CpScoreSheetSection.find(params[:id])\n @cp_score_sheet_section.destroy\n\n respond_to do |format|\n format.html { redirect_to cp_score_sheet_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @join_section = JoinSection.find(params[:id])\n @join_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(join_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @model_section = ModelSection.find(params[:id])\n @model_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(model_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @menu_section = MenuSection.find(params[:id])\n @menu_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(menu_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @collection_invoice = CollectionInvoice.find(params[:id])\n @collection_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prd_m_prchs_price.destroy\n respond_to do |format|\n format.html { redirect_to prd_m_prchs_prices_url, notice: 'Prd m prchs price was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promo_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to promo_slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoicefield = Invoicefield.find(params[:id])\n @invoicefield.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicefields_url }\n format.json { head :no_content }\n end\n end",
"def delete_testimonial\n Testimonial.destroy(params[:id])\n render :update do |page|\n page.remove \"testimonial_#{params[:id]}\"\n end\n end",
"def destroy\n @assignment = Assignment.find(params[:id])\n @section = @assignment.section\n @assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to section_path(@section) }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end"
] |
[
"0.6980797",
"0.67241883",
"0.67241883",
"0.6705014",
"0.6673571",
"0.667",
"0.66619635",
"0.66590655",
"0.66590655",
"0.6596321",
"0.6587576",
"0.6576339",
"0.6574573",
"0.64880896",
"0.64826775",
"0.64783835",
"0.64728045",
"0.6459528",
"0.6452271",
"0.6452271",
"0.6437279",
"0.6388778",
"0.63871413",
"0.638181",
"0.63710046",
"0.6362099",
"0.6362099",
"0.6362099",
"0.6362099",
"0.6362099",
"0.6362099",
"0.63503504",
"0.6344547",
"0.63429695",
"0.63339573",
"0.6329553",
"0.63261664",
"0.632164",
"0.6311815",
"0.6311346",
"0.63089716",
"0.63043517",
"0.6285823",
"0.6276526",
"0.6264873",
"0.6250561",
"0.622824",
"0.6227135",
"0.6218143",
"0.621772",
"0.6206115",
"0.6192287",
"0.6191665",
"0.61910903",
"0.61847436",
"0.61677825",
"0.61633664",
"0.6156857",
"0.6151514",
"0.6148399",
"0.6139063",
"0.6118807",
"0.6114627",
"0.61057264",
"0.60942274",
"0.6088696",
"0.607544",
"0.6075036",
"0.60740817",
"0.60726035",
"0.60712636",
"0.60702866",
"0.60644543",
"0.6060136",
"0.6059932",
"0.6057351",
"0.60482436",
"0.6044856",
"0.60399526",
"0.6036455",
"0.60334325",
"0.60332197",
"0.60303855",
"0.60290134",
"0.602423",
"0.60077226",
"0.6005902",
"0.60058826",
"0.6000771",
"0.6000265",
"0.59970605",
"0.59970146",
"0.599289",
"0.5980832",
"0.59707314",
"0.5969039",
"0.59643024",
"0.5956433",
"0.595603",
"0.59487605"
] |
0.7631115
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_pricing_section
@pricing_section = PricingSection.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def pricing_section_params
params.require(:pricing_section).permit(:section_id, :description)
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]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"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.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
projects:list Display the available set of Mortar projects.
|
def list
index
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def list_all\n query = create_query(:Project, :all, by: default_sort_order)\n show_selected_projects(query)\n end",
"def list\n get 'projects'\n end",
"def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def list(params = {})\n response = get_request('/projects/', params)\n response.map { |project| TheShiningSource::Project.new(project) }\n end",
"def all\n @projects\n end",
"def all\n @projects\n end",
"def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def list\n @title = \"Project List\"\n\n conditions = nil\n @status = nil\n @sortby = nil\n\n if params[:status]\n conditions = [ \"project_status = ?\", params[:status] ]\n @status = params[:status]\n end\n\n sortbylookup = {\n 'name' => \"project_title\",\n 'start' => \"start_date\",\n 'end' => \"actual_finish_date\"\n }\n\n if sortbylookup[params[:sortby]]\n order = sortbylookup[params[:sortby]]\n @sortby = params[:sortby]\n else\n order = 'project_title'\n end\n order += ' DESC'\n\n @projects = Project.paginate( :page => params[:page], :per_page => 20, :conditions => conditions, :order => order)\n end",
"def index\n\t\t@projects = Project.all\n\tend",
"def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end",
"def index\n @projects = Project.all\n end",
"def index\n \t@projects = Project.all\n end",
"def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend",
"def show\n @projects = Project.all\n end",
"def list\r\n @projects = Project.where(user:current_user).order(created_at: :desc).page(params[:page])\r\n respond_with(@projects)\r\n end",
"def projects\n PivotalTracker::Project.all\n end",
"def show\n @projects = find_projects\n end",
"def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\n pid = project[\"project\"][\"links\"][\"roles\"].to_s\r\n puts \"Project name: #{project[\"project\"][\"meta\"][\"title\"].bright} Project PID: #{pid.match(\"[^\\/]{32}\").to_s.bright}\"\r\n end\r\n end",
"def listProjects\n if user_signed_in?\n @project_lists = ProjectStrong.where(user_id: current_user.id)\n end\n end",
"def index\n \t\t\t@projects = Project.all\n end",
"def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def build_project_lists\n # call the application controller connect funtion\n conn = basecamp_connect\n unless conn \n raise \"url or authkey not set\"\n end\n projects = Basecamp::Project.find_by_status(conn, 'active')\n @project_list = projects.collect{|p| [p.name, p.id] }.sort_by{|name, id| name }\n @mantis_list = MantisProjectTable.order(\"name\").all.collect{|p| [ p.name, p.id ] }\n end",
"def index\n @projects = @namespace.projects.all\n end",
"def index\n #@projects = Project.all\n end",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end",
"def index\n # Lista todos los proyectos\n @projects = Project.all\n end",
"def projects(params = nil)\n params = params.merge({ :current_user => @options[:current_user]})\n params = params.except(:manufacturer_id, :catg_slug, :office_id, :max_matches)\n params[:order] ||= 'recently_active'\n\n @projects_response = ProjectsIndexPresenter.new(params[:current_user], params).response\n projects = @projects_response[:projects] || []\n projects\n end",
"def index\n\t\t@projects = current_user.projects.order(\"created_at ASC\")\n\tend",
"def projects_list(opts = {})\n data, _status_code, _headers = projects_list_with_http_info(opts)\n data\n end",
"def projects(params = {})\n fetch_all('projects', 'projects', params)\n end",
"def projects\n Harvest::Resources::Project\n end",
"def find_all\n api.command(:listProjects).collect do |project|\n project[1]['project'].map { |p| self.new p }\n end.flatten\n end",
"def index\n @projects = Project.paginate(page: params[:page], per_page: 5) # for pagination\n end",
"def index\n @projects = Project.page(params[:page]).per(10)\n end",
"def projects\n resource 'projects'\n end",
"def projects\n @projects\n end",
"def projects\n @projects ||= Project.all\n end",
"def index\n @projects = current_power.projects\n end",
"def list_projects max: nil, token: nil\n execute backoff: true do\n service.list_projects max_results: max, page_token: token\n end\n end",
"def index\n @projects=Project.all\n end",
"def index\n @projects_managers = ProjectsManager.all\n end",
"def project_list\n project_folders = Dir::entries(::File.join(Msf::Config.log_directory, 'projects'))\n projects = []\n framework.db.workspaces.each do |s|\n if project_folders.include?(s.name)\n projects << s.name\n end\n end\n return projects\n end",
"def find_projects\n @projects = Project.all\n end",
"def index\n\t\t@projects = Project.where(user_id: current_user.id).order(created_at: :asc)\n\tend",
"def index\n @projects = Project.order(order: :asc)\n end",
"def index\t\t\t\t\t\t\t\t\t# Index is a list of things or ...basically your index page.\n\t\t@projects = Project.all\t\t\t\t\t# Make a variable that can be seen by the view! with the @ - IT'S PLURAL!\n\tend",
"def index\r\n @projects = current_user.projects\r\n end",
"def projects(options = {})\n get(\"projects\", options).projects\n end",
"def projects ; end",
"def show\n @projects = @zabydovnuk.projects\n end",
"def index\n\tif @current_user.is_admin?\n\t\t@projects = Project.all\n\telse \n\t\t@projects = @current_user.projects\n\tend\n end",
"def list\n current_workspace = framework.db.workspace.name\n project_list.each do |p|\n if current_workspace == p\n print_line(\"%red* #{p}%clr\")\n else\n print_line(\" #{p}\")\n end\n end\n return true\n end",
"def index\n @projects = Project.all.page(params[:page]).per(20)\n end",
"def index\n @projects = Project.displayable_sorted_by_votes\n end",
"def projects_list\n projects.inject({}) do |h, project|\n h.merge( project['id'] => project['name'] )\n end\n end",
"def index\n @managers_projects = ManagersProject.all\n end",
"def projects\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Project)\n end",
"def index\n @projects = Project.order( :name ).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def index\n authorize Project\n # Only index projects of the current user\n @projects = current_user.projects\n @public_projects = policy_scope(Project)\n @help_context = \"Projects\"\n end",
"def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n admin?\n @projects = Project.all\n end",
"def index\r\n\r\n\t@showProjects = []\r\n\tshow_projects_closed = 0\r\n\tunless params[:closed]\r\n show_projects_closed = 1\r\n end\r\n\r\n\tif (show_projects_closed == 1)\r\n\t\t@allProjects = Project.visible(User.current).find(:all, :order => 'lft', :conditions => [\"#{Project.table_name}.status=#{Project::STATUS_ACTIVE}\"])\r\n\telse\r\n\t\t@allProjects = Project.visible(User.current).find(:all, :order => 'lft')\r\n\tend\t\r\n\tid = params[:id]\r\n\r\n\tif !(id)\r\n\t\tprojectsList = @allProjects - getProjectsNoMember()\r\n\t\t@showProjects = getRootProjects(projectsList)\r\n\telse\r\n\t\tparentProject = Project.find_by_id(id)\r\n\t\tchildProjects = getChildProject(parentProject)\r\n\t\t@showProjects = getRootProjectsFromList(childProjects)\r\n\tend\r\n\t@allProjects = @allProjects - getProjectsNoMember()\r\n\treturn @showProjects\r\n end",
"def index\n @projects = current_user.projects.all\n end",
"def index\n @curriculum_projects = CurriculumProject.all\n end",
"def all\n cookies[:allProjects]=true\n @all_projects=true\n @projects={\n \"current\"=> Project.find_all_by_state('current'),\n \"finished\"=> Project.find_all_by_state('finished'),\n \"aborted\"=> Project.find_all_by_state('aborted')\n }\n\t\tself.bread\n authorize! :list_all, @projects\n render 'index'\n end",
"def show_selected_projects(query, args={})\n args = {\n :action => :list_projects,\n :letters => 'projects.title',\n :num_per_page => 10,\n }.merge(args)\n\n @links ||= []\n\n # Add some alternate sorting criteria.\n args[:sorting_links] = [\n ['name', :sort_by_title.t],\n ['created_at', :sort_by_created_at.t],\n ['updated_at', :sort_by_updated_at.t],\n ]\n\n show_index_of_objects(query, args)\n end",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end"
] |
[
"0.8321108",
"0.81430775",
"0.8031821",
"0.78649247",
"0.77635694",
"0.77293485",
"0.76331955",
"0.76331955",
"0.76258874",
"0.76119924",
"0.75845623",
"0.75328326",
"0.7458737",
"0.73593843",
"0.7344323",
"0.7305017",
"0.7255085",
"0.7253378",
"0.72194785",
"0.7215072",
"0.7194845",
"0.719409",
"0.7173322",
"0.71697515",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.7160608",
"0.71594876",
"0.71574163",
"0.7137569",
"0.7122561",
"0.7081872",
"0.70671934",
"0.70270723",
"0.7025729",
"0.70239365",
"0.7000195",
"0.6986854",
"0.6986307",
"0.6978587",
"0.6977636",
"0.6969517",
"0.6959448",
"0.6958449",
"0.69572294",
"0.6950593",
"0.6928919",
"0.68923765",
"0.68852603",
"0.68382764",
"0.6823181",
"0.6817115",
"0.68157446",
"0.68135655",
"0.679516",
"0.6790221",
"0.6777897",
"0.6777244",
"0.6775303",
"0.6770912",
"0.6756158",
"0.6753266",
"0.67348135",
"0.6721256",
"0.67172843",
"0.67067534",
"0.6702974",
"0.67002887",
"0.6693724",
"0.66915226",
"0.66915226",
"0.66915226",
"0.66915226",
"0.66915226",
"0.66915226",
"0.66915226",
"0.66915226",
"0.66878223",
"0.6683987",
"0.66772425",
"0.66687155",
"0.6661976",
"0.6656041",
"0.66535246"
] |
0.0
|
-1
|
projects:delete PROJECTNAME Delete the Mortar project PROJECTNAME.
|
def delete
name = shift_argument
unless name
error("Usage: mortar projects:delete PROJECTNAME\nMust specify PROJECTNAME.")
end
validate_arguments!
projects = api.get_projects().body['projects']
project_id = nil
if projects.any?
projects.each do |project|
if project['name'] == name
project_id = project['project_id']
end
end
end
if project_id.nil?
display "\nNo project with name: #{name}"
else
# delete embedded project mirror if one exists
mirror_dir = "#{git.mortar_mirrors_dir()}/#{name}"
if File.directory? mirror_dir
FileUtils.rm_r mirror_dir
end
# delete Mortar remote
action("Sending request to delete project: #{name}") do
api.delete_project(project_id).body['project_id']
end
display "\nYour project has been deleted."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete(projects)\n project_ids = projects.collect { |project| project.id } \n args = {ids: project_ids.to_json}\n return @client.api_helper.command(args, \"project_delete\")\n end",
"def delete_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deleteproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def delete_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'DeleteProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def delete_project(id)\n elektron_identity.delete(\"projects/#{id}\")\n end",
"def delete_project\n\t\t@project = Project.find(params[:id])\n\n\t\tif @project.destroy\n\t\t\tredirect_to \"/details\"\n\t\telse\n\t\t\treder :action => \"delete_project\"\n\t\tend\n\tend",
"def delproject(project)\n post('delproject.json', project: project)\n end",
"def destroy\n @project.destroy\n redirect_to root_url, flash: {success: t('controllers.projects.destroy.deleted', name: @project.name)}\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n redirect_to projects_url, notice: I18n.t('flash.actions.project.destroy.notice')\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n end",
"def destroy\n if @project.destroy\n redirect_to projects_path, notice: 'Project has been deleted.'\n else\n redirect_to projects_path, notice: 'Project could not be deleted.'\n end\n end",
"def destroy\n @project = Project.find params[:id]\n @project.destroy\n redirect_to projects_path, notice: 'The project was deleted'\n end",
"def destroy\n @project = AzProject.find(params[:id])\n @project.deleting = true # По этому странному атрибуту страница определяет, что она не должна удалять свои задачи из Redmine\n @project.save\n\n if @project.can_user_delete(current_user)\n @project.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to('/projects') }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @project.destroy\n redirect_to root_path\n else\n redirect_to root_path\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n redirect_to projects_path, :notice => 'Anlage wurde gelöscht.'\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n redirect_to(projects_url)\n end",
"def destroy\n @project.destroy\n\n head :no_content\n end",
"def destroy\n \n @project = Project.find(params[:id])\n if @project.deleted == true\n @project.deleted = false\n else\n @project.deleted = true\n end\n @project.save\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def _project_delete(acronym)\n delete \"/projects/#{acronym}\"\n _response_status(204, last_response)\n end",
"def destroy\n # Se busca el proyecto por el id\n @project = Project.find(params[:id])\n # Se destruye\n @project.destroy\n redirect_to projects_url\n end",
"def delete_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def destroy\n @project = Admin::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end",
"def deleteProject(id) \n project_to_remove = getProjectByID(id)\n\n if project_to_remove != nil \n @Projects.delete(project_to_remove)\n else \n puts \"No such project. \"\n end \n end",
"def destroy\n @project.destroy\n head :no_content\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n end\n end",
"def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @project, :can_manage_projects?\n @project.destroy\n redirect_to root_url, notice: 'Project was successfully destroyed.'\n end",
"def destroy \n @project = Project.find(params[:id])\n @project.destroy\n redirect_to root_url\n end",
"def destroy\n name = @project.name\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_path,\n :notice => t('general.deleted',\n :entity => t('project.entity_name'),\n :identifier => name)) }\n format.xml { head :ok }\n end\n end",
"def delete(project_id)\n raw_response = delete_request(\"projects/#{project_id}\")\n parse_response(raw_response)\n end",
"def delete(project_id)\n raw_response = delete_request(\"projects/#{project_id}\")\n parse_response(raw_response)\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\t\t\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Successfully deleted project.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \tproject = Project.find(params[:id])\n\tif !project.blank? && project.can_be_deleted?\n project.destroy\n redirect_to :action => 'list'\n\telse\n\t flash[:error] = 'Project cannot be deleted to protect the related data'\n\t redirect_to :action => 'edit', :id => project.project_id\n\tend\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n redirect_to user_projects_url(@user)\n end",
"def destroy\n standard_destroy(Project, params[:id])\n end",
"def backend_deleteProject(param) \n @Projects.delete(param) if @Projects.include? param \n end",
"def destroy\n return unless find_project!\n\n if !check_permission!(@project)\n redirect_to(project_path(@project.id, q: get_query_param))\n elsif !@project.destroy\n flash_error(:destroy_project_failed.t)\n redirect_to(project_path(@project.id, q: get_query_param))\n else\n @project.log_destroy\n flash_notice(:destroy_project_success.t)\n redirect_to(projects_path(q: get_query_param))\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_projects_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@project = Project.find(params[:id])\n\t\t@project.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to projects_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = 'Project was deleted.'\n redirect_to projects_path\n end\n end\n end",
"def destroy\n Rails.logger.info \"We are deleting project\"\n @todo_project.destroy\n respond_to do |format|\n format.html { redirect_to todo_projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n ActiveRecord::Base.transaction do\n ## Remove the project and everything associated with it (permissions,\n ## files, comments, altcode).\n delete_project(@project)\n\n render json: \"\", serializer: SuccessSerializer\n end\n rescue => e\n render_error \"Could not remove project: #{e}\"\n end\n end",
"def destroy\n\t\t@project.destroy\n\t\trespond_to do |format|\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n authorize! :destroy, @project\n @project.destroy\n\n head :no_content\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Salesforce::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(salesforce_projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pat_project = Pat::Project.find(params[:id])\n @pat_project.destroy\n\n respond_to do |format|\n format.html { redirect_to(pat_projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n # @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7917102",
"0.78557205",
"0.7784202",
"0.7671753",
"0.76519525",
"0.7615767",
"0.76097095",
"0.75473964",
"0.75473964",
"0.75473964",
"0.75473964",
"0.75473964",
"0.7539417",
"0.7506018",
"0.74974936",
"0.7480534",
"0.7477606",
"0.74680436",
"0.7467646",
"0.7435846",
"0.7431725",
"0.74137914",
"0.7411115",
"0.7386204",
"0.7355683",
"0.73522705",
"0.73454124",
"0.7342175",
"0.7329435",
"0.73229456",
"0.73123986",
"0.7308457",
"0.73083764",
"0.72801274",
"0.72801274",
"0.72776246",
"0.7236099",
"0.7227082",
"0.72180843",
"0.7217766",
"0.7199653",
"0.7198736",
"0.7186835",
"0.71861243",
"0.71727204",
"0.7166936",
"0.716668",
"0.7156881",
"0.714656",
"0.7141665",
"0.7123019",
"0.71222323",
"0.711074",
"0.7109858",
"0.7109858",
"0.7109858",
"0.7109858",
"0.7092908",
"0.7088824",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.7084212",
"0.70784783",
"0.7074554",
"0.7074319",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649",
"0.7067649"
] |
0.86508876
|
0
|
projects:create PROJECTNAME Used when you want to start a new Mortar project using Mortar generated code. embedded Create a Mortar project that is not its own git repo. Your code will still be synced with a git repo in the cloud. public Register a public project, which can be viewed and forked by anyone.
|
def create
name = shift_argument
unless name
error("Usage: mortar projects:create PROJECTNAME\nMust specify PROJECTNAME")
end
args = [name,]
is_public = false
if options[:public]
is_public= true
ask_public(is_public)
end
validate_project_name(name)
project_id = register_api_call(name,is_public)
Mortar::Command::run("generate:project", [name])
FileUtils.cd(name)
is_embedded = false
if options[:embedded]
is_embedded = true
register_do(name, is_public, is_embedded, project_id)
else
git.git_init
git.git("add .")
git.git("commit -m \"Mortar project scaffolding\"")
register_do(name, is_public, is_embedded, project_id)
display "NOTE: You'll need to change to the new directory to use your project:\n cd #{name}\n\n"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n \n unless git.has_dot_git?\n error(\"Can only create a mortar project for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n \n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not create a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not create a new project inside of an existing mortar project.\")\n end\n end\n \n project_id = nil\n action(\"Sending request to create project: #{name}\") do\n project_id = api.post_project(name).body[\"project_id\"]\n end\n \n project_result = nil\n project_status = nil\n display\n ticking(polling_interval) do |ticks|\n project_result = api.get_project(project_id).body\n project_status = project_result.fetch(\"status_code\", project_result[\"status\"])\n project_description = project_result.fetch(\"status_description\", project_status)\n is_finished = Mortar::API::Projects::STATUSES_COMPLETE.include?(project_status)\n\n redisplay(\"Status: %s %s\" % [\n project_description + (is_finished ? \"\" : \"...\"),\n is_finished ? \" \" : spinner(ticks)],\n is_finished) # only display newline on last message\n if is_finished\n display\n break\n end\n end\n \n case project_status\n when Mortar::API::Projects::STATUS_FAILED\n error(\"Project creation failed.\\nError message: #{project_result['error_message']}\")\n when Mortar::API::Projects::STATUS_ACTIVE\n git.remote_add(\"mortar\", project_result['git_url'])\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n else\n raise RuntimeError, \"Unknown project status: #{project_status} for project_id: #{project_id}\"\n end\n \n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create_project(params)\n elektron_identity.post(\"projects\") { { project: params } }.body[\n \"project\"\n ]\n end",
"def create_project(name, type)\nend",
"def create_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"createproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def create_project(name, outputter, modules: nil)\n Bolt::ProjectManager.new(config, outputter, pal)\n .create(Dir.pwd, name, modules)\n end",
"def create_project(project)\n create_or_update(project, nil, 'project', 'projects')\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_project\n unless options.force\n abort \"'#{project}' already exists\" if File.exist?( project ) \n end\n\n # copy over files from the master project data diretory in crate\n files = project_files\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each do |file|\n cp file \n end\n end\n end",
"def create(project_name, repo_name, description) ; end",
"def new_project \n require 'fileutils'\n dir = \"./\" + @arguments.first\n Dir.mkdir(dir)\n %w[app config experiments report results test tmp vendor].each do |d|\n Dir.mkdir(dir + \"/\" + d)\n end\n basedir = File.dirname(__FILE__)\n File.open(File.join(dir, \"config\", \"config.yaml\"), \"w\") do |f|\n f << \"---\\nenvironments:\\n development:\\n compute:\\n\"\n end\n File.open(File.join(dir, \".gitignore\"), \"w\") do |f|\n f << \"tmp/*\"\n end\n FileUtils::cp File.join(basedir, \"generator/readme_template.txt\"), File.join(dir, \"README\")\n FileUtils::cp File.join(basedir, \"generator/Rakefile\"), File.join(dir, \"Rakefile\")\n FileUtils::cp File.join(basedir, \"generator/experiment_template.rb.txt\"), File.join(dir, \"experiments\", \"experiment.rb\")\n end",
"def create_project(options={})\n\t\t\tProject.create({\n\t\t\t\ttitle: \"Title example\",\n\t\t\t\tlevel: \"Easy\",\n\t\t\t\tcategory: \"Art\",\n\t\t\t\tdescription: \"Description example\"*20,\n\t\t\t\tstatus: \"Active\",\n\t\t\t\tpercentage: 50\n\t\t\t}.merge(options))\n\t\tend",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_project(options = {})\n project = Project.create(some_params(options))\n return project\n end",
"def create_project options\n Project::create_folder options\n Project::create_db_row options\n end",
"def create_valid_project\n create_project_with 'Some test project'\n end",
"def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"def create_project(args)\n system %{#{bin} create #{args.join(' ')}}\n end",
"def new_project(name:, component:, url_base:, branch:)\n # puts \"new_project(#{name}, #{component}, #{url_base})\"\n Project.new(name, component, url_base, branch: branch)\n end",
"def create_git_project\n GemBootstrap::GitUtils.create_git_project(File.expand_path(name), name)\n end",
"def createProject(description) \n project = Project.new \n project.Description = description \n @Projects.push(project) \n end",
"def project_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/projects.json\",\n body: project_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end",
"def project\n raw = client.get project_url\n client.factory.create(GoodData::Project, raw)\n end",
"def create_project(project)\n \n update_project(project)\n \n # TODO: Need to handle this exception...\n if (File.directory? project.svn_dir) then\n raise StandardError, \"A project called #{project.display_name} already exists in the #{project.client.display_name} repository. Please delete it or choose an alternate project name and run this script again.\"\n end\n \n # create a new subversion repository\n say(\"Creating a new subversion repository...\")\n `svnadmin create #{project.svn_dir}`\n \n # import into svn\n say(\"Importing temporary project into the new subversion repository...\")\n `svn import #{project.template}/svn file:///#{project.svn_dir} --message \"initial import\"`\n \n # this should fix the 'can't open activity db error'\n `sudo chmod 770 #{project.svn_dir}`\n activites_file = File.join(project.svn_dir,\"/dav/activities\")\n if File.exists?(activites_file)\n `sudo chmod 755 #{activites_file}`\n `sudo chown www-data:www-data #{activites_file}`\n end\n \n # install default post commit hook\n hook_file = File.join(project.svn_dir,\"hooks\",\"post-commit\")\n Template.new(File.join(Config.subtrac_path, \"svn\", \"post-commit.erb\")).write(hook_file)\n `sudo chmod +x #{hook_file}`\n\n end",
"def generate_project!(attributes={})\n identifier = \"a\" + Redmine::Utils.random_hex(6)\n Project.generate!(\n {\n :identifier => identifier,\n :name => identifier,\n :tracker_ids => [],\n :enabled_module_names => []\n }.merge(attributes)\n )\n end",
"def new_project(name)\n path = File.expand_path(name)\n if Dir.exist?(path)\n say \"#{path} already exists. Please choose a directory name that doesn't already exist.\".red\n exit\n end\n\n @gz_info = new_global_zone\n @gz_info.serialize(path)\n\n say \"You have now configured your SmartOS virtual infrastructure. Inspect it, then run \"\\\n \"'smartos up' to build it!\".green\n end",
"def create(rubyOF_project=nil)\n\t\t# If you invoke with no arguments, provide useful help,\n\t\t# rather than the standard error message.\n\t\tif rubyOF_project.nil?\n\t\t\traise ArgumentError, \"<1 argument>: Need to specify project name, or relative path (relative to [GEM_ROOT]/bin/projects), or absolute path to project (project folder will be created automatically).\"\n\t\tend\n\t\t\t\n\t\t\n\t\t# == Figure where to place the new project\n\t\tRubyOF::Build.create_project(rubyOF_project) do |path|\n\t\t\t# == Copy the template project into the target location\n\t\t\ttemplate_project_name = 'boilerplate'\n\t\t\t\n\t\t\t# Need to clean the example first, so you don't copy built files\n\t\t\t# run_task('clean_project', template_project_name)\n\t\t\t# ^ NOTE: This has been separated from the Rakefile, so it is no longer possible to clean out the example. But that's not actually so bad.\n\t\t\t\n\t\t\t# Find full path to template\n\t\t\t# NOTE: template_name == template_project_name\n\t\t\ttemplate_name, template_path =\n\t\t\t\tRubyOF::Build.load_project(template_project_name)\n\t\t\t\n\t\t\t# Copy the full directory to destination\n\t\t\tFileUtils.mkdir_p File.dirname(path) # make sure containg dir exists\n\t\t\tFileUtils.cp_r template_path, path\n\t\tend\n\t\t\n\t\t\n\t\t# # NOTE: This is the job for a unit test. Don't test this here\n\t\t# # The name inputted should be exactly the same as the name outputted.\n\t\t# # If not, there is a problem with the parsing function.\n\t\t# if template_project_name != template_name\n\t\t# \traise \"ERROR: RubyOF::Build.create_project() parsed incorrectly.\" +\n\t\t# \t \" Given '#{template_project_name}' \"\n\t\t# end;\n\t\t\n\t\t\n\t\t\n\t\t# Make sure that the GEM_ROOT path is set correctly,\n\t\t# regaurdless of where the new project has been created.\n\t\tself.update(rubyOF_project)\n\tend",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n\n json = {:project =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => 1,\n 'authorizationToken' => auth_token,\n 'driver' => 'Pg'\n }\n }\n }\n json['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n if block\n GoodData::with_project(project) do |p|\n block.call(p)\n end\n end\n project\n end",
"def new_custom_project \n begin\n tree = eval(params[:tree])\n params[:package] = tree\n result = MavensMate.new_project(params)\n return if result.nil?\n kill_server unless ! result[:is_success] \n MavensMate.close_all_html_windows unless ! result[:is_success]\n render \"_project_new_result\", :locals => { :message => result[:error_message], :success => result[:is_success] }\n rescue Exception => e\n TextMate::UI.alert(:warning, \"MavensMate\", e.message)\n end\n end",
"def create \n\t\t@project = Project.new(project_params)\n\t\t@project.creator = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attributes={})\n raw_response = post_request('projects', project: attributes)\n parse_response(raw_response, :project)\n end",
"def create_project\n empty_directory(project)\n end",
"def create(options={})\n title = options[:title]\n summary = options[:summary]\n template = options[:template]\n token = options[:token]\n\n GoodData::Project.create(:title => title, :summary => summary, :template => template, :auth_token => token)\n end",
"def project_create(project_name)\n # Make sure that proper values where provided\n spool_path = ::File.join(Msf::Config.log_directory, 'projects', project_name)\n ::FileUtils.mkdir_p(spool_path)\n spool_file = ::File.join(spool_path, \"#{project_name}_spool.log\")\n if framework.db and framework.db.active\n print_line(\"Creating DB Workspace named #{project_name}\")\n workspace = framework.db.add_workspace(project_name)\n framework.db.workspace = workspace\n print_line(\"Added workspace: #{workspace.name}\")\n driver.init_ui(driver.input, Rex::Ui::Text::Output::Tee.new(spool_file))\n\n # Restore the prompt so we don't get \"msf > >\".\n #prompt = framework.datastore['Prompt'] || Msf::Ui::Console::Driver::DefaultPrompt\n #prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar\n #if active_module # if there is an active module, give them the fanciness they have come to expect\n # driver.update_prompt(\"#{prompt} #{mod.type}(%bld%red#{mod.shortname}%clr) \", prompt_char, true)\n #else\n # driver.update_prompt(\"#{prompt} \", prompt_char, true)\n #end\n\n print_line(\"Spooling to file #{spool_file}...\")\n else\n print_error('A database most be configured and connected to create a project')\n end\n return true\n end",
"def create_projects\n projects = []\n config.projects.each do |project|\n projects << Project.new(project)\n end\n projects\nend",
"def project_new\n new_project.click\n end",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def create_project(uid, name, owner, project_profile)\n cl = client(\"Projects\", uid)\n response = cl.call(:create_project, message: {\n projectid: name,\n owner: owner,\n profile: project_profile.map { |f, v| { name: f, value: v.to_s } }\n })\n\n raise Error unless response.success?\n\n return response.to_hash[:create_project_response][:return]\n rescue Savon::SOAPFault => e\n process_error e\n end",
"def new\n @project = Project.new()\n end",
"def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end",
"def create(project_name)\n\t\tnew_branch_name = branch_generator(project_name)\n\t\tif project_name.nil?\n\t\t\tputs \"Missing project name!\"\n\t\telse\n\n\t\t\texec(\"\n\t\t\tmkdir #{@@default_directory}#{project_name.to_s} &&\n\t\t\tcd #{@@default_directory}#{project_name.to_s} &&\n\t\t\tgit init &&\n\t\t\tgit checkout -b master &&\n\t\t\tgit commit --allow-empty -m 'first commit' &&\n\t\t\tgit tag -a v0.0 -m 'first tag' &&\n\t\t\tgit checkout -b #{new_branch_name}\n\t\t\t\")\n\n\t\t\tsystem(\"cd #{@@default_directory}#{project_name.to_s}\")\n\t\t\tsave(project_name)\n\t\tend\n\tend",
"def create\n @project = current_user.projects.build(params[:project])\n if @project.save\n flash[:success] = \"Project was successfully created.\"\n redirect_to root_path\n else\n flash[:error] = \"Failed to make project.\"\n render 'new'\n end\n end",
"def create(project)\n self.say(\"* Creating project in directory: #{project}\")\n\n dir = Pathname.new(project)\n\n %w[\n manifests\n modules\n ].each do |subdir|\n target = (dir + subdir)\n unless target.exist?\n FileUtils.mkdir_p(target)\n self.say(\"- #{target}/\")\n end\n end\n\n return true\n end",
"def create_project( project_dir, git_enabled )\n if !File.directory? project_dir\n print \"Creating project dir...\"\n Dir.mkdir project_dir\n Dir.chdir project_dir\n File.open( 'README', 'w' ) do |file|\n file.puts \"README for the #{project_dir} project.\"\n file.puts ''\n file.puts \"This is just a place holder. Add your own content here.\"\n end\n print \"Done\"\n else\n puts \"Directory for #{project_name} already exists!\"\n end\n\n puts ''\n\n if git_enabled == '--git'\n puts \"Creating Git repo...\"\n if !File.directory? '.git'\n system( 'git init && git add . && git commit -m \"first commit\" -a' )\n end\n puts \"Done\"\n end\n\n puts ''\n \n puts \"Finished setting up your project!\"\nend",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n fail 'You have to provide your token for creating projects as :auth_token parameter' if auth_token.nil? || auth_token.empty?\n\n json = {\n 'project' =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => attributes[:guided_navigation] || 1,\n 'authorizationToken' => auth_token,\n 'driver' => attributes[:driver] || 'Pg'\n }\n }\n }\n\n json['project']['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n\n # until it is enabled or deleted, recur. This should still end if there is a exception thrown out from RESTClient. This sometimes happens from WebApp when request is too long\n while project.state.to_s != 'enabled'\n if project.state.to_s == 'deleted'\n # if project is switched to deleted state, fail. This is usually problem of creating a template which is invalid.\n fail 'Project was marked as deleted during creation. This usually means you were trying to create from template and it failed.'\n end\n sleep(3)\n project.reload!\n end\n\n if block\n GoodData.with_project(project) do |p|\n block.call(p)\n end\n end\n sleep 3\n project\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def create_project(tx)\n Installer.copy(tx, \"#{@service_dir}/pieces/public\", get_path(:web))\n true\n end",
"def create_project(name)\n response = @db.exec_params(%Q[\n INSERT INTO projects(name)\n VALUES ($1)\n RETURNING id;\n ], [name])\n\n response.first[\"id\"]\n end",
"def create_project_without_n_plus_1(*args)\n Gitlab::GitalyClient.allow_n_plus_1_calls do\n create(:project, :public, *args)\n end\n end",
"def create_project (project, pledge_goal)\n Project.new(project, self, pledge_goal)\n end",
"def create\n @project = Project.create(project_params)\n if @project.errors.blank?\n flash[:success] = t('controllers.projects.create.success', project: @project.name)\n else\n flash.now[:alert] = @project.errors.full_messages.unshift(t('controllers.projects.create.failure'))\n end\n respond_with @project, location: projects_url\n end",
"def create\n cmp = AzCompany.find(params[:az_project][:owner_id])\n @project = AzProject.create(params[:az_project][:name], cmp, current_user, params[:az_project][:public_access])\n\n @title = 'Создание нового сайта'\n\n respond_to do |format|\n if @project.id\n flash[:notice] = 'Проект успешно создан.'\n format.html { redirect_to(@project) }\n else\n format.html { render :template => 'az_projects/new', :owner_id => cmp.id }\n end\n end\n end",
"def new\n @project = Project.new\n @title = \"New Project\"\n end",
"def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def register\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:register PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n ask_public(options[:public])\n #nil is non existant project_id because it hasn't been posted yet\n register_do(name, options[:public], options[:embedded], nil) \n \n end",
"def create(project_name)\n project = read_config_file()\n FileUtils.mkdir(project_name)\n \n if project['project']['files']\n project['project']['files'].each do |file|\n FileUtils.touch(\"#{project_name}/#{file}.#{@language}\")\n end\n end\n \n project['project']['folders'].each do |folder|\n FileUtils.mkdir_p(\"#{project_name}/#{folder['name']}\")\n \n if folder['files']\n folder['files'].each do |file|\n FileUtils.touch(\"#{project_name}/#{folder['name']}/#{file}\")\n end\n end\n \n end\n \n end",
"def create\n project_params[:owner_id] = current_user.id if project_params[:owner_id].nil? or not current_user.is_admin?\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_url, notice: 'Project was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.status = \"Etat zero\"\n creator = current_user\n ProjectUser.create(:project => @project, :user => creator, :admin => true)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n \n if @project.save\n flash[:success] = \"Project created\" \n redirect_to projects_url\n else\n flash[:danger] = \"Cannot create project\"\n render 'new'\n end\n end",
"def create\n @project = Project.new(params[:project])\n\t\t@project.user_id =current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@project = Project.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.html { redirect_to projects_url, notice: 'Project was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @project }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to project_url(@project) }\n format.xml { head :created, :location => admin_project_url(@project) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n if @project.save\n flash[:notice] = t('projects.create.notice')\n redirect_to projects_path\n else\n render :action => \"new\"\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n add_breadcrumb \"Nouveau\"\n @project = Project.new\n end",
"def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_project_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Project'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.create_project\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_project(path)\n path = File.expand_path(path)\n startup_message(path)\n create_dir(path)\n download_fitnesse(path)\n create_fitnesse_root(path)\n install_mastiffe(path)\n install_template(path)\n # TODO: Error handling\n success_message(path)\n end",
"def new\r\n # This can and probably SHOULD be replaced with some URL rewrite magic\r\n # now that the project loader is Redmine project based.\r\n find_project()\r\n end",
"def create_project(project_name, target_dollar_amount)\n @db.execute('insert into projects values(?, ?, ?);', nil, project_name, target_dollar_amount)\n end",
"def create\n @project = Project.new(project_params)\n\n if is_organization_admin? and @project.save\n @project.team_members.create(user_id: @project.organization.owner_id)\n render json: {\n name: @project.name,\n organization: @project.organization.name,\n url: project_dashboard_path(@project.id)\n }\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@project = Project.new(params[:project].merge({:user_id => present_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.created') }\n\t\t\t\tformat.json { render json: @project, status: :created, location: @project }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @project = Project.new(params[:project])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n=======\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params.merge({\n owner_id: current_user_id,\n owner_name: current_user_name,\n user_id: current_user_db_record.id\n }))\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(global_options, options)\n status, body = project_create(global_options, options)\n\n if status == 201\n save_message(create_success_message(body))\n true\n else\n parse_message(body)\n false\n end\n end",
"def create\n if @project.save\n flash[:success] = 'Project was saved!'\n redirect_to root_path\n else\n render 'new'\n end\n end",
"def perform(args)\n opts = Slop.parse!(args) do\n banner (<<-eos\n Usage:\n smartos new <name>\n\n Description:\n Creates a new SmartOS virtual infrastructure project.\n\n Asks some questions about the topology of your network and then creates configuration\n files to prepare your Global Zone. After this command has run, use 'smartos generate'\n to generate VM definitions. And finally, run 'smartos up' to actaully create your VMs.\n\n eos\n ).strip_indent\n end\n\n if args.size != 1\n say opts\n exit\n end\n\n new_project(args.first)\n end",
"def create\n @project = Project.new(params[:project])\n # Si se crea correctamente, se guarda y se redirige al show con un mensaje de exito,\n # sino, se hace un render al new del proyecto, dando el mensaje de error correspondiente\n if @project.save\n redirect_to @project, flash: {success: I18n.t('project.create_success')}\n else\n render 'new'\n end\n end",
"def create_project_with_task(project_options: {}, task_options: {})\n project = create_project(project_options)\n task = create_task(task_options)\n project.tasks << task\n\n return project\n end",
"def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @new_nav = true;\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n if params[:project_attachments]\n create_attachments\n end\n\n if params[:project_fields]\n create_fields\n end\n\n if params[:slider_objects]\n create_slider_objects\n end\n\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: t('models.project.create') }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def name\n 'Project'\n end"
] |
[
"0.82168484",
"0.7927701",
"0.777378",
"0.7650788",
"0.75814563",
"0.7567293",
"0.7528929",
"0.7468335",
"0.74408036",
"0.73494047",
"0.72913575",
"0.72911626",
"0.7288899",
"0.72506505",
"0.7239542",
"0.72060895",
"0.71818537",
"0.71660745",
"0.7132836",
"0.70833194",
"0.7078763",
"0.69887596",
"0.6961032",
"0.69456095",
"0.6914714",
"0.6910429",
"0.6909472",
"0.68862814",
"0.68826944",
"0.6874356",
"0.68703187",
"0.6865627",
"0.68507713",
"0.6844642",
"0.6830172",
"0.68021315",
"0.67955863",
"0.67813003",
"0.6778546",
"0.67486787",
"0.6732685",
"0.6719444",
"0.67142695",
"0.67013276",
"0.6697466",
"0.6685142",
"0.66740453",
"0.66625726",
"0.6643371",
"0.6642902",
"0.66407055",
"0.6638506",
"0.66367185",
"0.660716",
"0.66041356",
"0.6602276",
"0.65976936",
"0.65702295",
"0.6565127",
"0.6564705",
"0.6554293",
"0.65425247",
"0.65392804",
"0.6527607",
"0.6520773",
"0.65125734",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6510834",
"0.6502902",
"0.64881176",
"0.6483074",
"0.6482574",
"0.6467736",
"0.6466263",
"0.6461985",
"0.6461563",
"0.6456761",
"0.6449062",
"0.64455146",
"0.6444941",
"0.64403456",
"0.64286834",
"0.6427144",
"0.6420329",
"0.6416028",
"0.6412174",
"0.6409193",
"0.6408523",
"0.6403986",
"0.64021415"
] |
0.8602962
|
0
|
projects:register PROJECTNAME Used when you want to start a new Mortar project using your existing code in the current directory. embedded Register code that is not its own git repo as a Mortar project. Your code will still be synced with a git repo in the cloud. public Register a public project, which can be viewed and forked by anyone.
|
def register
name = shift_argument
unless name
error("Usage: mortar projects:register PROJECT\nMust specify PROJECT.")
end
validate_arguments!
ask_public(options[:public])
#nil is non existant project_id because it hasn't been posted yet
register_do(name, options[:public], options[:embedded], nil)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def register_do(name, is_public, is_embedded, project_id)\n if is_embedded\n validate_project_structure()\n\n register_project(name, is_public, project_id) do |project_result|\n initialize_embedded_project(project_result)\n end\n else\n unless git.has_dot_git?\n # check if we're in the parent directory\n if File.exists? name\n error(\"mortar projects:register must be run from within the project directory.\\nPlease \\\"cd #{name}\\\" and rerun this command.\")\n else\n error(\"No git repository found in the current directory.\\nTo register a project that is not its own git repository, use the --embedded option.\\nIf you do want this project to be its own git repository, please initialize git in this directory, and then rerun the register command.\\nTo initialize your project in git, use:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\")\n end\n end\n\n\n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not register a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not register a new project inside of an existing mortar project.\")\n end\n end\n\n register_project(name, is_public, project_id) do |project_result|\n git.remote_add(\"mortar\", project_result['git_url'])\n git.push_master\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end\n end\n end",
"def register_project(project, dictionary, version, locale, syn_list)\n select_project.select project\n edit_project.click\n add_icon.click\n select_dictionary_name.click\n select_from_dropdown(:dictionary_name, dictionary)\n select_dictionary_version.click\n select_from_dropdown(:version, version)\n select_locale.click\n select_from_dropdown(:locale, locale)\n select_syn_list.click\n select_from_dropdown(:synonym_list, syn_list)\n save_dictionary.click\n sleep 10\n save_and_send_to_source.click\n send_ok.click\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name)\n project_id = register_api_call(name,is_public) \n Mortar::Command::run(\"generate:project\", [name])\n FileUtils.cd(name)\n is_embedded = false\n if options[:embedded]\n is_embedded = true\n register_do(name, is_public, is_embedded, project_id)\n else\n git.git_init\n git.git(\"add .\")\n git.git(\"commit -m \\\"Mortar project scaffolding\\\"\") \n register_do(name, is_public, is_embedded, project_id)\n display \"NOTE: You'll need to change to the new directory to use your project:\\n cd #{name}\\n\\n\"\n end\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n \n unless git.has_dot_git?\n error(\"Can only create a mortar project for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n \n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not create a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not create a new project inside of an existing mortar project.\")\n end\n end\n \n project_id = nil\n action(\"Sending request to create project: #{name}\") do\n project_id = api.post_project(name).body[\"project_id\"]\n end\n \n project_result = nil\n project_status = nil\n display\n ticking(polling_interval) do |ticks|\n project_result = api.get_project(project_id).body\n project_status = project_result.fetch(\"status_code\", project_result[\"status\"])\n project_description = project_result.fetch(\"status_description\", project_status)\n is_finished = Mortar::API::Projects::STATUSES_COMPLETE.include?(project_status)\n\n redisplay(\"Status: %s %s\" % [\n project_description + (is_finished ? \"\" : \"...\"),\n is_finished ? \" \" : spinner(ticks)],\n is_finished) # only display newline on last message\n if is_finished\n display\n break\n end\n end\n \n case project_status\n when Mortar::API::Projects::STATUS_FAILED\n error(\"Project creation failed.\\nError message: #{project_result['error_message']}\")\n when Mortar::API::Projects::STATUS_ACTIVE\n git.remote_add(\"mortar\", project_result['git_url'])\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n else\n raise RuntimeError, \"Unknown project status: #{project_status} for project_id: #{project_id}\"\n end\n \n end",
"def register o\n @projects << o\n o.on_change { write } \n end",
"def project; end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def project\n end",
"def set_project\n\n end",
"def set_project\n\n end",
"def create_project(name, type)\nend",
"def projects ; end",
"def projects\n resource 'projects'\n end",
"def register user_name, project_name\n unless @client.project.member? user_name, project_name\n @client.role.create user_name\n @client.role.create user_name, project_name\n @client.project.add_member user_name, project_name\n end\n end",
"def backend_addProject(param) \n @Projects.push(param) \n end",
"def define_subproject(name, params = {}, &block)\n\t\t\t@project.define_subproject(name, params, @current_context, block)\n\t\tend",
"def set_remote\n project_name = shift_argument\n\n unless project_name\n error(\"Usage: mortar projects:set_remote PROJECT\\nMust specify PROJECT.\")\n end\n\n unless options[:embedded]\n unless git.has_dot_git?\n error(\"Can only set the remote for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n\n if git.remotes(git_organization).include?(\"mortar\")\n display(\"The remote has already been set for project: #{project_name}\")\n return\n end\n end\n\n projects = api.get_projects().body[\"projects\"]\n project = projects.find { |p| p['name'] == project_name}\n unless project\n error(\"No project named: #{project_name} exists. You can create this project using:\\n\\n mortar projects:create\")\n end\n\n if options[:embedded]\n File.open(\".mortar-project-remote\", \"w\") do |f|\n f.puts project[\"git_url\"]\n end\n git.sync_embedded_project(project, embedded_project_user_branch, git_organization)\n else\n git.remote_add(\"mortar\", project[\"git_url\"])\n end\n\n display(\"Successfully added the mortar remote to the #{project_name} project\")\n\n end",
"def new_project(name)\n path = File.expand_path(name)\n if Dir.exist?(path)\n say \"#{path} already exists. Please choose a directory name that doesn't already exist.\".red\n exit\n end\n\n @gz_info = new_global_zone\n @gz_info.serialize(path)\n\n say \"You have now configured your SmartOS virtual infrastructure. Inspect it, then run \"\\\n \"'smartos up' to build it!\".green\n end",
"def new_custom_project \n begin\n tree = eval(params[:tree])\n params[:package] = tree\n result = MavensMate.new_project(params)\n return if result.nil?\n kill_server unless ! result[:is_success] \n MavensMate.close_all_html_windows unless ! result[:is_success]\n render \"_project_new_result\", :locals => { :message => result[:error_message], :success => result[:is_success] }\n rescue Exception => e\n TextMate::UI.alert(:warning, \"MavensMate\", e.message)\n end\n end",
"def register\n end",
"def register\n end",
"def register\n end",
"def setup_projects\n # noop\n end",
"def set_remote\n project_name = shift_argument\n\n unless project_name\n error(\"Usage: mortar projects:set_remote PROJECT\\nMust specify PROJECT.\")\n end\n\n unless git.has_dot_git?\n error(\"Can only set the remote for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n\n if git.remotes(git_organization).include?(\"mortar\")\n display(\"The remote has already been set for project: #{project_name}\")\n return\n end\n\n projects = api.get_projects().body[\"projects\"]\n project = projects.find { |p| p['name'] == project_name}\n unless project\n error(\"No project named: #{project_name} exists. You can create this project using:\\n\\n mortar projects:create\")\n end\n\n git.remote_add(\"mortar\", project['git_url'])\n display(\"Successfully added the mortar remote to the #{project_name} project\")\n\n end",
"def new_project(name:, component:, url_base:, branch:)\n # puts \"new_project(#{name}, #{component}, #{url_base})\"\n Project.new(name, component, url_base, branch: branch)\n end",
"def register\n end",
"def name\n 'Project'\n end",
"def new\r\n # This can and probably SHOULD be replaced with some URL rewrite magic\r\n # now that the project loader is Redmine project based.\r\n find_project()\r\n end",
"def create_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"createproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def create_project(project)\n create_or_update(project, nil, 'project', 'projects')\n end",
"def createProject(description) \n project = Project.new \n project.Description = description \n @Projects.push(project) \n end",
"def add_project(name)\n @tasks[name] = []\n end",
"def initialize\n @projects = [\n ReleaseTools::Project::GitlabEe,\n ReleaseTools::Project::GitlabCe,\n ReleaseTools::Project::OmnibusGitlab,\n ReleaseTools::Project::Gitaly,\n ReleaseTools::Project::HelmGitlab\n ]\n end",
"def project(project_id)\n resource \"projects/#{project_id}\"\n end",
"def create(project_name, repo_name, description) ; end",
"def register\n\n\tend",
"def create_valid_project\n create_project_with 'Some test project'\n end",
"def generate_project!(attributes={})\n identifier = \"a\" + Redmine::Utils.random_hex(6)\n Project.generate!(\n {\n :identifier => identifier,\n :name => identifier,\n :tracker_ids => [],\n :enabled_module_names => []\n }.merge(attributes)\n )\n end",
"def create_projects\n projects = []\n config.projects.each do |project|\n projects << Project.new(project)\n end\n projects\nend",
"def register\n \n end",
"def fork\n git_url = shift_argument\n name = shift_argument\n unless git_url and name\n error(\"Usage: mortar projects:fork GIT_URL PROJECT\\nMust specify GIT_URL and PROJECT.\")\n end\n validate_arguments!\n validate_project_name(name)\n\n if git.has_dot_git?\n begin\n error(\"Currently in git repo. You can not fork a new project inside of an existing git repository.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in git repo. You can not fork a new project inside of an existing git repository.\")\n end\n end\n is_public = options[:public]\n ask_public(is_public)\n git.clone(git_url, name, git.fork_base_remote_name)\n Dir.chdir(name)\n # register a nil project id because it hasn't been created yet\n register_project(name, is_public, nil) do |project_result|\n git.remote_add(\"mortar\", project_result['git_url'])\n git.push_master\n # We want the default remote to be the Mortar managed repo.\n git.git(\"fetch --all\")\n git.set_upstream('mortar/master')\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end\n end",
"def add_project(project)\n login unless authenticated?\n existing_project = find_project(project['name'])\n return existing_project if existing_project\n MaestroJenkinsExporter.sanitize_project(project)\n begin\n project = JSON.parse(RestClient.post(resource_url('projects'), {:projectName => project['name'], :projectDescription => project['description']}, :cookies => @cookies).body)\n rescue RestClient::Conflict => e\n logger.error(\"Unable to add project '#{project['name']}': #{e.response}\")\n raise e\n end\n logger.info(\"Added project: #{project['name']}\")\n project\n end",
"def create_project(params)\n elektron_identity.post(\"projects\") { { project: params } }.body[\n \"project\"\n ]\n end",
"def register\r\n \r\n end",
"def create_project(name, outputter, modules: nil)\n Bolt::ProjectManager.new(config, outputter, pal)\n .create(Dir.pwd, name, modules)\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def project\n request :project\n end",
"def allow_project\n name = params[:nameproject]\n @project = Project.find_project(@user.id, @space.id, name).take || not_found\n\n # parser token\n @parse_token = Project.token\n end",
"def project_new\n new_project.click\n end",
"def add\n # for volunteer to sign up for a project\n # if volunteer signs up, a message or notification gets sent to the administrator\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def new\n @project = Project.new()\n end",
"def new_project_unit\n end",
"def add_project(name)\n load_attributes\n\n # Add project name and date it has been added\n @attributes['projects'] << {:name => name, :date => \"#{Time.now}\"}\n save\n end",
"def init_project(*args)\n # anything to do?\n end",
"def project_hook(project)\n # STUB\n end",
"def change_project(name)\n update!(name: name)\n end",
"def project(name)\n Ow2mirror::Project.new(self, name)\n end",
"def project(name)\n @projects.find { |p| p.name == name }\n end",
"def create(project_name)\n\t\tnew_branch_name = branch_generator(project_name)\n\t\tif project_name.nil?\n\t\t\tputs \"Missing project name!\"\n\t\telse\n\n\t\t\texec(\"\n\t\t\tmkdir #{@@default_directory}#{project_name.to_s} &&\n\t\t\tcd #{@@default_directory}#{project_name.to_s} &&\n\t\t\tgit init &&\n\t\t\tgit checkout -b master &&\n\t\t\tgit commit --allow-empty -m 'first commit' &&\n\t\t\tgit tag -a v0.0 -m 'first tag' &&\n\t\t\tgit checkout -b #{new_branch_name}\n\t\t\t\")\n\n\t\t\tsystem(\"cd #{@@default_directory}#{project_name.to_s}\")\n\t\t\tsave(project_name)\n\t\tend\n\tend",
"def new\n add_breadcrumb \"Nouveau\"\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def create_project(name)\n response = @db.exec_params(%Q[\n INSERT INTO projects(name)\n VALUES ($1)\n RETURNING id;\n ], [name])\n\n response.first[\"id\"]\n end",
"def getProject(projectName)\n data = CLIENT.repository(projectName)\n return data\nend",
"def git_project()\n \"\"\nend",
"def projects\n config[:projects]\n end",
"def project_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/projects.json\",\n body: project_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end",
"def add_repository(name)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects add-project #{name}.git\")\n end",
"def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"def push!\n notify.write(\"Pushing to origin\")\n proj.push('origin', proj_branch)\n proj.push('origin', report_branch)\n end",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n \t@project = Project.new(params[:project])\n @project.date_added = Time.now.year \n \trespond_to do |format|\n \t\tif project = @project.save\n \t\tformat.html { redirect_to admin_path, notice: 'Project was successfully updated.' }\n \t\tformat.json { render json: @project, status: :created, location: @project }\n \t\telse\n \t\tformat.html { render action: \"new\" }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n \tend",
"def create\n @project = Project.new(project_params)\n\n if is_organization_admin? and @project.save\n @project.team_members.create(user_id: @project.organization.owner_id)\n render json: {\n name: @project.name,\n organization: @project.organization.name,\n url: project_dashboard_path(@project.id)\n }\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def new\n @project = Project.new\n @title = \"New Project\"\n end",
"def create_git_project\n GemBootstrap::GitUtils.create_git_project(File.expand_path(name), name)\n end",
"def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create_village_project\n iframe_src = \"<iframe src='\" + root_url.sub(/\\/$/, '') + embed_project_path(@project) + \"' width='575' height='485'></iframe><p>This project created with <b><a href='\" + root_url + \"'>#{ENV[\"APP_NAME\"]}</a></b> and updated on \" + @project.updated_at.strftime(\"%A, %B %-d at %-I:%M %p\") +\"</p>\"\n iframe_src = iframe_src.html_safe.to_str\n village_user_ids = @project.village_user_ids\n response = access_token.post(\"/api/projects\", params: {project: {name: @project.title, project_type_id: 15, source: \"original\", description: iframe_src, thumbnail_file_id: 769508, user_ids: village_user_ids} })\n village_project_id = response.parsed[\"project\"][\"id\"]\n @project.update_attributes(:village_id => village_project_id)\n end",
"def init(name, platforms, type)\n\n # Create environment\n git_init(name)\n config(name, platforms)\n create_file_structure(name)\n\n # Create xcodeproj\n project = new_project(name)\n configure_PBXGroups(project, name)\n\n create_info_plists(name, type, platforms)\n add_info_plist_refs(project, name)\n configure_targets(project, name, type, platforms)\n configure_header(project, name, platforms)\n configure_schemes(project, name, platforms)\n configure_build_configuration_settings(project, name, platforms)\n\n # Save xcodeproj\n project.save\nend",
"def project_create(project_name)\n # Make sure that proper values where provided\n spool_path = ::File.join(Msf::Config.log_directory, 'projects', project_name)\n ::FileUtils.mkdir_p(spool_path)\n spool_file = ::File.join(spool_path, \"#{project_name}_spool.log\")\n if framework.db and framework.db.active\n print_line(\"Creating DB Workspace named #{project_name}\")\n workspace = framework.db.add_workspace(project_name)\n framework.db.workspace = workspace\n print_line(\"Added workspace: #{workspace.name}\")\n driver.init_ui(driver.input, Rex::Ui::Text::Output::Tee.new(spool_file))\n\n # Restore the prompt so we don't get \"msf > >\".\n #prompt = framework.datastore['Prompt'] || Msf::Ui::Console::Driver::DefaultPrompt\n #prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar\n #if active_module # if there is an active module, give them the fanciness they have come to expect\n # driver.update_prompt(\"#{prompt} #{mod.type}(%bld%red#{mod.shortname}%clr) \", prompt_char, true)\n #else\n # driver.update_prompt(\"#{prompt} \", prompt_char, true)\n #end\n\n print_line(\"Spooling to file #{spool_file}...\")\n else\n print_error('A database most be configured and connected to create a project')\n end\n return true\n end",
"def create\n if request.post? and params[:project]\n project = Project.new(params[:project])\n project.owner = @user.id\n project.save\n\n sprint = project.sprints.build\n sprint.name = \"Backlog\"\n sprint.status_id = 0\n sprint.created_by = @user.id\n sprint.save\n\n task = project.tasks.build\n task.name = \"General\"\n task.description = \"General Work\"\n task.type_id = 0\n task.sprint_id = sprint.id\n task.created_by = @user.id\n task.assigned_to = @user.id\n task.save\n\n flash[:message] = \"Project '#{project.name}' has been registered.\"\n else\n flash[:error] = \"No project data provided.\"\n end\n\n redirect_to :action => 'index'\n end",
"def create_project\n unless options.force\n abort \"'#{project}' already exists\" if File.exist?( project ) \n end\n\n # copy over files from the master project data diretory in crate\n files = project_files\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each do |file|\n cp file \n end\n end\n end",
"def project_exists?(name)\n projects.include?(name)\n end",
"def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def project\n raw = client.get project_url\n client.factory.create(GoodData::Project, raw)\n end",
"def create\n @project = current_user.projects.build(params[:project])\n if @project.save\n flash[:success] = \"Project was successfully created.\"\n redirect_to root_path\n else\n flash[:error] = \"Failed to make project.\"\n render 'new'\n end\n end",
"def project(*names)\n new(names.map { |name| name.is_a?(Symbol) ? self[name] : name })\n end",
"def define_project_name_and_id(git_service, user_token)\n puts \"\\nPlease enter the name of the current project :\"\n puts '----------------------------------------------'\n\n begin\n input = STDIN.gets.chomp\n exit! if input == 'quit'\n\n url = \"#{git_service.routes[:search_projects]}#{input}\"\n\n response = get(url: url, headers: { git_service.token_header => user_token })\n\n if response[:status] == '200' && !response[:body].empty?\n puts \"\\nFound #{response[:body].count} match(es):\"\n response[:body].each_with_index do |project, index|\n puts \"#{index + 1} - #{project['name_with_namespace']}\"\n end\n\n puts \"\\nPlease insert the number of the current project :\"\n puts '-------------------------------------------------'\n input = validate_choice(response[:body])\n {\n project_slug: response[:body][input - 1]['path_with_namespace'],\n project_id: response[:body][input - 1]['id']\n }\n\n else\n puts \"\\nOops, we couldn't find a project called #{input}. Try again or quit (quit) :\"\n puts '-------------------------------------------------------------------' + ('-' * input.length) # Don't be upset, i'm a perfectionist <3\n define_project_name_and_id(git_service, user_token)\n end\n rescue Interrupt\n exit!\n end\n end"
] |
[
"0.78097445",
"0.66672343",
"0.6485799",
"0.6364393",
"0.6080523",
"0.6046141",
"0.6040116",
"0.601036",
"0.5999332",
"0.5999332",
"0.59859055",
"0.59563434",
"0.59516287",
"0.59289443",
"0.58608466",
"0.58344203",
"0.5823962",
"0.57886815",
"0.57801175",
"0.5723978",
"0.5723978",
"0.5723978",
"0.57100046",
"0.56967527",
"0.5691373",
"0.5691253",
"0.56832623",
"0.5660021",
"0.5646262",
"0.56434435",
"0.5639695",
"0.56303567",
"0.56239057",
"0.56189066",
"0.56167036",
"0.56038487",
"0.56005",
"0.554428",
"0.5543516",
"0.5542809",
"0.5514363",
"0.54914373",
"0.548642",
"0.5484564",
"0.54776156",
"0.5468772",
"0.54679775",
"0.5461201",
"0.54489607",
"0.5433626",
"0.54250014",
"0.54219085",
"0.5418256",
"0.53951657",
"0.5387796",
"0.53818977",
"0.5381254",
"0.5365651",
"0.5361667",
"0.53576124",
"0.5345623",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53214175",
"0.53161716",
"0.5310621",
"0.53016514",
"0.52999836",
"0.5296621",
"0.52875215",
"0.52844787",
"0.5283676",
"0.52823126",
"0.52796286",
"0.52709436",
"0.52657926",
"0.52574766",
"0.52528304",
"0.52503073",
"0.52502364",
"0.5247893",
"0.52444744",
"0.5244249",
"0.523326",
"0.5229247",
"0.5225287",
"0.521241",
"0.5207487",
"0.5206278",
"0.5201736",
"0.5201488"
] |
0.831978
|
0
|
projects:set_remote PROJECTNAME Used after you checkout code for an existing Mortar project from a nonMortar git repository. Adds a remote to your local git repository to the Mortar git repository. For example if a coworker creates a Mortar project from an internal repository you would clone the internal repository and then after cloning call mortar projects:set_remote. embedded make this a embedded project tied to the specified remote
|
def set_remote
project_name = shift_argument
unless project_name
error("Usage: mortar projects:set_remote PROJECT\nMust specify PROJECT.")
end
unless options[:embedded]
unless git.has_dot_git?
error("Can only set the remote for an existing git project. Please run:\n\ngit init\ngit add .\ngit commit -a -m \"first commit\"\n\nto initialize your project in git.")
end
if git.remotes(git_organization).include?("mortar")
display("The remote has already been set for project: #{project_name}")
return
end
end
projects = api.get_projects().body["projects"]
project = projects.find { |p| p['name'] == project_name}
unless project
error("No project named: #{project_name} exists. You can create this project using:\n\n mortar projects:create")
end
if options[:embedded]
File.open(".mortar-project-remote", "w") do |f|
f.puts project["git_url"]
end
git.sync_embedded_project(project, embedded_project_user_branch, git_organization)
else
git.remote_add("mortar", project["git_url"])
end
display("Successfully added the mortar remote to the #{project_name} project")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_remote\n project_name = shift_argument\n\n unless project_name\n error(\"Usage: mortar projects:set_remote PROJECT\\nMust specify PROJECT.\")\n end\n\n unless git.has_dot_git?\n error(\"Can only set the remote for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n\n if git.remotes(git_organization).include?(\"mortar\")\n display(\"The remote has already been set for project: #{project_name}\")\n return\n end\n\n projects = api.get_projects().body[\"projects\"]\n project = projects.find { |p| p['name'] == project_name}\n unless project\n error(\"No project named: #{project_name} exists. You can create this project using:\\n\\n mortar projects:create\")\n end\n\n git.remote_add(\"mortar\", project['git_url'])\n display(\"Successfully added the mortar remote to the #{project_name} project\")\n\n end",
"def set_remote\n return if @remote_type == :none\n\n url = \"git@github.com:pixelastic/#{@name}.git\" if @remote_type == :github\n if @remote_type == :bitbucket\n url = \"git@bitbucket.org:pixelastic/#{@name}.git\"\n end\n\n if create_remote('origin', url)\n puts '✔ Configuring remote'\n else\n puts '✘ Failed to configure remote'\n exit 1\n end\n end",
"def add_remote(name, url, opts = {})\n url = url.repo.path if url.is_a?(Git::Base)\n self.lib.remote_add(name, url, opts)\n Git::Remote.new(self, name)\n end",
"def add_remote(name, url)\n remotes.create name, url\n end",
"def add_remote(uri, name)\n @repository.add_remote(name,uri)\n \n self.remotes\n end",
"def push(remote)\n namehost, folder, _barefolder = split_url(remote.name)\n puts 'simple_push'\n simple_push(remote('origin'))\n puts 'bare_repo.push'\n bare_repo.push(remote)\n try_system %[ssh #{namehost} \"cd #{folder} && git pull origin\"]\n end",
"def create_remote_repo\n `git init --bare #{REMOTE_PATH}/#{@name}.git`\n\n # Connect local repository to remote and push local master branch to remote.\n Dir.chdir(\"#{LOCAL_PATH}/#{@name}\") do\n `git remote add #{UPSTREAM_NAME} #{REMOTE_PATH}/#{@name}.git && git push -u #{UPSTREAM_NAME} master`\n end\n end",
"def set_remote_url(name, url)\n url = url.repo.path if url.is_a?(Git::Base)\n self.lib.remote_set_url(name, url)\n Git::Remote.new(self, name)\n end",
"def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end",
"def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end",
"def git_push(remote = 'origin')\n mysystem(\"git push --set-upstream #{remote} #{git_current_branch}\")\n end",
"def remote(remote_name = 'origin')\n Git::Remote.new(self, remote_name)\n end",
"def git_push(*remotes)\n remotes.each do |remote|\n git(:push => \"#{remote} master\")\n end\n end",
"def git_remote\n repos = begin\n %x{git remote --verbose 2>/dev/null}.split(\"\\n\").map(&:split).map {|x| [x[0],x[1]] }.uniq\n rescue\n []\n end\n default = repos.find { |x| x.first == 'origin'}\n items = repos.map { |x| x.last }\n\n menu_with_default \"Select repository \", items.compact, default\n end",
"def push_to_remote(local_branch, remote_branch, remote_name, opts)\n remote_name ||= 'origin'\n\n args = [remote_name]\n\n local_branch ||= branches.current\n remote_branch ||= local_branch\n args << '-f' if opts[:force]\n\n logger.info do\n if local_branch == remote_branch\n \"Pushing to '#{remote_branch}' on '#{remote_name}'.\"\n else\n \"Pushing #{local_branch} to '#{remote_branch}' on '#{remote_name}'.\"\n end\n end\n\n args << \"#{local_branch}:#{remote_branch}\"\n return command(:push, args)\n end",
"def push!(local)\n if remote_id = local.remote_id(project.id)\n type = local.is_a?(Milestone) ? 'Milestone' : local.class.name\n remote = lighthouse.send type.downcase, remote_id\n remote.update_attributes! local.attributes\n else\n remote = lighthouse.from_local(local)\n if remote.save\n local.update_attributes :remote_id => remote.id\n else\n # TODO raise remote.errors\n end\n end\n end",
"def set_fake_remote\n Git::Run.under_root_dir do\n Dir.mkdir test_repo_url unless Dir.exists? test_repo_url\n `git init --bare #{test_repo_url}`\n `git remote add test #{test_repo_url}`\n end\n end",
"def push(repo)\n before_push(repo)\n\n repo.cmd \"git remote add #{name} #{clone_url(repo)}\"\n repo.cmd \"git push --all #{name}\"\n after_push(repo)\n end",
"def set_remote(args)\n remote = `#{Templates.check_remote(args)}`\n if (remote.empty?)\n `#{Templates.add_remote(args)}`\n end\n end",
"def add_remoteurl(dir)\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n remoteURL = @parse_json_config['deploy']['github']['config']['remoteURL']\n remoteVerify = `sed -n '/url/p' #{dir}/.git/config | cut -d'=' -f2 | cut -d' ' -f2`\n if remoteVerify.nil? || remoteVerify.empty?\n system_commands(\"cd #{dir}; git remote add origin #{remoteURL}\")\n end\n end",
"def fork\n git_url = shift_argument\n name = shift_argument\n unless git_url and name\n error(\"Usage: mortar projects:fork GIT_URL PROJECT\\nMust specify GIT_URL and PROJECT.\")\n end\n validate_arguments!\n validate_project_name(name)\n\n if git.has_dot_git?\n begin\n error(\"Currently in git repo. You can not fork a new project inside of an existing git repository.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in git repo. You can not fork a new project inside of an existing git repository.\")\n end\n end\n is_public = options[:public]\n ask_public(is_public)\n git.clone(git_url, name, git.fork_base_remote_name)\n Dir.chdir(name)\n # register a nil project id because it hasn't been created yet\n register_project(name, is_public, nil) do |project_result|\n git.remote_add(\"mortar\", project_result['git_url'])\n git.push_master\n # We want the default remote to be the Mortar managed repo.\n git.git(\"fetch --all\")\n git.set_upstream('mortar/master')\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end\n end",
"def set_push_origin_url push_origin_url\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_loggable_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} remote set-url --push origin\"\n git_set_push_origin_url_cmd = \"#{git_loggable_cmd} #{push_origin_url}\"\n log.info(x) { \"[git] set push origin url command without url => #{git_loggable_cmd}\" }\n %x[#{git_set_push_origin_url_cmd}];\n log.info(x) { \"[git] has set the remote origin url for pushing.\" }\n\n end",
"def pushToGitRemotes(branch = 'develop', force = 0)\n if force\n force = \"-f\"\n else\n force = \"\"\n end\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pushing #{branch} to remote: #{branch}\\\"\")\n sh(\"git push #{force} #{remote} #{branch}\")\n end\nend",
"def push(options={})\n raise MissingRemote unless has_remotes?\n options.merge! :remote => DEFAULT_REMOTE, :ref => DEFAULT_LOCAL_REF\n remotes[options[:remote]].push([options[:ref]], {:credentials => credentials})\n end",
"def initial_push_command\n \"git remote add origin git@github.com:#{owner.login}/#{name}.git &&\\n\" +\n \"git push origin master &&\\n\" +\n \"git config --add branch.master.remote origin &&\\n\" +\n \"git config --add branch.master.merge refs/heads/master\" \n end",
"def git_remote_add(remote_name, remote_url)\n cmd = \"#{discover_git_executable} remote add upstream \\\"#{remote_url}\\\"\"\n debug \"Running #{cmd} 2>&1\"\n output = %x[#{cmd} 2>&1]\n raise RHC::GitException, \"Error while adding upstream remote - #{output}\" unless output.empty?\n end",
"def push_to_repo\n return if @remote_type == :none\n\n if @remote_type == :bitbucket\n puts 'Cannot automatically create BitBucket repository.'\n puts 'Please, open it manually at https://bitbucket.org/repo/create'\n `#{ENV['BROWSER']} https://bitbucket.org/repo/create`\n return\n end\n\n return unless %i[github].include?(@remote_type)\n\n gh_options = [\n @name,\n ]\n gh_options << '--team algolia' if @is_algolia\n\n if @is_private\n gh_options << '--private'\n else\n gh_options << '--public'\n end\n\n command = \"gh repo create #{gh_options.join(' ')}\"\n\n if command_success?(command)\n puts '✔ Creating GitHub repository'\n else\n puts '✘ Failed to create GitHub repository'\n exit 1\n end\n\n if command_success?('git push origin main')\n puts '✔ Pushed to repository'\n else\n puts '✘ Failed to push to repository'\n exit 1\n end\n end",
"def pull(remote)\n namehost, folder, _barefolder = split_url(remote.name)\n try_system %[ssh #{namehost} \"cd #{folder} && git push origin\"]\n Dir.chdir(bare_repo.repo.to_s) do\n try_system(\"git fetch #{remote.name} master:master\")\n end\n #bare_repo.fetch(remote)\n simple_pull(remote('origin'))\n end",
"def push(name, internal_repository)\n ensure_remote(name, internal_repository)\n\n git = git(name)\n branch = git.current_branch\n\n git.config \\\n \"remote.#{REMOTE}.push\",\n \"refs/heads/#{branch}:refs/heads/#{branch}\"\n\n git.push(REMOTE, branch)\n end",
"def clone\n\t\t did_clone = system \"git clone #{remote_path} projects/#{name}\"\n\t\t\tsystem \"cd projects/#{name} && git pull origin\" if !did_clone\n\t\tend",
"def push!\n notify.write(\"Pushing to origin\")\n proj.push('origin', proj_branch)\n proj.push('origin', report_branch)\n end",
"def git_push(host, branch, git_repo_path)\n git_on(host, \"push origin #{branch}\", git_repo_path)\nend",
"def remote=(remote)\n super\n\n @sets.each {|set| set.remote = remote }\n end",
"def add_repository(name)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects add-project #{name}.git\")\n end",
"def create_remote_tag tag_name\n in_secondary_repository do\n create_local_tag tag_name\n run 'git push --tags'\n end\nend",
"def update_remote(remote, remote_name='origin')\n if @_rugged_repo\n logger.debug2(_(\"Remote URL is different from cache, updating %{orig} to %{update}\") % {orig: remotes[remote_name], update: remote})\n @_rugged_repo.remotes.set_url(remote_name, remote)\n end\n end",
"def remote\n grit.config[\"branch.#{branch}.remote\"] || 'origin'\n end",
"def update_remote(path, git_remote)\n updated = false\n\n Dir.chdir(path) do\n @logger.debug(\"update git remote urls for #{path}\")\n\n git_remote.each do |remote_name, remote_url|\n stdout, _stderr, _status = Open3.capture3(\"git remote get-url #{remote_name}\")\n\n current_remote_url = stdout.strip\n\n next if remote_url.nil? || current_remote_url == remote_url\n\n `git remote remove #{remote_name}` unless current_remote_url.empty?\n\n `git remote add #{remote_name} #{remote_url}`\n\n updated = true\n end\n end\n\n updated\n end",
"def remote\n remote_name = self.remote_name\n @owner.remotes[remote_name] if remote_name\n end",
"def update\n Repository.new(self).add_git_remote\n Hook.new(self).setup\n end",
"def register_do(name, is_public, is_embedded, project_id)\n if is_embedded\n validate_project_structure()\n\n register_project(name, is_public, project_id) do |project_result|\n initialize_embedded_project(project_result)\n end\n else\n unless git.has_dot_git?\n # check if we're in the parent directory\n if File.exists? name\n error(\"mortar projects:register must be run from within the project directory.\\nPlease \\\"cd #{name}\\\" and rerun this command.\")\n else\n error(\"No git repository found in the current directory.\\nTo register a project that is not its own git repository, use the --embedded option.\\nIf you do want this project to be its own git repository, please initialize git in this directory, and then rerun the register command.\\nTo initialize your project in git, use:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\")\n end\n end\n\n\n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not register a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not register a new project inside of an existing mortar project.\")\n end\n end\n\n register_project(name, is_public, project_id) do |project_result|\n git.remote_add(\"mortar\", project_result['git_url'])\n git.push_master\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end\n end\n end",
"def create_remote_mirror(project, url, options = {})\n post(\"/projects/#{url_encode project}/remote_mirrors\", body: options.merge(url: url))\n end",
"def setup_remote(args)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n formatter = Printer.new(@config).build_formatter\n formatter.print_header\n\n # Get $HOME/.watsonrc to check for remotes\n _home_conf = Watson::Config.home_conf\n\n print BOLD + \"Existing Remotes:\\n\" + RESET\n\n # Check the config for any remote entries (GitHub or Bitbucket) and print\n # We *should* always have a repo + API together, but API should be enough\n if _home_conf.github_api.empty? && @config.bitbucket_api.empty? && @config.asana_api.empty?\n formatter.print_status \"!\", YELLOW\n print BOLD + \"No remotes currently exist\\n\\n\" + RESET\n end\n\n unless _home_conf.github_api.empty?\n print BOLD + \"- GitHub APIs -\\n\" + RESET\n _home_conf.github_api.each_with_index do |_api, _i|\n print BOLD + \"#{_i+1}. #{_api[0]}\" + RESET + \" : #{_api[1]}\\n\"\n end\n print \"\\n\\n\"\n end\n\n unless @config.github_repo.empty?\n print BOLD + \"GitHub Repo : \" + RESET + \"#{ @config.github_repo }\\n\\n\"\n end\n\n\n if !@config.bitbucket_api.empty?\n print BOLD + \"Bitbucket User : \" + RESET + \"#{ @config.bitbucket_api }\\n\" + RESET\n print BOLD + \"Bitbucket Repo : \" + RESET + \"#{ @config.bitbucket_repo }\\n\\n\" + RESET\n end\n\n if !@config.gitlab_api.empty?\n print BOLD + \"GitLab User : \" + RESET + \"#{ @config.gitlab_api }\\n\" + RESET\n print BOLD + \"GitLab Repo : \" + RESET + \"#{ @config.gitlab_repo }\\n\\n\" + RESET\n end\n\n if !@config.asana_api.empty?\n print BOLD + \"Asana API Key : \" + RESET + \"#{ @config.asana_api }\\n\" + RESET\n print BOLD + \"Asana Workspace : \" + RESET + \"#{ @config.asana_workspace }\\n\" + RESET\n print BOLD + \"Asana Project : \" + RESET + \"#{ @config.asana_project }\\n\\n\" + RESET\n end\n\n # If github or bitbucket passed, setup\n # If just -r (0 args) do nothing and only have above printed\n # If more than 1 arg is passed, unrecognized, warn user\n if args.length == 1\n case args[0].downcase\n when \"github\"\n debug_print \"GitHub setup called from CL\\n\"\n Watson::Remote::GitHub.setup(@config)\n\n when \"bitbucket\"\n debug_print \"Bitbucket setup called from CL\\n\"\n Watson::Remote::Bitbucket.setup(@config)\n\n when \"gitlab\"\n debug_print \"GitLab setup called from CL\\n\"\n Watson::Remote::GitLab.setup(@config)\n\n when \"asana\"\n debug_print \"Asana setup called from CL\\n\"\n Watson::Remote::Asana.setup(@config)\n\n end\n elsif args.length > 1\n formatter.print_status \"x\", RED\n puts <<-SUMMERY.gsub(/^ {,8}/, '')\n #{BOLD}Incorrect arguments passed#{RESET}\n Please specify either Github or Bitbucket to setup remote\n Or pass without argument to see current remotes\n See help (-h/--help) for more details\n SUMMERY\n\n return false\n end\n end",
"def push_repo\n UI.puts \"\\nPushing the `#{@repo}' repo\\n\".yellow\n repo_git('push', 'origin', 'HEAD')\n end",
"def push_add_changegroup(remote, opts={})\n # no locking cuz we rockz\n ret = pre_push remote, opts\n \n if ret[0]\n cg, remote_heads = *ret\n remote.add_changegroup cg, :push, url\n else\n ret[1]\n end\n end",
"def establish_remote_server(remote)\n fail \"establish_remote_server called with remote established\" if @remote\n m, host, port = *remote.match(/^(.+):(.+)$/)\n @remote = [host, port]\n connect_to_server\n end",
"def push_to_remote!\n\n if @primary_image_tag.nil?\n raise \"Primary image tag not set\"\n end\n\n if @remote_repository.nil?\n raise \"Remote repository not set\"\n end\n\n if @local_repository.nil?\n raise \"Local repository not set\"\n end\n\n if @local_image_id.nil?\n raise \"Local image ID not set\"\n end\n\n if !@tagged_for_remote\n raise \"Image not yet tagged for remote repository\"\n end\n\n # Assumption: local repository will always be the entity \"pushing\" the image - this might change, though and\n # could be refactored such that an image pusher class is needed\n\n @local_repository.push_image_to_remote(self)\n\n return self\n\n end",
"def create_standalone_remote_tag tag_name\n in_secondary_repository do\n run 'git checkout -b temp'\n run 'touch a.txt'\n run 'git add -A'\n run 'git commit -m \"temp\"'\n run \"git tag -a #{tag_name} -m '#{tag_name}'\"\n run 'git push --tags'\n end\nend",
"def remote(branch = current_branch)\n remote = git('config', '--get', \"branch.#{branch}.remote\").to_s.strip\n remote if !remote.empty? && git('remote').include?(remote)\n end",
"def remote(branch = current_branch)\n remote = git('config', '--get', \"branch.#{branch}.remote\").to_s.strip\n remote if !remote.empty? && git('remote').include?(remote)\n end",
"def push()\n\t\tbegin\n\t\t\t@git.push('origin','master')\n\t\trescue Git::GitExecuteError => e\n\t\t\tif (e.to_s.include?(\"refspec master does not match any\"))\n\t\t\t\tLogger::log(@carpeta,Logger::INFO,\"No hay cambios para subir al servidor\")\n\t\t\telse\n\t\t\t\traise UploadException, \"Error al subir los cambios al servidor\" , caller\n\t\t\tend\n\t\tend\n\tend",
"def git_pull(remote = '')\n mysystem(\"git pull #{remote}\")\n end",
"def create_repo\n Rugged::Repository.init_at(repo_path, :bare).tap do |repo|\n repo.remotes.create('origin', \"git@github.com:#{project.gh_path}\")\n repo.remotes.add_fetch_refspec('origin', GITHUB_PULLS_REFSPEC)\n end\n end",
"def set_remote_env(env); end",
"def push(remote_repo, opts={:force => false, :revs => nil})\n if remote_repo.capable? \"unbundle\"\n push_unbundle remote_repo, opts\n else\n push_add_changegroup remote_repo, opts\n end\n end",
"def remote(host=nil)\n if host then\n Rake.application.last_remote = host\n Rake.application.last_remote_with_host = host\n else\n if Rake.application.last_remote_with_host then\n Rake.application.last_remote = Rake.application.last_remote_with_host\n else\n fail ArgumentError, \"missing host\"\n end\n end\n if block_given?\n global_remote = Rake.application.options.remoteurl\n Rake.application.options.remoteurl = Rake.application.last_remote\n yield\n Rake.application.options.remoteurl = global_remote\n end\n end",
"def remotes\n @remotes ||= @project.remotes\n end",
"def new(remote)\n @repos ||= {}\n unless @repos[remote]\n obj = self.allocate\n obj.send(:initialize, remote)\n @repos[remote] = obj\n end\n @repos[remote]\n end",
"def create_remote_path!(remote_path)\n if @local\n FileUtils.mkdir_p(remote_path)\n else\n connection do |ssh|\n ssh.exec!(\"mkdir -p '#{ remote_path }'\")\n end\n end\n end",
"def push_to_server(local_branch, remote_branch, opts = {})\n if opts[:local]\n logger.debug('Not pushing to the server because the user selected local-only.')\n elsif not has_a_remote?\n logger.debug('Not pushing to the server because there is no remote.')\n elsif local_branch == config.master_branch\n logger.warn('Not pushing to the server because the current branch is the mainline branch.')\n else\n opts[:prepush].call if opts[:prepush]\n\n push(remote.name, local_branch, remote_branch, :force => opts[:force])\n\n opts[:postpush].call if opts[:postpush]\n end\n end",
"def tw_project_to_toodle(project_name)\n folder = @remote_folders.find{|f| f[:name] == project_name}\n unless folder\n folder = add_folder(project_name).first\n @remote_folders << folder\n end\n folder[:id]\n end",
"def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end",
"def remote\n unless mirrors.empty?\n info \"Remote repositories overridden by mirrors #{mirrors.map(&:to_s).join(\", \")}\"\n mirrors\n end\n unless @remote\n @remote = [Buildr.settings.user, Buildr.settings.build].inject([]) { |repos, hash|\n repos | Array(hash['repositories'] && hash['repositories']['remote'])\n }\n end\n @remote\n end",
"def clone(remote, opts = {})\n logger.debug1 { _(\"Cloning '%{remote}' into %{path}\") % {remote: remote, path: @path } }\n\n proxy = R10K::Git.get_proxy_for_remote(remote)\n # libgit2/rugged doesn't support cloning a repository and providing an\n # alternate object database, making the handling of :alternates a noop.\n # Unfortunately this means that this method can't really use alternates\n # and running the clone will duplicate all objects in the specified\n # repository. However alternate databases can be handled when an existing\n # repository is loaded, so loading a cloned repo will correctly use\n # alternate object database.\n options = {:credentials => credentials, :proxy_url => proxy}\n options.merge!(:alternates => [File.join(opts[:reference], 'objects')]) if opts[:reference]\n\n\n R10K::Git.with_proxy(proxy) do\n @_rugged_repo = ::Rugged::Repository.clone_at(remote, @path.to_s, options)\n end\n\n if opts[:reference]\n alternates << File.join(opts[:reference], 'objects')\n end\n\n if opts[:ref]\n # todo: always check out something; since we're fetching a repository we\n # won't populate the working directory.\n checkout(opts[:ref])\n end\n rescue Rugged::SshError, Rugged::NetworkError => e\n raise R10K::Git::GitError.new(e.message, :git_dir => git_dir, :backtrace => e.backtrace)\n end",
"def fetch(remote=self.remote)\n sandbox {|git,w,i| git.fetch({}, remote) }\n self\n end",
"def github_release_task\n sh git, 'push', '--tags', remote, remote_branch\n end",
"def pull(remote, options={})\n raise RuntimeError, \"Unknown remote #{remote}\" unless remote_list.include?(remote)\n\n git.fetch({}, remote)\n git.fetch({:tags => true}, remote)\n\n ref_rx = /^#{Regexp.quote(remote)}\\//\n remote_branches = Hash[remotes.map{|r| [$',r] if r.name =~ ref_rx }.compact]\n\n # FIXME: should we depend on Vendorificator::Config here?\n Vendorificator::Config.each_module do |mod|\n remote_head = remote_branches[mod.branch_name]\n ours = mod.head && mod.head.commit.sha\n theirs = remote_head && remote_head.commit.sha\n\n if remote_head\n if not mod.head\n say_status 'new', mod.branch_name, :yellow\n git.branch({:track=>true}, mod.branch_name, remote_head.name) unless options[:dry_run]\n elsif ours == theirs\n say_status 'unchanged', mod.branch_name\n elsif fast_forwardable?(theirs, ours)\n say_status 'updated', mod.name, :yellow\n unless options[:dry_run]\n mod.in_branch do\n git.merge({:ff_only => true}, remote_head.name)\n end\n end\n elsif fast_forwardable?(ours, theirs)\n say_status 'older', mod.branch_name\n else\n say_status 'complicated', mod.branch_name, :red\n indent do\n say 'Merge it yourself.'\n end\n end\n else\n say_status 'unknown', mod.branch_name\n end\n end\n\n private\n\n def conf\n Vendorificator::Config\n end\n\n def say_status(*args)\n conf[:shell].say_status(*args) if conf[:shell]\n end\n end",
"def add_master_repo\n cmd = ['master', url, 'master']\n cmd << '--shallow' if @shallow\n Repo::Add.parse(cmd).run\n end",
"def add_origin_url origin_url\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_add_origin_loggable_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} remote add origin\"\n git_add_origin_cmd = \"#{git_add_origin_loggable_cmd} #{origin_url}\"\n log.info(x) { \"[git] add origin command without url => #{git_add_origin_loggable_cmd}\" }\n %x[#{git_add_origin_cmd}];\n log.info(x) { \"[git] has added a remote origin url.\" }\n\n end",
"def upload(local, remote, options={})\n ssh.upload(local, remote, options)\n end",
"def git_clone(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend",
"def git_add_everything(host, git_repo_path)\n git_on(host, \"add #{git_repo_path}/*\", git_repo_path)\nend",
"def set_upstream(clone_path, upstream_url)\n remotes = `cd #{clone_path} && git remote -v`\n unless remotes.include?('upstream')\n puts `cd #{clone_path} && git remote add upstream #{upstream_url}`\n end\nend",
"def push(remote_store, local_branch, remote_branch)\n VCSToolkit::Utils::Sync.sync object_store, local_branch, remote_store, remote_branch\n end",
"def remote(config=@config)\n Remote.from_config(config)\n end",
"def push\n unless system(\"cd #{repo_path};git push origin #{branch}\")\n raise GitCloud::GitException.new(\"Push\")\n end\n end",
"def edit_remote_mirror(project, id, options = {})\n put(\"/projects/#{url_encode project}/remote_mirrors/#{id}\", body: options)\n end",
"def git_push_commits\n shellout(\"git push #{config[:remote]} #{config[:branch]}\")\n end",
"def fetch_origin_task\n sh git, 'fetch', remote\n end",
"def remotes\n self.lib.remotes.map { |r| Git::Remote.new(self, r) }\n end",
"def import_repository(name, url)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects import-project #{name}.git #{url}\")\n end",
"def origin_remote\n origin = git(\"remote\", \"-v\").lines.grep(/^origin\\s/).first\n origin && origin.split[1]\n end",
"def add_remote_files?(branch, add_remote_files_info)\n return if add_remote_files_info.nil?\n checkout(branch) do \n add_remote_files_info.add_files(git_repo_manager: self, branch: branch)\n end\n add_all_files_and_commit(branch: branch) if add_remote_files_info.git_add_needed?\n end",
"def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end",
"def upload(local, remote = nil, opts={})\n remote ||= File.split(local).last\n remote = expand_path remote\n ssh.scp.upload!(local, remote, opts)\n end",
"def giturl(project_name, repo_name) ; end",
"def push_image_to_remote(image)\n\n if !image.tagged_for_remote\n raise \"Image not yet tagged (use tag_for_remote function)\"\n end\n\n if image.local_image_id.nil?\n raise \"No local id set in image\"\n end\n\n if image.remote_repository.nil?\n raise \"Image has not remote repository specified\"\n end\n\n # api push command oddly fails silently - not sure what's up\n # also, api appears to give no feedback as image is uploaded - which can take some time\n\n # raw_image = self.get_raw_image_by_id(image.local_image_id)\n # https://github.com/bkeepers/dotenv\n # result = raw_image.push(nil,repo_tag: image.remote_repository.get_remote_repository_name + \":\" + image.primary_image_tag)\n # puts result.inspect\n\n\n # drop to command line and issue push via docker-cli for now\n push_command = \"docker push #{image.remote_repository.get_remote_repository_name}:#{image.primary_image_tag}\"\n system push_command\n\n if $?.exitstatus == 0\n return true\n else\n return false\n end\n\n end",
"def remote_repository\n \"http://www.aQute.biz/repo\"\n end",
"def gitorious_remote_url\n output = `git remote -v`.scan(/^#{remote}\\s+(.*).git(.*)/)\n if output\n output.first[0]\n end\n end",
"def remote\n @remote ||= Remote::Fake\n end",
"def git_clone_repo(host, git_clone_path, git_source)\n on(host, \"git clone #{git_source} #{git_clone_path}\")\nend",
"def remote=(urls)\n case urls\n when nil then @remote = nil\n when Array then @remote = urls.dup\n else @remote = [urls.to_s]\n end\n end",
"def add_remote_task(task_name)\n heroku.run_task(task_name)\n end",
"def git_commit_and_push(cookbook_path, github_url)\n if File.exists?(File.join(cookbook_path, \".git\"))\n shell_out(\"git remote rm origin\", :cwd => cookbook_path)\n else\n shell_out!(\"git init\", :cwd => cookbook_path)\n end\n shell_out!(\"echo - $(date): Uploaded with knife github plugin. >> CHANGELOG.md \", :cwd => cookbook_path)\n shell_out!(\"git add .\", :cwd => cookbook_path)\n shell_out!(\"git commit -m 'creating initial cookbook structure from the knife-github plugin' \", :cwd => cookbook_path)\n shell_out!(\"git remote add origin #{github_url} \", :cwd => cookbook_path)\n shell_out!(\"git push -u origin master\", :cwd => cookbook_path)\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n \n unless git.has_dot_git?\n error(\"Can only create a mortar project for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n \n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not create a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not create a new project inside of an existing mortar project.\")\n end\n end\n \n project_id = nil\n action(\"Sending request to create project: #{name}\") do\n project_id = api.post_project(name).body[\"project_id\"]\n end\n \n project_result = nil\n project_status = nil\n display\n ticking(polling_interval) do |ticks|\n project_result = api.get_project(project_id).body\n project_status = project_result.fetch(\"status_code\", project_result[\"status\"])\n project_description = project_result.fetch(\"status_description\", project_status)\n is_finished = Mortar::API::Projects::STATUSES_COMPLETE.include?(project_status)\n\n redisplay(\"Status: %s %s\" % [\n project_description + (is_finished ? \"\" : \"...\"),\n is_finished ? \" \" : spinner(ticks)],\n is_finished) # only display newline on last message\n if is_finished\n display\n break\n end\n end\n \n case project_status\n when Mortar::API::Projects::STATUS_FAILED\n error(\"Project creation failed.\\nError message: #{project_result['error_message']}\")\n when Mortar::API::Projects::STATUS_ACTIVE\n git.remote_add(\"mortar\", project_result['git_url'])\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n else\n raise RuntimeError, \"Unknown project status: #{project_status} for project_id: #{project_id}\"\n end\n \n end",
"def push_repo\n reference_point = git_branch_name || git_tag_name || 'master'\n callback(:push_repo) do\n notify(:push_repo, reference_point: reference_point, app_name: app_name, force: force)\n force_flag = force ? \"-f \" : \"\"\n system_call \"git push #{force_flag}#{deployment_remote} #{reference_point}:refs/heads/master\"\n end\n end",
"def move_from_remote(remote_file, local_path)\n\t\tcopy_from_remote(remote_file, local_path)\n\t\tdelete_remote(remote_file)\n\tend",
"def local\n @local ||= File.expand_path(ENV['M2_REPO'] || ENV['local_repo'] ||\n (Buildr.settings.user['repositories'] && Buildr.settings.user['repositories']['local']) ||\n File.join(ENV['HOME'], '.m2/repository'))\n end",
"def newMet\n puts \"Try to create a new branch and then push it back to remote\"\n end",
"def remote_command(command, password = nil)\n Net::SSH.start(remote_ip, 'git', :password => password) do |ssh|\n output = ssh.exec!(\"cd #{remote_app_name}\")\n unless output =~ /No such file or directory/\n ssh.exec(\"cd #{remote_app_name} && #{command}\")\n else\n puts \"Your application has not yet been deployed to your Webby.\"\n puts \"To issue remote commands from the Webby, you must first push your application.\"\n end\n end\n end"
] |
[
"0.87974554",
"0.67510116",
"0.6679692",
"0.6569934",
"0.6522725",
"0.64648604",
"0.6442583",
"0.6284816",
"0.62839985",
"0.62839985",
"0.62299085",
"0.6183519",
"0.61738694",
"0.6101672",
"0.59710914",
"0.5843516",
"0.58231604",
"0.58125013",
"0.58071613",
"0.5791443",
"0.57683176",
"0.5724862",
"0.56988823",
"0.5667221",
"0.5639028",
"0.5632074",
"0.56090015",
"0.5581829",
"0.55556345",
"0.5552671",
"0.5547793",
"0.55174696",
"0.55152",
"0.5511263",
"0.54920423",
"0.54616815",
"0.54160863",
"0.53889954",
"0.53796667",
"0.5365054",
"0.5274347",
"0.5258966",
"0.5209072",
"0.5199299",
"0.5189287",
"0.5187232",
"0.5143402",
"0.5140893",
"0.5133114",
"0.5133114",
"0.5118216",
"0.51116276",
"0.5102876",
"0.5101292",
"0.50935423",
"0.5074622",
"0.50608295",
"0.5059384",
"0.5053644",
"0.5048728",
"0.50227493",
"0.50193876",
"0.50185144",
"0.501122",
"0.4997297",
"0.49919817",
"0.4990974",
"0.4989738",
"0.49821454",
"0.49816796",
"0.49724764",
"0.49702707",
"0.49569535",
"0.49528062",
"0.49520516",
"0.4933055",
"0.49205604",
"0.49102548",
"0.4907587",
"0.48805934",
"0.4871504",
"0.4870777",
"0.4867192",
"0.4864085",
"0.48477924",
"0.48415318",
"0.4830777",
"0.4830255",
"0.4821256",
"0.48210075",
"0.4814845",
"0.4811147",
"0.480562",
"0.47993356",
"0.47921905",
"0.47850978",
"0.477711",
"0.47688317",
"0.47654596",
"0.4757122"
] |
0.896468
|
0
|
projects:clone PROJECTNAME Used when you want to clone an existing Mortar project into the current directory.
|
def clone
name = shift_argument
unless name
error("Usage: mortar projects:clone PROJECT\nMust specify PROJECT.")
end
validate_arguments!
projects = api.get_projects().body["projects"]
project = projects.find{|p| p['name'] == name}
unless project
error("No project named: #{name} exists. Your valid projects are:\n#{projects.collect{ |x| x["name"]}.join("\n")}")
end
project_dir = File.join(Dir.pwd, project['name'])
unless !File.exists?(project_dir)
error("Can't clone project: #{project['name']} since directory with that name already exists.")
end
git.clone(project['git_url'], project['name'])
display "\nYour project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\n\n"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def clone\n\t\t did_clone = system \"git clone #{remote_path} projects/#{name}\"\n\t\t\tsystem \"cd projects/#{name} && git pull origin\" if !did_clone\n\t\tend",
"def copy\n project_to_clone = Project.find(params[:id])\n @project = project_to_clone.clone\n\n # FIXME add copying of project team members\n\n # date/time transformations\n convert_db_datetime_to_display\n end",
"def fork\n git_url = shift_argument\n name = shift_argument\n unless git_url and name\n error(\"Usage: mortar projects:fork GIT_URL PROJECT\\nMust specify GIT_URL and PROJECT.\")\n end\n validate_arguments!\n validate_project_name(name)\n\n if git.has_dot_git?\n begin\n error(\"Currently in git repo. You can not fork a new project inside of an existing git repository.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in git repo. You can not fork a new project inside of an existing git repository.\")\n end\n end\n is_public = options[:public]\n ask_public(is_public)\n git.clone(git_url, name, git.fork_base_remote_name)\n Dir.chdir(name)\n # register a nil project id because it hasn't been created yet\n register_project(name, is_public, nil) do |project_result|\n git.remote_add(\"mortar\", project_result['git_url'])\n git.push_master\n # We want the default remote to be the Mortar managed repo.\n git.git(\"fetch --all\")\n git.set_upstream('mortar/master')\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end\n end",
"def repo_clone(from_name, to_name)\n Dir.chdir(tmp_repos_path) { Pod::Executable.capture_command!('git', %W(clone #{from_name} -- #{to_name})) }\n repo_path(to_name)\n end",
"def _clone_repository(project:, path:)\n if _has_ssh_key_setting?(project)\n _clone_with_setting_key(project: project, path: path)\n else\n _clone_with_system_key(project: project, path: path)\n end\n end",
"def create_project\n unless options.force\n abort \"'#{project}' already exists\" if File.exist?( project ) \n end\n\n # copy over files from the master project data diretory in crate\n files = project_files\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each do |file|\n cp file \n end\n end\n end",
"def git_clone\n\n Rugged::Repository.clone_at git_url, root_path.to_s if git_url\n end",
"def clone_and_pull_repo\n FileUtils.mkdir(project_path, :mode => 0744) unless File.directory?(project_path)\n\n clone_project_repo unless File.directory?(project_repo_path)\n fetch_and_pull_trunk\n end",
"def clone_repo\n Dir.chdir(@dir) do\n command = ['clone', @configuration.repository, '.']\n git!(command)\n end\n end",
"def mv_project\n new_path = ARGV.shift\n\n unless new_path\n $logger.error \"mv-project failed: no destination path provided.\"\n return false\n end\n\n new_full_path = File.join(repos_path, new_path)\n\n # verify that the source repo exists\n unless File.exists?(full_path)\n $logger.error \"mv-project failed: source path <#{full_path}> does not exist.\"\n return false\n end\n\n # ...and that the target repo does not exist\n if File.exists?(new_full_path)\n $logger.error \"mv-project failed: destination path <#{new_full_path}> already exists.\"\n return false\n end\n\n $logger.info \"Moving project #{@project_name} from <#{full_path}> to <#{new_full_path}>.\"\n FileUtils.mv(full_path, new_full_path)\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name)\n project_id = register_api_call(name,is_public) \n Mortar::Command::run(\"generate:project\", [name])\n FileUtils.cd(name)\n is_embedded = false\n if options[:embedded]\n is_embedded = true\n register_do(name, is_public, is_embedded, project_id)\n else\n git.git_init\n git.git(\"add .\")\n git.git(\"commit -m \\\"Mortar project scaffolding\\\"\") \n register_do(name, is_public, is_embedded, project_id)\n display \"NOTE: You'll need to change to the new directory to use your project:\\n cd #{name}\\n\\n\"\n end\n end",
"def create\n if params[:project_id]\n cloned_from = Project.find(params[:project_id])\n @project = cloned_from.clone(params, @cur_user.id)\n else\n @cloned_project = nil\n @project = Project.new project_params\n @project.user_id = @cur_user.id\n end\n\n respond_to do |format|\n if @project.save\n format.html do\n redirect_to @project, notice: 'Project was successfully created.'\n end\n format.json do\n render json: @project.to_hash(false),\n status: :created, location: @project\n end\n else\n flash[:error] = @project.errors.full_messages\n format.html { redirect_to projects_path }\n format.json do\n render json: @project.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def clone(uri, destination = Dir.mktmpdir)\n git(\"clone\", uri, destination.to_s)\n\n destination\n end",
"def git_clone_repo(host, git_clone_path, git_source)\n on(host, \"git clone #{git_source} #{git_clone_path}\")\nend",
"def goto_prj_dir\n git_repo_dir = git_dir + '/' + @options[:repo].split('/')[1]\n # chech that dir exist, otherwise clone it\n ck_or_clone_git\n begin\n # /tmp/gitarro, this is in case the dir already exists\n Dir.chdir git_repo_dir\n rescue Errno::ENOENT\n # this is in case we clone the repo\n Dir.chdir @options[:repo].split('/')[1]\n end\n end",
"def clone_to(repo, destination)\n ::RightGit::Git::Repository.clone_to(repo, destination, DEFAULT_REPO_OPTIONS)\n true\n end",
"def clone_repos(repos, shallow=true)\n repos.each do |repo|\n name = repo['name']\n subtitle \"Cloning #{name}\"\n url = repo['clone_url']\n if File.exist?(name)\n puts 'Already cloned'\n else\n if shallow\n system(\"git\", \"clone\", url, \"--depth\", \"1\", \"--recursive\")\n else\n system(\"git\", \"clone\", url)\n end\n end\n end\nend",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n \n unless git.has_dot_git?\n error(\"Can only create a mortar project for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n \n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not create a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not create a new project inside of an existing mortar project.\")\n end\n end\n \n project_id = nil\n action(\"Sending request to create project: #{name}\") do\n project_id = api.post_project(name).body[\"project_id\"]\n end\n \n project_result = nil\n project_status = nil\n display\n ticking(polling_interval) do |ticks|\n project_result = api.get_project(project_id).body\n project_status = project_result.fetch(\"status_code\", project_result[\"status\"])\n project_description = project_result.fetch(\"status_description\", project_status)\n is_finished = Mortar::API::Projects::STATUSES_COMPLETE.include?(project_status)\n\n redisplay(\"Status: %s %s\" % [\n project_description + (is_finished ? \"\" : \"...\"),\n is_finished ? \" \" : spinner(ticks)],\n is_finished) # only display newline on last message\n if is_finished\n display\n break\n end\n end\n \n case project_status\n when Mortar::API::Projects::STATUS_FAILED\n error(\"Project creation failed.\\nError message: #{project_result['error_message']}\")\n when Mortar::API::Projects::STATUS_ACTIVE\n git.remote_add(\"mortar\", project_result['git_url'])\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n else\n raise RuntimeError, \"Unknown project status: #{project_status} for project_id: #{project_id}\"\n end\n \n end",
"def goto_prj_dir(repo)\n git_repo_dir = @git_dir + \"/\" + repo.split('/')[1]\n # chech that dir exist, otherwise clone it\n if File.directory?(@git_dir) == false\n FileUtils.mkdir_p(@git_dir)\n Dir.chdir @git_dir\n puts `git clone git@github.com:#{repo}.git`\n end\n begin\n # /tmp/gitbot, this is in case the dir already exists\n Dir.chdir git_repo_dir\n rescue\n # this is in case we clone the repo\n Dir.chdir repo.split('/')[1]\n end\n end",
"def clone(uri, destination = Dir.mktmpdir)\n hg('clone', uri, destination.to_s)\n destination\n end",
"def import_project\n # Skip import if repo already exists\n return false if File.exists?(full_path)\n\n @source = ARGV.shift\n masked_source = mask_password_in_url(@source)\n\n # timeout for clone\n timeout = (ARGV.shift || 120).to_i\n $logger.info \"Importing project #{@project_name} from <#{masked_source}> to <#{full_path}>.\"\n cmd = %W(git clone --bare -- #{@source} #{full_path})\n\n pid = Process.spawn(*cmd)\n\n begin\n Timeout.timeout(timeout) do\n Process.wait(pid)\n end\n\n return false unless $?.exitstatus.zero?\n rescue Timeout::Error\n $logger.error \"Importing project #{@project_name} from <#{masked_source}> failed due to timeout.\"\n\n Process.kill('KILL', pid)\n Process.wait\n FileUtils.rm_rf(full_path)\n return false\n end\n\n self.class.create_hooks(full_path)\n # The project was imported successfully.\n # Remove the origin URL since it may contain password.\n remove_origin_in_repo\n\n true\n end",
"def clone_url\n \"git://github.com/#{@account}/#{name}.git\"\n end",
"def clone_repository\n `cd #{client.config.tmp_folder} && git clone #{client.config.repository_url}.git`\n `cd #{client.config.tmp_folder}/#{client.config.repository_name} && git fetch origin #{client.config.ref_tree} && git reset --hard FETCH_HEAD`\n end",
"def clone_repo(root, repo)\n begin \n destination = \"#{root}/#{repo[\"destination\"]}\"\n rm_rf destination\n sh \"git clone https://github.com/rethinkdb/#{repo[\"repo\"]}.git #{destination}\"\n cd destination\n sh \"git checkout #{repo[\"branch\"]}\"\n rescue Exception\n $stderr.puts \"Error while cloning #{repo[\"repo\"]}\"\n exit 1\n end\nend",
"def subdir_clone( directory, name, git_repo )\n if not File.directory? \"#{directory}/#{name}\"\n FileUtils.mkdir_p directory\n sh \"git clone #{git_repo} '#{directory}/#{name}'\"\n end\nend",
"def clone(args)\n args.split!\n # git clone [opts] [repo] [dir]\n # raise InvalidArguments error unless args.split.length > 1\n humanized_name = /[a-zA-Z1-9]+.git/.match args[0]\n name = args[1] unless args[1].nil?\n\n [\"rm -rf #{name || humanized_name}\", true]\n end",
"def git_clone(name, repo_with_branch)\n repo, branch = repo_with_branch.split('#')\n dir = \"#{@dir}/#{name}\"\n\n sh \"git clone --depth 1 -b #{branch} https://github.com/#{repo}.git #{dir}\"\n end",
"def clone(*args); end",
"def create_mirror\n puts \"## Create mirror for project #{@name}\"\n # TODO : Check that all required data is here!\n load_attributes\n\n @config = Ow2mirror::Config.new(@workspace, @name)\n @config.load_attributes\n\n puts \"### Attributes\"\n pp @attributes\n\n puts \"### Configuration\"\n pp @config\n\n puts \"### Clone\"\n puts \"- Mirroring stuff from #{@source_project} source project to #{@target_project}...\"\n cd(folder)\n\n puts \" - Working in the folder #{pwd}\"\n\n # Get the repositories with their name and gitorious git URL\n # TODO :Make it in a generic way (load class from name)...\n\n source = {}\n source[:username] = @config.attributes['source']['username']\n source[:password] = @config.attributes['source']['password']\n source[:url] = @config.attributes['source']['url']\n source[:project] = @attributes['source']\n source_client = Ow2mirror::Client::GitoriousClient.new(source)\n sources = source_client.repositories(@source_project)\n\n target = {}\n target[:username] = @config.attributes['destination']['username']\n target[:password] = @config.attributes['destination']['password']\n target[:url] = @config.attributes['destination']['url']\n target[:project] = @attributes['target']\n target_client = Ow2mirror::Client::GithubClient.new(target)\n\n puts \" - Retrieved the following repositories from sources:\"\n sources.each do |repository|\n puts \" - #{repository[:name]} @ #{repository[:giturl]}\"\n end\n\n repos = []\n\n # For each repository, create the new one on the destination host\n # TODO : Filter from user choices...\n puts \" - Process repositories:\"\n sources.each do |repository|\n cd(folder)\n\n name = repository[:name]\n git = repository[:giturl]\n\n puts \" - Working on repository #{name} - #{git}\"\n puts \" - Clone source locally into #{name}\"\n\n Ow2mirror::Command.git(\"clone --bare --mirror #{git}\")\n\n folder = repository_folder(name)\n\n puts \" - cd to #{folder}\"\n if File.directory?(repository_folder(repository)) and File.exist?(repository_folder(repository))\n # No folder means that something failed...\n end\n\n cd(folder)\n\n target_repo = (@prefix.nil? or @prefix.empty?) ? name : \"#{@prefix}-#{name}\"\n\n puts \" - Target repository is #{target_repo}\"\n\n remote = target_client.create(@attributes['target'], target_repo, \"Official mirror of OW2 repository #{name} hosted at #{git}\")\n Ow2mirror::Command.git(\"remote add #{@config.attributes['destination']['type']} #{remote}\")\n\n Ow2mirror::Command.git(\"config remote.#{@config.attributes['destination']['type']}.mirror true\")\n\n # cache repo\n repos << {:name => name, :source => git, :destination => remote}\n\n end\n\n puts \"#### Clone summary\"\n puts \"- Generated repositories:\"\n pp repos\n\n save\n save_repos repos\n\n @workspace.add_project(@name)\n\n mirror\n end",
"def git_clone(repo, config = {})\n config ||= {}\n destination = config[:destination] || File.basename(repo, '.git')\n\n destination = Pathname.new(destination) unless destination.is_a?(Pathname)\n FileUtils.mkdir_p destination.dirname\n\n if destination.directory?\n say_status :exist, destination.expand_path, :blue\n else\n say_status 'git clone',\n \"#{repo} to #{destination.expand_path}\",\n :green\n system \"git clone -q --config push.default=upstream --recursive #{repo} #{destination}\"\n end\n end",
"def project(name)\n Ow2mirror::Project.new(self, name)\n end",
"def git_clone_repo(repo, branch, destination)\n abort(\"📖 ❗️ No branch to clone specified, aborting…\") if branch.empty?\n abort(\"📖 ❗️ No repo to clone specified, aborting…\") if repo.empty?\n abort(\"📖 ❗️ No destination where to clone specified, aborting…\") if branch.empty?\n\n system('git', 'clone', '--quiet', '-b', branch, repo, destination)\n end",
"def clone(uri, destination = Dir.mktmpdir)\n if File::ALT_SEPARATOR\n destination = destination.to_s.gsub(File::SEPARATOR, File::ALT_SEPARATOR)\n end\n\n git('clone', uri, destination.to_s)\n\n destination\n end",
"def create_git_project\n GemBootstrap::GitUtils.create_git_project(File.expand_path(name), name)\n end",
"def git_clone(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend",
"def clone_repo(repo_name, username)\n ` git clone http://github.com/#{username}/#{repo_name}.git /tmp/#{repo_name} `\n end",
"def clone\n # We do the clone against the target repo using the `--reference` flag so\n # that doing a normal `git pull` on a directory will work.\n git \"clone --reference #{@cache.path} #{@remote} #{@full_path}\"\n git \"remote add cache #{@cache.path}\", :path => @full_path\n end",
"def new_project \n require 'fileutils'\n dir = \"./\" + @arguments.first\n Dir.mkdir(dir)\n %w[app config experiments report results test tmp vendor].each do |d|\n Dir.mkdir(dir + \"/\" + d)\n end\n basedir = File.dirname(__FILE__)\n File.open(File.join(dir, \"config\", \"config.yaml\"), \"w\") do |f|\n f << \"---\\nenvironments:\\n development:\\n compute:\\n\"\n end\n File.open(File.join(dir, \".gitignore\"), \"w\") do |f|\n f << \"tmp/*\"\n end\n FileUtils::cp File.join(basedir, \"generator/readme_template.txt\"), File.join(dir, \"README\")\n FileUtils::cp File.join(basedir, \"generator/Rakefile\"), File.join(dir, \"Rakefile\")\n FileUtils::cp File.join(basedir, \"generator/experiment_template.rb.txt\"), File.join(dir, \"experiments\", \"experiment.rb\")\n end",
"def clone(repo_url)\n FileUtils.mkdir_p(File.dirname(working_dir))\n git 'clone', '--recursive', repo_url, working_dir\n end",
"def clone(repo_url)\n FileUtils.mkdir_p(File.dirname(working_dir))\n git 'clone', '--recursive', repo_url, working_dir\n end",
"def clone_to_local\n out = Temppath.create.open(\"w+\")\n\n # call git clone\n process = ChildProcess.build(\"git\", \"clone\", @address, local.path.to_s)\n process.io.stdout = out\n process.start\n process.wait\n\n # check the process result\n if process.crashed?\n raise GitError.new(self, message: \"'git clone' failed\")\n end\n\n # show debug message\n out.rewind\n Log::Debug.system(\"git clone: %s\" % out.read)\n end",
"def clone_dir\n \"#{RdocInfo.config[:tmp_dir]}/#{@project.owner}/#{@project.name}/blob/#{@project.commit_hash}\"\n end",
"def git_init_bare_repo_and_clone(host, git_repo_parent_path, git_repo_name, git_clone_path)\n origin_git_repo_path = git_init_bare_repo(host, git_repo_parent_path, git_repo_name)\n git_clone_repo(host, git_clone_path, origin_git_repo_path)\nend",
"def CreateCopy()\n copy = ProjectPath.new({base: @BasePath, relative: @RelativePath})\n return copy\n end",
"def test_clone_repo\n clone_to_path = \"#{TEST_DATA_DIR}/clone.git\"\n \n assert_nothing_raised RuntimeError do\n Gitit.clone(@repo_path, clone_to_path)\n end\n \n assert(File.exist?(\"#{clone_to_path}/HEAD\"), \"Checking HEAD file exists at #{clone_to_path}\")\n \n cleanup_dir(clone_to_path)\n end",
"def copy_back_from_temporary_clone(clone_dir)\n FileUtils.mkdir_p work_dir\n FileUtils.cp_r clone_dir, work_dir\n end",
"def create_project(tx)\n Installer.copy(tx, \"#{@service_dir}/pieces/public\", get_path(:web))\n true\n end",
"def delete\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:delete PROJECTNAME\\nMust specify PROJECTNAME.\")\n end\n validate_arguments!\n projects = api.get_projects().body['projects']\n project_id = nil\n if projects.any?\n projects.each do |project|\n if project['name'] == name\n project_id = project['project_id']\n end\n end\n end\n\n if project_id.nil?\n display \"\\nNo project with name: #{name}\"\n else\n # delete embedded project mirror if one exists\n mirror_dir = \"#{git.mortar_mirrors_dir()}/#{name}\"\n if File.directory? mirror_dir\n FileUtils.rm_r mirror_dir\n end\n\n # delete Mortar remote\n action(\"Sending request to delete project: #{name}\") do\n api.delete_project(project_id).body['project_id']\n end\n display \"\\nYour project has been deleted.\"\n end\n \n end",
"def new\n # Agrega el breadcrumb de la pagina new de proyecto\n add_breadcrumb I18n.t('project.new'), :controller => \"projects\", :action => \"new\"\n @project = Project.new\n end",
"def new\n add_breadcrumb \"Nouveau\"\n @project = Project.new\n end",
"def new_project(name:, component:, url_base:, branch:)\n # puts \"new_project(#{name}, #{component}, #{url_base})\"\n Project.new(name, component, url_base, branch: branch)\n end",
"def clone(where)\n unless self.class.empty_dir?(where)\n raise ArgumentError, \"File already exists `#{where}`\"\n end\n FileUtils.mkdir_p(where)\n g = Grit::Git.new(where)\n g.clone({}, \"--\", path, where)\n wdir = WorkingDir::Git.new(where)\n yield(wdir) if block_given?\n wdir\n end",
"def clone\n @cache.sync\n\n # We do the clone against the target repo using the `--reference` flag so\n # that doing a normal `git pull` on a directory will work.\n git [\"clone\", \"--reference\", @cache.git_dir, @remote, @full_path]\n git [\"remote\", \"add\", \"cache\", @cache.git_dir], :path => @full_path\n git ['fetch', 'cache'], :path => @full_path\n checkout(@ref)\n end",
"def project_new\n new_project.click\n end",
"def clone(path, options={})\n with_env do\n grit.git.clone(options, grit.path, path)\n clone = Grit::Repo.new(path)\n\n if options[:bare]\n # bare origins directly copy branch heads without mapping them to\n # 'refs/remotes/origin/' (see git-clone docs). this maps the branch\n # head so the bare grit can checkout branch\n clone.git.remote({}, \"add\", \"origin\", grit.path)\n clone.git.fetch({}, \"origin\")\n clone.git.branch({}, \"-D\", branch)\n end\n\n # sets up branch to track the origin to enable pulls\n clone.git.branch({:track => true}, branch, \"origin/#{branch}\")\n self.class.new(clone, :branch => branch, :author => author)\n end\n end",
"def import_repository(name, url)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects import-project #{name}.git #{url}\")\n end",
"def seed_repo(project_working_path)\n begin\n # remove destination directory if it already exists\n if File.directory? @project_git_work_path\n LOGGER.debug \"Removing directory #{@project_git_work_path}\"\n FileUtils.remove_entry_secure @project_git_work_path\n end\n \n # clone the empty git repo created for this project\n FileUtils.mkdir_p @project_git_work_path\n project_repo = Git.clone \"#{@@git_repo_prefix}#{@project_label}.git\",\n @project_label, \n :path => @@gitolite_work_dir_path\n \n LOGGER.debug \"Copying project files for repo #{@project_label}\"\n \n # move the project files into the git working directory\n FileUtils.cp_r Dir.glob(File.join(project_working_path, '*')), @project_git_work_path\n LOGGER.debug \"Copied project files successfully for repo #{@project_label}\"\n \n # delete the project files from the working path - ACTUALLY DO NOT DO THIS, THESE ARE REQUIRED!\n #LOGGER.debug \"Removing working files at #{project_working_path}\"\n #FileUtils.remove_entry_secure project_working_path\n \n # stage and commit the newly copied files\n LOGGER.debug \"Adding files to repo #{@project_label}\"\n project_repo.add('.')\n LOGGER.debug \"Committing repo #{@project_label}\"\n project_repo.commit(\"Seeded repo #{@project_label} with project files\")\n LOGGER.debug \"Pushing repo #{@project_label}\"\n project_repo.push\n rescue Exception => e\n LOGGER.error \"Error occurred seeding repo #{@project_label} with project files: #{e.message}\"\n end\n end",
"def clone_git_repo(nr)\n checkout_path = ::File.join(Chef::Config[:file_cache_path], nr.gem_name)\n at_compile_time do\n git checkout_path do\n action :checkout\n repository nr.repository\n revision nr.revision\n end\n end\n checkout_path\n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create_clone_with_branch(type, module_name, repo_url, branch=nil, version=nil, module_namespace=nil, opts={})\n Response.wrap_helper_actions do\n full_name = module_namespace ? ModuleUtil.resolve_name(module_name, module_namespace) : module_name\n\n modules_dir = modules_dir(type,full_name,version,opts)\n FileUtils.mkdir_p(modules_dir) unless File.directory?(modules_dir)\n\n target_repo_dir = local_repo_dir(type,full_name,version,opts)\n if File.exists?(target_repo_dir)\n # if local copy of module exists then move that module to backups location\n if opts[:backup_if_exist]\n backup_dir = backup_dir(type, full_name)\n FileUtils.mv(target_repo_dir, backup_dir)\n puts \"Backup of existing module directory moved to '#{backup_dir}'\"\n else\n raise ErrorUsage.new(\"Directory '#{target_repo_dir}' is not empty; it must be deleted or removed before retrying the command\", :log_error => false)\n end\n end\n\n begin\n opts_clone = (opts[:track_remote_branch] ? {:track_remote_branch => true} : {})\n GitAdapter.clone(repo_url, target_repo_dir, branch, opts_clone)\n rescue => e\n # Handling Git error messages with more user friendly messages\n e = GitErrorHandler.handle(e)\n\n #cleanup by deleting directory\n FileUtils.rm_rf(target_repo_dir) if File.directory?(target_repo_dir)\n error_msg = \"Clone to directory (#{target_repo_dir}) failed\"\n\n DtkLogger.instance.error_pp(e.message, e.backtrace)\n\n raise ErrorUsage.new(error_msg, :log_error => false)\n end\n {\"module_directory\" => target_repo_dir}\n end\n end",
"def cd_proj name\n Dir.chdir File.join(File.dirname(__FILE__), \"assets/proj/#{name}\") do\n yield\n end\n end",
"def clone\n end",
"def generate_project!(attributes={})\n identifier = \"a\" + Redmine::Utils.random_hex(6)\n Project.generate!(\n {\n :identifier => identifier,\n :name => identifier,\n :tracker_ids => [],\n :enabled_module_names => []\n }.merge(attributes)\n )\n end",
"def git_clone(repo, destination)\n result = `git clone -q #{repo} #{destination}`\n if $?.exitstatus != 0\n error \"Failed to clone #{repo} into #{destination} (Exit status: #{$?.exitstatus})!\"\n error \"Result: #{result}\" unless result.empty?\n exit $?.exitstatus\n end\n end",
"def clone(url, depth = 10)\n puts \"+ git clone --depth=#{depth} #{url}\"\n system \"git clone --depth=#{depth} #{url}\"\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def new\r\n # This can and probably SHOULD be replaced with some URL rewrite magic\r\n # now that the project loader is Redmine project based.\r\n find_project()\r\n end",
"def new_project(name)\n path = File.expand_path(name)\n if Dir.exist?(path)\n say \"#{path} already exists. Please choose a directory name that doesn't already exist.\".red\n exit\n end\n\n @gz_info = new_global_zone\n @gz_info.serialize(path)\n\n say \"You have now configured your SmartOS virtual infrastructure. Inspect it, then run \"\\\n \"'smartos up' to build it!\".green\n end",
"def get_clone_directory()\n\n if @to\n folder_exists = File.directory?( @to )\n FileUtils.mkdir_p( @to ) unless folder_exists\n return @to\n end\n\n if @verse.has_key?( Indices::GIT_CLONE_BASE_PATH )\n folder_exists = File.directory?( @verse[ Indices::GIT_CLONE_BASE_PATH ] )\n FileUtils.mkdir_p( @verse[ Indices::GIT_CLONE_BASE_PATH ] ) unless folder_exists\n return @verse[ Indices::GIT_CLONE_BASE_PATH ]\n end\n\n return Dir.pwd()\n\n end",
"def clone\n name_new = shift_argument || error(\"must specify NEWNAME\")\n name_old = app\n\n action(\"Creating #{name_new}\") do\n app = api.post_app({\n :name => name_new,\n :stack => \"cedar\",\n :region => options[:region],\n :tier => options[:tier]\n })\n end\n\n Dir.mktmpdir do |dir|\n download_bundle name_old, \"#{dir}/bundle.tgz\"\n upload_bundle name_new, \"#{dir}/bundle.tgz\"\n end\n\n puts \"Cloned #{name_old} to #{name_new}\"\n end",
"def create(project)\n self.say(\"* Creating project in directory: #{project}\")\n\n dir = Pathname.new(project)\n\n %w[\n manifests\n modules\n ].each do |subdir|\n target = (dir + subdir)\n unless target.exist?\n FileUtils.mkdir_p(target)\n self.say(\"- #{target}/\")\n end\n end\n\n return true\n end",
"def local_clone\n raise CommandNotImplemented\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def clone_repo_into_temp_directory\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(REPO_NAME)\n puts \"*** tempdir: (#{tempdir})\"\n\n at_exit { FileUtils.remove_entry(tempdir) }\n\n git clone: [\"--quiet\", REPO, tempdir].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[BRANCH_NAME_REGEX, 1])\n Dir.chdir(tempdir) do\n git checkout: branch\n end\n end\n\n # template_dir\n File.join(tempdir,TEMPLATE_DIR_NAME)\nend",
"def clone() end",
"def new\n @project = Project.new()\n end",
"def clone(*) end",
"def clone(*) end",
"def cloned?\n File.directory? git_dir\n end",
"def test_clone_to_existing_directory\n clone_to_path = \"#{TEST_DATA_DIR}/clone.git\"\n\n # Create an empty dir where we want to clone a new Gitit to\n create_dir_not_exist(clone_to_path)\n\n # Try the clone\n assert_raise RuntimeError do\n Gitit.clone(@repo_path, clone_to_path)\n end\n\n cleanup_dir(clone_to_path)\n end",
"def clone\n require_dep! 'awesome_spawn'\n require_cmd! pkg_cmd\n\n clobber!\n Dir.mkdir path unless File.directory? path\n in_repo do\n result = AwesomeSpawn.run \"#{pkg_cmd} clone #{rpm_name}\"\n raise PolisherError,\n \"could not clone #{rpm_name}\" unless result.exit_status == 0\n\n # pkg_cmd will clone into the rpm_name subdir,\n # move everything up a dir\n Dir.foreach(\"#{rpm_name}/\") do |f|\n orig = \"#{rpm_name}/#{f}\"\n skip = ['.', '..'].include?(f)\n FileUtils.move orig, '.' unless skip\n end\n\n FileUtils.rm_rf rpm_name\n end\n\n self\n end",
"def call\n clone_revision\n end",
"def create_project options\n Project::create_folder options\n Project::create_db_row options\n end",
"def clone(repo_url)\n mkpdir working_dir\n run 'git', 'clone', '--recursive', repo_url.split('#')[0], working_dir\n branch_from_repo_url(repo_url)\n update\n end",
"def clone(commit)\n repos_path = File.expand_path('repos')\n repo_path = File.join(repos_path, commit)\n @git = Git.open(repo_path) if FileTest.exist?(repo_path)\n @git = Git.clone(url, commit, path: repos_path) if @git.nil?\n end",
"def new\n redirect_to project_path id: new_project_from_hash('transient' => true,\n 'name' => 'Untitled Project',\n 'default_workspace' => {\n 'name' => 'Untitled Workspace'\n }).id\n end"
] |
[
"0.7456945",
"0.67859703",
"0.65468585",
"0.64820933",
"0.64382607",
"0.63885105",
"0.6360722",
"0.6315655",
"0.60633355",
"0.60182697",
"0.5974519",
"0.5917901",
"0.5908996",
"0.5905753",
"0.5873216",
"0.58126414",
"0.5793599",
"0.5777473",
"0.5745835",
"0.5742597",
"0.5737099",
"0.5730492",
"0.56822",
"0.5660023",
"0.5655271",
"0.56299734",
"0.5615909",
"0.55982643",
"0.5574238",
"0.55676734",
"0.5567161",
"0.5544931",
"0.5526802",
"0.55250686",
"0.5521933",
"0.5520157",
"0.55038965",
"0.54960704",
"0.54895157",
"0.54895157",
"0.54843175",
"0.54780734",
"0.5462042",
"0.5457555",
"0.5443685",
"0.544322",
"0.54365766",
"0.54359543",
"0.5422948",
"0.5419032",
"0.54172844",
"0.5411679",
"0.53945124",
"0.5394187",
"0.5388501",
"0.5388188",
"0.53839993",
"0.5377062",
"0.536005",
"0.5355548",
"0.53441334",
"0.5339411",
"0.53353435",
"0.5332157",
"0.5328157",
"0.53252065",
"0.53252065",
"0.53252065",
"0.53080755",
"0.53030807",
"0.52865607",
"0.5280417",
"0.5280332",
"0.5271492",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.5264765",
"0.52635396",
"0.52575004",
"0.52505934",
"0.52362025",
"0.52362025",
"0.5231671",
"0.52273005",
"0.52193433",
"0.52067643",
"0.5204059",
"0.51939684",
"0.5192717",
"0.5180608"
] |
0.8546274
|
1
|
projects:fork GIT_URL PROJECT_NAME Used when you want to fork an existing Git repository into your own Mortar project. public Register a public project, which can be viewed and forked by anyone.
|
def fork
git_url = shift_argument
name = shift_argument
unless git_url and name
error("Usage: mortar projects:fork GIT_URL PROJECT\nMust specify GIT_URL and PROJECT.")
end
validate_arguments!
validate_project_name(name)
if git.has_dot_git?
begin
error("Currently in git repo. You can not fork a new project inside of an existing git repository.")
rescue Mortar::Command::CommandFailed => cf
error("Currently in git repo. You can not fork a new project inside of an existing git repository.")
end
end
is_public = options[:public]
ask_public(is_public)
git.clone(git_url, name, git.fork_base_remote_name)
Dir.chdir(name)
# register a nil project id because it hasn't been created yet
register_project(name, is_public, nil) do |project_result|
git.remote_add("mortar", project_result['git_url'])
git.push_master
# We want the default remote to be the Mortar managed repo.
git.git("fetch --all")
git.set_upstream('mortar/master')
display "Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\n\n"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def admin_fork_repo(dst, src)\n response = HTTParty.post(\n GIT_BASE_URL + 'projects/' + dst.to_s + '/fork/' + src.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (fork repo): #{response}\"\n end",
"def create_repo_fork(url, options = {} )\n namespace = options[:namespace] || client.user.username\n new_url = swap_namespace(url, namespace)\n repo = repo_exists?(new_url)\n unless repo or url == new_url\n upstream_repo_id = name_to_id(repo_id(url))\n logger.info(\"Forking project from #{url} to #{new_url}\")\n repo = client.create_fork(upstream_repo_id)\n # gitlab lies about having completed the forking process, so lets sleep until it is actually done\n loop do\n sleep(1)\n break if repo_exists?(repo.ssh_url_to_repo)\n end\n end\n add_permissions(repo.id, options[:default_members])\n repo\n end",
"def fork_repo(src)\n response = HTTParty.post(\n GIT_BASE_URL + 'projects/fork/' + src.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => self.git_token\n }\n )\n Rails.logger.info \"Git server response (fork repo): #{response}\"\n if response.has_key? 'id'\n return response['id']\n end\n -1\n end",
"def github_fork(user_repo, fork_dir='~/code/fork')\n Dir.chdir File.expand_path(fork_dir)\n system \"hub clone #{user_repo}\"\n if $? == 0\n Dir.chdir user_repo[/[^\\/]+$/]\n exec 'hub fork'\n else\n \"Clone failed\"\n end\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def create(*args)\n arguments(args, required: [:user, :repo])\n\n post_request(\"/repos/#{arguments.user}/#{arguments.repo}/forks\", arguments.params)\n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def new_project(name:, component:, url_base:, branch:)\n # puts \"new_project(#{name}, #{component}, #{url_base})\"\n Project.new(name, component, url_base, branch: branch)\n end",
"def projects ; end",
"def fetch_projects!\n projects.destroy_all\n\n if github?\n result = YAML.load open(\"http://github.com/api/v2/yaml/repos/show/#{github}/\")\n\n result['repositories'].each do |repository|\n projects.create! :name => repository[:name], :description => repository[:description]\n end\n end\n rescue OpenURI::HTTPError # user not found, ignore\n end",
"def giturl(project_name, repo_name) ; end",
"def clone\n\t\t did_clone = system \"git clone #{remote_path} projects/#{name}\"\n\t\t\tsystem \"cd projects/#{name} && git pull origin\" if !did_clone\n\t\tend",
"def import_repository(name, url)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects import-project #{name}.git #{url}\")\n end",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name)\n project_id = register_api_call(name,is_public) \n Mortar::Command::run(\"generate:project\", [name])\n FileUtils.cd(name)\n is_embedded = false\n if options[:embedded]\n is_embedded = true\n register_do(name, is_public, is_embedded, project_id)\n else\n git.git_init\n git.git(\"add .\")\n git.git(\"commit -m \\\"Mortar project scaffolding\\\"\") \n register_do(name, is_public, is_embedded, project_id)\n display \"NOTE: You'll need to change to the new directory to use your project:\\n cd #{name}\\n\\n\"\n end\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n \n unless git.has_dot_git?\n error(\"Can only create a mortar project for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n \n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not create a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not create a new project inside of an existing mortar project.\")\n end\n end\n \n project_id = nil\n action(\"Sending request to create project: #{name}\") do\n project_id = api.post_project(name).body[\"project_id\"]\n end\n \n project_result = nil\n project_status = nil\n display\n ticking(polling_interval) do |ticks|\n project_result = api.get_project(project_id).body\n project_status = project_result.fetch(\"status_code\", project_result[\"status\"])\n project_description = project_result.fetch(\"status_description\", project_status)\n is_finished = Mortar::API::Projects::STATUSES_COMPLETE.include?(project_status)\n\n redisplay(\"Status: %s %s\" % [\n project_description + (is_finished ? \"\" : \"...\"),\n is_finished ? \" \" : spinner(ticks)],\n is_finished) # only display newline on last message\n if is_finished\n display\n break\n end\n end\n \n case project_status\n when Mortar::API::Projects::STATUS_FAILED\n error(\"Project creation failed.\\nError message: #{project_result['error_message']}\")\n when Mortar::API::Projects::STATUS_ACTIVE\n git.remote_add(\"mortar\", project_result['git_url'])\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n else\n raise RuntimeError, \"Unknown project status: #{project_status} for project_id: #{project_id}\"\n end\n \n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def git_project()\n \"\"\nend",
"def project(response)\n format = if response.args[1].slice(\"/\").nil?\n :repo\n else\n :owner\n end\n\n project_arg = config.projects.detect do |project|\n if format == :owner\n project[:owner] == response.args[1].partition(\"/\").first &&\n project[:repository] == response.args[1].partition(\"/\").last\n else\n project[:repository] == response.args[1]\n end\n end\n\n response.reply ::SnapCi::Project.new(project_arg, config).to_message\n end",
"def create_git_project\n GemBootstrap::GitUtils.create_git_project(File.expand_path(name), name)\n end",
"def projects(params = {})\n fetch_all('projects', 'projects', params)\n end",
"def clone\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:clone PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n projects = api.get_projects().body[\"projects\"]\n project = projects.find{|p| p['name'] == name}\n unless project\n error(\"No project named: #{name} exists. Your valid projects are:\\n#{projects.collect{ |x| x[\"name\"]}.join(\"\\n\")}\")\n end\n\n project_dir = File.join(Dir.pwd, project['name'])\n unless !File.exists?(project_dir)\n error(\"Can't clone project: #{project['name']} since directory with that name already exists.\")\n end\n\n git.clone(project['git_url'], project['name'])\n\n display \"\\nYour project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end",
"def clone\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:clone PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n projects = api.get_projects().body[\"projects\"]\n project = projects.find{|p| p['name'] == name}\n unless project\n error(\"No project named: #{name} exists. Your valid projects are:\\n#{projects.collect{ |x| x[\"name\"]}.join(\"\\n\")}\")\n end\n\n project_dir = File.join(Dir.pwd, project['name'])\n unless !File.exists?(project_dir)\n error(\"Can't clone project: #{project['name']} since directory with that name already exists.\")\n end\n\n git.clone(project['git_url'], project['name'])\n\n display \"\\nYour project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end",
"def fetch_project(input)\n input[:project] = { name: 'Fancy project', owner: { name: 'John Smith' } }\n Success(input)\n end",
"def projects\n resource 'projects'\n end",
"def create\n @project = Project.new(params[:project])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n=======\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fork_to_account(repository)\n KIT.fork(repository)[:full_name]\n end",
"def show\n @project = Project.find(@perk.project_id)\n add_breadcrumb @project.name.to_s, '/projects/' + @project.id.to_s\n end",
"def project_from_github(input)\n Github::ProjectMapper\n .new(App.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end",
"def create_project(params)\n elektron_identity.post(\"projects\") { { project: params } }.body[\n \"project\"\n ]\n end",
"def register\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:register PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n ask_public(options[:public])\n #nil is non existant project_id because it hasn't been posted yet\n register_do(name, options[:public], options[:embedded], nil) \n \n end",
"def project; end",
"def new\r\n # This can and probably SHOULD be replaced with some URL rewrite magic\r\n # now that the project loader is Redmine project based.\r\n find_project()\r\n end",
"def project_new\n new_project.click\n end",
"def project\n request :project\n end",
"def project_from_github(input)\n Github::ProjectMapper\n .new(Api.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end",
"def project\n end",
"def initialize\n @projects = [\n ReleaseTools::Project::GitlabEe,\n ReleaseTools::Project::GitlabCe,\n ReleaseTools::Project::OmnibusGitlab,\n ReleaseTools::Project::Gitaly,\n ReleaseTools::Project::HelmGitlab\n ]\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def projects\n @projects ||= begin\n http = Net::HTTP.new(API_HOST, API_PORT)\n http.use_ssl = true\n http.ca_file = (Twigg.root + 'files' + 'github.pem').to_s\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n uri = ORG_REPOS_ENDPOINT % Config.github.organization\n headers = { 'Authorization' => \"token #{Config.github.token}\" }\n\n [].tap do |names|\n begin # loop: page through project list\n request = Net::HTTP::Get.new(uri, headers)\n response = http.request(request)\n raise \"Bad response #{response.inspect}\" unless response.is_a?(Net::HTTPOK)\n names.concat JSON[response.body].map { |repo| repo['name'] }\n uri = parse_link(response['Link'])\n end until uri.nil?\n end\n end\n end",
"def myproject\n myproject = @current_profile.owned_project\n end",
"def get_repo(project)\n return 'https://github.com/NuCivic/' + project\n end",
"def create(project_name, repo_name, description) ; end",
"def set_project\n\n end",
"def set_project\n\n end",
"def add_repository(name)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects add-project #{name}.git\")\n end",
"def new\n add_breadcrumb \"Nouveau\"\n @project = Project.new\n end",
"def create_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"createproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def project(name)\n @projects.find { |p| p.name == name }\n end",
"def register_do(name, is_public, is_embedded, project_id)\n if is_embedded\n validate_project_structure()\n\n register_project(name, is_public, project_id) do |project_result|\n initialize_embedded_project(project_result)\n end\n else\n unless git.has_dot_git?\n # check if we're in the parent directory\n if File.exists? name\n error(\"mortar projects:register must be run from within the project directory.\\nPlease \\\"cd #{name}\\\" and rerun this command.\")\n else\n error(\"No git repository found in the current directory.\\nTo register a project that is not its own git repository, use the --embedded option.\\nIf you do want this project to be its own git repository, please initialize git in this directory, and then rerun the register command.\\nTo initialize your project in git, use:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\")\n end\n end\n\n\n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not register a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not register a new project inside of an existing mortar project.\")\n end\n end\n\n register_project(name, is_public, project_id) do |project_result|\n git.remote_add(\"mortar\", project_result['git_url'])\n git.push_master\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n end\n end\n end",
"def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GITHUB_CLIENT_SECRET\n end\n end",
"def create(project_name)\n\t\tnew_branch_name = branch_generator(project_name)\n\t\tif project_name.nil?\n\t\t\tputs \"Missing project name!\"\n\t\telse\n\n\t\t\texec(\"\n\t\t\tmkdir #{@@default_directory}#{project_name.to_s} &&\n\t\t\tcd #{@@default_directory}#{project_name.to_s} &&\n\t\t\tgit init &&\n\t\t\tgit checkout -b master &&\n\t\t\tgit commit --allow-empty -m 'first commit' &&\n\t\t\tgit tag -a v0.0 -m 'first tag' &&\n\t\t\tgit checkout -b #{new_branch_name}\n\t\t\t\")\n\n\t\t\tsystem(\"cd #{@@default_directory}#{project_name.to_s}\")\n\t\t\tsave(project_name)\n\t\tend\n\tend",
"def create\n @project = current_user.projects.build(project_params)\n\n # Error out if project_homepage_url and repo_url are both empty... don't\n # do a save yet.\n\n @project.project_homepage_url ||= set_homepage_url\n Chief.new(@project).autofill\n\n respond_to do |format|\n if @project.save\n flash[:success] = \"Thanks for adding the Project! Please fill out\n the rest of the information to get the Badge.\"\n format.html { redirect_to edit_project_path(@project) }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json do\n render json: @project.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def start_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'StartProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def create\n\n begin\n\n if params[:access_token]\n # # get name and email by GitHub API with access_token\n client = Octokit::Client.new(access_token: params[:access_token])\n user = client.user\n name = user.login\n\n # if user with this name not exists...\n @user = User.where(name: name).first\n if @user.blank?\n @user = User.create(name: name)\n end\n\n project_json = JSON.parse(params[:project])\n project_name = project_json['name']\n project_data = JSON.pretty_generate(project_json['data'])\n\n @project = @user.project.build(name: project_name, data: project_data)\n @project.name = @project.name.delete(\" \")\n\n # JSON.parse project data and create nodes and links\n # nodes -> node_ids, links -> link_ids\n # check if node and link already exists\n # (node unique parameter : name && author && year)\n # (link unique parameter : refering node id && referred node id)\n # create node and link only when it not exists\n # update node_ids and link_ids\n\n if @project.save # auto check if project uniqueness ?\n @success = true\n else\n @success = false\n end\n else\n @success = false\n end\n rescue => e\n @success = false\n end\n\n end",
"def new\n @linkDropbox = false\n @linkGithub = false\n \n if session[:dropbox_session] \n @linkDropbox = true\n @dropbox_token = session[:dropbox_session]\n session.delete :dropbox_session \n send_confirmation_doc \n end \n \n if session[:github_session]\n @linkGithub = true\n @github_token = session[:github_session]\n session.delete :github_session\n @g = Github.new :oauth_token => @github_token\n @github_username = @g.users.get.body[\"login\"]\n end\n\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def projects(options = {})\n get(\"projects\", options).projects\n end",
"def create\n if params[:project_id]\n cloned_from = Project.find(params[:project_id])\n @project = cloned_from.clone(params, @cur_user.id)\n else\n @cloned_project = nil\n @project = Project.new project_params\n @project.user_id = @cur_user.id\n end\n\n respond_to do |format|\n if @project.save\n format.html do\n redirect_to @project, notice: 'Project was successfully created.'\n end\n format.json do\n render json: @project.to_hash(false),\n status: :created, location: @project\n end\n else\n flash[:error] = @project.errors.full_messages\n format.html { redirect_to projects_path }\n format.json do\n render json: @project.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def git_project_name\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} config --get remote.origin.url\")\n stdout.split('/')[-1].chomp(\".git\").chomp\n end\n end",
"def new_custom_project \n begin\n tree = eval(params[:tree])\n params[:package] = tree\n result = MavensMate.new_project(params)\n return if result.nil?\n kill_server unless ! result[:is_success] \n MavensMate.close_all_html_windows unless ! result[:is_success]\n render \"_project_new_result\", :locals => { :message => result[:error_message], :success => result[:is_success] }\n rescue Exception => e\n TextMate::UI.alert(:warning, \"MavensMate\", e.message)\n end\n end",
"def add_list_of_projects(object, html, projects)\n return if projects.blank?\n\n head2 = :show_name_create_draft.t + \": \"\n list = [head2] + projects.map do |project|\n item = link_to(*new_description_for_project_tab(object, project))\n indent + item\n end\n html2 = list.safe_join(safe_br)\n html += tag.p(html2)\n html\n end",
"def create\n @repository = @project.repositories.new(params[:repository])\n @repository.path = '/home/git/repositories'\n @repository.repo_name = @repository.name.downcase.gsub(\" \",\"_\")\n respond_to do |format|\n if @repository.save\n flash[:notice] = 'Repository was successfully created.'\n format.html { redirect_to([@project,@repository]) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end",
"def create\n @project = Project.new(params[:project])\n @project.creator_id = current_user.id\t \n respond_to do |format|\n if @project.save\n @project.users << current_user\n format.html { redirect_to project_path(@project), notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n @main_projects = Project.roots.where(creator_id: @project.creator_id)\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def projects\n my_proj = self.my_projects\n my_memb = self.collaborations\n my_proj + my_memb\n end",
"def fork_gist(id)\n boolean_request :post, \"/gists/#{id}/fork\"\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def projects\n tmp = client.get @json['user']['links']['projects']\n tmp['projects'].map do |project_meta|\n project_uri = project_meta['project']['links']['self']\n project = client.get project_uri\n client.factory.create(GoodData::Project, project)\n end\n end",
"def set_remote\n project_name = shift_argument\n\n unless project_name\n error(\"Usage: mortar projects:set_remote PROJECT\\nMust specify PROJECT.\")\n end\n\n unless git.has_dot_git?\n error(\"Can only set the remote for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n\n if git.remotes(git_organization).include?(\"mortar\")\n display(\"The remote has already been set for project: #{project_name}\")\n return\n end\n\n projects = api.get_projects().body[\"projects\"]\n project = projects.find { |p| p['name'] == project_name}\n unless project\n error(\"No project named: #{project_name} exists. You can create this project using:\\n\\n mortar projects:create\")\n end\n\n git.remote_add(\"mortar\", project['git_url'])\n display(\"Successfully added the mortar remote to the #{project_name} project\")\n\n end",
"def set_remote\n project_name = shift_argument\n\n unless project_name\n error(\"Usage: mortar projects:set_remote PROJECT\\nMust specify PROJECT.\")\n end\n\n unless options[:embedded]\n unless git.has_dot_git?\n error(\"Can only set the remote for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n\n if git.remotes(git_organization).include?(\"mortar\")\n display(\"The remote has already been set for project: #{project_name}\")\n return\n end\n end\n\n projects = api.get_projects().body[\"projects\"]\n project = projects.find { |p| p['name'] == project_name}\n unless project\n error(\"No project named: #{project_name} exists. You can create this project using:\\n\\n mortar projects:create\")\n end\n\n if options[:embedded]\n File.open(\".mortar-project-remote\", \"w\") do |f|\n f.puts project[\"git_url\"]\n end\n git.sync_embedded_project(project, embedded_project_user_branch, git_organization)\n else\n git.remote_add(\"mortar\", project[\"git_url\"])\n end\n\n display(\"Successfully added the mortar remote to the #{project_name} project\")\n\n end",
"def follow_project(project)\n ProjectFollower.make_follow self, project\n end",
"def url\n \"http://github.com/#{@account}/#{name}/tree/master\"\n end",
"def find_project(input)\n if (project = project_in_database(input))\n input[:local_project] = project\n else\n input[:remote_project] = project_from_github(input)\n end\n Success(input)\n rescue StandardError => e\n Failure(Response::ApiResult.new(status: :not_found, message: e.to_s))\n end",
"def new\n # Agrega el breadcrumb de la pagina new de proyecto\n add_breadcrumb I18n.t('project.new'), :controller => \"projects\", :action => \"new\"\n @project = Project.new\n end",
"def create(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n normalize! params\n assert_required_keys(REQUIRED_KEY_PARAM_NAMES, params)\n filter! VALID_REPO_OPTIONS, params\n\n post_request(\"/1.0/repositories/#{user}/#{repo.downcase}/fork\", params)\n end",
"def project(*names)\n new(names.map { |name| name.is_a?(Symbol) ? self[name] : name })\n end",
"def build\n CircleCi.request(@conf, \"/project/#{username}/#{project}\").post\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def setup_projects\n # noop\n end",
"def project\n raw = client.get project_url\n client.factory.create(GoodData::Project, raw)\n end",
"def project?(p)\r\n projects.include?(p)\r\n end",
"def create_project(project)\n \n update_project(project)\n \n # TODO: Need to handle this exception...\n if (File.directory? project.svn_dir) then\n raise StandardError, \"A project called #{project.display_name} already exists in the #{project.client.display_name} repository. Please delete it or choose an alternate project name and run this script again.\"\n end\n \n # create a new subversion repository\n say(\"Creating a new subversion repository...\")\n `svnadmin create #{project.svn_dir}`\n \n # import into svn\n say(\"Importing temporary project into the new subversion repository...\")\n `svn import #{project.template}/svn file:///#{project.svn_dir} --message \"initial import\"`\n \n # this should fix the 'can't open activity db error'\n `sudo chmod 770 #{project.svn_dir}`\n activites_file = File.join(project.svn_dir,\"/dav/activities\")\n if File.exists?(activites_file)\n `sudo chmod 755 #{activites_file}`\n `sudo chown www-data:www-data #{activites_file}`\n end\n \n # install default post commit hook\n hook_file = File.join(project.svn_dir,\"hooks\",\"post-commit\")\n Template.new(File.join(Config.subtrac_path, \"svn\", \"post-commit.erb\")).write(hook_file)\n `sudo chmod +x #{hook_file}`\n\n end",
"def create\n\t\t@project = Project.new(params[:project].merge({:user_id => present_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.created') }\n\t\t\t\tformat.json { render json: @project, status: :created, location: @project }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create_project\n unless options.force\n abort \"'#{project}' already exists\" if File.exist?( project ) \n end\n\n # copy over files from the master project data diretory in crate\n files = project_files\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each do |file|\n cp file \n end\n end\n end",
"def create_new_fork\n @story = Story.new({title: params[:story][:title], content: params[:story][:content], user_id: current_user.id})\n if @story.save\n # redirect to the new fork\n redirect_to story_path(@story)\n end\n end",
"def project_id\n project_id = Util::Git.get_config KEY_PROJECT_ID, :inherited\n\n if project_id.empty?\n project_id = choose do |menu|\n menu.prompt = 'Choose project associated with this repository: '\n\n client = TrackerApi::Client.new(:token => api_token)\n\n client.projects.sort_by { |project| project.name }.each do |project|\n menu.choice(project.name) { project.id }\n end\n end\n\n Util::Git.set_config KEY_PROJECT_ID, project_id, :local\n puts\n end\n\n project_id\n end",
"def create_project(project)\n create_or_update(project, nil, 'project', 'projects')\n end",
"def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def project(project_id)\n resource \"projects/#{project_id}\"\n end",
"def create_project(name, type)\nend",
"def ensure_fork_point(owner, repo)\n\n fork = ensure_repo(owner, repo, false)\n\n if fork[:forked_from].nil?\n warn \"Repo #{owner}/#{repo} is not a fork\"\n return nil\n end\n\n # Return commit if already specified\n unless fork[:forked_commit_id].nil?\n commit = db[:commits].where(:id => fork[:forked_commit_id]).first\n return commit unless commit.nil?\n end\n\n parent = db.from(:projects, :users).\\\n where(Sequel.qualify('projects', 'owner_id') => Sequel.qualify('users', 'id')).\\\n where(Sequel.qualify('projects', 'id') => fork[:forked_from]).\\\n select(Sequel.qualify('users', 'login'), Sequel.qualify('projects','name')).first\n\n if parent.nil?\n warn \"Unknown parent for repo #{owner}/#{repo}\"\n return nil\n end\n\n default_branch = retrieve_default_branch(parent[:login], parent[:name])\n\n # Retrieve diff between parent and fork master branch\n diff = retrieve_master_branch_diff(owner, repo, default_branch, parent[:login], parent[:name], default_branch)\n\n if diff.nil? or diff.empty?\n # Try a bit harder by refreshing the default branch\n default_branch = retrieve_default_branch(parent[:login], parent[:name], true)\n diff = retrieve_master_branch_diff(owner, repo, default_branch, parent[:login], parent[:name], default_branch)\n end\n\n if diff.nil? or diff.empty?\n # This means that the are no common ancestors between the repos\n # This can apparently happen when the parent repo was renamed or force-pushed\n # example: https://github.com/openzipkin/zipkin/compare/master...aa1wi:master\n warn \"No common ancestor between #{parent[:login]}/#{parent[:name]} and #{owner}/#{repo}\"\n return nil\n else\n debug \"Fork #{owner}/#{repo} is #{diff['ahead_by']} commits ahead and #{diff['behind_by']} commits behind #{parent[:login]}/#{parent[:name]}\"\n end\n\n if diff['ahead_by'].to_i > 0\n # This means that the fork has diverged, and we need to search through the fork\n # commit graph for the earliest commit that is shared with the parent. GitHub's\n # diff contains a list of divergent commits. We are sorting those by date\n # and select the earliest one. We do date sort instead of graph walking as this\n # would be prohibetively slow if the commits for the parent did not exist.\n earliest_diverging = diff['commits'].sort_by{|x| x['commit']['author']['date']}.first\n\n if earliest_diverging['parents'].nil?\n # this means that the repo was forked from the from the parent repo's initial commit. thus, they both share an initial commit.\n # example: https://api.github.com/repos/btakita/pain-point/compare/master...spent:master\n likely_fork_point = ensure_commit(parent[:name], earliest_diverging['sha'], parent['login'])\n else\n # Make sure that all likely fork points exist for the parent project\n # and select the latest of them.\n # https://github.com/gousiosg/github-mirror/compare/master...pombredanne:master\n likely_fork_point = earliest_diverging['parents'].\\\n map{ |x| ensure_commit(parent[:name], x['sha'], parent[:login])}.\\\n select{|x| !x.nil?}.\\\n sort_by { |x| x[:created_at]}.\\\n last\n end\n forked_sha = likely_fork_point[:sha]\n else\n # This means that the fork has not diverged.\n forked_sha = diff['merge_base_commit']['sha']\n end\n\n forked_commit = ensure_commit(repo, forked_sha, owner);\n\n debug \"Fork commit for #{owner}/#{repo} is #{forked_sha}\"\n\n unless forked_commit.nil?\n db[:projects].filter(:id => fork[:id]).update(:forked_commit_id => forked_commit[:id])\n info \"Repo #{owner}/#{repo} was forked at #{parent[:login]}/#{parent[:name]}:#{forked_sha}\"\n end\n\n db[:commits].where(:sha => forked_sha).first\n end",
"def branch_project\n\t\t\tif project_is_configured_for_git?\n\t\t\t\tbegin\n\t\t\t\t\t# use -d instead of -D so not to remove uncommitted changes\n\t\t\t\t\t`git branch -d hamlr`\n\t\t\t\t\t`git checkout -b hamlr`\n\t\t\t\trescue Exception => e\n\t\t\t\t\t$stderr.puts \"Oh snap! Error: #{e.message}\"\n\t\t\t\t\texit 1\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t$stderr.puts \"Use git please. I feel bad doing this work without it.\"\n\t\t\t\texit 1\n\t\t\tend\n\t\tend",
"def ensure_fork(owner, repo, fork_id)\n fork = retrieve_fork(owner, repo, fork_id)\n\n if fork.nil?\n warn \"Could not retrieve fork #{owner}/#{repo} -> #{fork_id}\"\n return\n end\n\n fork_name = if fork['full_name'].nil? then fork['url'].split(/\\//)[4..5].join('/') else fork['full_name'] end\n fork_owner = fork_name.split(/\\//)[0]\n fork_name = fork_name.split(/\\//)[1]\n\n r = ensure_repo(fork_owner, fork_name, true)\n\n if r.nil?\n warn \"Could not add #{fork_owner}/#{fork_name} as fork of #{owner}/#{repo}\"\n else\n info \"Added fork #{fork_owner}/#{fork_name} of #{owner}/#{repo}\"\n end\n r\n end",
"def github_projects\n Rails.cache.fetch(\"/users/#{self.id}/github_projects\", :expires_in => 1.day) {\n gh = Github.new(authentications.where(:provider => 'github').first.provider_token)\n gh.repos\n }\n end",
"def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end"
] |
[
"0.7000899",
"0.6796955",
"0.6410218",
"0.6164391",
"0.6145727",
"0.6117099",
"0.61133814",
"0.6104223",
"0.60817224",
"0.60664755",
"0.6032076",
"0.59603673",
"0.59322625",
"0.5931203",
"0.5917447",
"0.5913743",
"0.5909714",
"0.58901495",
"0.5862971",
"0.58540183",
"0.5851451",
"0.58510065",
"0.583638",
"0.5834324",
"0.58108604",
"0.58054054",
"0.5776226",
"0.57691866",
"0.5766212",
"0.5746623",
"0.5743982",
"0.57368034",
"0.5736421",
"0.5731734",
"0.5729025",
"0.5726828",
"0.57213074",
"0.5710656",
"0.57055175",
"0.5698637",
"0.5698637",
"0.56896174",
"0.5689597",
"0.56698257",
"0.56672513",
"0.5664676",
"0.5664676",
"0.566347",
"0.56604105",
"0.56434983",
"0.56318504",
"0.562673",
"0.56254876",
"0.56210357",
"0.561433",
"0.5612297",
"0.56101507",
"0.56067127",
"0.5602546",
"0.5595427",
"0.5594513",
"0.5594491",
"0.5590058",
"0.558567",
"0.5578668",
"0.5575454",
"0.55690986",
"0.555909",
"0.5557461",
"0.55560696",
"0.55496347",
"0.5539382",
"0.5539211",
"0.553625",
"0.5531049",
"0.5527325",
"0.55260015",
"0.5524017",
"0.55238307",
"0.5520301",
"0.55178285",
"0.55072117",
"0.5507139",
"0.55012065",
"0.54996055",
"0.5498768",
"0.54975915",
"0.5492299",
"0.5490308",
"0.5489408",
"0.54841286",
"0.5479003",
"0.5473235",
"0.5472238",
"0.54612166",
"0.5449913",
"0.54450727",
"0.5437506",
"0.5435751",
"0.54345554"
] |
0.8252669
|
0
|
GET /users GET /users.json def index
|
def index
authorize! :index, User
@datatable = UsersDatatable.new view_context
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n users = User.all\n json_response(users)\n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @title = 'user index'\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n if current_user\n @users = User.all\n render \"index_users.json.jb\"\n else\n render json: []\n end\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @users}\n end\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n json_response(User.all) \n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def index\n users = User.all\n render json: users \n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render :json => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def index\n users = User.all \n render json: users \n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n\t\trender json: User.all\n\tend",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end",
"def index\n\t\trender json: User.all\n\tend",
"def index\n render json: User.all\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\n\t\t# redirect_to \"http://google.com\"\n\t\t# render text: \"Hello!\"\n\t\t# render json: {name: \"Derk\", age: 27}\n\t\t# render json: User.first\n\n\t\t@user = User.first\n\t\t@users = User.all.entries\n\tend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n # render json: @users\n # commented out because a jbuilder template has been added\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n if not check_logged_in then\n return\n end\n @users = User.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { @users = User.all }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n\n users = User.all \n render json: users\n\n end",
"def index\n @users = User.all \n render json: @users, status: :ok \n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n render json: User.all\n end",
"def index\n render json: User.all\n end",
"def index\n @users = User.all\n @title = \"Пользователи\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end"
] |
[
"0.85333496",
"0.85263276",
"0.8451336",
"0.83828354",
"0.8381708",
"0.83795655",
"0.83712995",
"0.8360554",
"0.8356165",
"0.8350339",
"0.8280744",
"0.8264254",
"0.8264254",
"0.82625717",
"0.82575315",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82527727",
"0.82497364",
"0.82362664",
"0.8215711",
"0.82052606",
"0.8204939",
"0.8186083",
"0.8186083",
"0.8186083",
"0.8186083",
"0.81697774",
"0.81659514",
"0.8161953",
"0.8159309",
"0.8157974",
"0.8150088",
"0.8150088",
"0.8150088",
"0.8150088",
"0.8138597",
"0.8138597",
"0.8138597",
"0.8138597",
"0.8138597",
"0.8138597",
"0.8138597",
"0.8138597",
"0.8138597",
"0.8138597",
"0.81376666",
"0.81376666",
"0.81376666",
"0.81376666",
"0.81376666",
"0.81376666",
"0.81358576",
"0.8128619",
"0.812092",
"0.81181175",
"0.8108371",
"0.81059086",
"0.8101689",
"0.8065978",
"0.8065978",
"0.8053818",
"0.80536854",
"0.80499816",
"0.8022057",
"0.8009699",
"0.8000677",
"0.7997715",
"0.79974025",
"0.79683524",
"0.79683524",
"0.7968224"
] |
0.0
|
-1
|
GET /users/1 GET /users/1.json
|
def show
authorize! :show, @user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n json_response(User.all) \n end",
"def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n users = User.all\n render json: users \n end",
"def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"def index\n users = User.all \n render json: users \n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end"
] |
[
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.72222257",
"0.72165024",
"0.72137505",
"0.72096044",
"0.71930283",
"0.7182953",
"0.7182144",
"0.7182144",
"0.7180289",
"0.71750754",
"0.7173851",
"0.71640617",
"0.71636444",
"0.71453786",
"0.7145053",
"0.7129776",
"0.71256554",
"0.71160513",
"0.7095665",
"0.70941204",
"0.70772994",
"0.7070785",
"0.7070607",
"0.7063351",
"0.70552826",
"0.7025071",
"0.7014598",
"0.70047677",
"0.6998373",
"0.69910055",
"0.6984177",
"0.6979766",
"0.6972448",
"0.6972228",
"0.6968384",
"0.69666255",
"0.6956339",
"0.69506294",
"0.6945614",
"0.6943135",
"0.69351804",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6927094",
"0.69255126",
"0.6925136",
"0.6917375",
"0.6907744",
"0.68947464",
"0.6882589",
"0.6875701",
"0.68749416",
"0.68633634",
"0.6861618",
"0.6858055",
"0.6855495",
"0.68530583",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.6849599",
"0.6847195",
"0.6847074",
"0.6847074"
] |
0.0
|
-1
|
POST /users POST /users.json
|
def create
authorize! :create, User
@user = User.new(user_params)
if @user.save
flash[:notice] = 'User is created successfully. '
else
flash.now[:alert] = @user.errors.full_messages.first
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def create\n user = User.create(user_params) \n render json: user, status: :created\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end",
"def create\n user= User.create(user_params)\n render json: user\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend",
"def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create(options = {})\n request(:post, '/users.json', default_params(options))\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end",
"def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end",
"def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end",
"def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end",
"def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end",
"def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end",
"def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end",
"def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end",
"def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end",
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end",
"def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end",
"def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end",
"def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend",
"def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend",
"def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_user(options = {})\n post \"/users\", options\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(body)\n post 'create_user', body\n end",
"def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end",
"def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end",
"def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end",
"def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end",
"def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(attributes)\n post(\"/v1/users\", attributes)\n end",
"def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end",
"def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end",
"def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end",
"def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end",
"def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end",
"def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end"
] |
[
"0.77179813",
"0.75206673",
"0.73831296",
"0.72405374",
"0.719841",
"0.7140812",
"0.71038526",
"0.7058827",
"0.7041636",
"0.70236504",
"0.7003128",
"0.70021695",
"0.70021695",
"0.70021695",
"0.69936967",
"0.6990463",
"0.6980393",
"0.6979075",
"0.69788617",
"0.69788617",
"0.69762856",
"0.6962628",
"0.6952247",
"0.69454783",
"0.69454783",
"0.6920555",
"0.69181055",
"0.691467",
"0.6901315",
"0.6898759",
"0.689459",
"0.6889815",
"0.6880676",
"0.6880467",
"0.6880196",
"0.68797004",
"0.6877297",
"0.686924",
"0.6855058",
"0.6851115",
"0.6844058",
"0.6814104",
"0.6803589",
"0.6777842",
"0.6776859",
"0.67678535",
"0.6757897",
"0.67471397",
"0.6738628",
"0.6734963",
"0.6733872",
"0.6720612",
"0.6711659",
"0.6670256",
"0.66581875",
"0.66573423",
"0.6654514",
"0.6638977",
"0.66325235",
"0.66199607",
"0.6615226",
"0.66148156",
"0.65989614",
"0.65910506",
"0.65792614",
"0.6578957",
"0.6573529",
"0.6573351",
"0.6557221",
"0.6553408",
"0.6551572",
"0.65466446",
"0.6540912",
"0.65399504",
"0.6538697",
"0.6535891",
"0.6533581",
"0.6526114",
"0.65116656",
"0.65072525",
"0.6507116",
"0.6503024",
"0.6490388",
"0.6488653",
"0.64881754",
"0.6473845",
"0.64722794",
"0.64702916",
"0.64702916",
"0.6469406",
"0.64682525",
"0.6462379",
"0.64619774",
"0.646129",
"0.6455196",
"0.645272",
"0.6448271",
"0.6447503",
"0.64468706",
"0.64460355",
"0.6441883"
] |
0.0
|
-1
|
PATCH/PUT /users/1 PATCH/PUT /users/1.json
|
def update
authorize! :update, @user
if @user.update(user_params)
flash.now[:notice] = '@user was successfully updated.'
else
flash.now[:alert] = @user.errors.full_messages.first
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update_user(options)\n patch(\"/user\", options, 3)\n end",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end",
"def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end",
"def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end",
"def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user.update(user_params)\n respond_with @user\n end",
"def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend",
"def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end",
"def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end",
"def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end",
"def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7225568",
"0.7129473",
"0.70036036",
"0.6903525",
"0.6821961",
"0.68157715",
"0.6708618",
"0.66936064",
"0.66810983",
"0.6673763",
"0.6672601",
"0.6664346",
"0.6664346",
"0.6659468",
"0.6659468",
"0.6654875",
"0.66486204",
"0.66436917",
"0.6641295",
"0.6635214",
"0.6618464",
"0.66153306",
"0.6610267",
"0.6607359",
"0.6583569",
"0.65825915",
"0.65820843",
"0.65801483",
"0.65615994",
"0.6558883",
"0.6558883",
"0.6543664",
"0.6537492",
"0.6515997",
"0.6514648",
"0.65062994",
"0.65054137",
"0.65054137",
"0.65015376",
"0.6468482",
"0.6466442",
"0.64641905",
"0.6453641",
"0.64496416",
"0.6443516",
"0.6441606",
"0.6437562",
"0.6428467",
"0.6428467",
"0.64279026",
"0.6427495",
"0.64269704",
"0.6424723",
"0.6424723",
"0.64239854",
"0.6418606",
"0.64156115",
"0.6411428",
"0.64053625",
"0.6405119",
"0.6398354",
"0.63945407",
"0.6390761",
"0.63903916",
"0.63876307",
"0.6383881",
"0.63834596",
"0.63829523",
"0.6382388",
"0.63776475",
"0.63752687",
"0.6374351",
"0.63735604",
"0.6373269",
"0.6370833",
"0.6363397",
"0.63607967",
"0.6360649",
"0.6356513",
"0.6356091",
"0.6350332",
"0.6342926",
"0.6334242",
"0.6333647",
"0.6328633",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188"
] |
0.0
|
-1
|
DELETE /users/1 DELETE /users/1.json
|
def destroy
authorize! :destroy, @user
@user.destroy
respond_to do |format|
format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end",
"def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7245172",
"0.7242216",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_user
@user = User.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def user_params
params.require(:user).permit(:email, :password, :password_confirmation, :mobile, :name, :admin)
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]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"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.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
just return a number does not return a rank, just sort all the users to have a rank type is either :cash or :tourney
|
def virtual_rank(type, group)
return chips(group.id) if type == :cash
return tourney_rank(group) if type == :tourney
raise "invalid type for rankings (#{type.to_s}})"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rank() User.withVerifiedWeighins.paid.sort_by {|u| u.percentWeightChange }.index(self)+1 end",
"def f2p_clues_rank(clue_type)\n f2p_rank [[\"clues_#{clue_type}\", :DESC],\n [\"id\", :ASC]]\n end",
"def sort_using_rank\n score[1]\n end",
"def rank\n BetaUser.where(selected: false).order(score: :desc).index(self)\n end",
"def user_rank!\n r = 1\n users.order('rating DESC').each do |u|\n user_universities.find_by_user_id(u.id).update_attribute(:rank, r)\n r += 1\n end\n end",
"def rank_actors \n top_actors.inject([]) do |sorted, element|\n sorted << if sorted.last and sorted.last[:count] == element.last[:count]\n { :actor => element.first, :count => element.last[:count], :rank => sorted.last[:rank] }\n else\n { :actor => element.first, :count => element.last[:count], :rank => sorted.length + 1 }\n end\n end\n end",
"def rank\n @rank > 10 ? 10 : @rank\n end",
"def get_rank\n hash = Hash[UserGame.for_game(self.game.id).by_portfolio_value.map.with_index.to_a]\n if hash[self] == 0\n return 1\n else\n x = hash[self]\n while x > 0 && hash.key(x).get_portfolio == hash.key(x-1).get_portfolio\n x -= 1\n end\n return x + 1\n end\n end",
"def rank\n\t\tRANKINGS.each do |ranking|\n\t\t\treturn ranking if self.send(\"#{ranking}?\".to_sym)\n\t\tend\n\tend",
"def rank\n case @owner\n # Prefer volumes from Princeton most strongly\n when 'njp'\n @rank = 4\n # Recap partners are next in order of preference\n when 'nyp', 'nnc1', 'nnc2.ark'\n @rank = 3\n # Followed by Borrow Direct partners\n when 'yale', 'hvd', 'coo', 'chi'\n @rank = 2\n # These are mentioned by Meagan\n when 'mdp', 'miun', 'uc1', 'uc2', 'loc.ark', 'uva', 'umn', 'dul1.ark', 'ien', 'inu', 'nc01.ark', 'pst', 'pur1', 'ucm', 'uiug', 'wu'\n @rank = 1\n # Anything else is unknown; rank lowest.\n else\n @rank = 0\n end\n @rank # return the rank\n end",
"def ranks \n r = {}\n data_hash = User.all_ranks \n return data_hash[self.id]\n end",
"def rank(result_array)\n # Highest first.\n return result_array.sort_by{ |hash| - hash[:score] + (hash[:enabled]==false ? 10 : 0) }\n end",
"def status_sort\n user_id_giver and user_id_receiver ? 1 : 2\n end",
"def calculate_rank(type, news)\n case type\n when :like\n news.like_count += 1\n return 2\n when :unlike\n news.unlike_count += 1\n return -1\n when :watch\n news.watch_count += 1\n return 1\n when :share\n news.share_count += 1\n return 4\n when :comment\n news.comment_count += 1\n return 3\n when :report\n if admin_logged_in?\n return 2\n end\n return 5\n when :focus # ?��??��?\n return 3\n end\n end",
"def size_to_rank(size)\n rank = 1\n map = {}\n for mapped_size in users_by_size.keys.sort.reverse\n return rank if size == mapped_size\n rank += 1\n end\nend",
"def get_access_rank\n guest_user_rank = 4\n user = get_user()\n if user != nil\n current_user = User.find_by user_id: \"#{user}\"\n user_rank = current_user.access_rank\n\n #Handler if user access rank missing\n if user_rank === nil\n flash[:notice] = \"Problem getting user access level.\n Please contact site administrator.\"\n user_rank = guest_user_rank\n end\n\n user_rank\n\n else\n user_rank = guest_user_rank\n end\n end",
"def rank; end",
"def rank; end",
"def sortRanks(ranks)\n sorted = []\n\n ranks.each do |c|\n if (c =~ /[0-9]/)\n sorted << c.to_i\n else\n case c\n when 'T'\n sorted << 10\n when 'J'\n sorted << 11\n when 'Q'\n sorted << 12\n when 'K'\n sorted << 13\n when 'A'\n sorted << 14\n end\n end\n end\n\n sorted.sort\nend",
"def sort_ranks(_ranks)\n raise NotImplementedError\n end",
"def rank_by_size\n ranked_users = []\n for size in users_by_size.keys.sort.reverse\n ranked_users.push(users_by_size[size])\n end\n\n return ranked_users\nend",
"def index\n users = User.all.select(:id, :username, :guild_id).with_otp\n @result = users.map{|user| user.as_json.merge({\n guild_name: user.guild ? user.guild.name : \"Not in a guild\",\n score: Match.where(challenged: false, winner: user.id).size,\n my_user: (user == current_user),\n route: '#users/' + user.id.to_s\n })}\n @result.sort_by! { |res| -res[:score] }\n @result = @result.map { |i| i.merge({ rank: @result.find_index{ |user| user[\"id\"] == i[\"id\"] }.to_i + 1 }) }\n render json: @result.as_json, status: :ok\n end",
"def update_user_ranking\n return if last_rank? || self.changes[:score].nil? || self.changes[:rank].present?\n old_score, new_score = self.changes[:score]\n User::LEVELS.each do |threshold|\n if old_score < threshold && new_score >= threshold\n self.update(rank: self[:rank] + 1, levelled_up: true)\n end\n end\n end",
"def ranking\n [what_rank, tie_breaker]\n end",
"def top_ten_users\n # Get top 3 dank ranks total scores\n top_danks = DankRank.order('total_score DESC').limit(6)\n # For each top dank_rank, retrieve [lvl, points, id]\n top_users = top_danks.map { |dank| [User.find(dank.user_id).dank_rank.total_score, User.find(dank.user_id).dank_rank.rank_up_xp_progress, User.find(dank.user_id).id] }\n # Sort that array by level and then points\n top_users.sort!{|a, b| b <=> a}\n # Return the users\n return top_users.map { |array| User.find(array[2]) }\n end",
"def sort\n @items.sort { |x,y| x.rank <=> y.rank }\n end",
"def ranked_points\n points.to_f/User.top_ranked.points.to_f * 100\n end",
"def what_rank\n 10 - all_ranks.find_index{ |truth| truth != 2014} \n end",
"def type\n rank.first\n end",
"def index\n @bettors = User.paid.sort {|x,y| y.total_points <=> x.total_points }\n end",
"def sort_ranking\n @sorted_hash = @hash_ranking.sort_by { |_name, points| -points }\n @sorted_hash = @sorted_hash.first(10)\n @sorted_hash.map { |k, v| \"#{k}\\t#{v}\" }.join(\"\\n\")\n end",
"def setup_rank_by_consulting\n @sem_studs_hash.sort_by{|x| x[:last_consultant_day]}.map{|x| x[:user]}\n end",
"def index\n @rankings = Prediction.select(\"user_id, name, sum(score) as score\")\n .joins(:user) \n .group(\"user_id, name\")\n .order(\"score DESC, name ASC\")\n .paginate(page: params[:page])\n end",
"def rank\n return inv + neg + nsp\n end",
"def cards_by_rank\n @cards_by_rank ||= @cards.group_by(&:rank).sort do |b,a|\n cmp_key_a, cmp_key_b = [a, b].map {|entry| entry[1]}\n\n cmp = cmp_key_a.count <=> cmp_key_b.count\n cmp.zero? ? cmp_key_a.first <=> cmp_key_b.first : cmp\n end.to_h\n end",
"def invertirRanking(unPunto, otroPunto)\n # ToDo\n end",
"def calculate_rank_and_grade \n points_off = 0\n points_off += self.opt_out_count * 5 \n points_off += self.un_solicited_count * 10 \n points_off += self.sell_count * 21 \n points_off += self.vulgar_count * 31 \n points_off = points_off/(self.surveys.count) \n result = case rank = 100 - points_off\n when 96..500 then \"A+\"\n when 90..95 then \"A-\"\n when 80..89 then \"B\"\n when 70..79 then \"C\"\n when 60..69 then \"D\"\n when 0..60 then \"F\"\n end\n self.grade = result\n self.rank = rank\n end",
"def ranks\n @teams = Team.where(\"wins > 0\t\").order(win_percentage: :desc)\n end",
"def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end",
"def users_ranking\n User.find_by_sql(\"SELECT U.id, U.name, COUNT(R.id) ediciones\n FROM users U, reviews R, species S, groups G, group_users GU, species_groups SG, models m\n WHERE U.id = R.user_id AND U.id = GU.user_id AND GU.group_id = G.id\n AND SG.group_id = G.id AND S.id=SG.species_id AND m.id =R.model_id\n AND m.species_id = S.id AND SG.species_group_state_id=1 AND GU.group_user_state_id=1\n AND G.id = \"+self.id.to_s+\"\n GROUP BY U.name\n ORDER BY COUNT(R.id) DESC\n LIMIT 10\")\n end",
"def navy_rank; end",
"def ranked\n Account.find(self.ranked_id)\n end",
"def update_user_rank\n\n\t\tif self.admin?\n\t\t\tself.rank = Rank.admin\n\t\telse\n\t\t\tself.rank = nil\n\t\t\tRank.where(system: false).order('requirement ASC').each do |rank| \n\t\t\t\tif self.posts.count >= rank.requirement\n\t\t\t\t\tself.rank = rank\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tself.save\n\tend",
"def ranked_candidates\n Array(@ranking - [UNRANKED_ID]).flatten.sort\n end",
"def get_reindeer_ranking\n return @reindeer_ranking\n end",
"def get_interest_rank\n \n rank = (self.stories.count * 2) + (self.adding_users.count * 5)\n\n end",
"def reindeer_ranking\n\t\t\treindeer = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n\t\tend",
"def rank_precedence() = RANKS_SCORES[self.rank]",
"def rankval ( rank )\n if rank.is_a? Numeric\n return rank\n elsif rank ==\"J\"\n return (11)\n elsif rank ==\"Q\"\n return (12)\n elsif rank ==\"K\"\n return (13)\n elsif rank ==\"A\"\n return (14)\n end\t #if\nend",
"def calculate_rank(gravity=1.8)\n item_hour_age = (Time.now - created_at) / 3600 \n return (vote_score - 1) / (item_hour_age+2) ** gravity\n end",
"def candidates_above_default\n Array(@ranking[0...@default_rank]).flatten.sort\n end",
"def rank\n send_to_rankers(rankables.prune!)\n end",
"def rank\n @team_records.sort_by! do |team|\n team.wins\n end #still correct\n @team_records.reverse! #up until here we're okay\n\n @team_records.each_with_index do |team, index| #line that doesn't function as expected\n team.rank = index + 1 #returns only two teams repeated twice, with wrong indexes\n end\n end",
"def index\n @users = User.all\n @users = User.order(\"rank ASC\").paginate(page: params[:page], :per_page => 20)\n end",
"def top_3_rank_contributors\n top_3 = User.top_contributors_by_rank.select { |user| user.rank <= 3 }\n\n top_3.map do |user|\n {\n user_id: user.id,\n first_name: user.first_name,\n last_name: user.last_name,\n photo_url: user.photo_url,\n badges_sum: user.badges_sum,\n badges_count: user.badges_count,\n rank: user.rank,\n badges: {\n gold: user.gold.to_i,\n silver: user.silver.to_i,\n bronze: user.bronze.to_i\n }\n }\n end\n end",
"def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end",
"def news_rank_action(user, news, type)\n\n rank = calculate_rank(type, news)\n\n # update news rank\n news.rank += rank\n news.save\n\n if (user != nil)\n #update friendship rank\n update_my_news_rank(user, news, rank)\n\n user.inverse_friends.each do |friend|\n update_user_news_rank(friend, news, rank)\n end\n end\n end",
"def army_rank; end",
"def users_leaderboard\n self.users.order(\"users.total_score DESC\").where(\"users.has_voted\" => true)\n end",
"def rank\n created_utc = T.must(self.created_utc)\n month = \"#{created_utc.year}-#{created_utc.month}\"\n top_100 = Post.top_100_for_month(month)\n # byebug\n if top_100.find_by(id: id).present?\n top_100.pluck(\"id, RANK() OVER(ORDER BY score DESC)\").to_h[id]\n end\n end",
"def ranking\n reindeer_hash = {}\n reindeer_arr = []\n puts \"Please rank reindeer with \\n numerical value 1 to 9\\n 1 being most favorite\\n 9 being least.\\n\"\n @reindeer_ranking.each do |reindeer|\n p reindeer\n reindeer_hash[reindeer] = gets.to_i\n end\n @reindeer_ranking = reindeer_hash\n p \"#{@name} Your favorite reindeer is #{@reindeer_ranking.key(1)}\"\n reindeer_hash.sort_by {|key, value| value }\n @reindeer_ranking.each do |key, value|\n reindeer_arr.insert(value - 1, key)\n end\n @reindeer_ranking = reindeer_arr.compact!\n puts\n end",
"def comparer_methods\n super + [\n :four_of_a_kind_rank,\n :kicker_rank\n ]\n end",
"def candidates_below_default\n Array(@ranking[@default_rank+1...@ranking.length]).flatten.sort\n end",
"def rank\n\t\t\t(const_defined?('Rank')) ? const_get('Rank') : NormalRanking\n\t\tend",
"def comparer_methods\n super + [\n :highest_rank,\n :second_highest_rank,\n :third_highest_rank,\n :fourth_highest_rank,\n :fifth_highest_rank\n ]\n end",
"def tournament_players_sorted_by_prestige\n TournamentPlayer.where(:tournament_id => self.id).order(\"prestige DESC\").order(\"match_points DESC\")\n end",
"def rank_for_print\n rank_print = @rank\n case @rank\n when :A then rank_print = \"Ace\"\n when :K then rank_print = \"King\"\n when :Q then rank_print = \"Queen\"\n when :J then rank_print = \"Jack\"\n end\n rank_print\n end",
"def _user_reference_ranking(text, profile)\n user_references = text.split(WORD_DELIMITER).find_all do |word|\n word.match(/^@/)\n end\n \n return 100 if user_references.size == 0\n\n user_references.inject(0) do |ranking, user|\n ranking + (profile.user_mentions.has_key?(user) ? (100 / user_references.size) : 0)\n end\n end",
"def rank\n groups = PoliceGroup.all.sort_by(&:grand_total)\n index = groups.index(self) + 1\n place = index / groups.size.to_f\n if place > 0.75\n 'High'\n elsif place > 0.25\n 'Moderate'\n else\n 'Low'\n end\n end",
"def default_sort\n if results_limit\n order(MasterRank).limit(results_limit)\n else\n order(MasterRank).all\n end\n end",
"def get_ranks\n ranks = {}\n ('2'..'10').each { |num_str| ranks[num_str] = num_str }\n ranks.merge!({ \"J\" => \"Jack\", \"Q\" => \"Queen\", \"K\" => \"King\", \"A\" => \"Ace\" })\nend",
"def re_rank\n all_member.each(&:uncache_rank_key)\n next_rank = 0\n all_member.\n sort_by(&:rank_key).\n each do |member|\n member.ordinal = next_rank\n next_rank += 1\n end\n end",
"def comparer_methods\n super + [\n :min_rank\n ]\n end",
"def score\n if g = royal_flush?\n r = 5000\n elsif g = straight_flush?\n r = 4000 + g.last.rank\n elsif g = four_of_a_kind?\n r = 3500 + g.first.rank\n elsif g = full?\n high1 = three_of_a_kind?.first.rank\n high2 = pair?.first.rank\n r = 3000 + high1 * 100 + high2\n elsif g = flush?\n highest = g.last.rank\n r = 2500 + highest\n elsif g = straight?\n r = 2000 + g.last.rank\n elsif g = three_of_a_kind?\n r = 1500 + 100 * g.first.rank\n elsif g = two_pairs?\n high1 = g.last.rank\n high2 = g.first.rank\n r = 1000 + 100 * high1 + high2\n elsif g = pair?\n r = 500 + g.first.rank\n else\n g = highest?\n r = highest?.rank\n end\n [val - [g].flatten, r]\n end",
"def display_score score, rank\r\n\r\n end",
"def comparer_methods\n super + [\n :three_of_a_kind_rank,\n :pair_rank\n ]\n end",
"def normalizeRankings\n setRankings = []\n ranking.each do |allRanking|\n if(allRanking.rank != nil)\n setRankings.push(allRanking)\n end\n end\n \n #setRankings = ranking.where.not(:rank => nil)\n setRankings.order(:rank, :desc)\n setRankings.each_with_index do |iterationRanking, index|\n iterationRanking.rank = index + 1\n end\n end",
"def calories_ranking(db, time_frame)\n ranking= {}\n users = db.execute(\"SELECT * FROM members\")\n users.each do |user|\n id =user['id']\n ranking[user['name']] = case time_frame \n when \"week\" then calories_week(db, id)\n when \"month\" then calories_month(db, id)\n else calories_burned(db, id) \n end \n end\n new_ranking= ranking.sort_by {|name, calories| calories}.reverse.to_h\n new_ranking.each {|name, calories| puts \"#{name}: #{calories} calories burned\"}\nend",
"def fix_rtype(rtype, rank)\n rtype += rank.to_s if rtype == 'top'\n rtype\nend",
"def ranked_repositories\n repositories_review.sort_by do |repository|\n repository.fully_reviewed? ? 1 : -1\n end\n end",
"def player_sort()\n\t\tsession[:player].sort {|a, b| a.total_score <=> b.total_score }\n\tend",
"def ranks(already_sorted=false)\n a = already_sorted ? self : sort\n map { |i| (a.index(i) + a.rindex(i)) / 2.0 }\n end",
"def get_user_rank(user_id)\n return $db.execute(\"SELECT rank FROM users WHERE id = ?\", user_id)[0][\"rank\"]\nend",
"def rank_name(rank)\n if rank==2\n return \"Two\"\n elsif rank ==3\n return (\"Three\")\n elsif rank ==4\n return (\"Four\")\n elsif rank ==5\n return (\"Five\")\n elsif rank ==6\n return (\"Six\")\n elsif rank ==7\n return (\"Seven\")\n elsif rank ==8\n return (\"Eight\")\n elsif rank == 9\n return (\"Nine\")\n elsif rank ==10\n return (\"Ten\")\n elsif rank ==\"J\"\n return (\"Jack\")\n elsif rank ==\"Q\"\n return (\"Queen\")\n elsif rank ==\"K\"\n return (\"King\")\n elsif rank ==\"A\"\n return (\"Ace\")\n end\t #if\nend",
"def find_relative_ranks(nums)\n output = Array.new(nums.length, nil)\n sorted_nums = nums.sort\n rank = nums.length\n \n sorted_nums.each do |n|\n idx = nums.find_index(n)\n \n ranking = case rank\n when 1\n \"Gold Medal\"\n when 2\n \"Silver Medal\"\n when 3\n \"Bronze Medal\"\n else\n rank.to_s\n end\n \n output[idx] = ranking\n rank -= 1\n end\n output\nend",
"def leaderboard\n self.joins(:user).\n select('SUM(score) AS score, users.name, users.uid, users.oauth_token').\n where('score > 0').\n group('users.name, users.uid, users.oauth_token').order('sum(score) desc')\n end",
"def sorted_top_users\n add_github_user('redline6561')\n followers = github.get_followers('redline6561',1,100)\n followers.map { |x| x['login'] }.sample(20).each do |username|\n add_github_user(username)\n end\n\n Cheepcreep::GithubUser.order(:followers => :desc).each do |u|\n puts \"User: #{u.login}, Name: #{u.name}, Followers: #{u.followers}\"\n end\nend",
"def set_ranking(value)\n\t\t@ranking = value\n\tend",
"def ranking(limit=4)\n return [] unless self.votes ## empty array if no ranks\n self.votes.map.sort {|x, y| y[1] <=> x[1] }.collect {|y| y[0] }[0..limit]\n end",
"def index\n \n\t@rankings = User.all(:order => 'entire_stars_count DESC', :conditions => {:fam_id => @user.fam_id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def leaderboard\n # TODO: there's probably a smart way to do this in DM\n User.all.map do |u|\n s = u.best_submission_for(self)\n [u, s] if s\n end.compact.sort_by { |u,s| [s.score, s.created_at] }\n end",
"def rank_by_only_points\n list = self.tournament.get_ranked_list_from_only_points.to_a;\n #return (list.index(self) + 1);\n #this was a nice idea, but it doesn't work because of ties\n \n i = 0;\n current_rank = 1;\n previous_points = -1;\n number_tied_teams = 0;\n while list[0] != self #go through list until we find us\n #if points of team before was the same, no rank increase\n #but we count the number of teams on same points\n #then add them all at once to the rank\n if (previous_points > list[0].points) || (previous_points == -1)\n current_rank = current_rank + number_tied_teams + 1;\n previous_points = list[0].points;\n number_tied_teams = 0;\n else #in this case we had teams on same num points\n number_tied_teams = number_tied_teams + 1;\n end\n i = i + 1;\n end\n\n return current_rank;\n end",
"def rank\n return @rank\n end",
"def find_relative_ranks(nums)\n hash = {}\n nums.each_with_index do |num, index|\n hash[num] = index\n end\n hash = hash.sort.to_h\n print hash\n count = 0\n hash.each do |k, v|\n if count == nums.size - 3\n nums[v] = \"Bronze Medal\"\n elsif count == nums.size - 2\n nums[v] = \"Silver Medal\"\n elsif count == nums.size - 1\n nums[v] = \"Gold Medal\"\n else\n nums[v] = (nums.size - count).to_s\n end\n count += 1\n end\n nums\nend",
"def array_suit_rank\n h = []; d = []; c = []; s = []\n (0..6).each { |i|\n h << (@cards[i][1]) if @cards[i][0] == 1\n d<<(@cards[i][1]) if @cards[i][0] == 2\n c<<(@cards[i][1]) if @cards[i][0] == 3\n s<<(@cards[i][1]) if @cards[i][0] == 4 }\n # sort rank in any suit\n { :suit_H => h, :suit_D => d, :suit_C => c, :suit_S => s }.each { |suit, rank|\n rank.sort! { |first, second| second <=> first } }\n end",
"def index\n sort_group = [\"id\",\"realname\",\"vote_count\"];\n @sorted = {};\n sort_group.each do |x|\n @sorted[x.to_sym]=0\n end\n if !params[:sort_by].nil?\n sort(params[:sort_by],params[:sort_type])\n else\n @manage_users = Manage::User.all\n end\n\n end",
"def get_rank\n list = self.tournament.rounds.to_a;\n #this list will be chronological already\n\n i = 0;\n while list[i].id != self.id\n i = i + 1;\n end\n return (i + 1);\n end",
"def ranks\n @ranks ||= RANK_RANGE.map(&:to_i)\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end",
"def get_current_ranking\r\n self.bid = self.bid.sort { |a, b| a.value <=> b.value }\r\n end"
] |
[
"0.67329633",
"0.6563013",
"0.6537982",
"0.64468825",
"0.6280818",
"0.6235899",
"0.62220144",
"0.6175744",
"0.6169046",
"0.6165289",
"0.61638117",
"0.615843",
"0.614226",
"0.6095294",
"0.60907006",
"0.60687727",
"0.60665387",
"0.60665387",
"0.6041314",
"0.5996539",
"0.596579",
"0.59416956",
"0.5939277",
"0.5918072",
"0.5909728",
"0.59062874",
"0.5896195",
"0.5894796",
"0.5891166",
"0.5880535",
"0.5875541",
"0.5870298",
"0.58572894",
"0.58424234",
"0.5829032",
"0.5816264",
"0.5813842",
"0.5807124",
"0.579641",
"0.5786607",
"0.57847565",
"0.57703704",
"0.57692987",
"0.57666934",
"0.5763457",
"0.5760948",
"0.5748451",
"0.5737405",
"0.5734536",
"0.5709027",
"0.570805",
"0.57075816",
"0.5704205",
"0.5701781",
"0.5700558",
"0.57001",
"0.5686204",
"0.5686075",
"0.568162",
"0.56790465",
"0.5675415",
"0.5664271",
"0.56608623",
"0.5642096",
"0.56224185",
"0.56204826",
"0.5602452",
"0.55813724",
"0.5576087",
"0.55736125",
"0.55733424",
"0.5572312",
"0.55698985",
"0.5553848",
"0.5543789",
"0.5539037",
"0.5519335",
"0.5518379",
"0.5515146",
"0.55130607",
"0.5508942",
"0.5507238",
"0.5505857",
"0.5491349",
"0.54818654",
"0.5481361",
"0.54716134",
"0.5467136",
"0.54666585",
"0.5464244",
"0.5461776",
"0.5461679",
"0.5460238",
"0.54586124",
"0.5455062",
"0.5450672",
"0.5449926",
"0.54451585",
"0.5437167",
"0.5426351"
] |
0.64397794
|
4
|
Write a method named xor that takes two arguments, and returns true if exactly one of its arguments is truthy, false otherwise.
|
def xor?(x, y)
return true if x && !y
return true if y && !x
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def xor?(arg1, arg2)\n if arg1 && !arg2\n true\n elsif !arg1 && arg2\n true\n else \n false\n end\nend",
"def xor?(first_arg, second_arg)\n return true if first_arg == false && second_arg == true\n return true if first_arg == true && second_arg == false\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2 || !arg1 && arg2\n true\n else\n false\n end\nend",
"def xor?(arg1, arg2)\r\n (arg1 && !arg2) || (arg2 && !arg1)\r\nend",
"def xor?(arg1, arg2)\r\n\r\nend",
"def xor?(arg1, arg2)\n if arg1 && arg2\n false\n elsif !arg1 && !arg2\n false\n else \n true\n end\nend",
"def xor?(arg1, arg2)\n (arg1 && !arg2) || (arg2 && !arg1) ? true : false\nend",
"def xor?(arg_1, arg_2)\n if (arg_1 && arg_2) \n return false\n elsif (arg_1 || arg_2)\n return true\n else\n return false\n end\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2 ||\n !arg1 && arg2\n return true\n else\n return false\n end\nend",
"def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end",
"def xor?(arg1, arg2)\n if !!arg1 == !!arg2\n false\n else\n true\n end \nend",
"def xor?(arg1, arg2)\n return true if arg1 && !arg2\n return true if arg2 && !arg1\n false # necessary because previous line returns nil (not false) if condition falsey\nend",
"def xor?(arg1, arg2)\r\n (arg1 || arg2) == true && (arg1 && arg2) == false\r\nend",
"def xor2?(arg1, arg2)\n (arg1 && !arg2) || (!arg1 && arg2)\nend",
"def xor?(argument_1, argument_2)\n if argument_1\n if argument_2 == false\n return true\n else\n return false\n end\n elsif argument_2\n if argument_1 == false\n return true\n else \n return false\n end\n else\n return false\n end\nend",
"def xor?(one, two)\n if one && two\n false\n elsif one || two\n true\n else\n false\n end\nend",
"def xor?(arg1, arg2)\n if arg1\n if arg2\n false\n else\n true\n end\n else\nif arg2\n true\n else\n false\n end\n end\nend",
"def xor?(one, two)\n return true if one && !two\n return true if two && !one\n\n false\nend",
"def xor?(parameter1, parameter2)\r\n return true if parameter1 == true && parameter2 == false\r\n return true if parameter1 == false && parameter2 == true\r\n return false if parameter1 == false && parameter2 == false\r\n return false if parameter1 == true && parameter2 == true\r\nend",
"def xor?(x, y)\n (x || !y) || (y && !x)\nend",
"def xor?(one, two)\n (one && !two) || (two && !one)\nend",
"def xor?(a,b)\n if a && !b\n true\n elsif !a && b\n true\n else\n false\n end\nend",
"def xor?(x, y)\n (x && !y) || (!x && y)\nend",
"def xor(a,b)\n if (a == true && b == true) || (a == false && b == false)\n return false\n else\n return true\n end\nend",
"def xor?(first, second)\n (first && !second) || (!first && second)\nend",
"def xor?(a, b)\n return true if a && !b\n return true if !a && b\n false\nend",
"def xor?(op_1, op_2)\n (op_1 == true && op_2 == false) || (op_1 == false && op_2 == true) \nend",
"def xor?(one, two)\n if ((one == true) && (two == false))\n true\n elsif ((one == false) && (two == true))\n true\n else\n false\n end\nend",
"def xor?(op1, op2)\n (op1 || op2) && !(op1 && op2)\nend",
"def xor?(input1, input2)\n if input1 && input2\n false\n elsif \n input1 || input2\n true\n else \n false\n end \nend",
"def xor(x, y)\n\nend",
"def xor?(this, that)\n (!this && that) || (this && !that)\nend",
"def xor?(a, b)\n if (a == true && b == false) || (a == false && b == true)\n true\n end\nend",
"def xor?(bool_1, bool_2)\n bool_1 == bool_2 ? false : bool_1 || bool_2\nend",
"def xor?(num1,num2)\n if num1 == true && num2 == false\n return true\n elsif num1 == false && num2 == true\n return true\n else\n return false\n end\nend",
"def xor?(num1, num2)\n (num1 && num2) || (!num2 && !num1) ? false : true\nend",
"def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n\n false\nend",
"def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n false\nend",
"def xor?(boolean1, boolean2)\n boolean1 != boolean2\nend",
"def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend",
"def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend",
"def xor?(condition1, condition2)\n if condition1 \n return true if !condition2\n elsif condition2\n return true if !condition1\n end\n false\nend",
"def xor?(expression1, expression2)\n if expression1 == true && expression2 == true\n false\n elsif expression1 == false && expression2 == false\n false\n else\n true\n end\nend",
"def xor(*args)\n args.inject(self, :^)\n end",
"def xor?(num1, num2)\n\n # If num1 is true and num2 is false, we're still going to return true\n return true if num1 && !num2\n # If num2 is true and num1 is false, we're still going to return true\n return true if num2 && !num1\nend",
"def xor?(value1, value2)\n (value1 || value2) && !(value1 && value2)\nend",
"def p1(x, y, z)\n # x or y\n xor(x, y)\nend",
"def xor?(bool1, bool2)\n !(bool1 && bool2) && (bool1 || bool2)\nend",
"def xor?(bool1, bool2)\n (bool1 && !bool2) || (!bool1 && bool2) # (I think that would work because by definition they are mutually exclusive conditions)\nend",
"def xor?(value1, value2)\r\n !!((value1 && !value2) || (value2 && !value1)) # !! forces the return to be a boolean\r\nend",
"def xor?(condition1, condition2)\n condition1 ? !condition2 : !!condition2\nend",
"def xor?(bool1, bool2)\n !!bool1 != !!bool2\nend",
"def xor?(value1, value2)\n !!((value1 && !value2) || (value2 && !value1))\nend",
"def xor?(bool1, bool2)\n (bool1 || bool2) && !(bool1 && bool2)\nend",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def xor?(boolean_one, boolean_two)\n if boolean_one && boolean_two\n false\n elsif boolean_one == false && boolean_two == false\n false\n else\n true\n end\nend",
"def xor?(boolean1, boolean2)\n (boolean1 || boolean2) && !(boolean1 && boolean2)\nend",
"def xor?(condition1, condition2)\n (condition1 || condition2) && not(condition1 && condition2)\nend",
"def xor?(bool1, bool2)\n if (bool1 == true && bool2 == false) || (bool1 == false && bool2 == true)\n true\n else\n false\n end\nend",
"def xor?(input1, input2)\n if input1 == true && input2 == false # => false, true, false, false\n true # => true\n elsif input1 == false && input2 == true # => true, false, false\n true # => true\n else\n false # => false, false\n end # => true, true, false, false\nend",
"def xor(*others)\n self.class.xor(self, *others)\n end",
"def xor(e1, e2)\n eval_ex(e1) ^ eval_ex(e2)\n end",
"def xor_b\n end",
"def test_xor\n assert_false F ^ F, 'F ^ F'\n assert_maybe F ^ M, 'F ^ M'\n assert_true F ^ T, 'F ^ T'\n\n assert_maybe M ^ F, 'M ^ F'\n assert_maybe M ^ M, 'M ^ M'\n assert_maybe M ^ T, 'M ^ T'\n\n assert_true T ^ F, 'T ^ F'\n assert_maybe T ^ M, 'T ^ M'\n assert_false T ^ T, 'T ^ T'\n end",
"def xor_a\n end",
"def xor_c\n end",
"def xor_l\n end",
"def xor(other)\n @bits ^ bits_from_object(other)\n end",
"def xor_d\n end",
"def fixedXOR(a = 0x1c0111001f010100061a024b53535009181c, b = 0x686974207468652062756c6c277320657965)\n if a.to_s(16).length == b.to_s(16).length\n res = a ^ b\n else\n # TODO: raise error\n res = 0\n puts \"error: diff size arguments\"\n end\n res\nend",
"def xor_e\n end",
"def test_TrueClass_InstanceMethods_ExclusiveOr\n\t\tassert_equal(false, true ^ true)\n\t\tassert_equal(true, true ^ false)\n\t\tassert_equal(true, false ^ true)\n\tend",
"def exclusive_or (p,q)\n p ^ q\nend",
"def op_xor(t_sym, f_sym, num)\n chars = num.split('')\n num_of_trues = 0\n chars.each do |c|\n if c == \"1\"\n num_of_trues += 1\n end\n end\n\n if num_of_trues.to_i.even?\n return f_sym\n else\n return t_sym\n end\nend",
"def xor_h\n end",
"def xor(policy, *others)\n __factory_method__(Xor, policy, others)\n end",
"def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend",
"def exclusive_or(num1, num2)\r\n\t# your code here\r\nend",
"def xor_missing_element array1, array2\n return nil if array1.length == 0 && array2.length == 0\n result = 0\n (array1 + array2).each do |number|\n result ^= number\n end\n return result\nend",
"def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend",
"def xor(left, right)\n res = Array.new\n 0.upto(3) do |i|\n temp = left[i] ^ right[i]\n res << temp\n end\n res\n end",
"def ^(other)\n `return other.$r ? Qtrue : Qfalse;`\n end",
"def xor_select(arr, prc_1, prc_2)\n new_arr = []\n\n arr.each do |ele|\n if prc_1.call(ele) && !prc_2.call(ele) || !prc_1.call(ele) && prc_2.call(ele)\n new_arr << ele\n end\n end\n\n new_arr\nend",
"def xor(first, second)\n first.bytes.zip(second.bytes).map{ |(a,b)| (a ^ b).chr }.join('')\n end",
"def xor(table, column, options)\n addition = Array(column).map {|c| %{(\"#{c}\" is not null)::integer} }.join(' + ')\n\n \"check (#{addition} = 1)\"\n end",
"def xor_hex(a, b)\n raise \"Unequal buffers passed.\" if a.length != b.length\n (a.hex ^ b.hex).to_s(16)\nend",
"def xor_hex(hex1, hex2)\n s1b = hex_to_bytes(hex1)\n s2b = hex_to_bytes(hex2)\n xor_bytes(s1b, s2b)\nend",
"def bit_xor(x, bits)\n bits.map{|b| x[b]}.reduce(:^)\n end",
"def test_SimpleXor\n puts \"SUITE: test_SimpleXor\"\n\n puts \" TEST: (hex) CD enter, AB enter, xor\"\n click(\"buttonC\")\n click(\"buttonD\")\n click(\"buttonEnter\")\n click(\"buttonA\")\n click(\"buttonB\")\n click(\"buttonEnter\")\n click(\"buttonXor\")\n assertResultVal(\"line0\", (0xCD ^ 0xAB))\n\n click(\"buttonClrAll\")\n assertResultEmp(\"line0\")\n\n puts \" TEST: (hex) CD enter, AB, xor\"\n click(\"buttonC\")\n click(\"buttonD\")\n click(\"buttonEnter\")\n click(\"buttonA\")\n click(\"buttonB\")\n click(\"buttonXor\")\n assertResultVal(\"line0\", (0xCD ^ 0xAB))\n\n click(\"buttonClrAll\")\n assertResultEmp(\"line0\")\nend",
"def one?(parameter, other)\n (send(parameter)) ^ (other.send(parameter))\n end",
"def ^ other\n call_enum \"boolean\", other, :eor\n end",
"def xor\n x, y = stack.pop(2)\n push x ^ y\n end",
"def bit_xor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n return_value = BitXorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal238 = nil\n bit_and237 = nil\n bit_and239 = nil\n\n tree_for_char_literal238 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 593:5: bit_and ( '^' bit_and )*\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3918 )\n bit_and237 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and237.tree )\n end\n # at line 593:13: ( '^' bit_and )*\n while true # decision 55\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == HAT )\n alt_55 = 1\n\n end\n case alt_55\n when 1\n # at line 593:16: '^' bit_and\n char_literal238 = match( HAT, TOKENS_FOLLOWING_HAT_IN_bit_xor_3923 )\n if @state.backtracking == 0\n\n tree_for_char_literal238 = @adaptor.create_with_payload( char_literal238 )\n root_0 = @adaptor.become_root( tree_for_char_literal238, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3927 )\n bit_and239 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and239.tree )\n end\n\n else\n break # out of loop for decision 55\n end\n end # loop for decision 55\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 52 )\n\n end\n \n return return_value\n end",
"def xor(bytes1, bytes2)\n bytes1.zip(bytes2).map { |b1, b2| b1 ^ b2 }\nend",
"def MUX2X1(x,y) XOR(x,y); end",
"def hex_XOR(hex1, hex2)\n bin1 = hexToBin(hex1)\n bin2 = hexToBin(hex2)\n \n #XOR result in binary\n xorBin = \"\"\n \n for i in 0..bin1.length-1 do\n xorBitResult = bin1[i].to_i ^ bin2[i].to_i\n xorBin.concat(xorBitResult.to_s)\n end\n \n return binToHex(xorBin)\nend",
"def ^(o)\n\t\tcase o\n\t\twhen Integer\n\t\t\tBuffer.__assert_range(o)\n\t\t\treturn __xor_byte(o)\n\t\twhen Buffer\n\t\t\treturn __xor_buffer(o)\n\t\telse\n\t\t\traise TypeError.new\n\t\tend\n\tend",
"def mask(a, b)\n a ^ b\n end",
"def bitwise_xor(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 | num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b|& = \" + ( ' ' * ([bnum1.length, bnum2.length].min ) + band)\nend"
] |
[
"0.8717416",
"0.8666821",
"0.86460924",
"0.86209816",
"0.86036307",
"0.8595236",
"0.858767",
"0.8576675",
"0.85737514",
"0.85692316",
"0.8515411",
"0.8457522",
"0.8388781",
"0.8323613",
"0.82958066",
"0.82783943",
"0.82055634",
"0.8176512",
"0.8133452",
"0.81316817",
"0.8106578",
"0.81041557",
"0.80583537",
"0.8042383",
"0.8029784",
"0.8008537",
"0.80074495",
"0.79602194",
"0.7944405",
"0.7922496",
"0.7885015",
"0.78718567",
"0.7851072",
"0.7784391",
"0.77570397",
"0.7754076",
"0.7752838",
"0.7744239",
"0.7730985",
"0.77194345",
"0.77194345",
"0.77193433",
"0.77174914",
"0.7702954",
"0.76690525",
"0.7640657",
"0.7621856",
"0.75706786",
"0.75601757",
"0.75574815",
"0.7535633",
"0.7491042",
"0.7490616",
"0.74878585",
"0.74823767",
"0.7454274",
"0.7453283",
"0.74483216",
"0.7410661",
"0.7277593",
"0.72718334",
"0.7237127",
"0.71907616",
"0.71887857",
"0.70767015",
"0.7060278",
"0.68835205",
"0.6716424",
"0.66610533",
"0.6656927",
"0.6627556",
"0.6613748",
"0.6579471",
"0.6571698",
"0.65637213",
"0.6558946",
"0.6368996",
"0.63555896",
"0.6331149",
"0.63073415",
"0.62718236",
"0.62195665",
"0.62119645",
"0.61402947",
"0.6118893",
"0.6104479",
"0.6073382",
"0.60605025",
"0.6038324",
"0.6026202",
"0.60070366",
"0.5982106",
"0.5966062",
"0.5942265",
"0.59071106",
"0.59048223",
"0.5829934",
"0.5826718",
"0.581273"
] |
0.8088864
|
23
|
Write a method that takes a single String argument and returns a new string that contains the original value of the argument, but the first letter of every word is now capitalized. You may assume that words are any sequence of nonblank characters, and that only the first character of each word must be considered. Examples
|
def word_cap(strs)
strs.split.map do |str|
str.capitalize
end.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def word_cap2(str) # Without Using .capitalize method\n str.split.each { |word| word[0] = word[0].upcase }.join(\" \")\nend",
"def capitalized string\n little_words = [\"a\", \"an\", \"the\", \"and\", \"in\", \"of\"]\n string = string.downcase\n string = string.split(\" \")\n if string.length > 1\n string.each_index do |i|\n if i == 0 || !little_words.include?(string[i])\n string[i] = string[i].capitalize\n end\n end\n else\n string[0] = string[0].capitalize\n end\n string.join(\" \").strip\n end",
"def weirdcase1(string)\n string.gsub(/(\\w{1,2})/) { |s| $1.capitalize }\nend",
"def word_cap3(string)\n string.split.each { |word| word[0] = word[0].capitalize }.join(\" \")\nend",
"def cap_first sentence\n sentence.split(\" \").map{|value| value.capitalize}.join(\" \")\nend",
"def cap_first(str)\r\n\tstr.split(' ').map!{ |word| word.capitalize }.join(' ')\r\nend",
"def capitalize_words(string)\n new = string.split\n i = 0\n first = \"\"\n str = \"\"\n \n while i < new.length\n str = new[i]\n first = str[0]\n first = first.upcase\n str[0] = first\n i = i + 1\n end\n \n final = new.join(\" \")\n return final\n \nend",
"def capital str \n cap_arr = str.split(' ')\n cap_arr.map! { |word|\n word[0].upcase + word[1..-1]\n }\n cap_arr.join(' ')\nend",
"def word_cap(str)\n str.split(\" \").each(&:capitalize!).join(\" \")\nend",
"def cap_the_words(string)\r\n string.split(\" \").map{|e| e.capitalize }.join(\" \")\r\nend",
"def word_cap(str)\n str.split.map { |word| word[0].upcase + word[1..-1] }.join(' ')\nend",
"def word_cap(string)\n string.split(' ').map!(&:capitalize).join(' ')\nend",
"def letterCapitalize(str)\n\t#str = str.split(' ')\n\t#str.map! {|word| word.capitalize}\n\t#str.join(' ')\n\tstr.split(' ').map! {|word| word.capitalize}.join(' ')\nend",
"def word_cap(str)\n words = str.split\n words.each do |word|\n word[0] = word[0].upcase\n word[1..-1] = word[1..-1].downcase\n end\n words.join(' ')\nend",
"def titleize(str)\n str.capitalize!\n dont_capitalize = [\"and\", \"over\", \"the\", \"from\"]\n str.split(\" \").collect {|word| dont_capitalize.include?(word) ? word : word.capitalize}.join(\" \")\nend",
"def word_cap(str)\n str.split.each { |word| word.capitalize! }.join(' ')\nend",
"def word_cap(str)\n str.split.each(&:capitalize).join(' ')\nend",
"def capitalize_letter_of_each_word(str)\n str.split.map(&:capitalize).join(' ')\nend",
"def word_cap(str)\n str.split(' ').map(&:capitalize).join(' ')\nend",
"def word_cap(str)\n str.split.map { |element| element.capitalize }.join(' ')\nend",
"def word_cap(string)\n string_array = string.split(' ')\n string_array.each do |word|\n word.capitalize!\n end\n string_array.join(' ')\nend",
"def word_cap(string)\n string.split(' ').each { |word| word.capitalize! }.join(' ')\nend",
"def capitalize(input); end",
"def capitalize(word)\n word[0, 1].upcase + word[1 .. -1]\n end",
"def capitalize_letter_of_each_word(str)\n return_string = \"\"\n words = str.split()\n\n index = 0\n words.each do |word|\n word[0] = word[0].upcase\n index += 1\n if index >= 2\n return_string = return_string + \" #{word}\"\n elsif index < 2\n return_string = word\n end\n end\n\n return return_string\nend",
"def word_cap(str)\n str.split.map(&:capitalize).join(' ')\nend",
"def word_cap(str)\n str.split.map(&:capitalize).join(' ')\nend",
"def ucfirst(my_string)\n raw(my_string.split(\" \").each{|word| word.capitalize!}.join(\" \"))\n end",
"def ucfirst(my_string)\n raw(my_string.split(\" \").each{|word| word.capitalize!}.join(\" \"))\n end",
"def word_cap(string)\n string.split.map(&:capitalize).join(' ')\nend",
"def word_cap(string)\n string.split.map(&:capitalize).join(' ')\nend",
"def word_cap(string)\n string.split.map(&:capitalize).join(' ')\nend",
"def letter_capitalize(str)\n str = str.split(\" \").each {|a| a.capitalize!}.join(\" \")\nend",
"def word_cap(str)\n str.split.each_with_object([]) { |word, arr| arr << my_capitalize(word) }.join(' ')\nend",
"def word_cap(string)\n string.split(\" \").map { |word| word.capitalize }.join(\" \")\nend",
"def LetterCapitalize(str)\n str.split(\" \").map(&:capitalize).join(\" \")\nend",
"def word_cap(str)\n str.split.words.map { |word| word.capitalize}.join(' ')\nend",
"def word_cap(string)\n string.split.map { |word| word.capitalize }.join(' ')\nend",
"def word_cap(str)\n str.split(' ').map { |word| word.capitalize }.join(' ')\nend",
"def word_cap(str)\n str.split.map { |word| word.capitalize }.join(' ')\nend",
"def word_cap(str)\n str.split.map { |word| word.capitalize }.join(' ')\nend",
"def word_cap(str)\n str.split.map { |word| word.capitalize }.join(' ')\nend",
"def capitalize_words(string)\n array_sentence = string.split(\" \")\n idx = 0\n while idx < array_sentence.length\n current = array_sentence[idx]\n current[0] = current[0].upcase\n idx += 1\n end\n return array_sentence.join(\" \")\nend",
"def LetterCapitalize(str)\n\n # code goes here\n str_parts = str.split(\" \")\n str_parts.each { |x| x.capitalize! }\n return str_parts.join(\" \")\n \nend",
"def capitalize_words\n self.split.collect{ |s| s.capitalize_first }.join(\" \")\n end",
"def cap_first(sentence)\n sentence.split(\" \").map{|el| el.capitalize}.join(\" \")\nend",
"def cap(str)\n str.split(\" \").each {|word| word.capitalize!}.join(\" \")\nend",
"def capitalize_each_word(str)\n str.split(\" \").each {|s|s.capitalize!}.join(\" \")\nend",
"def word_cap(string)\n string.split(' ').map {|word| word.capitalize}.join(' ')\nend",
"def word_cap(string)\n string.split(' ').map {|word| word.capitalize}.join(' ')\nend",
"def word_cap(string)\n string_array = string.downcase.split\n string_array.map do |str|\n str.capitalize!\n end\n string_array.join(' ')\nend",
"def LetterCapitalize(string)\n string.split.map(&:capitalize).join(' ')\nend",
"def capitalize(s)\n s.gsub(/\\b(\\w+)/) {|x| x.capitalize} if s\n end",
"def word_cap2(str)\n str.split(' ').map { |wrd| wrd[0].upcase + wrd[1..-1].downcase }.join(' ')\nend",
"def titleize_a_string(string)\nsentence = string.capitalize!.split(' ')\n words_not_to_capitalize = ['a', 'and', 'the']\n\n sentence.each do |word|\n word.capitalize! unless words_not_to_capitalize.include?(word)\n end.join(' ')\n\nend",
"def LetterCapitalize(str)\n str.split.map(&:capitalize).join(' ') \nend",
"def word_cap(str)\n str.split.map { |word| word.capitalize }.join(' ')\n # or words.split.map(&:capitalize).join(' ')\nend",
"def titleize(s)\n my_words = s.split(\" \")\n cap_sentence = \"\"\n my_words.each {|w| cap_sentence << w.capitalize << \" \"} \n cap_sentence.chop\n\nend",
"def word_cap(str)\n str.downcase.split.map{ |c| c[0].upcase + c[1..-1] }.join(\" \")\nend",
"def ucfirst\n self.sub(/^(\\w)/) { |s| s.capitalize }\n end",
"def camel_case\n @word.split(' ').collect(&:capitalize).join\n end",
"def capitalize_each_word(phrase)\r\n\r\nend",
"def capitalize1(str)\n words = str.split(' ')\n words.each_with_index do |word, idx|\n words[idx] = word.capitalize\n end\n \n words.join(' ')\nend",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def titleize_a_string(string)\n result = string.split.each do |x|\n if (x != 'a' && x != 'and' && x != 'the')\n x.capitalize!\n end\n end\n result[0].capitalize!\n result.join(' ')\nend",
"def stringcap(string)\n string.split.map{|word| word.capitalize}.join(' ')\nend",
"def word_cap(words)\n words.split.map(&:capitalize).join(' ')\nend",
"def titleize string\n words = string.split(' ')\n words[0] = words[0].capitalize\n words.map! { |word|\n ignore = %w{and over the}\n if ignore.include? word\n word \n else\n word.capitalize\n end\n }\n words.join(' ')\nend",
"def capitalizer (string)\n new_name = string.downcase.split\n new_name.map! do | words |\n words.capitalize\n end\n new_name.join(' ')\nend",
"def capitalize(word)\n\nend",
"def titlecase\n self\n .split(/ /)\n .map{ |word| word.capitalize }\n .join(' ')\n end",
"def word_cap(string)\n words = string.split\n words.map!{|x| x.capitalize!}\n words.join(' ')\nend",
"def strcapitalize (str)\n arr = str.split\n\n new_arr = []\n arr.each do |word|\n new_arr << word.capitalize\n end\n\n return new_arr.join(\" \")\n \nend",
"def titleize(string)\n\tlittle_words = [\"and\", \"over\", \"the\"]\n\n\teach_word = string.split(\" \")\n\teach_word.each { |word|\n\t\tword.capitalize! unless little_words.include?(word)\n\t}\n\t# capitalizes the first word regardless if it is a little_word or not\n\teach_word[0].capitalize!\n\teach_word.join(\" \")\nend",
"def capitalize2(str)\n words = str.split(' ')\n words.each_with_index do |word, idx|\n # ASCII letters are 32 spots from their other casing:\n # To capitalize, subtract. To lowercase, add.\n if word[0].ord >= 97 && word[0].ord <= 122\n words[idx] = (word[0].ord - 32).chr + word[1..-1] # slice the remainder of the word\n end\n end\n \n words.join(' ')\nend",
"def capitalize(s)\n s[0..0].upcase + s[1..-1]\n end",
"def camel(str)\n words = str.split(' ')\n counter = 0\n\n while counter < words.size\n words[counter] = words[counter].capitalize\n\n counter = counter + 1\n end\n\n words.join\nend",
"def cap_it\n words = \"hello there, how are you?\"\n p words.split(' ').capitalize.join(' ')\nend",
"def word_cap(s)\n words = s.split\n words = words.map(&:capitalize)\n words.join(\" \")\nend",
"def CamelCase(str)\n str = str.split(/[^a-zA-Z]/).map(&:capitalize)\n str.first.downcase!\n str.join\nend",
"def capitalize_words(string)\n\tindices = [0]\n\tidx = -1\n\n\twhile idx < string.length\n\t\tif string[idx] == \" \" || idx == -1\n\t\t\tstring[idx+1] = string[idx+1].to_s.upcase!\n\t\tend\n\t\tidx += 1\n\tend\t\n\n\treturn string\nend",
"def downcase_camelcase_input(input)\n input.split(\" \").collect do |word|\n word.downcase.capitalize\n end.join(\" \")\n end",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def titlecase\n\t\tsplit(/(\\W)/).map(&:capitalize).join\n\tend",
"def titleize(str)\n str = str.split().each do |word|\n word.capitalize!\n end\n str.join(' ')\nend",
"def title_case(title, minor_words = nil)\n title = title.downcase.split(\" \")\n title.map! {|word| minor_words && minor_words.downcase.split(\" \").include?(word) ? word : word.capitalize}\n title[0] = title[0].capitalize if title[0]\n return title.join(\" \")\nend",
"def word_cap(string)\n words = string.split(\" \")\n words.map! do |word|\n word.capitalize\n end\n words.join(\" \")\nend",
"def word_cap3(str)\n str.split.map { |word| word.sub(word[0], word[0].upcase) }.join(\" \")\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def amendTheSentence(s)\n s.gsub(/([A-Z])/, ' \\1').strip.downcase\nend",
"def getCapitalizedFirst(str)\n newStr = String.new\n newStr += str[0, 1].capitalize\n\n if (str.length > 1)\n newStr += str[1..str.length - 1]\n end\n\n return(newStr)\n end",
"def getCapitalizedFirst(str)\n newStr = String.new\n newStr += str[0, 1].capitalize\n\n if (str.length > 1)\n newStr += str[1..str.length - 1]\n end\n\n return(newStr)\n end",
"def titlelize(input)\n input.downcase!\n arr = input.split\n arr.each { |word| word.capitalize!}\n output = arr.join(\" \")\nend",
"def capitalize!() end",
"def capitalize(string) \r\n puts \"#{string[0].upcase}#{string[1..-1]}\"\r\nend"
] |
[
"0.82596326",
"0.821193",
"0.80596143",
"0.8053398",
"0.80417114",
"0.8025429",
"0.8023036",
"0.80071825",
"0.8003106",
"0.79722494",
"0.79678386",
"0.79623693",
"0.7956512",
"0.7938355",
"0.7935863",
"0.79354143",
"0.7928802",
"0.79246914",
"0.7901144",
"0.7880979",
"0.78769624",
"0.78718024",
"0.78646964",
"0.786329",
"0.78616935",
"0.78615975",
"0.78615975",
"0.7857416",
"0.78560287",
"0.7854322",
"0.7854322",
"0.7854322",
"0.7850725",
"0.78490233",
"0.7839247",
"0.7837857",
"0.7836069",
"0.78229445",
"0.78200126",
"0.7818465",
"0.7818465",
"0.7818465",
"0.78120744",
"0.78116745",
"0.78092855",
"0.78071177",
"0.78042114",
"0.77943677",
"0.7784778",
"0.7784778",
"0.7780677",
"0.77745754",
"0.7764583",
"0.7764333",
"0.7763606",
"0.7757768",
"0.77509147",
"0.7749747",
"0.77469325",
"0.774663",
"0.7745579",
"0.77397746",
"0.7739306",
"0.773483",
"0.77348155",
"0.77342373",
"0.77303314",
"0.7729065",
"0.7694787",
"0.7688627",
"0.76868755",
"0.76868165",
"0.7678392",
"0.7675645",
"0.76739717",
"0.76733124",
"0.7659184",
"0.76590484",
"0.76587874",
"0.76515436",
"0.7640596",
"0.76207674",
"0.76166517",
"0.76166517",
"0.76166517",
"0.76166517",
"0.76166517",
"0.76166517",
"0.7612106",
"0.7611932",
"0.7603421",
"0.7602336",
"0.76009005",
"0.75987613",
"0.75964653",
"0.759508",
"0.759508",
"0.75944024",
"0.75927925",
"0.75923765"
] |
0.76632994
|
76
|
Code blocks are anonymous functions that provide closure like functionality. The execution flow passes to the code block, due to yield method.
|
def function_Name
puts "Sample Function Name"
yield()
puts "monkey"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def run_block\n yield\nend",
"def simple\n puts 'Here comes the code block!'\n yield\n puts 'There was the code block!'\nend",
"def run_block_proc\n yield\nend",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def demonstrate_block(number)\n yield(number) #yield keyword calls the single lambda that has been implicitly passed to a method without using the parameter list\nend",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def test_procs_and_lambdas\n yield\n puts \"hello\"\nend",
"def i_take_a_block\n yield\nend",
"def summer\n yield # this represents a block of code.\nend",
"def blocks() end",
"def run_block\n p = Proc.new\n p.call\nend",
"def foo\n # Call the block\n yield\n yield\nend",
"def foo\n # Call the block\n yield\n yield\nend",
"def parse_codeblock; end",
"def callBlock\n yield\n yield\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def hello_world(&block)\n puts block.call\nend",
"def block?; end",
"def test_progs_and_lambdas\n yield \n puts \"Hello\"\nend",
"def block_example(&block)\n does block\n end",
"def foo\n #chamar um block\n yield #quando passarmos o block como parametro sera executado no lugar do yield\n yield #sera executado 2 vezes\nend",
"def return_block\n yield\nend",
"def each\n yield :code, code\n yield :data, data\n end",
"def with_block(&block)\n end",
"def run(&block); end",
"def block_test\n\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield #this expression allows the method to receive and execute a block\n puts \"We're back in the method!\"\nend",
"def return(&block); end",
"def execute\n [lambda, block].each do |aProc|\n next unless aProc\n aProc.call\n end\n end",
"def execute\n [lambda, block].each do |aProc|\n next unless aProc\n aProc.call\n end\n end",
"def test\n yield(1)\nend",
"def test\n yield(1)\nend",
"def test\n yield(1)\nend",
"def test\n yield(1)\nend",
"def run_block_3\n p = Proc.new # if new proc is not passed a code block, it looks to see if the current scope has been passed a code block and use that\n p.call # if current scope has not been passed a code block, there will be an error\nend",
"def block_code(code, language)\n code\n end",
"def yield; end",
"def run_block\n p = Proc.new # <1>\n p.call\nend",
"def block_sample\n p \"AAA\"\n yield\n p \"BBB\"\nend",
"def function\n block.function\n end",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def hello(&block)\n puts block\n block.call\nend",
"def call_block2\n yield(\"hello\",4)\nend",
"def run_block # this is a method that accepts a block and yields action to block once method is called (just like map or each)\n yield if block_given? # prevents error if no block is run with method invocation; only use this if you have a specific reason for it, otherwise, it's best to fail and fail early\nend",
"def do_something\n puts \"I've passed a function into this block.\"\n yield\nend",
"def block_test\n puts \"we are in the method\"\n puts \"Yielding to the block\"\n yield\n puts \"We are back in the method\"\n\nend",
"def do_something\n puts \"before the block\"\n yield\n puts \"after the block\"\nend",
"def yield_inside(&block)\n module_eval &block\n end",
"def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend",
"def create_block_object(&block)\n block\nend",
"def context(&block); end",
"def context(&block); end",
"def will_run_block\n # when you use yield, you'll call the block\n yield\n puts 'End'\nend",
"def callBlock\n yield ,\n end",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def block_test\r\n puts \"We're in the method!\"\r\n puts \"Yielding to the block...\"\r\n yield\r\n puts \"We're back in the method!\"\r\nend",
"def gimme_your_blocks\n yield if block_given?\nend",
"def call_block\n puts 'Start'\n yield\n yield\n puts 'End'\nend",
"def yield_block_example()\n puts \"Start of yield block example\"\n yield('example of param passing')\n puts \"End of yield block example\"\nend",
"def call_block2\n yield(\"hello\", 99)\nend",
"def test\n yield(1, 2)\nend",
"def run(&block)\n end",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def block_testing\r\n student1 = \"John\"\r\n student2 = \"Jane\"\r\n puts \"The student has not begun racing yet.\"\r\n yield(student1, student2)\r\nend",
"def run\n block.call\n end",
"def say_hello(&block)\n puts \"Hello, world\"\n \n # One advantage of yield is that you can run that code\n # any number of times, so let's go ahead and put yield \n # again.\n yield\n yield\n puts \"I said hello\"\nend",
"def calculate\n puts \"#{3+4} is equal to 7\"\n yield\n yield\n puts \"after this is block\"\n\nend",
"def blockTest\n\tputs \"Method!\"\n\tputs \"Yield!\"\n\tyield\n\tputs \"Method!\"\nend",
"def test(&block)\n puts \"inside test -- calling block\"\n block.call\n puts \"inside test -- after calling block\"\n yield\nend",
"def generators(&blk); end",
"def generators(&blk); end",
"def block_node; end",
"def block_node; end",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend",
"def block_test\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield\n puts \"We're back in the method!\"\nend"
] |
[
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.73626167",
"0.72142124",
"0.71515495",
"0.7112692",
"0.7053488",
"0.7053488",
"0.7053488",
"0.70314443",
"0.6924977",
"0.6924977",
"0.68902695",
"0.6860734",
"0.6853613",
"0.6849755",
"0.6802114",
"0.67507106",
"0.67507106",
"0.6730699",
"0.6730152",
"0.66970986",
"0.66970986",
"0.66970986",
"0.66612345",
"0.6606807",
"0.66001767",
"0.65831465",
"0.65797627",
"0.65677375",
"0.6559517",
"0.6551467",
"0.6539277",
"0.65390813",
"0.6520506",
"0.651983",
"0.65178317",
"0.65178317",
"0.6512498",
"0.6512498",
"0.6512498",
"0.6512498",
"0.65072834",
"0.6501422",
"0.6494246",
"0.6492121",
"0.64776164",
"0.64762276",
"0.647227",
"0.6463605",
"0.6445619",
"0.64430386",
"0.64283764",
"0.6427539",
"0.64130396",
"0.6411867",
"0.6406469",
"0.639506",
"0.6392529",
"0.6392529",
"0.6384568",
"0.63772756",
"0.63728285",
"0.6368238",
"0.6356514",
"0.63560086",
"0.6355026",
"0.63546145",
"0.6354607",
"0.63511163",
"0.63493097",
"0.63493097",
"0.6336313",
"0.63333523",
"0.6328931",
"0.6312766",
"0.6291929",
"0.6280079",
"0.6275408",
"0.6275408",
"0.6275171",
"0.6275171",
"0.62703896",
"0.62703896"
] |
0.0
|
-1
|
code block paramets are enclosed between |parameter_name|
|
def code_block_parameter
puts "random function name"
yield 10, 20, 30
#yield (10,20,30) --> not working
puts "after Yield, Yes () are optional"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def code\n str = Indentation.get\n str << \"var #{name} = function(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent { str << \"#{block}\\n\" }\n str << \"#{Indentation.get}};\\n\"\n str\n end",
"def yieldparam_tag(text); end",
"def m12a(p1,p2,p3, &blk)\n\tyield(p1,p2) # два параметра передаем в блок\n\tputs \"The third parameter is #{p3}\" # один параметр испоьзуем прямо тут\nend",
"def codeblock\n H[:pre, attr, H[:code, value]]\n end",
"def block_name \n :CodeBlock \n end",
"def block_name \n :CodeBlock \n end",
"def block_params=(value)\n # 'yield.to_s' or 'assert yield, msg'\n return @block_params = '' if value =~ /^[\\.,]/\n\n # remove trailing 'if/unless ...'\n return @block_params = '' if value =~ /^(if|unless)\\s/\n\n value = $1.strip if value =~ /^(.+)\\s(if|unless)\\s/\n\n # outer parentheses\n value = $1 if value =~ /^\\s*\\((.*)\\)\\s*$/\n value = value.strip\n\n # proc/lambda\n return @block_params = $1 if value =~ /^(proc|lambda)(\\s*\\{|\\sdo)/\n\n # surrounding +...+ or [...]\n value = $1.strip if value =~ /^\\+(.*)\\+$/\n value = $1.strip if value =~ /^\\[(.*)\\]$/\n\n return @block_params = '' if value.empty?\n\n # global variable\n return @block_params = 'str' if value =~ /^\\$[&0-9]$/\n\n # wipe out array/hash indices\n value.gsub!(/(\\w)\\[[^\\[]+\\]/, '\\1')\n\n # remove @ from class/instance variables\n value.gsub!(/@@?([a-z0-9_]+)/, '\\1')\n\n # method calls => method name\n value.gsub!(/([A-Z:a-z0-9_]+)\\.([a-z0-9_]+)(\\s*\\(\\s*[a-z0-9_.,\\s]*\\s*\\)\\s*)?/) do\n case $2\n when 'to_s' then $1\n when 'const_get' then 'const'\n when 'new' then\n $1.split('::').last. # ClassName => class_name\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n downcase\n else\n $2\n end\n end\n\n # class prefixes\n value.gsub!(/[A-Za-z0-9_:]+::/, '')\n\n # simple expressions\n value = $1 if value =~ /^([a-z0-9_]+)\\s*[-*+\\/]/\n\n @block_params = value.strip\n end",
"def param_seq\n params = params.gsub(/\\s*\\#.*/, '')\n params = params.tr(\"\\n\", \" \").squeeze(\" \")\n params = \"(#{params})\" unless p[0] == ?(\n\n if block = block_params then # yes, =\n # If this method has explicit block parameters, remove any explicit\n # &block\n params.sub!(/,?\\s*&\\w+/)\n\n block.gsub!(/\\s*\\#.*/, '')\n block = block.tr(\"\\n\", \" \").squeeze(\" \")\n if block[0] == ?(\n block.sub!(/^\\(/, '').sub!(/\\)/, '')\n end\n params << \" { |#{block}| ... }\"\n end\n\n params\n end",
"def execute(&nameofblock)\n nameofblock.call\nend",
"def param_seq\n params = @params.gsub(/\\s*\\#.*/, '')\n params = params.tr(\"\\n\", \" \").squeeze(\" \")\n params = \"(#{params})\" unless params[0] == ?(\n\n if @block_params then\n # If this method has explicit block parameters, remove any explicit\n # &block\n params.sub!(/,?\\s*&\\w+/, '')\n\n block = @block_params.gsub(/\\s*\\#.*/, '')\n block = block.tr(\"\\n\", \" \").squeeze(\" \")\n if block[0] == ?(\n block.sub!(/^\\(/, '').sub!(/\\)/, '')\n end\n params << \" { |#{block}| ... }\"\n end\n\n params\n end",
"def block_code(code, language)\n code\n end",
"def block_with_param\n puts \"Before calling block\"\n yield(123)\n puts \"After calling block\"\nend",
"def block_parameter_names\n return block_def_node.parameters\n end",
"def parse_codeblock; end",
"def let name, &block\n\t @sketch.define_parameter name, &block\n\tend",
"def param; end",
"def param; end",
"def each_parameter(&block)\n @parameters.each(&block)\n end",
"def param_tag(text); end",
"def baz(name, &block)\n @name = name\n block.call\nend",
"def param_template\n \"# @param %{param} [Class] Write param definition here.\"\n end",
"def coding_with_language(#{name}, #{language})\n puts \"Hi, my name is #{name} and I am learning to program in #{language}!\"\nend",
"def parse_block(*_arg0); end",
"def block_with_params\n puts \"Before calling block\"\n yield(123)\n yield(:test)\n yield([:a])\n puts \"After calling block\"\nend",
"def do_something_with_params_line\n if block_given?\n value = yield\n puts value\n end\nend",
"def yield_block_example()\n puts \"Start of yield block example\"\n yield('example of param passing')\n puts \"End of yield block example\"\nend",
"def foo(name, &block)\n @name = name\n block.call\nend",
"def param_seq\n if @call_seq then\n params = @call_seq.split(\"\\n\").last\n params = params.sub(/[^( ]+/, '')\n params = params.sub(/(\\|[^|]+\\|)\\s*\\.\\.\\.\\s*(end|\\})/, '\\1 \\2')\n elsif @params then\n params = @params.gsub(/\\s*\\#.*/, '')\n params = params.tr_s(\"\\n \", \" \")\n params = \"(#{params})\" unless params[0] == ?(\n else\n params = ''\n end\n\n if @block_params then\n # If this method has explicit block parameters, remove any explicit\n # &block\n params = params.sub(/,?\\s*&\\w+/, '')\n\n block = @block_params.tr_s(\"\\n \", \" \")\n if block[0] == ?(\n block = block.sub(/^\\(/, '').sub(/\\)/, '')\n end\n params << \" { |#{block}| ... }\"\n end\n\n params\n end",
"def test_disable_parametered\n hash_ = Hash.new\n block1_ = proc do ||\n set_value1('a', 1)\n end\n block2_ = proc do |target_|\n target_.set_value1('b', 2)\n end\n block3_ = proc do\n set_value1('c', 3)\n end\n Blockenspiel.invoke(block1_, Target1.new(hash_), :parameter => false)\n assert_raise(Blockenspiel::BlockParameterError) do\n Blockenspiel.invoke(block2_, Target1.new(hash_), :parameter => false)\n end\n Blockenspiel.invoke(block3_, Target1.new(hash_), :parameter => false)\n assert_equal(1, hash_['a1'])\n assert_equal(3, hash_['c1'])\n end",
"def set_block_params(name, params)\n\t\t\tparams = {} if !params.is_a?(Hash)\n\t\t\t@vars[:block_params][name] = params\n\t\tend",
"def pre_block\n end",
"def pre_block\n end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def foo\n\n yield # executa um bloco passado por parametro (so pode passar 1)\n yield \nend",
"def test_basic_param\n block_ = proc do |t_|\n t_.set_value(:a, 1)\n t_.set_value_by_block(:b){ 2 }\n assert(!self.respond_to?(:set_value))\n assert(!self.respond_to?(:set_value_by_block))\n end\n target_ = SimpleTarget.new\n Blockenspiel.invoke(block_, target_)\n assert_equal(1, target_.get_value(:a))\n assert_equal(2, target_.get_value(:b))\n end",
"def execute(block) # the syntax requires an & in the paramater name.\n \t block.call\n\tend",
"def run_block_proc_param\n yield(24)\nend",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def do_something_with_params\n yield(\"parameter\") if block_given?\nend",
"def each_param(&block) #:yield: name, value\n if @params\n @params.each(&block)\n end\n end",
"def list_block()\n\nend",
"def parameters=(_); end",
"def parse_codeblock_fenced; end",
"def debug_only(param = nil, &block)\n puts \"Param class: #{param.class}\"\n puts \"Block class: #{block.class}\" if block_given?\nend",
"def debug_only (param = nil, &block)\n puts \"Param class: #{param.class}\"\n puts \"Block class: #{block.class}\" if block_given?\nend",
"def parameters=(_arg0); end",
"def compileparameterlist\n\n end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def inline_code; end",
"def functionName(parameter1, parameter2)\n puts parameter1\n puts parameter2\nend",
"def do_something parameter1, parameter2, parameter3\nend",
"def do_something(par1, par2, par3)\nend",
"def do_something(par1, par2, par3)\nend",
"def do_something(par_1, par_2, par_3)\n\n\nend",
"def parfait_block(compiler)\n return @parfait_block if @parfait_block\n @parfait_block = compiler.create_block( make_arg_type , make_frame(compiler))\n end",
"def block_name \n to_sym\n end",
"def surround\r\n puts '{'\r\n yield\r\n puts '}'\r\nend",
"def parameter_list(fn)\n case @scanner.peek.value\n when 'void'\n match(Token.new(:reserved, 'void'))\n @prog_code << \"void\"\n when 'int'\n match(Token.new(:reserved, 'int'))\n @prog_code << \"int \"\n name = @scanner.next.value\n fn.add_param(name)\n @prog_code << name\n parameter_list_tail(fn)\n end\n end",
"def block_checker(param) \n [ param , block_given? ]\nend",
"def surround\n puts '{'\n yield\n puts '}'\nend",
"def method_with_block_arguments\n yield(\"Bob\")\nend",
"def atk; param(2); end",
"def to_prepare_blocks; end",
"def test(&block)\n puts \"&block is, #{block}\"\nend",
"def params=(value); end",
"def c(param1)\n end",
"def block_code(code, language)\n if language.present?\n CodeRay.scan(code, language).div\n else\n \"<pre><code>#{code}</code></pre>\"\n end\n end",
"def execute(&block)\r\n block\r\nend",
"def change_name(new_name)\n#declare instance variable, define as argument\n @name = new_name\n#return string with instance variable interpolated\n return \"I got by #{@name} now!\"\n#end method codeblock\n end",
"def code_point; end",
"def func_block (arg1, arg2, block_args = {})\n p arg1.inspect\n p arg2.inspect\n p block_args.inspect\nend",
"def yieldKeyword(param = \"defaultVal\", param1 = \"defaultVal_1\")\n puts \"Inside method: #{param}, #{param1}\"\n yield # no params means that no values are passed to the block\n yield(param, param1) # 2 values are passed to the block\n puts \"Inside method again\"\n yield(\"String\",22)\nend",
"def _wrap_parameters(parameters); end"
] |
[
"0.6844057",
"0.6674636",
"0.6464549",
"0.6450759",
"0.64361006",
"0.64361006",
"0.6356482",
"0.63479406",
"0.63126856",
"0.62919724",
"0.6279644",
"0.62644047",
"0.6240531",
"0.6240011",
"0.616068",
"0.6160082",
"0.6160082",
"0.60925835",
"0.60686475",
"0.60672027",
"0.605883",
"0.60396475",
"0.6029308",
"0.60278636",
"0.60244817",
"0.6012677",
"0.60093975",
"0.6005902",
"0.59695387",
"0.5963104",
"0.5944467",
"0.5944467",
"0.5875555",
"0.5875555",
"0.5875555",
"0.5875555",
"0.5875555",
"0.5875555",
"0.5875555",
"0.5875555",
"0.58673257",
"0.58311486",
"0.5829468",
"0.58275414",
"0.58140874",
"0.58140874",
"0.5807121",
"0.5790982",
"0.5789809",
"0.5784793",
"0.5771916",
"0.5754458",
"0.57535774",
"0.57137734",
"0.5692424",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56920594",
"0.56913096",
"0.56894207",
"0.5686519",
"0.568586",
"0.568586",
"0.56718767",
"0.5670898",
"0.56662476",
"0.5656598",
"0.5639279",
"0.5629483",
"0.56285447",
"0.5595789",
"0.5593081",
"0.5592685",
"0.5592183",
"0.55858785",
"0.5577488",
"0.557445",
"0.55735135",
"0.55722594",
"0.55607224",
"0.55584085",
"0.55471915",
"0.55349773"
] |
0.63985
|
6
|
Returns all the plan in the system.
|
def all_plans
file = File.read('./data/bundle.json')
plan_hash = JSON.parse(file)
plans = plan_hash['plans']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all_plans\n if current_user.typeofuser == \"admin\" then\n @tenant = current_user.tenant\n @current_plan = @tenant.pricing_plan\n @selected_plan = PricingPlan.find(@tenant.selected_plan_id)\n @pricing_plans = PricingPlan.where(:plan_type => 'public')\n end\n end",
"def plans\n return @plans\n end",
"def all_p_bam\n plan = Plan.select('id, name').where('plan_type = ? AND item= ?', 'plan', 'bam')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.name] }\n return plans\n end",
"def retrieve_plan_list\n options = { limit: 100 }\n options[:offset] = @offset if @offset.present?\n ChargeBee::Plan.list(options)\n end",
"def plans\n\t @plans = Plan.all\n\t current_user.clean_subscriptions if current_user\n\tend",
"def plans\n @plans ||= spinner('Loading plans') { Loader.load_all configuration.plan_files }\n end",
"def list_plans(filter: nil)\n {\n plans: filter_content(pal.list_plans_with_cache(filter_content: true), filter),\n modulepath: pal.user_modulepath\n }\n end",
"def index\n @plans = Plan.all\n end",
"def index\n @plans = Plan.all\n end",
"def plans(within_product=nil)\n product_id = within_product ? within_product.enabled_products.map(&:id) + [within_product.id] : nil\n Plan.where(:id => plan_ids, :product_id => product_id).all\n end",
"def find_test_plans()\n begin\n plan_shells = @testrail.send_get(\"get_plans/#{@tr_project['id']}\")\n plans = []\n plan_shells.each do |plan_shell|\n plan = @testrail.send_get(\"get_plan/#{plan_shell['id']}\")\n runs = []\n tests = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n run = @testrail.send_get(\"get_run/#{run_shell['id']}\")\n runs.push(run)\n test = @testrail.send_get(\"get_tests/#{run_shell['id']}\")\n tests.push(test)\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n \n return plans\n end",
"def plan\n @courses = Course.all\n @semesters = Semester.all\n @p_planners = PastPlanner.find_all_semester_groups(current_user)\n @f_planners = FuturePlanner.find_all_semester_groups(current_user)\n end",
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @plans = Plan.where(user_id: current_user.id)\n end",
"def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = testrail_send('get', uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = testrail_send('get', uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = testrail_send('get', uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = testrail_send('get', uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end",
"def service_plans\n manager_instance(ServicePlanManager)\n end",
"def all_bp_roaming\n plan = Plan.select('id, name').where('(plan_type = ? OR plan_type = ?) AND item= ?',\n 'plan', 'bag', 'roaming')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.name] }\n return plans\n end",
"def plans\r\n @plans ||= PlansController.new(configuration: @configuration)\r\n end",
"def roaming_plans(country)\n plan = Plan.select('id, name, detail, price').where('country= ? AND plan_type = ? AND item= ?',\n country, 'plan', 'roaming')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.id] }\n # Format to display details of plans\n details = plan.map {|m| [m.id, m.detail]}\n return [plans, details]\n end",
"def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = @testrail.send_get(uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = @testrail.send_get(uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = @testrail.send_get(uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = @testrail.send_get(uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end",
"def index\n if current_user.is_admin?\n @plans = Plan.all\n else\n @plans = Plan.where(user_id: current_user.id)\n end\n end",
"def plans\n subscriptions.map(&:plan)\n end",
"def read_service_plans()\n @client.service_plans\n end",
"def show\n @plans = Stripe::Plan.all\n end",
"def all_plans\n Plan.joins(:plan_category).includes(:plan_category) \\\n .yr(@year).order('plan_categories.ordinal, plans.cat_order')\n end",
"def fetch\n plans = @pgsql.exec(\n [\n 'SELECT plan.id, plan.completed, plan.schedule,',\n 'SUM(risk.probability * effect.impact) / COUNT(triple.id) AS rank',\n 'FROM plan',\n 'JOIN part ON part.id = plan.part',\n 'JOIN project ON part.project = project.id',\n 'JOIN triple ON cause = plan.part OR risk = plan.part OR effect = plan.part',\n 'JOIN risk ON triple.risk = risk.id',\n 'JOIN effect ON triple.effect = effect.id',\n 'LEFT JOIN task ON task.plan = plan.id',\n 'WHERE project.login = $1 AND task.id IS NULL',\n 'GROUP BY plan.id, plan.completed, plan.schedule'\n ],\n [@login]\n )\n plans.select { |p| deadline(Time.parse(p['completed']), p['schedule'].strip.downcase) < Time.now }\n .map { |p| p['id'].to_i }\n end",
"def fetch_plans (id = nil)\n @plans = []\n parameters = {}\n @networks_by_plan = {}\n parameters[:_profile] = 'http://hl7.org/fhir/us/davinci-pdex-plan-net/StructureDefinition/plannet-InsurancePlan' \n if(id)\n parameters[:_id] = id\n end\n\n @client.search(\n FHIR::InsurancePlan,\n search: { parameters: parameters }\n )&.resource&.entry&.map do |entry|\n @plans << {\n value: entry&.resource&.id,\n name: entry&.resource&.name\n }\n @networks_by_plan [ entry&.resource&.id] = entry&.resource&.network\n end\n @plans.sort_by! { |hsh| hsh[:name] }\n rescue => exception\n redirect_to root_path, flash: { error: 'Please specify a plan network server' }\n\n end",
"def index\n respond_with(@plans = Plan.all)\n end",
"def all_plans\n Plan.joins(:plan_category).includes(:plan_category) \\\n .yr(year).order('plan_categories.ordinal, plans.cat_order')\n end",
"def plans_available_bam(country)\n plan = Plan.select('id, name, detail, price').where('country= ? AND item= ?',\n country, 'bam')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.id] }\n # Format to display details of plans\n details = plan.map {|m| [m.id, m.detail]}\n return [plans, details]\n end",
"def index\n authorize Plan\n @plans = Plan.includes(:roles).active(current_user).page(1)\n @organisationally_or_publicly_visible = if current_user.org.is_other?\n []\n else\n Plan.organisationally_or_publicly_visible(current_user).page(1)\n end\n # TODO: Is this still used? We cannot switch this to use the :plan_params\n # strong params because any calls that do not include `plan` in the\n # query string will fail\n @template = Template.find(params[:plan][:template_id]) if params[:plan].present?\n end",
"def stack_plan_all(stack)\n logger.debug(\"loading all plans for stack `#{stack.id}`\")\n all_result_pages(nil, :body,\n \"ListChangeSetsResponse\", \"ListChangeSetsResult\",\n \"Summaries\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n Smash.new(\n \"Action\" => \"ListChangeSets\",\n \"StackName\" => stack.id || stack.name,\n )\n ),\n )\n end.map do |res|\n stack = Stack.new(self,\n id: res[\"StackId\"],\n name: res[\"StackName\"])\n stack.custom = {:plan_name => res[\"ChangeSetName\"],\n :plan_id => res[\"ChangeSetId\"]}\n stack.plan\n end\n end",
"def index\n @operative_plans = OperativePlan.all\n end",
"def to_a\n @plans\n end",
"def index\n @admin_subscription_plans = Admin::SubscriptionPlan.all\n end",
"def plan\n plan_rebuilder.plan\n end",
"def index\n @plans = Plan.all\n if not (current_user.role? :faculty) || (current_user.role? :admin)\n @plans = Plan.where(user_id: current_user.id)\n end\n end",
"def index\n @billing_plans = BillingPlan.all\n end",
"def index\n @planers = Planer.all\n end",
"def index\n @inventory_plans = InventoryPlan.all\n end",
"def plans\n [Free, FreePlus, Pro, Growth, ProSpecial, ProComped, ProManaged, EliteSpecial, Elite, Custom0, Custom1, Custom2, Custom3].map(&:name)\n end",
"def index\n @payment_plans = PaymentPlan.all\n end",
"def application_plans\n manager_instance(ApplicationPlanManager)\n end",
"def show_all\n styled_header('Resources')\n display_addons(get_addons, ['Plan', 'Name', 'Billed to', 'Price'])\n end",
"def plans=(value)\n @plans = value\n end",
"def index\n if user_signed_in?\n @plans = Plan.where(user_id: current_user.id)\n else\n @plans = []\n end\n end",
"def index\n @art_plans = current_user.art_plans\n end",
"def index\n @tipo_plans = TipoPlan.all\n end",
"def index\n @page_plans = PagePlan.all\n end",
"def get_plan\n\t\t\t@account_plan.map{|k, v| \"#{k}['#{v}']\"}.join(' ')\n\t\tend",
"def plans\n result = []\n self.books.each do |book|\n book.plans.each do |plan|\n result << plan\n end\n end\n\n result\n end",
"def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end",
"def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end",
"def plan_object\n Plan.new plan\n end",
"def index\n @callplans = Callplan.all\n end",
"def plans\n @title = 'Puppet Plan Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_plan)\n erb(:objects)\nend",
"def query_plan\n return nil unless @gapi.statistics.query.query_plan\n Array(@gapi.statistics.query.query_plan).map do |stage|\n Stage.from_gapi stage\n end\n end",
"def index\n @business_plans = BusinessPlan.all\n end",
"def get_campaign_plan_all_using_get(opts = {})\n data, _status_code, _headers = get_campaign_plan_all_using_get_with_http_info(opts)\n data\n end",
"def payer_plans\n payerplan_type = \"http://hl7.org/fhir/us/davinci-pdex-plan-net/CodeSystem/InsuranceProductTypeCS|\"\n reply = @client.search(FHIR::InsurancePlan, search: { parameters: { type: payerplan_type } }).resource\n @payersbyid = build_payer_plans(reply)\n session[:payersbyid] = compress_hash(@payersbyid.to_json)\n\n # Prepare the query string for display on the page\n @search = URI.decode(reply.link.select { |l| l.relation === \"self\" }.first.url) if reply.link.first\n session[:payersplan_query] = @search\n rescue => exception\n puts \"payer plans fails: #{exception}\"\n @payersbyid ||= {}\n end",
"def index\n @actual_action_plans = ActualActionPlan.all\n end",
"def account_plans\n @account_plans_manager\n end",
"def index\n @planif_records = current_user.planif_records.all\n end",
"def pharmacy_plans(params = {})\n response = default_scope.get('pharmacy/plans') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = ListPlansResultSet.new(resp)\n return results\n end",
"def form_plans\n return @_plans if @_plans.present?\n @_plans = all_plans.to_a\n unless admin?\n @_plans.delete_if { |p| p.disabled? && !@attendee.has_plan?(p) && !p.show_disabled? }\n end\n @_plans\n end",
"def planet_list\n return @planets\n end",
"def jmeter_plans\n jmeter_plan_ids = self.client_stats.collect(&:jmeter_plan_id).uniq\n Hailstorm::Model::JmeterPlan.where(id: jmeter_plan_ids)\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def form_plans\n return @_plans if @_plans.present?\n @_plans = all_plans\n unless current_user.admin?\n @_plans.delete_if {|p| p.disabled? && !@attendee.has_plan?(p)}\n end\n @_plans\n end",
"def list_all_planets\n puts \"The #{ @system } system has these #{ @all_planets.length } planets:\"\n @all_planets.each do |planet|\n puts \"#{@all_planets.index(planet)+1}. #{planet.name}\"\n end\n end",
"def index\n @test_plans = @project.test_plans\n end",
"def memberships\n @basic_plan = Plan.find(1)\n @pro_plan = Plan.find(2)\n end",
"def index_crud\n\n @plans = Plan.all\n render :index_crud\n end",
"def index\n @article_plans = ArticlePlan.all\n end",
"def show\n @plan = Plan.find(params[:id])\n end",
"def plan\n data['plans'][me]\n end",
"def index\n @calls = Call.all\n @plans = Plan.all\n end",
"def index\n @meal_plans = MealPlan.all\n end",
"def index\n @sales_plans = SalesPlan.all\n end",
"def index\n @planetary_systems = PlanetarySystem.all\n end",
"def index\n @plan_cuenta = PlanCuentum.all\n end",
"def display_plan_lists(stack)\n unless stack\n raise \"Failed to locate requested stack `#{name_args.first}`\"\n end\n plans = stack.plans.all\n if plans.empty?\n ui.warn \"No plans found for stack `#{stack.name}`\"\n return\n end\n ui.info \"Plans for stack: #{ui.color(stack.name, :bold)}\\n\"\n n_width = \"Plan Name\".length\n i_width = \"Plan ID\".length\n s_width = \"Plan State\".length\n c_width = \"Created\".length\n plan_info = plans.map do |plan|\n plan_id = plan.id.to_s.split(\"/\").last\n n_width = plan.name.to_s.length if plan.name.to_s.length > n_width\n i_width = plan_id.to_s.length if plan_id.length > i_width\n s_width = plan.state.to_s.length if plan.state.to_s.length > s_width\n c_width = plan.created_at.to_s.length if plan.created_at.to_s.length > c_width\n [plan.name, plan_id, plan.state, plan.created_at]\n end\n table = ui.table(self) do\n table(:border => false) do\n row(:header => true) do\n column \"Plan Name\", :width => n_width + 5\n column \"Plan ID\", :width => i_width + 5\n column \"Plan State\", :width => s_width + 5\n column \"Created\", :width => c_width + 5\n end\n plan_info.sort_by(&:first).each do |plan|\n row do\n plan.each do |item|\n column item\n end\n end\n end\n end\n end.display\n end",
"def index\n @media_plans = MediaPlan.all\n end",
"def active_plans\n self.plans.includes(:template).where(\"roles.active\": true).where(Role.not_reviewer_condition)\n end",
"def index\n @all_projects = Project.by_user_plan_and_tenant(params[:tenant_id], current_user)\n end",
"def as_plan\n self\n end",
"def plan( &block )\n nested_class( 'Plan', Yacl::Define::Plan, &block )\n end",
"def plan\n AcceptOn::Plan.new(@plan)\n end",
"def visible_plans(viewing_user_id)\r\n #MES- If the viewing user is the owner of this planner, then\r\n # they can see all the plans\r\n return plans if !viewing_user_id.nil? && viewing_user_id == self.user_id\r\n\r\n #MES- Other users can see all plans that are public\r\n return plans.find_all { |pln| pln.security_level == Plan::SECURITY_LEVEL_PUBLIC }\r\n end",
"def index\n @mealplans = Mealplan.all\n end",
"def index\n @ad_plans = AdPlan.all\n \n end",
"def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plans }\n end\n end",
"def index\n @weekplans = Weekplan.all\n end",
"def plan; connection_space.plan end",
"def roby_plan\n roby_app.plan\n end",
"def index\n @meeting_plans = MeetingPlan.all\n end",
"def index\n # @employee_plan = EmployeePlan.new\n\n @employee_plans = EmployeePlan.where(employee_id: current_user.employee_id)\n end",
"def index\n @check_plans = CheckPlan.all\n end",
"def plan_params plan\n {\n name: plan.name,\n plan_id: plan.id,\n status: plan.status,\n chargebee_data: {\n price: plan.price,\n period: plan.period,\n period_unit: plan.period_unit,\n trial_period: plan.trial_period,\n trial_period_unit: plan.trial_period_unit,\n charge_model: plan.charge_model,\n free_quantity: plan.free_quantity\n }\n }\n end"
] |
[
"0.7926094",
"0.7530647",
"0.7410767",
"0.73074496",
"0.7189474",
"0.70819163",
"0.6938462",
"0.6937519",
"0.6937519",
"0.6922988",
"0.6914073",
"0.68426526",
"0.68238723",
"0.67964655",
"0.67837745",
"0.6783648",
"0.6762163",
"0.675067",
"0.6743963",
"0.6743817",
"0.6728411",
"0.6705915",
"0.6672074",
"0.66660243",
"0.66511095",
"0.6622106",
"0.6608442",
"0.6599164",
"0.65969145",
"0.6593182",
"0.65697604",
"0.65665257",
"0.6547093",
"0.64795375",
"0.64564717",
"0.64498484",
"0.64313936",
"0.64276946",
"0.6394154",
"0.63769704",
"0.636356",
"0.63599896",
"0.6316163",
"0.63157564",
"0.6308526",
"0.62985015",
"0.6288389",
"0.6287691",
"0.62850195",
"0.6258992",
"0.6257304",
"0.6233191",
"0.6233191",
"0.6201935",
"0.6188711",
"0.61681056",
"0.6165766",
"0.6158992",
"0.6153468",
"0.61262584",
"0.61005044",
"0.6084705",
"0.6042878",
"0.6041853",
"0.6003634",
"0.6002943",
"0.6001017",
"0.59975046",
"0.59952676",
"0.5989777",
"0.59874934",
"0.5986753",
"0.5986398",
"0.5979149",
"0.5970611",
"0.5965254",
"0.5964067",
"0.59503883",
"0.59434605",
"0.59415597",
"0.59259844",
"0.5922211",
"0.5921368",
"0.59159124",
"0.5909898",
"0.5904772",
"0.58986413",
"0.5873252",
"0.5870111",
"0.5864609",
"0.58624506",
"0.58397084",
"0.5835373",
"0.58273757",
"0.58143884",
"0.5805297",
"0.5800249",
"0.57922906",
"0.5792211",
"0.5765483"
] |
0.69127774
|
11
|
Prints the best plan for the selected features. Shows the total price of the plan selected.
|
def to_s
if match?
"Best Plan: " + @plans_name + "for $" + '%.2f' % [(@cost * 100).round / 100.0]
else
"No matching plan for your features"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def optimal_plan=(plans)\n @plans = plans\n @cost = 0.00\n @plans_name = \"\"\n @features_count = 0\n @plans.each do |plan|\n @cost += plan['cost']\n @plans_name += plan['name'] + \" \"\n @features_count += plan['features'].size\n end\n end",
"def do_filtered_plan_display\n filter_plans @arguments.pattern\n\n unless plans.empty?\n frame('Plans') do\n puts build_display_string\n end\n else\n puts stylize(\"{{x}} No plans match #{@arguments.pattern.source}\")\n end\n end",
"def selection plan, solutions\n (sort_soluitons plan, solutions.shuffle.first(4)).first(2)\n end",
"def display_features\n puts\n puts \"Features:\"\n @features.each { |feature| puts \" * #{feature}\"}\n puts\n end",
"def cheaper?(plan)\n cost = plan.inject(0) {|sum,plan| sum + plan['cost']}\n features_count = plan.inject(0) {|sum,plan| sum + plan['features'].size}\n @cost.nil? or cost < @cost or (cost == @cost && features_count > @features_count)\n end",
"def show_planets our_solar_system\n all_planets = our_solar_system.planets\n puts \"Choose which planet:\"\n all_planets.length.times do |index|\n puts \"#{index+1}: #{all_planets[index].name}\"\n end\n puts \"Which planet info you want\"\n planet_choice = gets.chomp.to_i\n if planet_choice >=1 && planet_choice <= all_planets.length\n # Display all the planet objects in array.\n puts all_planets[planet_choice - 1].print_planet_info\n # Local variable which is assigned the planet that is selected\n choosen_planet = all_planets[planet_choice -1]\n all_planets.length.times do |index|\n # Skips the selected planet\n if planet_choice - 1 != index\n # Output the distance from other planet.\n puts \"✹ The distance from #{all_planets[index].name} is #{choosen_planet.distance_from_the_planet(all_planets[index])} km.\".bold\n puts \"\"\n end\n end\n end\nend",
"def get_pricing_of_partner(user, selected_plan)\n pricing = PartnerPricing.find_by_user_id(user)\n price = 0\n\n if selected_plan > 4\n selected_plan -= 4\n price += 20\n end\n\n plan = PAYMENT_PLAN_FOR_PARTNER[selected_plan]\n case plan\n when \"short_restricted\"\n price += pricing.short_restricted\n when \"full_restricted\"\n price += pricing.full_restricted\n when \"full_use\"\n price += pricing.full_use\n end\n\n return price\n end",
"def show\n @id = @plan.id\n @name = @plan.name\n @major = @plan.major\n end",
"def do_interactive_plan_selection\n options = (@selected_plan || plans).map { |k,v| [titleize(k.to_s), v] }.to_h\n\n @selected_plan = select(\"Select a plan under #{@plan_stack.join('/')}\", options: options)\n @plan_stack << titleize(@selected_plan.name)\n end",
"def pick_a_planet\n display_planet = nil\n puts \"\\nPlease choose from the following list of planets.\"\n planet_names = []\n @planets.each do |planet| # gets the names of the planets that currently exist in solar system\n planet_names << planet.name\n end\n puts planet_names\n\n # get planet choice and validate\n print \"\\nWhich planet would you like to \\\"learn\\\" more about? \"\n planet_choice = gets.chomp.capitalize\n planet_choice = planet_choice.gsub(\" \", \"\")\n while !planet_names.include? planet_choice\n print \"Sorry, which planet? \"\n planet_choice = gets.chomp.capitalize\n end\n\n # print the planet info for the chosen planet\n @planets.each do |planet|\n if planet.name == planet_choice\n puts planet.print_planet_data\n end\n end\n\n continue_or_quit\n end",
"def show_wagon(number)\n selected_train = select_train(number)\n selected_train.each_wagon do |wagon|\n puts \"Capasity: #{wagon.capacity}\"\n puts \"Train type: #{wagon.type}\"\n puts \"Free capacity: #{wagon.free_capacity}\"\n end\n end",
"def show\n set_client_profile(@plan)\n @goals = @plan.goals\n @tasks = @plan.tasks\n end",
"def print_planets\n puts \"\\n#{@name} has #{@planets.length} planets and was formed #{@formation_year} years ago.\"\n puts \"\\nHere are the planets in the #{@name} solar system:\\n\\n\"\n @planets.each do |planet|\n puts \"#{planet.print_planet_data}\"\n end\n puts \"\\n\"\n end",
"def show\r\n @tabs = SHOW_TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= SHOW_TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n\r\n case @current_tab\r\n when :summary\r\n\r\n when :rounds\r\n @rounds_grid = RoundGrid.new do |scope|\r\n scope.where(plan_id: @plan).page(params[:page]).per(20)\r\n end\r\n end\r\n end",
"def run\n solve(0)\n { price: @best_price, config: @best_config }\n end",
"def show\n @plans = Plan.find(params[:id])\n @foods = Food.all\n end",
"def display_plan_information(result)\n ui.info ui.color(\"Pre-update resource planning report:\", :bold)\n unless print_plan_result(result, [result.name])\n ui.info \"No resources life cycle changes detected in this update!\"\n end\n if config[:plan_apply]\n return ui.info \"Realizing this stack plan...\"\n elsif config[:plan_only]\n return\n end\n ui.confirm \"Realize this stack plan?\"\n end",
"def pricing_plan\n settings[:pricing_plan]\n end",
"def display_results\n make\n display_best\n display_mutations unless @mutations\n end",
"def estimate_cost(sql, *args)\n explanation = ask \"EXPLAIN (FORMAT JSON) #{sql}\", *args\n explanation.first.dig \"Plan\", \"Total Cost\"\n end",
"def display_planet_details\n puts \"Name: #{@name}, Primary Export: #{@primary_export}, Year-Length: #{@year_length}\"\n end",
"def run\n solve\n { price: @best_price, config: @best_config }\n end",
"def highest_priced_options\n possibilities = possibilites_matrix\n ( highest_total, highest_possibilities ) = highest_possibility_price( possibilities )\n end",
"def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend",
"def show\n if @deal.profile.boxberry_office_id.present? && @deal.weight.present? && @deal.sell.present?\n @cost = shipping_cost(@deal.profile.boxberry_office_id.to_i, @deal.weight.to_i, 1, 0, @deal.sell.to_i)\n else\n @cost = 0\n end\n end",
"def show\n @plan = Plan.find(params[:id])\n end",
"def select_plan\n unless params[:plan] && (params[:plan] == '1' || params[:plan] == '2')\n redirect_to root_url\n end\n end",
"def find_best_offers\n self.procurement_products.each do |p_product|\n p_product.find_best_offer\n end\n end",
"def final_solution(first, last, budget)\n best_cost = -1\n best_time = 0\n final_vertex = @vertex_array[last]\n final_vertex.valid_options.each do |ct_array|\n if ct_array[0] > best_cost && ct_array[0] <= budget\n best_cost = ct_array[0]\n best_time = ct_array[1]\n end\n end\n print \"\\nVertex #{@vertex_array[first].name} to vertex #{@vertex_array[last].name} has cost/time options:\\n\"\n count = 1\n print \" (Cost, Time)\\n\"\n @vertex_array[last].valid_options.each do |option|\n print \"#{count}\\t(#{option[0]}, #{option[1]})\\n\"\n count += 1\n end\n if best_cost == -1\n puts \"No solution found with budget #{budget}\"\n else\n print \"\\nBest solution found within budget of #{@budget} was:\\n Cost #{best_cost}\\n Time #{best_time}\\n\"\n true_path = get_path(@vertex_array[last].final_path, best_cost, best_time)\n print \"Path: \"\n count = 0\n while count < true_path.size - 1\n print \"#{true_path[count]} -> \"\n count += 1\n end\n puts true_path[count]\n end\n end",
"def plans\n [Free, FreePlus, Pro, Growth, ProSpecial, ProComped, ProManaged, EliteSpecial, Elite, Custom0, Custom1, Custom2, Custom3].map(&:name)\n end",
"def plan\n 0\n end",
"def help\n puts \"plan #{Plan::VERSION} - john crepezzi - http://github.com/seejohnrun/plan\"\n COMMAND_GLOSSARY.each do |cmd, description|\n puts \"\\e[0;33m#{cmd}\\e[0m - #{description}\"\n end\n end",
"def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarket[key], \"$\\n\"} \n\tend",
"def print_plan_result(info, names = [])\n said_any_things = false\n unless Array(info.stacks).empty?\n info.stacks.each do |s_name, s_info|\n result = print_plan_result(s_info, [*names, s_name].compact)\n said_any_things ||= result\n end\n end\n if !names.flatten.compact.empty? || info.name\n said_things = false\n output_name = names.empty? ? info.name : names.join(\" > \")\n ui.puts\n ui.puts \" #{ui.color(\"Update plan for:\", :bold)} #{ui.color(names.join(\" > \"), :blue)}\"\n unless Array(info.unknown).empty?\n ui.puts \" #{ui.color(\"!!! Unknown update effect:\", :red, :bold)}\"\n print_plan_items(info, :unknown, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.unavailable).empty?\n ui.puts \" #{ui.color(\"Update request not allowed:\", :red, :bold)}\"\n print_plan_items(info, :unavailable, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.replace).empty?\n ui.puts \" #{ui.color(\"Resources to be replaced:\", :red, :bold)}\"\n print_plan_items(info, :replace, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.interrupt).empty?\n ui.puts \" #{ui.color(\"Resources to be interrupted:\", :yellow, :bold)}\"\n print_plan_items(info, :interrupt, :yellow)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.remove).empty?\n ui.puts \" #{ui.color(\"Resources to be removed:\", :red, :bold)}\"\n print_plan_items(info, :remove, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.add).empty?\n ui.puts \" #{ui.color(\"Resources to be added:\", :green, :bold)}\"\n print_plan_items(info, :add, :green)\n ui.puts\n said_any_things = said_things = true\n end\n unless said_things\n ui.puts \" #{ui.color(\"No resource lifecycle changes detected!\", :green)}\"\n ui.puts\n said_any_things = true\n end\n end\n said_any_things\n end",
"def plan\n plan_rebuilder.plan\n end",
"def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end",
"def show_price(options = {})\n price_unpacked.to_s + '€ per piece, ' + price_packed.to_s + '€ per box'\n end",
"def print_factoids_options\n puts \"Available factoids are: \".light_magenta\n puts \" Country/countries with the MOST cases\".light_red\n puts \" Country/countries with the LEAST cases\".light_red\n puts \" Country/countries with the MOST NEW cases\".light_red\n puts \" Country/countries with the MOST RECOVERED cases\".light_red\n puts \"Which factoid would you like to see?\".light_magenta\n puts \"Please enter MOST, LEAST, MOST NEW, or MOST RECOVERED\".green\n end",
"def plan\n @courses = Course.all\n @semesters = Semester.all\n @p_planners = PastPlanner.find_all_semester_groups(current_user)\n @f_planners = FuturePlanner.find_all_semester_groups(current_user)\n end",
"def total_tuition_cost\n tuition_cost = courses.inject(0) {|sum, c| sum + c.cost}\n tuition_cost = sprintf( \"%0.02f\", tuition_cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\n puts \"\\nTotal tuition paid: $#{tuition_cost}\n \\n\"\n\n # puts tp self.courses,:subject,:cost\n tp self.courses,:subject, {\"Course Coste\" => {:display_method => lambda{|x| \"$\" + \"#{sprintf( \"%0.02f\", x.cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse}\"}}}\n\n end",
"def display_planet_list\n puts \"Here are the current planets in our solar system:\"\n @all_planets.each do |planet_info|\n puts planet_info.name\n end\n end",
"def offer_display( hotel_name, offer_available , normal_rate, normal_tax )\n o_from, o_to, o_rate = offer_available.start, offer_available.end , offer_available.rate.to_i \n visit_time_period = ( @to - @from ).to_i + 1\n puts \"\\n\\n****Amazing choice, you are walking in during a special season**** \n '#{offer_available.name.upcase}' from #{o_from.strftime(\"%m/%d/%Y\")} till #{o_to.strftime(\"%m/%d/%Y\")} at #{hotel_name}\"\n bill = calculate_bill( hotel_name, visit_time_period, o_to, o_from, o_rate, normal_rate, normal_tax )\n puts \"\\nStay at #{hotel_name} \\n From : #{from.strftime(\"%m/%d/%Y\")} \\t\\t\\t To : #{to.strftime(\"%m/%d/%Y\")} (including offer)\\n TOTAL : #{bill.to_i}\"\n end",
"def print_total_cost\n order_desc = []\n order_desc << \"----------------------------\"\n order_desc << \"Item Quantity Price\"\n order_desc << \"----------------------------\"\n \n total_price = 0\n saved_cost = 0\n purchased_items.each do |item, count|\n unit_price = PRICE_MAP[item][:unit_price].to_f\n\n if PRICE_MAP[item][:sale_price]\n qty = PRICE_MAP[item][:sale_price][:qty]\n unit_qty = qty.to_i.zero? ? 1 : qty\n if count < unit_qty\n unit_price *= count\n else\n sale_price = PRICE_MAP[item][:sale_price][:price].to_f\n offer_price = (unit_price * (count % unit_qty)) + (sale_price * (count / unit_qty))\n saved_cost += (unit_price * count) - offer_price\n unit_price = offer_price\n end\n else\n unit_price *= count\n end\n unit_price = ('%.2f' % unit_price).to_f\n order_desc << \"#{item} #{count} $#{unit_price}\"\n total_price += unit_price\n end\n order_desc << \"\"\n order_desc << \"Total price : $#{'%.2f' % total_price}\"\n order_desc << \"You saved $#{'%.2f' % saved_cost} today.\" unless saved_cost.zero?\n order_desc << \"\"\n order_desc.map {|d| puts d }\n end",
"def best_rate_plan(params)\n u_id = JTB::UnitId.from_roomorama_unit_id(params[:unit_id])\n\n cache_key = build_cache_key(params, u_id)\n cache_duration = 10 * 60 # ten minutes\n\n result = with_cache(cache_key, freshness: cache_duration) do\n message = builder.quote_price(params[:property_id], u_id.room_type_code, params[:check_in], params[:check_out])\n remote_call(message)\n end\n\n return result unless result.success?\n\n rate_plans_ids = rate_plans_ids(u_id.room_code)\n response_parser.parse_rate_plan(result.value, params[:guests], rate_plans_ids)\n end",
"def show\n id = @call.plan_id\n @plan = Plan.find(id)\n @plan = @plan.name\n end",
"def information\n @selected_plan = BillingPlan.find_by(stripe_plan_id: params['plan'], available: true)\n @stripe_customer = Stripe::Customer.retrieve(current_user.stripe_customer_id)\n end",
"def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend",
"def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend",
"def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend",
"def biggest_plan\n is_user = @current_user.respond_to? :subscriptions \n subs = is_user ? (@current_user.subscriptions.map{ |x| x.price if x.subscription_status_id == 11 }.compact.max) : ({ m: 'Temp user' })\n render json: subs\n end",
"def display_object\n\tputs \"Name: #{name}\"\n\tpretty_price = format(\"%0.2f\", price)\n\tputs \"Price: $#{pretty_price}\"\n\tputs \"Size: #{size}\"\n end",
"def display\n port_total\n display_port\n overall_total\n end",
"def print_info\n puts \" Planet Summary\"\n puts \"=============================================================\"\n puts \"Planet Name: #{@name.capitalize}\"\n puts \"Mass: #{@mass} e+24 kg\"\n puts \"Diameter: #{@diameter} km\"\n puts \"Number of Moons: #{@number_of_moons}\"\n puts \"Average Distance From The Sun: #{@distance_from_the_sun} e+6 km\"\n puts \"Rate of Solar Rotation: #{@rate_of_solar_rotation} hours\"\n puts \"Orbital Period: #{@orbital_period} Earth days\\n\\n\"\n end",
"def plans_classes\n cls = 'plans'\n if @selected_plan\n cls << ' plan-selected'\n end\n cls\n end",
"def highest_options_sum\n possibilities = possibilites_matrix\n ( highest_total, highest_possibilities ) = highest_possibility_price( possibilities )\n highest_total\n end",
"def show\n @plan = SemesterPlan.find(params[:id])\n @users = []\n @users = User.users_of_plan_pure @plan\n @slots = []\n @options = {0 => \"manuellen Plan erstellen\", 1 => \"gültige Lösungen berechnen lassen\", 2 => \"hinreichend optimale Lösung berechnen lassen\"}\n @users.each do |user|\n found = !SemesterPlanConnection.are_build?(user, @plan)\n @plan.time_slots.each do |slot|\n type = slot_type slot\n if found\n @slots << SemesterPlanConnection.create(user: user, time_slot: slot, typus: type, availability: 0)\n else\n @slots << SemesterPlanConnection.find_it(user, slot)\n end\n end\n end\n end",
"def print_choices\n puts \"(L)atte $4.00\"\n puts \"(S)cone $5.00\"\n puts \"(T)ea $3.00\"\n puts \"(D)one\"\n puts\n end",
"def print_report\n # total_bikes = @fleet.count \n # broken_bikes = @fleet.count {|b| b.is_broken?}\n # working_bikes = total_bikes-broken_bikes\n total_people = @people.count\n total_stations = @stations.count\n # show_stations = @stations.each do {|name, capacity| puts \"#{name}, #{capacity}\"}\n #tell me its name and capcity\n # puts \"Total bikes: #{total_bikes}\"\n # puts \"Broken bikes: #{broken_bikes}\"\n # puts \"Working bikes: #{working_bikes}\"\n puts \"Total people: #{total_people}\"\n # puts \"People with bikes: #{people_with_bikes}\"\n puts \"People without bikes #{people_without_bikes.count}\" \n puts \"Number of stations: #{total_stations}\" \n puts \"Stations:\"\n @stations.each do |station|\n puts \"#{station.name}, #{station.capacity}, #{station.bikes.count}\"\n end\n # result = \"total bikes #{total_bikes}\\n\" + \"broken bikes #{broken_bikes}\\n\" + \"working bikes #{working_bikes}\\n\"\n # result + \"total people #{total_people}\\n\" + \"people with bikes #{people_with_bikes}\\n\" + \"people without bikes #{people_without_bikes}\\n\" + \"number of stations #{total_stations}\\n\" + \"stations #{show_stations}\"\n end",
"def display\n\t\t\"SUITE: #{@suite}, RANK: #{@rank}, VALUE: #{@value}\"\n\tend",
"def per_ticket_cost\n flight_cost\n end",
"def modes_of_transportation (car, bike)\n puts \"A #{car} is faster than a #{bike}\"\n end",
"def show\n @unit_planner = UnitPlanner.find(params[:id])\n \n @skills = Skill.all(:include=>{:strategies=>:approaches}, :order=>\"skills.label\", :conditions=>[\"approaches.unit_planner_id=?\", @unit_planner.id])\n\n # move to model? Also, this seems a bit complicated. Any way to simplify?\n x = @unit_planner.objectives\n y = @unit_planner.formative_tasks.collect{|ft| ft.objectives}.flatten.uniq\n @objectives_sans_formative_tasks = (x - y).collect{|z| \"#{z.criterion.category}.#{z.subcategory}\"}.sort\n @criterions_sans_summative_tasks = (@unit_planner.criterions - @unit_planner.summative_tasks.collect(&:criterions).flatten.uniq).collect(&:category).join(\", \")\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @unit_planner }\n end\n end",
"def best_fans\n @teams.max_by { |team| team.home_minus_away_percentage }.team_name\n end",
"def print_planet_distance\n puts \"\\nWhich planets do you want to know the distance between? \"\n print \"Planet #1: \"\n planet1 = gets.chomp.capitalize\n print \"Planet #2: \"\n planet2 = gets.chomp.capitalize\n if in_my_solar_system?(planet1) && in_my_solar_system?(planet2)\n distance = find_distance(planet1, planet2)\n puts \"The distance between #{planet1} and #{planet2} is \" +\n \"#{'%.1f' % distance} million kilometers.\"\n end\n end",
"def plans\n @plans ||= spinner('Loading plans') { Loader.load_all configuration.plan_files }\n end",
"def display_product\n STDOUT.puts \"--\"*50\n STDOUT.puts \"title: \\t\\t#{$title}\"\n STDOUT.puts \"seller: \\t#{$seller}\"\n STDOUT.puts \"price: \\t\\t#{$price}\"\n STDOUT.puts \"stars: \\t\\t#{$stars}\"\n STDOUT.puts \"reviews: \\t#{$reviews}\"\n STDOUT.puts \"image url: \\t#{$image_href}\"\n STDOUT.puts \"product url: \\t#{$url}\"\n end",
"def\tbest_price_restaurant(item_labels)\n @item_search, @meal_combo, @results = [], [], []\n if item_present?(item_labels)\n search_meal_combo\n separate_meal_combo\n calculate_minimum_price\n output_result\n else\n \"Menu item not found\"\n end\n end",
"def show\n courier_cost = CourierCost.first\n @courier_cost = !courier_cost.nil? ? courier_cost.cost : 30;\n end",
"def show_ind which=:best, until_end: false\n ind = case which\n when :best then opt.best.last\n when :mean then opt.mu\n when NArray then which\n else raise ArgumentError, \"Which should I show? `#{which}`\"\n end\n nsteps = until_end ? max_nsteps*1000 : max_nsteps\n print \"Re-running best individual \"\n fit = fitness_one ind, render: true, nsteps: nsteps\n puts \"-- fitness: #{fit}\"\n end",
"def opportunity_select_cost_or_offer\n [\n ['Quiero poner un valor para el proyecto', Opportunity::OPTION_FOR_COST],\n ['Quiero escuchar ofertas de los estudiantes', Opportunity::OPTION_FOR_OFFER]\n ]\n end",
"def call\n result[:plan_features] = plan.features\n end",
"def display_plan_lists(stack)\n unless stack\n raise \"Failed to locate requested stack `#{name_args.first}`\"\n end\n plans = stack.plans.all\n if plans.empty?\n ui.warn \"No plans found for stack `#{stack.name}`\"\n return\n end\n ui.info \"Plans for stack: #{ui.color(stack.name, :bold)}\\n\"\n n_width = \"Plan Name\".length\n i_width = \"Plan ID\".length\n s_width = \"Plan State\".length\n c_width = \"Created\".length\n plan_info = plans.map do |plan|\n plan_id = plan.id.to_s.split(\"/\").last\n n_width = plan.name.to_s.length if plan.name.to_s.length > n_width\n i_width = plan_id.to_s.length if plan_id.length > i_width\n s_width = plan.state.to_s.length if plan.state.to_s.length > s_width\n c_width = plan.created_at.to_s.length if plan.created_at.to_s.length > c_width\n [plan.name, plan_id, plan.state, plan.created_at]\n end\n table = ui.table(self) do\n table(:border => false) do\n row(:header => true) do\n column \"Plan Name\", :width => n_width + 5\n column \"Plan ID\", :width => i_width + 5\n column \"Plan State\", :width => s_width + 5\n column \"Created\", :width => c_width + 5\n end\n plan_info.sort_by(&:first).each do |plan|\n row do\n plan.each do |item|\n column item\n end\n end\n end\n end\n end.display\n end",
"def sort\n\t\tputs \"Enter maximum price.\"\n\t\tuser_choice = gets.chomp.to_i\n\t\toutput_action_header(\"***sortingting restaurants***\")\n\t\trestaurants = Restaurant.saved_restaurants\n\t\tfound_restaurant_array = []\n\t\t\trestaurants.each do |rest|\n\t\t\tif rest.price.to_i <= user_choice\n\t\t\t\tfound_restaurant_array << rest\n\t\t\tend\n\t\tend\n\t\tif !found_restaurant_array.empty?\n\t\toutput_restaurant_table(found_restaurant_array)\n\t\telse\n\t\t\toutput_action_footer(\"oops! could not find an entry\")\n\t\tend\n\tend",
"def show\n @plan = Plan.includes(\n template: [:phases], guidance_groups: [:guidances]\n ).find_by(id: params[:id])\n raise ActiveRecord::RecordNotFound if @plan.blank?\n\n authorize @plan\n @visibility = if @plan.visibility.present?\n @plan.visibility.to_s\n else\n Rails.configuration.x.plans.default_visibility\n end\n # Get all of the available funders\n @funders = Org.funder\n .joins(:templates)\n .where(templates: { published: true }).uniq.sort_by(&:name)\n # TODO: Seems strange to do this. Why are we just not using an `edit` route?\n @editing = (!params[:editing].nil? && @plan.administerable_by?(current_user.id))\n\n # Get all Guidance Groups applicable for the plan and group them by org\n @all_guidance_groups = @plan.guidance_group_options\n @all_ggs_grouped_by_org = @all_guidance_groups.sort.group_by(&:org)\n @selected_guidance_groups = @plan.guidance_groups\n\n # Important ones come first on the page - we grab the user's org's GGs and\n # \"Organisation\" org type GGs\n @important_ggs = []\n\n if @all_ggs_grouped_by_org.include?(current_user.org)\n @important_ggs << [current_user.org, @all_ggs_grouped_by_org[current_user.org]]\n end\n\n @default_orgs = Org.default_orgs\n @all_ggs_grouped_by_org.each do |org, ggs|\n @important_ggs << [org, ggs] if @default_orgs.include?(org)\n\n # If this is one of the already selected guidance groups its important!\n @important_ggs << [org, ggs] if !(ggs & @selected_guidance_groups).empty? && @important_ggs.exclude?([org, ggs])\n end\n\n # Sort the rest by org name for the accordion\n @important_ggs = @important_ggs.sort_by { |org, _gg| (org.nil? ? '' : org.name) }\n @all_ggs_grouped_by_org = @all_ggs_grouped_by_org.sort_by do |org, _gg|\n (org.nil? ? '' : org.name)\n end\n @selected_guidance_groups = @selected_guidance_groups.ids\n\n @based_on = if @plan.template.customization_of.nil?\n @plan.template\n else\n Template.where(family_id: @plan.template.customization_of).first\n end\n\n @research_domains = ResearchDomain.all.order(:label)\n\n respond_to :html\n end",
"def show_all\n styled_header('Resources')\n display_addons(get_addons, ['Plan', 'Name', 'Billed to', 'Price'])\n end",
"def show\n @plans = Stripe::Plan.all\n end",
"def print_label\n puts \"#{@nombre_etiqueta}\"\n puts \"\\nValor energetico o nutriente | por 100g o 100ml de producto \"\n puts \"--------------------------------|--------------------------------\"\n puts \"valor energetico |\" + \" #{energetic_value_KJ}\" + \" KJ/\" + \"#{energetic_value_Kcal}\" + \" Kcal\"\n puts \"Camtidad de grasas |\" + \" #{@grasa}g\"\n puts \"Camtidad de grasas saturadas |\" + \" #{@grasa_saturada}g\"\n puts \"Camtidad de hidratos de carbono |\" + \" #{@hid_carbono}g\"\n puts \"Camtidad de azucares |\" + \" #{@azucares}g\"\n puts \"Camtidad de proteinas |\" + \" #{@proteinas}g\"\n puts \"Camtidad de sal |\" + \" #{@sal}g\"\n @nombre_etiqueta\n end",
"def best\n @best = User.find_paginated_best_bands_and_deejays :page => params[:page], :per_page => 3\n render :partial => 'best'\n end",
"def list_all_planets\n puts \"The #{ @system } system has these #{ @all_planets.length } planets:\"\n @all_planets.each do |planet|\n puts \"#{@all_planets.index(planet)+1}. #{planet.name}\"\n end\n end",
"def show\n @master_plan = MasterPlan.find(params[:id])\n add_breadcrumb(\"#{@master_plan.client.name} #{t('model.list', model: Project.model_name.human)}\", :client_projects_path)\n add_breadcrumb(@master_plan.project.name)\n\n if @master_plan.medium_master_plans.count > 0\n if params[:medium_id]\n @selected_medium_master_plan = @master_plan.medium_master_plans.where(medium_id: params[:medium_id]).first\n end\n @selected_medium_master_plan = @master_plan.medium_master_plans.first unless @selected_medium_master_plan\n @master_plan_items_grid = initialize_grid(\n MasterPlanItem.where(\"master_plan_id=#{@master_plan.id} and medium_id=#{@selected_medium_master_plan.medium_id}\").order('is_on_house, created_at'),\n name: 'medium_master_plan_items_grid',\n per_page: 100)\n end\n\n @choose_spots_path_params =\n {\n id: @master_plan.id,\n client_id: @master_plan.client_id,\n project_id: @master_plan.project_id\n }.merge(session[:spot_picker])\n\n respond_to do |format|\n format.html\n format.json { render json: @master_plan }\n end\n end",
"def show\n @sub_index = params[:sub_index]\n @tab_index = params[:tab_index]\n if @sub_index.to_i == -1\n @plan_id_code = params[:plan_id_code]\n @plan_type = Plan.where('plan_id_code=' + @plan_id_code.to_s).first.plan_type\n @plan_abb_name = Plan.where('plan_id_code=' + @plan_id_code.to_s).first.abbreviated_name\n @tab_index = Plan.plan_types[@plan_type] + 3\n end\n render :edit\n end",
"def present_menu\n puts \"-------------------\"\n puts t('select_features')\n puts t('feature_one')\n puts t('feature_two')\n puts t('feature_three')\n puts t('exit_option')\n\n selected_feature = gets.to_i\n\n case selected_feature\n when FEATURE_OPTION_MAJOR_STATES\n print_major_states\n when FEATURE_OPTION_AVERAGE_POP\n print_average_population_for_state\n when FEATURE_OPTION_BOUNDARY_CITIES\n print_boundary_cities_for_state\n when FEATURE_OPTION_EXIT\n return\n else\n puts t('invalid_option', option: selected_feature)\n run\n end\n end",
"def show_service_plan(id, opts = {})\n data, _status_code, _headers = show_service_plan_with_http_info(id, opts)\n data\n end",
"def select_options(offer)\n puts \"basepage select options\"\n @offer = offer.first\n begin\n @steps_loc = get_locators()\n puts \"steps_loc loc\"\n puts @steps_loc\n puts \"loc done\"\n rescue => e\n e.display\n end\n begin\n pages = get_pattern\n puts \"pages\"\n puts pages\n puts \"pages done\"\n Rails.logger.info pages\n pages.each do |page|\n puts \"page\"\n puts page\n puts \"page\"\n page.each do |step|\n puts \"step\"\n puts step\n puts \"step\"\n begin\n case step\n when \"Product\", \"Brandpseudo\"\n select_product\n when \"Kit\"\n select_kit\n when \"Gift\"\n select_gift\n when \"Supply\"\n select_supply\n when \"Fragrance\"\n select_fragrance\n when \"Shade\"\n select_shade\n when \"Formula\"\n select_formula\n when \"Pack\"\n select_pack\n when \"Duo\"\n select_duo\n end \n rescue => e\n e.display\n end\n end #of step execution\n end #of sas module selection \n # click_if_exists(:css, '#checkout.marketing-button-next')\n rescue => e\n e.display\n # TODO handle other situations\n end\n\n page = T5::Cart.new(@campaign_configuration)\n page.browser = @browser\n return page.adapt\n end",
"def show\n @pricing_plan = PricingPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pricing_plan }\n end\n end",
"def print_planet_info\n puts \"☛ Planet #{@name} takes #{@year_length} earth days to go around its star.✰\".bold\n puts \"\"\n puts \"◆ It is #{@distance_from_the_sun} kilometers away from the sun ☀️ and has a mass of #{@mass} kilogram.\".bold\n puts \"\"\n puts \"◆ It's diameter is #{@diameter} kilometer and it has these atmospheric components: #{@atmospheric_components}.\".bold\n puts \"\"\n end",
"def printout_best_timings\n # Bail out in case there are no results to process:\n unless @team.meeting_individual_results.exists?\n flash[:error] = I18n.t('radiography.team.no_data_to_process_for_this_team')\n redirect_to( team_radio_path(id: @team.id) ) and return\n end\n # Bail out in case there are no best-timings to process:\n unless IndividualRecord.for_team( @team.id ).exists?\n flash[:error] = I18n.t('radiography.team.no_record_found_for_this_team')\n redirect_to( team_radio_path(id: @team.id) ) and return\n # TODO / FUTURE DEV [Steve, 20170413] Eventually, it could be possibile to fall-back\n # to a real-time computation of the team's best timings, using the same\n # (OLD) implementation from the above action:\n #\n # @team_bests = @team_best_finder.split_categories( @team_best_finder.scan_for_distinct_bests )\n end\n\n # Setup the record collection and get the pre-calc records MIRs:\n team_distinct_best_dao = RecordX4dDAO.new( @team, RecordType.find_by_code( 'TTB' ) )\n\n # Scan the pre-computed records and fill the collection DAO with each records'MIR row found:\n IndividualRecord.for_team( @team.id ).includes(:meeting_individual_result)\n .joins(:meeting_individual_result).each do |record|\n team_distinct_best_dao.add_record( record.meeting_individual_result )\n end\n\n @team_best_finder = TeamBestFinder.new( @team )\n @team_bests = @team_best_finder.split_categories( team_distinct_best_dao )\n # == OPTIONS setup + RENDERING phase ==\n base_filename = \"#{ I18n.t('radiography.team.ttb_records_basefilename') }_#{ @team.id }\"\n filename = create_unique_filename( base_filename ) + '.pdf'\n options = {\n report_title: I18n.t('radiography.team.ttb_records_title'),\n meta_info_subject: 'team best-timings records printout',\n meta_info_keywords: \"Goggles, #{base_filename}'\",\n team: @team,\n team_best_finder: @team_best_finder,\n team_bests: @team_bests\n }\n send_data( # == Render layout & send data:\n TeamBestTimingsLayout.render( options ),\n type: 'application/pdf',\n filename: filename\n )\n end",
"def summary\n return \"\\nThis planet is called #{@name}. It is #{@color} in color, #{@mass_kg} kilograms in weight, \n and #{@distance_from_sun_km} kilometers from the sun. A fun fact about this planet: #{@fun_fact}.\"\n end",
"def plane_weight(cargo, passengers, carry_on)\n puts \"\\nFor #{cargo} pounds of cargo and #{passengers} passengers with #{carry_on} carry-on bags:\\n\"\n puts \"\\nThe 737 will be carrying #{cargo} pounds of cargo.\\n\"\n total_passenger_weight = 190 * passengers\n puts \"The plane will be carrying #{total_passenger_weight} estimated pounds of passengers.\\n\"\n total_carry_on_weight = 15 * carry_on\n puts \"The plane will be carrying #{total_carry_on_weight} estimated pounds of carry-on bags.\\n\"\n total_weight = cargo + total_passenger_weight + total_carry_on_weight\n puts \"The total weight of this planes load is #{total_weight} pounds.\\n\\n\"\n if total_weight <= 45000\n puts \"This 737 is SAFE to fly, with #{45000 - total_weight} pounds of extra capacity.\"\n elsif total_weight >= 45000\n puts \"This 737 is NOT SAFE to fly, it is #{total_weight - 45000} pounds over capacity.\\n\\n\"\n end\nend",
"def show\n marketplace_default_name = @current_community.name(@current_community.default_locale)\n\n PlanService::API::Api.plans.get_external_service_link(\n id: @current_community.id,\n ident: @current_community.ident,\n domain: @current_community.use_domain? ? @current_community.domain : nil,\n marketplace_default_name: marketplace_default_name\n ).on_success { |link|\n redirect_to link\n }.on_error { |error_msg|\n render_not_found!(error_msg)\n }\n end",
"def show_train(name)\n selected_station = select_station(name)\n selected_station.each_train do |train|\n puts \"Train number: #{train.number}\"\n puts \"Train type: #{train.type}\"\n puts \"Train speed: #{train.speed}\"\n puts \"Wagons list: #{train.wagons.size}\"\n end\n end",
"def pt(label, totals)\n puts \" #{label}\"\n totals.sort.each { |name, amount| puts \" #{name}: #{amount}\" }\nend",
"def draw_mp_cost\n values = []\n values.push(item.mp_cost) if item.mp_cost > 0\n values.push(sprintf('%d%%', item.mp_cost_per)) if item.mp_cost_per > 0\n return if values.empty?\n draw_detail(Vocab.attribute(:mp_cost), values.join('+'))\n end",
"def show_planet(number)\n selected = @solar_system[number-1]\n\n # Calculate planet related ages\n age = 4.5e9/(selected.rotation_time/12.0)\n age = age.to_i.to_s\n age = age.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n\n # Calculate the closest neighboring planets\n # Collect names and distances of planets\n distance_and_name = []\n @solar_system.length.times do |i|\n planet_info = {}\n planet_info[:name] = @solar_system[i].name\n planet_info[:distance] = @solar_system[i].distance_from_the_sun\n distance_and_name << planet_info\n end\n # Get only the distances and sort them\n planet_distances = []\n @solar_system.each do |planet|\n planet_distances << planet.distance_from_the_sun\n end\n ordered_planets = planet_distances.sort\n number_index = ordered_planets.index(selected.distance_from_the_sun).to_i\n\n # Find the select planet's distance neighbors (2)\n if (number_index+1) == @solar_system.length\n neighbor1_distance = 0\n neighbor1_difference = 0\n else\n neighbor1_distance = ordered_planets[(number_index+1)]\n neighbor1_difference = (selected.distance_from_the_sun - neighbor1_distance).abs.round(2)\n end\n if (number_index-1) < 0\n neighbor2_distance = 0\n neighbor2_difference = 0\n else\n neighbor2_distance = ordered_planets[(number_index-1)]\n neighbor2_difference = (selected.distance_from_the_sun - neighbor2_distance).abs.round(2)\n end\n neighbor1_name = \"\"\n neighbor2_name = \"\"\n distance_and_name.each do |planet|\n if neighbor1_distance == planet[:distance]\n neighbor1_name << planet[:name]\n end\n if neighbor2_distance == planet[:distance]\n neighbor2_name << planet[:name]\n end\n end\n if neighbor1_distance == 0 && neighbor2_distance == 0\n true_neighbor = \"not to be found\"\n true_distance = \"both infinity and negative infinity\"\n elsif neighbor1_distance == 0 && neighbor2_distance > 0\n true_neighbor = neighbor2_name\n true_distance = neighbor2_difference\n elsif neighbor2_distance == 0 && neighbor1_distance > 0\n true_neighbor = neighbor1_name\n true_distance = neighbor1_difference\n else\n true_neighbor = \"#{neighbor2_name} and #{neighbor1_name}\"\n true_distance = \"#{neighbor2_difference} and #{neighbor1_difference}\"\n end\n\n # Text summary shown to user\n text = \"\\nThe planet \\[#{selected.name}\\] is #{selected.distance_from_the_sun} Astronomical Units from the sun.\n \\rThe closest neighboring planet(s) is/are #{true_neighbor}, which is/are #{true_distance} AU away.\n \\rIt orbits the sun once every #{selected.rotation_time} Earth months, or #{(selected.rotation_time/12.0).round(2)} Earth years.\n \\rSince our sun is 4.5 billion Earth years old, this planet's age is #{age}!\n \\r#{selected.name} also enjoys #{selected.moon_count} moon(s) orbitin' around it.\\n\"\n return text\n end",
"def show\n set_client_profile(@goal)\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n\n @needs = @goal.needs\n end",
"def plan_description\n end",
"def display_results()\n @customers = @customers.sort_by{ |customer,values| values[:points] }.reverse\n @customers.map { |customer,values|\n if values[:total_amount] > 0\n print(\"#{customer}: #{values[:points]} points with #{values[:average_points]} points per order. \\n\")\n else\n print(\"#{customer}: No orders.\\n\")\n end\n }\n end",
"def summary\n return \"The planet #{@name} is #{@color} in color. It weighs #{@mass_kg} kilograms and is #{@distance_from_sun_km} kilometers from the sun. Fun fact: #{@fun_fact}.\"\n end",
"def print\n\t\t\tputs \"F: \" + toFahrenheit(@degrees, @scale).to_s + \" C: \" + toCelsius(@degrees, @scale).to_s + \" K: \" + toKelvin(@degrees, @scale).to_s\n\t\tend",
"def display_available_options\n output.puts\n if user_package.model_info.has_selected_model?\n output.puts \"Available Options: \"\n output.puts CarOptionList.available_options.to_s(\"\\n\")\n else\n output.puts \"You need to select a model before adding options!\"\n end\n end"
] |
[
"0.62128544",
"0.58965933",
"0.57153493",
"0.5684067",
"0.5590316",
"0.55577505",
"0.5530362",
"0.55002445",
"0.54985905",
"0.54802513",
"0.5435955",
"0.54123163",
"0.53586847",
"0.5356282",
"0.5331135",
"0.5311932",
"0.5305011",
"0.52871114",
"0.52792466",
"0.52788854",
"0.52460486",
"0.52400446",
"0.52179813",
"0.5205399",
"0.5199401",
"0.51873124",
"0.5187164",
"0.5165996",
"0.5149395",
"0.51442224",
"0.51427966",
"0.51390296",
"0.51291233",
"0.51269656",
"0.5096856",
"0.5083219",
"0.5074377",
"0.5056941",
"0.50478387",
"0.5024375",
"0.5024344",
"0.5024262",
"0.501294",
"0.50125706",
"0.49970683",
"0.49755833",
"0.49686205",
"0.49686205",
"0.49686205",
"0.49679005",
"0.49582088",
"0.4956864",
"0.4955021",
"0.49502042",
"0.4937033",
"0.49266392",
"0.49210006",
"0.4919234",
"0.49175352",
"0.4916587",
"0.491467",
"0.4901506",
"0.49014902",
"0.48977503",
"0.4895269",
"0.48926836",
"0.488145",
"0.4865305",
"0.48597553",
"0.48566392",
"0.4849824",
"0.48469177",
"0.48424467",
"0.48400086",
"0.48177123",
"0.48111704",
"0.48083925",
"0.48049104",
"0.4802859",
"0.48020205",
"0.48018554",
"0.4799768",
"0.4791807",
"0.47888088",
"0.47874445",
"0.47850573",
"0.47846574",
"0.47845173",
"0.47816527",
"0.4776896",
"0.47752896",
"0.47597754",
"0.47587594",
"0.47581518",
"0.47568023",
"0.4756106",
"0.47471344",
"0.47437358",
"0.47421455",
"0.47416866"
] |
0.70799404
|
0
|
is there at least one matching plan(s) for requested features
|
def match?
@plans and @plans.size > 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_feature?(*feature_names, match: :all?)\n features = get_var!(\"features\", single_match: :force)\n feature_names.map(&:to_s).send(match) do |feature_name|\n features.include? feature_name\n end\n end",
"def cheaper?(plan)\n cost = plan.inject(0) {|sum,plan| sum + plan['cost']}\n features_count = plan.inject(0) {|sum,plan| sum + plan['features'].size}\n @cost.nil? or cost < @cost or (cost == @cost && features_count > @features_count)\n end",
"def check_features\n # case params[:action]\n # when \"index\"\n # current_features.include?('feature_key') ? true : invalid_features \n # end\n return true\n end",
"def legit_feature?\n Flipflop.feature_set.features.map(&:name).include?(params[:feature])\n end",
"def plans?\n true\n end",
"def single_plan?\n !multiple_plans?\n end",
"def suitable_for_any?\n \treturn self.disciplines.count > 0\n end",
"def get_required_features(features)\n end",
"def feature?(feature)\n definition[:features]&.include?(feature)\n end",
"def has_feature?(*)\n end",
"def find_plans\n unless self.plan_names.blank?\n my_plans = Plan.by_name(plan_names)\n if my_plans.blank? || my_lifecycles.length < self.plan_names.length\n self.plans_lookup_failed = true\n else\n self.plans = my_plans\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end",
"def filtered_features(rollout, feature_names)\n feature_names.select do |feature_name|\n feature = rollout.get(feature_name)\n user_match = params[:user].nil? || feature.users.member?(params[:user])\n group_match = params[:group].nil? || feature.groups.member?(params[:group].to_sym)\n user_match && group_match\n end\n end",
"def exists?\n self.class.exists?(features)\n end",
"def multiple_plans?\n stripe_plan.nil?\n end",
"def finished?\r\n return passengers.all? {|x| x.plan.empty? }\r\n end",
"def has_feature_constraint?(name = nil)\n if !name\n any?(&:has_feature_constraint?)\n else\n any? { |bit| bit.enabled_by_feature?(name) }\n end\n end",
"def matches_requirement?(query, option, requirement); end",
"def plan?\n now = Time.zone.now\n\n have_discounts = clients_plans.with_discounts\n !have_discounts.empty? && have_discounts.any? do |plan|\n now < plan.expired_date\n end\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('department_index') ? true : invalid_features\n when \"new\"\n current_features.include?('department_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('department_edit') ? true : invalid_features\n when \"delete_multiple\"\n current_features.include?('department_delete') ? true : invalid_features\n end\n # return true\n end",
"def used?\n return true unless Counsel.where(survey: self).empty?\n return true unless Solicitation.where(survey: self).empty?\n return true unless Promulgation.for_survey(self).empty?\n return false\n end",
"def supports?(feature_name)\n features.key? feature_name\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('present_index') ? true : invalid_features\n when \"employee_present\"\n current_features.include?('present_employee') ? true : invalid_features\n when \"my_absence\"\n current_features.include?('present_detail') ? true : invalid_features\n when \"presence_report\"\n current_features.include?('present_report') ? true : invalid_features\n\n # Terlambat tab\n when \"late\"\n current_features.include?('late_index') ? true : invalid_features\n when \"override_late\"\n current_features.include?('override') ? true : invalid_features\n when \"show\"\n current_features.include?('late_detail') ? true : invalid_features\n\n # Jam Kerja Lebih tab\n when \"more_hour\"\n current_features.include?('working_hours_more_index') ? true : invalid_features\n\n # Jam Kerja Kurang tab\n when \"less_hour\"\n current_features.include?('working_hours_less_index') ? true : invalid_features\n\n # Istirahat Lebih tab\n when \"more_rest\"\n current_features.include?('less_rest_index') ? true : invalid_features\n\n # Istirahat Kurang tab\n when \"less_rest\"\n current_features.include?('more_rest_index') ? true : invalid_features\n\n # Tidak Masuk tab\n when \"absent\"\n current_features.include?('absence_index') ? true : invalid_features\n\n # Tidak Lengkap tab\n when \"no_logout\"\n current_features.include?('employee_no_end_work_time_index') ? true : invalid_features\n end\n # return true\n end",
"def isReady?\n self.plan_parts.each do |part|\n if !part.isReady?\n return false\n end\n end\n return true\n end",
"def estimated?\n (self.story_type == 'feature') && self.story_points\n end",
"def matching_combinations(plans, selected_features)\n a = {}\n \n # array of plan indexed by feature\n # Example F1 => [P1, P2], F2 => [P2, P3] ...\n plans.each do |plan|\n plan['features'].each do |f|\n a[f] ||= []\n a[f] << plan\n end\n end\n \n # Returns an array of all combinations of elements from all arrays.\n # [P1,P2].product([P3,P4]) #=> [[P1,P3],[P1,P4],[P2,P3],[P2,P4]]\n # @ref http://ruby-doc.org/core-1.9.3/Array.html#method-i-product\n combinations = selected_features.drop(1).inject(a[selected_features[0]]) do |result, element| \n result.product(a[element] || [])\n end || []\n \n # Get the unique plans as 2 different features can belong to same plan\n combinations.each do |plans|\n plans = [plans] if plans.is_a?(Hash)\n plans.flatten!\n plans.uniq!\n end\n end",
"def qualified_candidates (collection)\n match=[]\n \n collection.each do |x|\n if years_of_experience(x[:years_of_experience]) && github_points(x[:github_points]) && knowledge(x[:languages]) && applied_time(x[:date_applied]) && old_enough(x[:age])\n match << (x)\n end\n end\n\n match\nend",
"def plan_to_take_course?(course)\n taking_courses.where(:course_id => course).size >0\n end",
"def suitable?\n @confines.all?(&:true?)\n end",
"def one_candidate?\n @candidates.count == 1\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('employee_index') ? true : invalid_features\n when \"export\"\n current_features.include?('employee_export') ? true : invalid_features\n when \"new\"\n current_features.include?('employee_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('employee_edit') ? true : invalid_features\n when \"delete_multiple\"\n current_features.include?('employee_delete') ? true : invalid_features\n when \"show\"\n current_features.include?('employee_detail') ? true : invalid_features\n when \"multiple_user\"\n current_features.include?('employee_user') ? true : invalid_features\n # Mutasi\n when \"mutasi\"\n current_features.include?('mutation_index') ? true : invalid_features\n # Formasi\n when \"formasi\"\n current_features.include?('formation_index') ? true : invalid_features\n # Status\n when \"status\"\n current_features.include?('status_index') ? true : invalid_features\n end\n # return true\n end",
"def features_requested\n if !defined?(@_requested_features)\n @_requested_features = ENV[\"VAGRANT_EXPERIMENTAL\"].to_s.downcase.split(',')\n end\n @_requested_features\n end",
"def has_feat ( f )\n return false\n end",
"def supports?(feature)\n features.include?(feature)\n end",
"def has_geomancy_feature?\n !features(:geomancy_element_shift).empty?\n end",
"def configured_feature_requires_component?(component)\n list_configured_features_from_component(component).length > 0\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('holiday_index') ? true : invalid_features\n when \"new\", \"create\"\n current_features.include?('holiday_new') ? true : invalid_features\n when \"edit\", \"update\"\n current_features.include?('holiday_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('holiday_delete') ? true : invalid_features\n end\n # return true\n end",
"def has_planes?\t\t\n\t\t!@planes.empty?\n\tend",
"def discoverable?\n fails_any = false\n\n # TODO Loop through agent requirements\n\n return !fails_any\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('shift_index') ? true : invalid_features\n when \"new\"\n current_features.include?('shift_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('shift_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('shift_delete') ? true : invalid_features\n end\n # return true\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('salary_index') ? true : invalid_features\n when \"new\"\n current_features.include?('salary_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('salary_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('salary_delete') ? true : invalid_features\n when \"export\"\n true # current_features.include?('salary_export') ? true : invalid_features\n when \"show\"\n current_features.include?('salary_detail') ? true : invalid_features\n when \"download\"\n current_features.include?('salary_download') ? true : invalid_features\n when \"print\"\n current_features.include?('salary_print') ? true : invalid_features\n when \"mine\"\n current_features.include?('salary_mine') ? true : invalid_features\n end\n\n if params[:action] == 'export' && params[:type] == 'bca'\n current_features.include?('salary_click_BCA') ? true : invalid_features\n end\n end",
"def found_and_pending?\n findings.any? { |f| f.state == \"pending\" }\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('employee_leave_management_index') ? true : invalid_features\n when \"new\"\n current_features.include?('employee_leave_management_add') ? true : invalid_features\n when \"edit\"\n current_features.include?('employee_leave_management_edit') ? true : invalid_features\n when \"delete_multiple\"\n current_features.include?('employee_leave_management_delete') ? true : invalid_features\n when \"update_status\"\n current_features.include?('employee_leave_management_change_status') ? true : invalid_features\n end\n return true\n end",
"def any_results?\n races.any?(&:any_results?)\n end",
"def estimable?\n story_type == 'feature' && !estimated?\n end",
"def completeable?\n if self.measurements.empty?\n !self.treatment_plan.first_session?(self) and !self.treatment_plan.last_session?(self)\n else\n # standard validation has already made sure the measurement set has the required measurement\n true \n end\n end",
"def has_free_trial?\n return (trial and trial.free?)\n end",
"def plans_by_template?\n true\n end",
"def qualified_candidates(candidate_list)\n candidate_list.select {|candidate| qualified?(candidate)}\nend",
"def has_results?\n meeting_individual_results.has_points(:goggle_cup_points).exists?\n end",
"def feature_enable?(feature)\n @features ||= config.features_enable\n @features[feature] == true\nend",
"def enabled_by_feature?(name = nil)\n if !name\n !!feature\n else\n if feature.class == Array\n feature.each do |f|\n if f == name\n return true\n end\n end\n false\n else\n feature == name\n end\n end\n end",
"def enabled_by_feature?(name = nil)\n if !name\n !!feature\n else\n if feature.class == Array\n feature.each do |f|\n if f == name\n return true\n end\n end\n false\n else\n feature == name\n end\n end\n end",
"def cabinets_assigned?\n return gold_team_id.present? && blue_team_id.present?\n end",
"def check_feature_access\n cur_feature = feature_accessed\n return unless cur_feature # Not one of the feature pages. Nothing to check.\n\n unless self.enabled_features.include?(cur_feature)\n return handle_invalid_feature_access(cur_feature)\n end\n end",
"def deps_satisfied?(deps)\n deps.each do |dep|\n if dep.to_s =~ /^no_(.*)$/\n return false if @used_legos.include?( $1 )\n else\n return false unless @used_legos.include?( dep.to_s )\n end\n end\n\n true\nend",
"def planned?\n return false unless @plan_id != 'none'\n return true\n end",
"def no_available_plans\n plans.default.nil? && plans.published.empty?\n end",
"def records_support_feature?(records, feature)\n Array.wrap(records).all? { |record| record.supports?(feature.to_sym) }\n end",
"def qualified_candidates(candidates)\n puts \"Candidates that meet your specs:\"\n\n qualified = candidates.select do |c|\n experienced?(c)\n has_enough_github_pts?(c) &&\n has_right_languages?(c) &&\n applied_within_15_days?(c) &&\n is_of_age?(c)\n end\nend",
"def available_sp_resources?(sp_resources)\n return sp_resources_all.include?(sp_resources)\n end",
"def needed?\n topology.packages.length > 1\n end",
"def passing?\n return true if self.product_tests.empty?\n\n passing = self.product_tests.includes(:test_executions).select do |p|\n p.execution_state == :passed\n end\n passing.length == product_tests.length\n end",
"def complete?\n passes = self.calls.last(3).select { |c| c.is_a?(Pass) }.size\n self.calls.size >= 4 and passes == 3\n end",
"def feature_installed? (name, version=nil)\n feature = list_features.find {|f| f[:name]==name and (version.nil? or f[:version] == version)}\n feature[:status] == 'installed' unless feature.nil?\n end",
"def suite?\n !list_id && !whole_id && !table_id || !suite\n end",
"def requested?(matchable)\r\n (@requested ||= []).include? matchable\r\n end",
"def requires(include_pending=false)\n features = component_instances.map {|ci| ci.cartridge_name} #get_feature(ci.cartridge_name, ci.component_name)}\n\n if include_pending\n self.pending_op_groups.each do |op_group|\n case op_group.op_type\n when :add_features\n features += op_group[:args][\"features\"]\n when :remove_features\n features -= op_group[:args][\"features\"]\n end\n end\n end\n\n features || []\n end",
"def test_a\n fdl_test( %{\n feature test\n (not all(x,x:[word=nil]))\n <x.id>},\n false)\n end",
"def coach?\n students.any?\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def accepts?(countries)\n return false if done?\n\n @possibles.any? do |ops_modifiers, count|\n all_ops_modifiers_qualify?(countries, ops_modifiers, count)\n end\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('division_index') ? true : invalid_features\n when \"new\"\n current_features.include?('division_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('division_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('division_delete') ? true : invalid_features\n when \"delete_multiple\"\n current_features.include?('division_delete') ? true : invalid_features\n end\n end",
"def contains_response_and_soln?() true ; end",
"def defined_any?\n cassette_records.size > 0\n end",
"def is_relevant_for_educator?\n supported_schools.any? {|school| authorized_grade_levels(school.id).size > 0 }\n end",
"def guard_with(*features, &block)\n yield if block_given? && features.any? {|f| feature_enabled?(f)}\n end",
"def check_availability_of_cargo_wagons\n @trains.each do |train|\n train.each do |element|\n if element.class != Symbol\n return false if element.wagons.any? && element.type == 'cargo'\n end\n end\n end\n end",
"def suitable?\n @suitable ||= begin\n info = AvailableHints.keys.inject([]) do |ary, attr|\n ary.concat Array.wrap(send(attr))\n end\n\n info.size >= 7\n end\n end",
"def satisfied_by?(characteristics)\n (requirements - characteristics.keys).empty?\n end",
"def free_plan?(service_id, plans = nil)\n @free_plans ||= {}\n return @free_plans[service_id] if @free_plans.key?(service_id)\n plans ||= load_plans(service_id)\n @free_plans[service_id] = plans.any? { |plan| (plan[:price][:cents]).zero? }\n @free_plans[service_id]\n end",
"def enabled_for_all?(feature)\n redis.get(enabled_for_all_key(feature)) == '1'\n end",
"def ok?\n @specs.all? { |spec|\n\tspec.dependencies.all? { |dep|\n\t @specs.find { |s| s.satisfies_requirement?(dep) }\n\t}\n }\n end",
"def feature?(feature=RC.current_feature)\n return true if self.feature.nil?\n self.feature == feature.to_s\n end",
"def without_compliance_issues?\n issues = plan_compliance_issues\n if issues.present?\n logger.error(\"Request #{ number } could not be started because of plan compliance issues: #{ issues.map(&:message).to_sentence }\")\n false\n else\n true\n end\n end",
"def trial?\n (plan_type == 'free_trial')\n end",
"def requests?\n return requests.any?\n end",
"def test_features()\n \t\tpg_lyr = create_poly_layer(@pg_ds)\n \t\tfeat = populate_poly_layer(pg_lyr)\n \t\tcheck_poly_layer(pg_lyr, feat)\n\tend",
"def active_plan_recurrence?\n attribute(:plan).try(:active?) && attribute(:plan_recurrence).try(:is_active?)\n end",
"def remote_plan_needed?\n return false if dont_create_remote\n if Rails.env.test? || Rails.env.development?\n !self.id.in?(1..3)\n else\n true\n end\n end",
"def is_valid?(feature)\n !feature.description.blank?\n end",
"def contains?(target)\n return false if kind == 'state' && target.kind == 'country'\n return false if kind == 'zipcode' && ['country', 'state'].include?(target.kind)\n return false if zone_members.empty? || target.zone_members.empty?\n\n if kind == target.kind\n target.zoneables.each do |target_zoneable|\n return false unless zoneables.include?(target_zoneable)\n end\n elsif target.kind == 'zipcode'\n target.zoneables.each do |target_zip|\n # zips contained in states\n if kind == 'state'\n return false unless zoneables.include?(target_zip.state)\n # zips contained in countries\n elsif kind == 'country'\n return false unless zoneables.include?(target_zip.state.try(:country))\n end\n end\n elsif\n # states contained in countries\n target.zoneables.each do |target_state|\n return false unless zoneables.include?(target_state.country)\n end\n end\n true\nend",
"def is_listing\n\t\t\tall.select do |city|\n\t\t\t\tcity.listings.any?\n\t\t\tend\n\t\tend",
"def splitOn?\r\n\t\tmaxGain = 0\r\n\t\tbestFeature = nil\r\n\t\tfor i in 0..self.featureCount-1\r\n\t\t\tgain = self.gain(i)\r\n\t\t\tif gain >= maxGain\r\n\t\t\t\tmaxGain = gain\r\n\t\t\t\tbestFeature = i\r\n\t\t\tend\r\n\t\tend\r\n\t\tif maxGain == 0\r\n\t\t\tbestFeature = rand(0..self.featureCount-1)\r\n\t\tend\r\n\t\treturn bestFeature\r\n\tend",
"def splitOn?\r\n\t\tmaxGain = 0\r\n\t\tbestFeature = nil\r\n\t\tfor i in 0..self.featureCount-1\r\n\t\t\tgain = self.gain(i)\r\n\t\t\tif gain >= maxGain\r\n\t\t\t\tmaxGain = gain\r\n\t\t\t\tbestFeature = i\r\n\t\t\tend\r\n\t\tend\r\n\t\tif maxGain == 0\r\n\t\t\tbestFeature = rand(0..self.featureCount-1)\r\n\t\tend\r\n\t\treturn bestFeature\r\n\tend",
"def completely_probed?\n !(@probe_nodes.find{|node| node.nil?})\n end",
"def eligible_by_checklist(release, bugs)\n bugs.select do |b|\n BugEligibility::CheckList.new(b, :release => release).pass_all?\n end\n end",
"def grid_operation_checker(candidate)\n candidate.node_type == :call and\n candidate.sons.first.node_type == :lval and\n (candidate.grid_objects.map {|g_obj| g_obj.name}).include? candidate.sons.first.name\n end",
"def match?(choices)\n\n @choices = choices\n raise ArgumentError, 'Checker received non-card input' unless @choices.kind_of?(Array)\n raise ArgumentError, 'A set has 3 cards! Please select 3 cards!' unless @choices.size == 3\n\n # Logic: \"MAKE THIS TERSE\"\n numbers = Array.new(3) { |i| choices[i].number }\n symbols = Array.new(3) { |i| choices[i].symbol }\n shadings = Array.new(3) { |i| choices[i].shading }\n colors = Array.new(3) { |i| choices[i].color }\n\n features = [numbers, symbols, shadings, colors]\n @result = features.all? { |feature| feature.uniq.size != 2 }\n end",
"def enabled?\n if feature\n value = false\n current_owner = self\n if feature.class == Array\n feature.each do |f|\n current_owner = self\n loop do\n if current_owner.respond_to?(:owner)\n current_owner = current_owner.owner\n if current_owner.respond_to?(:has_feature?)\n if current_owner.has_feature?(f)\n value = true\n break\n end\n end\n else # if current owner does not have a owner\n value = false\n break\n end\n end # loop end\n unless value\n if Origen.top_level && \\\n Origen.top_level.respond_to?(:has_feature?) && \\\n Origen.top_level.has_feature?(f)\n value = true\n unless value\n break\n end\n end\n end\n unless value\n break # break if feature not found and return false\n end\n end # iterated through all features in array\n value\n else # if feature.class != Array\n loop do\n if current_owner.respond_to?(:owner)\n current_owner = current_owner.owner\n if current_owner.respond_to?(:has_feature?)\n if current_owner.has_feature?(feature)\n value = true\n break\n end\n end\n else # if current owner does not have a owner\n value = false\n break\n end\n end # loop end\n unless value\n if Origen.top_level && \\\n Origen.top_level.respond_to?(:has_feature?) && \\\n Origen.top_level.has_feature?(feature)\n value = true\n end\n end\n value\n end\n else\n true\n end\n end"
] |
[
"0.6741976",
"0.64889693",
"0.64785147",
"0.6353291",
"0.6352293",
"0.6303821",
"0.6282219",
"0.6277143",
"0.62335676",
"0.61741847",
"0.61596876",
"0.6124389",
"0.6063933",
"0.6063024",
"0.60503775",
"0.6031704",
"0.6029332",
"0.5998901",
"0.5987527",
"0.5957292",
"0.59536314",
"0.59067595",
"0.5855451",
"0.5850011",
"0.58438534",
"0.5822225",
"0.5813959",
"0.58089286",
"0.57934785",
"0.57699573",
"0.57657963",
"0.57501817",
"0.57463557",
"0.572261",
"0.5713895",
"0.5702623",
"0.57019776",
"0.56708926",
"0.5665811",
"0.5655829",
"0.56522816",
"0.56522214",
"0.56403595",
"0.5634812",
"0.56163865",
"0.5615423",
"0.56145096",
"0.56142074",
"0.55866665",
"0.55799174",
"0.55759066",
"0.55759066",
"0.55686134",
"0.5561545",
"0.55599666",
"0.5527234",
"0.5525434",
"0.55200267",
"0.55104065",
"0.55068505",
"0.54996914",
"0.548764",
"0.5485625",
"0.54848737",
"0.54836047",
"0.5481467",
"0.54776806",
"0.5477124",
"0.54740053",
"0.5468761",
"0.5468761",
"0.54564494",
"0.54540247",
"0.54539734",
"0.5445213",
"0.54381",
"0.54334253",
"0.5433408",
"0.543319",
"0.5431224",
"0.54243076",
"0.54233587",
"0.5394185",
"0.5394138",
"0.5390603",
"0.5379545",
"0.53766286",
"0.5373799",
"0.53692603",
"0.5365798",
"0.53651893",
"0.5359377",
"0.53590703",
"0.53533864",
"0.53533864",
"0.53512734",
"0.53437185",
"0.5341499",
"0.5334204",
"0.53222626"
] |
0.708158
|
0
|
returns an array of all combinations of plans where the selected feature exist Example F1 selected feature existing in following plans [[P1],[P1,P2]...]
|
def matching_combinations(plans, selected_features)
a = {}
# array of plan indexed by feature
# Example F1 => [P1, P2], F2 => [P2, P3] ...
plans.each do |plan|
plan['features'].each do |f|
a[f] ||= []
a[f] << plan
end
end
# Returns an array of all combinations of elements from all arrays.
# [P1,P2].product([P3,P4]) #=> [[P1,P3],[P1,P4],[P2,P3],[P2,P4]]
# @ref http://ruby-doc.org/core-1.9.3/Array.html#method-i-product
combinations = selected_features.drop(1).inject(a[selected_features[0]]) do |result, element|
result.product(a[element] || [])
end || []
# Get the unique plans as 2 different features can belong to same plan
combinations.each do |plans|
plans = [plans] if plans.is_a?(Hash)
plans.flatten!
plans.uniq!
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def combinations\n self.locations.product(self.criterias)\n end",
"def plans(within_product=nil)\n product_id = within_product ? within_product.enabled_products.map(&:id) + [within_product.id] : nil\n Plan.where(:id => plan_ids, :product_id => product_id).all\n end",
"def opt_params_only_result\n combinations = []\n final_list = []\n final_comb = []\n opt_param_values = get_opt_params_and_values \n opt_params = get_opt_param_names\n \n opt_param_values.each do |k, v|\n v.each do |i|\n v[v.index(i)] = k.to_s + \"=\" + v[v.index(i)]\n end\n combinations << v\n end\n\n(1..combinations.size).each do |c|\n logger.info c.to_s\n final_list << combinations[c-1].combination(1).to_a\n arr = []\nend\n\n # final_list << combinations.each_index.flat_map{|i| combinations[0].product(*combinations[1..i])}\n final_list << progressive_product(combinations)\n final_list.each_index {|i| final_list[i].each {|k| final_comb << final_list[i][final_list[i].index(k)] }}\n final_comb.flatten(1)\n\nend",
"def valid_combinations\n\t\treturn @@valid_combinations\n\tend",
"def variant_combinations\n combinations = []\n 0.upto(2 ** FIELD_VARIANTS.length - 1) do |b|\n combinations << combination = []\n FIELD_VARIANTS.each_with_index do |variant, i|\n combination << variant if b & 1<<i > 0\n end\n end\n combinations\n end",
"def get_matrix_of_possibilities(problem_set)\n possibilities = []\n\n problem_set.item_prices.each do |price|\n possibilities << find_possible_quantities(price, problem_set.total)\n end\n\n possibilities = possibilities[0].product(*possibilities[1..-1])\n possibilities\n end",
"def selection plan, solutions\n (sort_soluitons plan, solutions.shuffle.first(4)).first(2)\n end",
"def candidate_paths\n # All leaf categories for this product family. This is an array\n # of hashes. Each hash has keys :catid and :path.\n candidates = self.product_family.leaf_category_paths\n\n # All leaf category ids that were previously selected for this\n # product. This will be a subset of the candidates.\n current = self.leaf_ids\n\n candidates.each do |lcp|\n if current.include? lcp[:catid]\n lcp.merge! :selected => true\n else\n lcp.merge! :selected => false\n end\n end\n candidates\n end",
"def find_possibilities\n (0..@field_count-1).reduce({}) do |acc, i|\n acc[i] = @rules\n .select do |rule|\n ticket_values_at(i).all? { |v| rule.valid?(v) }\n end\n .map(&:name)\n\n acc\n end\n end",
"def plans\n [Free, FreePlus, Pro, Growth, ProSpecial, ProComped, ProManaged, EliteSpecial, Elite, Custom0, Custom1, Custom2, Custom3].map(&:name)\n end",
"def selected_features(activating_contexts, active_contexts)\n concerned = concerned_features(activating_contexts)\n selected = []\n # activated_contexts = activating_contexts + active_contexts\n \n concerned.each {\n |feature|\n concerned_contexts = @feature_to_contexts[feature]\n # TODO remove already active features from active contexts\n # then create relevant_contexts and include feature in\n # selected the number of times its mapping appears in\n # relevant_contexts\n }\n end",
"def find_triplets(non_reduced_possibilities)\n non_reduced_possibilities.group_by {|e| e}.map { |e| e[0] if e[1][2]}.compact\n end",
"def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end",
"def winning_combos\n [[0, 1, 2], [3, 4, 5], [6, 7, 8],\n [0, 3, 6], [1, 4, 7], [2, 5, 8],\n [0, 4, 8], [2, 4, 6]]\n end",
"def all_best_seat_combinations\n first=seat_point_chart[seat_point_chart.map{|x| x[2]}.each_with_index.max[1]]\n all_best = [[first[0]+first[1].to_s]]\n for i in 2..availableSeats.length\n all_best.push(best_seat_combination(i))\n end \n all_best\n end",
"def combinations (quin, combination)\n \n statements =\n [\n \"claims.entity_id = \",\n \"claims.property = \",\n \"claims.datavalue_entity = \",\n \"qualifiers.qualifier_property = \",\n \"qualifiers.datavalue_entity = \"\n ]\n\n query = \"\"\n\n combination.each do |vals|\n query += statements[vals] +\"'\"+quin[vals]+\"'\"+ \" AND \"\n end\n query_parameters = query.slice(0..-6)\n if combination.include?(3) || combination.include?(4)\n return 'SELECT claims.entity_id AS Subject, claims.property AS Predicate, claims.datavalue_entity AS Object, qualifiers.qualifier_property AS Qualifier_property, qualifiers.datavalue_entity AS Qualifier FROM claims, qualifiers WHERE claims.id = qualifiers.claim_id AND '+ query_parameters +'LIMIT 10000' \n else\n return 'SELECT Claim_data.Subject, Claim_data.Predicate, Claim_data.Object, Qualifier_data.Qualifier_property, Qualifier_data.datavalue_entity FROM (SELECT claims.id AS Main_claim_id, claims.entity_id AS Subject, claims.property AS Predicate, claims.datavalue_entity AS Object FROM claims WHERE '+ query_parameters +') AS Claim_data LEFT OUTER JOIN (SELECT claim_id, qualifier_property, datavalue_entity FROM qualifiers) AS Qualifier_data ON ( Claim_data.Main_claim_id = Qualifier_data.claim_id) LIMIT 10000' \n end\nend",
"def possibilities_for_requirement(requirement, activated = self.activated)\n return [] unless requirement\n if locked_requirement_named(name_for(requirement))\n return locked_requirement_possibility_set(requirement, activated)\n end\n\n group_possibilities(search_for(requirement))\n end",
"def plans\n result = []\n self.books.each do |book|\n book.plans.each do |plan|\n result << plan\n end\n end\n\n result\n end",
"def possible_combinations\n expression = {}\n PATTERNS.each do |pattern|\n index = 0\n pattern.each do |pattern_element|\n expression[\"#{index}_#{index + pattern_element - 1}\"] = build_regex_pattern(index, pattern_element)\n index += pattern_element\n end\n end\n words = scan_regex_pattern_expression(expression)\n computing_patterns(words)\n end",
"def get_feature_subset\n # feature subset\n subset = []\n \n # step 1: calc SU(i,c) for each feature\n f2su = {}\n get_features.each do |f|\n su = get_SU_fc(f)\n f2su[f] = su\n if su >= @delta\n subset << f\n end\n end\n \n # step 2: order subset by decreasing feature SU of\n subset = subset.sort { |x,y| f2su[y] <=> f2su[x] }\n \n # step 3: main algo\n fp = subset.first\n while fp\n fq = get_next_element(subset, fp)\n \n while fq\n su_pq = get_SU_pq(fp, fq)\n \n if su_pq >= f2su[fq]\n fq_new = get_next_element(subset, fq)\n subset.delete(fq) #remove fq\n fq = fq_new\n else\n fq = get_next_element(subset, fq)\n end\n end\n \n fp = get_next_element(subset, fp)\n end\n \n subset\n end",
"def filtered_possibility_set(vertex)\n PossibilitySet.new(vertex.payload.dependencies, vertex.payload.possibilities & possibility.possibilities)\n end",
"def find_combinations(source, selection_size)\n\t#RubyProf.start\n\tcombinations = []\n\tlen = 2 ** source.size - 1\n\t(1..len).each do |number| # each number 1..n\n\t\tselection = []\n\t\t(0..source.size).each do |ix| # each bit\n\t\t\tif selection.size <= selection_size\n\t\t\t\tselection << source[ix] if number & ( 1 << ix ) > 0\n\t\t\tend\n\t\tend\n\t\tcombinations << selection if !selection.empty? && selection.size == selection_size\n\tend\n\t#puts RubyProf::FlatPrinter.new(RubyProf.stop).print(STDOUT)\n\tcombinations\nend",
"def solve\n # Generate uniques\n spaces = student_ids.product(bag_ids)\n\n visited_nodes = 0\n student_ids.each do |sid|\n bid = solver.choose(*bag_choices_for_student(sid))\n visited_nodes +=1\n partial_plan[sid] = bid\n solver.assert assigned_bags_are_unique(partial_plan)\n solver.assert assigned_bags_without_student_repeats(partial_plan)\n end\n\n puts \"Visited: #{visited_nodes} nodes\"\n partial_plan.to_a\n end",
"def seat_combinations(input_num)\n #dont allow for combination numbers above number of avail seats\n return nil unless input_num < availableSeats.length + 1\n seat_point_chart.combination(input_num).to_a\n \n end",
"def reqd_params_only_result\n combinations = []\n reqd_params = get_reqd_params_and_values\n # logger.info \"===============\"+reqd_params.to_s\n reqd_params.each do |k, v|\n if(!v.nil? || k.empty?) \n v.each do |i|\n v[v.index(i)] = k.to_s + \"=\" + v[v.index(i)]\n end\n end \n combinations << v\n end\n # @combinations = @combinations.first.product(*@combinations[1..-1]).map(&:join)\n variations(combinations) unless !combinations\nend",
"def compute_matching_product(among_products) among_products.select { |product| concern?(product, among_products) } end",
"def plan_information(plan, options = {})\n apps = get_option(options, \"apps\", [])\n stages = get_option(options, \"stages\", [])\n report = []\n plan.plan_stages.each do |stage|\n if stages.empty? || stages.include?(stage.name)\n report << {\"stage\" => stage.name}\n components = []\n requests = stage.requests.include(:apps_requests).where(\"aasm_state IN ('complete, planned')\").order(\"apps_requests.app_id, aasm_state, requests.id DESC\")\n cur_app = \"\"; cur_env = \"\"\n request.each do |request|\n if request.app_name.first != cur_app\n report += components.sort{|a,b| a[\"component\"] <=> b[\"component\"] }\n report << {\"app\" => request.app_name.first, \"environment\" => request.environment.name }\n components = []\n cur_app = request.app_name.first\n end\n request_component_versions(request).each do |comp, ver|\n components << {\"component\" => comp, \"version\" => ver, \"request\" => request.number, \"environment\" => request.environment.name }\n end\n end\n end\n end\n report\nend",
"def qualified_candidates(candidate_list)\n candidate_list.select {|candidate| qualified?(candidate)}\nend",
"def combinations(arr)\n \tsolution = []\n\tarr.each do |i|\n arr.each do |j|\n if (j > i)\n solution.push([i,j]) \t\n end\n end\n end\n return solution\nend",
"def start_solution plan\n solutions = []\n 15.times do\n s = mutate_pairs plan, valid_solution2(false)\n solutions << s\n end\n\n #0.times do\n # s = random_solution plan\n #end\n\n 10.times do\n s = structured_solution plan\n solutions << mutate_pairs(plan, s)\n end\n sort_soluitons plan, solutions\n end",
"def generate_combos(n, item1, item2, item3, u1, u2, u3)\n used = []\n success = 0\n while (success < n)\n new_triplet = make_triplet(item1, item2, item3)\n if (triplet_included(new_triplet, used))\n # do nothing\n else\n success += 1\n used.push(new_triplet)\n end\n end\n end",
"def get_required_features(features)\n end",
"def all_combinations(ingredients, total_to_allocate = 100)\n first_ingredient = ingredients.first\n remaining_ingredients = ingredients[1..-1]\n\n if remaining_ingredients.any?\n (0..total_to_allocate).flat_map do |tbsp|\n all_combinations(\n remaining_ingredients,\n total_to_allocate - tbsp\n ).flat_map do |rmc|\n rmc.merge({ first_ingredient => tbsp })\n end\n end\n else\n [{ first_ingredient => total_to_allocate }]\n end\nend",
"def all_features\n connection().select_all(\"select f.title title, coalesce(pf.value, default_value) value, pf.value is not null overriden from plans p, features f left join plans_features pf on p.id=pf.plan_id and f.id=pf.feature_id where p.id = #{id}\")\n end",
"def referenced_option_sets(qing)\n codes = qing.default.scan(ODK::DynamicPatternParser::CODE_ONLY_REGEX)\n questions = codes.flatten.map { |c| Question.with_code(c).first }\n questions.any? ? questions.map { |q| q.option_set.presence } : []\n end",
"def find_solution(possibilities, *rest)\n return [possibilities.first] if rest.empty?\n\n possibilities.each do |inst|\n copy = rest.map(&:clone)\n\n copy.each { |instrs| instrs.delete(inst) }\n\n codes = [inst].concat(find_solution(*copy))\n\n return codes if codes.none?(&:nil?)\n end\n\n [nil]\nend",
"def generate_combinations( n )\n\t# => since the first combination will replace ALL digits and the last one\n\t# => won't replace anything both won't be necessary\n\treturn [ true, false ].repeated_permutation( n ).to_a[ 1..-2 ]\nend",
"def build_facet(facet:, ids:, plans:, facet_pos_in_plans:)\n return [] unless @facets[facet.to_sym].present?\n\n relevant_plan_ids = plans.map { |plan| plan[facet_pos_in_plans].to_s }\n\n # Only take the facets that apply to the current resultset!\n @facets[facet.to_sym] = @facets[facet.to_sym].select do |id, _hash|\n relevant_plan_ids.include?(id.to_s)\n end\n # Retain the user's selections and recalc the nbr_plans\n @facets[facet.to_sym].each do |id, hash|\n hash[:nbr_plans] = relevant_plan_ids.count(id)\n hash[:selected] = 'true' if ids.is_a?(Array) && ids.any? && ids.include?(id.to_s)\n end\n end",
"def combinations(n)\n \n end",
"def print_all_combinations(selected_set, left_over_set)\ndebug(\"first #{selected_set} - left over #{left_over_set}\")\n left_over_set.each do |left_over|\n save(selected_set + [left_over])\n end\nend",
"def plans_available_bam(country)\n plan = Plan.select('id, name, detail, price').where('country= ? AND item= ?',\n country, 'bam')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.id] }\n # Format to display details of plans\n details = plan.map {|m| [m.id, m.detail]}\n return [plans, details]\n end",
"def qualified_candidates(candidates)\n array = []\n candidates.each do |candidate| \n if experience?(candidate) && languages?(candidate) && last_15_days?(candidate) && over_17?(candidate)\n array << candidate\n end\n end\n array\nend",
"def available_project_choices(semester_id)\n available_projects = []\n self.students.each do |student|\n available_projects = available_projects | student.section.faculty_approved_projects(semester_id)\n end\n return available_projects\n end",
"def all_p_bam\n plan = Plan.select('id, name').where('plan_type = ? AND item= ?', 'plan', 'bam')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.name] }\n return plans\n end",
"def find_open_cases_for_plans(project_name, plan_regex, options={})\n puts 'meow'\n test_case_array = []\n project_id = project_id(project_name)\n puts \"project ID: #{project_id}\"\n test_plans = find_test_plans(project_id, plan_regex)\n puts \"test plans: #{test_plans}\"\n\n test_plans.each do |test_plan|\n builds = builds_for_test_plan(test_plan[:id]) # Get builds for plan(s)\n\n builds.each do |build|\n if options[:build]\n if build[:name] =~ options[:build]\n test_cases = test_cases_for_test_plan(build[:testplan_id],\n { \"buildid\" => build[:id] })\n end\n elsif build[:is_open] == 1\n test_cases = test_cases_for_test_plan(build[:testplan_id],\n { \"buildid\" => build[:id] })\n end\n\n unless test_cases.nil?\n test_cases.each_value do |test_case|\n test_case_array << test_case if test_not_run?(test_case)\n end\n end\n end\n end\n\n test_case_array\n end",
"def qualified_candidates (collection)\n match=[]\n \n collection.each do |x|\n if years_of_experience(x[:years_of_experience]) && github_points(x[:github_points]) && knowledge(x[:languages]) && applied_time(x[:date_applied]) && old_enough(x[:age])\n match << (x)\n end\n end\n\n match\nend",
"def plans\n subscriptions.map(&:plan)\n end",
"def affordable_combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v <= to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"You can't afford anything...\" end\n end",
"def computing_combinations pattern, words\n index = 0\n words_combination = []\n pattern.each do |pattern_element|\n words_combination << words[\"#{index}_#{index+pattern_element-1}\"]\n index += pattern_element\n end\n if words_combination.count > 1\n products = words_combination[0].product(*words_combination[1..-1])\n else\n products = words_combination[0]\n end\n products\n end",
"def combinations(array)\n combination_array = []\n array.each_with_index do |ele1, idx1|\n array.each_with_index do |ele2, idx2|\n combination_array << [ele1, ele2] if idx2 > idx1\n end\n end\n\n combination_array\nend",
"def option_sets_for_instances\n opt_sets = enabled_questionings.map do |qing|\n if qing.default.present? && qing.default =~ ODK::DynamicPatternParser::VALUE_REGEX\n referenced_option_sets(qing)\n end\n end\n opt_sets.flatten.compact.uniq\n end",
"def assosi(minsupp = 2)\n # create 1-frequent-set\n c1 = Product.all.permutation(1).to_a\n l1 = c1.reject { |fi| trans_containing(fi) < minsupp}\n # find k-frequent-set, first elem is nil because k = 2\n l = [nil, l1]\n k = 2\n c = []\n while not(l[k-1].empty?)\n # find candidates\n b = l[k-1].flatten.to_set.to_a\n c = b.reduce([]) do |accu, extension|\n accu + l[k-1].reduce([]) do |accu2, canidate|\n if not(canidate.include?(extension)) then\n accu2 << (canidate + [extension])\n else\n accu2\n end\n end\n end\n # remove dubs\n c = c.collect {|e| e.to_set }.to_set.collect {|e| e.to_a }.to_a\n # select minsupps\n l[k] = c.reject { |canidate| trans_containing(canidate) < minsupp }\n k = k + 1\n end\n #first elem is nil; last elem is an empty list\n l.shift; l.pop\n low_fatten(l)\n end",
"def skittle_combos(skittles)\n skittles.combination(2).map(&:sort).uniq\nend",
"def group_possibilities(possibilities)\n possibility_sets = []\n current_possibility_set = nil\n\n possibilities.reverse_each do |possibility|\n dependencies = dependencies_for(possibility)\n if current_possibility_set && dependencies_equal?(current_possibility_set.dependencies, dependencies)\n current_possibility_set.possibilities.unshift(possibility)\n else\n possibility_sets.unshift(PossibilitySet.new(dependencies, [possibility]))\n current_possibility_set = possibility_sets.first\n end\n end\n\n possibility_sets\n end",
"def pattern_candidates(pattern,representative)\n candidate_set_for_syntax_trees(representative_head_trees(representative),@category_filters,pattern) #TODO representative_head_trees?\n end",
"def expose_selections\n params[:attendee] ||= {} # TODO: not sure we need this\n params[:activity_ids] ||= []\n @activity_selections = params[:activity_ids].map(&:to_i)\n @plan_selections = Registration::PlanSelection.parse_params(params['plans'], all_plans)\n end",
"def solution_two\n result = []\n delivery_partners = partners\n capacities = partner_capacities\n posibilities = []\n CSV.foreach('input.csv') do |row|\n delivery_options = delivery_partners.select do |d|\n size_slab = d['Size Slab (in GB)'].split('-')\n deliverable?(d['Theatre'], row[2], size_slab, row[1])\n end\n unless delivery_options.empty?\n posibilities << delivery_possibilities(delivery_options, row[1])\n end\n end\n first, *rest = posibilities\n combinations = first.product(*rest)\n combinations.each do |combination|\n data = combination.inject do |memo, el|\n memo.merge(el) do |_k, old_v, new_v|\n merge_same_partners(old_v.split(','), new_v.split(','))\n end\n end\n\n if within_capacity_limit?(data, capacities)\n if result.empty?\n result = combination\n else\n old_sum = total_cost(result)\n new_sum = total_cost(combination)\n result = combination if new_sum < old_sum\n end\n end\n end\n CSV.open('second_output.csv', 'w') do |writer|\n counter = 0\n CSV.foreach('input.csv') do |row|\n delivery_id = row[0]\n size = row[1]\n theatre_id = row[2]\n data = { will_be_delivered: false, partner_id: '', cost: '' }\n\n delivery_options = delivery_partners.select do |d|\n size_slab = d['Size Slab (in GB)'].split('-')\n deliverable?(d['Theatre'], theatre_id, size_slab, size)\n end\n unless delivery_options.empty?\n data[:will_be_delivered] = true\n data[:partner_id] = result[counter].keys[0]\n data[:cost] = result[counter].values[0].split(',')[1]\n counter += 1\n end\n writer << csv_row(delivery_id, data)\n end\n end\n end",
"def call\n result[:plan_features] = plan.features\n end",
"def pattern_candidates(pattern,representative)\n candidate_set_for_syntax_trees(representative.head_trees,@category_filters,pattern)\n end",
"def find_all_features_by_project(project_name)\n @scenario_look_up_map[project_name].keys if @scenario_look_up_map.has_key? project_name\n end",
"def eqs_for_free_points(p)\n return [] if p.free?\n q, r = first_point, second_point\n eqs = []\n uv = [:x,:y,:z] # uv stands for unused vars\n %w{x y z}.map(&:to_sym).each do |v|\n if 0 == (q.send(v).to_f - r.send(v).to_f)\n eqs << p.send(v.to_s+\"_to\", q) # <-- A bit different equation\n uv.delete(v)\n end\n end\n if uv.size == 3\n eq_for_non_free_points(p) # The equations are the same as the\n # non-free-points options\n elsif uv.size == 2\n eqs << eq_for_coordinates(p, *uv)\n end\n eqs\n end",
"def all_choices_from(arrs) \n max_index = arrs.map { |x| x.size }.max - 1\n\n generate_power_set_of_size((0..max_index).to_a, arrs.size) do |indexes|\n next_set = []\n\n skip = false\n\n indexes.each_with_index do |j, i|\n v = arrs[i][j]\n skip ||= v.nil?\n next_set << v\n end\n\n yield next_set unless skip\n end\n end",
"def find_open_cases_for_plan(project_name, plan_name, options={})\n test_case_array = []\n plan_id = test_plan_id(project_name, plan_name)\n\n if plan_id.nil?\n return []\n else\n builds = builds_for_test_plan(plan_id)\n end\n\n builds.each do |build|\n if options[:build]\n if build[:name] =~ options[:build]\n test_cases = test_cases_for_test_plan(build[:testplan_id],\n { \"buildid\" => build[:id] })\n end\n elsif build[:is_open] == 1\n test_cases = test_cases_for_test_plan(build[:testplan_id],\n { \"buildid\" => build[:id] })\n end\n\n unless test_cases.nil?\n test_cases.each_value do |test_case|\n test_case_array << test_case if test_not_run?(test_case)\n end\n end\n end\n\n test_case_array\n end",
"def plans\n return @plans\n end",
"def find_available_combinations(board, token)\n if token == self.token\n valid_and_made_moves = self.find_available_moves(board) + self.find_moves_made(board, self.token)\n Game::WIN_COMBINATIONS.select do |combo|\n (valid_and_made_moves & combo).count > 2\n end\n else\n valid_and_made_moves = self.find_available_moves(board) + self.find_moves_made(board, self.opponent.token)\n Game::WIN_COMBINATIONS.select do |combo|\n (valid_and_made_moves & combo).count > 2\n end\n end\n end",
"def all_combinations(the_list)\n\tresults = []\n\tthe_list.each do |item|\n\t\tthe_list.each do |inner_item|\n\t\t\tresults.push([item, inner_item])\n\t\tend\n\tend\n\treturn results\nend",
"def programs\n programs = self.creators.to_a\n programs.collect! { |p| p.has_membership.to_a }.flatten!\n programs.collect! { |p| p.name }\n programs.uniq\n end",
"def prepare_plan(options)\n\t options = validate_options options,\n\t\tmissions: 0, add: 0, discover: 0, tasks: 0,\n\t\tpermanent: 0,\n\t\tmodel: Roby::Task, plan: plan\n\n\t missions, permanent, added, tasks = [], [], [], []\n\t (1..options[:missions]).each do |i|\n\t\toptions[:plan].add_mission_task(t = options[:model].new(id: \"mission-#{i}\"))\n\t\tmissions << t\n\t end\n\t (1..options[:permanent]).each do |i|\n\t\toptions[:plan].add_permanent_task(t = options[:model].new(id: \"perm-#{i}\"))\n\t\tpermanent << t\n\t end\n\t (1..(options[:discover] + options[:add])).each do |i|\n\t\toptions[:plan].add(t = options[:model].new(id: \"discover-#{i}\"))\n\t\tadded << t\n\t end\n\t (1..options[:tasks]).each do |i|\n\t\ttasks << options[:model].new(id: \"task-#{i}\")\n\t end\n\n\t result = []\n\t [missions, permanent, added, tasks].each do |set|\n\t\tunless set.empty?\n\t\t result << set\n\t\tend\n\t end\n\n result = result.map do |set|\n if set.size == 1 then set.first\n else set\n end\n end\n\n if result.size == 1\n return result.first\n end\n return *result\n\tend",
"def uniq_combinations_by_piece\n joins = combinations.keys\n\n joins.each do |join|\n combinations[join].reject! do |comb|\n comb.uniq { |c| c[:piece] }.size < comb.size\n end\n end\n end",
"def find_subsets_of_points(options={})\n puts \"Calculating subsets\"\n puts \"Set of #{@points_amount} points: 2^#{@points_amount} subsets = #{2**@points_amount} different subsets\"\n @points_subsets = Array.new(@points_amount) { Array.new }\n # amount of all subsets of a set 2^n-1 (-1, as we're excluding the empty set {})\n (1..2**@points.length-1).each { |i|\n p i if i%100000 == 0\n subset_size = subset_size(i)\n if (options[:with_first_point_only] != true) || (options[:with_first_point_only] == true and i % 2 == 1)\n @points_subsets[subset_size-1] << i\n end\n }\n\n (2..@points_amount).each do |subset_size|\n subsets = @points_subsets[subset_size-1]\n puts \"Subset size: \" + subset_size.to_s + \"; Subsets total: \" + subsets.size.to_s\n end\n\n puts \"Done calculating subsets\"\n end",
"def new_input_set()\n return ListPlansInputSet.new()\n end",
"def requires(include_pending=false)\n features = component_instances.map {|ci| ci.cartridge_name} #get_feature(ci.cartridge_name, ci.component_name)}\n\n if include_pending\n self.pending_op_groups.each do |op_group|\n case op_group.op_type\n when :add_features\n features += op_group[:args][\"features\"]\n when :remove_features\n features -= op_group[:args][\"features\"]\n end\n end\n end\n\n features || []\n end",
"def combinations(arr)\n\n new = []\n \n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n \n if ele1 < ele2\n new << [ ele1, ele2]\n end\n \n end\n end\n return new\n\nend",
"def all_the_choices\n solution_pool_temp = []\n for i in 0..5\n for j in 0..5\n for k in 0..5\n for l in 0..5\n solution_pool_temp.push([COLOR_CHOICES[i], COLOR_CHOICES[j], COLOR_CHOICES[k], COLOR_CHOICES[l]])\n end\n end\n end\n end\n solution_pool_temp\n end",
"def remaining_candidates\n case strategy.to_sym\n when :symmetric\n candidates.reject { | candidate | candidate.full? || candidate.exhausted_preferences? }\n when :asymmetric\n candidate_set1.values.reject { | candidate | candidate.full? || candidate.exhausted_preferences? }\n end\n end",
"def combinations(arr)\n combinations = []\n arr.each_with_index do |element1, indx1|\n arr.each_with_index do |element2, indx2|\n combinations << [element1, element2] if indx1 < indx2\n end\n end\n combinations\nend",
"def each_combination\n \n end",
"def calculate_deps\n all_deps\n .where(dependency_type: \"Point\", dependency_id: points.pluck(:id))\n .or(refactor_plz)\n .map(&:sequence)\n end",
"def exploitablity_matrix findings\n\t\t\t\t\tresults = Array.new\n\n\t\t\t\t\tfindings.each do |item|\n\t\t\t\t\t\tplugin = Plugin.where(:id => item.plugin_id).first\n\n\t\t\t\t\t\tname = scrub_plugin_name(plugin.plugin_name)\n\t\t\t\t\t\ttotal = Item.where(:plugin_id => item.plugin_id).count\n\t\t\t\t\t\tcore = plugin.exploit_framework_core? ? \"Yes\" : nil\n\t\t\t\t\t\tmetasploit = plugin.exploit_framework_metasploit? ? \"Yes\" : nil\n\t\t\t\t\t\tcanvas = plugin.exploit_framework_canvas? ? \"Yes\" : nil\n\t\t\t\t\t\texploithub = plugin.exploit_framework_exploithub? ? \"Yes\" : nil\n\t\t\t\t\t\td2elliot = plugin.exploit_framework_d2_elliot? ? \"Yes\" : nil\n\n\t\t\t\t\t\tresults.push [name, total, core, metasploit, canvas, exploithub, d2elliot]\n\t\t\t\t\tend\n\n\t\t\t\t\treturn results\n\t\t\t\tend",
"def couplings(port = nil)\n ary = @internal_couplings.values\n .concat(@input_couplings.values)\n .concat(@output_couplings.values)\n .flatten! || []\n\n if port.nil?\n ary\n else\n couplings = []\n i = 0\n while i < ary.size\n couplings << ary[i] if coupling.port_source == port\n i += 1\n end\n couplings\n end\n end",
"def find_winning_combinations(board,player,opponent)\n Game::WIN_COMBINATIONS.reject do | combo |\n combo.count { | position | board.cells[position]==opponent } > 0\n end\n end",
"def ways_to_fill_a_fridge(amount, available = [5, 5, 10, 15, 20])\r\n containers = 1\r\n ways = []\r\n until containers > available.length\r\n schemes = available.combination(containers)\r\n schemes.each {|scheme| ways << scheme if scheme.inject(:+) == amount}\r\n containers += 1\r\n end\r\n ways\r\nend",
"def print_combos(vector)\n \nend",
"def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end",
"def forms\n option_sets.collect{|os| os.questionings.collect(&:form)}.flatten.uniq\n end",
"def passing_products\n return self.products.select do |product|\n product.passing?\n end\n end",
"def overriden_features\n connection().select_all(\"select f.id id, f.title title, pf.value as plan_value, f.format_description format_description from plans p, features f left join plans_features pf on p.id=pf.plan_id and f.id=pf.feature_id where p.id = #{id}\")\n end",
"def with_pricing\n # CCS::FM::Rate.non_zero_rate\n services_with_pricing = CCS::FM::Rate.non_zero_rate.map(&:code)\n\n services_selected = user_buildings.collect { |b| b.building_json['services'] }.flatten # s.collect { |s| s['code'].gsub('-', '.') }\n services_selected = services_selected.map { |s| s['code'] }\n services_selected.uniq!\n\n FacilitiesManagement::Service.all.select do |service|\n # (@posted_services.include? service.code) && (services_with_pricing.include? service.code)\n (services_selected.include? service.code) && (services_with_pricing.include? service.code)\n end\n end",
"def concept_set(concept_name)\n concept_id = ConceptName.find_by_name(concept_name).concept_id\n \n set = ConceptSet.find_all_by_concept_set(concept_id, :order => 'sort_weight')\n options = set.map{|item|next if item.concept.blank? ; item.concept.fullname }\n return options\n end",
"def solutions(wanted_pieces_masks, available_piece_masks)\n solutions = []\n Decoder.all_possible_combinations(4).each do |combination_bitmask|\n wanted_pieces_masks.delete_if do |wanted_piece_mask|\n if combination_xors_to?(combination_bitmask, wanted_piece_mask, available_piece_masks)\n solutions << combination_bitmask\n true\n end\n end\n end\n solutions\n end",
"def prepare_plan(options)\n options = validate_options options,\n missions: 0, add: 0, discover: 0, tasks: 0,\n permanent: 0,\n model: Roby::Task, plan: plan\n\n missions, permanent, added, tasks = [], [], [], []\n (1..options[:missions]).each do |i|\n options[:plan].add_mission_task(t = options[:model].new(id: \"mission-#{i}\"))\n missions << t\n end\n (1..options[:permanent]).each do |i|\n options[:plan].add_permanent_task(t = options[:model].new(id: \"perm-#{i}\"))\n permanent << t\n end\n (1..(options[:discover] + options[:add])).each do |i|\n options[:plan].add(t = options[:model].new(id: \"discover-#{i}\"))\n added << t\n end\n (1..options[:tasks]).each do |i|\n tasks << options[:model].new(id: \"task-#{i}\")\n end\n\n result = []\n [missions, permanent, added, tasks].each do |set|\n unless set.empty?\n result << set\n end\n end\n\n result = result.map do |set|\n if set.size == 1 then set.first\n else\n set\n end\n end\n\n if result.size == 1\n return result.first\n end\n\n result\n end",
"def chosen\n the_set = []\n self.itemlist.each { |k,v| the_set << self.object(k).chosen }\n the_set\n end",
"def options_for_action_select\n source_array = []\n self.questions.each do |q|\n if q.class == MatrixQuestion\n q.choice_questions.each {|cq| source_array << [\"#{q.question_content.statement}: #{cq.question_content.statement} response\", \"#{cq.question_content.id}\"]}\n else\n source_array << [\"#{q.question_content.statement} response\", \"#{q.question_content.id}\"]\n end\n end\n source_array\n end",
"def available_pink_cabs\n arr = []\n @pink_cabs.select { |pink_cab| arr << pink_cab if (pink_cab.available == true) }\n return arr\n end",
"def combinations(arr)\n new_array = []\n \n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1\n new_array << [ele1, ele2]\n end\n end\n end\n \n return new_array\nend",
"def explode_by_combination(join_with = '.')\n parts = map { |part| part.respond_to?(:to_a) ? part.to_a.map(&:to_s) : [ part.to_s ] }\n combinations = parts.shift.map { |part| [ part ] }\n parts.inject(combinations) do |combos, part_values|\n combos.map { |combo| part_values.map { |part| combo + [ part ] } }.flatten(1)\n end.map do |combo|\n combo.join(join_with)\n end\n end",
"def combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v == to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"No exact price matches\" end\n end",
"def points_of_subset_simple subset\n subset = subset.to_s(2)\n (2 ... subset.length+1).find_all { |i| subset[-i,1] == '1' }\n end",
"def qualified_candidates(candidates)\n puts \"Candidates that meet your specs:\"\n\n qualified = candidates.select do |c|\n experienced?(c)\n has_enough_github_pts?(c) &&\n has_right_languages?(c) &&\n applied_within_15_days?(c) &&\n is_of_age?(c)\n end\nend",
"def eligible_by_checklist(release, bugs)\n bugs.select do |b|\n BugEligibility::CheckList.new(b, :release => release).pass_all?\n end\n end"
] |
[
"0.6114172",
"0.6042254",
"0.57879674",
"0.5766543",
"0.57328206",
"0.56937814",
"0.56345755",
"0.56344414",
"0.5536038",
"0.5522393",
"0.54283637",
"0.5384993",
"0.53054136",
"0.52885693",
"0.5281848",
"0.52582914",
"0.5251883",
"0.5247608",
"0.52353096",
"0.5226844",
"0.5184088",
"0.51535475",
"0.51442736",
"0.5136181",
"0.5126067",
"0.51224035",
"0.50909775",
"0.50686175",
"0.50658756",
"0.50651497",
"0.50647855",
"0.5064416",
"0.5060802",
"0.50455296",
"0.5035203",
"0.50247926",
"0.5001196",
"0.49959943",
"0.49714223",
"0.49692068",
"0.49584782",
"0.495581",
"0.49408785",
"0.4935466",
"0.49277878",
"0.49267358",
"0.49219415",
"0.4918541",
"0.4914874",
"0.4907196",
"0.49040306",
"0.49038824",
"0.4899328",
"0.48941335",
"0.48863783",
"0.48770848",
"0.48573604",
"0.4856021",
"0.48516855",
"0.4824148",
"0.48230052",
"0.4821507",
"0.481451",
"0.4814244",
"0.48125234",
"0.48077902",
"0.4805209",
"0.48040074",
"0.48017916",
"0.4800196",
"0.47967994",
"0.47914642",
"0.47883078",
"0.47812366",
"0.47795036",
"0.47787765",
"0.47748655",
"0.4757939",
"0.47501487",
"0.47428626",
"0.47423846",
"0.47399426",
"0.47327355",
"0.4731223",
"0.47299007",
"0.472555",
"0.47190326",
"0.4716742",
"0.47164884",
"0.4715732",
"0.47140035",
"0.4713296",
"0.47103894",
"0.47073892",
"0.47046527",
"0.46971273",
"0.46963912",
"0.46952793",
"0.46916947",
"0.46844026"
] |
0.77840865
|
0
|
set lowest plan and compute global name/feature_count/cost
|
def optimal_plan=(plans)
@plans = plans
@cost = 0.00
@plans_name = ""
@features_count = 0
@plans.each do |plan|
@cost += plan['cost']
@plans_name += plan['name'] + " "
@features_count += plan['features'].size
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cheaper?(plan)\n cost = plan.inject(0) {|sum,plan| sum + plan['cost']}\n features_count = plan.inject(0) {|sum,plan| sum + plan['features'].size}\n @cost.nil? or cost < @cost or (cost == @cost && features_count > @features_count)\n end",
"def plan\n 0\n end",
"def plan; end",
"def to_s\n if match?\n \"Best Plan: \" + @plans_name + \"for $\" + '%.2f' % [(@cost * 100).round / 100.0]\n else\n \"No matching plan for your features\"\n end\n end",
"def standard_cost_code; end",
"def plan\n plan_rebuilder.plan\n end",
"def compute(object)\n @seller = self.calculable.seller if self.calculable && self.calculable.respond_to?(:seller)\n weight = object.weight(@seller)\n # find weight range\n arr = JSON.parse(preferred_interval)\n # sort by inerval from smalles to biggest\n arr = arr.to_enum.sort_by {|x| x['int']}\n arr.each do |h|\n if weight.to_f < h['int'].to_f\n cost = h['cost'].to_f\n break\n end\n end\n # if not find range - maximum cost\n cost = arr.map {|x| x['cost']}.max.to_f unless cost\n cost\n end",
"def group_size_factor_for(plan)\n return 1.0 if use_simple_employer_calculation_model?\n\n factor_carrier_id = plan.carrier_profile_id\n @gsf_cache ||= Hash.new do |h, k|\n h[k] = lookup_cached_gsf_for(k)\n end\n @gsf_cache[factor_carrier_id]\n end",
"def min_cost(cost, inf)\n # dist[i] stores minimum cost to reach station i from station 0.\n dist = {};\n\n i = 0\n n = cost.length\n while i < n do\n dist[i] = inf\n i += 1\n end\n dist[0] = 0\n\n # Go through every station and check if using it as an intermediate station gives better path\n i = 0\n while i < n do\n j = i + 1\n while j < n do\n c = dist[i] + cost[i][j]\n dist[j] = c if dist[j] > c\n j += 1\n end\n i += 1\n end\n return dist[n-1];\nend",
"def cost_estimate\n @cost_estimate ||= @base_cost + @maze.furthest_key_distance(@at, @subset_mask)\n end",
"def estimate_cost(sql, *args)\n explanation = ask \"EXPLAIN (FORMAT JSON) #{sql}\", *args\n explanation.first.dig \"Plan\", \"Total Cost\"\n end",
"def solver(flights)\n (p all_paths(flights)).min_by { |path| cost_of_path(path) }\nend",
"def find_initial_task_basis_plan\n kill_one_artificial until status.got_task?\n BasisPlan.new optimal_plan_real_part, real_task_basis\n end",
"def min_cost(costs)\n costs.reduce([0]*3) { |prev, now| now.map { |n| n + prev.rotate![0,2].min } }.min\nend",
"def number_of_free_gigabytes\n if plan_id == 'pro'\n 100\n elsif plan_id == 'basic'\n 10\n else\n 1\n end\n end",
"def total_cost=(value)\n super.tap do\n assign_cost_per\n end\n end",
"def cost\n @cost ||= 10\n end",
"def call\n result[:plan_features] = plan.features\n end",
"def cost\n super + 0.10\n end",
"def cost\n super + 0.10\n end",
"def cost\r\n 0\r\n end",
"def min_cost?\n false\n end",
"def per_ticket_cost\n flight_cost\n end",
"def benchmarkedcostssum\n benchmarkedcosts\n benchclean\n benchsubtotal1\n benchvariation\n benchsubtotal2\n benchcafm\n benchhelpdesk\n benchsubtotal3\n benchmobilisation\n benchtupe\n benchyear1\n benchmanage\n benchcorporate\n benchyear1total\n benchprofit\n benchyear1totalcharges + benchsubyearstotal\n end",
"def cost=(value)\n @cost = value\n end",
"def cost=(value)\n @cost = value\n end",
"def plan plan\n plan.myself if respond_to?(:run)\n end",
"def cost\n super + 0.20\n end",
"def compute_for_one_variant(variant)\n weight = variant.weight\n # find weight range\n arr = JSON.parse(preferred_interval)\n # sort by inerval from smalles to biggest\n arr = arr.to_enum.sort_by {|x| x['int']}\n arr.each do |h|\n if weight.to_f < h['int'].to_f\n cost = h['cost'].to_f\n break\n end\n end\n # if not find range - maximum cost\n cost = arr.map {|x| x['cost']}.max.to_f unless cost\n cost\n end",
"def cost\n @cost = 0.89\n end",
"def cost\n super + 0.15\n end",
"def sic_factor_for(plan)\n return 1.0 if use_simple_employer_calculation_model?\n\n factor_carrier_id = plan.carrier_profile_id\n @scff_cache ||= Hash.new do |h, k|\n h[k] = lookup_cached_scf_for(k)\n end\n @scff_cache[factor_carrier_id]\n end",
"def plan\n unless planned?\n @plan_id = Gremlin.world.plan(template.to_class, args).id if validated\n self.save\n end\n end",
"def assign_plan\n self.plan_id = Plan.find_by_name('Free').id\n end",
"def cost\n @cost ||= calibrate_cost\n end",
"def cost\n start_value\n end",
"def cost\n unless @cost\n @cost = 0\n @nodes_v.each do |v|\n @cost += @nodes_s.map { |s| v.distance_to(s) }.min\n end\n end\n\n @cost\n end",
"def native_kendalTauish_cost( pi )\n EpsSrraNative::rank_aggergate_upperW(@n){ |u,v| pi.pref(u,v) == @w[u][v] ? 0 : 1 } \n end",
"def selection plan, solutions\n (sort_soluitons plan, solutions.shuffle.first(4)).first(2)\n end",
"def calculate_fcost(p)\n\t\t@hcosts[p] + @gcosts[p]\n\tend",
"def update_target_cost\n cost = BigDecimal(0.00, 10)\n self.activities.each do |activity|\n cost += activity.targetCost\n end\n self.target_cost = cost\n end",
"def cost_per_person\n self.total_cost / @group\n end",
"def find_optimal(rootCode,goalCode)\n\tfindHops(rootCode, goalCode, \n\t\tlambda{|flight,oldweight| \n\t\t\toldweight + (flight.date.date.to_i + (flight.flightDuration).seconds - @date.date.to_i)/1200 + 100 + flight.seatprice/5 \n\t\t\t# oldweight + (number of hours between arrival and departure + 100 (per hop))*3 + seatprice/5 (~25-250)\n\t\t\t})\nend",
"def find_plan_value(feature_name)\n feature = Feature.find_by_name(feature_name)\n return 0 if feature.nil?\n\n planFeature = PlanFeature.find_plan_feature(self, feature)\n return 0 if planFeature.nil?\n\n planFeature.value\n end",
"def reward_cost(klass, options={})\n options.reverse_merge!(:count => 1, :level => 1)\n\n metal_cost = klass.metal_cost(options[:level])\n energy_cost = klass.energy_cost(options[:level])\n zetium_cost = klass.zetium_cost(options[:level])\n\n reward_metal metal_cost * options[:count] if metal_cost > 0\n reward_energy energy_cost * options[:count] if energy_cost > 0\n reward_zetium zetium_cost * options[:count] if zetium_cost > 0\n end",
"def update_best\n if @best_price < @ep.max\n @best_price = @ep.max\n res_i = @ep.index(@best_price)\n @best_weight = @bw[res_i]\n @best_baggage = in_bag(@cg[res_i])\n end\n end",
"def cost(meth)\n @costs[meth][\"cost_per_call\"] / 100.0 rescue 0.0\n end",
"def plan\n AcceptOn::Plan.new(@plan)\n end",
"def compute_package(package)\n\n line_items = package.order.line_items\n \n puts 'package'\n\n split = preferred_split_base\n cost = 0\n poster_count = 0\n\n if (line_items.length >= 2)\n split = self.preferred_split\n end\n\n line_items.each do |item|\n if (item.variant.sku.length > 4)\n cost = (self.preferred_with_frame)\n break\n else\n cost = (self.preferred_without_frame)\n end\n end\n\n line_items.each do |item|\n\n if (item.variant.sku.length > 4)\n poster_count = 0\n break\n end\n\n if (item.variant.sku.length <= 4)\n poster_count += item.quantity;\n end\n end\n\n if (poster_count >= 2)\n cost = self.preferred_many_posters\n end\n\n if (package.order.ship_address.address2.include? \"pickup: true\")\n cost = 0\n end\n\n return cost\n end",
"def benchmarkedcosts\n benchmark_rate = @benchmark_rates[@service_ref].to_f\n @benchmarkedcosts = benchmark_rate * @uom_vol\n end",
"def assign_default_price\n self.cost_per_min = 120\n end",
"def cost\n @cost = 0.99\n end",
"def plan; connection_space.plan end",
"def cost \n return @extra_cost + @basic_inst.cost\n end",
"def optimize(weight)\r\n return 0 if weight <= 0\r\n\r\n best = nil\r\n $items.each do |item|\r\n c = optimize(weight - item.weight) + item.cost\r\n best = c if best.nil? || c < best\r\n end\r\n best\r\nend",
"def cost\n 0.89\n end",
"def plans\n [Free, FreePlus, Pro, Growth, ProSpecial, ProComped, ProManaged, EliteSpecial, Elite, Custom0, Custom1, Custom2, Custom3].map(&:name)\n end",
"def cost\n cost = 0\n @solution.each { |route| cost += route.travel_time_and_cost[0] }\n return cost\n end",
"def lowest_scoring_visitor\n @teams.min_by { |team| team.average_away_goals }.team_name\n end",
"def cost_centers\n\n end",
"def min_cost_climbing_stairs(cost)\n [step(cost, 0), step(cost, 1)].min\nend",
"def lifter_total_cost\n total_cost = 0 \n self.memberships.each do |membership_instance|\n total_cost += membership_instance.cost \n end\n total_cost\n end",
"def cost\n @cost = 1.99\n end",
"def cost_at(point)\n @cost_strategy.cost_at(point)\n end",
"def find_shortest(rootCode,goalCode)\n\tself.findHops(rootCode, goalCode, lambda{|flight,oldweight| oldweight+1})\nend",
"def initialize(plan)\n @scope = :global\n\t @plan = plan\n\t super()\n\t @plan_predicates = Array.new\n\t @neg_plan_predicates = Array.new\n\tend",
"def min_cost(costs)\n prev_color_path1 = 0\n prev_color_path2 = 1\n path1 = costs[0][prev_color_path1]\n path2 = costs[0][prev_color_path2]\n \n if costs[0][2] < path1\n if path1 < path2\n path2 = path1\n prev_color_path2 = prev_color_path1\n path1 = costs[0][2]\n prev_color_path1 = 2\n end\n elsif costs[0][2] < path2\n if path2 < path1\n path1 = path2\n prev_color_path1 = prev_color_path2\n path2 = costs[0][2]\n prev_color_path2 = 2\n end\n end\n\n costs[1..-1].each do |cost|\n min1 = nil\n min1idx = nil\n # for first path\n cost.each_with_index do |amt, idx|\n next if idx == prev_color_path1\n if min1\n if amt < min1\n min1 = amt\n prev_color_path1 = idx\n else\n next\n end\n else\n min1 = amt\n min1idx = idx\n end\n end\n path1 += min1\n\n \n min2 = nil\n min2idx = nil\n # for second path\n cost.each_with_index do |amt, idx|\n next if idx == prev_color_path2\n if min2\n if amt < min2\n min2 = amt\n prev_color_path2 = idx\n else\n next\n end\n else\n min2 = amt\n min2idx = idx\n end\n end\n \n path2 += min2\n end\n\n path1 < path2 ? path1 : path2\nend",
"def optimize(params)\n plan = SemesterPlan.find(params[:id])\n users = User.users_of_plan_pure plan\n empty_hours = false\n if users.any?\n users.each do |user|\n if user.hours == 0 || user.hours == nil\n empty_hours = true\n end\n\n end\n\n end\n if !empty_hours\n case params[\"optimisation\"][\"kind\"]\n when \"0\"\n if plan.solution.nil?\n empty_slots = []\n plan.time_slots.each_with_index do |n, index|\n empty_slots << {index: index, user: nil, co: nil, slot: n.id}\n end\n plan.update(solution: empty_slots)\n end\n flash[:success] = \" Manuelle Planerstellung eingeleitet\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"1\"\n flash[:success] = \" Gültiger Plan wurde erstellt.\"\n sol = valid_solution2(false)\n plan.update(solution: \"#{mutate_pairs(plan, sol)}\")\n\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2(true)}\")\n end\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"2\"\n plan.update(solution: \"#{heuristic (plan)}\")\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2 true}\")\n end\n flash[:success] = \" 2 verlinkt!\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n end\n else\n flash[:danger] = \"Abbruch: Ein Nutzer hat keine Stunden eingetragen!\"\n redirect_to semester_plan_path plan\n\n end\n end",
"def calculate_total_cost(a, stripped_row, k)\n total_cost = 0\n count = 0\n sum = 0\n delivery = \"\"\n mul_value = (a[:\"Cost Per GB\"].to_i * stripped_row[1].to_i)\n if mul_value >= a[:\"Minimum Cost\"].to_i\n if count > 0\n if mul_value < sum\n sum = mul_value\n delivery = k\n total_cost = sum\n return total_cost, delivery\n end\n else\n sum = mul_value\n count += 1\n total_cost = sum\n delivery = k\n return total_cost, delivery\n end\n end\n end",
"def min_cost2(costs)\n return 0 if costs.empty?\n \n pre_red = costs[0][0]\n pre_green = costs[0][1]\n pre_blue = costs[0][2]\n\n costs[1..-1].each_with_index do |cost, i|\n current_red = cost[0] + [pre_blue, pre_green].min\n current_green = cost[1] + [pre_red, pre_blue].min\n current_blue = cost[2] + [pre_red, pre_green].min\n\n pre_red = current_red\n pre_green = current_green\n pre_blue = current_blue\n end\n\n # p [pre_red, pre_green, pre_blue]\n [pre_red, pre_green, pre_blue].min\nend",
"def cost(op)\n {labor: 4.38, materials: 0}\nend",
"def gift_cost gift_counts, costs\n black_count, white_count = gift_counts\n black_cost, white_cost, conversion_cost = costs\n \n if conversion_cost + [black_cost, white_cost].min >= [black_cost, white_cost].max \n # just buy what we need, dont do any converting\n return (black_count * black_cost) + (white_count * white_cost)\n else\n # its better to buy all cheapest and convert what we need to the other\n cost = [black_cost, white_cost].min * gift_counts.reduce(&:+)\n if black_cost < white_cost\n cost += white_count * conversion_cost\n else\n cost += black_count * conversion_cost\n end\n return cost\n end\n \nend",
"def plan_name\n if @plan_name.nil?\n jmeter_document do |doc|\n test_plan = doc.xpath('//TestPlan').first\n @plan_name = test_plan['testname']\n end\n if @plan_name.blank? || (@plan_name == 'Test Plan')\n @plan_name = self.test_plan_name\n end\n end\n\n @plan_name\n end",
"def actual_cost\n self.cost/1000.to_f\n end",
"def calculate_cost(gold, powerups, premium = nil)\n\n\t\tlives = calculate_lives(data_params) \n\t\t\n\t\tif premium\n\t\t\tpremium_cost(data_params) \n\t\telse\n\t\t\tbasic_cost(data_params)\n\t\tend\n\tend",
"def initialize(name, cost)\n @name = name\n @cost = cost\n end",
"def calculate_discount_plan_cost(plan_id)\n # Find a plan\n plan = PlanCC.find_by_i_plan(plan_id)\n # Find a discount\n discount = BillingCircle.find(:first, :conditions => \"bilcircle = 12\")\n\n # Calculate a prices\n (plan.price*discount.bilcircle).to_f*((100-discount.discount).to_f/100)\n end",
"def plan=(plan)\r\n if plan.amount > 0\r\n # Discount the plan with the existing discount (if any)\r\n # if the plan doesn't already have a better discount\r\n plan.discount = discount if discount && discount > plan.discount\r\n # If the assigned plan has a better discount, though, then\r\n # assign the discount to the subscription so it will stick\r\n # through future plan changes\r\n self.discount = plan.discount if plan.discount && plan.discount > discount\r\n else\r\n # Free account from the get-go? No point in having a trial\r\n self.state = 'active' if new_record?\r\n end\r\n\r\n #\r\n # Find any attributes that exist in both the Subscription and SubscriptionPlan\r\n # and that match the pattern of \"something_limit\"\r\n #\r\n limits = self.attributes.keys.select { |k| k =~ /^.+_limit$/ } &\r\n plan.attributes.keys.select { |k| k =~ /^.+_limit$/ }\r\n\r\n (limits + [:amount, :renewal_period]).each do |f|\r\n self.send(\"#{f}=\", plan.send(f))\r\n end\r\n \r\n self.subscription_plan = plan\r\n end",
"def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend",
"def cost()\n unless @cost\n @cost = @description.inject(0) do |val, el|\n val + ((el.nil? || el.to_s.end_with?('?')) ? 1 : 0.1)\n end\n end\n @cost\n end",
"def plan(&block)\n @plan = block\n end",
"def update_estimated_cost\n self.estimated_cost = total_asset_cost\n save\n end",
"def setup_cost_types\n q = params[:q]\n t = q[:total_cost_eq].to_i\n\n if t == TechnicalServicesHelper::COST_TYPE_FREE\n q[:total_cost_eq] = '0.0'\n elsif t == TechnicalServicesHelper::COST_TYPE_NONFREE\n q[:total_cost_gt] = '0.0'\n q.delete(:total_cost_eq)\n end\n end",
"def total_cost\n [executor_cost, team_lead_cost, account_manager_cost].compact.inject(&:+)\n end",
"def cost(op)\n { materials: 0.84, labor: 1.24 }\nend",
"def fuel_cost\n ((amount * 100) / (mileage - predecessor.mileage)).round(1) if predecessor\n end",
"def min_cost(cost, m, n)\n if n < 0 || m < 0\n return 100000\n elsif m == 0 && n == 0\n return cost[m][n]\n else\n return cost[m][n] + find_min( min_cost(cost, m-1, n-1),\n min_cost(cost, m-1, n),\n min_cost(cost, m, n-1))\n end\nend",
"def cost\n self[:cost].to_f\n end",
"def service_plan_name=(value)\n @service_plan_name = value\n end",
"def total_cost\n Membership.all.select {|member_info| member_info.member_name == self}.map{|member_info| member_info.cost}.sum\n end",
"def initialize\n super\n @base_plan = \"\"\n @has_server_plan = false\n @has_stash = false\n @additional_computers = \"\"\n @additional_storage = \"\"\n @plan_summary = {}\n @billing_summary = []\n @curplan_payment_summary = \"\"\n end",
"def cost\n 0.99\n end",
"def new_plan\n\t plan.clear\n\t plan\n\tend",
"def set_defaults\n self.active = self.active.nil? ? true : self.active\n self.estimated_cost ||= 0\n self.anticipated_cost ||= 0\n end",
"def plan_object\n Plan.new plan\n end",
"def cost\r\n\t\treturn @extra_cost + @real_need.cost\r\n\tend",
"def set_costs (ic_spm_cost_per_vol, ic_mpm_cost_per_vol, ic_ser_cost_per_vol)\n set_cost(:spm, @ic_spm, ic_spm_cost_per_vol);\n set_cost(:mpm, @ic_mpm, ic_mpm_cost_per_vol);\n set_cost(:ser, @ic_ser, ic_ser_cost_per_vol);\n end",
"def findLeastCostNode(costs, unvisitedNodes) \n leastNode = nil\n cheapest = Float::INFINITY\n unvisitedNodes.each do |node| \n if (costs[node][:cost] < cheapest)\n leastNode = node\n end\n end\n return leastNode\n end",
"def set_costs (ic_spm_cost_per_vol, ic_mpm_cost_per_vol, ic_ser_cost_per_vol)\n set_cost(:spm, @ic_spm, ic_spm_cost_per_vol);\n set_cost(:mpm, @ic_mpm, ic_mpm_cost_per_vol);\n set_cost(:ser, @ic_ser, ic_ser_cost_per_vol);\n end",
"def calibrate_cost\n ::Rails.env.test? ? ::BCrypt::Engine::MIN_COST : ::BCrypt::Engine.calibrate(750)\n end"
] |
[
"0.65415066",
"0.6359894",
"0.60918415",
"0.60409456",
"0.59103656",
"0.58384174",
"0.5773555",
"0.5761045",
"0.57514215",
"0.5713995",
"0.5692845",
"0.5675192",
"0.56427705",
"0.56001556",
"0.558127",
"0.55578923",
"0.5552348",
"0.55357087",
"0.548267",
"0.548267",
"0.5480143",
"0.5445673",
"0.5439956",
"0.5431118",
"0.5420662",
"0.5420662",
"0.54042566",
"0.5403541",
"0.5398685",
"0.5384132",
"0.5379455",
"0.5376254",
"0.53733563",
"0.5371705",
"0.5371109",
"0.5359396",
"0.53578293",
"0.5357442",
"0.53512925",
"0.53470916",
"0.5346603",
"0.5333706",
"0.5322427",
"0.5300589",
"0.5299802",
"0.52996486",
"0.52918035",
"0.52850753",
"0.5275627",
"0.5265152",
"0.52550423",
"0.52531844",
"0.52487767",
"0.52455264",
"0.5232497",
"0.5231446",
"0.5229502",
"0.5211086",
"0.52078235",
"0.5200761",
"0.51845276",
"0.5179527",
"0.5169932",
"0.51682633",
"0.51661813",
"0.5159904",
"0.51594204",
"0.5153233",
"0.51522785",
"0.5151747",
"0.51408374",
"0.5137745",
"0.51342136",
"0.51229566",
"0.5121306",
"0.5116648",
"0.51123756",
"0.51027477",
"0.510135",
"0.5088325",
"0.5078784",
"0.50767386",
"0.5073388",
"0.50664055",
"0.50587493",
"0.5055636",
"0.5055627",
"0.50524896",
"0.5052154",
"0.50508296",
"0.5043422",
"0.50401694",
"0.5036766",
"0.5033927",
"0.5025898",
"0.5021505",
"0.5020917",
"0.5020288",
"0.5020123",
"0.50182843"
] |
0.6954604
|
0
|
Is the matching plan cheaper? We make two assumptions here: 1. If cost are equal, return the plan with more features as cheaper plan 2. If cost are equal, feature count is same and feature belongs to both plan, the first plan retrieved is selected. This behavior can be easily changed. Based on business need both plan can be shown to user or A/B test can be performed on the plan
|
def cheaper?(plan)
cost = plan.inject(0) {|sum,plan| sum + plan['cost']}
features_count = plan.inject(0) {|sum,plan| sum + plan['features'].size}
@cost.nil? or cost < @cost or (cost == @cost && features_count > @features_count)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n if match?\n \"Best Plan: \" + @plans_name + \"for $\" + '%.2f' % [(@cost * 100).round / 100.0]\n else\n \"No matching plan for your features\"\n end\n end",
"def matching_combinations(plans, selected_features)\n a = {}\n \n # array of plan indexed by feature\n # Example F1 => [P1, P2], F2 => [P2, P3] ...\n plans.each do |plan|\n plan['features'].each do |f|\n a[f] ||= []\n a[f] << plan\n end\n end\n \n # Returns an array of all combinations of elements from all arrays.\n # [P1,P2].product([P3,P4]) #=> [[P1,P3],[P1,P4],[P2,P3],[P2,P4]]\n # @ref http://ruby-doc.org/core-1.9.3/Array.html#method-i-product\n combinations = selected_features.drop(1).inject(a[selected_features[0]]) do |result, element| \n result.product(a[element] || [])\n end || []\n \n # Get the unique plans as 2 different features can belong to same plan\n combinations.each do |plans|\n plans = [plans] if plans.is_a?(Hash)\n plans.flatten!\n plans.uniq!\n end\n end",
"def selection plan, solutions\n (sort_soluitons plan, solutions.shuffle.first(4)).first(2)\n end",
"def plan\n plan_rebuilder.plan\n end",
"def best_rate_plan(params)\n u_id = JTB::UnitId.from_roomorama_unit_id(params[:unit_id])\n\n cache_key = build_cache_key(params, u_id)\n cache_duration = 10 * 60 # ten minutes\n\n result = with_cache(cache_key, freshness: cache_duration) do\n message = builder.quote_price(params[:property_id], u_id.room_type_code, params[:check_in], params[:check_out])\n remote_call(message)\n end\n\n return result unless result.success?\n\n rate_plans_ids = rate_plans_ids(u_id.room_code)\n response_parser.parse_rate_plan(result.value, params[:guests], rate_plans_ids)\n end",
"def free_plan?(service_id, plans = nil)\n @free_plans ||= {}\n return @free_plans[service_id] if @free_plans.key?(service_id)\n plans ||= load_plans(service_id)\n @free_plans[service_id] = plans.any? { |plan| (plan[:price][:cents]).zero? }\n @free_plans[service_id]\n end",
"def optimal_plan=(plans)\n @plans = plans\n @cost = 0.00\n @plans_name = \"\"\n @features_count = 0\n @plans.each do |plan|\n @cost += plan['cost']\n @plans_name += plan['name'] + \" \"\n @features_count += plan['features'].size\n end\n end",
"def plan?(plan)\n return items.any? { |item| item.stripe_plan == plan } if multiple_plans?\n\n stripe_plan == plan\n end",
"def plan\n AcceptOn::Plan.new(@plan)\n end",
"def splitOn?\r\n\t\tmaxGain = 0\r\n\t\tbestFeature = nil\r\n\t\tfor i in 0..self.featureCount-1\r\n\t\t\tgain = self.gain(i)\r\n\t\t\tif gain >= maxGain\r\n\t\t\t\tmaxGain = gain\r\n\t\t\t\tbestFeature = i\r\n\t\t\tend\r\n\t\tend\r\n\t\tif maxGain == 0\r\n\t\t\tbestFeature = rand(0..self.featureCount-1)\r\n\t\tend\r\n\t\treturn bestFeature\r\n\tend",
"def splitOn?\r\n\t\tmaxGain = 0\r\n\t\tbestFeature = nil\r\n\t\tfor i in 0..self.featureCount-1\r\n\t\t\tgain = self.gain(i)\r\n\t\t\tif gain >= maxGain\r\n\t\t\t\tmaxGain = gain\r\n\t\t\t\tbestFeature = i\r\n\t\t\tend\r\n\t\tend\r\n\t\tif maxGain == 0\r\n\t\t\tbestFeature = rand(0..self.featureCount-1)\r\n\t\tend\r\n\t\treturn bestFeature\r\n\tend",
"def single_plan?\n !multiple_plans?\n end",
"def cheaper_locally?(point)\n @local.price_at(point) < @abroad.price_at(point)\n end",
"def plan?\n now = Time.zone.now\n\n have_discounts = clients_plans.with_discounts\n !have_discounts.empty? && have_discounts.any? do |plan|\n now < plan.expired_date\n end\n end",
"def plans?\n true\n end",
"def better_match?( other )\n return true if prefers?( other ) && free?\n preference_index = preferences.index other\n match_preference_indexes = matches.map { | match | preferences.index match }\n preference_index and match_preference_indexes.any? { |i| i > preference_index }\n end",
"def plan plan\n plan.myself if respond_to?(:run)\n end",
"def min_cost?\n false\n end",
"def test_for_cheap\r\n if @agent_bargain_limit\r\n @ischeap = true if @price < @agent_bargain_limit\r\n else\r\n @ischeap = true if @price < @cheap\r\n end\r\n end",
"def select_plan\n unless params[:plan] && (params[:plan] == '1' || params[:plan] == '2')\n redirect_to root_url\n end\n end",
"def plan; end",
"def best_candidate\n self.by_quality.first\n end",
"def plan_type\n return 'supporter' if owner.values[:paypal_active] == true\n return 'free' if owner.values[:plan_type].nil?\n return 'supporter' if owner.values[:plan_type].match /^plan_/\n return 'supporter' if owner.values[:plan_type] == 'special'\n owner.values[:plan_type]\n end",
"def plan_next_step(used_strategy)\n options = {}\n case used_strategy\n when :agressive\n\n # attack a company if success rate is high enough\n attackable_companies = Company.all.delete_if { |c| chance_of_success_against(c, :hack) < 50.0 }\n if attackable_companies.present?\n company_with_highest_success_rate = attackable_companies.sort_by! { |c| chance_of_success_against(c, :hack) }.first\n options = {\n user_id: id,\n target_id: company_with_highest_success_rate.id,\n target_type: \"Company\",\n type_id: Action::TYPE_ATTACK_COMPANY,\n completed_at: time_to_attack(company_with_highest_success_rate, :hack)\n }\n\n # counter-attack last attacker (if his attack is still unavenged)\n elsif successful_attacks_in_last_24_hours > 0 && !counterattack_successful?\n last_attacker = Action.where([\"type_id = ? OR type_id = ?\", Action::TYPE_ATTACK_USER, Action::TYPE_ATTACK_USER_DDOS]).where(target_id: id, target_type: \"User\", completed: true, success: true).where(\"completed_at >= ?\", DateTime.now-24.hours).order(\"completed_at DESC\").first.try(:user)\n if last_attacker.present? && \n (can_attack?(last_attacker, :hack) || can_attack?(last_attacker, :ddos)) && \n (chance_of_success_against(last_attacker, :hack) >= 50.0 || chance_of_success_against(last_attacker, :ddos) >= 50.0)\n\n # determine attack type based on success rate and possible reward\n options = {\n user_id: id,\n target_id: last_attacker.id,\n target_type: \"User\"\n }\n\n # assume that last attacker is rich if he controls a company\n if last_attacker.companies.present?\n options[:type_id] = Action::TYPE_ATTACK_USER\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :hack).seconds\n\n elsif chance_of_success_against(last_attacker, :hack) > chance_of_success_against(last_attacker, :ddos)\n options[:type_id] = Action::TYPE_ATTACK_USER\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :hack).seconds\n\n elsif chance_of_success_against(last_attacker, :hack) <= chance_of_success_against(last_attacker, :ddos)\n options[:type_id] = Action::TYPE_ATTACK_USER_DDOS\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :ddos).seconds\n end\n\n # buy or evolve attack skills\n else\n options = buy_or_evolve_attack\n end\n else\n options = buy_or_evolve_attack\n end\n when :defensive\n options = buy_or_evolve_defense\n\n when :moderate\n options = if (hacking_ratio <= botnet_ratio && hacking_ratio <= defense_ratio) ||\n (botnet_ratio <= hacking_ratio && botnet_ratio <= defense_ratio)\n buy_or_evolve_attack\n elsif defense_ratio <= botnet_ratio && defense_ratio <= hacking_ratio\n buy_or_evolve_defense\n end\n end\n\n if options.present?\n if options[:accept_job_id].present? && Job.acceptable.where(id: options[:accept_job_id]).first.present?\nRails.logger.info(\"---> AI: i accept job# #{options[:accept_job_id]}\")\n Job.acceptable.where(id: options[:accept_job_id]).first.accept_by(self)\n else\n result = Action.create(options)\nRails.logger.info(\"---> AI: i perform #{result.readable_type}\")\n result\n end\n end\n end",
"def plan\n 0\n end",
"def get_pricing_of_partner(user, selected_plan)\n pricing = PartnerPricing.find_by_user_id(user)\n price = 0\n\n if selected_plan > 4\n selected_plan -= 4\n price += 20\n end\n\n plan = PAYMENT_PLAN_FOR_PARTNER[selected_plan]\n case plan\n when \"short_restricted\"\n price += pricing.short_restricted\n when \"full_restricted\"\n price += pricing.full_restricted\n when \"full_use\"\n price += pricing.full_use\n end\n\n return price\n end",
"def composite_participation_rate_factor_for(plan)\n factor_carrier_id = plan.carrier_profile_id\n @cprf_cache ||= Hash.new do |h, k|\n h[k] = lookup_cached_cprf_for(k)\n end\n @cprf_cache[factor_carrier_id]\n end",
"def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end",
"def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end",
"def match?\n @plans and @plans.size > 0\n end",
"def compare\n # Creates an array of matched offers\n output = []\n @result_a.trips.each do |trip_1|\n @result_b.trips.each do |trip_2|\n next if trip_1.price.nil? || trip_2.price.nil? # safeguard if the trip is an empty object\n output << Offer.new(\n origin_a: @origin_a,\n origin_b: @origin_b,\n destination_city: trip_1.destination_city,\n date_there: @date_there,\n date_back: @date_back,\n total: trip_1.price + trip_2.price,\n # we agnosticize QPXTripOption here\n roundtrips: [\n RoundTrip.new(qpx_trip_option: trip_1),\n RoundTrip.new(qpx_trip_option: trip_2)\n ]\n )\n end\n end\n output\n end",
"def matches(trip)\n if trip.to_work\n origin_dist = 8000\n destination_dist = 1000\n else\n origin_dist = 1000\n destination_dist = 8000\n end\n @matches = Trip.joins(:users).\n where(pools: { is_active: true}).\n where.not(users: { id: id}).\n where(\"users.driving_pref = 0 OR driving_pref != ?\", driving_pref).\n where(trips: {to_work: trip.to_work}).\n where(\"ST_NumGeometries(trips.waypoints) = 2\").\n where(\"ST_DWithin( ST_geometryN(trips.waypoints, 1)::geography , ?::geography, ? )\", trip.waypoints[0], origin_dist).\n where(\"ST_DWithin( ST_geometryN(trips.waypoints, 2)::geography , ?::geography, ? )\", trip.waypoints[1], destination_dist).\n limit(20)\n\n # This gets up to 20 trips where (in order):\n # - the match user is actively taking this trip\n # - the match user isn't the current user\n # - the match user is neutral driving_pref or opposite of current user\n # - the match trip has same \"to_work\" value as current trip\n # - the match trip is currently an individual trip (technically not checking this, just checking that trip only has 2 waypoints)\n # - the match trip's origin is within [origin_dist] of the current trip's origin (note the difference in indexing!)\n # - the match trip's destination is [destination_dist] 1km of the current trip's destination\n \n # ATM TIMES NEVER CONSIDERED ANYWHERE\n # SHOULD FILTER IN DB BASED ON TIME/LOCATIONS (POSSIBLY ORDER AND LIMIT), THEN ALSO COMPUTE COMPAT AND ORDER RESULTS SOMEHOW\n # SHOULD HAVE SOME WAY OF RELAXING IF NOT ENOUGH RESULTS / BEING MORE PICKY IF TOO MANY.\n # ALSO SHOULD PRIORITIZE EXISTING MATCHES SOMEWHERE SOMEHOW\n \n @matches = @matches.sort_by{|t| -compatibility(t.users.first)} #right now sorting by compatability with first user\n return @matches\n end",
"def purchase_sub_existing\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_my_plan_id(plan_set_three)\nend",
"def plans(within_product=nil)\n product_id = within_product ? within_product.enabled_products.map(&:id) + [within_product.id] : nil\n Plan.where(:id => plan_ids, :product_id => product_id).all\n end",
"def plan=(plan)\r\n if plan.amount > 0\r\n # Discount the plan with the existing discount (if any)\r\n # if the plan doesn't already have a better discount\r\n plan.discount = discount if discount && discount > plan.discount\r\n # If the assigned plan has a better discount, though, then\r\n # assign the discount to the subscription so it will stick\r\n # through future plan changes\r\n self.discount = plan.discount if plan.discount && plan.discount > discount\r\n else\r\n # Free account from the get-go? No point in having a trial\r\n self.state = 'active' if new_record?\r\n end\r\n\r\n #\r\n # Find any attributes that exist in both the Subscription and SubscriptionPlan\r\n # and that match the pattern of \"something_limit\"\r\n #\r\n limits = self.attributes.keys.select { |k| k =~ /^.+_limit$/ } &\r\n plan.attributes.keys.select { |k| k =~ /^.+_limit$/ }\r\n\r\n (limits + [:amount, :renewal_period]).each do |f|\r\n self.send(\"#{f}=\", plan.send(f))\r\n end\r\n \r\n self.subscription_plan = plan\r\n end",
"def call\n result[:plan_features] = plan.features\n end",
"def pricing_plan\n settings[:pricing_plan]\n end",
"def free?\n cost.zero?\n end",
"def better_partner?(matchable)\r\n rank(matchable) > rank(@partner)\r\n end",
"def group_size_factor_for(plan)\n return 1.0 if use_simple_employer_calculation_model?\n\n factor_carrier_id = plan.carrier_profile_id\n @gsf_cache ||= Hash.new do |h, k|\n h[k] = lookup_cached_gsf_for(k)\n end\n @gsf_cache[factor_carrier_id]\n end",
"def over_limit_for?(plan)\n return true if projects.count > plan.projects_allowed\n false\n end",
"def cost_estimate\n @cost_estimate ||= @base_cost + @maze.furthest_key_distance(@at, @subset_mask)\n end",
"def plan_object\n Plan.new plan\n end",
"def solution_two\n result = []\n delivery_partners = partners\n capacities = partner_capacities\n posibilities = []\n CSV.foreach('input.csv') do |row|\n delivery_options = delivery_partners.select do |d|\n size_slab = d['Size Slab (in GB)'].split('-')\n deliverable?(d['Theatre'], row[2], size_slab, row[1])\n end\n unless delivery_options.empty?\n posibilities << delivery_possibilities(delivery_options, row[1])\n end\n end\n first, *rest = posibilities\n combinations = first.product(*rest)\n combinations.each do |combination|\n data = combination.inject do |memo, el|\n memo.merge(el) do |_k, old_v, new_v|\n merge_same_partners(old_v.split(','), new_v.split(','))\n end\n end\n\n if within_capacity_limit?(data, capacities)\n if result.empty?\n result = combination\n else\n old_sum = total_cost(result)\n new_sum = total_cost(combination)\n result = combination if new_sum < old_sum\n end\n end\n end\n CSV.open('second_output.csv', 'w') do |writer|\n counter = 0\n CSV.foreach('input.csv') do |row|\n delivery_id = row[0]\n size = row[1]\n theatre_id = row[2]\n data = { will_be_delivered: false, partner_id: '', cost: '' }\n\n delivery_options = delivery_partners.select do |d|\n size_slab = d['Size Slab (in GB)'].split('-')\n deliverable?(d['Theatre'], theatre_id, size_slab, size)\n end\n unless delivery_options.empty?\n data[:will_be_delivered] = true\n data[:partner_id] = result[counter].keys[0]\n data[:cost] = result[counter].values[0].split(',')[1]\n counter += 1\n end\n writer << csv_row(delivery_id, data)\n end\n end\n end",
"def add_test_case_to_test_plan_by_name(project_name, plan_name, test_case_id,\n test_case_version)\n test_project_id = project_id(project_name)\n test_plan_id = test_plan_id(project_name, plan_name)\n\n result = add_test_case_to_test_plan(test_project_id, test_plan_id,\n test_case_id, test_case_version)\n\n if result.any?\n #Only way to tell if success if with the key \"feature_id\"\n return result.has_key?(:feature_id) ? true : false\n end\n end",
"def find_plan_value(feature_name)\n feature = Feature.find_by_name(feature_name)\n return 0 if feature.nil?\n\n planFeature = PlanFeature.find_plan_feature(self, feature)\n return 0 if planFeature.nil?\n\n planFeature.value\n end",
"def plan_consistent?\n # A consistent plan is one in which there are no \n #contradictions in the ordering or binding\n #constraints. A contradiction occurs when both Si-< Sj and Si>-Sj,- hold or\n # both v = A and v = B hold (for two different constants A and B). \n # Both -< and = are transitive, so, for example, a plan\n #with Si -< S2, S2 -< S3, and S3 -< Si is inconsistent.\n\n true \n end",
"def has_sum_of_best_leaderboards?\n patron?(tier: 1, before: STRIPE_MIGRATION_DATE) || patron?(tier: 4) || subscriptions.tier1.active.any? || admin? || self.class.stay_insideathon?\n end",
"def product_rate_plan\n Zapi::Models::ProductRatePlan.new\n end",
"def virtual_network_match_plan\n errors.add(:base, 'plan virtual_network mismatch') if virtual_network.cloud != plan.cloud && virtual_network.region.start_with?(cloud_profile.region)\n end",
"def generate_best_pairings(state)\n teams = state.teams\n\n state.matches = state.driver.matches_hash\n\n state.score_range = state.scores.values.max - state.scores.values.min\n state.average_score_difference = state.score_range / teams.length.to_f\n\n state.team_index_map = teams.map.with_index.to_h\n\n Algorithm::Matching.minimum_weight_perfect_matching(teams) do |home_team, away_team|\n cost_function(state, home_team, away_team)\n end\n end",
"def trial?\n (plan_type == 'free_trial')\n end",
"def plan\n unless planned?\n @plan_id = Gremlin.world.plan(template.to_class, args).id if validated\n self.save\n end\n end",
"def change_plan!(new_plan)\n changed = change_plan_internal(new_plan) do\n self.save!\n end\n\n changed && self.plan\n end",
"def calculate_discount_plan_cost(plan_id)\n # Find a plan\n plan = PlanCC.find_by_i_plan(plan_id)\n # Find a discount\n discount = BillingCircle.find(:first, :conditions => \"bilcircle = 12\")\n\n # Calculate a prices\n (plan.price*discount.bilcircle).to_f*((100-discount.discount).to_f/100)\n end",
"def combo_optimal?\n optimal_value == combo_witheffect\n end",
"def find_optimal(rootCode,goalCode)\n\tfindHops(rootCode, goalCode, \n\t\tlambda{|flight,oldweight| \n\t\t\toldweight + (flight.date.date.to_i + (flight.flightDuration).seconds - @date.date.to_i)/1200 + 100 + flight.seatprice/5 \n\t\t\t# oldweight + (number of hours between arrival and departure + 100 (per hop))*3 + seatprice/5 (~25-250)\n\t\t\t})\nend",
"def included_in_cost\n false\n end",
"def gta_travel_support_single_rate_multiplier?\n if is_channel_gta_travel? and self.gta_travel_rate_basis <= 1 and self.gta_travel_max_occupancy >= 1\n return true\n else\n false\n end\n end",
"def plans\n [Free, FreePlus, Pro, Growth, ProSpecial, ProComped, ProManaged, EliteSpecial, Elite, Custom0, Custom1, Custom2, Custom3].map(&:name)\n end",
"def find_initial_task_basis_plan\n kill_one_artificial until status.got_task?\n BasisPlan.new optimal_plan_real_part, real_task_basis\n end",
"def plan_type\n plan_type_config = facility.plan_type.to_s.downcase.gsub(' ', '_')\n if plan_type_config == 'payer_specific_only'\n output_plan_type = payer.plan_type.to_s if payer\n output_plan_type = 'ZZ' if output_plan_type.blank?\n else\n if eob.claim_information && !eob.claim_information.claim_type.blank?\n output_plan_type = eob.claim_information.plan_type\n elsif eob.claim_information.blank? && eob.claim_type == \"Secondary\"\n output_plan_type = \"CI\"\n else\n output_plan_type = eob.plan_type\n end\n end\n output_plan_type\n end",
"def free?\n \tcost.zero?\n end",
"def optimize(params)\n plan = SemesterPlan.find(params[:id])\n users = User.users_of_plan_pure plan\n empty_hours = false\n if users.any?\n users.each do |user|\n if user.hours == 0 || user.hours == nil\n empty_hours = true\n end\n\n end\n\n end\n if !empty_hours\n case params[\"optimisation\"][\"kind\"]\n when \"0\"\n if plan.solution.nil?\n empty_slots = []\n plan.time_slots.each_with_index do |n, index|\n empty_slots << {index: index, user: nil, co: nil, slot: n.id}\n end\n plan.update(solution: empty_slots)\n end\n flash[:success] = \" Manuelle Planerstellung eingeleitet\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"1\"\n flash[:success] = \" Gültiger Plan wurde erstellt.\"\n sol = valid_solution2(false)\n plan.update(solution: \"#{mutate_pairs(plan, sol)}\")\n\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2(true)}\")\n end\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"2\"\n plan.update(solution: \"#{heuristic (plan)}\")\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2 true}\")\n end\n flash[:success] = \" 2 verlinkt!\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n end\n else\n flash[:danger] = \"Abbruch: Ein Nutzer hat keine Stunden eingetragen!\"\n redirect_to semester_plan_path plan\n\n end\n end",
"def fetch_plan\n @plan = Plan.find_by(id: params[:plan_id])\n return true if @plan.present?\n\n redirect_to root_path, alert: _('plan not found')\n end",
"def fetch_plan\n @plan = Plan.find_by(id: params[:plan_id])\n return true if @plan.present?\n\n redirect_to root_path, alert: _('plan not found')\n end",
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than any other match?\n when better_match?( other )\n free!\n match! other\n\n else\n false\n end\n end",
"def prepare_plan(options)\n options = validate_options options,\n missions: 0, add: 0, discover: 0, tasks: 0,\n permanent: 0,\n model: Roby::Task, plan: plan\n\n missions, permanent, added, tasks = [], [], [], []\n (1..options[:missions]).each do |i|\n options[:plan].add_mission_task(t = options[:model].new(id: \"mission-#{i}\"))\n missions << t\n end\n (1..options[:permanent]).each do |i|\n options[:plan].add_permanent_task(t = options[:model].new(id: \"perm-#{i}\"))\n permanent << t\n end\n (1..(options[:discover] + options[:add])).each do |i|\n options[:plan].add(t = options[:model].new(id: \"discover-#{i}\"))\n added << t\n end\n (1..options[:tasks]).each do |i|\n tasks << options[:model].new(id: \"task-#{i}\")\n end\n\n result = []\n [missions, permanent, added, tasks].each do |set|\n unless set.empty?\n result << set\n end\n end\n\n result = result.map do |set|\n if set.size == 1 then set.first\n else\n set\n end\n end\n\n if result.size == 1\n return result.first\n end\n\n result\n end",
"def stale?\n cost < self.class.cost\n end",
"def plan_params plan\n {\n name: plan.name,\n plan_id: plan.id,\n status: plan.status,\n chargebee_data: {\n price: plan.price,\n period: plan.period,\n period_unit: plan.period_unit,\n trial_period: plan.trial_period,\n trial_period_unit: plan.trial_period_unit,\n charge_model: plan.charge_model,\n free_quantity: plan.free_quantity\n }\n }\n end",
"def number_of_free_gigabytes\n if plan_id == 'pro'\n 100\n elsif plan_id == 'basic'\n 10\n else\n 1\n end\n end",
"def multiple_plans?\n stripe_plan.nil?\n end",
"def plan\n super\n @trip.itineraries\n .find_by(trip_type: @outbound_trip_type, service: @outbound_service)\n .try(:select)\n @trip.save\n @trip\n end",
"def find_best_offers\n self.procurement_products.each do |p_product|\n p_product.find_best_offer\n end\n end",
"def as_plan\n self\n end",
"def prepare_plan(options)\n\t options = validate_options options,\n\t\tmissions: 0, add: 0, discover: 0, tasks: 0,\n\t\tpermanent: 0,\n\t\tmodel: Roby::Task, plan: plan\n\n\t missions, permanent, added, tasks = [], [], [], []\n\t (1..options[:missions]).each do |i|\n\t\toptions[:plan].add_mission_task(t = options[:model].new(id: \"mission-#{i}\"))\n\t\tmissions << t\n\t end\n\t (1..options[:permanent]).each do |i|\n\t\toptions[:plan].add_permanent_task(t = options[:model].new(id: \"perm-#{i}\"))\n\t\tpermanent << t\n\t end\n\t (1..(options[:discover] + options[:add])).each do |i|\n\t\toptions[:plan].add(t = options[:model].new(id: \"discover-#{i}\"))\n\t\tadded << t\n\t end\n\t (1..options[:tasks]).each do |i|\n\t\ttasks << options[:model].new(id: \"task-#{i}\")\n\t end\n\n\t result = []\n\t [missions, permanent, added, tasks].each do |set|\n\t\tunless set.empty?\n\t\t result << set\n\t\tend\n\t end\n\n result = result.map do |set|\n if set.size == 1 then set.first\n else set\n end\n end\n\n if result.size == 1\n return result.first\n end\n return *result\n\tend",
"def best_offer?\n item_hash.deep_find([:best_offer_details, :best_offer_enabled], false)\n end",
"def planned?\n return false unless @plan_id != 'none'\n return true\n end",
"def valid_shipping_cost?(cost)\n flatrate_shipping_option_costs.member? cost\n end",
"def comparison(yearly_cost, yearly_consumption, kVA_power)\n yearly_cost = yearly_cost.to_f\n yearly_consumption = yearly_consumption.to_i\n kVA_power = kVA_power.to_i\n first_filter = EleContract.all.select { |contract| contract.kVA_power == kVA_power }\n second_filter = first_filter.select{ |contract| yearly_cost > (contract.kwh_price_base * yearly_consumption + contract.subscription_base_price_month * 12)}\n max_save = 0\n all_savings = []\n second_filter.each do |contract|\n savings = yearly_cost - (contract.kwh_price_base * yearly_consumption + contract.subscription_base_price_month * 12)\n if savings > max_save\n max_save = savings\n end\n all_savings << savings\n end\n [max_save.round(2), second_filter, all_savings]\n end",
"def plan\n @plan ||= Plan.new(stripe_plan_id: stripe_plan_id)\n end",
"def gta_travel_support_triple_rate_multiplier?\n if is_channel_gta_travel? and self.gta_travel_rate_basis <= 3 and self.gta_travel_max_occupancy >= 3\n return true\n else\n false\n end\n end",
"def per_ticket_cost\n flight_cost\n end",
"def plan(&block)\n @plan = block\n end",
"def test_plan_id(project_name, plan_name)\n if @version < \"1.0\"\n project_id = project_id project_name\n test_plans = test_plans(project_id)\n\n test_plan = test_plans.first.values.find do |project_test_plan|\n project_test_plan[:name] == plan_name\n end\n else\n test_plan = test_plan_by_name(project_name, plan_name).first\n end\n\n test_plan.nil? ? nil : test_plan[:id].to_i\n end",
"def plan=(new_plan)\n reset\n @plan = new_plan\n end",
"def plan; connection_space.plan end",
"def assign_plan\n self.plan_id = Plan.find_by_name('Free').id\n end",
"def viewed_plan(pln)\r\n #MES- Is the plan on the planner?\r\n if plans.include?(pln)\r\n plans.update_attributes(pln, :viewed_at => Time.now_utc)\r\n end\r\n end",
"def product_rate_plan_charge\n Zapi::Models::ProductRatePlanCharge.new\n end",
"def has_contributor_plan?\n (current_user.plan.id == 5)\n end",
"def gift_cost gift_counts, costs\n black_count, white_count = gift_counts\n black_cost, white_cost, conversion_cost = costs\n \n if conversion_cost + [black_cost, white_cost].min >= [black_cost, white_cost].max \n # just buy what we need, dont do any converting\n return (black_count * black_cost) + (white_count * white_cost)\n else\n # its better to buy all cheapest and convert what we need to the other\n cost = [black_cost, white_cost].min * gift_counts.reduce(&:+)\n if black_cost < white_cost\n cost += white_count * conversion_cost\n else\n cost += black_count * conversion_cost\n end\n return cost\n end\n \nend",
"def plan\n data['plans'][me]\n end",
"def plan\n # si el usuario no tiene plan_id en su modelo, se le asigna el plan_id seleccionado en el formulario\n # recordar que ese plan_id llega en los params del contexto y por tanto tenemos acceso a el\n # como variable de clase @plan_id\n\n if @current_user.plan_id.nil?\n if @plan_id.nil?\n raise StandardError, 'Error creando plan, plan_id null'\n end\n # se almacena en el user\n @current_user.update_attribute(:plan_id, @plan_id)\n # despues de tenerlo almacenado en la bd, llamamos nuevamente este metodo plan\n plan\n else\n # el usuario tiene un plan_id asignado, se le actualiza el plan_id en caso de que haya seleccionado uno\n # diferente al que tiene actualmente\n @current_user.update_attribute(:plan_id, @plan_id)\n # obtener informacion del plan de la BD\n plan_db = @current_user.plan\n #\n # NOTA: los planes deben tener un plan_code es OBLIGATORIO para el buen funcionamiento\n #\n if plan_db.plan_code.nil? || plan_db.plan_code.empty?\n raise StandardError, 'Error creando plan, code null'\n end\n # con el plan_code lo buscamos en payu\n plan_payu = PayuLatam::Plan.new(plan_db.plan_code)\n # si existe?\n if plan_payu.success?\n # llenar la variable plan con la instancia de clase PayuLatam:Plan\n @plan = plan_payu\n else\n # si no existe en pyu, crearlo con el metodo del modelo plan\n plan_db.create_payu_plan\n # llamado recursivo\n plan\n end\n end\n end",
"def best_restaurant_with_price\n min_price = nil\n restaurant_choice_id = nil\n # since we encode all entries with request_items.size number of bits,\n # we need to target 2^n-1 as result of bitwise or:\n target_number = 2**@desired_items.size - 1\n @restaurants.each_pair do |restaurant_id, entries|\n # find all satisfying entry combinations for current restaurant\n satisfying_combos = subset_bitwise_or(entries.keys, target_number)\n\n satisfying_combos.each do |complimenting_entries|\n # find total price by adding up the complimenting entry prices:\n total_price = complimenting_entries.map{|entry| entries[entry].to_f}.inject(:+)\n if min_price.nil? or min_price > total_price\n restaurant_choice_id = restaurant_id.to_i\n min_price = total_price\n end\n end\n end\n return restaurant_choice_id, min_price if min_price\n end",
"def payment_plan\n bank_account_terms > 1 ? BANK_FINANCED : NOT_FINANCED\n end",
"def bought_plan\n bought_cinstance.plan\n rescue ActiveRecord::RecordNotFound => error\n System::ErrorReporting.report_error(error)\n\n ApplicationPlan.new\n end",
"def plans_by_template?\n true\n end",
"def shared\n # FIXME: please constantize the step numbers!\n if selected_plan.free?\n @step = 2\n session[:step] = 2 if (session[:step].nil? || session[:step] < 2)\n else\n @step = 3\n session[:step] = 3 if (session[:step].nil? || session[:step] < 3)\n end\n end",
"def compute_matching_product(among_products) among_products.select { |product| concern?(product, among_products) } end"
] |
[
"0.68194604",
"0.6333256",
"0.6147887",
"0.60911",
"0.59614336",
"0.59326947",
"0.58656025",
"0.5775174",
"0.5746929",
"0.57186216",
"0.57186216",
"0.5688096",
"0.568036",
"0.5651539",
"0.55394995",
"0.54938084",
"0.54895586",
"0.547203",
"0.5471945",
"0.5430631",
"0.5408961",
"0.5387215",
"0.538522",
"0.53811806",
"0.5380461",
"0.53803784",
"0.53785783",
"0.5363504",
"0.5363504",
"0.53548574",
"0.53428173",
"0.5313746",
"0.52999634",
"0.5286089",
"0.5250251",
"0.5243965",
"0.52306205",
"0.51897573",
"0.51845115",
"0.5169296",
"0.5159781",
"0.5142223",
"0.51385134",
"0.512485",
"0.51064825",
"0.5091005",
"0.5086436",
"0.50748545",
"0.50732964",
"0.506735",
"0.5063122",
"0.5058779",
"0.50516117",
"0.50485873",
"0.504694",
"0.5039294",
"0.50263935",
"0.50152194",
"0.501112",
"0.5008923",
"0.5006717",
"0.5000789",
"0.50000083",
"0.49960485",
"0.49885988",
"0.49885988",
"0.49799845",
"0.49781194",
"0.49642965",
"0.4944539",
"0.4939466",
"0.49364635",
"0.4927069",
"0.49208808",
"0.4919646",
"0.49192816",
"0.49183634",
"0.4917884",
"0.49157503",
"0.49005088",
"0.48983037",
"0.48973277",
"0.48914996",
"0.48793024",
"0.48785785",
"0.4876161",
"0.4875133",
"0.48733652",
"0.48708674",
"0.48705518",
"0.4868503",
"0.48670766",
"0.48627588",
"0.48619807",
"0.48578563",
"0.48573667",
"0.48484468",
"0.48400825",
"0.4838465",
"0.48368186"
] |
0.8141394
|
0
|
Takes the User object and returns the months since last login.
|
def adjust_balances_if_monthchange(user)
#Works out how many months have passed since last login. The formula ensures it works over new year.
months_since_last_login = (DateTime.now.year*12+DateTime.now.month) - (user.last_login.year*12+user.last_login.month)
logger.debug "\nUpdated current cadets areers by #{months_since_last_login} months."
#If no months have passed, this is skipped, otherwise the cadet balences are incremented.
#Note that cadets marked as discharged aren't updated.
months_since_last_login.times {
current_user.cadets.each { |c| #updates the cadet's balances.
c.balance = c.balance - user.amount_per_month unless c.discharged?; c.save!
}
}
return months_since_last_login
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def months\n\t\treturn self * 30.days\n\tend",
"def months\n\t\treturn self * 30.days\n\tend",
"def months ; self * 30.days ; end",
"def months() 30 * days end",
"def months\n @years * 12\n end",
"def months_since(date)\n return (DateTime.now - date.to_datetime).to_i*(12/365.25)\n end",
"def months\n self.to_i * 2_592_000\n end",
"def work_months_options(user=@curr_user, include_all=false)\n min_year, min_year_month, max_year, max_year_month = WorkEntry.min_max_dates_for_user(user)\n months = if min_year == 0 && max_year == 0\n []\n else\n (year_and_month_to_int(min_year, min_year_month) .. year_and_month_to_int(max_year, max_year_month)).collect { |year_month|\n [year_month_int_to_str(year_month), year_month]\n }.reverse\n end\n months = [['All', '']] + months if include_all\n months\n end",
"def month\n months = %w{January February March April May June July August September October November December}\n months[Time.now.month - 1]\n end",
"def expiration_month\n @months = [\"01\",\"02\",\"03\",\"04\",\"05\",\"06\",\"07\",\"08\",\"09\",\"10\",\"11\",\"12\"]\n end",
"def remember_me\n remember_me_for 1.month\n end",
"def months_in_year\n 12\nend",
"def remember_me\n remember_me_for 3.month\n end",
"def month\n MONTHS[@created_at.month-1]\n end",
"def months_since(date)\n\t\t\tmonths = ((::Time.zone.today.year - date.year) * 12) + (::Time.zone.today.month - date.month)\n\t\t\tmonths -= 1 if ::Time.zone.today.day < date.day\n\t\t\tmonths\n\t\tend",
"def months ; Duration[self * 30 * 86400] ; end",
"def to_months; @val end",
"def get_monthly(user)\n weeks = get_calendar(user)\n ret = {\n '01' => 0,\n '02' => 0,\n '03' => 0,\n '04' => 0,\n '05' => 0,\n '06' => 0,\n '07' => 0,\n '08' => 0,\n '09' => 0,\n '10' => 0,\n '11' => 0,\n '12' => 0\n }\n weeks.each do |k|\n k.children.each do |day|\n date = day.attribute('data-date').value.split('-')[1]\n count = day.attribute('data-count').value\n ret[date] += count.to_i\n end\n end\n ret\n end",
"def remember_me\n remember_me_for 3.months\n end",
"def time_month; Time.now.month; end",
"def difference_in_months(date1, date2)\n return (date1.utc.year - date2.utc.year)*12 + (date1.utc.month - date2.utc.month)\n end",
"def month\n return @month\n end",
"def get_average_month(user)\n monthly = get_monthly(user)\n get_average(monthly)\n end",
"def calc_months_till\n (calc_days_till / 31.0).round(2)\n end",
"def billable_hours_for_user_previous_month\n return @billable_hours_for_user_previous_month if defined?(@billable_hours_for_user_previous_month)\n\n @billable_hours_for_user_previous_month = nil\n\n return @billable_hours_for_user_previous_month if user_id.blank?\n\n date_filter = Date.today.prev_month\n\n scope_for_time_entries = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.billable_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @billable_hours_for_user_previous_month = cf.format.cast_total_value(cf, total)\n end",
"def months_since_epoch(date)\n ((EPOCH_YEAR - date.year).abs * 12) + (EPOCH_MONTH - date.month).abs\n end",
"def month\n Thread.current[:datet_mode] = :months\n return @t_month\n end",
"def training_sessions_remaining_this_month\n end",
"def spent_hours_for_user_previous_month\n return @spent_hours_for_user_previous_month if defined?(@spent_hours_for_user_previous_month)\n\n @spent_hours_for_user_previous_month = nil\n\n return @spent_hours_for_user_previous_month if user_id.blank?\n\n date_filter = Date.today.prev_month\n\n @spent_hours_for_user_previous_month = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def age_in_months\n dob = birth_date\n now = Time.zone.now.to_date\n months = now.month - dob.month - ((now.day >= dob.day) ? 0 : 1)\n years = now.year - dob.year\n years * 12 + months\n end",
"def display_months(this_year)\n # Calculate what the last month is\n last_month = this_year.last.month\n # Return an ordered array of the past months of the fiscal year\n return last_month >= 7 ?\n last_month.downto(7).to_a :\n last_month.downto(1).to_a + 12.downto(7).to_a\n end",
"def month\n return @month\n end",
"def months\n Thread.current[:datet_mode] = :months\n return self\n end",
"def months; self * MONTH; end",
"def months_ago(months)\n if months >= self.month\n change(:year => self.year - 1, :month => 12).months_ago(months - self.month)\n else\n change(:year => self.year, :month => self.month - months)\n end\n end",
"def monthly_print_usage_by_user\n return @monthly_print_usage_by_user\n end",
"def depreciation_months(on_date=Date.today, start_date=nil)\n if start_date.nil?\n start_date = depreciation_start_date\n end\n (on_date.year * 12 + on_date.month) - (start_date.year * 12 + start_date.month)\n end",
"def months_since(months)\n advance(months: months)\n end",
"def month() end",
"def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end",
"def diff_in_months(date2)\n if date2 > self\n ZDate.diff_in_months(month, year, date2.month, date2.year)\n else\n ZDate.diff_in_months(date2.month, date2.year, month, year) * -1\n end\n end",
"def spent_hours_for_user_this_month\n return @spent_hours_for_user_this_month if defined?(@spent_hours_for_user_this_month)\n\n @spent_hours_for_user_this_month = nil\n\n return @spent_hours_for_user_this_month if user_id.blank?\n\n date_filter = Date.today\n\n @spent_hours_for_user_this_month = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def new_user?\n self.created_at > 1.month.ago\n end",
"def recent_login(users)\n\tputs 'starting recent_login, length is ' + users.length.to_s\n\tres = Array.new\n\tlast_month_unform = (Time.current - 30.days).to_s.split(\" \")\n\ttoday_unform = Time.current.to_s.split(\" \")\n\tlast_month = last_month_unform[0] + 'T' + last_month_unform[1]\n\ttoday = today_unform[0] + 'T' + today_unform[1]\n\tusers.each do |person|\n\t\ttmp = person['id'].to_s\n\t\tresponse = TOKEN.get(\"/v2/users/\" + tmp + \"/locations?range[begin_at]=#{last_month},#{today}\").parsed\n\t\tif response.length > 0\n\t\t\tres.push(person)\n\t\tend\n\tend\n\treturn res\nend",
"def username_changed_more_than_one_month_ago\n errors.add(:username, \"^You cannot change your username more than once a month\") if self.username_changed? && self.username_changed_at > 1.month.ago\n end",
"def last_month_dates\n {\n init_date: Date.today.ago(1.month).beginning_of_month&.to_s,\n end_date: Date.today.ago(1.month).end_of_month&.to_s\n }\n end",
"def days_in_month\n Time.send(\"month_days\", self.year, self.month)\n end",
"def get_earning_months\n orders = self.orders.find(:all, :select => ['created_on'])\n return orders.collect{|o| o.created_on.to_date.beginning_of_month }.uniq\n end",
"def users_retention\n month_users = {}\n\t\n uret = {}\n\t\n @visits.each do |v| # all in right order\n time = Time.at(v.time_in)\n next if time < @from_day\n if time > @to_day then break end\n month = time.strftime \"%Y-%m\"\n if month_users[month].nil? then month_users[month] = {:uids => {}, :month => month} end\n if month_users[month][:uids][v.user_id].nil? then month_users[month][:uids][v.user_id] = 0 end\n month_users[month][:uids][v.user_id] += 1\n end\n \n month_users_ar = month_users.values.sort {|x,y| x[:month] <=> y[:month]} # sort by month\n\n for index in 1 ... month_users_ar.size # skip first month\n info = month_users_ar[index]\n month = info[:month]\n # how much (in %) from last month users came again in this month\n last_month_users = month_users_ar[index-1]\n uret[month] = {:count => 0, :total => last_month_users[:uids].count }\n last_month_users[:uids].each do |uid, count|\n if !(info[:uids][uid].nil?) then uret[month][:count] += 1 end\n end\n end\n \n render json: uret\n end",
"def get_last_login(user)\n userExists = User.find_by_id(user.id)\n if userExists\n return userExists['last_login']\n end\n end",
"def timeframe_months\n if self.end_date.present?\n number = (self.end_date.year * 12 + self.end_date.month) - (Date.today.year * 12 + Date.today.month)\n else\n number = 0\n end\n \"#{number} #{'month'.pluralize(number).capitalize}\"\n end",
"def billable_hours_for_user_this_month\n return @billable_hours_for_user_this_month if defined?(@billable_hours_for_user_this_month)\n\n @billable_hours_for_user_this_month = nil\n\n return @billable_hours_for_user_this_month if user_id.blank?\n\n date_filter = Date.today\n\n scope_for_time_entries = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.billable_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @billable_hours_for_user_this_month = cf.format.cast_total_value(cf, total)\n end",
"def check_month(db, user_name)\r\n\tstored_month = '\r\n\r\n\tSELECT month FROM users\r\n\r\n\tWHERE name = ?'\r\n\tmonth = db.execute(stored_month, [user_name])[0][0]\r\nend",
"def month\n created.strftime '%m'\n end",
"def index\n @user = User.find(params[:user_id])\n @works = @user.works.order(start: :desc).paginate(:per_page => 5, :page => params[:page])\n @works_month = @user.works.group_by { |t| t.start.beginning_of_month }\n end",
"def month; end",
"def month; end",
"def deviation_hours_for_user_previous_month\n return @deviation_hours_for_user_previous_month if defined?(@deviation_hours_for_user_previous_month)\n\n @deviation_hours_for_user_previous_month = nil\n\n return @deviation_hours_for_user_previous_month if user_id.blank?\n\n date_filter = Date.today.prev_month\n\n scope_for_time_entries = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.deviation_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @deviation_hours_for_user_previous_month = cf.format.cast_total_value(cf, total)\n end",
"def get_months\n \n @months = RiverEvents::Month.all\n end",
"def month\n @month || self.starts_at.month\n end",
"def months_ago(months)\n advance(months: -months)\n end",
"def month\n @date_time_value.month\n end",
"def month\n @date_time_value.month\n end",
"def month\n self.range('month')\n end",
"def monthsDifference\n dates = formatDates\n ((dates[:start_date] - dates[:end_date]).to_i / 30).to_i\n end",
"def get_months(years, months)\n if years > 0\n (years * 12) + months\n elsif years > 0 && months == 0\n years * 12\n else\n months\n end\nend",
"def months_list\n\t (Date.today-1.year..Date.today).map{|d| [d.strftime(\"%b-%Y\"), d.strftime(\"%m-%Y\")]}.uniq.reverse\n\tend",
"def monthly\n end",
"def month\n @month ||= date_calc.merch_to_julian(merch_month)\n end",
"def create_monthly_session(user)\n today = DateTime.now\n year = today.year\n month = today.month\n current_monthly_session = MonthlySession.new(:month => month, :year => year)\n current_monthly_session.user = user\n current_monthly_session.available_sessions = ENV['COMMUNITY_MONTHLY_SESSION_LIMIT']\n current_monthly_session.save!\n return current_monthly_session\n end",
"def account_age\n # gives the date account was created\n # created = @user.created_at.strftime(\"%m/%d/%y\").split(\"/\").map(&:to_i)\n # today = Date.today.strftime(\"%m/%d/%y\").split(\"/\").map(&:to_i)\n # created_array= []\n # month = today[0] - created[0]\n # day = today[1] - created[1]\n # year = today[2] - created[2]\n days = DateTime.now.mjd - created_at.to_date.mjd \n year = days/365\n remaining_days = days%365\n \"This account is #{year} years and #{remaining_days} days old.\"\n end",
"def index\n @user_plan_months = UserPlanMonth.all\n end",
"def login_time_last_30_days\n login_time_since(30.days.ago)\n end",
"def remember_me_for\n 10.years\n end",
"def deviation_hours_for_user_this_month\n return @deviation_hours_for_user_this_month if defined?(@deviation_hours_for_user_this_month)\n\n @deviation_hours_for_user_this_month = nil\n\n return @deviation_hours_for_user_this_month if user_id.blank?\n\n date_filter = Date.today\n\n scope_for_time_entries = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.deviation_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @deviation_hours_for_user_this_month = cf.format.cast_total_value(cf, total)\n end",
"def month\n end",
"def remember_me\n remember_me_for 1.year\n end",
"def month\n set_function_and_argument(:month, nil)\n end",
"def months_list\n unless @months_list\n months = []\n date = start_date\n while date <= end_date\n months << date\n date += 1.month\n end\n @month_list = months\n end\n\n @month_list\n end",
"def how_many_months(date1, date2)\n (date2.year - date1.year) * 12 + date2.month - date1.month - (date2.day >= date1.day ? 0 : 1)\n end",
"def index\n if @current_user.birth_date\n #setup values for month picker\n @available_months = @current_member.progresses.kept\n .pluck(:start)\n .map{ |d| d.beginning_of_month }\n .uniq\n else\n flash[:error] = \"Add your birth date first.\"\n redirect_to edit_user_path(@current_user)\n end\n end",
"def days_in_current_month\n\t\t\tcurrent_month = Time.now.month\n\t\t\tcurrent_year = Time.now.year\n\n\t\t\treturn Time.days_in_month(current_month, current_year)\n\t\tend",
"def month_number\n date.month\n end",
"def new_requests_since_last_login(user)\n now = Time.now\n\n if !user.last_sign_in_at.blank?\n user_last_login = user.last_sign_in_at.to_datetime\n else\n user_last_login = Time.now.to_datetime\n end\n\n Request.pending.where(updated_at: (user_last_login)..now).count\n end",
"def get_number_of_month\n (1..is_leap?[adjust_set_month]).to_a\n end",
"def index\n UserDate.generate_token_for_user current_user\n @user_dates = current_user.dates.sort_by(&:date)\n end",
"def month\r\n return @hm\r\n end",
"def remember_me\r\n remember_me_for 2.weeks\r\n end",
"def years_to_months(years)\n #some code here\nend",
"def index\n @entries = current_user.entries.for_month(@date)\n @budgets = current_user.budgets\n end",
"def last_login_date\n logins.last.created_at rescue logins.latest.created_at rescue Time.now\n end",
"def index\n @registeredUsers = Admin.getRegisteredUsers\n @loggedInLastWeek = Admin.getLoginActivity 1.week.ago\n @loggedInLastMonth = Admin.getLoginActivity 1.month.ago\n @recentlyRegistered = Admin.getRecentlyRegistered\n end",
"def all_month\n beginning_of_month..end_of_month\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def remember_me\n remember_me_for 2.weeks\n end",
"def period\n case self.recurring_month\n when 12\n 1.year # 1.year != 12.months\n else\n self.recurring_month.months\n end\n end",
"def age\n day = 60 * 60 * 24\n month = 30 * day\n @age ||= (Time.now.to_i - self.timestamp.to_i) / ( 1 * month)\n end",
"def calculate_dates\n self.inactive_date = Time.now + 2.months\n self.delete_date = Time.now + 4.months\n end",
"def month\n self.class.get_month(@bits)\n end",
"def monthly_print_usage_by_user=(value)\n @monthly_print_usage_by_user = value\n end"
] |
[
"0.652",
"0.652",
"0.64711374",
"0.64426523",
"0.63297087",
"0.62746316",
"0.61150825",
"0.6061112",
"0.60335386",
"0.6023007",
"0.59973747",
"0.5994615",
"0.5968101",
"0.59560156",
"0.59429145",
"0.590177",
"0.5901532",
"0.5900217",
"0.5882207",
"0.5841226",
"0.5822846",
"0.58091724",
"0.58045745",
"0.5738699",
"0.56978816",
"0.5679931",
"0.56745374",
"0.56714606",
"0.56681824",
"0.5650967",
"0.5648845",
"0.56359667",
"0.56330746",
"0.56189346",
"0.5608336",
"0.55976915",
"0.55870014",
"0.5583247",
"0.5560647",
"0.5559344",
"0.55418724",
"0.5537434",
"0.5531291",
"0.5511954",
"0.5477975",
"0.5475028",
"0.5458159",
"0.5453104",
"0.54390645",
"0.54237616",
"0.5422646",
"0.5421631",
"0.54161155",
"0.5409955",
"0.5402593",
"0.53947765",
"0.53947765",
"0.5378681",
"0.5374675",
"0.53679436",
"0.53679174",
"0.5333785",
"0.5333785",
"0.53279734",
"0.5299812",
"0.5293029",
"0.5292182",
"0.5290717",
"0.529033",
"0.5284575",
"0.528216",
"0.52629876",
"0.5260846",
"0.52548677",
"0.5254635",
"0.52533734",
"0.5238584",
"0.52373195",
"0.5226971",
"0.5226306",
"0.5225097",
"0.5221431",
"0.5216862",
"0.5215981",
"0.52057874",
"0.51989",
"0.5180432",
"0.517813",
"0.51670516",
"0.5160502",
"0.5158147",
"0.5152904",
"0.51527023",
"0.5147727",
"0.5147727",
"0.51340866",
"0.5131093",
"0.5123377",
"0.5113765",
"0.5108928"
] |
0.5980503
|
12
|
to prevent undefined method when forms are involved
|
def protect_against_forgery?
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def form; end",
"def forms; end",
"def form_data?; end",
"def injection_form\n # Nothing to do here\n end",
"def form\n end",
"def ing_form; end",
"def spoofForm(val)\n @deltaflag = false\n @form = val\n end",
"def form_view\n end",
"def patient_forms\n # blank\n end",
"def form_setup\n\tend",
"def onSubmit(request, response, form, errors)\r\n\treturn form\r\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def default_form_builder; end",
"def onSubmit(request, response, form, errors)\r\n return form\r\n end",
"def onSubmit(request, response, form, errors)\r\n return form\r\n end",
"def search_form\n #this is finsihed!!\n end",
"def set_form(easy)\n end",
"def fbo_updated_form\n end",
"def onSubmit(request, response, form, errors) \n return form\n end",
"def change_form_content \n\tend",
"def complete_login_form\n raise \"UnimplementedFunctionality\"\n end",
"def on_submit\n controller.send(@form_name+'_submit', @model) unless controller.nil?\n clear\n end",
"def form?\n self.type == :form\n end",
"def form_type\n ''\n end",
"def new_job \n form{|f| f.action == 'job'}\nend",
"def form_submit\r\n form.submit\r\n @form = nil\r\nend",
"def relation_condition_option_form\n # Nothing to do here\n end",
"def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end",
"def set_form\n #@form = Form.find(params[:id])\n end",
"def new\n # refs #373 - rails 3 - having this blank method fixes the problem\n end",
"def setForm(value)\r\n oldForm = @form\r\n @form = value\r\n @ability = nil\r\n yield if block_given?\r\n MultipleForms.call(\"onSetForm\", self, value, oldForm)\r\n calc_stats\r\n $Trainer.pokedex.register(self)\r\n end",
"def form_start\n ''\n end",
"def auto_submit?\n false\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def replace_form_frame\n end",
"def no_forms?\n !AppConfig['enable_forms']\n end",
"def from_form\n @from_form ||= fields.map { |field| form.__send__(field) }\n end",
"def confirmation_form\n end",
"def root_form?\n logger.warn \"##{__method__} is deprecated\"\n !nested_form?\n end",
"def nested_forms\n []\n end",
"def form_for(bar)\n bar.to_s\nend",
"def form_node; end",
"def _safe_active_admin_form_for\n @active_admin_form_for\n end",
"def permitted?; end",
"def ask_form\n AskForm.new(view_context)\n end",
"def text_field; end",
"def load_attributes_form\n @symbole = Symbole.new if @symbole.nil?\n if params[:form_name].present?\n respond_to do |format|\n format.js { render \"ajax_form_\"+params[:form_name] }\n end\n end\n end",
"def load_form\n @symbole = Symbole.new if @symbole.nil?\n if params[:form_name].present?\n respond_to do |format|\n format.js { render \"ajax_form_\"+params[:form_name] }\n end\n end\n end",
"def has_valid_form\n is_predefined_by_ak || has_valid_prefix\n end",
"def emailform\n end",
"def emailform\n end",
"def method_missing(method_name, *args, &block)\n name = method_name.to_s\n \n if field_keys.include? name.gsub(/=/, '')\n return name.include?(\"=\") ? self.data[name.gsub(/=/, '').to_sym] = args.first : self.data[method_name]\n else\n logger.debug(\"Form is #{form} and the fields are #{self.form.form_fields if self.form}\")\n super\n end\n end",
"def no_submit!\n @no_submit = true\n end",
"def form_end\n ''\n end",
"def override_input(form_ui)\n method = \"active_scaffold_input_#{form_ui}\"\n method if respond_to? method\n end",
"def submit; end",
"def method_missing(method_name, *args)\n field = args.first\n \n define_method(\"#{field}_form_field\") do |form, object|\n if form.respond_to? method_name\n form.send(method_name, *args)\n else\n raise NoMethodError, \"this form builder doesn't respond to #{method_name}\" \n end \n end\n end",
"def empty?\n\t\treturn @form.empty?\n\tend",
"def index\n @show_form = false\n\n end",
"def setup_form\n build_form\n super\n end",
"def being_submitted?(item = nil)\n # noinspection RubyMismatchedArgumentType\n super(item || self)\n end",
"def form_arguments_check(form, field_name)\n raise ArgumentError, 'Form is required.' if form.blank?\n raise ArgumentError, 'Field name is required.' if field_name.blank?\n raise ArgumentError, 'Object is not decorated.' \\\n unless form.object.is_a? ResourceDecorator\n end",
"def require_extraction_form_ownership\n \t\textraction_form_id = params[:extraction_form_id]\n \t\textraction_form = ExtractionForm.find(extraction_form_id, :select=>[\"creator_id\"])\n \t\tunless extraction_form.creator_id == current_user.id\n \t\t\tflash[:notice] = \"You do not have ownership of the extraction form, and therefore cannot make edits.\"\n \t\t\tredirect_to \"/extraction_forms/#{extraction_form_id.to_s}\"\n \t\t\treturn false\n \t\tend\n \tend",
"def set_form\n @form = Form.find_by(id: params[:id])\n redirect_to '/404.html' and return if @form.nil?\n end",
"def anonymous_form\n view_context.render \"users/anonymous_form\"\n end",
"def display(form)\n Right(form.model)\n end",
"def new\n \n @form =Forms.new \n end",
"def form_data=(data)\n @form_data = data if data\n end",
"def form_to_be_sent(path, form)\n end",
"def assign_form\n @response.form = Form.find(params[:form_id])\n check_form_exists_in_mission\n rescue ActiveRecord::RecordNotFound\n redirect_to(index_url_with_context)\n end",
"def form loc = nil \n if loc\n form_translations[loc]\n else\n self[:form] || form_translations.detect(->{[]}) {|k, v| v.present? }[1]\n end\n end",
"def _form\n @comment = Comment.new\n end",
"def click_submit\n end",
"def originalsourceform; end",
"def execute_this(meth, *args)\n alert \" #{meth} not found ! \"\n $log.debug \"app email got #{meth} \" if $log.debug?\n cc = @form.get_current_field\n [cc].each do |c|\n if c.respond_to?(meth, true)\n c.send(meth, *args)\n return true\n end\n end\n false\nend",
"def submit!\n\tend",
"def cancel_form handle_form_text \n click_to_handle_form handle_form_text\n cancel_form_alert_ok \n end",
"def form_mode\n {:new => :new, :create => :new, :edit => :edit, :update => :edit, :show => :show}[controller.action_name.to_sym]\n end",
"def form\n find_parent_by_tag_name('FORM')\n end",
"def form\n find_parent_by_tag_name('FORM')\n end",
"def hidden_field?(field_name); end",
"def set_form\n form = params[:form_txt] + \"_form\"\n @tab = params[:tab_id]\n form_hash_for_loan_details if !@loan_hash\n update_respond_to_parent(form,@tab,FLASH_MESSAGES['properties']['406'],nil)\n end",
"def before(controller)\n @old_proc = ActionView::Base.field_error_proc\n ActionView::Base.field_error_proc = @new_proc\n true\n end",
"def element_form(context={}, aspect_model)\n \n app = context[:app]\n\n if resource.can_write?(app.user) and (not app.user.belongs_to?(Users::Group.get('anonymous')))\n renderer = ::UI::FieldSetRender.new('resourceaccesscontrol', app) \n renderer.render('form', 'em') \n else \n ''\n end\n\n end",
"def validate_form(_formdata: {})\n true # Futureuse\nend",
"def new\n # give form access to model methods\n @user = User.new\n end",
"def formation; end",
"def form_submit_button; @form_submit_button ||= 'Soumettre le quiz' end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def validation; end",
"def validation; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end"
] |
[
"0.7534891",
"0.7295134",
"0.7042261",
"0.69481647",
"0.6913049",
"0.67655593",
"0.663577",
"0.6473257",
"0.63841915",
"0.6318648",
"0.62957895",
"0.6165333",
"0.6165333",
"0.6165333",
"0.6165333",
"0.6152266",
"0.61469185",
"0.61469185",
"0.61275476",
"0.60492545",
"0.6022578",
"0.59834886",
"0.5932494",
"0.58747405",
"0.58681697",
"0.5863702",
"0.5860009",
"0.58563995",
"0.58404535",
"0.58174735",
"0.58087987",
"0.5802365",
"0.5782885",
"0.5768444",
"0.5758176",
"0.5755981",
"0.57423407",
"0.5723538",
"0.5712974",
"0.5710757",
"0.5697516",
"0.56935084",
"0.5678012",
"0.56385213",
"0.5623831",
"0.5610043",
"0.55916005",
"0.5573129",
"0.5561059",
"0.554123",
"0.55270755",
"0.5522855",
"0.5519938",
"0.5519938",
"0.5519339",
"0.5509228",
"0.5486775",
"0.54865175",
"0.548446",
"0.54802465",
"0.5465256",
"0.5461363",
"0.5458834",
"0.5458251",
"0.54550207",
"0.54437876",
"0.5436672",
"0.54350895",
"0.54335386",
"0.54251033",
"0.540673",
"0.54058266",
"0.5394231",
"0.53806317",
"0.5376254",
"0.5373671",
"0.53685755",
"0.5363942",
"0.535971",
"0.53558195",
"0.535503",
"0.5347075",
"0.5347075",
"0.5346977",
"0.53415966",
"0.5336207",
"0.5317786",
"0.5317624",
"0.5316914",
"0.53111327",
"0.53059375",
"0.5298229",
"0.5298229",
"0.5298229",
"0.5298229",
"0.5296135",
"0.5296135",
"0.5295268",
"0.5295268",
"0.5295268",
"0.5295268"
] |
0.0
|
-1
|
adds the necessary javascript include tags, stylesheet tags, and load event with necessary javascript to activate wym editor(s)
|
def wym_editor_initialize(*dom_ids)
editor_ids = (@wym_editor_ids || []) + wym_extract_dom_ids(*dom_ids)
output = []
output << stylesheet_link_tag('/wymeditor/wymeditor/skins/default/screen')
output << javascript_include_tag('/wymeditor/jquery/jquery')
output << javascript_include_tag('/wymeditor/wymeditor/lang/en.js')
output << javascript_include_tag('/wymeditor/wymeditor/jquery.wymeditor.js')
output << javascript_include_tag('/wymeditor/wymeditor/jquery.wymeditor.explorer.js')
output << javascript_include_tag('/wymeditor/wymeditor/jquery.wymeditor.mozilla.js')
output << javascript_include_tag('/wymeditor/wymeditor/jquery.wymeditor.opera.js')
output << javascript_include_tag('/wymeditor/wymeditor/jquery.wymeditor.safari.js')
output << javascript_include_tag('/javascripts/boot_wym.js')
output.join("\n")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_js\n AssetManager.include_contrib_library [:core_ui, :jquery_tab]\n AssetManager.include_local_library [ 'ckeditor/init']\n\n AssetManager.include_css [:blog_global]\n end",
"def page_script(context={})\n \n [\"/htmleditor/js/jquery.wysiwyg.js\",\n \"/htmleditor/js/ysd.editor.js\",\n \"/htmleditor/js/controls/wysiwyg.colorpicker.js\",\n \"/htmleditor/js/controls/wysiwyg.cssWrap.js\",\n \"/htmleditor/js/controls/wysiwyg.image.js\",\n \"/htmleditor/js/controls/wysiwyg.link.js\",\n \"/htmleditor/js/controls/wysiwyg.table.js\",\n ] \n \n end",
"def inject_js; end",
"def js_includes\n end",
"def load_assets\n\n # class method call to include js files\n Asset.include_local_library [:application, :pageFormAdmin, \"ckeditor/init\"]\n\n # class method call to include css files\n Asset.include_css [\"mcms_pages/pages\", \"mcms_pages/page_form\", \"mcms_pages/tabs\"]\n\n end",
"def tinymce_assets\n javascript_include_tag \"tinymce\", \"data-turbolinks-track\" => \"reload\"\n end",
"def render_inline_on_load_javascripts\n return '' if @content_for_jquery_onload.blank? && @content_for_javascript_files_onload.blank?\n js_code = \"\\n<!-- DEFFERRED On page load Javascripts -->\\n\"\n on_load_scripts = [ ]\n #write the onload inline javascripts\n on_load_scripts << @content_for_jquery_onload if @content_for_jquery_onload\n #write the javascript files which are jammed into the document head\n on_load_scripts << @content_for_javascript_files_onload if @content_for_javascript_files_onload\n js_code << javascript_tag(j_query_on_load_tag(on_load_scripts)) unless on_load_scripts.blank?\n js_code\n end",
"def set_assets\n\n @custom_csses = []\n @custom_javascripts = []\n\n\n action_hash = {\"create\" => \"new\", \"update\" => \"edit\"}\n file_name = action_hash[action_name] ? action_hash[action_name] : action_name\n root = Rails.root.to_s\n\n @custom_csses << \"compiled/application.css\" # always include the layout css\n @custom_csses << \"compiled/#{controller_name}/#{file_name}.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/#{file_name}.css\")\n @custom_csses << \"compiled/#{controller_name}/all.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/all.css\")\n\n\n @custom_javascripts << \"#{controller_name}/#{file_name}.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/#{file_name}.js\") # && !(\"#{file_name}.js\" == \"consumer_index.js\")\n @custom_javascripts << \"#{controller_name}/all.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/all.js\")\n\n # a trick to include facebox in the (devise-owned) registrations controller\n include_facebox if controller_name == 'registrations' && action_name == 'edit'\n\n end",
"def tinymce_assets\n javascript_include_tag \"tinymce\"\n end",
"def use_tinymce\n @content_for_tinymce = \"\" \n content_for :tinymce do\n javascript_include_tag \"tiny_mce/tiny_mce\"\n end\n @content_for_tinymce_init = \"\" \n content_for :tinymce_init do\n javascript_include_tag \"mce_editor\"\n end\n end",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_PLANS, JS_DATEPICKER, JS_JSON]\r\n end",
"def use_tinymce\n @content_for_tinymce = \"\" \n content_for :tinymce do\n javascript_include_tag \"tiny_mce/tiny_mce\"\n end\n @content_for_tinymce_init = \"\" \n content_for :tinymce_init do\n javascript_include_tag \"mce_editor\"\n end\n end",
"def use_tinymce\n @content_for_tinymce = \"\" \n content_for :tinymce do\n javascript_include_tag \"tiny_mce/tiny_mce\"\n end\n @content_for_tinymce_init = \"\" \n content_for :tinymce_init do\n javascript_include_tag \"mce_editor\"\n end\n end",
"def init_autocrud\n javascript_include_tag('../autocrud/javascripts/autocrud.js', :cache => '../autocrud/javascripts/all_cached')\n end",
"def load_javascript(*files)\n content_for(:head) { javascript_include_tag(*files) }\n end",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_COMMENTS]\r\n end",
"def edit\n @javascripts = %w(wedding-form.js)\n end",
"def javascript_include_tag_with_engine_additions(*sources)\r\n javascript_include_tag_without_engine_additions(*Engines::RailsExtensions::AssetHelpers.pluginify_sources(\"javascripts\", *sources))\r\n end",
"def install_javascript_dependencies\n inject_into_file 'app/assets/javascripts/application.js', after: '//= require blacklight/blacklight' do\n \"\\n// Required by Arclight\" \\\n \"\\n//= require arclight/arclight\"\n end\n end",
"def scripts\n script_tag(fancyviews.included_scripts.map do |name, js|\n \"\\n/* -- #{name} -- */\\n\" + js\n end.join)\n end",
"def appoxy_javascripts\n '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi?key=ABQIAAAAhes0f80sBcwL-h5xCNkkgxQBmiBpQeSpIciQPfZ5Ss-a60KXIRQOVvqzsNpqzhmG9tjky_5rOuaeow\"></script>\n <script type=\"text/javascript\">\n google.load(\"jquery\", \"1\");\n google.load(\"jqueryui\", \"1\");\n </script>\n '.html_safe\n end",
"def ubiquo_javascript_include_tags(files=['ubiquo', 'lightwindow'])\n files.delete 'lightwindow' unless File.exists?(Rails.root.join('public', 'javascripts', 'ubiquo', 'lightwindow.js'))\n files.collect do |js|\n javascript_include_tag \"ubiquo/#{js}\"\n end.join \"\\n\"\n end",
"def render_deferred_javascript_tags\n # First write the onload inline javascripts\n js_code = ''\n js_code << render_deferred_javascript_files\n js_code << render_inline_javascripts\n js_code << render_inline_on_load_javascripts\n js_code\n end",
"def add_js_and_css_to_form\n unless @check_migration\n page_options = open(\"app/views/admin/#{@plural_name}/_form.html.erb\").grep(/content_for :javascripts/)\n \n if page_options.empty?\n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :before => \"<%= form_for\" do\n \"<% content_for :javascripts do %>\" +\n \"\\n\\t<script>\" +\n \"\\n\\t\\t$(document).ready(function(){\" +\n \"\\n\\t\\t\\tpage_options.init(false, '', '');\" +\n \"\\n\\t\\t});\" +\n \"\\n\\t</script>\"+\n \"\\n\\t<%= javascript_include_tag 'gallery' %>\" +\n \"\\n<% end %>\" +\n \n \"\\n\\n<% content_for :stylesheets do %>\" +\n \"\\n\\t<%= stylesheet_link_tag 'gallery' %>\" +\n \"\\n<% end %>\\n\\n\"\n end\n else\n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :after => \"<% content_for :javascripts do %>\" do\n \"\\n\\t<%= javascript_include_tag 'gallery' %>\"\n end\n \n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :before => \"<% content_for :javascripts do %>\" do\n \"\\n<% content_for :stylesheets do %>\" +\n \"\\n\\t<%= stylesheet_link_tag 'gallery' %>\" +\n \"\\n<% end %>\\n\"\n end\n end\n end\n end",
"def use_jquerytools\n #use_jquery # required for ie bug?\n javascript_place :js_libs, 'jQuery/jquerytools-1.1.2.min', 'application_jquery'\n #@@jquery_loaded = true\n end",
"def active_scaffold_includes\r\n js = ActiveScaffold::Config::Core.javascripts.collect do |name|\r\n javascript_include_tag(ActiveScaffold::Config::Core.asset_path(:javascript, name))\r\n end.join('')\r\n\r\n css = stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path(:stylesheet, \"stylesheet.css\"))\r\n ie_css = stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path(:stylesheet, \"stylesheet-ie.css\"))\r\n\r\n js + \"\\n\" + css + \"\\n<!--[if IE]>\" + ie_css + \"<![endif]-->\\n\"\r\n end",
"def load_assets\n AssetManager.include_local_library [:application, :admin_layout_data_table]\n AssetManager.include_css [:application, :admin_layout, :colorbox]\n AssetManager.include_contrib_library [:colorbox]\n end",
"def add_javascripts\n insert_into_file \"app/assets/javascripts/application.js\", :after => \"//= require jquery_ujs\\n\" do\n \"//= require dataTables/jquery.dataTables\\n\"\n end\n end",
"def javascripts\n super + %w(js/custom.js)\nend",
"def view_layouts_base_html_head(context)\n stylesheet_link_tag(\"drafts\", :plugin => \"redmine_drafts\") +\n javascript_include_tag('jquery.observe-form.js', :plugin => 'redmine_drafts')\n end",
"def javascript(*files)\n add_files(*files)\n end",
"def g_javascript_include_tag( *sources )\n g = Guilded::Guilder.instance\n defaults = nil\n if sources.include?( :defaults )\n defaults = ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES\n sources.delete( :defaults )\n end\n if sources.include?( :jquery )\n sources.insert( 0, g.jquery_js ) unless sources.include?( g.jquery_js )\n sources.delete( :jquery )\n end\n if sources.include?( :mootools )\n unless sources.include?( g.mootools_js )\n insert_at = 0\n insert_at = 1 if( sources.include?( g.jquery_js ) )\n sources.insert( insert_at, g.mootools_js )\n end\n sources.delete( :mootools )\n end\n if defaults\n g.add_js_sources( *(sources << defaults) )\n else\n g.add_js_sources( *sources )\n end\n ''\n end",
"def javascript_include_tag(*sources); end",
"def javascript_include_tag(*sources); end",
"def javascript_include_tag(*sources); end",
"def scripts\n #Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline\n script(:src => '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')\n script do\n rawtext(%{window.jQuery || document.write('<script src=\"#{js_urls(:lib).first}\"><\\\\/script>')})\n end\n #TODO should just be \"defer\" without attribute, but erector doesn't really do that\n js_urls(:app).each do |url|\n script(:defer => 'defer', :src => url) \n end\n \n #removed google analytics tag\n \n #Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. \n # chromium.org/developers/how-tos/chrome-frame-getting-started\n comment('[if IE 7 ]') do\n script(:src => '//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js')\n script do\n rawtext(%{window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})})\n end\n end\n \n yield if block_given?\n end",
"def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end",
"def tinymce_javascript(config=:default, options={})\n <<-JAVASCRIPT.strip_heredoc.html_safe\n (function() {\n if (typeof tinyMCE != 'undefined') {\n tinyMCE.init(#{tinymce_configuration(config, options).to_javascript.gsub(/^/, ' ' * 10).sub(/\\A\\s+/, \"\")});\n } else {\n setTimeout(arguments.callee, 50);\n }\n })();\n JAVASCRIPT\n end",
"def javascript (*files)\n content_for(:head) { javascript_include_tag(*files) }\n end",
"def javascript_include_auto_complete\n if can_do_ajax?\n javascript_include 'prototype'\n javascript_include 'effects'\n javascript_include 'controls'\n javascript_include 'cached_auto_complete'\n end\n end",
"def onLoad\n end",
"def google_ajax_api_scripts\n return '' if defined?(@google_ajax_api_scripts_included)\n script = '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi'\n script << \"?key=#{Overlord.configuration.google_ajax_api_key}\" if Overlord.configuration.google_ajax_api_key\n script << '\"></script>'\n @google_ajax_api_scripts_included = true\n script.html_safe\n end",
"def include_default_scripts\n includes = []\n\n includes << javascript_include_tag(:application) if assets_exists? \"application.js\"\n\n default_asset_paths.each do |path|\n if assets_exists? \"#{path}.js\"\n includes << javascript_include_tag(path)\n end\n end\n \n includes << content_for(:scripts)\n includes.join(\"\\n\").html_safe\n end",
"def smart_edit(content_type=0,save_url)\n if content_type == 1\n render \"shared/wysihtml5_js\", {url: save_url}\n else\n render \"shared/autosave_js\", {url: save_url}\n end\n end",
"def unobtrusive_datepicker_includes\n #javascript 'datepicker'\n #stylesheet 'datepicker'\n end",
"def google_ajax_slideshow_scripts\n return '' if defined?(@google_ajax_slideshow_scripts_included)\n @google_ajax_slideshow_scripts_included = true\n '<script src=\"http://www.google.com/uds/solutions/slideshow/gfslideshow.js\" type=\"text/javascript\"></script>'.html_safe\n end",
"def actual_injection\n files_to_page\n set_vars(@default_vars + @custom_vars)\n all_scripts(@default_scripts + @custom_scripts)\n end",
"def copy_javascripts\n if ::Rails.version[0..2].to_f >= 3.1\n #puts \"The javascripts do not need to be installed since Rails 3.1\"\n else\n copy_file \"../../../../../app/assets/javascripts/on_the_spot_code.js\", \"public/javascripts/on_the_spot.js\"\n copy_file \"../../../../../app/assets/javascripts/jquery.jeditable.js\", \"public/javascripts/jquery.jeditable.js\"\n copy_file \"../../../../../app/assets/javascripts/jquery.jeditable.checkbox.js\", \"public/javascripts/jquery.jeditable.checkbox.js\"\n copy_file \"../../../../../app/assets/stylesheets/on_the_spot.css\", \"public/stylesheets/on_the_spot.css\"\n end\n end",
"def activate\n tab 'Content' do\n add_item \"Gestion des Slides\", \"/admin/slides\", :after => \"Pages\"\n end\n Page.send :include, HomeSliderTags\n end",
"def run\n super\n\n uri = _get_entity_name\n\n # Get existing software details (in case this is a second run)\n existing_libraries = _get_entity_detail(\"javascript\") || []\n\n session = create_browser_session\n\n # Run the version checking scripts in our session (See lib/helpers/browser)\n new_libraries = gather_javascript_libraries(session, uri)\n\n # set the new details\n _set_entity_detail(\"javascript\", new_libraries)\n\n # cleanup\n destroy_browser_session(session)\n\n end",
"def include_javascript\n @outfile.puts <<'EOF'\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.js\"></script>\n <link rel=\"stylesheet\" href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css\" />\n <script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js\"></script> \nEOF\n Pathname.new(JavascriptDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <script>\"\n @outfile.puts path.read\n @outfile.puts \" </script>\"\n else\n @outfile.puts \"<script src=\\\"lib/javascript/#{path.basename}\\\"></script>\"\n end\n end\n end",
"def javascript(*files)\n content_for(:javascript) { javascript_include_tag(*files) }\n end",
"def build_all_external_scripts\n html = \"\"\n result = Mokio::ExternalScript.all\n unless result.blank?\n result.each do |position|\n html = build_common(position)\n end\n end\n html.html_safe\n end",
"def netzke_init(params = {})\n theme = params[:ext_theme] || :default\n [netzke_css_include(theme), netzke_js_include, netzke_js].join(\"\\n\")\n end",
"def active_scaffold_includes(frontend = :default)\r\n js = javascript_include_tag(*active_scaffold_javascripts(frontend))\r\n\r\n css = stylesheet_link_tag(*active_scaffold_stylesheets(frontend))\r\n ie_css = stylesheet_link_tag(*active_scaffold_ie_stylesheets(frontend))\r\n\r\n js + \"\\n\" + css + \"\\n<!--[if IE]>\" + ie_css + \"<![endif]-->\\n\"\r\n end",
"def install_sample_files\n super\n inject_line_before root.join('apps/web/templates/application.html.erb'), '</head>', <<-HTML\n <%= vite_client %>\n <%= vite_javascript 'application' %>\n HTML\n end",
"def javascript_compile_list\n\t[\t\n\t\t# Wordpress distributed JS (not monitored for changes...)\n\t\t#\"../../../wp-includes/js/jquery/jquery-migrate.min.js\",\n\t\t#\"../../../wp-includes/js/jquery/jquery.masonry.min.js\",\n\n\t\t# Theme JS\n\t\t\"js/jquery-1.11.0.js\",\n\t\t\"js/jquery-ui-1.10.4.datepicker.js\",\n\t\t\"js/jquery.cookie.js\",\n\t\t\"js/functions.js\",\n\t\t\"js/imagelightbox.js\",\n\t\t\"js/lightboxinit.js\",\n\t\t\"js/jflickrfeed.js\",\n\t\t\"js/flickrsetup.js\",\n\t\t\"js/vender.js\", \n\t\t\"js/scrollTo.js\",\n\t\t\"js/placeholder.js\",\n\t\t\"js/default.js\",\n\t\t\"js/campus-libraries.js\",\n\t\t\"js/find-a-library.js\",\n\t\t\"js/datepicker.js\",\n\t\t\"js/library.js\",\n\t\t\"js/directory.js\",\n\t\t\"js/liaison.js\",\n\t\t\"js/locations.js\",\n\t\t\"js/ask.js\",\n\t\t\"js/alerts.js\",\n\t\t\"js/google-support.js\",\n\t\t\"js/locate.js\"\n\t]\nend",
"def <<(javascript)\n self.script << javascript\n \n javascript\n end",
"def load_editor name = {}\n # the editor methods are included the first time\n unless respond_to? :editor\n require 'app/ui/tabs/editor'\n extend HH::Editor\n end\n @action.clear { editor(name) }\n end",
"def prepare_js\n compile_templates\n compile_controllers\n end",
"def javascript!\n @coffeescript = false\n end",
"def inject_js=(_arg0); end",
"def setup!\n editor_execute!\n editor_delete_character!\n editor_delete_line!\n editor_down!\n editor_insert_character!\n editor_insert_line!\n editor_left!\n editor_right!\n editor_up!\n end",
"def controller_javascript_tags\n \n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"js\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << javascript_include_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end",
"def load_scripts!\n scripts_dir = File.expand_path @config['blur']['scripts_dir']\n script_file_paths = Dir.glob File.join scripts_dir, '*.rb'\n\n # Sort the script file paths by file name so they load by alphabetical\n # order.\n #\n # This will make it possible to create a script called '10_database.rb'\n # which will be loaded before '20_settings.rb' and non-numeric prefixes\n # will be loaded after that.\n script_file_paths = script_file_paths.sort do |a, b|\n File.basename(a) <=> File.basename(b)\n end\n\n script_file_paths.each { |script_path| load_script_file script_path }\n\n initialize_superscripts\n\n emit :scripts_loaded\n end",
"def script_load(script); end",
"def render_deferred_javascript_files\n #write any deffered javascript files\n return '' if @content_for_javascript_files.blank?\n js_code = \"\\n<!-- DEFFERRED Javascripts -->\\n#{@content_for_javascript_files}\"\n end",
"def g_apply_includes\n g = Guilded::Guilder.instance\n g.generate_asset_lists\n\n # JavaScript\n if g.production? && g.use_remote_jquery\n js_groups = g.combined_js_srcs.partition { |src| src == g.jquery_js }\n output = javascript_include_tag( g.jquery_remote_url )\n output << javascript_include_tag( js_groups[1], :cache => \"cache/#{g.js_cache_name}\" ) unless js_groups[1].nil?\n else\n output = javascript_include_tag( g.combined_js_srcs, :cache => \"cache/#{g.js_cache_name}\" )\n end\n output\n end",
"def javascript_include_tag(*sources)\n behaviours = ''\n if sources.delete :acts_as_node\n #graph drawing\n root_dir = 'jsviz/0.3.3/'\n sources = sources.concat(\n ['physics/ParticleModel', 'physics/Magnet', 'physics/Spring', 'physics/Particle', 'physics/RungeKuttaIntegrator', 'geometry/SnowflakeGraphModel', 'layout/graph/ForceDirectedLayout', 'layout/graph/SnowflakeLayout', 'layout/view/HTMLGraphView', 'layout/view/SVGGraphView', 'util/Timer', 'util/EventHandler', 'io/DataGraph', 'io/JSVIZHTTP', 'io/XMLTreeLoader']\n ).uniq.map { |js_file| root_dir + js_file }\r\n sources = sources.concat(['tooltip/boxover'])\r\n end\n rails_javascript_include_tag(*sources)\n end",
"def add_support_for_inline_code_editor(content, path)\n content.gsub(/\\(code-editor:([^\\)>]+)\\)/i) do\n jsbin_id = JsBins.jsbin_id_from_path(Regexp.last_match[1])\n if jsbin_id\n \"(code-editor open-jsbin open-jsbin-#{jsbin_id})\"\n else\n puts \"Warning: Code-editor for JSBin '#{Regexp.last_match[1]}' not found, skipping\"\n Regexp.last_match[0]\n end\n end\n end",
"def activate\n Page.send :include, ExtraRadiantTags\n Admin::PagesController.send :include, InterfaceAdditions\n \n # admin.page.edit.add :form, \"/admin/page/hide_page\", :before => \"edit_extended_metadata\"\n # admin.tabs.remove \"Assets\"\n # admin.tabs.add \"Bilder\", \"/admin/assets\", :after => \"Snippets\", :visibility => [:all]\n # admin.tabs.remove \"Pages\"\n # admin.tabs.add \"Seiten\", \"/admin/pages\", :before => \"Snippets\", :visibility => [:all]\n end",
"def javascripts(options={})\n [\n # include the default sources (minus application.js)\n javascript(ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES),\n\n # include the dynamic page javascripts\n page_javascripts(options),\n\n # application.js always needs to be at the end\n javascript(\"application\")\n ].join(\"\\n\")\n end",
"def javascript_include_tag(file_name)\n path_prefix = development? ? '/assets/' : '/js/'\n suffix = development? ? '' : \"-#{Heliom::Labs::VERSION}.min\"\n %(<script src=\"#{path_prefix}#{file_name}#{suffix}.js\"></script>)\nend",
"def find_admin_js\n layout = \"#{TRUSTY_CMS_ROOT}/app/views/layouts/application.html.haml\"\n js_regexp = /javascript_include_tag %w\\((.*)\\), :cache => 'admin\\/all/\n files = File.open(layout) { |f| f.read.match(js_regexp)[1].split }\n files.collect { |f| f.split('/').last + '.js' }\n end",
"def js_code\n '<script type=\"text/javascript\">' <<\n asset('webconsole.js') <<\n '</script>'\n end",
"def control_modal_setup\n js = <<END_OF_STATEMENT\n document.getElementsByClassName('modal').each(function(link){\n new Control.Modal(link, {opacity: 0.8, position: 'relative', offsetTop: 20, hover: true});\n });\nEND_OF_STATEMENT\n javascript_tag(js)\n end",
"def dom_ready\n node = section.container_node\n\n %x{\n var editorDiv = $(node).find('.ace-editor').get(0);\n this.editor = ace.edit(editorDiv);\n //this.editor.setTheme(\"ace/theme/monokai\");\n this.editor.setTheme(\"ace/theme/twilight\");\n }\n\n @value_listener = @value.on('changed') do\n unless @updating\n new_value = @value.cur\n `this.editor.setValue(new_value)`\n end\n end\n\n `var editor = this.editor;`\n `this.editor.getSession().on('change', function(e) {`\n `var new_value = editor.getValue()`\n new_value = \"\" + new_value\n\n @updating = true\n @value.cur = new_value\n @updating = false\n `});`\n puts instance_variables.inspect\n\n if @mode\n @mode_listener = @mode.on('changed') do\n change_mode\n end\n end\n\n change_mode\n end",
"def sync_js\n if self.sync_js_dir(💎.engine.dir('services/web_assets/src/'), \"#{@path_base}src/\")\n self.build_js(true)\n self._sync_js(true)\n end\n\n end",
"def jmaki_setup\n\n # Configure global variables as needed\n # FIXME - next three lines are a real hack\n railsURI = request.request_uri # Usually just /controller/action\n requestURI = request.env['REQUEST_URI'] # Entire absolute URI\n webRoot = requestURI[0, (requestURI.length - railsURI.length)]\n result = \"<script type='text/javascript'>\\n\" +\n \" jmaki.webRoot = '\" + webRoot + \"';\\n\" +\n \" jmaki.resourcesRoot = '/resources';\\n\" +\n \" jmaki.xhp = '\" + webRoot + \"/xhp';\\n\" +\n \"</script>\\n\"\n\n # Load global configuration\n global = jmaki_load_global()\n\n # Render glue includes as necessary\n config = global['config']\n if config\n glue = config['glue']\n if glue\n includes = glue['includes']\n if includes\n for i in 0...includes.length\n include = includes[i]\n if include.instance_of?(String)\n result += jmaki_generate_js(include)\n elsif include.instance_of?(Hash)\n lib = include['lib']\n url = include['url']\n if lib && url && jmaki_match_url(url)\n result += jmaki_generate_js(lib)\n end\n end\n end\n end\n end\n if config['globalTheme']\n @jmakiGlobalTheme = config['globalTheme']\n end \n end\n\n # Return the accumulated result\n result\n\n end",
"def insert_chunk_admin_js\n js_admin_path = \"public/javascripts/refinery/admin.js\"\n unless @check_migration\n insert_into_file \"#{js_admin_path}\",\"\\n, chunk: null\", :after => \", callback: null\"\n insert_into_file \"#{js_admin_path}\", \",chunk\", :after => \", init: function(callback\" \n insert_into_file \"#{js_admin_path}\",\"\\n\\t\\tthis.chunk = chunk;\", :after => \"this.callback = callback;\"\n insert_into_file \"#{js_admin_path}\", \", this.chunk\", :after => \"this.callback(img_selected\"\n end\n end",
"def load_google_api\n content = ''\n content += javascript_include_tag(request.protocol + \"www.google.com/jsapi?key=#{AppConfig.google_api_key}\") unless @@google_api_loaded\n content += yield if block_given?\n @@google_api_loaded = true\n \n content_for(:js_libs) { \n concat content\n }\n end",
"def javascript_include_tag(*sources)\n super *sources_with_path('javascripts', sources)\n end",
"def javascript_include(*args)\n if args.select {|arg| arg.class != String} != []\n raise(ArgumentError, \"javascript_include doesn't take symbols like :default, etc.\")\n end\n @javascripts = [] if !@javascripts\n @javascripts += args\n end",
"def insert_script_tags(fileContent)\n\n @doc = Nokogiri::HTML(fileContent)\n\n hasChanges = false\n\n headScript = @doc.at_css \"head script\"\n #check if head section already contains script\n if headScript == nil\n script = Nokogiri::HTML::DocumentFragment.parse '<script src=\"https://www.powr.io/powr.js\"></script>'\n\n head = @doc.at_css \"head\"\n head << script\n\n hasChanges = true\n end\n\n bodyScript = @doc.at_css \"body script\"\n #check if body section already contains script\n if bodyScript == nil\n script = Nokogiri::HTML::DocumentFragment.parse '<script src=\"https://www.powr.io/powr.js\"></script>'\n\n body = @doc.at_css \"body\"\n body << script\n\n hasChanges = true\n end\n\n return { 'success' => hasChanges, 'content' => @doc.to_html }\n\n end",
"def initial_dynamic_javascript\n res = []\n # res << %(Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection)\n res << %{Ext.ns('Netzke');}\n res << %{Ext.ns('Netzke.core');}\n res << %{Netzke.RelativeUrlRoot = '#{ActionController::Base.config.relative_url_root}';}\n res << %{Netzke.RelativeExtUrl = '#{ActionController::Base.config.relative_url_root}/extjs';}\n\n res << %{Netzke.core.directMaxRetries = '#{Netzke::Core.js_direct_max_retries}';}\n\n res.join(\"\\n\")\n end",
"def run_on_modifications(paths = [])\n hash = {}\n \n # Get all files.\n paths = Dir.glob(\"#{@options[:input]}/**/*\").select do |path|\n not File.directory? path\n end\n \n paths.each do |path|\n file = File.read path\n compiled = ::EJS.compile file\n hash[path] = compiled\n \n UI.info \"[Guard::EJS] Compiled #{path}.\"\n end\n \n # Just overwrite the whole thing for now.\n FileUtils.mkdir_p File.dirname(@options[:output])\n \n File.open(@options[:output], 'w+') do |file|\n file.write \"window.#{@options[:namespace]} = window.#{@options[:namespace]} || {}\\n\"\n file.write \"window.#{@options[:namespace]}.templates = {\"\n \n hash.each do |name, template|\n file.write \"\\\"#{name}\\\": #{template},\"\n end\n \n file.write \"}\"\n end\n end",
"def extra_js(*targets)\n @js_targets ||= []\n\n # Rails.logger.info(\"+ Extra JS: Request to add extra js: #{targets.inspect}\")\n targets.each do |filename|\n if @js_targets.include?(filename)\n # Rails.logger.info(\"- Extra JS: @js_targets already has entry for #{filename}. Skipping\")\n else\n # Rails.logger.info(\"- Extra JS: #{filename} not found in @js_targets\")\n @js_targets.push(filename)\n\n # allow 'http://path' or '//path'\n path = filename.match(/^(http(s)?:\\/)?\\//).present? ? filename : \"/javascripts/#{filename}.js\"\n content_for :extra_js do\n js = \"<script src='#{path}' type='text/javascript'></script>\\n\".html_safe\n # Rails.logger.info(\"- Extra JS: Adding: #{js}\")\n js\n end\n end\n end\n # Rails.logger.info(\"- Extra JS: Current @js_targets: #{@js_targets.inspect}\")\n end",
"def ace(code_string)\n #string = hook_gac()\n string = hook_editor(MODE, THEME)\n string << hook_code(code_string)\n \n # FIX\n # When hook commands, the code do not appears on editor\n # string << hook_ace_commands(RENDER_OPTIONS[:commands])\n string = CoffeeScript.compile(string, :bare => true)\n javascript_tag(string, :id => \"ace-#{Time.now}\")\n end",
"def javascript_file(*files)\n content_for(:javascript) { javascript_include_tag(*files) }\n end",
"def render_inline_javascripts\n #write out any inline javascript\n return '' if @content_for_inline_javascripts.blank?\n js_code = \"\\n<!-- Inline Javascripts -->\\n#{@content_for_inline_javascripts}\"\n end",
"def call_js_init(something_js)\n content_for :javascript do\n \"<script type='text/javascript'>\n $(document).ready(function(){\n #{something_js}\n });\n </script>\".html_safe\n end\n end",
"def add_javascripts(*args, &block)\n add_or_print_scripts(:regulars, *args, &block)\n end",
"def include_calendar_headers_tags\n unless @calendar_headers_tags_included\n @calendar_headers_tags_included = true\n content_for :additional_javascript do\n javascript_include_tag('calendar/calendar') +\n javascript_include_tag(\"calendar/lang/calendar-#{I18n.locale.to_s.downcase}.js\") +\n javascript_include_tag('calendar/calendar-setup') +\n stylesheet_link_tag('calendar')\n end\n end\n end",
"def add_content_script(&block)\n content_script = ContentScript.new\n yield content_script\n @content_scripts << content_script\n end",
"def in_place_editor(field_id, options = {})\n function = \"new Ajax.InPlaceEditor(\"\n function << \"'#{field_id}', \"\n function << \"'#{url_for(options[:url])}'\"\n\n js_options = {}\n js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text]\n js_options['okText'] = %('#{options[:save_text]}') if options[:save_text]\n js_options['cancelControl'] = options[:cancel_control].inspect if options.has_key?(:cancel_control)\n js_options['okControl'] = options[:save_control].inspect if options.has_key?(:save_control)\n js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text]\n js_options['savingText'] = %('#{options[:saving_text]}') if options[:saving_text]\n js_options['rows'] = options[:rows] if options[:rows]\n js_options['cols'] = options[:cols] if options[:cols]\n js_options['size'] = options[:size] if options[:size]\n js_options['externalControl'] = \"'#{options[:external_control]}'\" if options[:external_control]\n js_options['externalControlOnly'] = \"true\" if options[:external_control_only]\n js_options['loadTextURL'] = \"'#{url_for(options[:load_text_url])}'\" if options[:load_text_url] \n js_options['ajaxOptions'] = options[:options] if options[:options]\n js_options['evalScripts'] = options[:script] if options[:script]\n js_options['htmlResponse'] = options[:html_response] if options.key?(:html_response)\n js_options['callback'] = \"function(form) { return #{options[:with]} }\" if options[:with]\n js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text]\n js_options['paramName'] = %('#{options[:param_name]}') if options[:param_name]\n js_options['method'] = %('#{options[:method]}') if options[:method]\n js_options['onEnterHover'] = %('#{options[:on_enter_hover]}') if options[:on_enter_hover]\n js_options['onLeaveHover'] = %('#{options[:on_leave_hover]}') if options[:on_leave_hover]\n js_options['onComplete'] = %('#{options[:on_complete]}') if options[:on_complete]\n js_options['onEnterEditMode'] = options[:on_enter_edit_mode] if options[:on_enter_edit_mode]\n js_options['onLeaveEditMode'] = options[:on_leave_edit_mode] if options[:on_leave_edit_mode]\n function << (', ' + options_for_javascript(js_options)) unless js_options.empty?\n \n function << ')'\n\n javascript_tag(function)\n end",
"def render_js_includes\n return \"\".html_safe unless respond_to?(:javascript_includes) \n \n javascript_includes.uniq.collect do |args|\n javascript_include_tag(*args)\n end.join(\"\\n\").html_safe\n end",
"def initialize_setup\n super\n snippet_content_path = File.expand_path(File.join(static_content_path(__FILE__, 'guard'))) + '/.'\n @flavor.class.do_add_content do\n tocopy << [snippet_content_path]\n end\n end",
"def on_start_document() end",
"def inject_blacklight_browse_nearby_require\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by BlacklightBrowseNearby\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by BlacklightBrowseNearby:\n *= require blacklight_browse_nearby/blacklight_browse_nearby\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by BlacklightBrowseNearby\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by BlacklightBrowseNearby:\n//= require blacklight_browse_nearby/blacklight_browse_nearby\n}\n end\n end\n end",
"def ext(name, config = {}) #:doc:\n comp = Netzke::ExtComponent.new(name, config)\n content_for :netzke_on_ready, raw(\"#{comp.js_component_render}\")\n raw(comp.js_component_html)\n end"
] |
[
"0.7019391",
"0.6608026",
"0.6321885",
"0.6229285",
"0.62082946",
"0.61583054",
"0.6098102",
"0.6011592",
"0.60063833",
"0.5863114",
"0.58468765",
"0.5834803",
"0.5834803",
"0.5790196",
"0.5755622",
"0.5695198",
"0.56814504",
"0.5668234",
"0.5648277",
"0.5646434",
"0.5643013",
"0.5642192",
"0.56249684",
"0.56194025",
"0.5600358",
"0.55961066",
"0.55729693",
"0.5568959",
"0.5568492",
"0.5525743",
"0.55203515",
"0.5519926",
"0.55123395",
"0.55123395",
"0.55123395",
"0.54990286",
"0.54729915",
"0.5445375",
"0.5381501",
"0.5365157",
"0.5361482",
"0.53388363",
"0.5325384",
"0.5298718",
"0.52961427",
"0.52887744",
"0.52832144",
"0.5277393",
"0.527719",
"0.5263458",
"0.5259098",
"0.5252797",
"0.5250671",
"0.5238086",
"0.5236925",
"0.52275884",
"0.5222277",
"0.5213133",
"0.5206672",
"0.520527",
"0.52047074",
"0.5203126",
"0.52013475",
"0.5198661",
"0.5194334",
"0.51865274",
"0.5183583",
"0.51773536",
"0.5171346",
"0.5163876",
"0.51595956",
"0.5142213",
"0.51406074",
"0.51341593",
"0.5134098",
"0.5133206",
"0.51282626",
"0.51266754",
"0.5126114",
"0.51220757",
"0.51094157",
"0.51061565",
"0.51045775",
"0.5098176",
"0.50951624",
"0.50936097",
"0.5083828",
"0.5082189",
"0.50761276",
"0.50674415",
"0.50625783",
"0.5042367",
"0.5039355",
"0.5029296",
"0.50246996",
"0.50225425",
"0.5004163",
"0.50039256",
"0.50036836",
"0.49927527"
] |
0.69603467
|
1
|
cheap way to get module_function s from everything
|
def gentest argv
argv = argv.dup
@both = false
process_opts(argv) if /^-/ =~ argv.first
@service_controller = deduce_services_controller
@ui = Hipe::IndentingStream.new($stdout,'')
file = argv.shift
mod = deduce_module_from_file file
mod.spec.invocation_name = File.basename(file)
get_actuals mod, argv
@ui.indent!.indent!
go_app(mod, file)
go_desc(mod, file) do
go_exp
go_act(mod, argv)
end
exit(0) # rake is annoying
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def module_function(sym, *rest) end",
"def call\n moduleFunction\n end",
"def register_module_function(object); end",
"def modules_for_helpers(modules_or_helper_prefixes); end",
"def modules_for_helpers(args); end",
"def method_module\n home.method_module\n end",
"def modules; end",
"def modules; end",
"def modules; end",
"def requested_modules(module_names)\n if module_names.empty?\n module_names = Dir[\"*.fun\"].each{ |mod| mod.chomp! \".fun\" }\n end\n module_names\n end",
"def extended(a_module)\n end",
"def service_functions(service_module)\n methods = service_module.const_get('Client').instance_methods.map {|method| method.to_s}\n methods.select do |method|\n send_exists = methods.include? \"send_#{method}\"\n upped = method.dup\n upped[0..0] = method[0..0].upcase\n begin\n send_exists && service_module.const_get(\"#{upped}_args\")\n rescue\n false\n end\n end\n end",
"def to_module_name\n self.to_method_name.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def extended_modules; end",
"def print_module(*) end",
"def module_function(name)\n if entry = @method_table.lookup(name)\n sc = class << self; self; end\n sc.method_table.store name, entry.method, :public\n Rubinius::VM.reset_method_cache name\n private name\n end\n end",
"def modules\n @modules = @modules.call if @modules.is_a?(Proc)\n @modules\n end",
"def find_from_parts(modules)\n modules.find do |mod|\n next nil if mod.blank?\n ActiveSupport::Inflector.constantize(mod).constants.include?(\n name.to_s.classify.to_sym\n )\n end\n end",
"def type\n Msf::MODULE_EXPLOIT\n end",
"def mod_resolve\n case @mod\n when Module\n @mod\n when String, Symbol\n @mod.to_s.split('::').\n reject { | name | name.empty?}.\n inject(Object) { | namespace, name | namespace.const_get(name) }\n else\n raise TypeError, \"mod_resolve: expected Module, String, Symbol, given #{@mod.class}\"\n end\n end",
"def faker_modules\n FFaker\n .constants\n .reject { |const| UTILS_MODULES.include?(const) }\n .select { |const| FFaker.const_get(const).instance_of?(Module) }\n .sort\n .map { |const| FFaker.const_get(const) }\nend",
"def get_methods(mod)\n methods = []\n mod.constants.sort.each do |c|\n mod.const_get(c).singleton_methods.sort.each do |m|\n methods << \"#{c}::#{m}\"\n end\n end\n methods\nend",
"def included_modules() end",
"def getFunctionName()\n return /in `([^']*)'/.match(caller[0].to_s)[1]\nend",
"def function_map\n unless @functions\n do_initialize\n @functions = {}\n function_files.each do |file|\n obj = {}\n name = File.basename(file, '.rb')\n obj[:name] = name\n obj[:parent] = mod_finder.match(file)[1]\n @functions[\"#{obj[:parent]}::#{name}\"] = obj\n end\n end\n @functions\n end",
"def defined_modules\n # TODO: check content type before scanning\n content.scan(/\\s*module\\s+([A-Za-z0-9_\\.]*)/).flatten\n end",
"def module\n klass[0..(klass.index(\"::\")-1)] if has_module?(klass)\n end",
"def module_name\n File.basename(File.dirname(__FILE__)).sub(/^[A-Za-z]*?-/, '')\nend",
"def definition\n \"module #{full_name}\"\n end",
"def module_names\n @cache[:modules]\n end",
"def name(_prefix = false)\n 'Puppet Functions'\n end",
"def module\n RDoc::TopLevel.find_module_named(@name) || @name\n end",
"def module_name\n (i = name.index(\"::\")) ? name[0..i-1] : name\n end",
"def faker_methods(mod)\n methods = mod.methods - Module.methods - UTILS_METHODS\n\n # For Company.name (et al), don't discard :name if it was reimplemented\n methods << :name if mod.send(:name) != mod.to_s\n methods\nend",
"def retrieve_func_calls\n\t$class_map.each do |keyc, valuec|\n\t\t#puts \"keyc is : #{keyc}\"\n\t\tif $const and !$const.include?keyc\n\t\t\tputs \"don't consider #{keyc}\"\n\t\t\tnext\n\t\tend\n\t\tvaluec.getMethods.each do |key, value|\n\t\t\t#puts \"Investigating #{keyc} . #{key}\"\n\t\t\tvalue.getCalls.each do |each_call|\n\t\t\t\teach_call.findCaller(keyc, key)\n\t\t\t\t#each_call.print\n\t\t\t\t#puts \"keyc #{keyc} key: #{key}\"\n\t\t\t\t#if each_call.caller == nil\n\t\t\t\t#\tputs \"\\t\\tcaller not found: #{each_call.getObjName} . #{each_call.getFuncName}\"\n\t\t\t\t#elsif each_call.caller.getMethod(each_call.getFuncName) == nil and each_call.isQuery == false and each_call.isField == false\n\t\t\t\t#\tputs \"\\t\\t* * function not found: #{each_call.getObjName} . #{each_call.getFuncName}\"\n\t\t\t\t#end\n\t\t\tend\n\t\tend\n\tend\nend",
"def prepended_modules; end",
"def get_all_functions src_file\n code = IO.readlines(src_file)\n functions = []\n puts src_file\n code.each do |line|\n /^\\s*def\\s+([^\\s\\(]+)\\s?.*/ =~ line\n functions << $1 if $1\n end \n functions\n end",
"def isolate_namespace(mod); end",
"def isolate_namespace(mod); end",
"def get_NAME_OF_MODULE(doc)\n module_name = Array.new\n doc.find( \"#{NAME_OF_MODULE}\" ).each do |mod_name|\n module_name << mod_name.content.strip.split[0]\n end\n if module_name.size == 1\n return module_name[0]\n=begin\n module_name.each do |each|\n return each\n end\n=end\n else\n return module_name\n end\n end",
"def module_info(module_name)\n #note: we may need to match something like \"romedia.Flash Player.plugin\" to\n #0x16cda000 - 0x172dfff3 +com.macromedia.Flash Player.plugin 10.0.12.36 (1.0.4f362) <776944fd51654ca2b59ab26a33d8f9b3> /Library/Internet Plug-Ins/Flash Player.plugin/Contents/MacOS/Flash Player\n # \"com.apple.QuickTime\" in the stack trace should match com.apple.QuickTime 7.6.3 (1584) \n #in the module list, but NOT com.apple.QuickTimeFireWireDV.component 7.6.3 (1584)\n if module_name == \"???\"\n return [nil, nil]\n elsif @log_string =~ /(0x[[:xdigit:]]+)\\s+-\\s+(0x[[:xdigit:]]+)\\s+[^\\n]+#{Regexp.escape(module_name)} [^\\/]+(\\/[^\\n]+)$/\n module_base = $1\n crashed_module_path = $3\n return module_base, crashed_module_path\n else\n raise \"Unable to get full path of #{module_name} from log #{@log_path}\"\n end \n \n \n end",
"def service_result(service_module, function_name)\n function_name = function_name.dup\n function_name[0..0] = function_name[0..0].upcase\n service_module.const_get(\"#{function_name}_result\")\n end",
"def included_methods\n included_modules.map(&:instance_methods).flatten\n end",
"def callable_methods\n methods.grep(/^_\\w+[^_]$/)\n end",
"def functions\n pg_major = ::PgSaurus::Engine.pg_server_version[0]\n res = select_all <<-SQL\n SELECT n.nspname AS \"Schema\",\n p.proname AS \"Name\",\n pg_catalog.pg_get_function_result(p.oid) AS \"Returning\",\n CASE\n WHEN #{pg_major >= 11 ? \"p.prokind = 'w'\" : \"p.proiswindow\"} THEN 'window'\n WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN 'trigger'\n ELSE 'normal'\n END AS \"Type\",\n p.oid AS \"Oid\"\n FROM pg_catalog.pg_proc p\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n WHERE pg_catalog.pg_function_is_visible(p.oid)\n AND n.nspname <> 'pg_catalog'\n AND n.nspname <> 'information_schema'\n AND #{pg_major >= 11 ? \"p.prokind <> 'a'\" : \"p.proisagg <> TRUE\"}\n ORDER BY 1, 2, 3, 4;\n SQL\n res.inject([]) do |buffer, row|\n returning = row['Returning']\n function_type = row['Type']\n oid = row['Oid']\n\n function_str = select_value(\"SELECT pg_get_functiondef(#{oid});\")\n\n name = parse_function_name(function_str)\n language = parse_function_language(function_str)\n definition = parse_function_definition(function_str)\n volatility = parse_function_volatility(function_str)\n\n if definition\n buffer << ::PgSaurus::ConnectionAdapters::FunctionDefinition.new(name,\n returning,\n definition.strip,\n function_type,\n language,\n oid,\n volatility)\n end\n buffer\n end\n end",
"def submodules\n self.constants\n .map { |name| const_get(name) }\n .select { |const| const.class == Module }\n end",
"def mod\n CheriModule \n end",
"def get_module()\n raise NoMethodError, 'This method needs to be overridden'\n end",
"def moduleList()\n res = \"\"\n leader = \" \"\n begin\n Dir.foreach($opdir) do |name|\n next unless name =~ /(.*)\\.rb$/\n require File.join(\"ri/op\", $1)\n klass = eval $1\n modDesc = klass::desc\n res << leader << $1 << \": \" << modDesc << \"\\n\"\n end\n rescue\n puts $!\n res = leader + \"no modules found...\"\n end\n res\nend",
"def mod\n\t\treturn driver.active_module\n\tend",
"def included_modules\n end",
"def common_function_link\n $tracer.trace(\"GlobalFunctions: #{__method__}, Line #{__LINE__}\")\n return common_functions = CommonFunctionLink.new\n end",
"def functions(name = nil)\n if name\n functions.find(:name => name)\n else\n @functions.flatten\n end\n end",
"def full_module_name\n self.class.ndx_full_module_names([id_handle]).values.first\n end",
"def real_mod_name(mod)\n UNBOUND_METHOD_MODULE_NAME.bind(mod).call\n end",
"def module?\n true\n end",
"def module?\n true\n end",
"def interesting_methods\n em = extension_modules\n methods-[em.last ? em.last.methods : nil]-self.class.instance_methods\n end",
"def get_module_name\n return :core_plugins\n end",
"def functions\n {\n OpenProcess: Fiddle::Function.new(KERNEL32['OpenProcess'],\n [Fiddle::TYPE_INT, Fiddle::TYPE_CHAR, Fiddle::TYPE_INT], Fiddle::TYPE_INT),\n TerminateProcess: Fiddle::Function.new(KERNEL32['TerminateProcess'], [Fiddle::TYPE_INT, Fiddle::TYPE_INT],\n Fiddle::TYPE_CHAR),\n GetProcessID: Fiddle::Function.new(GHRL_DLL['GetProcessID'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_VOIDP),\n GetModuleBaseAddress: Fiddle::Function.new(GHRL_DLL['GetModuleBaseAddress'],\n [Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP], Fiddle::TYPE_UINTPTR_T),\n RPMChar: Fiddle::Function.new(GHRL_DLL['RPMChar'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],\n Fiddle::TYPE_CHAR),\n RPMInt: Fiddle::Function.new(GHRL_DLL['RPMInt'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],\n Fiddle::TYPE_VOIDP),\n RPMBuf: Fiddle::Function.new(GHRL_DLL['RPMBuf'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],\n Fiddle::TYPE_VOIDP),\n WPMChar: Fiddle::Function.new(GHRL_DLL['WPMChar'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_CHAR],\n Fiddle::TYPE_SIZE_T),\n WPMInt: Fiddle::Function.new(GHRL_DLL['WPMInt'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT],\n Fiddle::TYPE_SIZE_T),\n WPMBuf: Fiddle::Function.new(GHRL_DLL['WPMBuf'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT],\n Fiddle::TYPE_SIZE_T)\n\n }\n end",
"def her_containing_module\n return unless name =~ /::/\n name.split(\"::\")[0..-2].join(\"::\").constantize\n end",
"def included_modules; end",
"def functions\n @tree['functions']\n end",
"def get(name)\n module_name = /^#{name.to_s.dup.delete('_')}(?:helper)?$/i\n\n options.namespaces.each do |namespace|\n found = namespace.constants.grep(module_name).first\n return namespace.const_get(found) if found\n end\n\n nil\n end",
"def Functions(source_module, *method_names)\n all_methods = source_module.instance_methods +\n source_module.private_instance_methods\n unwanted_methods = all_methods - method_names\n object = Object.new.extend(source_module)\n Module.new do\n define_singleton_method(:to_s) do\n \"ImportedFunctions(#{source_module}: #{method_names.join(', ')})\"\n end\n\n method_names.each do |name|\n define_method(name) do |*args, &block|\n object.send(name, *args, &block)\n end\n end\n private(*method_names)\n end\n end",
"def module2command(mod)\n case mod\n when Module\n module2command(RubyTools::class_unqualified_name(mod))\n when String\n mod.gsub(/[A-Z]/){|x| \"-#{x.downcase}\"}[1..-1]\n when Symbol\n module2command(mod.to_s).to_sym\n else\n raise ArgumentError, \"Invalid module argument #{mod.class}\"\n end\n end",
"def mod\n @mod \n end",
"def service_args(service_module, function_name)\n function_name = function_name.dup\n function_name[0..0] = function_name[0..0].upcase\n service_module.const_get(\"#{function_name}_args\")\n end",
"def find_module_named name\n @modules_hash[name]\n end",
"def extract_modules(name)\n modules = name.include?('/') ? name.split('/') : name.split('::')\n name = modules.pop\n path = modules.map { |m| m.underscore }\n file_path = (path + [name.underscore]).join('/')\n nesting = modules.map { |m| m.camelize }.join('::')\n [name, path, file_path, nesting, modules.size]\n end",
"def getFunction(name)\n getFunctionAux(@ast, name)\n end",
"def get_helpers\n Hyde::Helpers.constants.inject([Hyde::Helpers]) do |a, constant|\n mod = Hyde::Helpers.const_get(constant)\n a << mod if mod.is_a? Module\n a\n end\n end",
"def active_module\n\t\tdriver.active_module\n\tend",
"def fgetm(fname,sname)\n pname = \"\"\n if fexists fname, sname\n if eval \"$#{fname}['#{sname},facets'].include? 'ref'\"\n fname2 = eval \"$#{fname}['#{sname},ref']\"\n if eval \"$#{fname}['#{sname},facets'].include? 'ifref'\"\n eval \"eval $#{fname}['#{sname},ifref']\"\n end\n pname = fgetm(fname2,sname)\n else\n if eval \"$#{fname}['#{sname},facets'].include? 'method'\"\n if eval \"$#{fname}['#{sname},facets'].include? 'ifgetm'\"\n eval \"eval $#{fname}['#{sname},ifgetm']\"\n end\n fname = eval \"$#{fname}['#{sname},method']\"\n end\n end\n end\n return pname\nend",
"def current_module_name\n moduleable_modules.join('::')\n end",
"def only_name(mod); end",
"def module_name\n 'KfGame'\nend",
"def helper_module(object)\n (object.class.name + 'Helper').constantize\n end",
"def modules\n @modules.values\n end",
"def modules\n @modules.values\n end",
"def process_defn(exp)\n make_function exp\n end",
"def extract_modules(name) #:nodoc:\n modules = name.include?('/') ? name.split('/') : name.split('::')\n name = modules.pop\n path = modules.map { |m| m.underscore }\n\n file_path = (path + [name.underscore]).join('/')\n nesting = modules.map { |m| m.camelize }.join('::')\n\n [name, path, file_path, nesting, modules.size]\n end",
"def mod(name)\n master.module_instance name\n end",
"def functions(name = nil)\n find_children_of_type(\"Function\", name)\n end",
"def name\n @module.name\n end",
"def find_modules\n find_engine\n find_storage\n find_pod\n end",
"def get_installed_modules_for_host(host)\n on host, puppet(\"module list --render-as pson\")\n str = stdout.lines.to_a.last\n pat = /\\(([^()]+)\\)/\n mods = str.scan(pat).flatten\n return mods\n end",
"def module_sources(mod)\n graph.each_with_object([]) do |(m,next_modules),ret|\n ret << m if next_modules.include?(mod)\n end\n end",
"def all_modules\n modules_hash.values\n end",
"def find_callback(name)\n mod_with_callback = Catena.config.modules.find do |mod|\n mod = mod.is_a?(String) ? class_from_name(mod) : mod\n mod.respond_to?(name)\n end\n return mod_with_callback.method(name)\n end",
"def mod(symbol)\n H87Enchant.get_a_mod(symbol)\n end",
"def modular_class_name\n @modular_class_name\n end",
"def mod_finder\n @mod_finder ||= Regexp.new('\\/([\\w\\-\\.]+)\\/lib')\n end",
"def functions\n\n end",
"def modules\n yield self\n end",
"def transproc\n Functions[__fn__]\n end",
"def funcname\n NAMES[@name][1]\n end",
"def type\n :puppet_function\n end",
"def name\n @funcT.name\n end",
"def uses?(mod); end",
"def mod_finder\n @mod_finder ||= Regexp.new('\\/([\\w\\-\\.]+)\\/lib')\n end"
] |
[
"0.7539681",
"0.66389096",
"0.6538773",
"0.6528515",
"0.6448185",
"0.63964003",
"0.63705623",
"0.63705623",
"0.63705623",
"0.6216277",
"0.6207098",
"0.61999846",
"0.6125097",
"0.61241394",
"0.6110246",
"0.6099739",
"0.60307765",
"0.60126466",
"0.60106075",
"0.6010462",
"0.5945142",
"0.5944968",
"0.5884308",
"0.58645344",
"0.57727",
"0.57460785",
"0.57401836",
"0.5734673",
"0.57157886",
"0.57140034",
"0.57107186",
"0.5694265",
"0.5682178",
"0.5679899",
"0.5676915",
"0.56688136",
"0.5664444",
"0.566423",
"0.566423",
"0.564694",
"0.5642499",
"0.56394356",
"0.56333303",
"0.5631324",
"0.5625904",
"0.561298",
"0.561134",
"0.56071585",
"0.5601327",
"0.55996674",
"0.5599636",
"0.5590071",
"0.5587934",
"0.5587475",
"0.5583416",
"0.5575946",
"0.5575946",
"0.5567117",
"0.55573064",
"0.5528509",
"0.5519178",
"0.5510574",
"0.550379",
"0.5499769",
"0.5481287",
"0.547375",
"0.54728526",
"0.5462684",
"0.54563814",
"0.5448398",
"0.5446545",
"0.54359645",
"0.5426624",
"0.5421602",
"0.54101175",
"0.54085076",
"0.5398965",
"0.5396295",
"0.5384663",
"0.5384663",
"0.5384302",
"0.5362427",
"0.53570646",
"0.5350538",
"0.5343194",
"0.5342518",
"0.53388333",
"0.5337202",
"0.5316236",
"0.53119034",
"0.5311514",
"0.5310373",
"0.5303965",
"0.5303811",
"0.5302693",
"0.53001654",
"0.5294285",
"0.5288881",
"0.5288188",
"0.5285192",
"0.5279051"
] |
0.0
|
-1
|
Sets the token value for the current session and returns it in a masked form that's safe to send to the client. See section 3.4 of "BREACH: Reviving the CRIME attack".
|
def masked_authenticity_token(session)
one_time_pad = SecureRandom.random_bytes(AUTHENTICITY_TOKEN_LENGTH)
encrypted_csrf_token = xor_byte_strings(one_time_pad, real_csrf_token(session))
masked_token = one_time_pad + encrypted_csrf_token
Base64.strict_encode64(masked_token)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def masked_authenticity_token(session, form_options: T.unsafe(nil)); end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def set_token\n self.token ||= SecureRandom.uuid.gsub(/\\-/, '').first(5).upcase\n end",
"def set_token\n self.token ||= encrypted_data\n end",
"def set_token\n\tbegin\n\t self.token = SecureRandom.hex\n\tend while EncryptedString.where(token: self.token).present?\n end",
"def assign_secure_token\n self.secure_token = SecureRandom.hex\n end",
"def set_token\n self.token = Digest::SHA2.hexdigest \"#{username}-#{lastvisitDate.to_i}\" if self.token.blank?\n end",
"def token=(value)\n Pillowfort::Helpers::DeprecationHelper.warn(self.class.name, :token=, :secret=)\n send(:secret=, value)\n end",
"def save_authentication_token(token)\n carrier_setting.settings['token'] = token\n carrier_setting.settings['token_expire_date'] = DateTime.now + 7.hours\n carrier_setting.save\n end",
"def save_token\n self.token = SecureRandom.uuid unless self.token\n end",
"def reset_session_token!\n self.session_token = SecureRandom::urlsafe_base64\n self.save!\n # save! to persist. when not checking if worked, bang version\n end",
"def token=(token)\n self.encrypted_token = ::Digest::SHA2.hexdigest(token)\n end",
"def reset_token\r\n authentication_token true\r\n end",
"def token=(_token)\n raise NotImplementedError, \"#token= is not implemented\"\n end",
"def principal_token=(token)\n end",
"def session_token=(new_token)\n @session_token = new_token\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n @session_token\n end",
"def reset_session_token!\n self.update!(session_token: SecureRandom::urlsafe_base64)\n end",
"def reset_token\n self.token = ''\n end",
"def token=(token)\n self[:token] = HVCrypto::JWT.decode(token, audience)\n end",
"def set_csrf_token(_req, res)\n res.session[CSRF_TOKEN] ||= generate_csrf_token\n end",
"def set_internal_token!\n self.token ||= generate_token\n end",
"def reset_perishable_token!\n reset_perishable_token\n save_without_session_maintenance(validate: false)\n end",
"def reset_perishable_token!\n update_attribute(:perishable_token, reset_perishable_token)\n end",
"def ensure_session_token\n self.token ||= self.class.random_string\n end",
"def reset_session_token!\n self.session_token = SecureRandom::urlsafe_base64(16)\n self.save!\n self.session_token\n end",
"def reset_session_token!\n self.session_token = SecureRandom.urlsafe_base64(16)\n self.save!\n self.session_token\n end",
"def token=(token)\n Thread.current[:token] = token\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def set_Token(value)\n set_input(\"Token\", value)\n end",
"def ensure_session_token\n self.token ||= SecureRandom.hex\n end",
"def reset_sesssion_token!\n self.session_token = SecureRandom.urlsafe_base64\n self.save!\n self.session_token\n end",
"def session_token_set_attribute!(token, track = false)\n @session_token = token.to_s\n end",
"def not_spammer(token)\n if session[:token] == token.to_i\n session[:token] = rand(1000000)\n true\n else\n false\n end\n end",
"def reset_token!\n self.session_token = User.generate_session_token\n self.save!\n self.session_token\n end",
"def set_auth_token(token)\n @auth_token = token.to_s\n end",
"def csrf_token\n session[:csrf] ||= SecureRandom.hex 32\n end",
"def reset_perishable_token\n self.perishable_token = self.class.make_token\n end",
"def set_token(column)\n self[column] = SecureRandom.urlsafe_base64\n self.save_unconfirmed_user\n end",
"def edit_password\n @token = params[:token]\n end",
"def generate_token\n\t\tself.token = SecureRandom.hex\n end",
"def generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def invalidate_token\n update_attribute(:token, nil)\n update_attribute(:token_created_at, Time.now)\n end",
"def setup_token\n token = SecureRandom.hex(16)\n @token = token\n token\n end",
"def secure_token token=nil\n generated = Crypt.sha1(request.ip)\n return generated == token if token\n generated\n end",
"def init_token\n self.token = SecureRandom.hex(64) if self.token.blank?\n end",
"def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end",
"def ensure_session_token \n self.session_token ||= SecureRandom::urlsafe_base64\n end",
"def reset_token!\n token = Devise.friendly_token[0,20]\n self.password = self.password_confirmation = token\n self.email = \"#{name}@scribe\"\n save! validate: false\n token\n end",
"def reset_token\n set_new_token\n save!\n temporary_token\n end",
"def set_contact_token\r\n @contact_token = cookies[:mints_contact_id]\r\n end",
"def reset_token\n self.reset_password_token = BCrypt::Engine.generate_salt\n self.save(:validate => false)\n end",
"def auth_token\n (protect_against_forgery? ? form_authenticity_token : nil)\n end",
"def set_user_token(token)\n @user_token = token\n end",
"def authenticity_token_value(onclick)\n return unless onclick && onclick.include?(\"s.setAttribute('name', 'authenticity_token');\") &&\n onclick =~ /s\\.setAttribute\\('value', '([a-f0-9]{40})'\\);/\n $LAST_MATCH_INFO.captures.first\n end",
"def save_token\n self.token ||= Digest::MD5.hexdigest(login + Time.now.to_i.to_s)[0..5]\n $redis.set \"#{KEY}:#{login}:token\", token\n $redis.set \"#{KEY}:#{token}:login\", login\n end",
"def set_session\n session['token'] = @result['data']['token']\n current_user\n end",
"def plaintext_token\n if secret_strategy.allows_restoring_secrets?\n secret_strategy.restore_secret(self, :token)\n else\n @raw_token\n end\n end",
"def reset_session_token!\n self.session_token = self.class.generate_session_token\n self.save!\n self.session_token\n end",
"def reset_session_token!\n self.session_token = self.class.generate_session_token\n self.save!\n self.session_token\n end",
"def token=(token)\n res = token.scan(/\\<(.+)\\>/).first\n unless res.nil? || res.empty?\n token = res.first\n end\n write_attribute('token', token)\n end",
"def access_token=(value)\n reset_agent\n @access_token = value\n end",
"def access_token=(value)\n reset_agent\n @access_token = value\n end",
"def token\n refresh_token! if token_expired?\n super\n end",
"def set_current_user(user)\n session[:user_token] = user.token\n end",
"def set_token! model\n token = set_token model\n model.save!\n token\n end",
"def generate_token\n self.token = SecureRandom.urlsafe_base64\n end",
"def token=(token)\n if !token.nil? && token.to_s.length > 36\n fail ArgumentError, 'invalid value for \"token\", the character length must be smaller than or equal to 36.'\n end\n\n if !token.nil? && token.to_s.length < 1\n fail ArgumentError, 'invalid value for \"token\", the character length must be great than or equal to 1.'\n end\n\n @token = token\n end",
"def new_token\n \t SecureRandom.urlsafe_base64\n \tend",
"def token\n @token ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(4) ]\n end",
"def plaintext_token\n if secret_strategy.allows_restoring_secrets?\n secret_strategy.restore_secret(self, :token)\n else\n @raw_token\n end\n end",
"def set_image_token\n return if cookies[:ucsc_imgsrv_token].present?\n domain = [\"production\", \"staging\",\"sandbox\"].include?(Rails.env) ? '.library.ucsc.edu' : :all\n expires = Time.now + 86400\n value = Digest::SHA256.hexdigest(expires.to_i.to_s + ENV['image_token_secret'].to_s)\n cookies[:ucsc_imgsrv_token] ||= {value: \"#{expires.to_i.to_s}-#{value}\",\n expires: expires,\n domain: domain}\n end",
"def set_token model\n challenge = generate_challenge model\n model[challenge_column] = encrypt challenge\n build_token model, challenge\n end",
"def request_token=(token)\n @request_token = token\n end",
"def reset_single_access_token!\n update_attribute(:single_access_token, User.encrypt_token(Time.now.to_i, \"password reset--\"))\n end",
"def set_AuthenticationToken(value)\n set_input(\"AuthenticationToken\", value)\n end",
"def set_AuthenticationToken(value)\n set_input(\"AuthenticationToken\", value)\n end",
"def access_token\n return nil unless (temp_access_token = read_attribute(:access_token))\n # logger.debug2 \"temp_access_token = #{temp_access_token}\"\n encrypt_remove_pre_and_postfix(temp_access_token, 'access_token', 43)\n end",
"def access_token\n return nil unless (temp_access_token = read_attribute(:access_token))\n # logger.debug2 \"temp_access_token = #{temp_access_token}\"\n encrypt_remove_pre_and_postfix(temp_access_token, 'access_token', 43)\n end",
"def token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: auth_token)\n end",
"def set_auth_token\n return if auth_token.present?\n self.auth_token = generate_auth_token\n end",
"def reset_session_token!\n self.session_token = User.generate_session_token\n self.save!\n self.session_token\n end",
"def new_token\n SecureRandom.urlsafe_base64\nend",
"def card_token=(card_token)\n pattern = Regexp.new(/^[0-9]{8}$/)\n if !card_token.nil? && card_token !~ pattern\n fail ArgumentError, \"invalid value for \\\"card_token\\\", must conform to the pattern #{pattern}.\"\n end\n\n @card_token = card_token\n end",
"def token_secret=(_arg0); end",
"def token_secret=(_arg0); end",
"def token_secret=(_arg0); end",
"def generate_token\n self.token ||= SecureRandom.hex(16)\n end",
"def reset_token\n @@token = nil\n end",
"def reset_session_token!\n self.session_token = User.generate_session_token\n self.save\n self.session_token\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end"
] |
[
"0.6830139",
"0.65041685",
"0.65041685",
"0.64283067",
"0.6327143",
"0.6318878",
"0.6278038",
"0.6204214",
"0.61473805",
"0.6131066",
"0.61267567",
"0.6109995",
"0.6098966",
"0.60460377",
"0.6044267",
"0.60171235",
"0.5985372",
"0.59787583",
"0.59399724",
"0.5924458",
"0.59109545",
"0.591075",
"0.5910451",
"0.58942425",
"0.5879851",
"0.58651054",
"0.5827278",
"0.5824034",
"0.580552",
"0.580552",
"0.580552",
"0.580552",
"0.580552",
"0.580552",
"0.580552",
"0.580552",
"0.580552",
"0.5802917",
"0.5798106",
"0.57880294",
"0.5779667",
"0.5774431",
"0.57635283",
"0.5753705",
"0.57418424",
"0.5736057",
"0.5730547",
"0.57099336",
"0.5685157",
"0.5668141",
"0.56441706",
"0.5643366",
"0.56407636",
"0.56347424",
"0.5615972",
"0.56084764",
"0.56084687",
"0.5601344",
"0.5597399",
"0.5590674",
"0.5582675",
"0.558103",
"0.5568588",
"0.55666703",
"0.5545669",
"0.5545029",
"0.5545029",
"0.55362946",
"0.5533014",
"0.5533014",
"0.5532546",
"0.55292416",
"0.5528995",
"0.55264276",
"0.55260617",
"0.55223864",
"0.5517443",
"0.55168843",
"0.5515396",
"0.55009216",
"0.5496241",
"0.5489149",
"0.5487548",
"0.5487548",
"0.5474914",
"0.5474914",
"0.5471531",
"0.5467786",
"0.5467348",
"0.54592615",
"0.5451047",
"0.54471636",
"0.54471636",
"0.54471636",
"0.5444935",
"0.54437625",
"0.54435676",
"0.5443345",
"0.5443345",
"0.5443345"
] |
0.70682895
|
0
|
Checks the client's masked token to see if it matches the session token. Essentially the inverse of +masked_authenticity_token+.
|
def valid_authenticity_token?(session, encoded_masked_token)
return false if encoded_masked_token.nil? || encoded_masked_token.empty?
masked_token = Base64.strict_decode64(encoded_masked_token)
return false if masked_token.length != AUTHENTICITY_TOKEN_LENGTH * 2
# Split the token into the one-time pad and the encrypted
# value and decrypt it
one_time_pad = masked_token[0...AUTHENTICITY_TOKEN_LENGTH]
encrypted_csrf_token = masked_token[AUTHENTICITY_TOKEN_LENGTH..-1]
csrf_token = xor_byte_strings(one_time_pad, encrypted_csrf_token)
csrf_token == real_csrf_token(session)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_authenticity_token?(session, encoded_masked_token); end",
"def masked_authenticity_token(session)\n one_time_pad = SecureRandom.random_bytes(AUTHENTICITY_TOKEN_LENGTH)\n encrypted_csrf_token = xor_byte_strings(one_time_pad, real_csrf_token(session))\n masked_token = one_time_pad + encrypted_csrf_token\n Base64.strict_encode64(masked_token)\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def masked_authenticity_token(session, form_options: T.unsafe(nil)); end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def authenticated?(token)\n hex_encrypt(token) == remember_token\n end",
"def token?\n @session_token\n end",
"def verify\n incoming_token = ActiveSupport::JSON.decode(request.body.read)\n session = Session.where(nightcrew_token: incoming_token).first\n response = { valid: false }\n response[:valid] = true if session\n render :json => ActiveSupport::JSON.encode(response)\n end",
"def check_magic_token\n params[:magic_token] == Rails.application.secrets.calendly_magic_token\n end",
"def verified_request?\n\t\tsuper || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n\tend",
"def correct_login_token?(given_token)\n false\n end",
"def token_valid?\n @session_token and @toodle_token_death > Time.now\n end",
"def check_magic_token\n params[:magic_token] == Rails.application.secrets.salesforce_magic_token\n end",
"def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end",
"def verify_authenticity_token; end",
"def authenticate_by_token\n token = get_token\n if token.nil?\n render json: \"Missing HTTP_X_NB_AUTHTOKEN HTTP header\", status: :bad_request\n return false\n end\n\n # We verify by two ways:\n # 1. if app session id is present, does the app token match the associated app?\n # 2. does the current track belongs to the app session which the app token points to?\n true_token = Track.find(params[:id]).app_session.app.token\n\n if token != true_token\n render json: \"Token mismatch\", status: :bad_request\n return false\n end\n\n true\n end",
"def authenticated_with_token?(token)\n return false if token.nil?\n token == remember_digest\n end",
"def session_lock_token_valid_handle\n raise ArgumentError, params.inspect if params[:session_lock_token].blank?\n if current_user.emox_session_lock_token_valid?(params[:session_lock_token])\n render json: { status: \"success\" }\n else\n render json: { status: \"session_lock_token_invalid\" }\n end\n end",
"def secure_token token=nil\n generated = Crypt.sha1(request.ip)\n return generated == token if token\n generated\n end",
"def client_has_valid_token?\n request.headers[\"Authorization\"] == Rails.application.credentials.guessing_access_token\n end",
"def authorized?\n !session[:token].nil?\n end",
"def not_spammer(token)\n if session[:token] == token.to_i\n session[:token] = rand(1000000)\n true\n else\n false\n end\n end",
"def logged_in?\n #return true if !session[\"app_user\"].nil? && session[\"app_user\"].id != -1\n validate_token\n return true if !session[\"app_user\"].nil? && session[\"app_user\"].id != -1 \n return false\n end",
"def authenticate_token\n @is_authenticated = false\n if request.headers[\"TOKEN\"]\n if request.headers[\"TOKEN\"] == \"AppDipre\"\n @is_authenticated = true\n end\n end\n end",
"def authenticate_token\n @is_authenticated = false\n if request.headers[\"TOKEN\"]\n if request.headers[\"TOKEN\"] == \"AppDipre\"\n @is_authenticated = true\n end\n end\n end",
"def verified_request?\r\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\r\n end",
"def invalid_csrf_token?(req, res)\n return false unless verify_csrf_token?(req, res)\n\n missing_csrf_token?(req, res) ||\n !::Rack::Utils.secure_compare(req.session[CSRF_TOKEN], req.params[CSRF_TOKEN])\n end",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def valid_token?\n five_minutes_ago = DateTime.now - 5.minutes\n params[:timestamp].to_i > five_minutes_ago.to_i &&\n params[:token] == Scalingo::SsoController.generate_authentication_token(params[:id], params[:timestamp])\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verify_access_token\n \tuser = User.find_by(auth_token: params[:session][:auth_token])\n\n \tif user\n \t\trender text: \"verified\", status: 200\n \telse\n \t\trender text: \"Invalid token\", status: 422\n \tend\n end",
"def verify_authenticity_token\n verified_request? || raise(ActionController::InvalidAuthenticityToken)\n end",
"def valid_authentication_token?(incoming_auth_token)\n incoming_auth_token == self.authentication_token\n end",
"def any_authenticity_token_valid?; end",
"def check_token\n @usuario = Credentials.check_token(authorization: request.headers[\"Authorization\"])\n end",
"def require_token\n today = Time.now\n today_string = today.to_date.to_s\n yesterday_string = today.yesterday.to_date.to_s\n return false unless [today_string, yesterday_string].include?(params[:salt])\n params[:token] == token_with_salt(params[:salt])\n end",
"def verify_access_token\n debugger\n @user = User.find_by(access_token: params[:session][:access_token])\n if @user\n render text: \"verified\", status: 200\n else\n render text: \"Token failed verification\", status: 422\n end\n end",
"def authenticated?\n @auth_token =~ /^.*$/\n end",
"def verify_access_token\n if bypass_auth?\n true\n else\n authenticate_or_request_with_http_token do |token, opts|\n current_user && token && current_user.access_token.token == token\n end\n end\n end",
"def valid_auth_token?(request_auth_token)\n Devise.secure_compare(auth_token, request_auth_token) && !auth_token_expired?\n end",
"def token_authenticated?\n !!@access_token\n end",
"def token_authenticated?\n !!@access_token\n end",
"def has_auth_cookie?\n cookie = @request.cookies[TOKEN_COOKIE]\n !cookie.nil? && cookie.length == 32\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN']) || api_operator.present?\n end",
"def is_valid_session?\n session && session.include?(\"_csrf_token\") && (current_user && session.include?(\"user_credentials\"))\n end",
"def validate_token\n token = params[:token]\n return false if token.nil?\n \n user = User.validate_token(token)\n return false if user.nil?\n \n login_user(user)\n return true\n end",
"def valid_authentication_token?(incoming_auth_token)\n incoming_auth_token.present? && incoming_auth_token == self.authentication_token\n end",
"def check_access_token\n @access_token = session[:access_token]\n\n begin\n @client = Octokit::Client.new :access_token => @access_token\n @user = @client.user\n rescue => e\n # The token has been revoked, so invalidate the token in the session.\n session[:access_token] = nil\n authenticate!\n end\nend",
"def verified_request?\n\t\tsuper || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n\tend",
"def verify_access_token\n user = User.find_by(access_token: params[:session][:access_token])\n if user\n render json: user, status: :ok\n else\n render json: 'Token failed verification', status: :unprocessable_entity\n end\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def auth_token\n (protect_against_forgery? ? form_authenticity_token : nil)\n end",
"def validate_token\n return true if @current_username\n token = get_token\n token.force_encoding('utf-8') if token\n token_object = AccessToken.find_by_token(token)\n if token_object && token_object.validated?\n @current_username = token_object.username\n return true\n else\n return false\n end\n end",
"def token_authenticated?\n !!access_token\n end",
"def authentic_token?(token)\n return false if remember_token.nil?\n\n BCrypt::Password.new(remember_token).is_password?(token)\n end",
"def logged_in?\n !!session[:current_token]\n end",
"def has_auth_cookie?\n old_cookie = @request.cookies[OLD_TOKEN_COOKIE]\n new_cookie = @request.cookies[NEW_TOKEN_COOKIE]\n !old_cookie.nil? && !new_cookie.nil?\n end",
"def check_auth_token\n token = decoded_auth_token\n render json: { error: 'Not Authorized' }, status: :unauthorized unless token\n end",
"def valid_app_access_token?\n token = request.headers['X-App-Access-Token']\n\n token.present? && token == Rails.application.secrets.app_access_token\n end",
"def token_verify\r\n\r\n #render json: {id: params[\"user\"][\"id\"], params: params}\r\n \r\n user_tmp = User.find(params[:id])\r\n if user_tmp.authentication_token == params[:authentication_token]\r\n $granted = true\r\n render json: false\r\n else\r\n \r\n render json: false\r\n end\r\n end",
"def token_autenticado?(token)\n return false if token.nil?\n Password.new(reset_digest).is_password?(token)\n end",
"def valid_app_access_token?\n app_access_token = request.headers['X-App-Access-Token']\n\n app_access_token.present? &&\n app_access_token == Rails.application.secrets.app_access_token\n end",
"def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if token.present?\r\n end",
"def verify_csrf_token(req, res)\n handle_invalid_csrf_token(req, res) if invalid_csrf_token?(req, res)\n end",
"def validate_token\n token = params[:token]\n return false if token.nil?\n \n user = User.validate_token(token)\n return false if user.nil?\n \n login_user(user)\n return true\n end",
"def authenticate_token\n render_401 if @token.blank? || !@token.active?\n end",
"def request_authenticity_tokens; end",
"def token_can_be_reused?(token, client_id)\n # ghetto HashWithIndifferentAccess\n updated_at = self.tokens[client_id]['updated_at'] || self.tokens[client_id][:updated_at]\n last_token = self.tokens[client_id]['last_token'] || self.tokens[client_id][:last_token]\n\n\n return true if (\n # ensure that the last token and its creation time exist\n updated_at && last_token &&\n\n # ensure that previous token falls within the batch buffer throttle time of the last request\n Time.parse(updated_at) > Time.now - DeviseTokenAuth.batch_request_buffer_throttle &&\n\n # ensure that the token is valid\n ::BCrypt::Password.new(last_token) == token\n )\n end",
"def check_token(token)\n params = \"token=#{token}&md5=#{Ivona::GetMd5.formula(token)}\"\n HTTParty.get(\"#{BASE_URL}/tokens?#{params}\")\n end",
"def verify_auth_token\n halt 401 unless valid_user?(extracted_token)\n end",
"def verify_jwt_token\n head :unauthorized if request.headers['Authorization'].nil? ||\n !AuthToken.valid?(request.headers['Authorization'].split(' ').last)\n end",
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def verified_request?\n !protect_against_forgery? || request.get? ||\n form_authenticity_token == params[request_forgery_protection_token] ||\n form_authenticity_token == request.headers['X-XSRF-Token']\n end",
"def verified_request?\n !protect_against_forgery? || request.get? ||\n form_authenticity_token == params[request_forgery_protection_token] ||\n form_authenticity_token == request.headers['X-XSRF-Token']\n end",
"def verified_request?\n !protect_against_forgery? || request.get? ||\n form_authenticity_token == params[request_forgery_protection_token] ||\n form_authenticity_token == request.headers['X-XSRF-Token']\n end",
"def authenticated?\n !!@access_token\n end",
"def authorize_request\n if !cookies.nil? and !cookies[:session_secret].nil?\n config = Util.eval_configuration\n if cookies[:session_secret] == config.session_secret[:secret]\n logger.debug \"Passes security check\"\n return true\n end\n end\n logger.debug(\"Session secret is not present in %s\" % cookies.inspect)\n logger.warn 'Someone from IP %s may be spoofing' % request.env['REMOTE_ADDR']\n render :nothing => true, :status => 403\n end",
"def valid_token?\n # we check against a copy invitation object\n match = Invitation.find_by_token(self.token)\n \n if !match\n errors.add :token, 'not found'\n return false\n elsif User.registered.find_by_invitation_id(match)\n errors.add :token, 'already used'\n return false\n end\n \n true\n end",
"def authorized?\n return if session[:access_token]\n end"
] |
[
"0.8165088",
"0.6949309",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.6852407",
"0.67660624",
"0.67561024",
"0.67561024",
"0.67561024",
"0.67531353",
"0.67362356",
"0.6697247",
"0.6683008",
"0.6638576",
"0.6628997",
"0.658566",
"0.6573421",
"0.6542194",
"0.65367866",
"0.65116",
"0.6495002",
"0.64870286",
"0.641735",
"0.6416202",
"0.64148927",
"0.6386015",
"0.6355945",
"0.63545376",
"0.63545376",
"0.6345546",
"0.634343",
"0.63143957",
"0.63143957",
"0.63143957",
"0.63143957",
"0.63143957",
"0.6314338",
"0.63023365",
"0.63023365",
"0.63023365",
"0.63023365",
"0.6274981",
"0.62614745",
"0.6247721",
"0.6241918",
"0.62347096",
"0.62307316",
"0.6228523",
"0.62153953",
"0.61906195",
"0.61889946",
"0.61814594",
"0.61814594",
"0.61588705",
"0.61540365",
"0.6153324",
"0.6149126",
"0.61490715",
"0.6141399",
"0.61396766",
"0.61294705",
"0.6128023",
"0.61248827",
"0.61140615",
"0.6110765",
"0.6092316",
"0.60869235",
"0.60868454",
"0.6080128",
"0.607853",
"0.60704565",
"0.6064874",
"0.60584915",
"0.6054209",
"0.60528034",
"0.6052285",
"0.60411376",
"0.6040339",
"0.60369897",
"0.60323775",
"0.6026417",
"0.60246354",
"0.6018521",
"0.6018307",
"0.6018307",
"0.6018307",
"0.5993402",
"0.5990823",
"0.59796333",
"0.5970634"
] |
0.8027464
|
1
|
Destroy all records and stop Daemon script on logout
|
def destroy
system "ruby streaming_script.rb stop"
session[:username] = nil
User.all.each do |user|
user.destroy
end
User.reset_pk_sequence
Tweet.all.each do |tweet|
tweet.destroy
end
Tweet.reset_pk_sequence
reset_session
redirect_to root_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n log_out\n end",
"def destroy\n kill\n reset\n end",
"def daemon_clean_up\n TaskQueue.where(id: $daemon[:heartbeat_task_queue_id]).destroy_all\n File.delete($daemon[:pid_file])\nend",
"def clean_sessions\n self.log_puts(\"Cleaning sessions on appserver.\") if @debug\n \n #Clean up various inactive sessions.\n session_not_ids = []\n time_check = Time.now.to_i - 300\n @sessions.delete_if do |session_hash, session_data|\n session_data[:dbobj].flush\n \n if session_data[:dbobj].date_lastused.to_i > time_check\n session_not_ids << session_data[:dbobj].id\n false\n else\n true\n end\n end\n \n self.log_puts(\"Delete sessions...\") if @debug\n @ob.list(:Session, {\"id_not\" => session_not_ids, \"date_lastused_below\" => (Time.now - 5356800)}) do |session|\n idhash = session[:idhash]\n self.log_puts(\"Deleting session: '#{session.id}'.\") if @debug\n @ob.delete(session)\n @sessions.delete(idhash)\n end\n \n #Clean database weak references from the tables-module.\n @db.clean\n \n #Clean the object-handler.\n @ob.clean_all\n \n #Call various user-connected methods.\n @events.call(:on_clean) if @events\n end",
"def shut_down\n end",
"def cleanup\n _send_command(\"hosts -d\")\n _send_command(\"services -d\")\n _send_command(\"creds -d\")\n end",
"def delete_pidfile; end",
"def terminate\n self.destroy\n end",
"def destroy\n if @mList.size > 0\n str = @mList.join\n dt = Time.now.localtime\n fname = dt.year.to_s + \"_\" + dt.month.to_s + \"_\" + dt.day.to_s\n fh = File.open(\"logs/\" + fname, \"a\")\n fh.write(str)\n fh.close\n @mList.clear\n end\n @mSocket.close\n storeDebug(\"Dumped final logs.\")\n end",
"def teardown\n Process.kill('KILL',@pid)\n end",
"def cleanup\n if @logfile #make sure there is a log file meaning keylog started and migration was successful, if used.\n finish_up if session_good?\n time_stamp(\"exited\")\n end\n end",
"def stop\n system(\"pkill -f #{DAEMON}\")\n end",
"def erase_old_data()\n Djinn.log_run(\"rm -rf /tmp/h*\")\n Djinn.log_run(\"rm -f ~/.appscale_cookies\")\n Djinn.log_run(\"rm -f #{APPSCALE_HOME}/.appscale/status-*\")\n Djinn.log_run(\"rm -f #{APPSCALE_HOME}/.appscale/database_info\")\n\n Nginx.clear_sites_enabled\n HAProxy.clear_sites_enabled\n Djinn.log_run(\"echo '' > /root/.ssh/known_hosts\") # empty it out but leave the file there\n CronHelper.clear_crontab\n end",
"def teardown\n self.db_disconnect\n self.logout()\n super\n end",
"def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_fqdn)\n if dns_service != nil\n dnsrecord = dns_service.get_record(get_fqdn, get_type)\n dns_service.remove_record(dnsrecord.hash_id)\n end\n Puppet.debug \"done with destroy #{self.class.to_s}\"\n end",
"def destroy\n user_id = app_session.current_user_id\n current_user_session.register_logout\n\n app_session.logged_out\n DeterLab.logout(user_id)\n SslKeyStorage.delete(user_id)\n\n ActivityLog.for_user(user_id).add(:logout, user_id)\n rescue DeterLab::NotLoggedIn\n # That's ok. We are logging out anyway\n ensure\n redirect_to :login, notice: t(\".success\")\n end",
"def cleanup\n @session_id = nil\n end",
"def exec_logout\n core_destroySession\n redirect_to lato_core.login_path\n end",
"def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def destroy_instance_database\n instance_database.delete!\n end",
"def destroy_instance_database\n instance_database.delete!\n end",
"def destroy\n # invalidate the token\n client.logout\n\n # client is not valid anymore\n @client = nil\n\n # reset client for records\n Confluence::Record.client = nil\n end",
"def cleanUp\n if @running != nil\n info(\"Cleaning: Disconnect from the PubSub server\")\n RMCommunicator.instance.stop\n # info(\"Cleaning: Kill all previously started Applications\")\n # ExecApp.killAll ## NOTE: do we want to kill of the started RM on reset ???\n info(\"Cleaning: Exit\")\n info(\"\\n\\n------------ EXIT ------------\\n\")\n end\n end",
"def cleanup\n\t\tcurrent_time = current_date_time\n\n\t\tputs current_time\n\n\t\t# delete all sessions that are older than 30 minutes\n\t\tActiveRecord::Base.connection.execute(\"DELETE FROM sessions WHERE updated_at < '#{current_time}'\")\n\tend",
"def destroy!\n fail \"Can not destroy a running stone\" if running?\n rm_rf system_config_filename\n rm_rf extent_directory\n rm_rf log_directory\n rm_rf tranlog_directories\n end",
"def cleanup\n @pid = nil\n File.delete($config[:'pid-file']) rescue true\n @log.close rescue true\n end",
"def before_destroy_user\n indestructible_demo_user\n\n self.opml_import_job_state.opml_import_failures.delete_all\n self.opml_import_job_state.delete\n self.opml_export_job_state.delete\n self.refresh_feed_job_states.delete_all\n self.subscribe_job_states.delete_all\n\n self.folders.delete_all\n self.entry_states.delete_all\n\n # feed subscriptions are deleted WITH callbacks, to take care of the possible deletion of feeds with no more\n # subscribed users\n self.feed_subscriptions.destroy_all\n end",
"def destroy\n self.timelog_stop_tracking\n \n #Use quit-variable to avoid Gtk-warnings.\n Gtk.main_quit if @quit != true\n @quit = true\n end",
"def delete_from_dor\n CocinaObjectStore.destroy(druid)\n AdministrativeTags.destroy_all(identifier: druid)\n ObjectVersion.where(druid:).destroy_all\n Event.where(druid:).destroy_all\n end",
"def cleanup!(h)\n Sudo::System.kill h[:pid]\n Sudo::System.unlink h[:socket]\n end",
"def kill\n\t\tframework.sessions.deregister(self)\n\tend",
"def kill\n\t\tframework.sessions.deregister(self)\n\tend",
"def destroy\n data = Storm::Base::SODServer.remote_call '/Server/destroy',\n :uniq_id => @uniq_id\n data[:destroyed]\n end",
"def clear_database\n User.destroy_all\n Animal.destroy_all\n Report.destroy_all\nend",
"def destroy_data\n # ActiveRecord::Base.connection.execute(\"DELETE FROM watchables\")\n end",
"def stop_managed_sessions\n @sessions.each {|session| session.stop}\n end",
"def destroy\n Process.kill(9, pid)\n end",
"def run_cleanup\n load_code\n connect_to_database(true)\n Job.cleanup_all(:days => @options[:days])\n end",
"def logoff\n end",
"def log_out\n session.delete(:doctor_id)\n @current_doctor = nil\nend",
"def destroy_all\n destroy_users\n puts \"Destroyed users\"\n destroy_comments\n puts \"Destroyed comments\"\n destroy_costs\n puts \"Destroyed costs\"\n destroy_service_locations\n puts \"Destroyed service locations\"\n destroy_service_contacts\n puts \"Destroyed service contacts\"\n destroy_services\n puts \"Destroyed services\"\n destroy_service_types\n puts \"Destroyed service types\"\n destroy_locations\n puts \"Destroyed locations\"\n destroy_contacts\n puts \"Destroyed contacts\"\n destroy_categories\n puts \"Destroyed categories\"\n end",
"def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end",
"def logout\n session_delete\n @token = ''\n @seqid = 0\n auth_header\n end",
"def done()\n info \"'#{@name}' daemon done\"\n @running = false\n @@inst[self.class].delete(@name)\n end",
"def stop\n service.pool_action uuid, :destroy\n end",
"def cleanup\n Authie.notify(:cleanup) do\n # Invalidate transient sessions that haven't been used\n active.where('expires_at IS NULL AND last_activity_at < ?',\n Authie.config.session_inactivity_timeout.ago).each(&:invalidate!)\n # Invalidate persistent sessions that have expired\n active.where('expires_at IS NOT NULL AND expires_at < ?', Time.now).each(&:invalidate!)\n end\n true\n end",
"def teardown\n PersistentUser.new(TEST_USER).delete\n Time.use_system_time\n clear_change_log\n end",
"def stop_all(wait=true)\n if script_to_run?('terminate')\n options = { \"DB_TERMINATE_SAFETY\" => \"text:off\" }\n run_script_on_set('terminate', @servers.select { |s| s.state != 'stopped' }, wait, options)\n # @servers.each { |s|run_script('terminate', s, options) unless s.state == 'stopped' }\n else\n @servers.each { |s| obj_behavior(s, :stop) }\n end\n \n wait_for_all(\"stopped\") if wait\n # unset dns in our local cached copy..\n @servers.each { |s| s.params['dns-name'] = nil } \n end",
"def log_out\n # current_user.created_lists.where(\"name is null\").delete_all\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n @current_list = nil\n # @current_team = nil\n cookies.signed[:id] = nil\n session[:current_date]=nil\n session[:list_id]=nil\n\n end",
"def destroy\n begin\n exitMaintenanceMode\n rescue\n Puppet.err 'Could not find Host system.Either Host is not exist or disconnected'\n end\n end",
"def destroy\n [METADATA_TABLE_NAME, RUN_HISTORY_TABLE_NAME,\n DISABLED_MONITOR_TABLE_NAME, MONITOR_INFO_TABLE_NAME].each do |table|\n @db.execute(\"DROP TABLE IF EXISTS #{table}\")\n end\n\n create()\n end",
"def destroy\n \t#call logout method in admin_helper but only if we r loggedin\n \tlog_out if logged_in?\n \t#redirect him to homepage\n \tredirect_to root_path\n end",
"def log_out\n session.delete(:officer_id)\n @current_officer = nil\n end",
"def destroy\n @run.destroy\n head 200\n end",
"def destroy\n user_session.log_out\n redirect_to root_url\n end",
"def destroy\n\t\t#logout method is defined in helper file\n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path\n\tend",
"def destroy\n # Shutdown pool if active\n service.pool_action uuid, :destroy if active?\n # If this is a persistent domain we need to undefine it\n service.pool_action uuid, :undefine if persistent?\n end",
"def clean_db\n Mongoid::Sessions.default.collections.select {|c| c.name !~ /system/}.each {|c| c.find.remove_all}\n end",
"def log_out\n forget(current_coordinator)\n session.delete(:coordinator_id)\n @current_coordinator = nil\n end",
"def purge_db\n\tUser.delete_all\n\tSubscription.delete_all\n\tDorkus.delete_all\nend",
"def logout_existing(db)\n @all.each do |socket|\n @socket_ops[socket] << Proc.new do\n @connection.db(db).issue_logout(:socket => socket)\n end\n end\n end",
"def cdb_destroy\n couchdb.delete(\"webui_user\", @name, @couchdb_rev)\n end",
"def log_out\n forget(current_doctor)\n session.delete(:doctor_id)\n @current_doctor = nil\n end",
"def clear_syscheck_database(agent_id)\n delete \"/syscheck/#{agent_id}\"\n end",
"def cleanup(tmp_path, meeting_id)\n # Delete temporary files\n FileUtils.rm_rf(tmp_path)\n\n # Delete all raw recording data\n # TODO: Find a way to outsource this into a script that runs after all post_archive scripts have run successfully\n system('sudo', 'bbb-record', '--delete', \"#{meeting_id}\") || raise('Failed to delete local recording')\nend",
"def cleanup_script_execution\n FileUtils.rm_rf(InstanceConfiguration::CACHE_PATH)\n end",
"def ensure_destroy\n ensure_stop\n destroy if exist?\n end",
"def start\n destroy_session_customer\n end",
"def manager_out\n forget(current_manager)\n session.delete(:manager_id)\n @current_manager = nil\n end",
"def destroy\n begin\n client = DiscourseApi::Client.new(\"https://intranet.cuhappycorner.com\")\n client.api_key = \"1729b13700d45e58d2e3d81c1bee5431a5167244e75389c07bb613fae54777ee\"\n client.api_username = \"ckho\"\n user = client.by_external_id(current_user.id)\n client.log_out(user[\"id\"]) if user\n rescue\n # nothing\n ensure\n super\n end\n end",
"def destroy!\n destroy { trigger :refresh }\n end",
"def shutdown\n drop_database\n end",
"def after_destroy(resume) \n expire_cache_for(resume) \n end",
"def stop\n Vedeu.trigger(:_cleanup_)\n\n Vedeu::Runtime::MainLoop.stop!\n end",
"def stop\n system(\"start-stop-daemon --stop --pidfile #{pidfile}\")\n end",
"def cleanup\n logger.info(\"Cleaning up expired sessions...\", :cleanup, { state: :starting })\n begin\n count = CacheStore.cleanup(ttl: SESSION_TTL)\n logger.info(\"Deleted #{count} expired sessions.\", :cleanup, { state: :success, count: count })\n rescue StandardError => e\n logger.info(\"Failed to clean up expired sessions.\", :cleanup, { state: :error, message: e.message })\n\n # Reraise (calling `raise` without arguments will reraise last error)\n raise\n end\n end",
"def kill\n signal(\"KILL\", scope: :all)\n cleanup\n end",
"def cleanup()\n attempts = @options[:timeout].to_i / SLEEPWAIT\n start = Time.now\n\n @gce_helper.delete_firewall(@firewall, start, attempts)\n\n @hosts.each do |host|\n @gce_helper.delete_instance(host['vmhostname'], start, attempts)\n @logger.debug(\"Deleted Google Compute instance #{host['vmhostname']} for #{host.name}\")\n @gce_helper.delete_disk(host['diskname'], start, attempts)\n @logger.debug(\"Deleted Google Compute disk #{host['diskname']} for #{host.name}\")\n end\n\n end",
"def cleanup_connection!\n Models::JanusInstance.destroys\n end",
"def logout!\n @ssh.close\n @ssh = nil\n end",
"def destroy\r\n\t\t\tif @user != nil\r\n\t\t\t\t@user.quit\r\n\t\t\tend\r\n\t\t\tsuper\r\n\t\tend",
"def logout\n $redis.del \"userhash:#{session['userhash']}\"\n session['userhash']=nil\n session['user']=nil\n end",
"def logout\n validate_arguments!\n\n Turbot::Auth.logout\n display \"Local credentials cleared.\"\n end",
"def destroy\n log_out\n redirected_to root_url\n end",
"def destroy\n current_hiker.create_activity :logged_out, owner: current_hiker\n session[:user_id] = nil\n redirect_to root_url\n end",
"def execute(days = nil)\n expire_params = [compose_query, compose_condition(days)]\n\n TOKEN_MODELS.each do |klass|\n perform_delete(klass, expire_params)\n\n log_info(\"System - #{klass.model_name.human} was cleaned-up\")\n end\n end",
"def cleanup_meterpreter\n if self.pivot_session\n self.pivot_session.remove_pivot_session(self.session_guid)\n end\n\n self.pivot_sessions.keys.each do |k|\n pivot = self.pivot_sessions[k]\n pivot.pivoted_session.kill('Pivot closed')\n pivot.pivoted_session.shutdown_passive_dispatcher\n end\n\n unless self.skip_cleanup\n ext.aliases.each_value do | extension |\n extension.cleanup if extension.respond_to?( 'cleanup' )\n end\n end\n\n dispatcher_thread.kill if dispatcher_thread\n\n unless self.skip_cleanup\n core.shutdown rescue nil\n end\n\n shutdown_passive_dispatcher\n end",
"def destroy\n\t\tlog_out\n\t\tUTEPSSO.deauthenticate(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tredirect_to root_url\n\tend",
"def cleanup\n @sessions.each_value do |session|\n session.close if session.expired?\n end\n rescue => e\n log.error(\"Expired session cleanup failed: #{e}\")\n end",
"def stop\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end",
"def destroy\n warden.logout\n @session.destroy\n head :no_content\n end",
"def destroy(_)\n paths = [\n instance.provisioner[:root_path], instance.verifier[:root_path]\n ]\n paths.each do |p|\n FileUtils.rm_rf(p)\n logger.info(\"[Localhost] Deleted temp dir '#{p}'.\")\n end\n self.class.unlock!\n end",
"def cleanup\n super\n if(service)\n stop_service()\n print_status(\"Server stopped.\")\n end\n end",
"def stop\n # self.stop_proxy\n # if machine_status and (machine_status == STATUS_AVAILABLE or machine_status == STATUS_OCCUPIED)\n # self.cleanup_after_stop\n # end\n\n self.delete_machine\n self.status = STATUS_ERROR\n self.student_id = 0\n self.save\n end",
"def log_out_manager\n session.delete(:manager_id)\n end",
"def log_out\n forget(current_employee)\n session.delete(:employee_id)\n @current_employee = nil\n end",
"def delete\n self.users.each do |id|\n user = User.find_by_id(id)\n next if user.nil?\n user.databases.delete(self._id)\n user.working_db_id = nil if user.working_db == self\n user.save\n end\n super\n end",
"def sdestroy\n\t\tsession[:user_id] = nil\n\t\tredirect_to \"/summary/login\"\n\tend",
"def cleanup\n @omicli_pgids.each do |pgid|\n `pkill -KILL -g #{pgid}`\n end\n @omicli_pgids.clear\n end",
"def before_destroy\n self.user.entry_states.where(entry_id: self.feed.entries).delete_all\n self.feed.refresh_feed_job_states.where(user_id: self.user.id).destroy_all\n self.feed.subscribe_job_states.where(user_id: self.user.id).destroy_all\n\n folder = self.feed.user_folder self.user\n folder.feeds.delete self.feed if folder.present?\n\n # If triggered by the destruction of user or feed, do not update timestamps, there's no need\n unless destroyed_by_association\n touch_subscriptions\n touch_user_data\n end\n end"
] |
[
"0.66424865",
"0.6568091",
"0.65014905",
"0.64252025",
"0.6346752",
"0.63371754",
"0.63297087",
"0.6321891",
"0.6320664",
"0.6310702",
"0.6285546",
"0.6282958",
"0.6278167",
"0.62675714",
"0.62645936",
"0.6254862",
"0.6188635",
"0.6183023",
"0.61717826",
"0.6139106",
"0.6139106",
"0.6121014",
"0.61168754",
"0.61168605",
"0.611278",
"0.608419",
"0.60735184",
"0.60644114",
"0.6057272",
"0.6052702",
"0.60435563",
"0.60425913",
"0.60409766",
"0.6040606",
"0.6040524",
"0.6039873",
"0.60310596",
"0.6002685",
"0.5991726",
"0.596988",
"0.59692264",
"0.5961595",
"0.5952148",
"0.59518015",
"0.59379965",
"0.5928746",
"0.59265816",
"0.59157",
"0.5915123",
"0.59121394",
"0.5905069",
"0.59018683",
"0.5901778",
"0.59006864",
"0.58997333",
"0.5893448",
"0.58870494",
"0.5878858",
"0.5878341",
"0.5875519",
"0.58706045",
"0.5870589",
"0.5866747",
"0.5862593",
"0.5861997",
"0.5857063",
"0.5856453",
"0.585548",
"0.58432627",
"0.5841936",
"0.5832584",
"0.5830858",
"0.58287305",
"0.58254266",
"0.5823889",
"0.58231235",
"0.58206993",
"0.58195597",
"0.5816387",
"0.5815294",
"0.5813964",
"0.58075416",
"0.5807068",
"0.5797451",
"0.5796461",
"0.57853884",
"0.57819676",
"0.5776372",
"0.5773735",
"0.5772329",
"0.5769094",
"0.5768937",
"0.5768015",
"0.57657665",
"0.5764661",
"0.576231",
"0.576051",
"0.5757084",
"0.5744144",
"0.5743949"
] |
0.66317403
|
1
|
def full_address address = [self.street_address, self.city] address.push(self.state) unless self.state.blank? address.push(self.postal_code) unless self.postal_code.blank? address.push(self.country) address.join(", ") end
|
def all_phones_vendor
if self.phone.blank? && self.alt_phone.blank?
return "Not shown"
elsif self.alt_phone.blank?
return self.phone
elsif self.phone.blank?
return self.alt_phone
else
return "#{self.phone} / #{self.alt_phone}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def full_address\n\t\t[\"#{self.street}\", self.city, self.country].compact.join(', ')\n\tend",
"def full_address\n full_address = \"\"\n unless self.address.blank?\n full_address += self.address\n end\n unless self.city.blank?\n full_address += \", \" + self.city\n end\n unless self.province.blank?\n full_address += \", \" + self.province\n end\n unless self.country.blank?\n full_address += \", \" + self.country\n end\n unless self.postal.blank?\n full_address += \", \" + self.postal\n end\n return full_address\n end",
"def full_address\n [ address, city, state, zipcode, country ].compact.join(', ')\n end",
"def full_address\n [address, city, state, zipcode, country].compact.join(\", \")\n end",
"def full_address\n [address, town, state, zipcode].compact.join(', ')\n end",
"def full_address\n\t\t[address1, address2, city, state, zipcode].join(', ')\n\tend",
"def full_address\n addr = []\n addr << country.try(:name) if show_country\n addr << (state.try(:name).presence || state_name) if show_state\n addr << address1\n addr.compact.join(', ')\n end",
"def full_street_address\n [address, city, state, country].compact.join(', ')\n end",
"def full_address\n [self.address, \"Madrid\", \"Spain\"].compact.join(\", \") if self.address\n end",
"def full_address\n [area, city, country].compact.join(', ')\n end",
"def full_address\n address.presence || [street_number, routes, locality, administrative_area_level_1, country].compact.reject(&:blank?).join(', ')\n end",
"def full_address\n [address, city, state].join(' ')\n end",
"def full_address\n [address, city].compact.join(', ')\n end",
"def full_address\n [landmark_name, city, country].compact.join(', ')\n end",
"def full_address\n \"#{address1} #{address2} #{city},#{state} #{postal_code} #{country}\"\n end",
"def full_address\n\t\t\"#{street}, #{postal_code}, #{city}, #{country}\"\n\tend",
"def get_full_address\n [\n (address.empty? ? nil : address),\n (self.le_city.nil? ? nil : self.le_city.get_full_name)\n ].compact.join(\", \")\n end",
"def get_full_address\n [\n (address.empty? ? nil : address),\n (self.le_city.nil? ? nil : self.le_city.get_full_name)\n ].compact.join(\", \")\n end",
"def full_address\n [state,zip].compact.join(',')\n end",
"def address\n [street, city, state, country].compact.join(', ')\n end",
"def full_address\n \"#{address}, #{city}, #{state}, #{zip}\"\n end",
"def full_address\n \"#{address}, #{suburb}, #{state}, #{postcode}\"\n end",
"def address\n\t\taddress_str = \"\"\n\t\taddress_str += \"#{address_street}\\n\" unless address_street.blank?\n\t\taddress_str += \"#{address_city}, \" unless address_city.blank?\n\t\taddress_str += \"#{address_state} \" unless address_state.blank?\n\t\taddress_str += \"#{address_zip}\" unless address_zip.blank?\n\t\taddress_str\n\tend",
"def address\n [street, city, zip, state].compact.join(\", \")\n end",
"def address\n [city, state, country].compact.join(', ')\n end",
"def address\n [country, state, city].compact.join(', ')\n end",
"def location_full_address\n\n the_address = []\n the_address << location_street unless location_street.nil? or location_street.empty?\n the_address << location_number unless location_number.nil? or location_number.to_s.empty?\n the_address << location_complement unless location_complement.nil? or location_complement.empty?\n\n the_city = []\n the_city << location_city unless location_city.nil? or location_city.empty?\n the_city << location_state unless location_state.nil? or location_state.empty? or (location_state == location_city)\n the_city << location_country unless location_country.nil? or location_country.empty?\n \n full_address = \"\" \n full_address << the_address.join(\" \") unless the_address.empty?\n full_address << \", #{the_city.join(' ')}\" unless the_city.empty?\n full_address << \" #{location_zip}\" unless location_zip.nil? or location_zip.to_s.empty?\n\n return full_address\n\n end",
"def full_street_address #Take all location fields, remove nil elements with .compact, then return a string for Geocoder\n [address_1, address_2, city, country, z_post_code].compact.join(', ')\n end",
"def address\n\t\t\taddress = [self.address_1, self.try(:address_2), \"#{self.city} #{self.try(:state)}\", \"#{self.try(:zip)}\"].compact\n\t\t\taddress.delete(\"\")\n\t\t\taddress.join(\"<br/>\")\n\t\tend",
"def full_address\n city.present? ? city_delim = city + \",\" : city_delim = city\n [address_1, address_2, city_delim, state, zip].reject(&:nil? || empty?).join(' ')\n end",
"def address\n return \"\" unless [city, state, state_code].all?(&:present?)\n \"#{city}, #{state}(#{state_code})\"\n end",
"def full_address\n if has_full_address?\n \"#{street_address}, #{locality} #{region} #{postal_code} #{country}\"\n end\n end",
"def address\n [address1, city, state, country, zip].compact.join(', ')\n end",
"def full_address\r\n [street, city, state, zip_code].delete_if{ |content| content.blank? }.join(\", \")\r\n end",
"def full_address\n part_1 = address\n part_2 = [zip_code, city].reject(&:blank?).join(' ')\n part_3 = \"France\"\n [part_1, part_2, part_3].reject(&:blank?).join(', ')\n end",
"def address\n [address1, address2, city, state, zip].compact.join(', ')\n end",
"def full_address\n [address, city, state_code, zip].compact.uniq.join ' '\n end",
"def full_address\n \"#{address1}, #{address2}, #{city}, #{state}, #{zipcode}\"\nend",
"def full_street_address\n \"#{self.address}, #{self.city}, #{self.state.try(:alpha_code)} #{self.zipcode} US\"\n end",
"def address\n [address1, address2, city, state, zip].compact.join(', ')\n end",
"def full_street_address\n if self.city_id || self.city\n \n city = City.find(:first,:conditions => {:city => self.city_id}) || self.city\n \"#{self.street_address},#{self.postal_code},#{city.city},#{city.region.code},#{city.region.country.name}\" || \"\"\n else\n \"\"\n end\n end",
"def full_address\n return \"#{@address}, #{@apart} #{@city} #{@state}, 60611\"\n end",
"def full_address\n \"#{region}, #{district}, #{street_type} #{street_name}, д. #{house_number} кв. #{apartment}\"\n end",
"def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end",
"def full_address\n return \"#{address}, #{city}, #{state}, #{zip}\"\nend",
"def full_address\n return\"#{self.client},#{self.rep_address_one} #{self.rep_address_two},#{self.city},#{self.state},#{self.zipcode}\"\n end",
"def address\n address = []\n address << [address1] if !address1.blank?\n address << [address2] if !address2.blank?\n address << [city] if !city.blank?\n address << [province] if !province.blank?\n address << [region] if !region.blank?\n address << [zip_code] if !zip_code.blank?\n address.join(\", \")\n end",
"def full_street_address\n \"#{street_address}, #{city}, #{state}\"\n end",
"def full_address\n \"#{street_address}, #{city}, #{ISO3166::Country.new(country_code.upcase).name}\"\n end",
"def full_street_address\n\t\treturn \"#{self.street}, #{self.city}, #{self.state}, #{self.zip}\"\n\tend",
"def address(format = :full)\n if state_code.to_s != \"\"\n s = \", #{state_code}\"\n elsif state.to_s != \"\"\n s = \", #{state}\"\n else\n s = \"\"\n end\n \"#{city}#{s} #{postal_code}, #{country}\".sub(/^[ ,]*/, '')\n end",
"def address_for_geocode\n add = []\n add << self.address_1\n add << self.address_2 if self.address_2.present?\n add << self.address_3 if self.address_3.present?\n add << self.city if self.city.present?\n add << self.region if self.region.present?\n add << self.postcode if self.postcode.present?\n add << (self.country.present? ? self.country : 'United Kingdom')\n add.join(', ')\n end",
"def full_street_address\n return \"#{bAddress1}, #{bCity}, #{bState}\"\n end",
"def address\n address = \"#{self.street_address}, #{self.city}, #{self.country}\"\n \n end",
"def address\n \"%s %s %s %s\"%([self.prefecture_code,self.address_city,self.address_street,self.address_building])\n end",
"def display_address\n address_list = []\n address_list << city unless city.blank?\n address_list << state unless state.blank?\n address_list << country unless country.blank?\n address_list.join(\", \")\n end",
"def full_address\n merchant.street + \", \" + merchant.city + \", \" + merchant.state + \" \" + merchant.zip\n end",
"def address\n [province_c, county_c, town_c].join(',')\n end",
"def co_address\n [location,city,state,\"nigeria\"].compact.join(',')\n end",
"def completeAddress\n\t\tprint \"#{streetAddress},\" \n\t\tprint \"#{cityName},\" \n\t\tprint \"#{countryName}\"\n\tend",
"def create_full_address\n \"#{address_line1}, #{city}, #{state} #{zip}\"\n end",
"def full_address_for(address)\n \"#{street_address_for(address)}, #{address.city}, #{address.state_province} \" \\\n \"#{address.postal_code}\"\n end",
"def full_hq_address\n part_1 = hq_address\n part_2 = [hq_zip_code, hq_city].reject(&:blank?).join(' ')\n part_3 = hq_country.present? ? hq_country : \"France\"\n [part_1, part_2, part_3].reject(&:blank?).join(', ')\n end",
"def full_address(include_country = false, include_secondary = false)\n address = \"#{street_address(include_secondary)} #{postal_code} #{city}\"\n address = \"#{address} POLOGNE\" if include_country\n address\n end",
"def address\n [street, [postal_code, l].join(' ')].join(\"\\n\")\n end",
"def formatted_address\n \"#{self.street_address}, #{self.city}, #{self.state} #{self.zip_code}\"\n end",
"def address_string\n \"#{address}, #{city}, #{state} #{zip}\"\n end",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def address\n \"#{self.building} #{return_data_format(self.street)} #{self.zipcode}\"\n end",
"def display_full_address\n [floor, full_address].join(' ')\n end",
"def address\n\t [inst_add1, inst_add2, inst_city, inst_state, inst_zip].compact.join(\", \")\n\tend",
"def street_address\n [\n house_number, \n street_predirection, \n street_name, \n street_type, \n street_postdirection, \n unit_type, \n unit_number\n ].compact.delete_if(&:empty?).join(' ')\n end",
"def full_street_address\n location + \"New York City, NY, USA\"\n end",
"def text_address\n [street, city, state].join(\" \")\n end",
"def to_s\n city.present? ? city_delim = city + \",\" : city_delim = city\n line3 = [city_delim, state, zip].reject(&:nil? || empty?).join(' ')\n [address_1, address_2, line3].reject(&:nil? || empty?).join('<br/>').html_safe\n end",
"def address_full\n \"#{self.address.titleize}, Toronto, ON\"\n end",
"def to_s\n [\n self.street,\n [\n self.zip,\n self.city\n ].join(\" \"),\n self.country\n ].select(&:present?).join(\", \")\n end",
"def address_one_line\n \"%s, %s, %s %s\" % [self.address_line_1, self.city, self.state_abbr, self.zipcode]\n end",
"def full(address)\n \"#{address[:type]} #{address[:description]}, #{address[:neighborhood]}, #{address[:city]}-#{address[:state]}, Brasil.\"\n end",
"def full_street_address\n postcode_only_address\n end",
"def full_address_array\n [name, address1, address2, city_state_zip].compact\n end",
"def full_address_array\n [name, address1, address2, city_state_zip].compact\n end",
"def full(glue=',')\n lines = address_lines(glue).split(glue)\n\n if town.present?\n lines.push town.name, town.county.name\n end\n\n lines.push postcode\n \n # Remove empty lines and join by parameter\n lines.select{|i|i.present?}.join glue\n end",
"def to_s\n [self.address_1, self.address_2].compact.join(', ')\n end",
"def city_address\n \"#{city}, #{state} #{zip}\"\n end",
"def name_and_full_address\n [name, full_address].join ' - '\n end",
"def format_address\n street + \", \" + zip\n end",
"def get_verbose_address\n [\n (address.empty? ? nil : address),\n (self.le_city.nil? ? nil : self.le_city.get_verbose_name)\n ].compact.join(\", \")\n end",
"def get_verbose_address\n [\n (address.empty? ? nil : address),\n (self.le_city.nil? ? nil : self.le_city.get_verbose_name)\n ].compact.join(\", \")\n end",
"def mailing\n out = address1.to_s\n out += \"<br />\" unless out.strip.empty? || address2.to_s.empty?\n out += address2.to_s\n out += \"<br />\" unless out.strip.empty?\n out += city.to_s\n out += \", \" if city.present? && state.present?\n out += state if state.present?\n out += \"<br />\" + zip.to_s if zip.present?\n out += \"<br />\" unless out.strip.empty? || !country.present?\n out += country_ref.name if country.present?\n out\n end",
"def full_street\n\t\tstreet = \"\"\n\t\tstreet += self.street + \" \" unless self.street.blank?\n\t\tstreet +=self.street2 unless self.street2.blank?\n\t\treturn street\n\tend",
"def full_order_to_address\n ship_address.address1 + ' ' + ship_address.address2\n end",
"def property_display_address_street_comma_with_county\n dets = self['address_details']\n \"#{dets['address_line_1']}, #{dets['city']}, #{dets['county']} COUNTY, #{dets['state'][0..1]}, #{dets['zip_code']}\".upcase\n end",
"def display_address(type)\n [self.send(\"#{type}_city\"), self.send(\"#{type}_state\")].compact.uniq.join(\", \")\n #address_list << send.(\"#{type}_city\") unless send.(\"#{type}_city\").blank?\n #address_list << send.(\"#{type}_state\") unless send.(\"#{type}_state\").blank?\n #address_list << send.(\"#{type}_country\") unless send.(\"#{type}_country\").blank?\n #address_list.join(\", \")\n end",
"def to_s\n \"#{street_address}, #{city}, #{state} #{zip_5}\"\n end",
"def address_detail\n \"#{province.try :name}#{city.try :name}#{district.try :name}#{address}\"\n end",
"def to_s\n \"\\nAddress:\\n#{line_one}\\n#{line_two}\\n#{city} #{state} #{zip}\"\n end",
"def getVendorAddress(profile)\n\t\tprofile.address+' '+profile.city+ ', '+profile.state\n\tend",
"def to_s\n [street1, street2, city, state, country].reject { |e| e.empty? }.join(', ')\n end",
"def to_s\n \"#{street} #{city}, #{state} #{zip}, #{country}\"\n end",
"def geoAddress\n\n self.address + \",\" +self.region.name\n\n end"
] |
[
"0.92671585",
"0.9200169",
"0.9180925",
"0.917997",
"0.91260433",
"0.90960443",
"0.9096008",
"0.9065554",
"0.90654063",
"0.8994806",
"0.89553076",
"0.890423",
"0.8900255",
"0.8865048",
"0.88640606",
"0.8838104",
"0.88274795",
"0.8826684",
"0.8825708",
"0.8808252",
"0.87865716",
"0.8746272",
"0.8740473",
"0.87313616",
"0.86955845",
"0.86953557",
"0.86842334",
"0.8682894",
"0.86718625",
"0.8657694",
"0.864312",
"0.8620745",
"0.86100143",
"0.8607446",
"0.8606775",
"0.8569659",
"0.8555197",
"0.85431105",
"0.8542294",
"0.85420406",
"0.854186",
"0.85340947",
"0.852579",
"0.84925467",
"0.8473223",
"0.8442904",
"0.84427214",
"0.84275854",
"0.84176403",
"0.8412737",
"0.84084463",
"0.83633596",
"0.83627474",
"0.8359069",
"0.83078533",
"0.8261617",
"0.82511926",
"0.82163244",
"0.81948507",
"0.81298494",
"0.8120829",
"0.8093767",
"0.8092883",
"0.8086795",
"0.80512327",
"0.8028815",
"0.7988207",
"0.79749423",
"0.7970632",
"0.79078496",
"0.7853497",
"0.7837111",
"0.7821745",
"0.7821013",
"0.7815804",
"0.7803775",
"0.77787566",
"0.77699804",
"0.7763796",
"0.76967806",
"0.76861125",
"0.76861125",
"0.7595693",
"0.7584814",
"0.75637347",
"0.75623447",
"0.75527626",
"0.75129026",
"0.75129026",
"0.7470898",
"0.74548006",
"0.7449466",
"0.74400043",
"0.7423528",
"0.7418725",
"0.7375993",
"0.73423725",
"0.7336372",
"0.7329398",
"0.7319085",
"0.7307494"
] |
0.0
|
-1
|
def check_address? [street_address_changed?, city_changed?, state_changed?, postal_code_changed?, country_changed?].any? end
|
def inactive_date
if inactive_changed?
if inactive?
self.inactive_from = Time.now
else
self.inactive_from = nil
end
end
def new_ownership
@user = User.find(self.created_by)
Ownership.create(business_id: self.id, user_id: self.created_by,
email_address: @user.email, created_by: self.created_by)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def address_changed?\n \tstreet_changed? || city_changed? || state_changed?\n end",
"def full_hq_address_changed?\n hq_address_changed? || hq_zip_code_changed? || hq_city_changed? || hq_country_changed?\n end",
"def should_geocode?\n address.present? && (address_changed? || !latitude || !longitude)\n end",
"def geocode?\n address_changed? and (latitude.blank? or longitude.blank?)\n end",
"def valid_address?(address)\n all_addresses = get_all_addresses\n all_addresses.include? address\nend",
"def has_address?\n !address.blank? && !city.blank? && !state.blank? && !zip.blank?\n end",
"def needs_geocoding?\n self.new_record? || self.city_changed? || self.street_address_changed?\n end",
"def can_update_addresses?\n !complete?\n end",
"def has_full_address?\n [street_address, locality, region, postal_code, country].any?(&:present?)\n end",
"def geocode?\n \t(!address.blank? && (latitude.blank? || longitude.blank?)) || address_changed?\n end",
"def address_empty?\n if !self.street.blank? or !self.city.blank? or !self.state.blank? or !self.postal_code.blank?\n return false\n else\n return true\n end\n end",
"def address_change\n @update_cart_invoice = zip_code_changed?\n true\n end",
"def lat_changed?\n if (self.address_changed?)\n if !(self.latitude_changed?)\n self.errors.add(:address, \"is not valid\")\n return false\n end\n end\n return true\nend",
"def addressing_ok?\n if billing_address.nil?\n return false\n elsif billing_address.filled_in? and (shipping_address.nil? or !shipping_address.filled_in?)\n return true\n elsif billing_address.filled_in? and shipping_address.filled_in?\n return false\n else\n return false\n end\n end",
"def needs_address?\n !flagged? && !sent?\n end",
"def address_changed?\n return self.address_hash_changed?\n end",
"def coordinates_changed?\n if self.address_changed?\n unless self.lat_changed? || self.lng_changed?\n self.errors.add(:address, 'cannot be geo-located. Please try to be more specific')\n return false\n end\n end\n true\n end",
"def address_valid?\n not_valid = email.blank? || first_name.blank? || last_name.blank? || address.blank? || city.blank? ||\n zipcode.blank? || country.blank?\n !not_valid\n end",
"def aramex_address_validation\n zones = Spree::ShippingMethod.where(['LOWER(admin_name) like ?', '%aramex%']).map(&:zones).flatten\n if zones.map(&:countries).flatten.map(&:iso).include?(country.iso)\n response = JSON.parse(validate_address(city, zipcode, country.iso))\n if response['HasErrors'] == true && errors[:zipcode].blank?\n if response['SuggestedAddresses'].present?\n errors.add(:base, response['Notifications'].map { |data| data['Message'] }.join(', ') + ', Suggested city name is - ' + response['SuggestedAddresses'].map { |data| data['City'] }.join(', '))\n else\n cities_response = JSON.parse(fetch_cities(country.iso, city[0..1]))\n errors.add(:base, cities_response['Notifications'].map { |data| data['Message'] }.join(', ') + ', Suggested city name is - ' + cities_response['Cities'].join(' ,'))\n end\n end\n end\n rescue\n return true\n end",
"def address_valid?(validation_contexts)\n return true if address.nil?\n return true unless reg_company_contact_address_yes_no == 'N' || reg_company_contact_address_yes_no.to_s.empty?\n\n address.valid?(validation_contexts)\n end",
"def check_address_or_lat_long\n if address.blank? and latitude.blank? and longitude.blank?\n return false\n elsif !address.blank? and latitude.blank? and longitude.blank?\n return true\n elsif address.blank? and !latitude.blank? and !longitude.blank?\n return true\n elsif !address.blank? and !latitude.blank? and !longitude.blank?\n return false\n end\n end",
"def address?\n if self.address\n return false\n else\n return true\n end\n end",
"def lat_changed?\n if (self.address_changed?)\n if !(self.latitude_changed?)\n self.errors.add(:address, \"is not valid\")\n return false\n end\n end\n return true\n end",
"def address_selected?\n return unless address_line1.to_s.empty? || town.to_s.empty?\n\n errors.add(:postcode, :address_not_chosen)\n end",
"def geo_location_changed?\n self.changed.include?(\"lat\") || self.changed.include?(\"lng\")\n end",
"def valid_address? address\n code = call_blockchain_api(\"checkaddress/#{address}\")\n\n !['X5', 'SZ', 'CK'].include?(code)\n end",
"def details_complete?\n name.valid? &&\n date_of_birth.present? &&\n date_of_applicability.present? &&\n addresses.any?(&:valid?)\n end",
"def geocode?\n !(address.blank? || (!latitude.blank? && !longitude.blank?))\n end",
"def been_here?(email)\n email.been_there_addresses.include?(address.downcase)\n end",
"def fully_specified\r\n !address.nil? && !address.empty? &&\r\n !city.nil? && !city.empty? &&\r\n !state.nil? && !state.empty? &&\r\n !zip.nil? && !zip.empty?\r\n end",
"def any_locations?\r\n contacts.detect { |x| x && !x.address.nil? }\r\n end",
"def check_address(_)\n raise NotImplementedError\n end",
"def valid_address?( delta = 1.0 )\n @required = [:ups_account, :ups_user, :ups_password]\n \n state = STATES.has_value?(@state.downcase) ? STATES.index(@state.downcase) : @state\n \n @data = String.new\n b = Builder::XmlMarkup.new :target => @data\n \n b.instruct!\n b.AccessRequest {|b|\n b.AccessLicenseNumber @ups_account\n b.UserId @ups_user\n b.Password @ups_password\n }\n b.instruct!\n b.AddressValidationRequest {|b|\n b.Request {|b|\n b.RequestAction \"AV\"\n b.TransactionReference {|b|\n b.CustomerContext \"#{@city}, #{state} #{@zip}\"\n b.XpciVersion API_VERSION\n }\n }\n b.Address {|b|\n b.City @city\n b.StateProvinceCode state\n b.PostalCode @zip\n }\n }\n \n \t get_response \"https://wwwcie.ups.com/ups.app/xml/AV\"\n \n \t\tif REXML::XPath.first(@response, \"//AddressValidationResponse/Response/ResponseStatusCode\").text == \"1\" && REXML::XPath.first(@response, \"//AddressValidationResponse/AddressValidationResult/Quality\").text.to_f >= delta\n \t\t return true\n \t\telse\n \t\t return false\n \t\tend\n end",
"def registration_complete?\n self.address.present?\n end",
"def valid?\n @errors = []\n\n if address_type && !ADDRESS_TYPE[address_type]\n @errors << ['address_type', \"must be one of #{ADDRESS_TYPE.keys.join('/')} and is currently #{address_type}\"]\n end\n\n @errors.size == 0\n end",
"def has_address?(addresses, addy)\n addy == addresses.bsearch { |a| addy <= a }\n end",
"def check_owner_and_address\n check_owner\n check_address\n check_access\n end",
"def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end",
"def address_search?\n # do any of the parameters start with pick_address\n pick_address = params.each_key.find { |key| key.start_with? 'pick_address_' }.present?\n params[:search] || params[:select] || params[:manual_address] || params[:change_postcode] || pick_address\n end",
"def validateaddress(coinaddress)\n coind.validateaddress\n end",
"def tvc_address?\n self.id == Rails.application.config.fedex_vc_address_id || (self.first_name == \"The Visible\" && self.last_name == \"Closet\")\n end",
"def with_address?(address)\n return false\n if address_today_paid(address) > 0\n (order_price + address_today_paid(address)) > Setting.instance.max_total_per_day\n end\n end",
"def check_addr_status(hsh)\n full_addr = hsh[:full_addr]\n full_addr_f = hsh[:full_addr_f]\n status = nil\n\n if full_addr && full_addr_f\n status = full_addr != full_addr_f ? 'formatted' : 'unchanged'\n end\n\n hsh[:address_status] = status\n hsh\n end",
"def check_values\n check_numericity\n check_zip_code\n end",
"def validate_all\n current_user.valid?(:save) && valid?(:create) && address_valid?(:save)\n end",
"def valid_email_address_fields?(array)\n if array.present?\n @contact_form.email_address_field_ids.each do |field_id|\n if array[\"#{field_id}\"].present? && array[\"#{field_id}\"] !~ EmailValidator::REGEX\n return false\n end\n end\n end\n\n true\n end",
"def seller_address? \r\n sold_by_business? && user.has_address? rescue false\r\n end",
"def address_present\n if address.blank?\n errors.add(:address, \"Can't be empty\")\n end\n end",
"def valid_email_address?( value )\n begin\n parsed = Mail::Address.new(value)\n return parsed.address == value && parsed.local != parsed.address\n rescue Mail::Field::ParseError\n return false\n end\n end",
"def valid_email_address?( value )\n begin\n parsed = Mail::Address.new(value)\n return parsed.address == value && parsed.local != parsed.address\n rescue Mail::Field::ParseError\n return false\n end\n end",
"def is_complete?()\n return false if @name.nil? || @name.empty?\n return false if @url.nil? || @url.empty? \n return false if @zip.nil? || @zip.empty?\n return false if @lat.nil? || @lat.empty?\n return false if @long.nil? || @long.empty?\n true \n end",
"def validate(address)\n if (address.country.present? && scotland_country_code_valid?(address.country) == false) ||\n (address.postcode.present? && scotland_postcode_format_valid?(address.postcode) == false)\n address.errors.add(:postcode, :postcode_format_invalid)\n end\n end",
"def valid?\n MSPhysics::Newton::Gear.is_valid?(@address)\n end",
"def blank?\n @address_line1.blank? && @town.blank? && @postcode.blank?\n end",
"def valid_address\n @address_string ||= [:street_address, :postal_code].map{|f| self.send(f)}.join(',')\n \n res=Geokit::Geocoders::GoogleGeocoder.geocode(@address_string)\n \n if res.success && res.precision.to_sym == :address\n\n self.street_address = res.street_address.upcase\n self.postal_code \t= res.zip.gsub(/\\s+/,'') \n self.lat = res.lat\n self.lng = res.lng\n \n country = Country.find_by_iso2(res.country_code)\n region = country.regions.find_or_create_by_code(res.state)\n city = region.cities.find_or_create_by_name_and_country_id(res.city, country.id) \n self.city = city\n\n elsif military_address?\n self.city = Country.find_by_iso2(res.country_code).regions.\n find_by_code(res.state).cities.find_by_name(res.city)\n return true \n else\n errors.add_to_base('Sorry the address is not valid')\n end \n end",
"def verify_address_owners\n if complete?\n errors.add(:bill_address, 'Billing address should not have a user') if bill_address.try(:user_id)\n errors.add(:ship_address, 'Shipping address should not have a user') if ship_address.try(:user_id)\n else\n if bill_address && bill_address.valid? && !bill_address.user_id.nil? && bill_address.user_id != user_id\n errors.add(\n :bill_address,\n \"Billing address user #{bill_address.user_id.inspect} does not match order #{user_id.inspect}\"\n )\n end\n\n if ship_address && ship_address.valid? && !ship_address.user_id.nil? && ship_address.user_id != user_id\n errors.add(\n :ship_address,\n \"Shipping address user #{ship_address.user_id.inspect} does not match order #{user_id.inspect}\"\n )\n end\n end\n end",
"def address_matches(spec, address)\n (0..3).all? { |i| spec[i]=='*' || spec[i]==address[i] }\nend",
"def location_fully_specified\r\n (!address.nil? && !city.nil? && !state.nil? && !zip.nil?) || has_lat_long?\r\n end",
"def valid?\n country_code && country_code.size == 2 && city_code && city_code.size == 3\n end",
"def lat_changed?\n if (self.location_changed?)\n if !(self.latitude_changed?)\n self.errors.add(:location, \"is not valid\")\n return false\n end\n end\n return true\nend",
"def check_addresses\n\n if location = @found_params.entities.detect {|entity| entity.name == \"from\"} || @ride.start_address\n if @ride.start_address\n address = @ride.start_address\n else\n address = geocode(location.value)\n end\n\n @ride.start_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @start_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n @time = UberService.new(@ride).time_estimates\n @time = @time / 60 if @time.class == Fixnum\n\n end\n\n if location = @found_params.entities.detect {|entity| entity.name == \"to\"} || @ride.end_address\n if @ride.end_address\n address = @ride.end_address\n else\n address = geocode(location.value)\n end\n\n @ride.end_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @end_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n end\n\n if (location = @found_params.entities.detect {|entity| entity.name == \"address\"}) && (@ride.end_address || @ride.start_address)\n\n address = geocode(location.value)\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n nice_address = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n if @ride.start_address\n @ride.end_address = address\n @end_address_nice = nice_address\n else\n @ride.end_address = address\n @start_address_nice = nice_address\n end\n\n @ride.save\n end\n\n if !@ride.end_address.nil? && !@ride.start_address.nil?\n @price = UberService.new(@ride).price_estimates\n end\n end",
"def matches?(another_address)\n return(false) if another_address.nil?\n attrs_to_match = [:kind, :address_1, :address_2, :address_3, :city, :state, :zip]\n attrs_to_match.all? { |attr| attribute_matches?(attr, another_address) }\n end",
"def valid?\n return false if !@first_name.nil? && @first_name.to_s.length > 30\n return false if !@first_name.nil? && @first_name !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @last_name.nil?\n return false if @last_name.to_s.length > 30\n return false if @last_name !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @address_one.nil?\n return false if @address_one.to_s.length > 50\n return false if @address_one !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@address_two.nil? && @address_two.to_s.length > 30\n return false if !@address_two.nil? && @address_two !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @city.nil?\n return false if @city.to_s.length > 30\n return false if @city !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @state.nil?\n return false if @state.to_s.length > 2\n return false if @state !~ Regexp.new(/^[A-Z]{2}$/)\n return false if @zip.nil?\n return false if @zip.to_s.length > 11\n return false if @zip !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @phone.nil?\n return false if @phone.to_s.length > 10\n return false if @phone !~ Regexp.new(/^[0-9]+$/)\n return false if !@email.nil? && @email.to_s.length > 100\n return false if !@email.nil? && @email !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@country_code.nil? && @country_code.to_s.length > 2\n return false if !@country_code.nil? && @country_code !~ Regexp.new(/^[A-Z]{2}$/)\n true\n end",
"def address_check(obj)\n if obj.address.vague_address == nil\n \"No address provided.\"\n else\n obj.address.vague_address\n end\n end",
"def address_is_local?(address)\n Rails.configuration.local_addresses.any? { |spec| address_matches spec.strip.split('.'), address.strip.split('.') }\nend",
"def addr_valid?(res)\n res << \"Provided IP addr isn't valid!\" unless ip_validation_lib.valid? addr\n end",
"def is_work_address_previously_collected_and_valid?(question)\n answer_for(question, valid_response_exists?(\"PREG_VISIT_1_3.WORK_ADDRESS_1\", :last))\n end",
"def regeocode\n self.geocode_address if self.address_changed? || self.city_changed? || self.state_changed?\n end",
"def street_areSame?(street)\n if(@street == street)\n true\n else\n false\n end\nend",
"def include?(address)\n return false unless address\n\n members.any? do |zone_member|\n case zone_member.zoneable_type\n when \"Spree::Country\"\n zone_member.zoneable_id == address.country_id\n when \"Spree::State\"\n zone_member.zoneable_id == address.state_id\n when \"Spree::Zipcode\"\n zone_member.zoneable.name == address.zipcode_base\n else\n false\n end\n end\nend",
"def has_locationable_field?\n if latitude.blank? and longitude.blank? and address.blank?\n errors.add :base, 'You must fill in at least one field'\n end\n end",
"def touch_addresses\n if changes.include?(:bill_address_id) && self.bill_address.present?\n self.bill_address.touch\n end\n\n if changes.include?(:ship_address_id) && self.ship_address.present?\n self.ship_address.touch\n end\n end",
"def validate_zip_or_state\n # check format of zip and state\n enough = false\n if zip.present? && ::Geocode::ZipCode.is_valid_usa_zip_code?(zip)\n #\n enough = true\n elsif state.present?\n if ::Geocode::State::USA_STATE_CODES_TO_NAMES_MAP.include?(state.strip.upcase)\n enough = true\n else\n self.errors.add(:state, \"Invalid State\")\n end\n end\n unless enough\n self.errors.add(:zip, \"Required to set either State or Zip Code\")\n end\n end",
"def avalara_eligible?\n if ship_address.present? and ship_address.state.present?\n SpreeAvalara.sales_tax_states.keys.include? ship_address.state.abbr\n else\n false\n end\n end",
"def validate_address(address, options={})\n options = @options.update(options)\n address_validation_request = build_address_validation_street_request(address, options)\n #UPS sandbox is not knowing about all states\n log(:address_validation, address_validation_request)\n response = commit(:address_validation_street, save_request(address_validation_request), (false))\n response = response.gsub(/\\sxmlns(:|=)[^>]*/, '').gsub(/<(\\/)?[^<]*?\\:(.*?)>/, '<\\1\\2>')\n log(:address_validation, response)\n parse_address_street_validation_response(response, options)\n end",
"def check_for_payment_addresses(parties)\n out = []\n parties.each do |party|\n res = party.self_check\n party.errors.map{|err| @errors << \"Party #{ party.name } #{ err }\"} unless res == true\n out << res\n end\n \n out.include?(false)\n end",
"def valid?\n return false if @occurred_at.nil?\n return false if !@description.nil? && @description.to_s.length < 0\n return false if @city_locality.nil?\n return false if @city_locality.to_s.length < 0\n return false if @state_province.nil?\n return false if @state_province.to_s.length < 2\n return false if @postal_code.nil?\n return false if @postal_code.to_s.length < 5\n return false if !@company_name.nil? && @company_name.to_s.length < 0\n return false if !@signer.nil? && @signer.to_s.length < 0\n return false if !@event_code.nil? && @event_code.to_s.length < 0\n return false if !@latitude.nil? && @latitude > 90\n return false if !@latitude.nil? && @latitude < 0\n return false if !@longitude.nil? && @longitude > 180\n return false if !@longitude.nil? && @longitude < 0\n true\n end",
"def addresses_set\n if @cart.shipping_address.nil?\n redirect_to :action=>'shipping_address'\n return false\n elsif @cart.billing_address.nil?\n redirect_to :action=>'billing_address'\n return false\n end\n end",
"def validate(address)\n result = fetch_result(address)\n return result.verified? || result.unknown?\n end",
"def zipcode_matches_state?\n zipArray = Array.new\n zipArray[0] = /CT|MA|ME|NH|NJ|RI|VT/\n zipArray[1] = /DE|NY|PA/\n zipArray[2] = /DC|MD|NC|SC|VA|WV/\n zipArray[3] = /AL|FL|GA|MS|TN/\n zipArray[4] = /IN|KY|MI|OH/\n zipArray[5] = /IA|MN|MT|ND|SD|WI/\n zipArray[6] = /IL|KY|MO|NE/\n zipArray[7] = /AR|LA|OK|TX/\n zipArray[8] = /AZ|CO|ID|NM|NV|UT|WY/\n zipArray[9] = /AK|CA|HI|OR|WA/\n (zipArray[postalcode.chars.first.to_i] =~ province) != nil\n end",
"def set_postal_address\n\n\tpostal_address = PostalAddress.find_by_postal_address_type_code_and_city_and_address1_and_address2(self.postal_address_type_code,self.city,self.address1,self.address2)\n\t if postal_address != nil \n\t\t self.postal_address = postal_address\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'postal_address_type_code' and 'city' and 'address1' and 'address2' is invalid- it must be unique\")\n\t\t return false\n\tend\nend",
"def success?\n return false unless @result['status'] == 'OK'\n return false unless @result['results'][0]['address_components'].length > 1\n true\n end",
"def should_be_set_to_draft?\n return false if self.draft?\n self.payin_rules.any?{|pr| pr.changed?} || self.ad_images.any?{|ai| ai.changed? } || self.location.changed? || self.changes.except('status','refusal_reason').present?\n end",
"def checkAddr(before, after, instruction)\n\ta = instruction[1] #reg\n\tb = instruction[2] #reg\n\tc = instruction[3] #reg\n\n\treturn after[c] == before[a] + before[b]\nend",
"def vat_number_expected?\n return false unless has_billing?\n billing_address.country != store.country\n end",
"def can_update_ethereum_address?(user_kyc_detail)\n return true if user_kyc_detail.present? && (!user_kyc_detail.case_closed?)\n return false\n end",
"def any_changed?(*fields)\n fields.any? do |field|\n model_field = self.class.model_field_cache_inverse[field]\n value_changed = true\n\n if model_field\n value_changed = send(model_field).send(field) != send(field)\n end\n\n given?(field) && value_changed\n end\n end",
"def check(address,from)\n self.set_address(address,from)\n @message=[]\n puts \"checking #{@address}\"\n ['format','mx','smtp'].each { |cmd| \n cmdstring=\"check_#{cmd}\"\n res,msg= self.send(cmdstring)\n @flag=@flag && res\n @message << msg }\n [@flag,@message.join(',').to_s]\n end",
"def waypoints_changed?\n changed = false\n waypoints.each do |waypoint|\n changed |= waypoint.changed? || waypoint.marked_for_destruction?\n end\n changed\n end",
"def validate_for_sent?\n [\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n #:first_name,\n #:last_name,\n :serial_number\n ].detect { |attr| self.send(attr).blank? }.nil?\n end",
"def update_any_data?\n add_name? || add_events? || set_wheel_sizes? || add_volunteers? || add_contact_details? || lodging? || expenses? || set_organization_membership?\n end",
"def will_save_change_to_email?\n changed.include? 'email'\n end",
"def address(input)\n\t(/[0-9]{4}(\\s|\\,){1}(.+?)(\\s|\\,){1}(?i)((str)|(street)|(ave)|(avenue)|(rd)|(road)|(blvd)|(boulevard))(\\.)?/i =~ input)? \"true\" : \"false\"\nend",
"def check?(fields)\n @bindings.any? { |group| group.all? { |binding| binding.check?(fields) } }\n end",
"def valid?\n return false if @default_from_address.nil?\n return false if @default_from_address.to_s.length > 50\n return false if @portal_url_override.nil?\n return false if @portal_url_override.to_s.length > 100\n return false if @site_url.nil?\n return false if @site_url.to_s.length > 100\n return false if !@logo_path.nil? && @logo_path.to_s.length > 200\n contact_sync_validator = EnumAttributeValidator.new('String', [\"FL\", \"LF\", \"CFL\", \"CLF\"])\n return false unless contact_sync_validator.valid?(@contact_sync)\n return false if @server_time_zone.nil?\n return false if @default_calendar.nil?\n return false if @default_address_format.nil?\n return true\n end",
"def gmaps\n return true if resource_type == 'Web'\n return false if read_attribute(:gmaps) == false # lets us flag entries for re-processing manually\n !(street_address_changed? or city_changed? or country_changed? or postal_changed?)\n end",
"def event_passable_check?(new_x, new_y, z, game_map)\n game_map.events.each_value do |event|\n next unless event.contact?(new_x, new_y, z)\n next if event.through\n return false unless event.character_name.empty?\n end\n return true\n end",
"def has_town?\n !!province_c and !!county_c and !!town_c\n end",
"def is_ok ( addr )\n\tindex = addr - @base\n\treturn true if @map[index] == \"X\"\n\treturn true if @map[index] == \"I\"\n\treturn false\n end",
"def has_city?\n \thas?(params[:state_id]) and has?(params[:city_id])\n end",
"def border_points_changed?\n changed = false\n border_points.each do |point|\n changed |= point.latitude_changed? || point.longitude_changed? || point.marked_for_destruction?\n end\n changed\n end"
] |
[
"0.88526523",
"0.8323529",
"0.7554205",
"0.7497203",
"0.74474555",
"0.74288017",
"0.7410452",
"0.7330024",
"0.7250618",
"0.72253186",
"0.70726055",
"0.70486546",
"0.7045269",
"0.7023302",
"0.6990546",
"0.6892447",
"0.6883941",
"0.687011",
"0.6840467",
"0.6832624",
"0.6819438",
"0.6786615",
"0.6761704",
"0.6753966",
"0.6734478",
"0.6614882",
"0.6502735",
"0.65002275",
"0.645413",
"0.64491695",
"0.6403589",
"0.6378828",
"0.63666314",
"0.6365546",
"0.63621616",
"0.63253915",
"0.6322893",
"0.629408",
"0.62689555",
"0.62498057",
"0.62410235",
"0.623265",
"0.6179059",
"0.6176689",
"0.6163863",
"0.61612236",
"0.61550206",
"0.61505234",
"0.61218894",
"0.61218894",
"0.6113948",
"0.6094442",
"0.6090482",
"0.6080656",
"0.6073929",
"0.6023813",
"0.6005497",
"0.60052776",
"0.59743845",
"0.59630626",
"0.5959151",
"0.59564054",
"0.5953585",
"0.5947671",
"0.5908493",
"0.58886415",
"0.5888446",
"0.5885221",
"0.5879445",
"0.58579147",
"0.58464503",
"0.5836804",
"0.5790874",
"0.57807976",
"0.5780227",
"0.5776115",
"0.5772881",
"0.57643163",
"0.574489",
"0.5722913",
"0.5717999",
"0.5706141",
"0.5690082",
"0.567617",
"0.56717193",
"0.56711304",
"0.5669044",
"0.56621957",
"0.56604975",
"0.5656662",
"0.56480575",
"0.5643766",
"0.56411725",
"0.5640247",
"0.56378657",
"0.56279695",
"0.56271493",
"0.5618336",
"0.56082946",
"0.55909616",
"0.5590592"
] |
0.0
|
-1
|
GET /calendars/1 GET /calendars/1.xml
|
def show
@calendar = Calendar.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @calendar }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end",
"def calendar\n get '/gtfs/calendar'\n end",
"def calendar_events(calendar_id)\n records \"/calendars/#{calendar_id}/calendar_events.xml\", :method => :get\n end",
"def list_calendars\n unless @calendars\n xml = send(Addressable::URI.parse(\"#{BASE_URI}/default/allcalendars/full\"), :get)\n @calendars = Nokogiri::XML(xml.body)\n @calendars.remove_namespaces!\n end\n @calendars\n end",
"def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\n end",
"def index\n\t@events = @calendar.events(:order => 'created_at ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def show\n respond_to do |format|\n format.html do\n @date = Date.parse(params[:date]) rescue Date.today\n @date = Date.today if !@date.valid_gregorian_date?\n\n raise ActiveRecord::RecordNotFound if params[:date].present? && !@calendar.calendar_items.date_in_range?(@date)\n\n @calendar_items = @calendar.calendar_items.find_all_for_month_of(@date).group_by { |ci| ci.start_time.mday }\n end\n format.any(:rss, :atom) do\n @calendar_items = @calendar.calendar_items.accessible.all(:include => :node, :order => 'start_time', :conditions => [ 'nodes.ancestry = ? ', @calendar.node.child_ancestry ])\n render :layout => false\n end\n format.xml { render :xml => @calendar }\n end\n end",
"def calendar_list\n\t\t logger.info(\"-- get_calendar_list_responce st --\") if logger\n\t\t auth unless @auth\n\t\t uri = URI.parse(CALENDAR_LIST_PATH)\n\t\t res = do_get(uri, {})\n\t\t logger.info(\"-- get_calendar_list_responce en(#{res.message}) --\") if logger\n\t\t res\n\t\tend",
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def calendar_list\r\n logger.info(\"-- calendar list st --\") if logger\r\n auth unless @auth\r\n uri = URI.parse(CALENDAR_LIST_PATH)\r\n res = do_get(uri, {})\r\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\r\n res\r\n end",
"def events(param = nil)\n request = new_request Net::HTTP::Report do |request|\n request.body = CalendarQuery.new.event(param).to_xml\n end\n response = perform_request request\n \n events = []\n \n body = Nokogiri::XML.parse(response.body)\n namespaces = { 'dav' => \"DAV:\", 'caldav' => 'urn:ietf:params:xml:ns:caldav' }\n \n body.search(\"./dav:multistatus/dav:response\", namespaces).each do |element|\n calendar_data = element.search(\"./dav:propstat/dav:prop/caldav:calendar-data\", namespaces)\n calendar = Icalendar::Parser.new(calendar_data.text).parse.first\n calendar.events.each do |event|\n event.caldav = {\n :etag => element.search(\"dav:propstat/dav:prop/dav:getetag\", namespaces).text, \n :href => element.search(\"dav:href\", namespaces).text\n }\n events += calendar.events\n end\n end\n \n events\n end",
"def show\n @menu_calendar = MenuCalendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @menu_calendar }\n end\n end",
"def show\n @calendario = Calendario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def get_calendar_list()\n\t\tif(!@client.nil?)\n\t\t\tresponse = @client.execute(api_method: @service.calendar_list.list)\n\t\t\tcalendars = JSON.parse(response.body)\n\t\telse\n\t\t\tputs \"Client No Calendar boi\"\n\t\tend\n\tend",
"def show\n @calendar_event = CalendarEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar_event }\n end\n end",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @calendars = Calendar.all\n end",
"def index\n @calendars = Calendar.all\n end",
"def show\n @track_calendar = TrackCalendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @track_calendar }\n end\n end",
"def index\n @calendar = Calendar.find(1)\n end",
"def show\n @calendar = Calendar.find(params[:id])\n @events = Event.find(@calendar.event_ids)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @calendar }\n end\n end",
"def index\n @calendars = Event.all\n end",
"def show\n @google_calendar = GoogleCalendar.find_by_hashed_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @google_calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar }\n end\n end",
"def index\n url = 'https://churchofjesuschrist.org/church-calendar/services/lucrs/ical/group/b03afe3544134ca59a839688d454fb2b'\n \n begin\n raw_file = URI.parse(url).read\n calendar = Calendar.create_or_find_by(url: url)\n calendar.update(raw: raw_file)\n rescue OpenURI::HTTPError => e\n logger.debug e\n raw_file = Calendar.find_by(url: url).raw\n end\n\n ical = Icalendar::Calendar.parse(raw_file).first\n\n events_by_month = ical.events.reverse.inject({}) do |by_month, event|\n month = DateTime::MONTHNAMES[event.dtstart.to_datetime.month]\n by_month[month] ? by_month[month] << event : by_month[month] = [event]\n by_month\n end\n\n @icalendar = OpenStruct.new(\n events: ical.events,\n events_by_month: events_by_month\n )\n end",
"def calendars\n page_token = nil\n result = execute(:api_method => service.calendar_list.list)\n entries = []\n while true\n entries += result.data.items\n if !(page_token = result.data.next_page_token)\n break\n end\n result = execute(:api_method => service.calendar_list.list,\n :parameters => {'pageToken' => page_token})\n end\n\n entries\n end",
"def get_calendar(calendar_id = 'primary')\n execute(:api_method => service.calendars.get, :parameters => { 'calendarId' => calendar_id }).data\n end",
"def index\n @items = Item.recent\n respond_to do |format|\n format.html\n format.json\n format.ics do\n calendar = Icalendar::Calendar.new\n calendar.append_custom_property('X-WR-CALNAME', \"amzn-ics\")\n @items.each do |item|\n calendar.add_event(item.to_ics(request.host))\n end\n calendar.publish\n render text: calendar.to_ical\n end\n end\n end",
"def index\n @calendarios_entrega = CalendarioEntrega.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendarios_entrega }\n end\n end",
"def calendar_list\n logger.info(\"-- calendar list st --\") if logger\n auth unless @auth\n uri = URI.parse(CALENDAR_LIST_PATH + @email)\n res = do_get(uri, {})\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\n res\n end",
"def index\n @events = Event.upcoming.order(:start_time)\n @events_cal = Event.ical(@events) if params[:format] == 'ics'\n end",
"def get_user_calendar_xml # :nodoc:\n response = session.get(USER_FEED)\n Nokogiri::XML(response.body)\n end",
"def index\n if params[:month]\n month = Date::parse(params[:month])\n conditions = ['begins_at between ? and ?', month, (month+1.month-1.day)]\n else\n if not granted_for? 'events'\n conditions = ['begins_at >= ?', Date::today() ]\n else\n conditions = ['1 = 1' ]\n end\n end\n \n \n \n @events = Event.find(:all, :conditions => conditions, :order => \"begins_at\" )\n if @events.length < 1\n flash[:error] = _('Sorry, no events found')\n end\n\n respond_to do |format|\n format.html \n format.rss \n format.xml { render :xml => @events }\n end\n end",
"def send_calendar_request(path_and_query_string, method, content = '')\n @connection.send(\"/calendars#{path_and_query_string}\", method, content)\n end",
"def index_for_calendar\n # build_calendar_data --> AppointmentsHelper method\n render json: build_calendar_data, status: 200\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def show\n @calendario_entrega = CalendarioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendario_entrega }\n end\n end",
"def index\n @events = Event.order(:time).order(:date)\n \n fetch_calendar 'tgbgmclhk5gegn8t95fvqov0s8@group.calendar.google.com'\n end",
"def show\n @calendar = @combined_calendar\n\n respond_to do |format|\n format.html { render :partial => '/admin/calendars/show', :layout => 'admin/admin_show' }\n format.xml { render :xml => @combined_calendar }\n end\n end",
"def retrieve_calendar\n response = send_calendar_request(\"/#{@id}\", :get)\n @raw = JSON.parse(response.body)\n instance_variable_set(:@summary, @raw['summary'])\n instance_variable_set(:@location, @raw['location'])\n instance_variable_set(:@description, @raw['description'])\n instance_variable_set(:@time_zone, @raw['timeZone'])\n @html_link = @raw['htmlLink']\n\n self\n end",
"def new\n @calendar_event = CalendarEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar_event }\n end\n end",
"def index\n @calendar_events = CalendarEvent.page(params[:page])\n end",
"def show\n @calendar_date = CalendarDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar_date }\n end\n end",
"def index\n respond_to do |format|\n @events = event_finder\n @title = Radiant::Config['event_calendar.feed_title'] || \"#{Radiant::Config['admin.title']} Events\"\n @description = list_description\n @description = \"All future events\" if @description.blank?\n format.js {\n @venues = @events.map(&:event_venue).uniq\n @venue_events = {}\n @events.each do |e|\n @venue_events[e.event_venue.id] ||= []\n @venue_events[e.event_venue.id].push(e)\n end\n }\n format.rss {\n @version = params[:rss_version] || '2.0'\n @link = list_url\n }\n format.ics {\n headers[\"Content-disposition\"] = %{attachment; filename=\"#{list_filename}.ics\"}\n }\n end\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def show\n @calendar_event = CalendarEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar_event }\n end\n end",
"def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def search_for_future_calendar_events\n uri = URI.parse(\"https://www.googleapis.com/calendar/v3/calendars/ufbobbo%40gmail.com/events?orderBy=startTime&singleEvents=true&timeMin=#{Time.now.strftime(\"%FT%T%:z\")}&fields=items(id%2Cstart)&key=#{ENV['GOOGLE_API_KEY']}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request).body\n end",
"def find_calendar\n @calendar = @node.content\n end",
"def scrape_calendar\n begin\n objects = objects_from_event_api\n objects.select! {|o| DateTime.strptime(o['start'],'%Y-%m-%d') > DateTime.now }\n activities = objects_to_activities(objects)\n return process_calendar(activities)\n rescue Exception => e\n return format_error(e)\n end\n end",
"def index\n verify_owner(params[:gcal_id])\n\n calendar_list = @current_user.calendar_list\n calendar = calendar_list.calendars.find_or_create_by(gcal_id: params[:gcal_id])\n calendar.sync!(@current_user.access_token) if not calendar.synced?\n\n render json: calendar.json_data\n end",
"def index\n @calendar_days = CalendarDay.all\n end",
"def list\n if params[:month]\n month = Date::parse(params[:month])\n conditions = ['begins_at between ? and ?', month, (month+1.month-1.day)]\n else\n conditions = ['begins_at >= ?', Date::today() ]\n end\n \n @events = Event.find(:all, :conditions => conditions, :order => \"begins_at\" )\n if @events.length < 1\n flash[:error] = _('Sorry, no events found')\n end\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @events }\n end\n end",
"def index\n @events = Event.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def new\n @google_calendar = GoogleCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @google_calendar }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n @calender_events = CalenderEvent.all\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def calendar(filter = { status: 'Coming', zone: 'Real' })\n page = load_page @cal_url, filter\n page_number = parse_max_page(page, 'GameCalendar.aspx')\n return parse_calendar_page(page) if filter.key? :page\n 1.upto(page_number).flat_map do |i|\n page = load_page @cal_url, filter.merge(page: i)\n parse_calendar_page(page)\n end\n end",
"def get_payroll_calendars(options = {})\n request_params = {}\n response_xml = http_get(client, \"#{@payroll_url}/PayrollCalendars\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/payroll_calendars'})\n end",
"def index\n @month_now = (Time.zone || Time).now.month.to_i\n @year_now = (Time.zone || Time).now.year.to_i\n @month = (params[:month] || (Time.zone || Time).now.month).to_i\n @year = (params[:year] || (Time.zone || Time).now.year).to_i\n @day = (params[:day] || (Time.zone || Time).now.day).to_i\n @last_month_start = Date.new(@year_now, @month_now-1).to_time\n @month_start = Date.new(@year, @month).to_time\n @month_end = Date.new(@year, @month+1).to_time\n @next_year_end = Date.new(@year_now+2, 1).to_time\n\n @shown_month = Date.civil(@year, @month)\n\n @events = Event.where(\"end_at BETWEEN :month_start AND :month_end OR start_at BETWEEN :month_start AND :month_end\", {:month_start => @month_start, :month_end => @month_end})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n\t \tformat.ics do\n\t\t\t\tsend_data(\texport_ical_range(@last_month_start,@next_year_end).export,\n\t\t\t\t\t\t\t\t\t\t:filename=>\"reisebuero_events.ics\",\n\t\t\t\t\t\t\t\t\t\t:disposition=>\"inline; filename=reisebuero_events.ics\",\n\t\t\t\t\t\t\t\t\t\t:type=>\"text/calendar\")\n\t\t\tend\n end\n end",
"def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html\n format.json\n format.rss { render :layout => false }\n end\n end",
"def show\n @appt_calendar = ApptCalendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appt_calendar }\n end\n end",
"def calendar\n\t\t@pagenumber=154\n\t\tdata=params\n\t\tsession[:referer] = nil\n\t\tget_report_favourites\n\t\tset_date_and_month_for_calendar(data)\n\t\t@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), :month)\n\t\tget_receiver_and_provider\n\t\t@calendar.time_entries = Physical::Timeandexpenses::TimeEntry.find(:all,:conditions => ['employee_user_id = ? and (time_entry_date BETWEEN ? and ? ) and matter_people_id is null', @receiver.id, @calendar.startdt, @calendar.enddt ])\n\t\tif request.xhr?\t\t\t\n\t\t\trender :partial=> \"content\"\n\t\telse\n\t\t\trender :layout => \"left_with_tabs\"\n\t\tend\n\tend",
"def show\n @calmapp = Calmapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calmapp }\n end\n end",
"def new\n @menu_calendar = MenuCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_calendar }\n end\n end",
"def new\n @track_calendar = TrackCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track_calendar }\n end\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def index\n @calendar_dates = CalendarDate.all\n end",
"def show\n @events_by_year = EventsByYear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @events_by_year }\n end\n end",
"def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end",
"def index\n @commission_days = CommissionDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commission_days }\n end\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def calendars\n if @event.travels_done?\n if current_user.expired == 1\n render :nothing => true, :status => :unauthorized\n else\n render :json => @event.to_json, :status => :ok\n end\n elsif @event.canceled?\n render :nothing => true, :status => :gone\n else\n render :nothing => true, :status => :not_found\n end\n end",
"def index\n log_request(\"Show All Schedules\")\n\n @schedules = Schedule.all\n\n @response = {\n \tevents: @schedules\n }\n\n respond_to do |format|\n format.html { @schedules }\n format.json { render :json => @response }\n end\n end",
"def show\n @schedule = schedule\n respond_to do |format|\n format.html do\n @broadcasts = schedule.broadcasts_and_gaps(Time.now.utc, 1.day.from_now.utc) \n # renders show.html.erb\n end\n format.xml do \n except = [:id, :created_at, :updated_at]\n render :xml => @schedule.to_xml(:except => except)\n end\n end\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def calendar_by_service(service_id)\n get \"/gtfs/calendar/serviceId/#{service_id}\"\n end",
"def index\n @rooms = Room.all\n @meetings = Meeting.all\n respond_to do |format|\n format.html\n format.ics do\n cal = Icalendar::Calendar.new\n @meetings.each do |meeting|\n event = Icalendar::Event.new\n event.dtstart = meeting.start_at\n event.dtend = meeting.end_at\n event.summary = meeting.notes\n event.description = meeting.room.name\n cal.add_event(event)\n end\n render :text => cal.to_ical\n end\n end\n end",
"def index\n @shop_calendars = ShopCalendar.all\n end",
"def mini_calendar\n if request.request_uri == '/'\n params[:id] = Time.now.strftime('%Y-%m-%d')\n end\n \n @calendars = Calendar.all\n \n selection = DateTime.strptime(\"#{params[:id]}T00:00:00+00:00\")\n \n prev_month = selection.advance :months => -1\n next_month = selection.advance :months => 1\n \n calendar( :month => selection.strftime(\"%m\").to_i,\n :year => selection.strftime(\"%Y\").to_i,\n :show_today => true,\n :abbrev => (0..0),\n :previous_month_text => (link_to \"#{image_tag '/images/left_arrow.gif', :alt => 'Previous Month'}\", \"/calendar_list/#{prev_month.strftime('%Y-%m-%d')}\"),\n :next_month_text => (link_to \"#{image_tag '/images/right_arrow.gif', :alt => 'Next Month'}\", \"/calendar_list/#{next_month.strftime('%Y-%m-%d')}\")) do |d|\n cell_text = \"#{d.mday}<br />\"\n cell_attrs = {:class => 'day'}\n @calendars.each do |e|\n #if (e.start_date.day == d.day) || ( e.start_date <= d && e.end_date >= d )\n if ((e.start_date.year == d.year) && (e.start_date.month == d.month) && (e.start_date.day == d.day)) || ( e.start_date <= d && e.end_date >= d )\n cell_attrs[:class] = 'specialDay'\n cell_text = link_to \"#{d.mday}<br />\", \"/daily_event/#{d}\"\n end\n end\n [cell_text, cell_attrs]\n end\n end",
"def show\n @calendar_item = CalendarItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar_item }\n end\n end",
"def index\n\tredirect_to new_availability_calendar_path\n end",
"def get_calendar_json(url)\n require 'open-uri'\n require 'iconv'\n\n open(url) do |page|\n calendarJson = page.read\n end\n end",
"def index\n @events = Event.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n format.json { render :json=>@events } \n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @calendar }\n end\n end",
"def get_events\n @doc.css(\"#cal-event-entry\")\n end"
] |
[
"0.83324295",
"0.7815758",
"0.73857427",
"0.73124325",
"0.7286438",
"0.7247076",
"0.7195674",
"0.71288174",
"0.70427966",
"0.7022576",
"0.69627964",
"0.695235",
"0.69320506",
"0.69304955",
"0.69044256",
"0.680493",
"0.67488253",
"0.6747682",
"0.6746255",
"0.67403746",
"0.67245126",
"0.6702879",
"0.6661771",
"0.66562116",
"0.66562116",
"0.66562116",
"0.66562116",
"0.66562116",
"0.66549444",
"0.66549444",
"0.6646758",
"0.66159976",
"0.66130465",
"0.65306485",
"0.65291524",
"0.6529107",
"0.6519903",
"0.64490235",
"0.6428771",
"0.64284366",
"0.64264286",
"0.641221",
"0.64050096",
"0.6392813",
"0.63841677",
"0.63570625",
"0.6337934",
"0.63353807",
"0.63087165",
"0.62978405",
"0.6272351",
"0.6269883",
"0.6264025",
"0.62447864",
"0.6244536",
"0.62286335",
"0.6204825",
"0.6203355",
"0.6199379",
"0.6198937",
"0.6194345",
"0.6193014",
"0.61620915",
"0.6160679",
"0.6160679",
"0.6160679",
"0.6160679",
"0.6154769",
"0.6145301",
"0.6135963",
"0.6120085",
"0.6109702",
"0.6094327",
"0.60938174",
"0.6083565",
"0.6078071",
"0.606873",
"0.6060663",
"0.60595906",
"0.60537726",
"0.6051211",
"0.6045944",
"0.6042845",
"0.6038146",
"0.6032261",
"0.603113",
"0.60297596",
"0.6014009",
"0.60044813",
"0.60011303",
"0.59974724",
"0.59910166",
"0.59904456",
"0.59860724",
"0.5972558",
"0.59710294",
"0.5969276",
"0.59598035",
"0.59529144"
] |
0.7297926
|
5
|
GET /calendars/new GET /calendars/new.xml
|
def new
@calendar = Calendar.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @calendar }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def new\n @calendar_event = CalendarEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar_event }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @calendar }\n end\n end",
"def new\n @track_calendar = TrackCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track_calendar }\n end\n end",
"def new\n @menu_calendar = MenuCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_calendar }\n end\n end",
"def new\n @google_calendar = GoogleCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @google_calendar }\n end\n end",
"def new\n @calendario_entrega = CalendarioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario_entrega }\n end\n end",
"def new\n @calendar_event = CalendarEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar_event }\n end\n end",
"def calendar\n get '/gtfs/calendar'\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(@calendar) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @calendar_date = CalendarDate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar_date }\n end\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendario }\n end\n end",
"def new\n @events_by_year = EventsByYear.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @events_by_year }\n end\n end",
"def new\n @event = Event.new_default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end",
"def new\n @appt_calendar = ApptCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @appt_calendar }\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @calification = Calification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calification }\n end\n end",
"def new\n @the_day = TheDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @the_day }\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @event = Event.new\n @title = 'New Event'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @calendar_item = CalendarItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar_item }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @schedule = Schedule.new\n @apps = App.find(:all)\n @tags = Contact.get_tags\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n load_dependents\n @training_calendar = TrainingCalendar.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @training_calendar }\n end\n end",
"def new\n setup_variables\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @event }\n end\n end",
"def new\n @schedule = Schedule.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @event = Event.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n @page_title = \"Add an Event\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @simple_event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simple_event }\n end\n end",
"def new\n @event = Event.new\n setup_accounts\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @class_schedule = ClassSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @class_schedule }\n end\n end",
"def new\n @evento = Evento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evento }\n end\n end",
"def create\n\t@calendar = @user.calendars.build(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @commission_day = CommissionDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commission_day }\n end\n end",
"def new\n @event = Event.new\n @event.event_dates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def new\n @maintenance_schedule = MaintenanceSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n @organisation = Organisation.find(params[:organisation_id])\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = IndrelEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @event }\n end\n end",
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def create\n @track_calendar = TrackCalendar.new(params[:track_calendar])\n\n respond_to do |format|\n if @track_calendar.save\n flash[:notice] = 'TrackCalendar was successfully created.'\n format.html { redirect_to(track_calendars_url) }\n format.xml { render :xml => @track_calendar, :status => :created, :location => @track_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @track_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @availability_day = AvailabilityDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @availability_day }\n end\n end",
"def new\n @holidaymaster = Holidaymaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @holidaymaster }\n end\n end",
"def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end",
"def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end",
"def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end",
"def create\n @calendar = Calendar.find(params[:calendar_id])\n\t@event = @calendar.events.build(params[:event])\n\t@event.finished = 0;\n\t\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n\t\t\t\tics_for_all #######\n\t\t\t\tformat.html { redirect_to(@calendar) }\n\t\t\t\tformat.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def http_mk_calendar(request, _response)\n body = request.body_as_string\n path = request.path\n\n properties = {}\n\n unless body.blank?\n begin\n mkcalendar = @server.xml.expect(\n '{urn:ietf:params:xml:ns:caldav}mkcalendar',\n body\n )\n rescue Tilia::Xml::ParseException => e\n raise Dav::Exception::BadRequest, e.message\n end\n\n properties = mkcalendar.properties\n end\n\n # iCal abuses MKCALENDAR since iCal 10.9.2 to create server-stored\n # subscriptions. Before that it used MKCOL which was the correct way\n # to do this.\n #\n # If the body had a {DAV:}resourcetype, it means we stumbled upon this\n # request, and we simply use it instead of the pre-defined list.\n if properties.key?('{DAV:}resourcetype')\n resource_type = properties['{DAV:}resourcetype'].value\n else\n resource_type = ['{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar']\n end\n\n @server.create_collection(path, Dav::MkCol.new(resource_type, properties))\n\n @server.http_response.status = 201\n @server.http_response.update_header('Content-Length', 0)\n\n # This breaks the method chain.\n false\n end",
"def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end",
"def new\n @month = Month.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @month }\n end\n end",
"def create\n @availability_calendar = AvailabilityCalendar.new(params[:availability_calendar])\n\n respond_to do |format|\n if @availability_calendar.save\n format.html { redirect_to(@availability_calendar, :notice => 'Availability calendar was successfully created.') }\n format.xml { render :xml => @availability_calendar, :status => :created, :location => @availability_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @availability_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @bday = Bday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bday }\n end\n end",
"def new\n category\n @categories = Category.order('name')\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @appointment = Appointment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def new\n @appointment = Appointment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @appointment = Appointment.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def new\n @appointment = Appointment.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eventtime }\n end\n end",
"def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"def new\n @calidadtiposdocumento = Calidadtiposdocumento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calidadtiposdocumento }\n end\n end",
"def new\n @event_schedule = EventSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_schedule }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n format.json { render :json => @appointment }\n end\n end",
"def new\n @eventual = Eventual.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eventual }\n end\n end",
"def new\n @event = Event.new\n @page_title=\"Add Race\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n #@calendar_guess = CalendarGuess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar_guess }\n end\n end",
"def new\n \t@conference = Conference.find(params[:conference_id])\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day }\n end\n end",
"def new\n @work_day = WorkDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_day }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def new\n @create_event = CreateEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_event }\n end\n end",
"def new\n @calificacion = Calificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calificacion }\n end\n end"
] |
[
"0.75729984",
"0.7558967",
"0.7361929",
"0.7361929",
"0.73416984",
"0.73271686",
"0.7290582",
"0.71744484",
"0.71178424",
"0.7048005",
"0.7029269",
"0.70134854",
"0.69354343",
"0.69273424",
"0.6912992",
"0.6858443",
"0.68197453",
"0.6809624",
"0.67458385",
"0.6713474",
"0.671284",
"0.6695047",
"0.66932863",
"0.66759205",
"0.6669895",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.666617",
"0.66640705",
"0.66591126",
"0.6658744",
"0.6651797",
"0.664796",
"0.6613095",
"0.66054296",
"0.66046697",
"0.65859574",
"0.65679413",
"0.6546287",
"0.6542488",
"0.6513678",
"0.6500043",
"0.6485942",
"0.64636916",
"0.645815",
"0.6449944",
"0.64395964",
"0.6431856",
"0.6431015",
"0.64074636",
"0.6406634",
"0.6406406",
"0.63883454",
"0.637918",
"0.63751674",
"0.63751674",
"0.63751674",
"0.6373738",
"0.6351621",
"0.63498586",
"0.63465977",
"0.63267386",
"0.6315888",
"0.63153666",
"0.6308958",
"0.6308958",
"0.62994206",
"0.62990606",
"0.62966156",
"0.62966156",
"0.62915707",
"0.62915707",
"0.62913686",
"0.6290832",
"0.6288588",
"0.6287575",
"0.62817425",
"0.6275136",
"0.6267959",
"0.62678486",
"0.62677974",
"0.6267091",
"0.6263574",
"0.625662",
"0.62556124",
"0.6255544"
] |
0.7901439
|
3
|
POST /calendars POST /calendars.xml
|
def create
@calendar = Calendar.new(params[:calendar])
respond_to do |format|
if @calendar.save
flash[:notice] = 'Calendar was successfully created.'
format.html { redirect_to(@calendar) }
format.xml { render :xml => @calendar, :status => :created, :location => @calendar }
else
format.html { render :action => "new" }
format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end",
"def http_mk_calendar(request, _response)\n body = request.body_as_string\n path = request.path\n\n properties = {}\n\n unless body.blank?\n begin\n mkcalendar = @server.xml.expect(\n '{urn:ietf:params:xml:ns:caldav}mkcalendar',\n body\n )\n rescue Tilia::Xml::ParseException => e\n raise Dav::Exception::BadRequest, e.message\n end\n\n properties = mkcalendar.properties\n end\n\n # iCal abuses MKCALENDAR since iCal 10.9.2 to create server-stored\n # subscriptions. Before that it used MKCOL which was the correct way\n # to do this.\n #\n # If the body had a {DAV:}resourcetype, it means we stumbled upon this\n # request, and we simply use it instead of the pre-defined list.\n if properties.key?('{DAV:}resourcetype')\n resource_type = properties['{DAV:}resourcetype'].value\n else\n resource_type = ['{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar']\n end\n\n @server.create_collection(path, Dav::MkCol.new(resource_type, properties))\n\n @server.http_response.status = 201\n @server.http_response.update_header('Content-Length', 0)\n\n # This breaks the method chain.\n false\n end",
"def calendar\n get '/gtfs/calendar'\n end",
"def create\n\t@calendar = @user.calendars.build(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.find(params[:calendar_id])\n\t@event = @calendar.events.build(params[:event])\n\t@event.finished = 0;\n\t\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n\t\t\t\tics_for_all #######\n\t\t\t\tformat.html { redirect_to(@calendar) }\n\t\t\t\tformat.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: \"Calendar was successfully created.\" }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @availability_calendar = AvailabilityCalendar.new(params[:availability_calendar])\n\n respond_to do |format|\n if @availability_calendar.save\n format.html { redirect_to(@availability_calendar, :notice => 'Availability calendar was successfully created.') }\n format.xml { render :xml => @availability_calendar, :status => :created, :location => @availability_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @availability_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def send_calendar_request(path_and_query_string, method, content = '')\n @connection.send(\"/calendars#{path_and_query_string}\", method, content)\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.user_id = session[:user_id]\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to(@calendar, :notice => 'Calendar was successfully created.') }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_succeed_no_calendars\n # Deleting calendars\n @caldav_backend.delete_calendar(1)\n @caldav_backend.delete_calendar(2)\n\n @server.http_request = Http::Request.new(\n 'POST',\n '/calendars/user1/outbox',\n 'Content-Type' => 'text/calendar'\n )\n\n body = <<ICS\nBEGIN:VCALENDAR\nMETHOD:REQUEST\nBEGIN:VFREEBUSY\nORGANIZER:mailto:user1.sabredav@sabredav.org\nATTENDEE:mailto:user2.sabredav@sabredav.org\nDTSTART:20110101T080000Z\nDTEND:20110101T180000Z\nEND:VFREEBUSY\nEND:VCALENDAR\nICS\n\n @server.http_request.body = body\n\n # Lazily making the current principal an admin.\n @acl_plugin.admin_principals << 'principals/user1'\n\n refute(\n @plugin.http_post(@server.http_request, @response)\n )\n\n assert_equal(200, @response.status)\n assert_equal(\n { 'Content-Type' => ['application/xml'] },\n @response.headers\n )\n\n strings = [\n '<d:href>mailto:user2.sabredav@sabredav.org</d:href>',\n '<cal:request-status>2.0;Success</cal:request-status>'\n ]\n\n strings.each do |string|\n assert(\n @response.body.index(string),\n \"The response body did not contain: #{string} Full response: #{@response.body}\"\n )\n end\n end",
"def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @track_calendar = TrackCalendar.new(params[:track_calendar])\n\n respond_to do |format|\n if @track_calendar.save\n flash[:notice] = 'TrackCalendar was successfully created.'\n format.html { redirect_to(track_calendars_url) }\n format.xml { render :xml => @track_calendar, :status => :created, :location => @track_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @track_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index_for_calendar\n # build_calendar_data --> AppointmentsHelper method\n render json: build_calendar_data, status: 200\n end",
"def index\n verify_owner(params[:gcal_id])\n\n calendar_list = @current_user.calendar_list\n calendar = calendar_list.calendars.find_or_create_by(gcal_id: params[:gcal_id])\n calendar.sync!(@current_user.access_token) if not calendar.synced?\n\n render json: calendar.json_data\n end",
"def write_travels_to_calendar\n @event.write_travels_to_calendar\n render :json => @event.to_json, :status => :ok\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.user_id = current_user.id\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, :notice => 'Calendar was successfully created.' }\n format.json { render :json => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n dstart = Date.new(@calendar.year_c, 1, 1)\n dfinish = Date.new(@calendar.year_c + 1, 1, 1)\n while dstart < dfinish\n cld = Calendar.new\n cld.year_c = @calendar.year_c\n cld.date_c = dstart\n cld.is_output = (dstart.wday == 6 or dstart.wday == 0 ? true : false)\n cld.save\n dstart = dstart + 1.day\n end\n\n respond_to do |format|\n format.html { redirect_to calendars_path(year: @calendar.year_c), notice: 'Calendar was successfully created.' }\n end\n end",
"def calendar_events(calendar_id)\n records \"/calendars/#{calendar_id}/calendar_events.xml\", :method => :get\n end",
"def list_calendars\n unless @calendars\n xml = send(Addressable::URI.parse(\"#{BASE_URI}/default/allcalendars/full\"), :get)\n @calendars = Nokogiri::XML(xml.body)\n @calendars.remove_namespaces!\n end\n @calendars\n end",
"def create\n @calendar_event = CalendarEvent.new(params[:calendar_event])\n\n respond_to do |format|\n if @calendar_event.save\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully created.' }\n format.json { render json: @calendar_event, status: :created, location: @calendar_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar_event = CalendarEvent.new(calendar_event_params)\n\n respond_to do |format|\n if @calendar_event.save\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully created.' }\n format.json { render :show, status: :created, location: @calendar_event }\n else\n format.html { render :new }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to :controller => 'calendar', :action => 'index' }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar_action = CalendarAction.new(calendar_action_params)\n respond_to do |format|\n if @calendar_action.save\n format.html { redirect_to @calendar_action, notice: t('calendar_action.create') }\n format.json { render :show, status: :created, location: @calendar_action }\n else\n format.html { render :new }\n format.json { render json: @calendar_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t@events = @calendar.events(:order => 'created_at ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def create\n @calendar_date = CalendarDate.new(params[:calendar_date])\n\n respond_to do |format|\n if @calendar_date.save\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully created.' }\n format.json { render json: @calendar_date, status: :created, location: @calendar_date }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @appt_calendar = ApptCalendar.new(params[:appt_calendar])\n\n respond_to do |format|\n if @appt_calendar.save\n format.html { redirect_to @appt_calendar, notice: 'Appt calendar was successfully created.' }\n format.json { render json: @appt_calendar, status: :created, location: @appt_calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @appt_calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def create\n @calendar_date = CalendarDate.new(calendar_date_params)\n\n respond_to do |format|\n if @calendar_date.save\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully created.' }\n format.json { render :show, status: :created, location: @calendar_date }\n else\n format.html { render :new }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_calendar_event(calendar_id, event)\n @requester.make_request(:post, \"/calendar_events.xml\", :event => event.merge(:calendar_id => calendar_id))\n\n if @requester.code == 201\n @requester.response['Location']\n else\n false\n end\n end",
"def index\n url = 'https://churchofjesuschrist.org/church-calendar/services/lucrs/ical/group/b03afe3544134ca59a839688d454fb2b'\n \n begin\n raw_file = URI.parse(url).read\n calendar = Calendar.create_or_find_by(url: url)\n calendar.update(raw: raw_file)\n rescue OpenURI::HTTPError => e\n logger.debug e\n raw_file = Calendar.find_by(url: url).raw\n end\n\n ical = Icalendar::Calendar.parse(raw_file).first\n\n events_by_month = ical.events.reverse.inject({}) do |by_month, event|\n month = DateTime::MONTHNAMES[event.dtstart.to_datetime.month]\n by_month[month] ? by_month[month] << event : by_month[month] = [event]\n by_month\n end\n\n @icalendar = OpenStruct.new(\n events: ical.events,\n events_by_month: events_by_month\n )\n end",
"def create\n @calendar_day = CalendarDay.new(calendar_day_params)\n\n respond_to do |format|\n if @calendar_day.save\n format.html { redirect_to @calendar_day, notice: 'Calendar day was successfully created.' }\n format.json { render :show, status: :created, location: @calendar_day }\n else\n format.html { render :new }\n format.json { render json: @calendar_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def create\n @calendar_event = CalendarEvent.new(params[:calendar_event])\n @calendar_event.tag_list = params[:tags]\n \n respond_to do |format|\n if @calendar_event.save\n flash[:notice] = \"The event \\\"#{@calendar_event.name}\\\" was created.\"\n format.html { redirect_to(calendar_events_path) }\n format.xml { render :xml => @calendar_event, :status => :created, :location => @calendar_event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar_event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @calendario = Calendario.new(params[:calendario])\n\n respond_to do |format|\n if @calendario.save\n format.html { redirect_to @calendario, notice: 'Calendario was successfully created.' }\n format.json { render json: @calendario, status: :created, location: @calendario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def calendar_list\n\t\t logger.info(\"-- get_calendar_list_responce st --\") if logger\n\t\t auth unless @auth\n\t\t uri = URI.parse(CALENDAR_LIST_PATH)\n\t\t res = do_get(uri, {})\n\t\t logger.info(\"-- get_calendar_list_responce en(#{res.message}) --\") if logger\n\t\t res\n\t\tend",
"def create\n @google_calendar = GoogleCalendar.new(params[:google_calendar])\n\n respond_to do |format|\n if @google_calendar.save\n flash[:notice] = 'GoogleCalendar was successfully created.'\n format.html { redirect_to(@google_calendar) }\n format.xml { render :xml => @google_calendar, :status => :created, :location => @google_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @google_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @calendario_entrega = CalendarioEntrega.new(params[:calendario_entrega])\n\n respond_to do |format|\n if @calendario_entrega.save\n format.html { redirect_to(@calendario_entrega, :notice => 'Calendario entrega fue creado exitosamente.') }\n format.xml { render :xml => @calendario_entrega, :status => :created, :location => @calendario_entrega }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendario_entrega.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_calendar\n League.current_seasons.each(&:start!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.start_seasons_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def calendar_list\r\n logger.info(\"-- calendar list st --\") if logger\r\n auth unless @auth\r\n uri = URI.parse(CALENDAR_LIST_PATH)\r\n res = do_get(uri, {})\r\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\r\n res\r\n end",
"def index\n @calendars = Event.all\n end",
"def new\n @calendar_event = CalendarEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar_event }\n end\n end",
"def index\n create_calendar_props\n end",
"def index\n @calendars = Calendar.all\n end",
"def index\n @calendars = Calendar.all\n end",
"def calendars\n page_token = nil\n result = execute(:api_method => service.calendar_list.list)\n entries = []\n while true\n entries += result.data.items\n if !(page_token = result.data.next_page_token)\n break\n end\n result = execute(:api_method => service.calendar_list.list,\n :parameters => {'pageToken' => page_token})\n end\n\n entries\n end",
"def calendar_params\n params.require(:calendar).permit(:title, :start, :end, :url, :user_id, :all_day)\n end",
"def events(param = nil)\n request = new_request Net::HTTP::Report do |request|\n request.body = CalendarQuery.new.event(param).to_xml\n end\n response = perform_request request\n \n events = []\n \n body = Nokogiri::XML.parse(response.body)\n namespaces = { 'dav' => \"DAV:\", 'caldav' => 'urn:ietf:params:xml:ns:caldav' }\n \n body.search(\"./dav:multistatus/dav:response\", namespaces).each do |element|\n calendar_data = element.search(\"./dav:propstat/dav:prop/caldav:calendar-data\", namespaces)\n calendar = Icalendar::Parser.new(calendar_data.text).parse.first\n calendar.events.each do |event|\n event.caldav = {\n :etag => element.search(\"dav:propstat/dav:prop/dav:getetag\", namespaces).text, \n :href => element.search(\"dav:href\", namespaces).text\n }\n events += calendar.events\n end\n end\n \n events\n end",
"def create\n \n\t\t@family_id = @user.fam_id\n\t\t@family = Fam.find(@family_id)\n\t\t@calendar = @user.calendars.build(params[:calendar])\n\t\t@calendar.fam_id = @family.id\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @items = Item.recent\n respond_to do |format|\n format.html\n format.json\n format.ics do\n calendar = Icalendar::Calendar.new\n calendar.append_custom_property('X-WR-CALNAME', \"amzn-ics\")\n @items.each do |item|\n calendar.add_event(item.to_ics(request.host))\n end\n calendar.publish\n render text: calendar.to_ical\n end\n end\n end",
"def create\n @calender = Calender.new(calender_params)\n\n respond_to do |format|\n if @calender.save\n format.html { redirect_to @calender, notice: \"Calender was successfully created.\" }\n format.json { render :show, status: :created, location: @calender }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @calender.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_calendar = ShopCalendar.new(shop_calendar_params)\n\n respond_to do |format|\n if @shop_calendar.save\n format.html { redirect_to @shop_calendar, notice: 'Shop calendar was successfully created.' }\n format.json { render :show, status: :created, location: @shop_calendar }\n else\n format.html { render :new }\n format.json { render json: @shop_calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_events_request(path_and_query_string, method, content = '')\n @connection.send(\"/calendars/#{CGI::escape @id}/events#{path_and_query_string}\", method, content)\n end",
"def create\n @calender_event = CalenderEvent.new(calender_event_params)\n respond_to do |format|\n if @calender_event.save\n format.html { redirect_to @calender_event, notice: '予定を追加しました。' }\n format.json { render :show, status: :created, location: @calender_event }\n else\n format.html { render :new }\n format.json { render json: @calender_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n\t@family_id = @user.fam_id\n\t@family = Fam.find(:all, :conditions => [\"id=?\", @family_id])\n\t@calendar = @user.calendars.build(params[:calendar])\n\t@calendar.fam_id = @family[0].id\n\t#@calendar = @family[0].calendars.build(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_calendar_list()\n\t\tif(!@client.nil?)\n\t\t\tresponse = @client.execute(api_method: @service.calendar_list.list)\n\t\t\tcalendars = JSON.parse(response.body)\n\t\telse\n\t\t\tputs \"Client No Calendar boi\"\n\t\tend\n\tend",
"def sync_calendars(opts={})\n # why does the primary calendar feed change every time?\n feed_xml = get_user_calendar_xml\n xml_ts = Time.zone.parse(feed_xml.xpath('/ns:feed/ns:updated', 'ns'=>'http://www.w3.org/2005/Atom').text)\n self.body = feed_xml.to_s if xml_ts != synced_at\n\n feed_xml.css('entry').each { |entry|\n existing_cal = calendars.find :first, :conditions=>{ :uid=>entry.css('id').text}\n if existing_cal\n existing_cal.events.destroy_all if opts[:force] == true\n existing_cal.sync_with_xml(entry, opts) # , range - allows calendar to only sync specified range\n else\n cal = Calendar.new(:init=>entry)\n puts \"XXX not found. creating new calendar object for #{cal.title}\"\n calendars << cal\n cal.sync_events\n end\n }\n\n # find any local calendars that are new and push them up to google\n calendars.find(:all, :conditions=>{:synced_at=>nil}).each do |entry|\n end\n self.synced_at = xml_ts\n save\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar }\n end\n end",
"def scrape_calendar\n begin\n objects = objects_from_event_api\n objects.select! {|o| DateTime.strptime(o['start'],'%Y-%m-%d') > DateTime.now }\n activities = objects_to_activities(objects)\n return process_calendar(activities)\n rescue Exception => e\n return format_error(e)\n end\n end",
"def calendar\n @reservations= Reservation.all\n @reservations_by_date = @reservations.group_by { |e| e.date.strftime('%Y-%m-%d') }\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def create\r\n @group = Group.find(params[:group_id])\r\n\r\n if @group.update_attributes(classdays_params)\r\n @group.generate_calendar!\r\n render json: @group.classdays, status: :created\r\n else\r\n render json: @group.errors, status: :unprocessable_entity\r\n end\r\n end",
"def calendar_params\n params.fetch(:calendar, {})\n end",
"def calendar_params\n params.fetch(:calendar, {})\n end",
"def assign_calendar\n @event.calendar = Calendar.find(params[:calendars_event][:calendar_id])\n end",
"def create\n @event = Event.new(params[:event])\n @move= Move.find(params[:move_id])\n @month = Time.now.month\n @year = Time.now.year\n @appointments = Event.find(:all, :conditions => ['move_id = ? AND start_at >= ?', @move.id, DateTime.now], :order => :start_at, :limit=> '5')\n @shown_month = Date.civil(@year, @month)\n @events = @move.events(:order=> :start_at, :limit=> '5')\n @event_strips = @events.event_strips_for_month(@shown_month)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to calendar_path(@move, Date.today.year, Date.today.month) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :template => 'calendar/index', :layout => 'calendar' }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar_item = CalendarItem.new(params[:calendar_item])\n\n respond_to do |format|\n if @calendar_item.save\n format.html { redirect_to calendar_path, notice: 'Calendar item was successfully created.' }\n format.json { render json: @calendar_item, status: :created, location: @calendar_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\tredirect_to new_availability_calendar_path\n end",
"def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def create\n \n @org_calendars= current_user.organization.calendars(:order=>'created_at ASC')\n puts @org_calendars.inspect\n @org_last_calendar=@org_calendars.find(:last)\n puts \"#########################\"\n puts @org_last_calendar.inspect\n puts \"*****************************\"\n if !@org_calendars.blank? && !@org_last_calendar.blank?\n y= @org_last_calendar.cal_num.gsub!(\"CAL-\",\"\")\n \n m=y.to_i\n m = m +1\n x = (\"CAL-%0.4d\" %m.to_i).to_s\n\n params[:calendar][:cal_num] = x\n \n @calendar = Calendar.new(params[:calendar])\n @calendar.organization = current_user.organization\n @calendar.user = current_user\n else \n m = 1\n x = (\"CAL-%0.4d\" %m.to_i).to_s\n params[:calendar][:cal_num] = x\n @calendar = Calendar.new(params[:calendar])\n @calendar.organization = current_user.organization\n @calendar.user = current_user\n end\n \n @calendar.entry_date = change_date_format(params[:calendar][:entry_date]) if !(params[:calendar][:entry_date]).blank?\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def calendar_params\n params.require(:calendar).permit(:name, :last_frost, :city, :state)\n end",
"def scrape_events\n @scraper.scrape_and_create_events\n end",
"def create\n @training_calendar = TrainingCalendar.new(params[:training_calendar])\n @training_calendar.status = TrainingCalendar::NOT_STARTED\n respond_to do |format|\n if @training_calendar.save\n format.html { redirect_to @training_calendar, :notice => 'Training calendar was successfully created.' }\n format.json { render :json => @training_calendar, :status => :created, :location => @training_calendar }\n else\n load_dependents\n format.html { render :action => \"new\" }\n format.json { render :json => @training_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @calendar_event = CalendarEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar_event }\n end\n end",
"def calendars\n if @event.travels_done?\n if current_user.expired == 1\n render :nothing => true, :status => :unauthorized\n else\n render :json => @event.to_json, :status => :ok\n end\n elsif @event.canceled?\n render :nothing => true, :status => :gone\n else\n render :nothing => true, :status => :not_found\n end\n end",
"def new\n @calendar_date = CalendarDate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar_date }\n end\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.update_attribute :user_id, current_user.id\n\n params[:doors].each_value do |door|\n @calendar.doors.build(door)\n end\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def calendar_params\n params.require(:calendar).permit(:date_c, :is_output, :year_c)\n end",
"def index\n @calendar_days = CalendarDay.all\n end",
"def create\n parse_dates\n @category = Category.find_by_name params[:category_id]\n # Commented out line below to prevent addition of new events\n # @event = Event.new params[:event]\n @event.approved = params[:event][:approved] if user_signed_in?\n @categories = Category.order('name')\n\n respond_to do |format|\n if @event.save\n clear_zend_cache\n format.html\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @calendar.destroy\n respond_to do |format|\n format.html { redirect_to calendars_calendars_url, notice: t('calendar.delete') }\n format.json { head :no_content }\n end\n end",
"def create\n calendar = Calendar.where(default: true, user_id: current_user.id)[0]\n @event = calendar.events.build(params[:event])\n\n parse_params\n if @event.save\n redirect_to request.referer\n else\n flash[:error] = \"Event creation failed!\"\n redirect_to request.referer\n end\n end",
"def index\n respond_to do |format|\n @events = event_finder\n @title = Radiant::Config['event_calendar.feed_title'] || \"#{Radiant::Config['admin.title']} Events\"\n @description = list_description\n @description = \"All future events\" if @description.blank?\n format.js {\n @venues = @events.map(&:event_venue).uniq\n @venue_events = {}\n @events.each do |e|\n @venue_events[e.event_venue.id] ||= []\n @venue_events[e.event_venue.id].push(e)\n end\n }\n format.rss {\n @version = params[:rss_version] || '2.0'\n @link = list_url\n }\n format.ics {\n headers[\"Content-disposition\"] = %{attachment; filename=\"#{list_filename}.ics\"}\n }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_url) }\n format.xml { head :ok }\n end\n end",
"def index\n @calendar_events = CalendarEvent.page(params[:page])\n end"
] |
[
"0.7142082",
"0.71316516",
"0.68008906",
"0.6781165",
"0.6524191",
"0.6507283",
"0.6478495",
"0.64572924",
"0.64560366",
"0.64473957",
"0.62847143",
"0.6217834",
"0.61973417",
"0.61833847",
"0.61407286",
"0.6137919",
"0.61292046",
"0.612832",
"0.6123774",
"0.60921174",
"0.6057962",
"0.60366976",
"0.6033916",
"0.59982616",
"0.599613",
"0.59933835",
"0.59774387",
"0.595803",
"0.5954251",
"0.5907839",
"0.58880275",
"0.58867085",
"0.58867085",
"0.58867085",
"0.58867085",
"0.58867085",
"0.58822477",
"0.58809733",
"0.5877219",
"0.5876161",
"0.5867585",
"0.58375216",
"0.5823937",
"0.581259",
"0.5806487",
"0.57741314",
"0.57666814",
"0.57583785",
"0.57550395",
"0.5728505",
"0.5726547",
"0.57157445",
"0.57150024",
"0.57135206",
"0.56995064",
"0.56919783",
"0.5664301",
"0.5662194",
"0.565302",
"0.5652492",
"0.56508785",
"0.564118",
"0.5640978",
"0.5636575",
"0.56282115",
"0.5611318",
"0.56085896",
"0.56085896",
"0.5604725",
"0.5590616",
"0.55814064",
"0.5580611",
"0.5580611",
"0.5576322",
"0.55706054",
"0.5545533",
"0.55360395",
"0.5529671",
"0.5515426",
"0.5496602",
"0.5491556",
"0.5490005",
"0.54887474",
"0.54868984",
"0.54765147",
"0.54758185",
"0.5462659",
"0.5457837",
"0.54543936",
"0.5445809",
"0.5445809",
"0.5445809",
"0.5442942",
"0.544016",
"0.5428741",
"0.54277724",
"0.5426952",
"0.5425327",
"0.5424532",
"0.5419189"
] |
0.6699629
|
4
|
PUT /calendars/1 PUT /calendars/1.xml
|
def update
@calendar = Calendar.find(params[:id])
respond_to do |format|
if @calendar.update_attributes(params[:calendar])
flash[:notice] = 'Calendar was successfully updated.'
format.html { redirect_to(@calendar) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to @calendar, :notice => 'Calendar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @calendar.update(calendar_params)\n format.html { redirect_to calendars_calendars_url, notice: t('calendar.update') }\n format.json { render :show, status: :ok, location: calendars_calendars_url }\n else\n format.html { render :edit }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @availability_calendar = AvailabilityCalendar.find(params[:id])\n\n respond_to do |format|\n if @availability_calendar.update_attributes(params[:availability_calendar])\n format.html { redirect_to(@availability_calendar, :notice => 'Availability calendar was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @availability_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar.update(calendar_params)\n format.html { redirect_to @calendar, notice: \"Calendar was successfully updated.\" }\n format.json { render :show, status: :ok, location: @calendar }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calendar = Calendar.find(params[:id])\n params[:calendar][:available] = true\n\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to(@calendar, :notice => 'Calendar was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar.update(calendar_params)\n format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar }\n else\n format.html { render :edit }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar.update(calendar_params)\n format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar }\n else\n format.html { render :edit }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @track_calendar = TrackCalendar.find(params[:id])\n\n respond_to do |format|\n if @track_calendar.update_attributes(params[:track_calendar])\n flash[:notice] = 'TrackCalendar was successfully updated.'\n format.html { redirect_to(track_calendars_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @track_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n\t\t\t\tics_for_all ########\n format.html { redirect_to calendar_configurations_path(params[:calendar_id]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n raise @calendar.inspect\n\n if @calendar.update(calendar_params)\n format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar }\n else\n format.html { render :edit }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calendar_event = CalendarEvent.find(params[:id])\n\n respond_to do |format|\n if @calendar_event.update_attributes(params[:calendar_event])\n flash[:notice] = \"The event \\\"#{@calendar_event.name}\\\" was updated.\"\n format.html { redirect_to(calendar_events_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calendar_event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @calendar_event = CalendarEvent.find(params[:id])\n\n respond_to do |format|\n if @calendar_event.update_attributes(params[:calendar_event])\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def calendar\n get '/gtfs/calendar'\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end",
"def update\n @training_calendar = TrainingCalendar.find(params[:id])\n respond_to do |format|\n if @training_calendar.update_attributes(params[:training_calendar])\n format.html { redirect_to @training_calendar, :notice => 'Training calendar was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @training_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @calendario = Calendario.find(params[:id])\n\n respond_to do |format|\n if @calendario.update_attributes(params[:calendario])\n format.html { redirect_to @calendario, notice: 'Calendario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def update\n @google_calendar = GoogleCalendar.find_by_hashed_id(params[:id])\n\n respond_to do |format|\n if @google_calendar.update_attributes(params[:google_calendar])\n flash[:notice] = 'GoogleCalendar was successfully updated.'\n format.html { redirect_to(@google_calendar) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @google_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def update\n @calendar_date = CalendarDate.find(params[:id])\n\n respond_to do |format|\n if @calendar_date.update_attributes(params[:calendar_date])\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n if @id.nil?\n data = decode_response connection.post(\"/calendar/feeds/default/owncalendars/full\", {:data => self.to_hash})\n self.id = data[\"data\"][\"id\"].split(\"full/\").last\n else\n data = decode_response connection.put(\"/calendar/feeds/default/owncalendars/full/#{@id}\", {:apiVersion => \"2.3\", :data => self.to_hash})\n end\n self\n end",
"def update\n @menu_calendar = MenuCalendar.find(params[:id])\n\n respond_to do |format|\n if @menu_calendar.update_attributes(params[:menu_calendar])\n format.html { redirect_to(@menu_calendar, :notice => 'Menu calendar was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @menu_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar_action.update(calendar_action_params)\n format.html { redirect_to @calendar_action, notice: t('calendar_action.update') }\n format.json { render :show, status: :ok, location: @calendar_action }\n else\n format.html { render :edit }\n format.json { render json: @calendar_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.find(params[:calendar_id])\n\t@event = @calendar.events.build(params[:event])\n\t@event.finished = 0;\n\t\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n\t\t\t\tics_for_all #######\n\t\t\t\tformat.html { redirect_to(@calendar) }\n\t\t\t\tformat.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def update_calendar(opts = {})\n end",
"def update\n @calendar = Calendar.find(params[:id])\n respond_to do |format|\n @calendar.update_attributes({ :date_start => params[:newDate], :time_start => params[:newTime] })\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully updated.' }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_url) }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @calendar_event.update(calendar_event_params)\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar_event }\n else\n format.html { render :edit }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar_event.update(calendar_event_params)\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar_event }\n else\n format.html { render :edit }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(bin_calendars_url) }\n format.xml { head :ok }\n end\n end",
"def sync_calendars(opts={})\n # why does the primary calendar feed change every time?\n feed_xml = get_user_calendar_xml\n xml_ts = Time.zone.parse(feed_xml.xpath('/ns:feed/ns:updated', 'ns'=>'http://www.w3.org/2005/Atom').text)\n self.body = feed_xml.to_s if xml_ts != synced_at\n\n feed_xml.css('entry').each { |entry|\n existing_cal = calendars.find :first, :conditions=>{ :uid=>entry.css('id').text}\n if existing_cal\n existing_cal.events.destroy_all if opts[:force] == true\n existing_cal.sync_with_xml(entry, opts) # , range - allows calendar to only sync specified range\n else\n cal = Calendar.new(:init=>entry)\n puts \"XXX not found. creating new calendar object for #{cal.title}\"\n calendars << cal\n cal.sync_events\n end\n }\n\n # find any local calendars that are new and push them up to google\n calendars.find(:all, :conditions=>{:synced_at=>nil}).each do |entry|\n end\n self.synced_at = xml_ts\n save\n end",
"def update\n @appt_calendar = ApptCalendar.find(params[:id])\n\n respond_to do |format|\n if @appt_calendar.update_attributes(params[:appt_calendar])\n format.html { redirect_to @appt_calendar, notice: 'Appt calendar was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @appt_calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calendario_entrega = CalendarioEntrega.find(params[:id])\n\n respond_to do |format|\n if @calendario_entrega.update_attributes(params[:calendario_entrega])\n format.html { redirect_to(@calendario_entrega, :notice => 'Calendario entrega fue modificado exitosamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calendario_entrega.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @calendar = Calendar.find(params[:id])\n params[:calendar][:entry_date] = change_date_format(params[:calendar][:entry_date]) if !(params[:calendar][:entry_date]).blank?\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_calendar_request(path_and_query_string, method, content = '')\n @connection.send(\"/calendars#{path_and_query_string}\", method, content)\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(@calendar) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar_date.update(calendar_date_params)\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar_date }\n else\n format.html { render :edit }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n parse_dates\n @event = Event.find(params[:id])\n @event.approved = params[:event][:approved]\n @category = @event.categories.first\n @categories = Category.order('name')\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n clear_zend_cache\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @calendar_item = CalendarItem.find(params[:id])\n\n respond_to do |format|\n if @calendar_item.update_attributes(params[:calendar_item])\n format.html { redirect_to calendar_path, notice: 'Calendar item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calendar_event\n @calendar_event = CalendarEvent.find(params[:id])\n end",
"def set_calendar_event\n @calendar_event = CalendarEvent.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @shop_calendar.update(shop_calendar_params)\n format.html { redirect_to @shop_calendar, notice: 'Shop calendar was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop_calendar }\n else\n format.html { render :edit }\n format.json { render json: @shop_calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def patch_calendar(opts = {})\n update_calendar(opts)\n end",
"def test_succeed_no_calendars\n # Deleting calendars\n @caldav_backend.delete_calendar(1)\n @caldav_backend.delete_calendar(2)\n\n @server.http_request = Http::Request.new(\n 'POST',\n '/calendars/user1/outbox',\n 'Content-Type' => 'text/calendar'\n )\n\n body = <<ICS\nBEGIN:VCALENDAR\nMETHOD:REQUEST\nBEGIN:VFREEBUSY\nORGANIZER:mailto:user1.sabredav@sabredav.org\nATTENDEE:mailto:user2.sabredav@sabredav.org\nDTSTART:20110101T080000Z\nDTEND:20110101T180000Z\nEND:VFREEBUSY\nEND:VCALENDAR\nICS\n\n @server.http_request.body = body\n\n # Lazily making the current principal an admin.\n @acl_plugin.admin_principals << 'principals/user1'\n\n refute(\n @plugin.http_post(@server.http_request, @response)\n )\n\n assert_equal(200, @response.status)\n assert_equal(\n { 'Content-Type' => ['application/xml'] },\n @response.headers\n )\n\n strings = [\n '<d:href>mailto:user2.sabredav@sabredav.org</d:href>',\n '<cal:request-status>2.0;Success</cal:request-status>'\n ]\n\n strings.each do |string|\n assert(\n @response.body.index(string),\n \"The response body did not contain: #{string} Full response: #{@response.body}\"\n )\n end\n end",
"def destroy\n @availability_calendar = AvailabilityCalendar.find(params[:id])\n @availability_calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(availability_calendars_url) }\n format.xml { head :ok }\n end\n end",
"def index\n verify_owner(params[:gcal_id])\n\n calendar_list = @current_user.calendar_list\n calendar = calendar_list.calendars.find_or_create_by(gcal_id: params[:gcal_id])\n calendar.sync!(@current_user.access_token) if not calendar.synced?\n\n render json: calendar.json_data\n end",
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def delete_calendar(id)\n @client.raw('delete', \"/config/calendars/#{id}\")\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to calendars_url }\n format.json { head :no_content }\n end\n end",
"def edit\n @calendar_event = CalendarEvent.find_by(id: params[:id])\n end",
"def assign_calendar\n @event.calendar = Calendar.find(params[:calendars_event][:calendar_id])\n end",
"def update\n respond_to do |format|\n if @calender.update(calender_params)\n format.html { redirect_to @calender, notice: \"Calender was successfully updated.\" }\n format.json { render :show, status: :ok, location: @calender }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @calender.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calendar\n @calendar = @hairdresser.calendars.find(params[:calendar_id])\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/welcome/calendar', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calendario = Calendario.find(params[:id])\n expire_fragment Time.now.to_date.to_s\n \n \n respond_to do |format|\n if @calendario.update_attributes(params[:calendario])\n flash[:notice] = 'Calendario se ha actualizado con exito.'\n format.html { redirect_to(admin_calendarios_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calendario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @calendar.destroy\n respond_to do |format|\n format.html { redirect_to calendars_calendars_url, notice: t('calendar.delete') }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @calender_event.update(calender_event_params)\n format.html { redirect_to @calender_event, notice: '予定を変更しました。' }\n format.json { render :show, status: :ok, location: @calender_event }\n else\n format.html { render :edit }\n format.json { render json: @calender_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calendar_action\n @calendar_action = CalendarAction.find(params[:id])\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_mk_calendar(request, _response)\n body = request.body_as_string\n path = request.path\n\n properties = {}\n\n unless body.blank?\n begin\n mkcalendar = @server.xml.expect(\n '{urn:ietf:params:xml:ns:caldav}mkcalendar',\n body\n )\n rescue Tilia::Xml::ParseException => e\n raise Dav::Exception::BadRequest, e.message\n end\n\n properties = mkcalendar.properties\n end\n\n # iCal abuses MKCALENDAR since iCal 10.9.2 to create server-stored\n # subscriptions. Before that it used MKCOL which was the correct way\n # to do this.\n #\n # If the body had a {DAV:}resourcetype, it means we stumbled upon this\n # request, and we simply use it instead of the pre-defined list.\n if properties.key?('{DAV:}resourcetype')\n resource_type = properties['{DAV:}resourcetype'].value\n else\n resource_type = ['{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar']\n end\n\n @server.create_collection(path, Dav::MkCol.new(resource_type, properties))\n\n @server.http_response.status = 201\n @server.http_response.update_header('Content-Length', 0)\n\n # This breaks the method chain.\n false\n end",
"def create\n\t@calendar = @user.calendars.build(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_calendar_list(opts = {})\n end",
"def set_calendar_day\n @calendar_day = CalendarDay.find(params[:id])\n end",
"def set_calendar_day\n @calendar_day = CalendarDay.find(params[:id])\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def set_calendar_sync\n @calendar_sync = CalendarSync.find(params[:id])\n end",
"def update\n @calendar=DefaultCalendar.find(@default_line_calendar.default_calendar_id)\n if @default_line_calendar.update(default_line_calendar_params)\n flash[:success] = \"Dia no laborable actualizado correctamente\"\n redirect_to default_calendar_path(@default_line_calendar.default_calendar_id)\n else\n render 'edit'\n end\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n @site = @calendar.site\n end",
"def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: \"Calendar was successfully created.\" }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @calendar_day.update(calendar_day_params)\n format.html { redirect_to @calendar_day, notice: 'Calendar day was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar_day }\n else\n format.html { render :edit }\n format.json { render json: @calendar_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @calendar_event = CalendarEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar_event }\n end\n end",
"def update\n respond_to do |format|\n if @calender.update(calender_params)\n format.html { redirect_to @calender, notice: '日曆成功的更新了' }\n format.json { render :show, status: :ok, location: @calender }\n else\n format.html { render :edit }\n format.json { render json: @calender.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_schedule = EventSchedule.find(params[:id])\n\n respond_to do |format|\n if @event_schedule.update_attributes(params[:event_schedule])\n format.html { redirect_to @event_schedule, notice: 'Event schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calendar_date\n @calendar_date = CalendarDate.find(params[:id])\n end"
] |
[
"0.67149985",
"0.6685749",
"0.6567797",
"0.6494846",
"0.64824784",
"0.64787394",
"0.6461926",
"0.6461926",
"0.6413853",
"0.6378897",
"0.63606536",
"0.6280817",
"0.6242284",
"0.6197591",
"0.6190485",
"0.6185639",
"0.6165237",
"0.6163055",
"0.6144471",
"0.6144471",
"0.6144471",
"0.6144471",
"0.6144471",
"0.6144471",
"0.61436945",
"0.6142689",
"0.61313677",
"0.61168194",
"0.6065854",
"0.60503966",
"0.602309",
"0.60035044",
"0.60035044",
"0.60035044",
"0.5989566",
"0.5987023",
"0.5980515",
"0.59697586",
"0.59697586",
"0.5954126",
"0.59409666",
"0.59372485",
"0.5933752",
"0.59244233",
"0.5915623",
"0.58774614",
"0.58749",
"0.5873656",
"0.5866779",
"0.5846965",
"0.5841719",
"0.5841719",
"0.58252454",
"0.5817849",
"0.5817849",
"0.5762472",
"0.5727244",
"0.57149404",
"0.5690171",
"0.5682763",
"0.56826925",
"0.5681125",
"0.5681125",
"0.5681125",
"0.56796986",
"0.56705666",
"0.5663483",
"0.56524104",
"0.5646679",
"0.5638336",
"0.5629037",
"0.56199414",
"0.5613129",
"0.56021655",
"0.5601928",
"0.56016743",
"0.5588221",
"0.55816954",
"0.5578419",
"0.5578419",
"0.5556885",
"0.5556885",
"0.5556885",
"0.5556885",
"0.5556885",
"0.5554455",
"0.55447114",
"0.5543874",
"0.55281323",
"0.5525079",
"0.5524074",
"0.5523885",
"0.5522281",
"0.55131066",
"0.55086446",
"0.55062217",
"0.55050606"
] |
0.6937048
|
2
|
DELETE /calendars/1 DELETE /calendars/1.xml
|
def destroy
@calendar = Calendar.find(params[:id])
@calendar.destroy
respond_to do |format|
format.html { redirect_to(calendars_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(bin_calendars_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendars_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end",
"def delete_calendar(calendar_id)\n end",
"def delete_calendar(id)\n @client.raw('delete', \"/config/calendars/#{id}\")\n end",
"def destroy\n @calendar_event = CalendarEvent.find(params[:id])\n @calendar_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendar_events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @menu_calendar = MenuCalendar.find(params[:id])\n @menu_calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(menu_calendars_url) }\n format.xml { head :ok }\n end\n end",
"def delete_calendar(id)\n return @client.raw(\"delete\", \"/config/calendars/#{id}\")\n end",
"def destroy\n @google_calendar = GoogleCalendar.find_by_hashed_id(params[:id])\n @google_calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(google_calendars_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @availability_calendar = AvailabilityCalendar.find(params[:id])\n @availability_calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(availability_calendars_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @track_calendar = TrackCalendar.find(params[:id])\n @track_calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to(track_calendars_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar.destroy\n respond_to do |format|\n format.html { redirect_to calendars_calendars_url, notice: t('calendar.delete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @calendario_entrega = CalendarioEntrega.find(params[:id])\n @calendario_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to(calendarios_entrega_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @default_line_calendar.destroy\n respond_to do |format|\n format.html { redirect_to default_line_calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar.destroy\n respond_to do |format|\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar.destroy\n respond_to do |format|\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar.destroy\n respond_to do |format|\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar.destroy\n respond_to do |format|\n format.html { redirect_to calendars_url, notice: \"Calendar was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendario = Calendario.find(params[:id])\n @calendario.destroy\n expire_fragment Time.now.to_date.to_s\n respond_to do |format|\n format.html { redirect_to(admin_calendarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar_action.destroy\n respond_to do |format|\n format.html { redirect_to calendar_actions_url, notice: t('calendar_action.delete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendario = Calendario.find(params[:id])\n @calendario.destroy\n\n respond_to do |format|\n format.html { redirect_to calendari_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar_event = CalendarEvent.find(params[:id])\n @calendar_event.destroy\n\n respond_to do |format|\n format.html { redirect_to calendar_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar_date = CalendarDate.find(params[:id])\n @calendar_date.destroy\n\n respond_to do |format|\n format.html { redirect_to calendar_dates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\t\tics_for_all #########\n respond_to do |format|\n\t\t\tformat.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calification = Calification.find(params[:id])\n @calification.destroy\n\n respond_to do |format|\n format.html { redirect_to(califications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar_type.destroy\n respond_to do |format|\n format.html { redirect_to calendar_types_url }\n end\n end",
"def destroy\n @appt_calendar = ApptCalendar.find(params[:id])\n @appt_calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to appt_calendars_url }\n format.json { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @calendar_date.destroy\n respond_to do |format|\n format.html { redirect_to calendar_dates_url, notice: 'Calendar date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calificacione = Calificacione.find(params[:id])\n @calificacione.destroy\n\n respond_to do |format|\n format.html { redirect_to calificaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calender_event.destroy\n respond_to do |format|\n format.html { redirect_to calender_events_url, notice: '予定を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar_day.destroy\n respond_to do |format|\n format.html { redirect_to calendar_days_url, notice: 'Calendar day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calificacion = Calificacion.find(params[:id])\n @calificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to calificaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calificacion = Calificacion.find(params[:id])\n @calificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to calificaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calendar_item = CalendarItem.find(params[:id])\n @calendar_item.destroy\n\n respond_to do |format|\n format.html { redirect_to calendar_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calendar_event.destroy\n respond_to do |format|\n format.html { redirect_to calendar_events_url, notice: 'Calendar event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_event = ClientEvent.find(params[:id])\n @client_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @datetime.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shop_calendar.destroy\n respond_to do |format|\n format.html { redirect_to shop_calendars_url, notice: 'Shop calendar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n load_data\n @event.destroy\n clear_zend_cache\n\n respond_to do |format|\n format.html { redirect_to(category_events_url(category)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @default_line_calendar.destroy\n flash[:success]= 'Dia no laborable eliminado correctamente'\n redirect_to default_calendar_path(@default_line_calendar.default_calendar_id)\n end\n end",
"def destroy\n @training_calendar = TrainingCalendar.find(params[:id])\n @training_calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to training_calendars_url }\n format.json { head :ok }\n end\n end",
"def delete_org_unit_calendar_event(org_unit_id, event_id)\n path = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/calendar/event/#{event_id}\"\n _delete(path)\nend",
"def destroy\n @feria2009calificacion = Feria2009calificacion.find(params[:id])\n @feria2009calificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2009calificaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bday = Bday.find(params[:id])\n @bday.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdays_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to(conference_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy_google_calendar\n result = Gandalf::GoogleApiClient.delete_google_calendar(self.apps_cal_id)\n result.data\n end",
"def destroy\n @attendance = Attendance.find(params[:id])\n @attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>'today') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calender.archive\n respond_to do |format|\n format.html { redirect_to calenders_url, notice: '日曆成功的刪除了' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_canada_events_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @the_day = TheDay.find(params[:id])\n @the_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(the_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event.destroy\n respond_to do | format |\n format.html { redirect_to events_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/admin/events/\"+ Time.zone.now.year.to_s+\"/\"+Time.zone.now.month.to_s)}\n format.xml { head :ok }\n end\n end",
"def destroy\n @calificaciones.destroy\n respond_to do |format|\n format.html { redirect_to calificacion_url, notice: 'Calificaciones was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @appointment = Appointment.find(params[:id])\n @appointment.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @appointment = Appointment.find(params[:id])\n @appointment.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @appointment = Appointment.find(params[:id])\n @appointment.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n @maintenance_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(maintenance_schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7565846",
"0.75267005",
"0.75267005",
"0.75267005",
"0.7416957",
"0.7382632",
"0.73236775",
"0.71978337",
"0.71686584",
"0.71468234",
"0.70761853",
"0.7074887",
"0.70444226",
"0.69760174",
"0.69760174",
"0.69760174",
"0.69476295",
"0.6935693",
"0.69210047",
"0.67908245",
"0.6778716",
"0.6777808",
"0.6777808",
"0.6773994",
"0.6736511",
"0.6727341",
"0.67032427",
"0.6678014",
"0.6642687",
"0.65875715",
"0.6586808",
"0.65314513",
"0.6516631",
"0.6511733",
"0.64934343",
"0.6485416",
"0.6481847",
"0.64735556",
"0.64664686",
"0.64664686",
"0.646453",
"0.6457701",
"0.6452259",
"0.6422958",
"0.64004534",
"0.63922685",
"0.63853973",
"0.63815635",
"0.6349973",
"0.63410866",
"0.6338607",
"0.63310826",
"0.6326703",
"0.63239884",
"0.6311898",
"0.63074875",
"0.6302869",
"0.62931985",
"0.62886655",
"0.6285655",
"0.6282983",
"0.62716156",
"0.62716156",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6270375",
"0.6265593",
"0.62597567",
"0.625879",
"0.6256317",
"0.6256317",
"0.6256317",
"0.624704",
"0.62419933",
"0.6236285",
"0.6232868",
"0.6232868",
"0.6232868"
] |
0.7489783
|
4
|
This algorythm is not ok, because it depends on the input. If I sort the nail sequence then the algorythm fails
|
def findFirstNail(plankBegin, plankEnd, nails)
do_debug "b:#{plankBegin} e:#{plankEnd} nails:#{nails}"
result = -1 # The index of nail in the original array
resultPos = -1 # The index of nail in the sorted array
nailLower = 0
nailUpper = nails.size - 1
nailMid = 0
while nailLower <= nailUpper do
nailMid = (nailLower + nailUpper) / 2
nailPosMid = nails[nailMid][1]
do_debug "l:#{nailLower} u:#{nailUpper} m:#{nailMid} npm:#{nailPosMid}"
if nailPosMid < plankBegin
nailLower = nailMid + 1
do_debug "rising lower bound nailLower:#{nailLower}"
elsif nailPosMid > plankEnd
nailUpper = nailMid - 1
do_debug "lowering upper bound nailUpper:#{nailUpper}"
else
nailUpper = nailMid - 1
result = nails[nailMid][0]
resultPos = nailMid
do_debug "adjusting: upper bound nailUpper:#{nailUpper}"
do_debug "result: #{result}"
do_debug "resultPos: #{resultPos}"
end
end
[result, resultPos]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution(n)\n siblings = n.to_s.chars.each_slice(1).to_a\n siblings.sort {|x,y| -(x <=> y)}.join.to_i\nend",
"def sequence(hidden, open)\n weight = { 1 => \"A\", 2 => \"2\", 3 => \"3\", 4 => \"4\", 5 => \"5\", 6 => \"6\", 7 => \"7\", 8 => \"8\", 9 => \"9\", \n 10 => \"T\", 11 => \"J\", 12 => \"Q\", 13 => \"K\" }\n i = 0\n result = []\n inputs = 1\n differ = 0\n if weight.key(hidden[i]) > weight.key(hidden[i+2])\n small = weight.key(hidden[i+2])\n big = weight.key(hidden[i])\n differ = big - small\n elsif weight.key(hidden[i]) < weight.key(hidden[i+2])\n small = weight.key(hidden[i])\n big = weight.key(hidden[i+2])\n differ = big - small\n else\n return false\n end\n return false if differ > 4\n if differ > 1\n start = small + 1\n end1 = big - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n inputs += 1\n end \n end \n end \n end\n end\n return false unless differ == inputs \n if result.size < 6\n steps = (6-result.size)/2\n start = big + 1\n end1 = big + steps\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n if result.size < 6\n steps = (6-result.size)/2\n return false if small - steps < 1 \n start = small - steps\n end1 = small - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n return false if result.size < 6\n end\n end \n result \n end",
"def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def solution(a)\n return 0 if a.length < 3\n a.sort.each_cons(3) { |e| return 1 if e[0] + e[1] > e[2] }\n return 0\nend",
"def longest_increasing_subsequence n\n\n pileTops = []\n # sort into piles\n for x in n\n # binary search]\n low, high = 0, pileTops.size-1\n while low <= high\n mid = low + (high - low) / 2\n if pileTops[mid][:val] >= x\n high = mid - 1\n else\n low = mid + 1\n end\n end\n i = low\n node = {:val => x} #Node.new(x)\n node[:back] = pileTops[i-1] if i > 0\n pileTops[i] = node\n end\n\n result = []\n node = pileTops.last\n while node\n result.unshift(node)\n node = node[:back]\n end\n result.collect{|r| r[:val]}\n\nend",
"def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"def shell_sort(a)\n n=a.length\n h=1\n \n while (h<n/3) #for computing increment factor \"h\"\n h= (3*h)+1\n end\n \n while h>=1\n # Logic of insertion sort with inrement steps of \"h\"\n for i in h...n\n j=i\n while j>=h\n if a[j-h]>a[j]\n temp=a[j]\n a[j]=a[j-h]\n a[j-h]=temp\n end\n j-=h\n end\n end\n h/=3\n end\n \n return a\n \nend",
"def solution(nums)\n nums.to_a.sort\nend",
"def shell_sort(a)\n n = a.length # Size of input\n h = 1\n h = h * 3 + 1 while h < n / 3\n\n while h >= 1\n i = h\n while i < n\n j = i\n while j >= h && a[j] < a[j - h]\n temp = a[j - h]\n a[j - h] = a[j]\n a[j] = temp\n\n j -= h\n end\n i += 1\n end\n h = (h / 3).to_i\n end\n a\nend",
"def sort(sequence)\n\n made_a_swap = true\n swaps = 0\n loops = 0\n\n def swap(counter, sequnce)\n temp = sequnce[counter]\n sequnce[counter] = sequnce[counter + 1]\n sequnce[counter + 1] = temp\n end\n\n\n while made_a_swap do\n counter = 0\n made_a_swap = false\n\n while counter < sequence.length - 1 #&& !made_a_swap\n\n if sequence[counter] > sequence[counter + 1]\n made_a_swap = true\n swaps += 1\n swap(counter, sequence)\n end\n\n\n counter += 1\n end\n\n print \"#{loops} \" if loops % 1000 == 0\n loops += 1\n end\n\nend",
"def lexicograph(n)\n\tputs \"lexicograph(#{n})\"\n\tif n == 0\n\t\treturn [\"0\"]\n\tend\n\tresult = []\n\tprevious_ordering = lexicograph(n-1)\n\t0.upto(n) do |k|\n\t\t# puts \"k: #{k}\"\n\t\tprevious_ordering.each do |perm|\n\t\t\t# puts \"perm: #{perm}\"\n\t\t\tval = perm.clone\n\t\t\t(n-1).downto(k) do |i|\n\t\t\t\t# puts \"i: #{i}\"\n\t\t\t\tval.gsub!(i.to_s, (i+1).to_s)\n\t\t\tend\n\t\t\tresult << k.to_s + val\n\t\tend\n\tend\n\tputs \"returning #{n}\"\n\treturn result\nend",
"def greedy_sorting(p)\n <<-DOC\n GREEDYSORTING(P)\n approxReversalDistance ← 0\n for k = 1 to |P|\n if element k is not sorted\n apply the k-sorting reversal to P\n approxReversalDistance ← approxReversalDistance + 1\n if k-th element of P is −k\n apply the k-sorting reversal to P\n approxReversalDistance ← approxReversalDistance + 1\n return approxReversalDistance\n\n Sample Input:\n (-3 +4 +1 +5 -2)\n\n Sample Output:\n (-1 -4 +3 +5 -2)\n (+1 -4 +3 +5 -2)\n (+1 +2 -5 -3 +4)\n (+1 +2 +3 +5 +4)\n (+1 +2 +3 -4 -5)\n (+1 +2 +3 +4 -5)\n (+1 +2 +3 +4 +5) \n DOC\n p_a = []\n # puts p.join(\" \")\n i = 0\n identity = []\n p.each_index {|i| identity << (i+1)}\n # puts identity.join(\" \")\n loop do\n break if p == identity\n new_line = []\n # Lets get the index of the element (i+1) and reverse the array portion from there\n unless (p[i] == (i+1) || p[i] == -(i+1))\n # get the index where our (i+1) element is\n elem_idx = p.index(i+1)\n # our element could have a -ve sign so if elem_idx is nil lets try the -(i+1)\n elem_idx = p.index(-(i+1)) unless elem_idx\n # puts \"i #{i} elem_idx #{elem_idx}\"\n new_line = p[0..(i-1)] if (i > 0)\n new_line += p[i..elem_idx].reverse.map {|i| i *= -1}\n\n new_line += p[(elem_idx+1)..(p.length-1)] if (elem_idx < (p.length-1))\n\n p = new_line\n # puts p.join(\" \")\n p_a << p.dup\n # puts p_a.join(\" -> \")\n end\n if (p[i] < 0) \n p[i] *= -1\n # puts p.join(\" \") \n p_a << p.dup\n end\n i += 1\n end\n return p_a\n end",
"def min_subsequence(nums)\n sorted = nums.sort\n left = sorted.inject(:+)\n right = 0\n i = 0\n while i < nums.length\n left -= sorted[i]\n right += sorted[i]\n\n if left < right\n return sorted.drop(i-a1).sort.reverse\n end\n i += 1\n end\n return []\nend",
"def solution(a)\n # we could do radix sort and then loop over all the items in order to find the missing element\n # in the ordered list or use the Gauss theorem: https://study.com/academy/lesson/finding-the-sum-of-consecutive-numbers.html\n #\n # if we use the Gauss theorem we can do:\n # sum = (1 + N+1) * ( N / 2 )\n #\n # if (1 + N+1) % 2 == 1 we need to sum also (n+1+1)/2 + 1\n #\n # then remove every item from the sum: the remainder is the missing number\n len = a.length\n sum = (1 + len + 1) * ((len + 1) / 2)\n sum += ((len + 1) / 2.0).ceil unless (len + 1) % 2 == 0\n\n a.reduce(sum) do |sum, i|\n sum - i\n end\nend",
"def lucas_sequence(n)\n case n\n when -Float::INFINITY..0 then return []\n when 1 then return [2]\n when 2 then return [2, 1]\n end\n\n sequence = lucas_sequence(n - 1)\n sequence << sequence[-1] + sequence[-2]\nend",
"def greedy_sort perm\n seq = []\n curr = perm.clone\n 1.upto(perm.length) do |pos|\n ind = curr.index(pos) || curr.index(-pos)\n if ind > pos - 1\n sub = curr[(pos - 1)..ind].map{|x| -x}\n curr[(pos - 1)..ind] = sub.reverse\n if curr[pos - 1] < 0\n seq << curr\n curr = curr.clone\n curr[pos - 1] = - curr[pos - 1]\n end\n seq << curr\n curr = curr.clone\n elsif curr[pos - 1] < 0\n curr[pos - 1] = -curr[pos - 1]\n seq << curr\n curr = curr.clone\n end\n end\n seq\nend",
"def shell_sort(a)\n array = a\n \n m = 1\n while (gap = array.length / (2 ** m)) >= 1\n puts \"gap: #{gap}\"\n 0.step(array.length-1, gap) do |i|\n #puts \"#{i}\"\n # insertion sort\n #puts \" ###{i+gap}\"\n (i+1).upto(i+gap-1) do |j|\n #puts \" #{j}\"\n if array[j] < array[j-1]\n # need to shift everything over until it isn't\n j.downto(i+1) do |k|\n if array[k] < array[k-1]\n array[k], array[k-1] = array[k-1], array[k]\n end\n end\n end\n end\n p a\n end\n \n m += 1\n end\nend",
"def shell_sort(a)\n i = 0\n j = 0\n size = a.length\n increment = size / 2\n temp = 0\n \n while increment > 0\n i = increment\n while i<size\n j = i\n temp = a[i]\n while j>=increment and a[j-increment]>temp\n a[j] = a[j-increment]\n j = j-increment\n end\n a[j] = temp\n i+=1\n end\n if increment == 2\n increment = 1\n else\n increment = (increment/2).to_i\n end\n end\n return a\nend",
"def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\nend",
"def arrangeArray(num, relation)\n list = []\n completeArrange = Array.new(num)\n index = 0 \n\n while(index < relation.length)\n while(list.length != 0)\n key = list.delete_at(0)\n completeArrange[key] = true\n \n i = index\n while(i < relation.length)\n if(relation[i] == key)\n if(i % 2 == 1)\n if(completeArrange[relation[i - 1]] == nil)\n list.push(relation[i - 1])\n end\n relation[index],relation[i - 1] = relation[i - 1],relation[index]\n relation[index + 1],relation[i] = relation[i],relation[index + 1]\n else\n if(completeArrange[relation[i + 1]] == nil)\n list.push(relation[i + 1])\n end\n relation[index],relation[i] = relation[i],relation[index]\n relation[index + 1],relation[i + 1] = relation[i + 1],relation[index + 1]\n end\n index += 2\n end\n i += 1\n end\n end\n if(index < relation.length)\n list.push(relation[index])\n list.push(relation[index + 1])\n index += 2\n end\n end\n return relation\nend",
"def solution(a)\n min_index = nil\n max_index = nil\n\n a.each_with_index do |num, index|\n if index < a.length-1\n if num > a[index + 1]\n min_index = index\n break\n end\n end\n end\n\n reversed_array = a.reverse\n\n reversed_array.each_with_index do |num, index|\n if index < reversed_array.length-1\n if num < reversed_array[index + 1]\n max_index = a.length - index - 1\n break\n end\n end\n end\n\n if min_index.nil? && max_index.nil?\n return 0\n end\n\n until a.sort == a[0...min_index] + a[min_index..max_index].sort + a[max_index+1..-1]\n minimum_in_sub = a[min_index..max_index].sort.first\n maximum_in_sub = a[min_index..max_index].sort.last\n\n new_min_index = a[0...min_index].reverse.index(a[0...min_index].reverse.find{|n| n >= minimum_in_sub})\n\n if new_min_index\n min_index = min_index - new_min_index - 1\n end\n\n new_max_index = a[max_index+1..-1].index(a[max_index+1..-1].find{|n| n <= maximum_in_sub})\n\n if new_max_index\n max_index = max_index + new_max_index + 1\n end\n end\n\n max_index - min_index + 1\nend",
"def sluggish_octopus(array)\n\n sorted = false\n until sorted\n sorted = true\n\n array.each_index do |i|\n next if i == array.length - 1\n j = i + 1\n\n if array[i].length > array[j].length\n sorted = false\n array[i], array[j] = array[j], array[i]\n end\n end\n end\n array.last\n\nend",
"def lucas_sequence(n)\n return [] if n == 0\n return [2] if n == 1\n return [2, 1] if n == 2\n\n sequence = lucas_sequence(n - 1)\n next_sequence = sequence[-1] + sequence[-2]\n sequence << next_sequence\nend",
"def sort_array(array)\n n = array.size\n return array if n < 2\n (0..n - 2).each do |i|\n (i + 1..n - 1).each do |j|\n next if array[i].even? || array[j].even?\n interchange(array, i, j) if array[i] > array[j]\n end\n end\n array\nend",
"def array_sort(arr)\nx = arr.length\nif x == 1\nelsif x == 2\n if arr[0] > arr[1]\n arr[0], arr[1] = arr[1], arr[0]\n end\nelse\n loop do\n modified = FALSE\n (x-2).times do |x|\n if (arr[x] < arr[x + 1]) && (arr[x] < arr[x + 2])\n if arr[x + 2] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x], arr [x + 2], arr[x + 1]\n modified = TRUE\n end\n elsif (arr[x + 1] < arr[x]) && (arr[x + 1] < arr[x + 2])\n if arr[x] < arr[x + 2]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n elsif arr[x + 2] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr [x + 2], arr[x]\n modified = TRUE\n elsif arr[x + 2] == arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n end\n elsif (arr[x + 2] < arr[x]) && (arr[x + 2] < arr[x + 1])\n if arr[x] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n elsif arr[x + 1] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x + 1], arr[x]\n modified = TRUE\n elsif arr[x] == arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n end\n end\n end\n break if modified == FALSE\n end\nend\n arr\nend",
"def get_sequence(map, order)\r\n\t# this is a dumb but correct solution\r\n\t# shuffle randomly messes up the elements in an array\r\n\t\r\n\t#return order.shuffle\r\n\t$globalArr = []\r\n\t$finalAns = []\r\n\t$globalArr2 = []\r\n\t$BestAns = []\r\n\t\r\n\tprintData(map, order)\r\n\r\n\t#return $finalAns.collect {|ind| ind[0]}\r\n\t\r\n\t##puts \"BEST:\" + $BestAns.to_s\r\n\r\n\t#score1 = q1_scoreMY(map, $BestAns[0])\r\n\t#score2 = q1_scoreMY(map, $BestAns[1])\r\n\t#if score1 < score2 \r\n\t#\treturn $BestAns[0]\r\n\t#else \r\n\t#\treturn $BestAns[1]\r\n\t#end\r\n\t#test = order.permutation(2).to_a\r\n\t#print test\r\n\tans = twoOpt(map, $BestAns[0])\r\n\t#puts \"Order by greedy + 2-opt: \" + ans.to_s\r\n\t#puts \"=====================================================================================================================================================\"\r\n\t#puts \"====================================================================================================================================================\"\r\n\treturn ans\r\n\t#return twoOpt(map, order)\r\n\t#return randomShit(map,order)\r\n\r\n\t\r\nend",
"def bitonic_sort(array)\n return array if array.length <= 1\n\n length = array.length\n num = nearest_power_of_2(array.length)\n\n # add place holder values\n array << Float::INFINITY until array.length == num\n\n array = bitonic_recurse(array, 0, array.length, 1)\n\n # remove place holder values\n array.pop until array.length == length\n\n array\nend",
"def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend",
"def shell_sort(array)\n # p array\n gap = array.length/2\n while gap > 0\n idx = 0\n while idx < array.length - gap\n # while loop to move multiple steps\n while array[idx + gap] < array[idx]\n array[idx+gap],array[idx] = array[idx],array[idx+gap]\n if idx >= gap\n idx -= gap \n else\n break\n end\n end\n idx += 1\n end\n gap = gap/2\n # puts \"new gap is #{gap}\"\n p \"-\" * 10\n # p array verify properly sorting\n end\nend",
"def sortmore(array)\n (array.length-1).times do |a|\n i = 0\n n = array.length-2\n\n begin\n if array == [] || array == [1]\n break\n elsif array[i] > array[i+1] then\n\n array[i], array[i+1] = array[i+1], array[i]\n\n next\n\n end\n\n i+= 1\n end until i > n\n end\n print array\n return array\n end",
"def solution4(a)\n left = 0\n right = a.size - 1\n distinct = 0\n\n while left <= right\n # puts \"left: #{left}, right: #{right}\"\n # puts \"a[l]: #{a[left]}, a[r]: #{a[right]}\"\n # puts \"distinct: #{distinct}\"\n if a[left].abs > a[right].abs\n begin\n left += 1\n end until a[left] != a[left - 1]\n elsif a[left].abs < a[right].abs\n begin\n right -= 1\n end until a[right] != a[right + 1]\n else\n begin\n left += 1\n end until a[left] != a[left - 1]\n begin\n right -= 1\n end until a[right] != a[right + 1] \n end\n\n distinct += 1\n end\n distinct\nend",
"def lucas_sequence(n)\n if n == 0\n return []\n end\n if n == 1 \n return [2]\n end\n if n == 2\n return [2,1]\n end\n lucas_sequence(n-1) << lucas_sequence(n-1)[-1] + lucas_sequence(n-1)[-2]\nend",
"def almostIncreasingSequence(sequence)\n ans = true\n i = 0\n len = sequence.length-1\n while (i < sequence.length-1 && ans == true)\n if (sequence[i] < sequence[i+1])\n ans = true\n else\n # puts sequence.inspect\n if(sequence[i+2] != nil && sequence[i+2] > sequence[i])\n sequence.delete_at(i+1)\n elsif(i+1 == len)\n sequence.delete_at(i+1)\n else\n sequence.delete_at(i)\n end\n ans = (sequence.length >= len)\n i = -1\n end\n i += 1\n end\n ans\n\nend",
"def sean_sort(numbers)\n\n\nend",
"def TN93(sequence_array = [])\n diff = []\n seq_hash = count(sequence_array)\n seq_hash.values.each do |v|\n comb = v * (v - 1) / 2\n comb.times {diff << 0}\n end\n\n seq_hash.keys.combination(2).to_a.each do |pair|\n s1 = pair[0]\n s2 = pair[1]\n diff_temp = compare_two_seq(s1,s2)\n comb = seq_hash[s1] * seq_hash[s2]\n comb.times {diff << diff_temp}\n end\n\n count_diff = count(diff)\n out_hash = Hash.new(0)\n Hash[count_diff.sort_by{|k,v|k}].each do |k,v|\n out_hash[k] = v\n end\n return out_hash\nend",
"def solution(a)\n sorted_array = a.sort\n\n index = 0\n while index < sorted_array.length do\n break unless sorted_array[index] == sorted_array[index+1]\n index += 2\n end\n\n sorted_array[index]\nend",
"def smooth_sort(array)\n orders = [0]\n trees = 0\n\n (0...array.length).each do |i|\n if trees > 1 && orders[trees - 2] == orders[trees - 1] + 1\n trees -= 1\n orders[trees - 1] += 1\n elsif trees > 0 && orders[trees - 1] == 1\n orders[trees += 1] = 0\n else\n orders[trees += 1] = 1\n end\n find_and_sift(array, i, trees - 1, orders)\n end\n (array.length - 1).downto(1) do |i|\n if orders[trees - 1] <= 1\n trees -= 1\n else\n right_index = i - 1\n left_index = right_index - LEONARDO_NUMS[orders[trees - 1] - 2]\n trees += 1\n orders[trees - 2] -= 1\n orders[trees - 1] = orders[trees - 2] - 1\n find_and_sift(array, left_index, trees - 2, orders)\n find_and_sift(array, right_index, trees - 1, orders)\n end\n end\n array\nend",
"def bubble_sort_by(input)\r\n sorted = false\r\n last_index = input.length-2\r\n until sorted\r\n swaps = 0\r\n 0.upto(last_index) do |i|\r\n if yield(input[i], input[i+1]) < 0\r\n input[i],input[i+1] = input[i+1],input[i]\r\n swaps += 1\r\n end\r\n end\r\n sorted = true if swaps == 0\r\n last_index -= 1\r\n end\r\n input\r\nend",
"def ChangingSequence(arr)\n idx = 2\n\n while idx < arr.length\n if arr[1] > arr[0] && arr[idx] < arr[idx-1]\n return idx - 1\n elsif arr[1] < arr[0] && arr[idx] > arr[idx-1]\n return idx - 1\n end\n idx += 1\n end\n\n -1\nend",
"def gnomesort(a)\n a.start_logging\n\n i = 0\n while i < a.length\n if i == 0 || a[i] > a[i - 1]\n i += 1\n else\n a[i], a[i - 1] = a[i - 1], a[i]\n a.log\n i -= 1\n end\n end\n\n a\nend",
"def lucas_sequence(n)\n return [] if n == 0\n return [2] if n == 1\n return [2,1] if n== 2\n\n result = lucas_sequence(n-1)\n result << result[-1] + result[-2]\n result\nend",
"def test_merge_sort_helper\n # Arrange\n hundred_elements = (0..100).to_a\n cases = [{input: [0], expected: [0]},\n {input: [0, 1], expected: [0, 1]},\n {input: [0, 1, 2, 5, 7], expected: [0, 1, 2, 5, 7]},\n {input: [1, 5, 2, 0], expected: [0, 1, 2, 5]},\n {input: hundred_elements.shuffle, expected: hundred_elements}]\n\n\n cases.each { |test_case|\n # Act\n @aux = Array.new(test_case[:input].length)\n actual = standard_merge_sort test_case[:input], 0, test_case[:input].length - 1\n\n # Assert\n assert_equal test_case[:expected], actual\n }\n end",
"def pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def shell_sort(arr)\n gap = arr.size / 2\n until gap >= 1\n (0...gap).each do |i|\n j = i\n while j < arr.size\n arr[j], arr[j+gap] = arr[j+gap], arr[j] if arr[j] > arr[j+gap]\n j = j + gap\n end\n end\n gap, mod = gap.divmod(2)\n gap = mod == 0 ? gap + 1 : gap\n end\n arr\nend",
"def solution(n, gaps = [])\n n = n.to_s(2).split('') unless n.is_a?(Array)\n idx = n.index('1')\n subarr = n[idx + 1..-1]\n gap = subarr.index('1')\n gaps << gap unless gap.nil?\n solution(subarr, gaps) unless subarr.empty? || subarr.length == 1 || gap.nil?\n gaps.nil? || gaps.empty? ? 0 : gaps.max\nend",
"def sluggish_octopus!(array)\n sorted = false\n until sorted\n sorted = true\n array.each_index do |index|\n index_2 = index + 1\n next if index_2 == array.length\n if array[index].length > array[index_2].length\n array[index],array[index_2] = array[index_2],array[index]\n sorted = false\n end\n end\n end\n array[-1]\nend",
"def lucas_sequence(n)\n if n == 0\n []\n elsif n == 1\n [2]\n elsif n == 2\n [2, 1]\n else\n seq = lucas_sequence(n-1)\n seq << seq[-1] + seq[-2]\n end\nend",
"def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend",
"def nyc_bribes(a)\n return -1 unless is_valid?(a)\np \"valid\"\n k = bubble_sort(a)\n\n return k\nend",
"def bubbly(arr)\n loop do\n switch = false\n (arr.length - 1).times do |i|\n \tif arr[i] > arr[i + 1]\n arr[i + 1],arr[i] = arr[i],arr[i + 1]\n switch = true\n end\n end\n if switch == false\n break\n end\n end\n arr\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def find_shortest_seq(n)\n new_num = n/2\n i = 0\n arr = []; arr[i] = 1\n\n while(arr[i] < new_num)\n n1 = arr[i] * 2\n n2 = arr[i] + 1\n\n i += 1\n if(n1 < new_num)\n arr[i] = n1\n else\n arr[i] = n2\n end \n end\n puts arr.to_s\n if(arr[i] == n)\n puts arr.to_s\n puts i \n elsif n == (arr[i] * 2)\n arr[i + 1] = arr[i] * 2\n puts arr.to_s\n puts i + 1\n else\n arr[i + 1] = arr[i] * 2\n i += 1\n arr[i + 1] = arr[i] + 1\n puts arr.to_s\n puts i\n end \n \nend",
"def solution(h)\n h.inject([1, [h.first]]) do |(blocks, stack), n|\n next [blocks+1, stack.push(n)] if stack.last < n\n stack.pop while stack.any? && stack.last > n\n next [blocks, stack] if stack.last == n\n \n [blocks+1, stack.push(n)]\n end.first\nend",
"def sort3(collection)\n # p \"sort 3\"\n # p collection\n collection[1..-1].each_with_index do |el, i|\n k = i + 1\n # p \"*********** i is: #{i} ************\"\n while collection[k] < collection[k-1]\n # p \"k is: #{k}\"\n # p \"swapping #{collection[k]} with #{collection[k-1]}\"\n collection[k], collection[k-1] = collection[k-1], collection[k]\n # p collection\n # p \"subtracting 1 from k\"\n k -= 1\n break if k == 0\n end\n end\n collection\nend",
"def sort_array_by_parrity(nums)\n even_misplaced = 0\n odd_misplaced = 1\n arr_len = nums.length\n\n while even_misplaced < nums.length && odd_misplaced < nums.length\n if nums[even_misplaced].even?\n even_misplaced += 2\n elsif nums[odd_misplaced].odd?\n odd_misplaced += 2\n else\n nums[even_misplaced] , nums[odd_misplaced] = nums[odd_misplaced], nums[even_misplaced]\n even_misplaced += 2\n odd_misplaced += 2\n end\n end\n\n nums\nend",
"def shell_sort(array)\n p array\n gap = array.length/2\n while gap > 0\n puts \"gap is currently #{gap}\"\n idx = 0\n while idx < array.length - gap\n # while loop to move multiple steps\n while array[idx + gap] < array[idx]\n array[idx+gap],array[idx] = array[idx],array[idx+gap]\n if idx > 0\n idx -= 1\n else\n break\n end\n end\n idx += 1\n end\n gap = gap/2\n p \"-\" * 10\n p array\n end\nend",
"def minimumBribes(q)\r\n moves = 0\r\n r = (0..q.size-1).to_a\r\n\r\n until q == (1..q.size).to_a do\r\n q.map { |a| a - 1 }\r\n .reverse_each.with_index do |person, i|\r\n i = q.size - i - 1\r\n if person - i > 2\r\n puts \"Too chaotic\"\r\n return\r\n end\r\n\r\n if person > r[i] && person > q[person] -1\r\n moves += person - r[i]\r\n q = q - [person + 1]\r\n q.insert(person, person + 1)\r\n end\r\n end\r\n end\r\n\r\n puts moves\r\nend",
"def longest_decreasing_subsequence(sequence)\n len = sequence.length\n\n # construct a temp array to store lenght of LDS at each index(default len: 1)\n temp = [1] * len # or Array.new(len, 1)\n\n (len - 2).downto(0) do |i|\n (len - 1).downto(i - 1) do |j|\n if sequence[i] > sequence[j] && temp[i] < temp[j] + 1\n temp[i] = temp[j] + 1\n end\n end\n end\n\n return temp.max\nend",
"def sort(input)\n # If the length of the array is < or = 1, then we already\n # know it's sorted, so exit\n return input if input.length <= 1\n\n # Now we want to run this algorithm in a loop for forever\n # until we know that the entire array is sorted. That\n # will be our \"break\" condition - the condition to\n # break out of the loop.\n\n swapped = true\n while swapped do\n # We set swapped equal to false here, because we\n # basically want to set it only to true when we've\n # actually swapped something. If we never swap anything\n # in this iteration of the loop, it means that the\n # array is sorted and we're done.\n swapped = false\n\n # We use upto, which is a function from Enumerators\n # https://ruby-doc.org/core-2.2.0/Integer.html#method-i-upto\n # We basically are saying we are going to access through the\n # array we're given, up until the length of it -2. Why?\n # We're accessing each of the array elements by index.\n # Example: [1,2,3,4]\n # If we want to get 1 from the array, we access element 0.\n # In this example, we want to access the current index and the\n # index ahead of it. So, in this loop, we only want to try\n # and access the length of the array minus 2, because otherwise\n # we'll run out of the bounds of the array.\n 0.upto(input.length - 2) do |index|\n # If the number at our current index is greater than the one\n # in front of it... swap!\n if input[index] > input[index+1]\n # Here's a neat trick you can do so you don't have to assign\n # any variables to hold onto a value.\n input[index], input[index+1] = input[index+1], input[index]\n swapped = true\n end\n end\n end\n\n input\nend",
"def is_sorted(input)\n if (input.length < 2)\n return true\n end\n for i in 1..input.length - 1\n if (input[i-1] > input[i])\n return false\n end\n end\n return true\nend",
"def is_sorted(input)\n if (input.length < 2)\n return true\n end\n for i in 1..input.length - 1\n if (input[i-1] > input[i])\n return false\n end\n end\n return true\nend",
"def is_sorted(input)\n if (input.length < 2)\n return true\n end\n for i in 1..input.length - 1\n if (input[i-1] > input[i])\n return false\n end\n end\n return true\nend",
"def is_sorted(input)\n if (input.length < 2)\n return true\n end\n for i in 1..input.length - 1\n if (input[i-1] > input[i])\n return false\n end\n end\n return true\nend",
"def is_sorted(input)\n if (input.length < 2)\n return true\n end\n for i in 1..input.length - 1\n if (input[i-1] > input[i])\n return false\n end\n end\n return true\nend",
"def lucas_sequence(n)\n return [] if n <= 0\n return [2] if n == 1\n return [2, 1] if n == 2\n\n lucas_sequence(n - 1) << lucas_sequence(n - 1)[-1] + lucas_sequence(n - 1)[-2]\nend",
"def mountain_seq(nums)\n start_ind = 0\n last_ind = nums.size - 1\n while start_ind + 1 < last_ind do \n mid = start_ind + (last_ind - start_ind) / 2\n if nums[mid] > nums[mid + 1]\n last_ind = mid\n else\n start_ind = mid\n end\n end\n\n [nums[start_ind], nums[last_ind]].max\nend",
"def insertionsort! arr\n (1..arr.size - 1).each do |i|\n j = i\n while j > 0 && arr[j] < arr[j - 1] do\n arr[j], arr[j - 1] = arr[j - 1], arr[j]\n j -= 1\n end\n end\n arr\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend",
"def bubble_sort(numbers)\n permutation = nil\n\n while permutation != 0 do # N times\n permutation = 0\n\n numbers.each_with_index do |number, index| # N times\n next if numbers[index + 1].nil?\n\n if number > numbers[index + 1]\n numbers.insert(index + 1, numbers.delete_at(index))\n permutation += 1\n end\n end\n end\n\n numbers\nend",
"def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend",
"def sort2(num_array)\n n = num_array.length - 1\n for i in 0..n\n for j in 0..(n-i-1)\n if num_array[j] >= num_array[j+1]\n num_array[j], num_array[j+1] = num_array[j+1], num_array[j]\n end\n end\n end\n return num_array\nend",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend",
"def selection_sort3(array)\n n = array.length\n n.times do |i|\n # assume the min number is the leftmost one, until proven otherwise\n minimum_index = i\n # checking all the digits to the right of i\n ((i + 1)..n - 1).each do |j|\n # if one of those digits is smaller than the one at i, we have a new min\n minimum_index = j if array[j] < array[minimum_index]\n end\n # once the min has been found, we swap it with the leftmost one.\n array[i], array[minimum_index] = array[minimum_index], array[i]\n p array\n end\n array\nend",
"def strand_sort(array)\n temp = array.dup\n result = []\n until temp.empty?\n value = temp.first\n sublist, temp = temp.partition { |val| value = val if value <= val }\n result += sublist.shift(sublist.length) if result.empty?\n result = binary_sort(result, sublist)\n end\n result\nend",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def lucasSequence(n)\n if n == 0\n return []\n elsif n == 1\n return [2]\n elsif n == 2\n return [2,1]\n end\n\n seq = lucasSequence(n-1)\n seq << seq[-1] + seq[-2]\n seq\nend",
"def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend",
"def variant_for_poisson(seq)\n seq_size = seq.size\n l = seq[0].size - 1\n var = []\n (0..l).to_a.each do |pos|\n nt = []\n seq.each do |s|\n nt << s[pos]\n end\n count_nt = count(nt)\n v = seq_size - count_nt.values.max\n var << v\n end\n var_count = count(var)\n var_count.sort_by{|key,value|key}.to_h\nend",
"def sort_by_perfsq(array)\n numbers = {}\n array.each do |n|\n numbers[n] ||= 0\n\n n.to_s.split('').permutation.to_a.uniq.each do |arr|\n sqrt = Math.sqrt(arr.join.to_i)\n numbers[n] += 1 if sqrt == sqrt.to_i\n end\n end\n\n sorted = array.sort do |x, y|\n numbers[x] > numbers[y] ? 1 : numbers[x] == numbers[y] ? x > y ? -1 : x == y ? 0 : 1 : -1\n end\n sorted.reverse\nend",
"def sort(array)\n array.each_index do |i|\n (array.length - i - 1).times do |job|\n if array[cownt] > list[cownt + 1]\n array[cownt], array[cownt + 1] = array[cownt + 1], array[cownt]\n end\n end\n end\nend",
"def lucas_sequence(n)\n return [] if n == 0\n lucas_sequence(n-1)+[lucas_number(n)]\nend",
"def sort(array, length)\n length.times do |index| # outer loop - narray\n min_index = index # assume index is where the next minimally value is\n temp_index = index + 1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1array\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def integer_pigeonhole_sort(numbers)\n sorted = []\n\n numbers.length.times do |i|\n sorted << i\n end\n\n sorted\nend",
"def solution(a)\n \n max = 0\n # write your code in Ruby 2.2\n max if a.nil? || a.length == 0\n \n if a.length < 4\n max = 1\n a.each do |item|\n max = max * item\n end\n max\n end\n \n # order first => nlogn + left and right edge max three\n a.sort!\n \n # - - -\n # + + +\n if a[0] >= 0 || a[-1] <= 0 || a[1] >= 0\n max = a[-1] * a[-2] * a[-3]\n max\n end\n \n # n = 4\n max = a[0] * a[1] * a[2]\n max = [max,a[0] * a[1] * a[-1]].max\n max = [max,a[0] * a[-2] * a[-1]].max\n max = [max,a[-3] * a[-2] * a[-1]].max\n max\n end",
"def longest_increasing_subsequence(nums) len = nums.length\n return len if len < 2\n\n# After calculating lis for each index, take a max by 1 value equal to max, go backwards on lis array, and every time we find an element equal to max, we add that element to result and decrement max by 1. Hereby we'll get the indexes array in reversed order.\n lis_array = find_lis_lengths(nums)\n\n result = []\n max = lis_array.max\n i = len - 1\n while i >= 0\n if lis_array[i] == max\n result.unshift(nums[i])\n max -= 1\n end\n i-= 1\n end\n result\n\nend",
"def buuble_sort(arr)\n\tloop do\n\t\tloop_break = true\n\t\t(arr.length-1).times do |i|\n\t\tif arr[i]>arr[i+1]\n\t\t\tarr[i], arr[i+1] = arr[i+1], arr[i]\n\t\t\tloop_break = false\n\t\tend\n\t\tend\n\tbreak if loop_break\n\tend\n\tputs arr\nend",
"def find_missing_number(sequence)\n if sequence == \"\"\n return 0\n end\n # remove whitespaces and convert to array\n sequence = sequence.gsub(/\\s+/, \",\").split(\",\")\n\n # string to array\n # sequence = sequence.split(\",\")\n\n # sort by integer value\n sequence = sequence.sort_by(&:to_i)\n # sort string\n # sequence = sequence.chars.sort.join\n puts sequence \n\n \n if sequence[0].to_i != 1\n return 1\n elsif\n sequence[0].to_i == 1 && sequence.length == 1\n return 1\n elsif\n sequence.count(\"a-zA-Z\") > 0\n return 1\n elsif\n sequence == \"\"\n return 0\n elsif\n sequence[0].to_i == 2\n return 1\n else\n \n for i in 1..sequence.length - 1\n\n check = sequence[i].to_i - sequence[i - 1].to_i\n\n if check > 1\n missNum = sequence[i - 1].to_i + 1\n return missNum\n end\n\n end\n if check == 1\n return 0\n end\n end\nend",
"def zig_zag(arr)\n # return 0 unless arr.length > 1\n\n arr.each_with_index do |x, i|\n return arr if arr[i + 1].nil?\n\n #y = x\n if ((x > arr[i + 1]) && i.even? ) || ((x < arr[i + 1]) && i.odd?)\n arr[i..(i + 1)] = arr[i..(i + 1)].reverse\n #arr[i] = arr[i + 1]\n #arr[i + 1] = y\n end\n end\n end",
"def bubble_sort_by_concept_one(array)\n n = array.length\n\n while n.positive?\n\n j = 0\n\n (1..n - 1).each do |k|\n compare_result = yield array[j], array[k]\n\n # if array[j] > array[k], swap these two values\n if compare_result.positive?\n store = array[j]\n array[j] = array[k]\n array[k] = store\n end\n j += 1\n end\n n -= 1; # last element is now sorted\n end\n\n array\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def alternatingSort(a)\n ar = []\n f = a\n s = a.reverse\n (0...a.size).each do |i|\n if i.even?\n ar.push(f.shift)\n else\n ar.push(s.shift)\n end\n end\n return true if a.size == 1\n return false if ar.each_cons(2).any?{|(x,y)| x >= y}\n \n true\nend",
"def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend",
"def low_missing(input)\n i = 0\n while i < input.length\n item = input[i]\n next i += 1 if input[item] == input[i]\n next i += 1 if item < 0 || item > input.length - 1\n input[i], input[item] = input[item], input[i]\n end\n out = 1\n out += 1 while out == input[out]\n out\nend",
"def solution(a)\n if a.count >= 3\n distances = []\n last = nil\n (1...a.count - 1).each { |i|\n if a[i] > a[i - 1] and a[i] > a[i + 1]\n distances << i - last if last\n last = i\n end\n }\n puts distances.inspect\n \n (distances.count + 1).downto(1) { |flags|\n return flags if distances.all? { |d| d >= flags }\n }\n end\n 0\nend",
"def reverse_seq(n)\n # long solution\n # arr = []\n # for i in 1..n do\n # arr.unshift(i)\n # end\n # p arr\n # sort solution\n p Array(1..n).reverse\n end",
"def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend"
] |
[
"0.6679203",
"0.6467372",
"0.6438212",
"0.6434923",
"0.6413566",
"0.634645",
"0.6256383",
"0.6164571",
"0.61275226",
"0.6104325",
"0.6102129",
"0.6092222",
"0.60886526",
"0.6066543",
"0.60653037",
"0.6042917",
"0.6025384",
"0.60250777",
"0.60055864",
"0.59936637",
"0.59666616",
"0.5943609",
"0.5942583",
"0.59336907",
"0.59293985",
"0.59231496",
"0.5920565",
"0.5909238",
"0.590914",
"0.59025747",
"0.58949935",
"0.58933645",
"0.5892429",
"0.5889226",
"0.5888864",
"0.5887434",
"0.5871878",
"0.5866549",
"0.58597964",
"0.58583724",
"0.5855063",
"0.5854472",
"0.5851206",
"0.58478075",
"0.5843398",
"0.58380795",
"0.58352184",
"0.5835099",
"0.58256054",
"0.5819638",
"0.5818331",
"0.5810736",
"0.5810694",
"0.5804591",
"0.5802004",
"0.57967556",
"0.57960457",
"0.5781242",
"0.5766652",
"0.57558507",
"0.57557666",
"0.5753953",
"0.5751692",
"0.57476646",
"0.57476646",
"0.57476646",
"0.57476646",
"0.57476646",
"0.5744498",
"0.5741299",
"0.5739439",
"0.57382566",
"0.5737864",
"0.5737704",
"0.57255757",
"0.5725124",
"0.57225174",
"0.57184625",
"0.57169455",
"0.57124066",
"0.5711588",
"0.57108486",
"0.5709341",
"0.5709107",
"0.57067364",
"0.5699726",
"0.56966466",
"0.569503",
"0.5694084",
"0.5692592",
"0.5687385",
"0.5686591",
"0.568647",
"0.5682533",
"0.56752205",
"0.5674315",
"0.5671713",
"0.56683594",
"0.5661989",
"0.56612486",
"0.5660074"
] |
0.0
|
-1
|
I could extract the return of this function into an object data_clump
|
def determine_damage
if Random.rand(100) < critical_rate
[fighter_attack * 2, FightEvent.attack_types['critical']]
else
[fighter_attack, FightEvent.attack_types['normal']]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def get_data()\t\n\tend",
"def getc() end",
"def getc() end",
"def getc() end",
"def collect_data( data )\n data\n end",
"def code_of_conduct; end",
"def getc()\n #This is a stub, used for indexing\n end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def do_data(data); end",
"def data\n Rubabel::MoleculeData.new(@ob)\n end",
"def data(*args); end",
"def data\n @data ||= @_data.respond_to?(:call) ? @_data.call() : @_data\n end",
"def getc\n end",
"def getc\n end",
"def fancy_clu\n clu_obj = CLU.new\n @clu.each { |pixel| clu_obj.array.push(pixel) }\n return clu_obj\n end",
"def data\n # This is a common memoization technique used in Ruby\n @data ||= normalize_data\nend",
"def cp_l\n end",
"def dalli\n @data\n end",
"def cpl\n end",
"def data() @data ||= Data.new( self ); end",
"def basic_clasificator origen,dpworld_data,stwd_data,hit_data\n origen.each do |params|\n\tputs \"FILA: #{params.to_s}\"\n $LOG.debug \" LIBERACION: #{params.to_s}\"\n case [ params['ptocreacion'] , params['solvenciaNotifId'] ]\n when ['DOCAU',1]\n dpworld_data << ReleaseCaucedo.new( params )\n when ['DOCAU',4]\n stwd_data << ReleaseSTWD.new( params )\n when ['DOHAI',2]\n\t hit_data << ReleaseHIT.new( params )\n end\n end\n [dpworld_data,stwd_data,hit_data]\nend",
"def calculated_datapoints_for_councils\n return if calculation_method.blank?\n raw_results = datapoints.sum(:value, :group => :area_id, :conditions => {:area_type => 'Council'}, :order => \"sum_value DESC\").to_a #for some reason we can't group by polymorphic belongs_to\n return if raw_results.blank?\n raw_results = raw_results.select{ |r| r.last > 0.0 }.transpose\n councils = Council.find(raw_results.first) # .. so we have to go through hoops if we want to return councils as keys to values, rather than council_ids. B fetching councils gives us default order which we have to blow out\n # There's also the the problem that default_scope on councils returns in named order, not order we asked for them in, and something funny going on with OrderedHash returned from\n # sum, which means order is screwing up\n res = []\n muid_format, muid_type = dataset_topics.first.muid_format, dataset_topics.first.muid_type\n raw_results.first.each_with_index do |council_id, i|\n council = councils.detect{ |c| c.id == council_id }\n res<< BareDatapoint.new(:area => council, :subject => self, :value => raw_results.last[i], :muid_format => muid_format, :muid_type => muid_type)\n end\n res\n end",
"def data= data \n end",
"def get_data\n\t\texecute unless @result\n\t\treturn get_data_from_result(@result)\n\tend",
"def get_data\n raise \"overwrite it\"\n end",
"def stored_data; end",
"def clensing\n @data.reject(&:nil?)\n end",
"def data\n nil\n end",
"def ccf\n end",
"def compile_data(klass)\n model = Object.const_get(\"Cropster::Response::\" + klass)\n\n process(model, @data_set)\n @compiled_data\n end",
"def data\n @data\n end",
"def initialize_data\n end",
"def data; @data ||= fetch; end",
"def cp_d\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def call\n data\n end",
"def get_list_data\n\t\tlist_data = Array.new\n\t\tlist = get_list\n\t\tlist.each do |item|\n\t\t\tvoc = Voc.find(item)\n\t\t\tvoc.wylie = Functions.disparse_a(voc.wylie)\t\n\t\t\tlist_data.push( voc )\n\t\tend\n\t\treturn list_data\n\tend",
"def getc\n raise NotImplementedError\n end",
"def get_data\n data = ProjectHanlon::Data.instance\n data.check_init\n data\n end",
"def cp_c\n end",
"def get_data(locals: {}, data:{}) \n\t\t_data = get_local(locals: locals, key: \"data\", alt: {})\n\t\t_data = _data.merge(data)\n\t\treturn _data\n\tend",
"def ExtractData (f)\n pass\n\nend",
"def data\n raise NotImplementedError\n end",
"def data\n @data_t\n end",
"def get_data\n $test_logger.log(\"Get data\")\n\n if @data.is_a?(Array) \n data_copy = Array.new(@data.size)\n @data.each_with_index{|d, i|\n if !d.to_s.include? CmdManager::DONT_CARE\n data_copy[i] = BioPacket.swap_dword(d)\n else\n data_copy[i] = d\n end \n } \n else\n data_copy = Common.get_obj_copy(@data)\n end \n data_copy\n end",
"def get_data\n @data = []\n end",
"def ndata; end",
"def data\n @datas\n end",
"def fetch_data\n return @data if @data[\"/type/reflect/any_master\"]\n @data = Ken.session.mqlread(FETCH_DATA_QUERY.merge!(:id => id))\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def values() end",
"def cp_h\n end",
"def getc; nil; end",
"def data(dc, target)\n []\n end",
"def prepare_result; end",
"def request_data; end",
"def data\n @_data ||= (@response['data'] || {})\n # ap @_data if ENV['GIZMO_DEBUG']\n end",
"def init_data\n end",
"def data\n @values.fetch('data') { \n @values['data'] = nil\n }\n end",
"def data\r\n @data\r\n end",
"def data\n @data\n end",
"def gcdlcm(p0) end",
"def data= a; @data = a ;end",
"def clone\n\t\t\tCData.new self\n\t\tend",
"def data\n {}\n end",
"def merged_result; end",
"def data\n @data ||= aggregate\n end",
"def include_gathered_data\n compile_user_data if @@aggregate.length == 6\n end",
"def data(_value=nil, _repair=false)\n raise NotImplementedError.new\n end",
"def original_result; end",
"def _V(data) ; end",
"def site_data; end",
"def getlocal() end",
"def farmies(data)\nend",
"def updated_data; end",
"def patches\n DATA\n end",
"def patches\n DATA\n end",
"def patches\n DATA\n end",
"def patches\n DATA\n end",
"def patches\n DATA\n end",
"def patches\n DATA\n end",
"def patches\n DATA\n end"
] |
[
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61500263",
"0.61417675",
"0.60870653",
"0.60870653",
"0.60870653",
"0.59817535",
"0.59810597",
"0.59617096",
"0.59605724",
"0.59605724",
"0.59605724",
"0.59605724",
"0.5797492",
"0.5723071",
"0.5667785",
"0.5625568",
"0.55923915",
"0.55923915",
"0.5587769",
"0.5575836",
"0.55640936",
"0.5560739",
"0.55434364",
"0.5524229",
"0.5506105",
"0.54949296",
"0.5484638",
"0.5473213",
"0.54720336",
"0.5471399",
"0.5449564",
"0.54437196",
"0.5443366",
"0.5441077",
"0.54395133",
"0.5433556",
"0.54252625",
"0.54226923",
"0.54055977",
"0.54055977",
"0.54055977",
"0.5382463",
"0.53784674",
"0.537601",
"0.53682804",
"0.53620327",
"0.53525466",
"0.53326035",
"0.53150296",
"0.53128177",
"0.52971387",
"0.52970976",
"0.5294518",
"0.5280549",
"0.5269483",
"0.52619135",
"0.52619135",
"0.52619135",
"0.52488446",
"0.5248177",
"0.5237199",
"0.5233046",
"0.52327055",
"0.5211053",
"0.5210469",
"0.5204471",
"0.51701975",
"0.51620847",
"0.5159707",
"0.51574105",
"0.51511323",
"0.51501715",
"0.51449364",
"0.5139179",
"0.51347387",
"0.5128141",
"0.5118148",
"0.51098067",
"0.5103326",
"0.5098671",
"0.50937426",
"0.5079678",
"0.5078658",
"0.50659305",
"0.50659305",
"0.50659305",
"0.50659305",
"0.50659305",
"0.50659305",
"0.50659305"
] |
0.0
|
-1
|
GET /restaurants/1/tables GET /restaurants/1/tables.json
|
def index
@tables = @restaurant.tables
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @restaurant_table = RestaurantTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_table }\n end\n end",
"def list(table)\n self.get(\"/#{table}\")\n end",
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def index\n @title = 'Tables'\n @tables = Table.all\n\n respond_to do |format|\n format.html {\n @tables_rabl = Rabl.render(@tables, 'tables/index', view_path: 'app/views', format: 'json')\n @guests_rabl = Rabl.render(Guest.attending, 'tables/guests', view_path: 'app/views', format: 'json')\n }\n format.json { render json: @tables }\n end\n end",
"def index\n json_response(Restaurant.all)\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def index \n restaurant = Restaurant.all\n render json: restaurant\n end",
"def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def index\n current_admin_user\n @tablets = Tablet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tablets }\n end\n end",
"def show\n @table = Table.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def create\n if current_user.restaurant_ids.include?(params[:restaurant_id].to_i)\n # find new table number\n table_index = 1\n tables = Table.where(restaurant_id: params[:restaurant_id])\n if !tables.nil? && tables.count > 0\n tables.each do |table|\n table_index = table.table_number + 1 if table.table_number >= table_index\n end \n end\n\n @table = Table.new(restaurant: Restaurant.find(params[:restaurant_id]), table_number: table_index)\n\n if @table.save\n render json: @table, status: :created, location: nil\n else\n render json: @table.errors, status: :unprocessable_entity\n end\n else\n render json: { error: \"can't add tables to restaurants you don't own\" }, status: :unprocessable_entity\n end\n end",
"def new\n @restaurant_table = RestaurantTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant_table }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def set_restaurant_table\n @restaurant_table = RestaurantTable.find(params[:id])\n end",
"def create\n @table = @restaurant.tables.build(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to restaurant_tables_path(@restaurant), notice: 'Table was successfully created.' }\n format.json { render :show, status: :created, location: @table }\n else\n format.html { render :new }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @through_tables = ThroughTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @through_tables }\n end\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end",
"def index\n @data_tables = DataTable.all\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @data_tables.as_json(only: [:title, :username, :name, :email, :hometown]) }\n # end\n end",
"def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end",
"def index\n json_response(current_restaurant.restaurant_food_items)\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end",
"def table_response(key, query = nil, *args)\n url = File.join(properties.primary_endpoints.table, *args)\n\n headers = build_headers(url, key, 'table')\n headers['Accept'] = 'application/json;odata=fullmetadata'\n\n # Must happen after headers are built\n unless query.nil? || query.empty?\n url << \"?#{query}\"\n end\n\n ArmrestService.send(\n :rest_get,\n :url => url,\n :headers => headers,\n :proxy => proxy,\n :ssl_version => ssl_version,\n :ssl_verify => ssl_verify,\n )\n end",
"def index\n @ip_tables = IpTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ip_tables }\n end\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def index\n @restaurants = Restaurant.order('RANDOM()').limit(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def index\n @flights = Flight.all\n\n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => [:airplane, :reservations, :users, :seats] }\n end\n end",
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @favorite_routes = FavoriteRoute.all\n render json: @favorite_routes\n end",
"def get_table(table_name, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(:full_meta),\n }\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:get, table_uri(table_name, new_query(options), options), nil, headers, options)\n Serialization.table_entries_from_json(response.body)\n rescue => e\n raise_with_response(e, response)\n end",
"def tables(key = nil)\n key ||= properties.key1\n response = table_response(key, nil, \"Tables\")\n JSON.parse(response.body)['value'].map{ |t| Table.new(t) }\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def index\n @restaurants = Restaurant.all\nend",
"def index\n trips = Trip.all\n render json: trips\n end",
"def show\n @liber777_table = Liber777Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liber777_table }\n end\n end",
"def index\n \t@restaurants = Restaurant.all\n end",
"def show\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n render json: @get_restaurant_list\n end",
"def index\n #See all my restaurants\n #Retreive all the restaurants from the DB\n @restaurants = Restaurant.all\n end",
"def index\n @restaurant_table_ratings = RestaurantTableRating.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @user = current_user\n @restaurants = @user.restaurants\n @branches = Array.new\n @tables = Array.new\n\n @restaurants.each do |r|\n r.branches.each do |b|\n @branches.push(b)\n end \n end\n\n @restaurants.each do |r|\n r.branches.each do |b|\n b.tables.each do |t|\n @tables.push(t)\n end \n end \n end\n\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def index\n @favorite_templates = FavoriteTemplate.all\n render json: @favorite_templates\n end",
"def destroy\n @restaurant_table = RestaurantTable.find(params[:id])\n @restaurant_table.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_tables_url }\n format.json { head :no_content }\n end\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def get_data\n users_without_admin = User.where(\"name != 'admin'\").count\n users = Userarchyves.select('user_id, food, voted_for').where(archyves_id: current_round.id).all\n retaurants = Restaurant.select('id, votes').all\n \n # return json \n respond_to do |format|\n format.json {\n render json: {\n users: users.as_json(only: [:user_id, :food, :voted]),\n restaurants: retaurants.as_json(only: [:id, :votes]),\n winner: winner.as_json(only: [:id]),\n food_history: food_history.as_json(only: [:food]),\n round_end: round_ended?.as_json\n }\n }\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def render_json_show(table)\n render json: serializer(table).new(model(table).find(params[:id]))\n end",
"def get_schema\n schema = CLIENT_TABLES.map {|t| {:name => t.table_name, :columns => table_schema(t)} }\n \n# respond_to do |format|\n# format.js { render({:content_type => :js, :text => schema.to_json}) }\n# end\n \n render_json schema.to_json\n end",
"def show(table, id)\n self.get(\"/#{table}/show/#{id}\")\n end",
"def show\n @custom_table = CustomTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custom_table }\n end\n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def show\n @dummy_table = DummyTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dummy_table }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant.to_json(except: [ :created_at, :updated_at ], methods: [ :partial_dishes, :partial_comments, :busy, :partial_recommendations ]) }\n end\n end",
"def index\n @restaurants = Restaurant.order('name ASC')\n respond_with(@restaurants)\n end",
"def index\n\t\t@flights = Flight.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @flights }\n\t\tend\n\tend",
"def index\n # return restaurants in nearby area\n # needs to be implemented later--for now just return all globally available restaurants\n # max_distance = params[:maxDistance]\n # location = { latitude: params[:latitude], longitude: params[:longitude] }\n\n # Restaurant.all.select do |restaurant|\n # restaurant.distance_to(location) <= max_distance\n # end\n\n @restaurants = Restaurant.all\n\n render json: @restaurants\n end",
"def index\n @restaurant = Restaurant.find(restaurant_id)\n @dishes = Dish.where(restaurant_id: restaurant_id).all\n end",
"def show\n @through_table = ThroughTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @through_table }\n end\n end",
"def index\n @service_tables = ServiceTable.all\n end",
"def index\n @trtypes = Trtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trtypes }\n end\n end",
"def index\n type = params[:type]\n fg = params[:fg]\n @page = Page.find(2)\n @foodTypes = FoodType.all\n @type_id = type\n\n @foods = Food.find_by_sql([\"SELECT * FROM FOODS WHERE food_type_id = ?\", type])\n\n \n @foods = Food.find_by_sql(\"SELECT * FROM FOODS WHERE important = 't'\") if !params.has_key?(:type)\n \n \n if !fg.nil?\n @front_food = Food.find(fg) \n end if\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foods }\n end\n end",
"def index\n render json: Todo.all\n end",
"def index\n # Get trips for the trip type\n trips = Trip.all.where(trip_type: params[:trip_type] || 2)\n # (optional) if city_id params was provided\n trips = trips.joins(:city).where(\"cities.id = ?\", params[:city_id]) if params[:city_id]\n # (optional) if country_id params was provided\n trips = trips.joins(:city => :country).where(\"countries.id = ?\", params[:country_id]) if params[:country_id]\n # (optional) if sort params was provided\n if params[:sort]\n \n case params[:sort].downcase\n when 'popularity' # by number of bookings\n trips = trips.most_popular\n when 'rating' # by rating of reviews\n trips = trips.best_rated\n end\n\n end\n\n # Paginate\n trips = trips.page(params[:page] || 1).per(params[:per_page] || 20)\n\n render json: {\n trips: ActiveModelSerializers::SerializableResource.new(trips, each_serializer: TripSerializer),\n total: trips.total_count,\n page: trips.current_page,\n per_page: trips.limit_value\n }\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def get_all_tables\n\t\ttc = new_sub(@discovery['tables']['url'], @discovery['tables']['capability'])\n\t\ttc.listen.map {|x| JSON.parse(x) rescue nil}.compact\n\tend",
"def weekIndex\n render json: Restaurant.restaurantsWeek\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def show\n json_response(@restaurant)\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def table\n Response\n end",
"def index\n @restaurants = Restaurant.where(\"name like ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @restaurants.map(&:attributes) }\n end\n end",
"def show\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timetable }\n end\n end",
"def show\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timetable }\n end\n end",
"def index\n @talleres = Taller.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talleres }\n end\n end",
"def test_it_can_get_list_of_tables\n VCR.insert_cassette 'tables'\n tables = @api.tables('writer1')\n\n assert_kind_of Array, tables\n assert_equal 2, tables.size\n\n assert_kind_of Hash, tables.first\n assert_kind_of Hash, tables.last\n\n assert_equal \"out.c-main.categories\", tables.first[\"id\"]\n assert_equal \"out.c-main.products\", tables.last[\"id\"]\n assert_equal \"Categories\", tables.first[\"name\"]\n assert_equal \"Products\", tables.last[\"name\"]\n end",
"def index\n render json: reservations\n end",
"def index\n flights = scope.includes(:departure_airport, :destination_airport,\n :flight_executions).page(page)\n .per(per)\n json_response(PageDecorator.decorate(flights)\n .as_json(flight_details: true), :ok)\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end"
] |
[
"0.7248467",
"0.6869382",
"0.68106014",
"0.6714031",
"0.6665551",
"0.66593635",
"0.66562",
"0.6310047",
"0.6297372",
"0.62689877",
"0.6236629",
"0.62266326",
"0.62266326",
"0.62266326",
"0.6197502",
"0.6129593",
"0.61229014",
"0.61080986",
"0.60944676",
"0.6091092",
"0.60806197",
"0.6068368",
"0.6065992",
"0.60318863",
"0.5978587",
"0.5970875",
"0.5969514",
"0.5969514",
"0.5951525",
"0.59512746",
"0.594701",
"0.59232",
"0.5921414",
"0.5901915",
"0.5877609",
"0.5868767",
"0.58584994",
"0.58584994",
"0.58584994",
"0.58584994",
"0.58584994",
"0.58584994",
"0.58584994",
"0.58462274",
"0.5834426",
"0.58323175",
"0.5832249",
"0.58086634",
"0.58032966",
"0.5799278",
"0.57940817",
"0.5788369",
"0.5781018",
"0.5773434",
"0.5771621",
"0.57589555",
"0.5739386",
"0.5729832",
"0.572705",
"0.57209957",
"0.5715734",
"0.57053995",
"0.56987566",
"0.56920105",
"0.5690627",
"0.5687527",
"0.5685323",
"0.56828624",
"0.56786287",
"0.5676844",
"0.56766415",
"0.5672102",
"0.56623024",
"0.5647956",
"0.5640086",
"0.56366575",
"0.56331277",
"0.5630534",
"0.5628824",
"0.56212735",
"0.562022",
"0.5613641",
"0.5613641",
"0.5613641",
"0.5598453",
"0.5595756",
"0.55949104",
"0.55901027",
"0.5588882",
"0.55876803",
"0.5586063",
"0.5578611",
"0.5577079",
"0.5569666",
"0.5569666",
"0.5565356",
"0.5564935",
"0.5559459",
"0.5555581",
"0.5555247"
] |
0.7427656
|
0
|
GET /restaurants/1/tables/1 GET /restaurants/1/tables/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @restaurant_table = RestaurantTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_table }\n end\n end",
"def index\n @tables = @restaurant.tables\n end",
"def index \n restaurant = Restaurant.all\n render json: restaurant\n end",
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def index\n json_response(Restaurant.all)\n end",
"def list(table)\n self.get(\"/#{table}\")\n end",
"def index\n @title = 'Tables'\n @tables = Table.all\n\n respond_to do |format|\n format.html {\n @tables_rabl = Rabl.render(@tables, 'tables/index', view_path: 'app/views', format: 'json')\n @guests_rabl = Rabl.render(Guest.attending, 'tables/guests', view_path: 'app/views', format: 'json')\n }\n format.json { render json: @tables }\n end\n end",
"def create\n if current_user.restaurant_ids.include?(params[:restaurant_id].to_i)\n # find new table number\n table_index = 1\n tables = Table.where(restaurant_id: params[:restaurant_id])\n if !tables.nil? && tables.count > 0\n tables.each do |table|\n table_index = table.table_number + 1 if table.table_number >= table_index\n end \n end\n\n @table = Table.new(restaurant: Restaurant.find(params[:restaurant_id]), table_number: table_index)\n\n if @table.save\n render json: @table, status: :created, location: nil\n else\n render json: @table.errors, status: :unprocessable_entity\n end\n else\n render json: { error: \"can't add tables to restaurants you don't own\" }, status: :unprocessable_entity\n end\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def new\n @restaurant_table = RestaurantTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant_table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def set_restaurant_table\n @restaurant_table = RestaurantTable.find(params[:id])\n end",
"def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end",
"def create\n @table = @restaurant.tables.build(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to restaurant_tables_path(@restaurant), notice: 'Table was successfully created.' }\n format.json { render :show, status: :created, location: @table }\n else\n format.html { render :new }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end",
"def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def index\n @restaurants = Restaurant.order('RANDOM()').limit(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end",
"def index\n current_admin_user\n @tablets = Tablet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tablets }\n end\n end",
"def index\n @through_tables = ThroughTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @through_tables }\n end\n end",
"def index\n @data_tables = DataTable.all\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @data_tables.as_json(only: [:title, :username, :name, :email, :hometown]) }\n # end\n end",
"def show\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n render json: @get_restaurant_list\n end",
"def index\n json_response(current_restaurant.restaurant_food_items)\n end",
"def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end",
"def table_response(key, query = nil, *args)\n url = File.join(properties.primary_endpoints.table, *args)\n\n headers = build_headers(url, key, 'table')\n headers['Accept'] = 'application/json;odata=fullmetadata'\n\n # Must happen after headers are built\n unless query.nil? || query.empty?\n url << \"?#{query}\"\n end\n\n ArmrestService.send(\n :rest_get,\n :url => url,\n :headers => headers,\n :proxy => proxy,\n :ssl_version => ssl_version,\n :ssl_verify => ssl_verify,\n )\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def index\n @flights = Flight.all\n\n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => [:airplane, :reservations, :users, :seats] }\n end\n end",
"def index\n @ip_tables = IpTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ip_tables }\n end\n end",
"def show\n @liber777_table = Liber777Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liber777_table }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant.to_json(except: [ :created_at, :updated_at ], methods: [ :partial_dishes, :partial_comments, :busy, :partial_recommendations ]) }\n end\n end",
"def index\n type = params[:type]\n fg = params[:fg]\n @page = Page.find(2)\n @foodTypes = FoodType.all\n @type_id = type\n\n @foods = Food.find_by_sql([\"SELECT * FROM FOODS WHERE food_type_id = ?\", type])\n\n \n @foods = Food.find_by_sql(\"SELECT * FROM FOODS WHERE important = 't'\") if !params.has_key?(:type)\n \n \n if !fg.nil?\n @front_food = Food.find(fg) \n end if\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foods }\n end\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def render_json_show(table)\n render json: serializer(table).new(model(table).find(params[:id]))\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def index\n @favorite_routes = FavoriteRoute.all\n render json: @favorite_routes\n end",
"def index\n @restaurants = Restaurant.all\nend",
"def destroy\n @restaurant_table = RestaurantTable.find(params[:id])\n @restaurant_table.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_tables_url }\n format.json { head :no_content }\n end\n end",
"def show\n @dummy_table = DummyTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dummy_table }\n end\n end",
"def index\n # return restaurants in nearby area\n # needs to be implemented later--for now just return all globally available restaurants\n # max_distance = params[:maxDistance]\n # location = { latitude: params[:latitude], longitude: params[:longitude] }\n\n # Restaurant.all.select do |restaurant|\n # restaurant.distance_to(location) <= max_distance\n # end\n\n @restaurants = Restaurant.all\n\n render json: @restaurants\n end",
"def get_table(table_name, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(:full_meta),\n }\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:get, table_uri(table_name, new_query(options), options), nil, headers, options)\n Serialization.table_entries_from_json(response.body)\n rescue => e\n raise_with_response(e, response)\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def show(table, id)\n self.get(\"/#{table}/show/#{id}\")\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n @restaurants = Restaurant.order('name ASC')\n respond_with(@restaurants)\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def show\n @custom_table = CustomTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custom_table }\n end\n end",
"def index\n \t@restaurants = Restaurant.all\n end",
"def index\n @favorite_templates = FavoriteTemplate.all\n render json: @favorite_templates\n end",
"def index\n @restaurant_table_ratings = RestaurantTableRating.all\n end",
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def index\n # Get trips for the trip type\n trips = Trip.all.where(trip_type: params[:trip_type] || 2)\n # (optional) if city_id params was provided\n trips = trips.joins(:city).where(\"cities.id = ?\", params[:city_id]) if params[:city_id]\n # (optional) if country_id params was provided\n trips = trips.joins(:city => :country).where(\"countries.id = ?\", params[:country_id]) if params[:country_id]\n # (optional) if sort params was provided\n if params[:sort]\n \n case params[:sort].downcase\n when 'popularity' # by number of bookings\n trips = trips.most_popular\n when 'rating' # by rating of reviews\n trips = trips.best_rated\n end\n\n end\n\n # Paginate\n trips = trips.page(params[:page] || 1).per(params[:per_page] || 20)\n\n render json: {\n trips: ActiveModelSerializers::SerializableResource.new(trips, each_serializer: TripSerializer),\n total: trips.total_count,\n page: trips.current_page,\n per_page: trips.limit_value\n }\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def index\n @restaurants = Restaurant.all\n end",
"def index\n #See all my restaurants\n #Retreive all the restaurants from the DB\n @restaurants = Restaurant.all\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def index\n @restaurant = Restaurant.find(restaurant_id)\n @dishes = Dish.where(restaurant_id: restaurant_id).all\n end",
"def index\n render json: reservations\n end",
"def get_data\n users_without_admin = User.where(\"name != 'admin'\").count\n users = Userarchyves.select('user_id, food, voted_for').where(archyves_id: current_round.id).all\n retaurants = Restaurant.select('id, votes').all\n \n # return json \n respond_to do |format|\n format.json {\n render json: {\n users: users.as_json(only: [:user_id, :food, :voted]),\n restaurants: retaurants.as_json(only: [:id, :votes]),\n winner: winner.as_json(only: [:id]),\n food_history: food_history.as_json(only: [:food]),\n round_end: round_ended?.as_json\n }\n }\n end\n end",
"def show\n @through_table = ThroughTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @through_table }\n end\n end",
"def index\n render json: Todo.all\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def get_schema\n schema = CLIENT_TABLES.map {|t| {:name => t.table_name, :columns => table_schema(t)} }\n \n# respond_to do |format|\n# format.js { render({:content_type => :js, :text => schema.to_json}) }\n# end\n \n render_json schema.to_json\n end",
"def index\n @restaurants = Restaurant.where(\"name like ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @restaurants.map(&:attributes) }\n end\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def weekIndex\n render json: Restaurant.restaurantsWeek\n end",
"def show\n json_response(@restaurant)\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def index\n if(current_user.customer_id?)\n @resturants = Resturant.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @resturants = Resturant.where(\"region_id = ?\", current_user.driver.region_id)\n end\n \n render json: @resturants, status: 200\n end",
"def show\n @ip_table = IpTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip_table }\n end\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def create\n @restaurant_table = RestaurantTable.new(params[:restaurant_table])\n\n respond_to do |format|\n if @restaurant_table.save\n format.html { redirect_to @restaurant_table, notice: 'Restaurant table was successfully created.' }\n format.json { render json: @restaurant_table, status: :created, location: @restaurant_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @user = current_user\n @restaurants = @user.restaurants\n @branches = Array.new\n @tables = Array.new\n\n @restaurants.each do |r|\n r.branches.each do |b|\n @branches.push(b)\n end \n end\n\n @restaurants.each do |r|\n r.branches.each do |b|\n b.tables.each do |t|\n @tables.push(t)\n end \n end \n end\n\n end",
"def index\n @talleres = Taller.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talleres }\n end\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def index\n flights = scope.includes(:departure_airport, :destination_airport,\n :flight_executions).page(page)\n .per(per)\n json_response(PageDecorator.decorate(flights)\n .as_json(flight_details: true), :ok)\n end",
"def index\n reviews = Review.all\n render json: reviews\n end",
"def index\n reviews = Review.all\n render json: reviews\n end",
"def index\n @stationeryrequests = Stationeryrequest.order(\"id DESC\").all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stationeryrequests }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end"
] |
[
"0.7315217",
"0.7297612",
"0.6770574",
"0.6756205",
"0.67242134",
"0.66625845",
"0.6605243",
"0.6538266",
"0.6438962",
"0.63313365",
"0.63099295",
"0.62681705",
"0.62656367",
"0.62656367",
"0.62656367",
"0.6200736",
"0.61851645",
"0.61309767",
"0.6121084",
"0.61134136",
"0.6109074",
"0.61065936",
"0.6098866",
"0.6097655",
"0.60613835",
"0.6021194",
"0.6017329",
"0.59836215",
"0.59648037",
"0.59433067",
"0.5939762",
"0.59349173",
"0.59349173",
"0.59198165",
"0.59024984",
"0.589702",
"0.588729",
"0.5885877",
"0.5880747",
"0.5872835",
"0.5872835",
"0.5872835",
"0.5872835",
"0.5872835",
"0.5872835",
"0.5872835",
"0.586364",
"0.5862068",
"0.5854069",
"0.58421",
"0.5840578",
"0.5837687",
"0.5829225",
"0.581657",
"0.5798663",
"0.5786468",
"0.57862586",
"0.57852983",
"0.57844216",
"0.5783613",
"0.57827437",
"0.57822025",
"0.57822025",
"0.57822025",
"0.5779699",
"0.577587",
"0.57698786",
"0.5763914",
"0.57531756",
"0.5748815",
"0.5743567",
"0.57378405",
"0.5729097",
"0.5725703",
"0.5705724",
"0.5702176",
"0.570111",
"0.5694751",
"0.5687563",
"0.5681513",
"0.5677309",
"0.5658665",
"0.56567144",
"0.5650946",
"0.5644483",
"0.56431127",
"0.56340235",
"0.5627233",
"0.56251043",
"0.56243825",
"0.56109715",
"0.56085384",
"0.5608307",
"0.5593307",
"0.55864596",
"0.5584197",
"0.55714947",
"0.55714947",
"0.5568172",
"0.5556958",
"0.5556958"
] |
0.0
|
-1
|
POST /restaurants//tables POST /restaurants/1/tables.json
|
def create
@table = @restaurant.tables.build(table_params)
respond_to do |format|
if @table.save
format.html { redirect_to restaurant_tables_path(@restaurant), notice: 'Table was successfully created.' }
format.json { render :show, status: :created, location: @table }
else
format.html { render :new }
format.json { render json: @table.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n if current_user.restaurant_ids.include?(params[:restaurant_id].to_i)\n # find new table number\n table_index = 1\n tables = Table.where(restaurant_id: params[:restaurant_id])\n if !tables.nil? && tables.count > 0\n tables.each do |table|\n table_index = table.table_number + 1 if table.table_number >= table_index\n end \n end\n\n @table = Table.new(restaurant: Restaurant.find(params[:restaurant_id]), table_number: table_index)\n\n if @table.save\n render json: @table, status: :created, location: nil\n else\n render json: @table.errors, status: :unprocessable_entity\n end\n else\n render json: { error: \"can't add tables to restaurants you don't own\" }, status: :unprocessable_entity\n end\n end",
"def create\n @restaurant_table = RestaurantTable.new(params[:restaurant_table])\n\n respond_to do |format|\n if @restaurant_table.save\n format.html { redirect_to @restaurant_table, notice: 'Restaurant table was successfully created.' }\n format.json { render json: @restaurant_table, status: :created, location: @restaurant_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_table(payload)\n make_request(payload, 'post')\n [status, body]\n end",
"def create\n @table = Table.new(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, notice: 'Table was successfully created.' }\n format.json { render 'tables/create', status: :created, location: @table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nursery_table = NurseryTable.new(nursery_table_params)\n\n respond_to do |format|\n if @nursery_table.save\n format.html { redirect_to @nursery_table, notice: \"Nursery table was successfully created.\" }\n format.json { render :show, status: :created, location: @nursery_table }\n else\n format.html { render :new }\n format.json { render json: @nursery_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def table_params\n params.require(:table).permit(:restaurant_id, :number_table)\n end",
"def index\n @tables = @restaurant.tables\n end",
"def create\n @table = Table.new(params[:table])\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, notice: 'Table was successfully created.' }\n format.json { render json: @table, status: :created, location: @table }\n else\n format.html { render action: 'new' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def table_params\n # params.require(:table).permit(:restaurant_id)\n end",
"def set_restaurant_table\n @restaurant_table = RestaurantTable.find(params[:id])\n end",
"def new\n @restaurant_table = RestaurantTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant_table }\n end\n end",
"def create\n @table = Table.new(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to tables_path, notice: 'Table was successfully created.' }\n format.json { render action: 'show', status: :created, location: @table }\n else\n format.html { render action: 'new' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @table = Table.new(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, notice: 'Table was successfully created.' }\n format.json { render :show, status: :created, location: @table }\n else\n format.html { render :new }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n json_response(Restaurant.create!(restaurant_params), :created)\n end",
"def create\n @table = Table.new(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, notice: 'Table was successfully created.' }\n format.json { render action: 'show', status: :created, location: @table }\n else\n format.html { render action: 'new' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rewardtable = Rewardtable.new(rewardtable_params)\n\n respond_to do |format|\n if @rewardtable.save\n format.html { redirect_to @rewardtable, notice: 'Rewardtable was successfully created.' }\n format.json { render :show, status: :created, location: @rewardtable }\n else\n format.html { render :new }\n format.json { render json: @rewardtable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def serve(table)\n self.customers.create(table_id: table.id)\n end",
"def create(table, new_record)\n self.post(\"/#{table}/create\", body: {record: new_record})\n end",
"def create_flight_creation(body)\r\n # Prepare query url.\r\n _path_url = '/v1/airline/flights'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Response.from_hash(decoded)\r\n end",
"def create_table\n params.require(:table).permit(:restourant_id, :name, :min_num, :max_num)\n end",
"def create\n @table = Table.new\n @table.user_id = current_user.id\n @table.name = params[:name] if params[:name]\n @table.description = params[:description] if params[:description]\n @table.the_geom_type = params[:the_geom_type] if params[:the_geom_type]\n @table.force_schema = params[:schema] if params[:schema]\n @table.tags = params[:tags] if params[:tags]\n @table.import_from_query = params[:from_query] if params[:from_query]\n\n if @table.valid? && @table.save\n @table = Table.fetch(\"select *, array_to_string(array(select tags.name from tags where tags.table_id = user_tables.id),',') as tags_names\n from user_tables\n where id=?\",@table.id).first\n render_jsonp(@table.public_values, 200, { :location => table_path(@table) })\n else\n CartoDB::Logger.info \"Error on tables#create\", @table.errors.full_messages\n render_jsonp( { :description => @table.errors.full_messages,\n :stack => @table.errors.full_messages\n }, 400)\n end\n end",
"def create\n @table = Table.new(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, notice: 'Mesa criada com sucesso.' }\n format.json { render :show, status: :created, location: @table }\n else\n format.html { render :new }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dummy_table = DummyTable.new(params[:dummy_table])\n\n respond_to do |format|\n if @dummy_table.save\n format.html { redirect_to @dummy_table, notice: 'Dummy table was successfully created.' }\n format.json { render json: @dummy_table, status: :created, location: @dummy_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dummy_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_table = PostTable.new(post_table_params)\n\n respond_to do |format|\n if @post_table.save\n format.html { redirect_to @post_table, notice: 'Post table was successfully created.' }\n format.json { render :show, status: :created, location: @post_table }\n else\n format.html { render :new }\n format.json { render json: @post_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @table = Table.new(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to admin_index_tables_path, notice: 'Mesa creada!.' }\n format.json { render :show, status: :created, location: @table }\n else\n format.html { render :new }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def create\n @restaurant_table_rating = RestaurantTableRating.new(restaurant_table_rating_params)\n\n respond_to do |format|\n if @restaurant_table_rating.save\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_table_rating }\n else\n format.html { render :new }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @web_table = Web::Table.new(web_table_params)\n\n respond_to do |format|\n if @web_table.save\n format.html { redirect_to @web_table, notice: 'Table was successfully created.' }\n format.json { render :show, status: :created, location: @web_table }\n else\n format.html { render :new }\n format.json { render json: @web_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def create\n @schema_table = SchemaTable.new(schema_table_params)\n\n respond_to do |format|\n if @schema_table.save\n format.html { redirect_to @schema_table, notice: 'Schema table was successfully created.' }\n format.json { render :show, status: :created, location: @schema_table }\n else\n format.html { render :new }\n format.json { render json: @schema_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index \n restaurant = Restaurant.all\n render json: restaurant\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restaurant.errors}, status: :unprocessable_entity\n end\n end",
"def restaurant_table_params\n params.require(:restaurant_table).permit(:restaurant_id, :minimum_count, :maximum_count, :name)\n end",
"def create\n @through_table = ThroughTable.new(params[:through_table])\n\n respond_to do |format|\n if @through_table.save\n format.html { redirect_to @through_table, notice: 'Through table was successfully created.' }\n format.json { render json: @through_table, status: :created, location: @through_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @through_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(current_user.id)\n @game = Game.find(params[:table][:game_id])\n @table = @game.tables.new(table_params)\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to event_path(@table.event_id), notice: 'Table was successfully created.' }\n format.json { render :show, status: :created, location: @table }\n else\n format.html { render :new }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n @table = Table.new(table_params)\n respond_to do |format|\n if @table.save\n\n if params[:waiter]\n @waitertable = WaiterTable.new\n @waitertable.user_id = params[:waiter]\n @waitertable.table_id = @table.id\n @waitertable.save\n @table.assign = true\n @table.save\n \n end\n \n format.html { redirect_to @table, notice: 'Mesa creada correctamente.' }\n format.json { render :show, status: :created, location: @table }\n else\n format.html { render :new }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @custom_table = CustomTable.new(params[:custom_table])\n\n respond_to do |format|\n if @custom_table.save\n format.html { redirect_to @custom_table, notice: 'Custom table was successfully created.' }\n format.json { render json: @custom_table, status: :created, location: @custom_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @custom_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_table = TaskTable.new(task_table_params)\n\n respond_to do |format|\n if @task_table.save\n format.html { redirect_to @task_table, notice: 'Task table was successfully created.' }\n format.json { render :show, status: :created, location: @task_table }\n else\n format.html { render :new }\n format.json { render json: @task_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Tabla.new(tabla_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Tabla was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @restaurant_table = RestaurantTable.find(params[:id])\n @restaurant_table.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_tables_url }\n format.json { head :no_content }\n end\n end",
"def create\n @device_table_mapping = DeviceTableMapping.new(device_table_mapping_params)\n @device_table_mapping.restaurant_owner_id = current_user.id\n\n respond_to do |format|\n if @device_table_mapping.save\n format.html { redirect_to @device_table_mapping, notice: 'Device table mapping was successfully created.' }\n format.json { render :show, status: :created, location: @device_table_mapping }\n else\n format.html { render :new }\n format.json { render json: @device_table_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hr_table = HrTable.new(hr_table_params)\n\n respond_to do |format|\n if @hr_table.save\n format.html { redirect_to @hr_table, notice: 'Hr table was successfully created.' }\n format.json { render :show, status: :created, location: @hr_table }\n else\n format.html { render :new }\n format.json { render json: @hr_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\", error: @restaurant.errors.full_messages }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n render :show, status: :created, location: @restaurant\n else\n render json: @restaurant.errors, status: :unprocessable_entity\n end\n end",
"def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end",
"def create\n @ip_table = IpTable.new(params[:ip_table])\n\n respond_to do |format|\n if @ip_table.save\n format.html { redirect_to @ip_table, notice: 'Ip table was successfully created.' }\n format.json { render json: @ip_table, status: :created, location: @ip_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ip_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timetable = Timetable.new(timetable_params)\n\n respond_to do |format|\n if @timetable.save\n format.html { redirect_to request.referer, notice: 'Timetable was successfully created.' }\n format.json { render :show, status: :created, location: @timetable }\n else\n format.html { render :new }\n format.json { render json: @timetable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @restaurant_table = RestaurantTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_table }\n end\n end",
"def create\n @object_table = ObjectTable.new(object_table_params)\n\n respond_to do |format|\n if @object_table.save\n format.html { redirect_to @object_table, notice: 'Object table was successfully created.' }\n format.json { render :show, status: :created, location: @object_table }\n else\n format.html { render :new }\n format.json { render json: @object_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @liber777_table = Liber777Table.new(params[:liber777_table])\n\n respond_to do |format|\n if @liber777_table.save\n format.html { redirect_to @liber777_table, notice: 'Liber777 table was successfully created.' }\n format.json { render json: @liber777_table, status: :created, location: @liber777_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @liber777_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n restaurants = yelp.businesses\n restaurants.each do |item|\n create = Restaurant.new(\n :name => item.name,\n :location => item.location.neighborhoods,\n :phone_numbers => item.display_phone,\n :featured_image => item.image_url,\n :thumb_url => item.url,\n :cuisines => item.categories,\n :aggregate_rating => item.rating,\n :yelp => item.id\n )\n create.save\n end\n end",
"def create_fund_table\n Bsf::Scraper.db.create_fund_table\n end",
"def create\n @temp_table_for_cust = TempTableForCust.new(params[:temp_table_for_cust])\n\n respond_to do |format|\n if @temp_table_for_cust.save\n format.html { redirect_to @temp_table_for_cust, :notice => 'Temp table for cust was successfully created.' }\n format.json { render :json => @temp_table_for_cust, :status => :created, :location => @temp_table_for_cust }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @temp_table_for_cust.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \t@restaurant = Restaurant.new(params[:restaurant])\n\n \trespond_to do |format|\n \t\tif @restaurant.save\n \t\t\tformat.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n \t\t\tformat.json { render json: @restaurant, status: :created, location: @restaurant }\n \t\telse\n \t\t\tformat.html { render action: \"new\" }\n \t\t\tformat.json { render json: @restaurant.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end",
"def create_table(table_name, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(options[:accept]),\n }\n headers[Azure::Storage::Common::HeaderConstants::PREFER] = options[:prefer] unless options[:prefer].nil?\n body = Serialization.hash_to_json(\"TableName\" => table_name)\n\n call(:post, collection_uri(new_query(options)), body, headers, options)\n nil\n end",
"def create_table(table)\n db_client.query(\"SHOW CREATE TABLE #{table['name']}\").first['Create Table'] + ';'\n end",
"def create\n @data_table = DataTable.new(data_table_params)\n\n respond_to do |format|\n if @data_table.save\n format.html { redirect_to @data_table, notice: 'Data table was successfully created.' }\n format.json { render :show, status: :created, location: @data_table }\n else\n format.html { render :new }\n format.json { render json: @data_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @get_restaurant_list = GetRestaurantList.new(params[:get_restaurant_list])\n\n if @get_restaurant_list.save\n render json: @get_restaurant_list, status: :created, location: @get_restaurant_list\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end",
"def post(data)\n jss = self.get_structure() # For referencing purposes\n\n input = self.query_to_hash(data)\n bad_request = false\n resp = nil\n jss.each do |key, value|\n # Check if we have it on the query too\n unless input.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Not enough data for a new resource\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n input.each do |key, value|\n # Check if we have it on the structure too\n unless jss.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Wrong argument #{key}\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n \n\n # Insert the values if we have a good request\n unless bad_request\n fields = Hash.new\n inserts = Hash.new\n main_table = self.get_structure.values[0].split('/')[0]\n input.each do |key, value|\n struct = jss[key]\n table = struct.split(\"/\")[0]\n inserts[table] ||= []\n fields[table] ||= []\n inserts[table].push \"\\\"\" + value + \"\\\"\"\n fields[table].push struct.split(\"/\")[1]\n if struct.split(\"/\").length > 2\n match = struct.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n fields[table].push matching_field\n if @engine.config[\"dbengine\"] == :mysql\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID()))\"\n else\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(last_insert_rowid()))\"\n end\n end\n end\n queries = [] \n inserts.each do |table, values|\n queries.push \"INSERT INTO #{table}(#{fields[table].join(',')}) VALUES (#{inserts[table].join(',')});\"\n end\n # Connect to the database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n results = []\n rid = nil\n # Find the ID to return in the response (only for the first query)\n queries.each do |q|\n results.push dbe.query(dblink, q)\n if @engine.config[\"dbengine\"] == :mysql\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID());\"), \"id\")\n else\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(last_insert_rowid());\"), \"id\")\n end\n end\n @engine.http_status = \"201 Created\"\n resp = {status: \"201 created\", id: rid}\n end\n return resp\n end",
"def build_tables\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS breeds(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n price integer\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS puppies(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n name varchar(30),\n age integer,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS requests(\n id serial NOT NULL PRIMARY KEY,\n breed text,\n status text,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n end",
"def create\n @timetable = Timetable.new(params[:timetable])\n\n respond_to do |format|\n if @timetable.save\n format.html { redirect_to @timetable, notice: 'Timetable was successfully created.' }\n format.json { render json: @timetable, status: :created, location: @timetable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timetable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @daw_tabla = DawTabla.new(daw_tabla_params)\n\n respond_to do |format|\n if @daw_tabla.save\n format.html { redirect_to @daw_tabla, notice: 'Daw tabla was successfully created.' }\n format.json { render :show, status: :created, location: @daw_tabla }\n else\n format.html { render :new }\n format.json { render json: @daw_tabla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if signed_in?\n @tourtable = Tourtable.new(params[:tourtable])\n\n respond_to do |format|\n if @tourtable.save\n format.html { redirect_to @tourtable, notice: 'Tourtable was successfully created.' }\n format.json { render json: @tourtable, status: :created, location: @tourtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tourtable.errors, status: :unprocessable_entity }\n end\n end\n end\nend",
"def create\n @service_table = ServiceTable.new(service_table_params)\n\n respond_to do |format|\n if @service_table.save\n format.html { redirect_to service_tables_path, notice: 'Gói dịch vụ mới được tạo!' }\n format.json { render :show, status: :created, location: @service_table }\n else\n format.html { render :new }\n format.json { render json: @service_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @user = current_user\n @restaurants = @user.restaurants\n @branches = Array.new\n @tables = Array.new\n\n @restaurants.each do |r|\n r.branches.each do |b|\n @branches.push(b)\n end \n end\n\n @restaurants.each do |r|\n r.branches.each do |b|\n b.tables.each do |t|\n @tables.push(t)\n end \n end \n end\n\n end",
"def create_table(table_name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n body = Table::Serialization.hash_to_entry_xml({\"TableName\" => table_name}).to_xml\n call(:post, collection_uri(query), body, {}, options)\n nil\n end",
"def create\r\n @restaurant = Restaurant.new(params[:restaurant])\r\n\r\n respond_to do |format|\r\n if @restaurant.save\r\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\r\n format.json { render json: @restaurant, status: :created, location: @restaurant }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n @restaurants = Restaurant.find(params[:id])\n else\n render 'create_error'\n end\n end",
"def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(params[:restaurant])\n @restaurant.owner_id = current_owner.id\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def index\n json_response(Restaurant.all)\n end",
"def create(table, hash_of_attributes)\n @@pg_conn.exec(\"insert into #{tablename}#{table}(json) values ('#{JSON::dump(hash_of_attributes)}') \")\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @flight }\n else\n format.html { render action: 'new' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n\n airplane = Airplane.find(@flight.airplane_id)\n\n rows_array = (1..airplane.row.to_i).to_a\n column_array = (1..airplane.column.to_i).to_a\n \n\n rows_array.each do |row_name|\n column_array.each do |column_name|\n seat_name = row_name.to_s + \"-\" + column_name.to_s \n seat = Seat.create(:column_row => seat_name, :flight_id => @flight.id, :available => true)\n end\n end\n\n end",
"def create_many table\n table.map do |row|\n create_record row\n end\n end",
"def create\n @tablet = Tablet.new(tablet_params)\n\n respond_to do |format|\n if @tablet.save\n format.html { redirect_to @tablet, notice: 'Tablet was successfully created.' }\n format.json { render :show, status: :created, location: @tablet }\n else\n format.html { render :new }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n @restaurant.save\n redirect_to restaurants_path\n end",
"def submit_menu\n @order = Order.create! user_id: current_user.id, restaurant_id: @restaurant.id\n\n params[:order].each do |order_item|\n MenuItemOrder.create(order_id: @order.id, menu_item_id: params[:order][order_item][:item], quantity: params[:order][order_item][:quantity])\n end\n respond_to do |format|\n format.html { redirect_to new_order_path(@restaurant), notice: 'Menu items were successfully submitted.' }\n format.json { render :new, status: :created, location: @order }\n end\n end",
"def index\n @title = 'Tables'\n @tables = Table.all\n\n respond_to do |format|\n format.html {\n @tables_rabl = Rabl.render(@tables, 'tables/index', view_path: 'app/views', format: 'json')\n @guests_rabl = Rabl.render(Guest.attending, 'tables/guests', view_path: 'app/views', format: 'json')\n }\n format.json { render json: @tables }\n end\n end",
"def post_page_tables(name, page_number, tables, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_page_tables_with_http_info(name, page_number, tables, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_page_tables_with_http_info(name, page_number, tables, opts)\n else\n raise\n end\n return data\n end",
"def create_all(name, table)\n table.hashes.map do |attributes|\n Utils.model(name).new(attributes).tap do |document|\n document.save\n end\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create_table(name, min_players = 2, blinds = 1)\n\t\traise \"No player yet!\" unless @player_id\n\t\t@table_response = new_sub(@discovery['tables']['url'],\n\t\t\t\t@discovery['tables']['capability'])\n\t\t@create_table_channel = new_channel(@discovery['create_table']['url'],\n\t\t\t\t@discovery['create_table']['capability'])\n\t\t@table_response.last = (Time.now.to_i * 1000) - 5\n\t\t@table_response.add_listener('table_response') {|m| my_table_created(m)}\n\t\t@table_response.start_listening\n\t\t@create_table_channel.publish({'name' => name, 'id' => @player_id,\n\t\t\t'min_players' => min_players, 'blinds' => blinds}.to_json)\n\tend",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @restaurant }\n else\n format.html { render action: 'new' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n current_admin_user\n @tablet = Tablet.new(params[:tablet])\n\n respond_to do |format|\n if @tablet.save\n format.html { redirect_to @tablet, notice: 'Tablet was successfully created.' }\n format.json { render json: @tablet, status: :created, location: @tablet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_table_request\n {\n table_name: self.table_name.to_s,\n attribute_definitions: self.attribute_definitions,\n key_schema: self.key_schema,\n provisioned_throughput: self.provisioned_throughput\n }\n end",
"def create\n @product_table = ProductTable.new(product_table_params)\n\n respond_to do |format|\n if @product_table.save\n format.html { redirect_to @product_table, notice: 'Product table was successfully created.' }\n format.json { render :show, status: :created, location: @product_table }\n else\n format.html { render :new }\n format.json { render json: @product_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def create\n @lookup_truthtable = LookupTruthtable.new(params[:lookup_truthtable])\n\n respond_to do |format|\n if @lookup_truthtable.save\n format.html { redirect_to(@lookup_truthtable, :notice => 'Lookup truthtable was successfully created.') }\n format.xml { render :xml => @lookup_truthtable, :status => :created, :location => @lookup_truthtable }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_truthtable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tableau = Tableau.new(tableau_params)\n\n respond_to do |format|\n if @tableau.save\n format.html { redirect_to @tableau, notice: 'Tableau was successfully created.' }\n format.json { render :show, status: :created, location: @tableau }\n else\n format.html { render :new }\n format.json { render json: @tableau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itemstable = Itemstable.new(params[:itemstable])\n\n respond_to do |format|\n if @itemstable.save\n format.html { redirect_to @itemstable, notice: 'Itemstable was successfully created.' }\n format.json { render json: @itemstable, status: :created, location: @itemstable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @itemstable.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.72751194",
"0.676111",
"0.6393096",
"0.6262105",
"0.5993949",
"0.58371073",
"0.5829471",
"0.5816438",
"0.5790426",
"0.5720594",
"0.5675311",
"0.56332034",
"0.560765",
"0.55981475",
"0.5595866",
"0.5579365",
"0.5562936",
"0.5526544",
"0.5522176",
"0.5507415",
"0.5474045",
"0.54443514",
"0.5419089",
"0.54045534",
"0.53938556",
"0.53919435",
"0.5367767",
"0.53600526",
"0.5332162",
"0.5306542",
"0.5300617",
"0.52706045",
"0.52694535",
"0.52591276",
"0.52503973",
"0.5249685",
"0.524354",
"0.5242043",
"0.52399814",
"0.5231573",
"0.5226506",
"0.5226017",
"0.51823014",
"0.5119916",
"0.5119916",
"0.5119916",
"0.5118701",
"0.51125383",
"0.51035315",
"0.5102328",
"0.5100916",
"0.510075",
"0.5099648",
"0.5097646",
"0.5094898",
"0.50865006",
"0.5086437",
"0.5080408",
"0.5076913",
"0.5072808",
"0.5072355",
"0.50715715",
"0.50700134",
"0.5068569",
"0.50667864",
"0.50522214",
"0.5037474",
"0.5020642",
"0.5012692",
"0.50085455",
"0.5001637",
"0.49976376",
"0.49933618",
"0.4991322",
"0.49819285",
"0.49714607",
"0.49675396",
"0.49627906",
"0.49603862",
"0.4953633",
"0.49524704",
"0.49469587",
"0.49469587",
"0.49469587",
"0.49377808",
"0.49280304",
"0.492444",
"0.49234635",
"0.49205795",
"0.4920459",
"0.4916405",
"0.491079",
"0.49099183",
"0.4906363",
"0.4902975",
"0.48995173",
"0.48959005",
"0.48872656",
"0.48835343",
"0.4883111"
] |
0.71772075
|
1
|
PATCH/PUT /restaurants/1/tables/1 PATCH/PUT /restaurants/1/tables/1.json
|
def update
respond_to do |format|
if @table.update(table_params)
format.html { redirect_to restaurant_tables_path(@restaurant), notice: 'Table was successfully updated.' }
format.json { render :show, status: :ok, location: @table }
else
format.html { render :edit }
format.json { render json: @table.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @restaurant_table = RestaurantTable.find(params[:id])\n\n respond_to do |format|\n if @restaurant_table.update_attributes(params[:restaurant_table])\n format.html { redirect_to @restaurant_table, notice: 'Restaurant table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_response(@restaurant.update!(restaurant_params))\n end",
"def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table])\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_restaurant\n end",
"def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to admin_index_tables_path, notice: 'Table was successfully updated.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @custom_table = CustomTable.find(params[:id])\n\n respond_to do |format|\n if @custom_table.update_attributes(params[:custom_table])\n format.html { redirect_to @custom_table, notice: 'Custom table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @custom_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(tabla_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Tabla was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @restaurant = Restaurant.find(params[:id])\n @restaurant.owner_id = current_owner.id\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n # format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.html { redirect_to account_owner_dashboards_path, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: 'Mesa atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def update\n if @restaurant.update(restaurant_params)\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restaurant.errors}, status: :unprocessable_entity\n end\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end",
"def update\n respond_to do |format|\n if @schema_table.update(schema_table_params)\n format.html { redirect_to @schema_table, notice: 'Schema table was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_table }\n else\n format.html { render :edit }\n format.json { render json: @schema_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to events_path, notice: 'Table was successfully updated.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @restaurant = Restaurant.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @restaurant.update_attributes(params[:restaurant])\r\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def edit\n id = params[:id]\n @restaurant = Restaurant.find_by_id(id)\n if @restaurant.nil?\n raise ActionController::RoutingError.new('No such restaurant')\n end\n @foods = Food.where(\"restaurant_id = ?\", id)\n\n end",
"def update\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n if @get_restaurant_list.update(params[:get_restaurant_list])\n head :no_content\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @table_def.update(table_def_params)\n format.html { redirect_to @table_def, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table_def.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update\n @dummy_table = DummyTable.find(params[:id])\n\n respond_to do |format|\n if @dummy_table.update_attributes(params[:dummy_table])\n format.html { redirect_to @dummy_table, notice: 'Dummy table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dummy_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_truck.update(food_truck_params)\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restaurant_table_rating.update(restaurant_table_rating_params)\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_table_rating }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to(@restaurant, :notice => 'Restaurant was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :status => :ok }.to_json }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @restaurant.errors, :status => :unprocessable_entity }\n format.json { fail }\n end\n end\n end",
"def update\n respond_to do |format|\n if @object_table.update(object_table_params)\n format.html { redirect_to @object_table, notice: 'Object table was successfully updated.' }\n format.json { render :show, status: :ok, location: @object_table }\n else\n format.html { render :edit }\n format.json { render json: @object_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @stationeryrequest = Stationeryrequest.find(params[:id])\n #\n @stationeryrequest.hotelsuppliesrequests.each do |hotelsuppliesrequests|\n \n end\n\n respond_to do |format|\n if @stationeryrequest.update_attributes(params[:stationeryrequest])\n format.html { redirect_to @stationeryrequest, notice: 'Stationeryrequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stationeryrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@food_item automatically set to FoodItem.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n if request.xhr?\n format.html { render partial: 'row', locals: {food_item: @food_item, index: 0}}\n else\n format.html { redirect_to @food_item, notice: 'Food item was successfully updated.' }\n end\n format.json { head :no_content }\n else\n if request.xhr?\n format.html { render partial: 'row_form', locals: {food_item: @food_item}, status: :unprocessable_entity }\n else\n format.html { render action: \"edit\" }\n end\n format.json { render json: @food_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @data_table.update(data_table_params)\n format.html { redirect_to @data_table, notice: 'Data table was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_table }\n else\n format.html { render :edit }\n format.json { render json: @data_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @table.update(table_params)\n\n # force related running match to refresh\n if @table.banner_id.blank?\n @table.matches.where(is_running: true).each do |match|\n match.touch\n end\n end\n\n format.html { redirect_to tables_path, notice: 'Table was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @table }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_table.update(task_table_params)\n format.html { redirect_to @task_table, notice: 'Task table was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_table }\n else\n format.html { render :edit }\n format.json { render json: @task_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n if @restaurant.present?\n if @review.present?\n if @review.update(review_params)\n render_json content: @review\n else\n render_json content: @review.errors\n end\n end\n end\n\n end",
"def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n current_admin_user\n @tablet = Tablet.find(params[:id])\n\n respond_to do |format|\n if @tablet.update_attributes(params[:tablet])\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hr_table.update(hr_table_params)\n format.html { redirect_to @hr_table, notice: 'Hr table was successfully updated.' }\n format.json { render :show, status: :ok, location: @hr_table }\n else\n format.html { render :edit }\n format.json { render json: @hr_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def edit\n @restaurant = Restaurant.find(params[:restaurant_id])\n @food = Food.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @table.update(table_params)\n if params[:waiter]\n @waitertable = WaiterTable.find_by(table_id: @table.id)\n @waitertable.user_id = params[:waiter]\n @waitertable.save\n end\n format.html { redirect_to @table, notice: 'Mesa actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_restaurant_table\n @restaurant_table = RestaurantTable.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @admin_restaurant.update(admin_restaurant_params)\n format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @admin_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @restaurant.update(restaurant_params)\n @restaurants = Restaurant.all\n else\n render 'update_error'\n end\n end",
"def update\n respond_to do |format|\n if @tbody.update(tbody_params)\n format.html { redirect_to @tbody, notice: 'Tbody was successfully updated.' }\n format.json { render :show, status: :ok, location: @tbody }\n else\n format.html { render :edit }\n format.json { render json: @tbody.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n respond_to do |format|\n if @tablero.update(tablero_params)\n format.html { redirect_to @tablero, notice: 'Tablero was successfully updated.' }\n format.json { render :show, status: :ok, location: @tablero }\n else\n format.html { render :edit }\n format.json { render json: @tablero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n data = tenant_update_params\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"customer_id\": @tenant.customer_id,\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/edit\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n respond_to do |format|\n if response[\"status\"] == 200\n if @tenant.update(tenant_update_params)\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n if @tenant.active == true\n end\n end\n @tenant.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { redirect_to tenants_url, notice: 'Tenant was not updated.' }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n \t@restaurant = Restaurant.find(params[:id])\n\n \trespond_to do |format|\n \t\tif @restaurant.update_attributes(params[:restaurant])\n \t\t\tformat.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n \t\t\tformat.json { head :ok }\n \t\telse\n \t\t\tformat.html { render action: \"edit\" }\n \t\t\tformat.json { render json: @restaurant.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end",
"def update\n respond_to do |format|\n if @favorite_restaurant.update(favorite_restaurant_params)\n format.html { redirect_to @favorite_restaurant, notice: 'Favorite restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @favorite_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @restaurante = Restaurante.find params[:id]\n respond_to do |format|\n if @restaurante.update(restaurante_params)\n format.html { redirect_to @restaurante, notice: 'Restaurante editado com sucesso!.' }\n format.json { render :show, status: :ok, location: @restaurante }\n else\n format.html { render :edit }\n format.json { render json: @restaurante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n format.html { render :partial => \"row_table\", :locals => {:promotion => @promotion} }\n else\n format.json { render :json => { :errors => @promotion.errors }, :status => 409 }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fast_food.update(fast_food_params)\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully updated.' }\n format.json { render :show, status: :ok, location: @fast_food }\n else\n format.html { render :edit }\n format.json { render json: @fast_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @restaurant.update(restaurant_params.except(:local_id))\n render :show, status: :ok, location: @restaurant\n else\n render json: @restaurant.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html {redirect_to @restaurant, notice: 'Restaurant was successfully updated.'}\n format.json {render :show, status: :ok, location: @restaurant}\n else\n format.html {render :edit}\n format.json {render json: @restaurant.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n flash[:notice] = t('scaffold.notice.updated', :item => Refenciacontable.model_name.human) if @refenciacontable.update_attributes(params[:refenciacontable])\n respond_with(@refenciacontable, :location => refenciacontables_path)\n end",
"def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rental = Rental.friendly.find(params[:rental_id])\n \n\n respond_to do |format|\n if @feature.update(feature_params)\n format.html { redirect_to rental_path(@rental), notice: 'Feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n temp_restaurant = Restaurant.new(params[:restaurant])\n notice = 'Restaurant was successfully updated.'\n\n if (temp_restaurant.linkedRestaurator != '')\n @restaurant.restaurator_id = temp_restaurant.linkedRestaurator\n else\n notice = 'Vous avez modifie un restaurant sans lui assigner un restaurateur.'\n end\n\n if (current_user.clientType == Client::CLIENT_TYPES[:entrepreneur])\n @restaurant.entrepreneur_id = current_user.id\n end\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: notice }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(1)\n @trucks = @company.get_trucks()\n @employees = @company.get_employees()\n \n respond_to do |format|\n if @sheet_route_detail.update(sheet_route_detail_params)\n format.html { redirect_to @sheet_route, notice: 'Sheet route detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @sheet_route_detail }\n else\n format.html { render :edit }\n format.json { render json: @sheet_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def free\n @tables = Table.find_all_by_status('free')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tables }\n end\n\n def busy\n @tables = Table.find_all_by_status('busy')\n respond_to do |format|\n format.html\n format.json { render :json => @tables }\n end\n end\n\n def dirty\n @tables = Table.find_all_by_status('dirty')\n respond_to do |format|\n format.html\n format.json { render :json => @tables }\n end\n end\n\n #modify status of table's id\n def change_free_status\n @table = Table.find(params[:id])\n if @table.status == 'free'\n @table.status = 'busy'\n @table.save\n end\n respond_to do |format|\n format.html\n format.json { render :json => @table }\n end\n end\n\n def change_busy_status\n @table = Table.find(params[:id])\n if @table.status == 'busy'\n @table.status = 'dirty'\n @table.save\n end\n respond_to do |format|\n format.html\n format.json { render :json => @table }\n end\n end\n\n def change_dirty_status\n @table = Table.find(params[:id])\n if @table.status == 'dirty'\n @table.status = 'free'\n @table.save\n end\n respond_to do |format|\n format.html\n format.json { render :json => @table }\n end\n end\n\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n trip = Trip.find_by_id(params[:trip_id])\n trip.title = params[:title]\n trip.city = params[:city]\n trip.state = params[:state]\n trip.country = params[:country]\n trip.start_date = params[:start_date]\n trip.end_date = params[:end_date]\n trip.description = params[:description]\n trip.link = params[:link]\n if params[:photo_base]\n trip.photo = params[:photo_base]\n end\n trip.save!\n render json: trip\n end",
"def update\n respond_to do |format|\n if @trip_todo.update(trip_todo_params)\n format.html { redirect_to @trip_todo, notice: 'Trip todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_todo }\n else\n format.html { render :edit }\n format.json { render json: @trip_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @delivery_truck.update(delivery_truck_params)\n format.js { render :js => \"loadtables();\" }\n\n format.html { redirect_to @delivery_truck, notice: 'Delivery truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @delivery_truck }\n else\n format.html { render :edit }\n format.json { render json: @delivery_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @favorite_template.update(favorite_template_params)\n render json: @favorite_template\n end",
"def update\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n @tipo_unidad = @truck.get_tipos()\n @config = @truck.get_config()\n @clase = @truck.get_clase()\n @color = @truck.get_color()\n\n\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_table.update(service_table_params)\n format.html { redirect_to service_tables_path, notice: 'Đã cập nhật thành công!' }\n format.json { render :show, status: :ok, location: @service_table }\n else\n format.html { render :edit }\n format.json { render json: @service_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to user_restaurant_url(current_user), notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.update(trip_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Trip update failed.\"]}\n end\n end",
"def update\n # given an array of people ids\n if params[:people] && params[:people].is_a?(Array)\n people = params['people'].collect{|id| Person.find_by id: id.to_i }.compact\n if people.size == params[:people].size\n seated_people = people.select{|p| p.seated && p.seat.table_id != @table.id}\n if seated_people.empty?\n seats = people.collect{|p| Seat.new table: @table, person: p}\n if TableRules.check_table(seats).empty?\n @table.seats = seats\n @table.save\n render json: @table\n else\n render json: {errors: \"Unable to seat those people in that order\"}, status: 422\n end\n else\n has_have = if seated_people.size > 1\n 'have'\n else\n 'has'\n end\n render json: {errors: \"#{seated_people.collect(&:name).sort.to_sentence} #{has_have} already been seated at another table\"}, status: 422\n end\n else\n render json: {errors: \"Non-existant people sent\"}, status: 422\n end\n else\n render json: {errors: 'Invalid parameters'}, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @recipes_food.update(recipes_food_params)\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipes_food }\n else\n format.html { render :edit }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if signed_in?\n @tourtable = Tourtable.find(params[:id])\n\n respond_to do |format|\n if @tourtable.update_attributes(params[:tourtable])\n format.html { redirect_to @tourtable, notice: 'Tourtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tourtable.errors, status: :unprocessable_entity }\n end\n end\n end\nend",
"def update\n respond_to do |format|\n if @order_restaurant.update(order_restaurant_params)\n format.html { redirect_to @order_restaurant, notice: 'Order restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @order_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6857745",
"0.6312511",
"0.6252273",
"0.6060474",
"0.602739",
"0.5971374",
"0.5960167",
"0.5894511",
"0.58566034",
"0.58282554",
"0.5821747",
"0.5800232",
"0.57935786",
"0.57913935",
"0.57905793",
"0.5781102",
"0.57748574",
"0.57748574",
"0.57748574",
"0.57748574",
"0.5763453",
"0.5756996",
"0.5746468",
"0.5741979",
"0.57318366",
"0.57318366",
"0.5711643",
"0.5691417",
"0.5687764",
"0.5681203",
"0.5678723",
"0.5658189",
"0.56547016",
"0.56489104",
"0.56344503",
"0.5631664",
"0.56299907",
"0.5628658",
"0.5625931",
"0.5618684",
"0.56158775",
"0.56064904",
"0.56040514",
"0.56039983",
"0.5588485",
"0.55812824",
"0.5579017",
"0.5578946",
"0.5571717",
"0.55661744",
"0.55626357",
"0.5557982",
"0.5539793",
"0.5536615",
"0.55279803",
"0.5527212",
"0.55254596",
"0.55254596",
"0.55254596",
"0.5519897",
"0.5518198",
"0.551465",
"0.5503084",
"0.55019593",
"0.5501519",
"0.5499207",
"0.5497679",
"0.54965895",
"0.5491982",
"0.54908",
"0.5490076",
"0.5489951",
"0.54840463",
"0.5480779",
"0.5480611",
"0.5480336",
"0.54783046",
"0.5477595",
"0.5477244",
"0.547679",
"0.54753435",
"0.54734534",
"0.54708827",
"0.5461093",
"0.5457809",
"0.545756",
"0.5456584",
"0.5448315",
"0.5448037",
"0.54471064",
"0.5446963",
"0.54396665",
"0.54362017",
"0.5430288",
"0.54237264",
"0.54216206",
"0.5421166",
"0.54207975",
"0.5420719",
"0.54193383"
] |
0.6892507
|
0
|
DELETE /restaurants/1/tables/1 DELETE /restaurants/1/tables/1.json
|
def destroy
@table.destroy
respond_to do |format|
format.html { redirect_to tables_url, notice: 'Table was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @restaurant_table = RestaurantTable.find(params[:id])\n @restaurant_table.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_tables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # DELETE\n # TODO: removes a specific restaurant\n DB.execute(\"DELETE FROM restaurants WHERE id = #{@id}\")\n nil\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n render json: {success: true}\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\r\n @restaurant = Restaurant.find(params[:id])\r\n @restaurant.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to restaurants_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy(table, id)\n self.post(\"/#{table}/destroy/#{id}\")\n end",
"def destroy\n @<%= singular_table_name %>.destroy\n respond_to do |format|\n format.html { redirect_to <%= table_name %>_url }\n format.json { head :no_content }\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(*rest) end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @table.destroy\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @table.destroy\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @restaurant_table_rating.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_table_ratings_url, notice: 'Restaurant table rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n @get_restaurant_list.destroy\n\n head :no_content\n end",
"def delete_table(table_id); delete(\"tables/#{table_id}\"); nil; end",
"def destroy\n \t@restaurant = Restaurant.find(params[:id])\n \t@restaurant.destroy\n\n \trespond_to do |format|\n \t\tformat.html { redirect_to restaurants_url }\n \t\tformat.json { head :ok }\n \tend\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n \n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @table = Table.find(params[:id])\n @table.destroy\n\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @table = Table.find(params[:id])\n @table.destroy\n\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @table = Table.find(params[:id])\n @table.destroy\n\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\n @admin_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to admin_restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html {redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @waitertable = WaiterTable.where(\"table_id = #{@table.id}\")\n @waitertable.delete_all\n @table.destroy\n respond_to do |format|\n format.html { redirect_to tables_url, notice: 'Mesa eliminada correctamente.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def delete\n\n end",
"def delete\n request(:delete)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n @restaurant_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_dishes_url }\n format.json { head :ok }\n end\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def destroy\n @food.destroy\n respond_to do |format|\n format.html { redirect_to @restaurant, notice: 'Food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: \"Restaurant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @table.destroy\n respond_to do |format|\n format.html { redirect_to tables_url, notice: 'Mesa deletada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_truck.destroy\n respond_to do |format|\n format.html { redirect_to food_trucks_url }\n format.json { head :no_content }\n end\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def destroy\n\n @restaurant.delete\n\n redirect_to root_path\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @nursery_table.destroy\n respond_to do |format|\n format.html { redirect_to nursery_tables_url, notice: \"Nursery table was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stable = Stable.find(params[:id])\n @stable.destroy\n\n respond_to do |format|\n format.html { redirect_to stables_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy(table)\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to menus_url }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end",
"def delete\n \n end",
"def delete!\n request! :delete\n end",
"def delete\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @dummy_table = DummyTable.find(params[:id])\n @dummy_table.destroy\n\n respond_to do |format|\n format.html { redirect_to dummy_tables_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n Todo.find(params[:id]).destroy\n render :json => {:message => \"Record deleted\", :item_id => params[:id]}\n end",
"def destroy\n @restaurant = Restaurant.find_by(id: params[:id])\n current_user\n if @restaurant.user_id == @current_user.id\n @restaurant.destroy!\n redirect_to '/restaurants'\n else\n status 422\n end\n end",
"def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rewardtable.destroy\n respond_to do |format|\n format.html { redirect_to rewardtables_url, notice: 'Rewardtable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @restaurante.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_url,\n notice: 'Restaurante eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"def destroy\n @todo = Todo.find_by(id: params[:id])\n Todo.delete(@todo)\n @@all = Todo.all\n render json: @@all\n end"
] |
[
"0.7486505",
"0.7044491",
"0.6873011",
"0.67982674",
"0.67982674",
"0.67982674",
"0.67982674",
"0.67982674",
"0.67982674",
"0.67982674",
"0.67982674",
"0.6787941",
"0.67438287",
"0.67438287",
"0.67438287",
"0.67352796",
"0.67216164",
"0.66654927",
"0.66171163",
"0.6615374",
"0.65999275",
"0.6575788",
"0.65618277",
"0.65618277",
"0.6555555",
"0.65355897",
"0.6527605",
"0.6526478",
"0.65244323",
"0.6524073",
"0.6522337",
"0.6519642",
"0.6519642",
"0.6519642",
"0.6519642",
"0.65085316",
"0.65085316",
"0.65085316",
"0.6484488",
"0.6484057",
"0.64816684",
"0.6480925",
"0.6476458",
"0.6476152",
"0.6471039",
"0.6461412",
"0.6453541",
"0.6445921",
"0.6443393",
"0.63968325",
"0.63928944",
"0.6386583",
"0.6381333",
"0.63788176",
"0.6378102",
"0.63757414",
"0.6373699",
"0.6371004",
"0.63693136",
"0.6367753",
"0.6367753",
"0.6367753",
"0.6367753",
"0.6367753",
"0.6367753",
"0.6367753",
"0.63667166",
"0.63649523",
"0.63481313",
"0.63465613",
"0.63465613",
"0.63438237",
"0.63438237",
"0.6341422",
"0.6339814",
"0.63189983",
"0.6314765",
"0.6314675",
"0.63139355",
"0.6312446",
"0.6309275",
"0.63032025",
"0.62999403",
"0.62843996",
"0.6282649",
"0.62824017",
"0.62747765",
"0.627167",
"0.627167",
"0.6270196",
"0.62684023",
"0.62656164",
"0.62633425",
"0.6262245",
"0.62616295",
"0.62591696",
"0.6256658",
"0.62566483",
"0.6253431"
] |
0.6285904
|
84
|
Use callbacks to share common setup or constraints between actions.
|
def set_restaurant
@restaurant = Restaurant.find(params[:restaurant_id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def table_params
params.require(:table).permit(:restaurant_id, :number_table)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
two arguments and returns the product of the two numbers.
|
def multiply(a,b)
a * b
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def product(num1, num2)\n num1 * num2\nend",
"def multiply_two_numbers( x, y )\n x * y\nend",
"def prod(x,y)\n x*y\nend",
"def multiply(first_number, second_number)\n return first_number * second_number\nend",
"def multiply(first_number, second_number)\n return first_number * second_number\nend",
"def multiply(num1, num2)\n\treturn num1 * num2\nend",
"def multiply(first_number , second_number)\n return first_number * second_number\nend",
"def multiply(number1, number2)\n number1 * number2\n end",
"def multiply(n1, n2)\n return n1*n2\n end",
"def calculate_product(a,b)\n a*b\nend",
"def mult_numbers(a,b)\n\ta*b\nend",
"def multiply(a, b)\r\n a * b\r\n end",
"def multiply(a, b)\n\treturn a.to_i * b.to_i\nend",
"def multiply(num1, num2)\n num1 * num2\n end",
"def getProd ( x , y )\n\tprod = x * y\n\treturn prod\nend",
"def multiply(num1, num2)\n\treturn num1*num2\nend",
"def multiply(num1, num2)\n product = num1 * num2 # => 15\nend",
"def multiply(num1,num2)\n product = num1 * num2\n puts product\nend",
"def multiply(n1, n2)\n multiply = n1 * n2\n return multiply\nend",
"def multiply(first_number, second_number)\n first_number * second_number\nend",
"def multiply(num1, num2)\n num1 ** num2\nend",
"def multiply(num1, num2)\n product = num1 * num2\nend",
"def multiply(a, b)\n\t\treturn a*b\n\tend",
"def multiply(first_num, second_num)\n first_num * second_num\nend",
"def multiply(num1, num2)\n product = num1 * num2\n puts product\nend",
"def multiplication (first_number, second_number)\nfirst_number * second_number\nend",
"def multiply(num_one, num_two)\n num_one * num_two\nend",
"def multiply(num1, num2)\n\tnum1 * num2\nend",
"def multiply(num1, num2)\n\tnum1 * num2\nend",
"def multiply(num1,num2)\n\tnum1 * num2\nend",
"def multiply(num_a, num_b)\n num_a * num_b\nend",
"def multiply(num_a, num_b)\n num_a * num_b\nend",
"def multiply(num_one, num_two)\n num_one * num_two\nend",
"def multiply(n1, n2)\r\n n1.to_i * n2.to_i\r\nend",
"def multiply(number_one, number_two)\nnumber_one * number_two\nend",
"def multiply(a,b)\n\treturn a * b\nend",
"def multiply(number_1, number_2)\n return number_1 * number_2\nend",
"def multiply(number_1, number_2)\n return number_1 * number_2\nend",
"def Multiplication(a,b)\n f = a.to_i * b.to_i\n puts \"Multiplication of both number is: #{f}\"\n end",
"def multiply(x, y)\n\tx * y\nend",
"def multiply(a, b)\n\ta * b\nend",
"def multiply (num1, num2)\n return num1 * num2\nend",
"def multiplicationm(num_1,num_2)\n return num_1 * num_2\nend",
"def multiply(n1, n2)\n n1 * n2\nend",
"def multiply(num1, num2)\n\tnew_value = num1 * num2\n\tnew_value\nend",
"def multiply(num1, num2)\n return num1 * num2\nend",
"def multiply(x, y)\n product = x*y\nend",
"def multiply(n1, n2)\n n1 * n2\nend",
"def multiply(n1, n2)\n n1 * n2\nend",
"def multiply(n1, n2)\n n1 * n2\nend",
"def multiply(n1, n2)\n n1 * n2\nend",
"def multiply(number_1, number_2)\n number_1 * number_2\nend",
"def multiply(number_1, number_2)\n number_1 * number_2\nend",
"def multiply(nb1,nb2)\n\treturn nb1*nb2\nend",
"def multiply(first_parameter, second_parameter)\n (first_parameter * second_parameter).to_i\n end",
"def multiply(num1, num2)\n return num1 * num2\nend",
"def multiply(x,y) \n\tx * y\t\nend",
"def multiply(a,b)\n a.to_i * b.to_i\nend",
"def multiply(num_1, num_2)\n num_1 * num_2\nend",
"def multiply(num_1, num_2)\n num_1 * num_2\nend",
"def multiply(first_number, second_number)\n first_number.to_f * second_number.to_f\nend",
"def multiply(num_1, num_2)\n num_1*num_2\nend",
"def multiply(first, second)\n first * second\nend",
"def multiply(first_number, second_number)\n first_number.to_f * second_number.to_f\nend",
"def product(numbers)\n result = 1\n numbers.each do |number|\n result *= number\n end\n result\nend",
"def multiplyThem(numOne, numTwo)\n numOne * numTwo\nend",
"def multiplier(num1, num2)\nnum1 * num2\nend",
"def multiplier(num1, num2)\nnum1 * num2\nend",
"def multiply(a, b)\nend",
"def multiply(num1,num2)\n num1 * num2\nend",
"def multiply(number1, number2)\n number1 * number2\nend",
"def multiply(number1, number2)\n number1 * number2\nend",
"def multiply(number1, number2)\n number1 * number2\nend",
"def multiply(number1, number2)\n number1 * number2\nend",
"def mult(x,y)\n\tx * y\nend",
"def multiplier(num1, num2)\n num1 * num2\nend",
"def multiply(x,y)\n\tx*y\nend",
"def multiply(x, y)\n return x * y if x.is_a?(Numeric) && y.is_a?(Numeric)\n fail ArgumentError, 'Arguments must be a number'\nend",
"def multiple(num1,num2)\n\tnum1 * num2\nend",
"def multiply(a, b)\n multiply = a * b\n return multiply\nend",
"def multiply(num1,num2)\n num1 * num2 \nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend",
"def multiply(num1, num2)\n num1 * num2\nend"
] |
[
"0.80911416",
"0.8019841",
"0.78480786",
"0.78205353",
"0.78205353",
"0.7803001",
"0.7801665",
"0.77984434",
"0.7797936",
"0.7796563",
"0.7793577",
"0.7771764",
"0.7767486",
"0.7764761",
"0.7746023",
"0.77152795",
"0.7681972",
"0.7681675",
"0.76719564",
"0.7670739",
"0.7649389",
"0.7647249",
"0.76467985",
"0.7643672",
"0.7643657",
"0.76259637",
"0.7617368",
"0.7602348",
"0.7602348",
"0.7588814",
"0.7580781",
"0.7580781",
"0.7578234",
"0.75682664",
"0.75608826",
"0.7559135",
"0.7553906",
"0.7553906",
"0.755013",
"0.7546236",
"0.7537593",
"0.75203604",
"0.7512439",
"0.750576",
"0.75034565",
"0.7501139",
"0.7483141",
"0.74823177",
"0.74823177",
"0.74823177",
"0.74823177",
"0.7477075",
"0.7477075",
"0.7474556",
"0.7474029",
"0.74692065",
"0.7466952",
"0.7464574",
"0.74622154",
"0.74622154",
"0.74495316",
"0.74444705",
"0.74408937",
"0.7432631",
"0.7405047",
"0.7395891",
"0.7395156",
"0.7395156",
"0.7394649",
"0.7393787",
"0.738562",
"0.738562",
"0.738562",
"0.738562",
"0.738076",
"0.737155",
"0.73686296",
"0.7368377",
"0.73593897",
"0.7359087",
"0.7357777",
"0.73497105",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292",
"0.7348292"
] |
0.0
|
-1
|
read options from YAML config
|
def configure
# config file default options
configuration = {
:options => {
:verbose => false,
:color => 'AUTO'
}
}
# set default config if not given on command line
config = @options[:config]
unless config
config = [
File.join(@working_dir, "oct.conf"),
File.join(@working_dir, ".oct.conf"),
File.join(@working_dir, "config", "oct.conf"),
File.expand_path(File.join("~", ".oct.conf"))
].detect { |filename| File.exists?(filename) }
end
if config && File.exists?(config)
# rewrite options full path for config for later use
@options[:config] = config
# load options from the config file, overwriting hard-coded defaults
config_contents = YAML::load(File.open(config))
configuration.merge!(config_contents.symbolize_keys!) if config_contents && config_contents.is_a?(Hash)
else
# user specified a config file?, no error if user did not specify config file
raise "config file not found" if @options[:config]
end
# the command line options override options read from the config file
@options = configuration[:options].symbolize_keys!.merge!(@options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_config!\n return unless options.empty?\n\n data = ::YAML.load_file(File.open(\"#{directory.path}/supernova.yml\", \"r\"))\n load_paths.push(*data.fetch(\"load_paths\", []))\n\n load_paths.map! do |path|\n File.absolute_path(path, directory.path)\n end\n\n @options = data\n end",
"def parsed_options\n config\n end",
"def config\n @config ||= YAML.load_file @options[:config_file]\n end",
"def configuration_from_options(options); end",
"def parse_config_file\n if !File.exist?(options[:config_file])\n puts \"Configuration file is not found\"\n exit 1\n end\n\n configs = YAML.load_file(options[:config_file]).deep_symbolize_keys\n options.reverse_merge!(configs[environment.to_sym] || {})\n end",
"def yml_config\n return @yml_config if @yml_config\n\n require 'yaml'\n data = File.open(options[:config_path]).read\n\n require 'erb'\n data = ERB.new(data).result(binding)\n\n @yml_config ||= YAML.load(data)\n end",
"def read_opts(file_path=nil)\n begin\n default_opts.merge!(\n deep_symbolize(YAML.load_file(file_path || config_file_path))[environment.to_sym])\n rescue Errno::ENOENT => e\n p \"[warning] config file not read, using default options\"\n default_opts\n end\n end",
"def read_config_file()\n if File.exists?(options[:config_file])\n return YAML.load_file(options[:config_file])\n else\n @logger.error \"Config file [#{options[:config_file]}] missing!\"\n end\n end",
"def options\n return @options if @options_parsed\n options = super\n config_path = File.join(File.dirname(__FILE__),\n '../..', CONFIG_FILE_NAME)\n return options unless File.exist? config_path\n\n defaults = YAML.load_file(config_path).deep_symbolize_keys || {}\n options = defaults.merge_with_arrays(options)\n @options = Thor::CoreExt::HashWithIndifferentAccess.new(options)\n @options_parsed = true\n\n @options\n end",
"def config\n\tYAML.load(File.open(\"config.yaml\"))\nend",
"def config\n @options[:config]\n end",
"def read_config\n begin\n config = YAML.load_file('config/config.yml')\n puts config['address']\n puts config['port']\n rescue YAML::LoadError => e\n # If config file is not found or valid, return with errors\n logger.error \"read config error: #{e}\"\n end\n\n [config['address'], config['port']]\n end",
"def read_config!\n @config = YAML.load_file(CONFIG_FILE)\n end",
"def config_for_yaml(opts = {})\n path = opts[:yaml] || fixture('app_config.yml')\n config_for({ yaml: path }.merge(opts))\n end",
"def load_config(config_file)\n if !(hash = YAML.load_file(config_file))\n raise(ConfigError, \"Config file [#{config_file}] contains no options.\")\n end\n \n debug(\"Config options:\")\n debug(\"\") \n hash.each do |key, val|\n debug(\"#{key}: #{val}\") \n if CONFIG_OPTIONS.include?(key.to_sym)\n self.send(\"#{key}=\", val)\n else\n raise(ConfigError, \"Unrecognized Option: #{key}\")\n end\n end\n end",
"def read_config(io = nil)\n unless io\n root_path = ::Middleman::Application.root\n config_file_path = File.join(root_path, \".s3_sync\")\n\n # skip if config file does not exist\n return unless File.exists?(config_file_path)\n\n io = File.open(config_file_path, \"r\")\n end\n\n config = YAML.load(io).symbolize_keys\n\n OPTIONS.each do |config_option|\n self.send(\"#{config_option}=\".to_sym, config[config_option]) if config[config_option]\n end\n end",
"def parse_config \n path = \"#{Rails.root}/config/mebla.yml\"\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end",
"def parse\n options = {}\n options.merge(parse_config_file(CONFIG_LOCATION))\n\n argv = parse_argv\n if argv[:config_file].kind_of?(String)\n options.merge(parse_config_file(argv[:config_file]))\n end\n\n options.merge(argv)\n end",
"def read_configuration\n\t\t@config = YAML.load_file(\"config.yml\")\n\t\treturn @config\n\tend",
"def get_options\n options = YAML.load_file(\n File.expand_path(\"#{ENV['HOME']}/.right_api_client/login.yml\")\n )\nend",
"def config options={}\n options = DEFAULT_OPTS.merge(options)\n config = Path.yaml_file(options[:file])\n unless options[:environment].nil? || options[:environment].empty?\n config[options[:environment]]\n else\n config\n end\n end",
"def read_config_file\n config_path = File.expand_path(File.dirname(__FILE__)+\"/../../\")\n YAML.load_file(\"#{config_path}/config/#{@type}/config.yaml\")\n end",
"def options\n config.options\n end",
"def read_options args={}, update_options={}\n args = {:environment => nil,\n :config_file => nil,\n :verbose => 'silent'\n }.update(args)\n\n options = {}\n\n if File.exists? @cfg_file\n vputs \"Loading '#{@cfg_file}'\", args[:verbose]\n options = load_file @cfg_file\n end\n\n if args[:config_file]\n if !File.exists? args[:config_file]\n vputs \"ERROR: Config file '#{args[:config_file]}' not found!\", args[:verbose]\n exit\n end\n vputs \"Loading '#{args[:config_file]}'\", args[:verbose]\n update_options(args[:config_file], options)\n elsif @persistent_local_cfg_file && File.exists?(@persistent_local_cfg_file)\n vputs \"Loading '#{@persistent_local_cfg_file}'\", args[:verbose]\n update_options(@persistent_local_cfg_file, options)\n elsif @local_cfg_file && File.exists?(@local_cfg_file)\n vputs \"Loading '#{@local_cfg_file}'\", args[:verbose]\n update_options(@local_cfg_file, options)\n end\n\n if args[:environment]\n vputs \"Using environment '#{args[:environment]}'\", args[:verbose]\n options = (options['default']||{}).deep_merge!(options[args[:environment]]||{})\n end\n\n options.update(update_options)\n options['environment'] = 'development' if options['environment'].nil?\n options['verbose'] = false if options['verbose'].nil?\n\n if args[:verbose] == true\n len = options.keys.map { |k| k.size }.sort.last\n vputs \"Loaded options:\", args[:verbose]\n options.each { |k, v| puts \" #{k.ljust(len)} => #{v}\" }\n end\n\n options\n end",
"def yaml\n parse_yaml_string(yaml_string(config_file), config_file)\n end",
"def load_configuration_file_or_read_the_options!\n @application.load_configuration_file\n @application.config.use(\n :rubies => (options[:rubies] || @application.rubies),\n :test_framework => (options[:test_framework] || @application.config.test_framework),\n :verbose => options[:verbose] || @application.config.verbose)\n end",
"def config_options\n # config_file_path = File.join(ENV['SHARED_CONFIG_ROOT'] || \"#{Rails.root}/config\", \"college_mapper.yml\")\n # @config_options ||= YAML::load(ERB.new((IO.read(config_file_path))).result)[(Rails.env)].symbolize_keys \n @config_options ||= API_KEYS['collegemapper'][Rails.env].symbolize_keys\n end",
"def parse_from_file\n parsed_opts = YAML.load_file(config_path)\n parsed_opts.delete_if{|k| k.to_s == 'config_path'}\n parsed_opts.each_pair{|k,v| self[k] = v}\n true\n rescue Errno::ENOENT\n false\n end",
"def services\n (YAML.load_file( @options[:path] )||[]) rescue []\n end",
"def yardopts\n IO.read(options_file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def configure_from_options\n if @options[:config]\n config = Configuration.new(@path, @options[:config])\n config.from_options\n end\n end",
"def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n if @ConfFile.nil?\n return conf\n end\n\n optfile = @ConfFile\n optfile = optfile.gsub(/%f/, @doc.filename)\n optfile = optfile.gsub(/%F/, @doc.file)\n optfile = optfile.gsub(/%D/, @doc.dir)\n optfile = optfile.gsub(/%E/, @doc.extname)\n optfile = optfile.gsub(/%R/, @doc.dir + \"/\" + @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%r/, @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%t/, @Type)\n optfile = optfile.gsub(/%B/, $basedir)\n optfile = optfile.gsub(/%b/, $confdir)\n\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @doc.filename\n conf[\"dir\"] = @doc.dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @doc.dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @doc.dir) if conf[k].class == String\n end\n }\n\n return conf\n end",
"def configuration_from_options(options)\n Jekyll.configuration(options)\n end",
"def load_yaml(yaml_file)\n @options = YAML.load_file(yaml_file)\n end",
"def load_options(conf_file)\n if File.readable?(conf_file)\n conf_txt = File.read(conf_file)\n conf_opt = YAML::load(conf_txt)\n\n @options.merge!(conf_opt) if conf_opt != false\n end\n end",
"def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end",
"def parse_config(config)\n @config = YAML.load_file(config)\n debug_msg(\"CONFIG: #{@config.inspect}\")\nend",
"def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n optfile = @ConfFile\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @filename\n conf[\"dir\"] = @dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @dir) if conf[k].class == String\n end\n }\n\n return conf\n end",
"def config_for name\n yaml = SpaceScrape.root.join 'config', \"#{ name }.yml\"\n\n unless yaml.exist?\n raise \"Could not load configuration. No such file - #{ yaml }\"\n end\n\n erb = ERB.new(yaml.read).result\n erbd_yaml = YAML.load erb\n\n erbd_yaml[SpaceScrape.environment.to_s] || {}\n rescue YAML::SyntaxError => e\n raise \"YAML syntax error occurred while parsing #{ yaml }. \" \\\n \"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. \" \\\n \"Error: #{ e.message }\"\n end",
"def load_config_file( filename )\n\n begin\n config_erb = ERB.new( IO.read( filename ) ).result( binding )\n rescue StandardError => ex\n raise( \"#{filename} could not be parsed with ERB. \\n#{ex.inspect}\" )\n end\n\n begin\n yml = YAML.load( config_erb )\n rescue Psych::SyntaxError => ex\n raise \"#{filename} could not be parsed as YAML. \\nError #{ex.message}\"\n end\n\n config = yml.symbolize_keys\n return config.symbolize_keys || {}\n end",
"def parse_config(config); end",
"def read_settings\n\t\t\t\tread = nil\n\t\t\t\tif File.exist?(\"#{Notify_yaml}\")\n\t\t\t\t\tldconfig = YAML.load_file(\"#{Notify_yaml}\")\n\t\t\t\t\t@webhook_url = ldconfig['webhook_url']\n\t\t\t\t\t@user_name = ldconfig['user_name']\n\t\t\t\t\t$source = ldconfig['source']\n\t\t\t\t\tread = true\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You must create a YAML File with the options\")\n\t\t\t\t\tprint_error(\"as: #{Notify_yaml}\")\n\t\t\t\t\treturn read\n\t\t\t\tend\n\t\t\t\treturn read\n\t\t\tend",
"def config\n @config ||= YAML.load File.read(@config_file)\n end",
"def config\n \n # TODO: Re-enable:\n # # Display the value for a specific machine.\n # $ rudy -e prod -r db config param-name\n \n if @@config.nil? || @@config.empty?\n return if @@global.quiet\n raise Rudy::NoConfig\n end\n\n outform = @@global.format == :json ? :to_json : :to_yaml\n \n types = @option.marshal_dump.keys & @@config.keys # Intersections only\n types = @@config.keys if @option.all\n types = [:machines] if types.empty?\n \n if @option.project\n rf = File.join(RUDY_HOME, 'Rudyfile')\n raise \"Cannot find: #{rf}\" unless File.exists?(rf)\n li File.read(rf)\n \n elsif @option.script\n conf = fetch_script_config\n li conf.to_hash.send(outform) if conf\n \n else\n #li \"# ACCOUNTS: [not displayed]\" if types.delete(:accounts)\n types.each do |conftype|\n li \"# #{conftype.to_s.upcase}\"\n next unless @@config[conftype] # Nothing to output\n if conftype == :accounts\n skey = @@config[conftype][:aws][:secretkey]\n @@config[conftype][:aws][:secretkey] = hide_secret_key(skey)\n end\n \n li @@config[conftype].to_hash.send(outform)\n end\n end\n \n end",
"def load(options = HashWithIndifferentAccess.new)\n config = load_config_file(options[:config])\n import_config(config, options)\n end",
"def read_config(name)\n read_config_file[name]\n end",
"def read_settings\n\t\t\t\tread = nil\n\t\t\t\tif File.exist?(\"#{Notify_yaml}\")\n\t\t\t\t\tldconfig = YAML.load_file(\"#{Notify_yaml}\")\n\t\t\t\t\t@webhook_url = ldconfig['webhook_url']\n\t\t\t\t\t@user_name = ldconfig['user_name']\n\t\t\t\t\tread = true\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You must create a YAML File with the options\")\n\t\t\t\t\tprint_error(\"as: #{Notify_yaml}\")\n\t\t\t\t\treturn read\n\t\t\t\tend\n\t\t\t\treturn read\n\t\t\tend",
"def load_options\n # step: we iterate each of the options file and load them\n begin \n @config[:files].each do |filename|\n Logger.info 'load_options: loading the file: %s' % [ filename ]\n loader = DSLLoader.load filename\n # check: we need to validation the parsed options aginst anything we already have\n loader = validate_rules loader, filename\n # step: add the parsed entried into the collected items\n end\n # step: all the files have been loaded, we do need to perform some post analysis tho and linking\n Logger.debug 'load_options: perform post linking and validation'\n # notes: we need to make sure all the commands options and validations exists and link them for ease\n @rules.commands.each_pair do |name,command|\n Logger.debug \"load_options: processing the command: #{name}\"\n # step: iterate each of the inputs\n command.inputs.each_pair do |input_name,input|\n ## Validations ===\n unless @rules.validation? input.validation\n raise ArgumentError, \"command: '%s' has validation: '%s' but the validation does not exist\" % [ input_name, input.validation ]\n end\n # step: lets link the validation into the input\n input.validation @rules.validations[input.validation]\n ## Options ===\n unless @rules.option? input.options\n raise ArgumentError, \"command: '%s' has options: '%s' but the options does not exist\" % [ input_name, input.options ] \n end\n input.options @rules.options[input.options]\n end\n end\n rescue Exception => e \n Logger.error 'load_options: unable to load the options dsl, error: %s' % [ e.message ]\n raise Exception, e.message\n end\n end",
"def from_yaml(text)\n if config = YAML.load(text)\n return config\n end\n end",
"def parse!(argv=ARGV, options={})\n parser = ConfigParser.new\n parser.add(configurations)\n \n args = parser.parse!(argv, options)\n [args, parser.config]\n end",
"def config_load(config); end",
"def ReadGlobalConfig()\n\n # Load config file\n begin\n conf = YAML.load_file(\"#{$confdir}/#{$globalConfFile}\")\n rescue\n puts \"Unable to locate #{$confdir}/#{$globalConfFile}\"\n conf = {}\n end\n\n Dir.glob(\"#{$confdir}/#{$globalConfDir}/*.yaml\") {|f|\n begin\n conf.merge!(YAML.load_file(f))\n rescue\n puts \"Unable to locate #{f}\"\n conf = {}\n end\n }\n\n $sections.each {|o|\n conf[o] = [] if conf[o].nil?\n }\n conf[:globalConfFile] = \"#{$confdir}/#{$globalConfFile}\"\n conf[:globalConfDir] = \"#{$confdir}/#{$globalConfDir}\"\n\n altConfFile = \"#{$curdir}/.rake/#{$globalConfFile}\"\n if File.exists?(altConfFile)\n begin\n puts \"Reading local config file #{altConfFile}\" if $verbose\n c = YAML.load_file(altConfFile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n }\n rescue\n puts \"Error loading #{altConfFile}\"\n end\n end\n \n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n end\n }\n\n return conf\nend",
"def parse_config(config_path)\n begin\n YAML.load(IO.read(config_path))\n rescue StandardError => e\n raise(\"Failed reading configuration from '#{config_path}': '#{e}'\")\n end\n end",
"def params\n begin\n YAML::load(File.open(@config))\n rescue\n {}\n end\n end",
"def load_config(config_file)\n YAML.load(File.open(config_file))\nend",
"def read_settings\n\t\t\t\tread = nil\n\t\t\t\tif File.exist?(\"#{Twitter_yaml}\")\n\t\t\t\t\tldconfig = YAML.load_file(\"#{Twitter_yaml}\")\n\t\t\t\t\t@consumer_key = ldconfig['consumer_key']\n\t\t\t\t\t@consumer_secret = ldconfig['consumer_secret']\n\t\t\t\t\t@oauth_token = ldconfig['oauth_token']\n\t\t\t\t\t@oauth_token_secret = ldconfig['oauth_token_secret']\n\t\t\t\t\t@user = ldconfig['user']\n\t\t\t\t\t@source = ldconfig['source']\n\t\t\t\t\tread = true\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You must create a YAML File with the options\")\n\t\t\t\t\tprint_error(\"as: #{Twitter_yaml}\")\n\t\t\t\t\treturn read\n\t\t\t\tend\n\t\t\t\treturn read\n\t\t\tend",
"def load_config!\n if options[:config]\n config_inst = Config.new(options[:config])\n elsif self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES)\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = Config.new(path) if path\n end\n if config_inst\n options.delete(:config)\n defaults_inst = Smash[\n config_class.new(\n defaults.to_smash\n ).to_smash.find_all do |key, value|\n defaults.key?(key)\n end\n ]\n config_data = config_inst.data\n config_inst = Smash[\n config_inst.to_smash.find_all do |key, value|\n config_data.key?(key)\n end\n ]\n options_inst = Smash[\n config_class.new(\n options.to_smash\n ).to_smash.find_all do |key, value|\n options.key?(key)\n end\n ]\n @options = config_class.new(\n defaults_inst.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options_inst.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end",
"def parse_options; end",
"def parse_options; end",
"def read(*args)\n raise ArgumentError.new('No arguments passed to ConfigReader#read') if args.empty?\n\n config = case\n when args.last.end_with?('.json')\n read_json_config(args)\n when args.last.end_with?('.yaml')\n read_yaml_config(args)\n else\n read_json_config(args) || read_yaml_config(args)\n end\n\n raise ArgumentError.new(\"Config file #{File.join(args)} not found\") if config.nil?\n\n config\n end",
"def data\n YAML::load_file(files[:config])\n end",
"def configuration\n options = @configuration.deep_symbolize_keys.merge(yaml_options)\n options.merge!(logger: logger) if logger\n options\n end",
"def parse_cloud_config\n cloud_config = YAML.load(File.read('config/cloud.yml'))\n check_cloud_config(cloud_config)\n\n cloud_config\n end",
"def config\n @config ||= YAML.load_file(@config_file_path)\n end",
"def read_yaml(base, name, opts = T.unsafe(nil)); end",
"def load_from_yaml(file)\n document_lines = File.readlines(file)\n\n headers = document_lines.enum_for(:each_with_index).\n find_all { |line, _| line =~ /^---/ }\n if headers.empty? || headers.first[1] != 0\n headers.unshift [\"--- name:default\", -1]\n end\n\n options = headers.map do |line, line_number|\n line_options = Hash.new\n line = line.chomp\n line.split(/\\s+/)[1..-1].each do |opt|\n if opt =~ /^(\\w+):(.*)$/\n line_options[$1] = $2\n else\n raise ArgumentError, \"#{file}:#{line_number}: wrong format #{opt}, expected option_name:value, where 'value' has no spaces\"\n end\n end\n line_options['merge'] = (line_options['merge'] == 'true')\n line_options['chain'] = (line_options['chain'] || '').split(',')\n [line_options, line_number]\n end\n options[0][0]['name'] ||= 'default'\n\n options.each do |line_options, line_number|\n if !line_options['name']\n raise ArgumentError, \"#{file}:#{line_number}: missing a 'name' option\"\n end\n end\n\n sections = []\n options.each_cons(2) do |(_, line0), (_, line1)|\n sections << document_lines[line0 + 1, line1 - line0 - 1]\n end\n sections << document_lines[options[-1][1] + 1, document_lines.size - options[-1][1] - 1]\n\n changed_sections = []\n @conf_options = options\n\n sections.each_with_index do |doc, idx|\n doc = doc.join(\"\")\n doc = evaluate_dynamic_content(file, doc)\n\n result = YAML.load(StringIO.new(doc))\n\n conf_options = options[idx].first\n name = conf_options.delete('name')\n changed = in_context(\"while loading section #{name} of #{file}\") do\n add(name, result || Hash.new, conf_options)\n end\n\n if changed\n changed_sections << name\n end\n end\n\t if !changed_sections.empty?\n\t \t@merged_conf.clear\n\t end\n changed_sections\n rescue Exception => e\n raise e, \"error loading #{file}: #{e.message}\", e.backtrace\n end",
"def parse_config_file(file)\n options = {}\n return options if file.nil?\n\n config_string = \"\"\n if File.exists?(File.expand_path(file))\n config_string << File.open(File.expand_path(file)).read\n end\n\n config_string.each_line do |line|\n line.strip!.gsub!(/#.*/, \"\")\n next if line.empty?\n\n opt,value = line.split(/\\s*/, 2)\n options[opt.to_sym] = value\n end\n\n options\n end",
"def options\n self.read_attribute(:options).split(\"\\n\") unless self.read_attribute(:options).nil?\n end",
"def read_config config_path = ''\n return nil if config_path.empty?\n return nil unless File.file?(config_path)\n YAML.safe_load(File.read(config_path))\n end",
"def read_config filename # {{{\n\n # Pre-condition check\n raise ArgumentError, \"Filename argument should be of type string, but it is (#{filename.class.to_s})\" unless( filename.is_a?(String) )\n\n # Main\n @log.message :debug, \"Loading this config file: #{filename.to_s}\"\n result = File.open( filename, \"r\" ) { |file| YAML.load( file ) } # return proc which is in this case a hash\n result = hashes_to_ostruct( result ) \n\n # Post-condition check\n raise ArgumentError, \"The function should return an OpenStruct, but instead returns a (#{result.class.to_s})\" unless( result.is_a?( OpenStruct ) )\n\n result\n end",
"def conf\n unless @conf\n if @db_url || @db # skip loading config if db set explicitly\n @conf = {}\n else\n parse_command_line unless @args\n\n raise \"No configuration file defined (-c <config>).\" if @args[\"config\"].nil?\n raise \"Couldn't read #{@args[\"config\"]} file.\" unless @args['config'] && @conf = YAML::load(File.new(@args[\"config\"]).read)\n # setting default options that should be written along with all the records to process_items\n if @conf['default_options']\n @conf['default_options'].each do |k,v|\n default_options.send(\"#{k}=\", v)\n end\n end\n\n if @args['params']\n @args['params'].each do |k, v|\n default_options.send(\"#{k}=\", v)\n end\n end\n end\n end\n @conf\n end",
"def parse_config!(config, &block)\n options = OptionParser.new do |opts|\n opts.banner = \"Usage: djinn_file [OPTIONS]\"\n opts.on(\"-N\", \"--no-daemon\", \"Don't run in the background\") do\n config[:__daemonize] = false\n end\n opts.on(\"--stop\", \"Stop the Djinn, if possible\") do\n config[:__stop] = true\n end\n opts.on_tail(\"-h\", \"--help\", \"Prints this message\") do\n puts opts\n exit(0)\n end\n @config_items.each { |c| c.parse!(opts, config) }\n end\n yield options if block_given?\n options.parse!\n #Apply defaults\n @config_items.each do |ci|\n config[ci.key] = ci.default_value if ci.has_default? unless config.include?(ci.key)\n end\n # Check for missing arguments\n @config_items.each do |ci|\n if ci.required?\n puts \"Missing argument: #{ci.key}\\n\\n#{options}\"\n exit(1)\n end unless config.include?(ci.key) or config.include?(:__stop)\n end\n rescue OptionParser::InvalidOption => e\n puts e.message\n exit(1)\n end",
"def load_config( filename )\n\n fullname = \"#{Rails.application.root}/config/#{filename}\"\n begin\n config_erb = ERB.new( IO.read( fullname ) ).result( binding )\n rescue StandardError => ex\n raise( \"#{filename} could not be parsed with ERB. \\n#{ex.inspect}\" )\n end\n\n begin\n yml = YAML.load( config_erb )\n rescue Psych::SyntaxError => ex\n raise \"#{filename} could not be parsed as YAML. \\nError #{ex.message}\"\n end\n\n config = yml.symbolize_keys\n @configuration = config[ Rails.env.to_sym ].symbolize_keys || {}\n end",
"def yaml(*files, **options, &block) = read(*files, parse: :yaml, ext: ['.yml', '.yaml'], **options, &block)",
"def from_options\n # don't do anything, unless options were provided\n return if not @config or @config.empty?\n @config.each { |key, value| update(key, value) }\n end",
"def from_config\n config ||= YAML::load(File.open((File.join(File.dirname(__FILE__), 'config.yml'))))\nend",
"def read_settings\n begin\n @settings = YAML::load_file(@path)\n rescue\n @settings = {}\n end\n end",
"def configure_by_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getOpenFileName(self, \"Open configuration file\", \".\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin \n # Load configuration from YAML\n hash = YAML.load(open(path))\n \n # Sanity checks:\n error = nil\n \n if hash.keys.max > @container_hash.keys.max\n error = \"Higher position value in file than #containers available.\"\n elsif hash.size > @container_hash.size\n error = \"More config items in file than containers available.\"\n end\n \n if error\n msg_box = Qt::MessageBox.new\n msg_box.set_text(\"Problem with YAML import:\")\n msg_box.set_informative_text(error)\n msg_box.exec\n return\n end\n \n # Disconnect, update configuration and connect for each container\n hash.each do |pos, config|\n container = @container_hash[pos]\n container.disconnect\n container.configure_by_obj(config)\n container.connect if config\n end\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to open '#{path}': \\n#{e.message}\"\n Vizkit.error e.backtrace.inspect \n end\n end",
"def load_config\n @log.debug \"loading validator-specific configuration\"\n config = Autosign::Config.new\n\n if config.settings.to_hash[self.name].nil?\n @log.warn \"Unable to load validator-specific configuration\"\n @log.warn \"Cannot load configuration section named '#{self.name}'\"\n return {}\n else\n @log.debug \"Set validator-specific settings from config file: \" + config.settings.to_hash[self.name].to_s\n return config.settings.to_hash[self.name]\n end\n end",
"def parse_config_file config_path\n File.open(config_path, \"r\") do |file|\n case File.extname(file).delete(\".\")\n when \"json\" then JSON.parse(file.read)\n when \"yml\" then YAML.load_file(file)\n else\n file.close\n raise LoadError, \"Type of file is not supported.\"\n end\n end\n end",
"def load_config_file\n require 'yaml'\n YAML.load_file(@path)\n rescue Errno::ENOENT\n return\n end",
"def load_config\n cfg = File.open(CONFIG) { |yf| YAML::load( yf ) } if File.exists?(CONFIG)\n # => Ensure loaded data is a hash. ie: YAML load was OK\n if cfg.class != Hash\n raise \"ERROR: Configuration - invalid format or parsing error.\"\n else\n if cfg['login'].nil?\n raise \"ERROR: Configuration: login not defined.\"\n end\n end\n\n return cfg\nend",
"def as_config\n Configureasy::Config.new self.parse\n end",
"def read_config_file; end",
"def parse_config(\n config_file=File.expand_path(File.join(File.dirname(__FILE__), 'config.yml'))\n)\n require 'yaml'\n config = {\n 'sites' => \"sites\",\n 'webroot_subdir' => \"\",\n 'databases' => \"databases\",\n 'memory' => '2048',\n 'cpus' => '1',\n 'use_nfs' => true,\n 'with_gui' => false,\n 'ip' => \"192.168.50.4\",\n 'box_name' => 'Parrot-Trusty',\n 'varnish_enabled' => false,\n 'local_user_uid' => Process.uid,\n 'local_user_gid' => Process.gid,\n 'forward_solr' => true,\n 'forward_mysql' => true,\n 'forward_varnish' => true,\n 'forward_apache' => true,\n 'forward_https' => true,\n 'forward_dovecot' => true,\n 'solr_port' => 8983,\n 'mysql_port' => 3306,\n 'varnish_port' => 8181,\n 'apache_port' => 8080,\n 'https_port' => 1443,\n 'dovecot_port' => 1143,\n 'drush_version' => 'drush/drush',\n }\n if File.exists?(config_file)\n overrides = YAML.load_file(config_file)\n config.merge!(overrides)\n end\n config\nend",
"def loadconf\n\n @conf = YAML.load_file(File.join($path, \"config.yaml\"))\n return @conf['theme']\n end",
"def read_config(loc)\n if File.file?(loc) && File.readable?(loc)\n begin\n YAML.safe_load(File.read(loc), [], [], true)\n rescue StandardError => e\n PDK.logger.warn(_(\"'%{file}' is not a valid YAML file: %{message}\") % { file: loc, message: e.message })\n {}\n end\n else\n {}\n end\n end",
"def settings_read(name: nil)\n\n result = {}\n begin\n file_contents = IO.read settings_path(name)\n old_settings = YAML.load file_contents\n if old_settings.class == Hash\n result = old_settings\n end\n rescue\n result = {}\n end\n\n result.select! {|k,v| value_definition(k) != nil }\n result\n end",
"def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end",
"def load_configuration\n config = options[\"config\"]\n return unless config\n\n Mihari.load_config_from_yaml config\n Database.connect\n end",
"def load_config!\n if(options[:config])\n config_inst = config_class.new(options[:config])\n elsif(self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES))\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = config_class.new(path) if path\n end\n if(config_inst)\n options.delete(:config)\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end",
"def optParse\n OptionParser.new do |o|\n o.on('-v', 'Be more verbose.') { |i|\n self[:verbose] += 1\n }\n o.on('-V', '--version', 'Show version & exit.') { |i|\n puts Meta::VERSION\n exit EX_OK\n }\n o.on('--config NAME',\n \"Set a config name or file\",\n \"(default is #{@conf[:config_name]}).\") {|arg|\n @conf[:config_name] = arg\n }\n o.on('--config-dirs', 'Show possible config locations.') {\n mark = false\n @conf[:config_dirs].each { |idx|\n f = Pathname(idx) + @conf[:config_name]\n if File.file?(f) && !mark\n puts \"* #{f}\"\n mark = true\n else\n puts \" #{f}\"\n end\n }\n exit EX_OK\n }\n\n yield o if block_given?\n o.banner = @conf[:banner]\n\n env = nil\n env = ENV[@conf[:config_env]].shellsplit if ENV.key?(@conf[:config_env])\n\n begin\n [env, ARGV].each { |i| o.parse!(i) if i }\n rescue\n CliUtils.errx EX_USAGE, $!.to_s\n end\n end\n end",
"def build_config\n file = [options[:config_file], DEFAULT_CONFIG_FILE_LOCATION].\n compact.find {|f| File.exists?(f) }\n\n hash =\n if file\n YAML.load_file(file).each do |key, value|\n stderr.puts(\"Warn: Unknown key in config file: #{key}\") unless\n self.class.configs.find {|opt| opt.first.to_s == key.to_s }\n end\n else\n {}\n end\n\n options[:config_option].map {|str| str.split('=') }.\n inject(hash) {|m, (k,v)| m.merge(k.to_sym => v) }\n end",
"def load_config\n config_data = File.read(app_config_file)\n YAML.load(config_data) || {}\n end",
"def load_settings(args = [], *names)\n raise \"no setting names provided\" if not args.empty? and names.empty?\n require 'yaml'\n @options = {}\n args.reverse.each do |val|\n @options[names.pop] = val\n end\n \n # import and clean up options from the yaml\n imports = YAML.load_file(SETTINGS_FILE)\n imports.each_pair do |key, value|\n if not key.is_a? Symbol\n imports[key.to_sym] = value\n imports.delete(key)\n end\n end\n\n # combine the hashes\n @options = imports.merge(@options)\n end",
"def read_config_files\n load_config_files\n end",
"def yml_file_to_object(options={})\n content = read_file_content(options)\n YAML.load(content)\nend",
"def load config_file\n YAML.load_file(config_file).each do |parameter,value|\n instance_variable_set( \"@#{parameter}\", value )\n end\n end",
"def config\n yield @@config_options\n end",
"def fetch_config\n Rails.logger.debug \"Loading #{@file}::#{@env}\" if Object.const_defined?('Rails') && Rails.logger.present?\n YAML::load_file(@file)[@env.to_s]\n end",
"def load_config()\n rspec_file = '.rspec'\n full_config = YAML::load(File.open('./config/users.yaml')) # full YML\n puts \"\\n>Loaded user configuration for: \" + ENV['env_name'].to_s # only section of YML that is relevant for the particular environment\n return full_config[ENV['env_name']] # only section of YML that is relevant for the particular environment\nend"
] |
[
"0.70201164",
"0.69457424",
"0.6906089",
"0.6888912",
"0.6713834",
"0.6694016",
"0.6479926",
"0.64688617",
"0.64497",
"0.6407037",
"0.6399066",
"0.6394115",
"0.6391378",
"0.63850623",
"0.6383569",
"0.6380703",
"0.63534874",
"0.63323563",
"0.6317484",
"0.6312028",
"0.6283605",
"0.62767875",
"0.6261701",
"0.6243433",
"0.62288797",
"0.62052643",
"0.6196615",
"0.61847335",
"0.61802375",
"0.6168013",
"0.6167678",
"0.6163002",
"0.6158179",
"0.6143589",
"0.6133724",
"0.61309355",
"0.61064994",
"0.6096572",
"0.6086575",
"0.60742205",
"0.60666937",
"0.6062089",
"0.6055639",
"0.6051438",
"0.6042347",
"0.60299027",
"0.6029717",
"0.6022483",
"0.6011391",
"0.6008959",
"0.6005154",
"0.6001443",
"0.6000435",
"0.5993326",
"0.5990323",
"0.59854037",
"0.5978174",
"0.5977188",
"0.5977188",
"0.59684205",
"0.5965533",
"0.59638125",
"0.5947339",
"0.5942993",
"0.5936808",
"0.5936587",
"0.5931748",
"0.59303075",
"0.5927441",
"0.5924999",
"0.591937",
"0.5919036",
"0.5916396",
"0.59133583",
"0.59120417",
"0.5904863",
"0.5891782",
"0.5887993",
"0.5876789",
"0.5847236",
"0.584546",
"0.58328",
"0.58093625",
"0.5804514",
"0.5803524",
"0.57836705",
"0.5781433",
"0.57784176",
"0.5773316",
"0.5762099",
"0.5757107",
"0.575427",
"0.57511574",
"0.5746761",
"0.57425755",
"0.5738976",
"0.57383895",
"0.5737587",
"0.5735066",
"0.57283217",
"0.57279265"
] |
0.0
|
-1
|
use the sorted outputs for comparison
|
def insync?(is)
if defined? @should and @should
case self.should_to_s
when "all"
self.provider.all_privs_set?
when self.is_to_s(is)
true
else
false
end
else
true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def compare(x, y); end",
"def bigSorting(unsorted)\n\nend",
"def sorted_results\n results.sort\n end",
"def sort_entries; end",
"def e5115_sublinear_sort(values)\n end",
"def comp(array1, array2)\n p array1\n p array2\n if array1.nil? || array2.nil?\n return false\n else\n array2 = array2.map { |num| Math.sqrt(num) }\n p array1.sort\n p array2.sort\n array1.sort == array2.sort\n end\nend",
"def sortHisto(finalHisto)\n\n\tif finalHisto == 0\n\t\treturn \n\tend\n\n\tcheckST1 = 0\n\tcheckCH1 = 1\n\tcheckNM1 = 2\n\n\tcheckST2 = 3\n\tcheckCH2 = 4\n\tcheckNM2 = 5\n\n\twhile checkNM1 < finalHisto.length\n\t\t\n\t\tif checkNM2 >= finalHisto.length\n\t\t\tcheckST1 +=3\n\t\t\tcheckCH1 +=3\n\t\t\tcheckNM1 +=3\n\t\t\tcheckST2 = checkST1 + 3\n\t\t\tcheckCH2 = checkCH1 + 3\n\t\t\tcheckNM2 = checkNM1 + 3\n\t\tend\n\n\t\tif finalHisto[checkNM1 + 1] == nil \n\t\t\treturn finalHisto\n\t\tend\n\n\t\tif finalHisto[checkNM1] == finalHisto[checkNM2]\n\t\t\tcheckLex = finalHisto[checkST1].to_s <=> finalHisto[checkST2].to_s\n\t\t\tif checkLex > 0\n\t\t\t\tfinalHisto = swap(checkST1, checkCH1, checkNM1, checkST2, checkCH2, checkNM2, finalHisto)\n\t\t\tend\n\t\t\t\t\n\t\tend\n\n\t\tcheckST2 +=3\n\t\tcheckCH2 +=3\n\t\tcheckNM2 +=3\n\t\n\tend\n\n\treturn finalHisto\n\t\t\t\nend",
"def compare\n results = []\n @sets.each do |set|\n results << interpret(set)\n end\n\n base = nil\n results.each do |res|\n if base.nil?\n base = res\n base[:slower] = 0\n else\n res[:slower] = ((res[:mean] / base[:mean]) * 100) - 100\n end\n end\n\n results\n end",
"def stable_sort_by(list); end",
"def compare_further p1hand, p2hand, rank, secondary\n p1values = p1hand.map{|c| $value_map[c[0]]}.sort\n p2values = p2hand.map{|c| $value_map[c[0]]}.sort\n # no further comparison if it's a straight\n return 0 if rank == 9 || rank == 8 || rank == 4\n if rank == 7 # four of a kind\n comp1 = (p1values[0] == secondary ? p1values[4] : p1values[0])\n comp2 = (p2values[0] == secondary ? p2values[4] : p2values[0])\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank == 6 # full house\n comp1 = (p1values - [secondary]).uniq[0]\n comp2 = (p2values - [secondary]).uniq[0]\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank <= 5 # all remaining ranks\n comp1 = (p1values - [secondary]).uniq.reverse\n comp2 = (p2values - [secondary]).uniq.reverse\n comp1.each_with_index do |e,i|\n return 1 if e > comp2[i]\n return 2 if comp2[i] > e\n end\n return 0\n end\nend",
"def compare(a, b)\n #YOUR WORK HERE\n end",
"def test_merge_sort_helper\n # Arrange\n hundred_elements = (0..100).to_a\n cases = [{input: [0], expected: [0]},\n {input: [0, 1], expected: [0, 1]},\n {input: [0, 1, 2, 5, 7], expected: [0, 1, 2, 5, 7]},\n {input: [1, 5, 2, 0], expected: [0, 1, 2, 5]},\n {input: hundred_elements.shuffle, expected: hundred_elements}]\n\n\n cases.each { |test_case|\n # Act\n @aux = Array.new(test_case[:input].length)\n actual = standard_merge_sort test_case[:input], 0, test_case[:input].length - 1\n\n # Assert\n assert_equal test_case[:expected], actual\n }\n end",
"def priority_sort(result_list, free_bandwidth)\n priority_list = result_list.sort\n new_results = []\n priority_index = 0\n priority_list.each_index do |i|\n result = \"PASSED\"\n priority_index = priority_list[i].slice!(/^\\d+/).to_i\n bc = priority_list[i].split(\"|\")[0].unpack(\"a2a2a2\")\n if bc[2] == \"BF\"\n # fails if minimum failed and it's the top priority stream\n result = \"FAILED\" if bc[0] == \"YM\" && i == 0\n # fails if minimum failed and there was free bandwidth\n result = \"FAILED\" if bc[0] == \"YM\" && free_bandwidth > 0\n # fails if the bandwidth is over maximum specified\n result = \"FAILED\" if bc[1] == \"YN\"\n end\n new_results << priority_list[i].split(\"|\")[1].insert(0, \"[#{priority_index >= 0 ? sprintf(\"%d\", priority_index) : \"NONE\"}] [#{result}] \")\n end\n return new_results\nend",
"def ordered_by_qualifications(candidates)\n ordered_candidates = candidates.sort_by { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return (ordered_candidates).reverse\n\n # @ordered_by_qualifications = []\n\n # candidates.each do |candidate|\n # years_exp s=candidate[:years_of_experience]\n # @ordered_by_qualifications << years_exp\n # if years_exp == years_exp += 1\n # candidate[:github_points] > candidate[github_points] += 1\n # end \n \n # end\n # return @ordered_by_qualifications.sort!.reverse\n #This line returns the values 12..1 \n # return @ordered_by_qualifications.sort!.reverse\nend",
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def test_sort\n\n a_plus = Grade.new(\"A+\")\n a = Grade.new(\"A\")\n b_minus = Grade.new(\"B-\")\n\n ordered = [a_plus,b_minus, a].sort # should return [a, a_plus]\n\n assert(ordered[0] == b_minus)\n assert(ordered[1] == a)\n assert(ordered[2] == a_plus)\n\n end",
"def sort(array_of_nodes, order); end",
"def orderly(array)\n p array.sort\nend",
"def sort1(array)\n\nend",
"def gnomesort(a)\n a.start_logging\n\n i = 0\n while i < a.length\n if i == 0 || a[i] > a[i - 1]\n i += 1\n else\n a[i], a[i - 1] = a[i - 1], a[i]\n a.log\n i -= 1\n end\n end\n\n a\nend",
"def sort_cards_by_value_bis!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\tlen=@list.length-2\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value_bis<@list[i+1].get_value_bis\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value_bis == @list[i+1].get_value_bis\r\n\t\t\t\t\t\t@list.delete_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def two(array)\n array.sort\nend",
"def ordered_by_qualifications(array)\n\nloop do \n swapped = false\n for i in 0...(array.length-1)\n if array[i][:years_of_experience] > array[i+1][:years_of_experience]\n array[i], array[i+1] = array[i+1], array[i]\n swapped = true\n end\n end\n break if not swapped\nend\n\nloop do \n swapped = false\n for i in 0...(array.length-1)\n if array[i][:years_of_experience] == array[i+1][:years_of_experience]\n if array[i][:github_points] > array[i+1][:github_points]\n array[i], array[i+1] = array[i+1], array[i]\n swapped = true\n end\n end\n end\n break if not swapped\nend\n array.reverse\n\nend",
"def poorly_written_ruby(*arrays)\n\n combined_array = arrays.flatten # use built in ruby method\n\n index_count = combined_array.size - 1 # assign a variable so that array does not need to be accessed in while loop check\n sorted_array = [combined_array.delete_at(combined_array.length-1)]\n\n for val in combined_array\n i = 0\n while i <= index_count # use variable to avoid array access\n\n if val <= sorted_array[i]\n sorted_array.insert(i, val)\n break\n elsif i == sorted_array.length - 1\n sorted_array << val\n break\n end\n i+=1\n end\n end\n\n # Return the sorted array\n sorted_array\nend",
"def merge_print_sort\n @merge.print_sort\n end",
"def sorting(numbers)\n numbers.sort\nend",
"def sort_output_file\n FileUtils.rm_rf(order_result_filename)\n\n cmd = \"head -1 #{order_result_filename_temp} | rev | \" + \\\n \"cut -d ',' -f 2- | rev > #{order_result_filename}\"\n\n `#{cmd}`\n\n cmd = \"tail -n +2 #{order_result_filename_temp} | \" + \\\n \"awk -F ',' -v OFS=',' '{print $NF,$0}' | \" + \\\n \"sort -t ',' -k1,1 -n | cut -d ',' -f 2- | \" + \\\n \"rev | cut -d ',' -f 2- | rev >> #{order_result_filename}\"\n\n `#{cmd}`\n\n FileUtils.rm_rf(order_result_filename_temp)\n end",
"def sean_sort(numbers)\n\n\nend",
"def sorted_results(unsorted)\n scores = []\n sorted = []\n\n unsorted.group_by(&:itself).each_pair do |result, results|\n relevance = result_relevance(result, results.length)\n new_index = scores.bsearch_index { |val| val < relevance }\n # if this result has the lowest score, add it to the end\n new_index ||= -1 \n\n scores.insert(new_index, relevance)\n sorted.insert(new_index, result.first)\n end\n sorted\n end",
"def recombine (halved)\n left = halved.first\n right = halved.last\n sorted = []\n\n\n\nend",
"def onethrough unsorted_list, sorted_list\nstill_unsorted_list=[]\ncurrent_lowest = unsorted_list.pop\n\n\twhile unsorted_list.empty? != true #while it is not empty to run through the whole unsortedarray\n\n\t\t#if the array last value is bigger than the current lowest value\n\t\t#take the last (the one we just checked) and put it in the stillunsorted\n\t\tif unsorted_list.last >\tcurrent_lowest\n\t\t\tstill_unsorted_list.push(unsorted_list.pop)\n\t\t\t\n\t\t#if the currentlowest is not the lowest of the two comparissons\n\t\t#put it on the still undorded list\n\t\t#take the last one off the unsorted and put it as the new currentlowest\n\t\telse\n\t\t\tstill_unsorted_list.push(current_lowest)\n\t\t\tcurrent_lowest = unsorted_list.pop\n\t\t\n\t\t\t\n\t\tend\n\t\t\n\tend\n\tsorted_list.push(current_lowest)\n\n\nreturn still_unsorted_list, sorted_list\n\nend",
"def solution(nums)\n nums.to_a.sort\nend",
"def sort_entries=(_arg0); end",
"def sort_costs(y_costs, x_costs)\n x_costs.sort!\n y_costs.sort!\n order = []\n until y_costs.empty? && x_costs.empty?\n if x_costs.empty? \n order << [y_costs.pop, \"y\"] \n elsif y_costs.empty?\n order << [x_costs.pop, \"x\"]\n elsif y_costs.last > x_costs.last \n order << [y_costs.pop, \"y\"] \n else\n order << [x_costs.pop, \"x\"]\n end\n end\n order\nend",
"def combine(a, b)\n\t# create a results array\n\t\n\t# counters pointing to the index of the smallest elements in each array\n\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\nend",
"def my_array_sorting_method(source)\n p source.sort {|x,y| x.to_s <=> y.to_s}\nend",
"def sort_input(input, property, order); end",
"def ph(hash)\n hash.sort { |a, b| a[1]<=>b[1]}.each { |a| puts \"#{a[0]} : #{a[1]}\"}\nend",
"def display_merge_sort(array, expected_array, test_msg)\n puts \"===========================================\"\n puts \"\\nInput array: \" + test_msg\n p array\n result = merge_sort(array)\n puts \"\\nSorted array:\"\n p result\n puts \"\\nExpected output is:\"\n p expected_array\n puts \"\\n===========================================\"\nend",
"def tie_breaker_single hand2\n values.sort.reverse <=> hand2.values.sort.reverse\n end",
"def improved_poorly_written_ruby(*arrays)\n sorted = []\n arrays.flatten.each do |v|\n size = sorted.size\n if sorted.empty?\n sorted.push(v)\n else\n i = 0\n while i < size\n item = sorted[i]\n if item > v\n sorted.insert(i, v)\n break\n elsif i == size - 1\n sorted.push(v)\n break\n end\n i += 1\n end\n end\n end\n sorted\nend",
"def sort_cards_by_value!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\tlen=@list.length-2\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value<@list[i+1].get_value\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value == @list[i+1].get_value\r\n\t\t\t\t\t\t@list.delete_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def is_sorted\r\n false\r\n end",
"def compara_arrays(aa, ab)\n suma_aa = 0\n aa.each do |prom|\n suma_aa += prom\n end\n suma_aa = suma_aa / aa.length\n# ab = array b\n suma_ab = 0\n ab.each do |prom|\n suma_ab += prom\n end\n suma_ab = suma_ab / ab.length\n# condicion\n if suma_aa > suma_ab\n return suma_aa\n else\n return suma_ab\n end\nend",
"def poorly_written_ruby(*arrays)\n combined_array = []\n\n arrays.each do |array|\n combined_array.concat(array)\n end\n \n def quick_sort(collection)\n return collection if collection.length <= 1\n pivot = collection.sample\n\n left = Array.new\n right = Array.new\n\n collection.each do |x|\n if x <= pivot\n left << x\n else\n right << x\n end\n end\n\n quick_sort(left) + quick_sort(right)\n\n end\n\n def buckethash_sort(collection)\n\n buckets = Hash.new\n\n (\"A\"..\"Z\").each do |x|\n buckets[x] = Array.new\n end\n\n collection.each do |x|\n if buckets.key?(x[0])\n buckets[x[0]] << x\n end\n end\n\n buckets.each_key do |key|\n buckets[key] = quick_sort(buckets[key])\n end\n\n buckets.values.flatten\n\n end\n\n buckethash_sort(combined_array)\n\nend",
"def better_written_ruby(*arrays)\n combined_array = []\n # remove one loop and simply concatenate the arrays.\n arrays.each do |array|\n combined_array += array\n end\n \n sorted_array = [combined_array.delete_at(combined_array.length-1)]\n \n for val in combined_array\n i = 0\n while i < sorted_array.length\n if val < sorted_array[i]\n sorted_array.insert(i, val)\n break\n elsif i == sorted_array.length - 1\n sorted_array << val\n break\n end\n i+=1\n end\n end\n sorted_array\nend",
"def array_sort(arr)\nx = arr.length\nif x == 1\nelsif x == 2\n if arr[0] > arr[1]\n arr[0], arr[1] = arr[1], arr[0]\n end\nelse\n loop do\n modified = FALSE\n (x-2).times do |x|\n if (arr[x] < arr[x + 1]) && (arr[x] < arr[x + 2])\n if arr[x + 2] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x], arr [x + 2], arr[x + 1]\n modified = TRUE\n end\n elsif (arr[x + 1] < arr[x]) && (arr[x + 1] < arr[x + 2])\n if arr[x] < arr[x + 2]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n elsif arr[x + 2] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr [x + 2], arr[x]\n modified = TRUE\n elsif arr[x + 2] == arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n end\n elsif (arr[x + 2] < arr[x]) && (arr[x + 2] < arr[x + 1])\n if arr[x] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n elsif arr[x + 1] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x + 1], arr[x]\n modified = TRUE\n elsif arr[x] == arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n end\n end\n end\n break if modified == FALSE\n end\nend\n arr\nend",
"def rec_sort unsorted, sorted \n\tif unsorted.length <= 0\n\n# sorted is an array\n\treturn sorted \n\tend\n\n# So if we got here, then it means we still have work to do.\n# take last one out of unsorted, call it smallest\nsmallest = unsorted.pop\n#create en empty 'still unsorted' array \nstill_unsorted = []\n\n#testing if each object in unsorted is smaller than 'smallest' \n\tunsorted.each do |tested_object| \n\t#if tested object is smaller than smallest then push them in still unsorted\n\t\tif tested_object.downcase < smallest.downcase\n\t\t\tstill_unsorted.push smallest\n\t\t\tsmallest = tested_object\n\t\telse\n\t\t\tstill_unsorted.push tested_object\n\t\tend \n\tend\n# Now \"smallest\" really does point to the\n# smallest element that \"unsorted\" contained,\n# and all the rest of it is in \"still_unsorted\". \nsorted.push smallest\n\nrec_sort still_unsorted, sorted\nend",
"def array_2(array2)\n array2.sort!\n return array2\nend",
"def sorted?(arr)\n\nend",
"def merge(arr1, arr2)\n big_arr = arr1 + arr2\n sorted_arr = []\n\n until big_arr.empty?\n saved_num = big_arr.shift\n if big_arr.all? { |num| num >= saved_num }\n sorted_arr << saved_num\n else\n big_arr.push(saved_num)\n end\n end\n sorted_arr\nend",
"def output(input)\n array = []\n input.sort.each do |value|\n select_result(input, value)\n end\n [@result.first, @result.last]\n end",
"def grand_sorting_machine(array)\n\n\n\nend",
"def test_sorting\n # Make sure declarations with no length sort first.\n host_exact = Declaration.new(:allow, \"host.com\")\n host_range = Declaration.new(:allow, \"*.host.com\")\n\n ip_exact = Declaration.new(:allow, \"192.168.0.1\")\n ip_range = Declaration.new(:allow, \"192.168.0.*\")\n\n\n assert_equal(\n -1, host_exact <=> host_range,\n\n \"exact name match did not sort first\")\n\n\n assert_equal(\n -1, ip_exact <=> ip_range,\n\n \"exact ip match did not sort first\")\n\n # Next make sure we sort by length\n ip_long = Declaration.new(:allow, \"192.168.*\")\n assert_equal(-1, ip_range <=> ip_long, \"/16 sorted before /24 in ip\")\n\n # Now try it using masks\n ip24 = Declaration.new(:allow, \"192.168.0.0/24\")\n ip16 = Declaration.new(:allow, \"192.168.0.0/16\")\n\n assert_equal(-1, ip24 <=> ip16, \"/16 sorted before /24 in ip with masks\")\n\n # Make sure ip checks sort before host checks\n assert_equal(-1, ip_exact <=> host_exact, \"IP exact did not sort before host exact\")\n\n\n assert_equal(\n -1, ip_range <=> host_range,\n\n \"IP range did not sort before host range\")\n\n host_long = Declaration.new(:allow, \"*.domain.host.com\")\n\n assert_equal(-1, host_long <=> host_range, \"did not sort by domain length\")\n\n # Now make sure denies sort before allows, for equivalent\n # declarations.\n host_deny = Declaration.new(:deny, \"host.com\")\n assert_equal(-1, host_deny <=> host_exact, \"deny did not sort before allow when exact\")\n\n host_range_deny = Declaration.new(:deny, \"*.host.com\")\n assert_equal(-1, host_range_deny <=> host_range, \"deny did not sort before allow when ranged\")\n\n ip_allow = Declaration.new(:allow, \"192.168.0.0/16\")\n ip_deny = Declaration.new(:deny, \"192.168.0.0/16\")\n\n\n assert_equal(\n -1, ip_deny <=> ip_allow,\n\n \"deny did not sort before allow in ip range\")\n\n %w{host.com *.domain.com 192.168.0.1 192.168.0.1/24}.each do |decl|\n assert_equal(0, Declaration.new(:allow, decl) <=>\n Declaration.new(:allow, decl),\n \"Equivalent declarations for #{decl} were considered different\"\n )\n end\n end",
"def bozosort!(arr)\n while not arr.sort == arr\n a, b = rand(arr.length), rand(arr.length)\n arr[a], arr[b] = arr[b], arr[a]\n end\n return arr\nend",
"def cleanup\n # @@array.reject!(&:empty?)\n @@possible_codes.reject!(&:empty?)\n # @@possible_codes.sort! do |group1, group2|\n # group1_value = 0\n # group2_value = 0\n # @@array.each do |comp|\n # group1.each_with_index { |num, index| group1_value += 1 if comp[index] == num || comp.include?(num) }\n # group2.each_with_index { |num, index| group2_value += 1 if comp[index] == num || comp.include?(num) }\n # end\n # if group2_value < group1_value\n # group2 <=> group1\n # else\n # group1 <=> group2\n # end\n # end\n end",
"def test_multiple_string_number_2\r\n # x2-g8 < x2-y7 < x2-y08 < x8-y8\r\n assert_equal ['x02-g8', 'x2-y7', 'x02-y08', 'x8-y8'], ['x02-y08', 'x8-y8', 'x2-y7', 'x02-g8'].natural_sort, \"TODO Not implemented\"\r\n end",
"def rec_dict_sort unsorted, sorted\r\n\tif unsorted.length <= 0\r\n\t\treturn sorted\r\n\tend\r\n\t# if here then there is still work to do\r\n\r\n\tsmallest = unsorted.pop\r\n\tstill_unsorted = []\r\n\r\n\tunsorted.each do |tested_object|\r\n\t\tif tested_object.downcase < smallest.downcase\r\n\t\t\t# when tested_object < smallest\r\n\t\t\tstill_unsorted.push smallest\r\n\t\t\tsmallest = tested_object\r\n\t\telse\r\n\t\t\tstill_unsorted.push tested_object\r\n\t\tend\r\n\tend\r\n\t# now 'smallest' really does point to the smallest\r\n\t# element that 'unsorted' contained, and all the\r\n\t# rest of it is in 'still_unsorted'\r\n\tsorted.push smallest\r\n\r\n\trec_dict_sort still_unsorted, sorted\r\nend",
"def poorly_written_sort(*arrays)\n combined_array = []\n arrays.each do |array|\n array.each do |value|\n combined_array << value\n end\n end\n\n sorted_array = [combined_array.delete_at(combined_array.length-1)]\n\n for val in combined_array\n i = 0\n while i < sorted_array.length\n if val <= sorted_array[i]\n sorted_array.insert(i, val)\n break\n elsif i == sorted_array.length - 1\n sorted_array.insert(i, val)\n break\n end\n i+=1\n end\n end\n\n # Return the sorted array\n sorted_array\nend",
"def compara_arrays(array1, array2)\n if promedio(array1) > promedio(array2)\n promedio(array1)\n else \n promedio(array2)\n end\nend",
"def is_sorted_and_how(numbers)\n\tif numbers.sort == numbers\n\t\t\"yes, ascending\"\n\telsif numbers.sort.reverse == numbers\n\t\t\"yes, descending\"\n\telse\n\t\t\"no\"\n\tend\nend",
"def well_written_ruby(*arrays)\n combined_array = []\n arrays.each do |array|\n combined_array += array\n end\n\n return merg_sort(combined_array)\nend",
"def compare_tests(test_a, test_b); end",
"def compare_tests(test_a, test_b); end",
"def sort_list(x, y)\n [protease_name(x), protease_conc(y)]\n end",
"def process_sort_by(values)\n map_values(values) do |value|\n split_value(value, \" \").join(\" \")\n end \n end",
"def assert(expected, output)\n left = expected.to_s.gsub(/\\s+/, ' ').gsub(/>\\s+</, '><').strip\n right = output.to_s.gsub(/\\s+/, ' ').gsub(/>\\s+</, '><').strip\n nodiff = left.scan(/./).sort == right.scan(/./).sort\n unless ( nodiff )\n puts \"\\nERROR in comparaison\\n\"\n puts \"EXPECTED : #{left}\"\n puts \"RETURNED : #{right}\"\n end\n nodiff.should == true\n end",
"def my_array_sorting_method(source)\n puts source.map{|x| x.to_s}.sort \n\n #return source.sort_by{|x| x.to_s} => see comment A below regarding this line\nend",
"def test_3\n b = ArrayThing.new\n c = b.sortIt\n v = [\"1\",\"2\",\"3\",\"4\",\"5\"]\n assert_equal c, v\n end",
"def par_compare(a, b)\n if a.par_price.price > b.par_price.price\n -1\n elsif a.par_price.price < b.par_price.price\n 1\n else\n @formed.find_index(a) < @formed.find_index(b) ? -1 : 1\n end\n end",
"def sort2(arr, upper_bound)\n hash = {}\n result = []\n arr.each { |el| hash[el] = true }\n (1..upper_bound).each do |el|\n result << el if hash[el]\n end \n p result \nend",
"def merge_sort(&prc)\n end",
"def bubble_print_sort\n @bubble.print_sort\n end",
"def proefssorted\n \tproefs.order(:position)\n end",
"def cmp (left_element, right_element)\n #puts left_element\n #puts right_element\n if @order == \"ASC\"\n if left_element[@order_column] < right_element[@order_column]\n return true\n else\n return false\n end\n else\n if left_element[@order_column] > right_element[@order_column]\n return true\n else\n return false \n end \n end\n end",
"def sort \n n_hash = {}\n roster.each do |x, y| \n n_hash[x] = y.sort \n end \n n_hash\n end",
"def print_res(res)\n if (res.instance_of? Array) then \n str = \"\"\n res.sort.each {|elem| str += elem.to_s + \" \"}\n puts str.chomp\n else \n puts res\n end\nend",
"def print_res(res)\n if (res.instance_of? Array) then \n str = \"\"\n res.sort.each {|elem| str += elem.to_s + \" \"}\n puts str.chomp\n else \n puts res\n end\nend",
"def test_merge_sort\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3])\n assert_equal [card_2, card_1, card_3], deck.merge_sort\n end",
"def qsort(arr)\nend",
"def combine(a, b)\n\tsorted = []\n\twhile a.length != 0 && b.length != 0\n\t\ta[0] < b[0] ? (sorted << a.shift) : (sorted << b.shift)\n\tend\n a.length == 0 ? (sorted += b) : (sorted += a)\n\treturn sorted\nend",
"def sort\n @pokers.sort.reverse\n end",
"def cmp(x)\r\n x2 = []\r\n x.each {|y|\r\n if y !=nil\r\n x2 << y\r\n end\r\n }\r\n return x2\r\nend",
"def print_res(res)\r\n if (res.instance_of? Array) then \r\n str = \"\"\r\n res.sort.each {|elem| str += elem.to_s + \" \"}\r\n puts str.chomp\r\n else \r\n puts res\r\n end\r\nend",
"def sort_norm_data\n store.sort_norm_data!\n end",
"def oky_two_sum?(arr, target)\n sorted = arr.sort\n \nend",
"def iterate_through_array(input_array)\n\n # Initialization of variable used for the checking of the array sorting \n list_is_not_sorted = false\n\n # Duplication of the input array to not destroy the input array\n output_array = input_array\n\n # Loop through a range representing the array indexes\n (0..output_array.length - 2).each do |index|\n\n # Comparison of the two values next to each other and application if the sorting if true\n if (output_array[index] > output_array[index + 1])\n correction_value = output_array[index]\n output_array[index] = output_array[index + 1]\n output_array[index + 1] = correction_value\n\n # If at least one sorting action is processed then another sorting loop needs to be applied\n list_is_not_sorted = true\n end\n end\n\n # Returns a pair with the sorted array in first position and a boolean informing if the array \n # was alrady sorted in second position\n return [output_array, list_is_not_sorted]\nend",
"def comparisons\n comps = self.comparison_firsts\n self.comparison_seconds.each do |second|\n comps << second\n end\n comps\n end",
"def compare(move1, move2)\r\n\r\nend",
"def cmp_out(test)\n test.out_result = FileUtils.cmp(test.expected_out_path, \n test.result_out_path)\n end",
"def my_array_sorting_method(source)\n\treturn source.uniq.map{|element| element.to_s}.sort\nend",
"def bubble_sort(&prc)\n arr = self.dup\n sorted = false\n\n while !sorted\n sorted = true\n\n (0...self.length - 1).each do |idx1|\n num1, num2 = arr[idx1], arr[idx1 + 1]\n\n if prc.call(num1, num2) == 1\n arr[idx1], arr[idx1 + 1] = num2, num1\n sorted = false\n end\n end\n end\n \n arr\n end",
"def ordered_by_qualifications(candidates)\n myArray = candidates\n #first sort by github points\n myArray.sort! { |a, b| a[:github_points] <=> b[:github_points] }\n #sort by experience\n myArray.sort! { |a, b| a[:years_of_experience] <=> b[:years_of_experience] }\n\n return myArray\nend",
"def bar arr\n arr.sort!\nend",
"def sort_genes\n \t@genes.sort!{|x,y| x.start <=> y.start}\n end",
"def test_s31_Check_sort_buffer_use\n W('s31a');\n\n p1 = Metakit::IntProp.new(\"p1\");\n Metakit::Storage.open(\"s31a\", 1) {|s1|\n s1.set_structure(\"a[p1:I]\");\n v1 = s1.view(\"a\");\n v1.add(p1[3]);\n v1.add(p1[1]);\n v1.add(p1[2]);\n s1.commit();\n\n v2 = v1.sort_on(p1);\n assert_equal 3, v2.get_size\n assert_equal 1, p1.get(v2[0])\n assert_equal 2, p1.get(v2[1])\n assert_equal 3, p1.get(v2[2])\n }\n\n #D(s31a);\n R('s31a');\n end",
"def for\r\n aux = @head\r\n vec = []\r\n \r\n while (aux != nil)\r\n vec << aux.value\r\n aux = aux.next\r\n end\r\n\r\n for i in 1..vec.size-1\r\n for j in 0..vec.size-i-1\r\n if(vec[j] > vec[j+1])\r\n k=vec[j+1]\r\n vec[j+1]=vec[j]\r\n vec[j]=k\r\n end\r\n end\r\n end\r\n vec \r\n end",
"def for\r\n aux = @head\r\n vec = []\r\n \r\n while (aux != nil)\r\n vec << aux.value\r\n aux = aux.next\r\n end\r\n\r\n for i in 1..vec.size-1\r\n for j in 0..vec.size-i-1\r\n if(vec[j] > vec[j+1])\r\n k=vec[j+1]\r\n vec[j+1]=vec[j]\r\n vec[j]=k\r\n end\r\n end\r\n end\r\n vec \r\n end",
"def sort\n return @sort\n end",
"def sort_operations\n operations.sort! { |a, b| sort_list(b, a) <=> sort_list(a, b) }\n end",
"def determine_winner\n @active_players.sort! do |player1, player2|\n if player1.strongest_hand > player2.strongest_hand\n -1\n elsif player1.strongest_hand < player2.strongest_hand\n 1\n else\n 0\n end\n end\nend"
] |
[
"0.679415",
"0.67423755",
"0.66697353",
"0.6431097",
"0.6404233",
"0.6330936",
"0.62546384",
"0.6240586",
"0.621792",
"0.6169064",
"0.61684763",
"0.6167926",
"0.6160956",
"0.6160407",
"0.6155046",
"0.61501056",
"0.6135104",
"0.6116335",
"0.60716003",
"0.6070032",
"0.6058721",
"0.60575366",
"0.6055013",
"0.6042546",
"0.6029611",
"0.6029157",
"0.6019292",
"0.60165805",
"0.60140884",
"0.6006823",
"0.5997055",
"0.59892166",
"0.5959897",
"0.59486437",
"0.59439343",
"0.5936622",
"0.59347457",
"0.5930872",
"0.59095323",
"0.5902871",
"0.588135",
"0.58731645",
"0.58558065",
"0.5854766",
"0.5848611",
"0.58436984",
"0.58336234",
"0.58333784",
"0.58331424",
"0.581494",
"0.5811717",
"0.5809834",
"0.5806081",
"0.5802075",
"0.5798118",
"0.5796148",
"0.5789965",
"0.57869095",
"0.57828546",
"0.57795",
"0.57666945",
"0.5764943",
"0.576329",
"0.576329",
"0.57615155",
"0.5761135",
"0.575464",
"0.5748263",
"0.5737095",
"0.5734209",
"0.5732261",
"0.5731101",
"0.5730172",
"0.57292676",
"0.57258594",
"0.5722077",
"0.5718678",
"0.5718678",
"0.5717604",
"0.5717275",
"0.57130426",
"0.5709704",
"0.57094026",
"0.5705689",
"0.57009816",
"0.5699818",
"0.5698515",
"0.5697057",
"0.5693112",
"0.56907326",
"0.5686842",
"0.5681866",
"0.5681312",
"0.56812733",
"0.5681032",
"0.5680107",
"0.56792694",
"0.56792694",
"0.56774795",
"0.56774235",
"0.5676515"
] |
0.0
|
-1
|
Ask user for second integer
|
def get_integer
puts "Type another integer."
gets.chomp
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def second_value\n print \"type in the second number: \"\n gets.chomp.to_f\n end",
"def number_choice_one\n puts \"Now I need two numbers to use with that operator.\"\n puts \"Type your first number: \"\n gets.chomp.to_i\nend",
"def ask_for_number\n gets.chomp.to_i\n end",
"def fetch_number\n print \"Please choose a number: \"\n gets.to_i\nend",
"def num2\n\tputs \"Enter the second number:\"\n\t@number2 = gets.strip\n\t\tif @number2 == 'clear'\n\t\t\texit\n\t\telsif @number2 == \"0\"\n\t\t\t@number2.to_f\n\t\telse @number2 = @number2.to_f\n\t\t\tif @number2 == 0.0\n\t\t\t\tputs \"That is not a valid input, please try again.\"\n\t\t\t\twelcome\n\t\t\telse\n\t\t\tend\n\t\tend\n\tanswer\nend",
"def user_selection_integer\n print '> '\n selection = gets.chomp.to_i\n end",
"def q1_get_num\n puts \"Enter a number please: \"\n gets.to_i\nend",
"def user_input()\n return gets.chomp.to_i\n end",
"def user_answer_to_i\n gets.to_i - 1\n end",
"def initial_input\n # grabs the user's input and store it before passing it to the method\n input = gets.chomp\n index = input_to_index(input)\n\n if !index.between?(0,1)\n puts \"\\nPlease, select a number between 1 and 2\".colorize(:light_red)\n self.initial_input\n elsif index == 1\n goodbye\n exit\n end\n index\n end",
"def enter_value()\n value = gets\n if int?(value.to_i)\n return value\n end #end of if\n end",
"def get_answer\n print 'Enter your answer:'\n user_input = gets.chomp.to_i\nend",
"def get_input\n\t\tputs \"Press 1 to raise by 100\"\n\t\tputs \"Press 2 to call\"\n\t\tputs \"Press 3 to fold\"\n\t\tinput = gets().chomp().to_i\n\t\treturn input\n\n\tend",
"def get_input_i\n\tgets.chomp.to_i\nend",
"def user_num\n loop do\n prompt(MESSAGES['number_request'])\n num1 = Kernel.gets().chomp()\n num2 = Kernel.gets().chomp()\n if number?(num1) && number?(num2)\n return num1, num2\n else\n prompt(MESSAGES['invalid_numbers'])\n end\n end\nend",
"def fetch_number\n print \"What is your number? \" # Will print this text and allow you to type in next to it\n gets.to_i # Will ask for a user input and then turn it into an integer (will also return)\nend",
"def choose_number\n\t\tputs \"Choose a number between 1-10\"\n\t\t$input = gets.chomp.to_i\n\t\tif $input > 10 || $input < 1\n\t\t\tputs \"Invalid number. Please use a number between 1-10\"\n\t\t\tchoose_number\n\t\tend\n\tend",
"def get_number\nprint \"What number do you want to check? \"\n@number = gets.to_i\nend",
"def ask(question) \n print question + \" \"\n gets.chomp.to_i #returns the integer that was inputed from the keyboard\nend",
"def how_many_players\n puts \"How many human players are there?\"\n num = gets.chomp.to_i\n until num.between?(1, 2)\n puts \"Please choose a number between 1-2\"\n num = gets.chomp.to_i\n end\n num\n end",
"def last_number\n puts \"enter your last number:\"\n @num2 = gets.to_f\n puts \"Your last number is #{@num2}\"\nend",
"def chosen_digit\n gets.chomp.to_i\nend",
"def divide(num_one, num_two)\n if num_two == 0\n until num_two != 0\n puts \"You can't divide by zero. Enter the second number again: \"\n num_two = gets.chomp.to_i\n end\n end\n return num_one / num_two\nend",
"def fav_num\n\tputs \"Enter your favorite number\"\n\tfav_num = gets.chomp.to_i\n\tunless fav_num.is_a? Integer\n\t\tputs \"Pls enter Integer\"\n\t\tfav_num = gets.chomp.to_i\n\tend\n\tbigger_num = fav_num + 1\n\n\tputs \"my number is better #{bigger_num} than your #{fav_num}\"\nend",
"def get_int_input(message)\n print message\n x = gets.strip\n if x.number?\n x.to_i\n else\n return get_int_input(message)\n end\n end",
"def two_inputs\n puts \"Enter the first number\"\n first = gets.chomp.to_f\n puts \"Enter the second number\"\n second = gets.chomp.to_f\n return first, second\nend",
"def chosen_digit\n return gets.chomp.to_i\nend",
"def choice\nputs \"how many number of questions?\"\nuser_choice = gets.chomp.to_i\nend",
"def get_input\n print \"> \"\n number_option = $stdin.gets.chomp.to_i\n consequence number_option\n end",
"def bigger_better_favorite_number\n\n puts 'Please type your favorite number.'\n favorite_number = gets.chomp.to_i\n\n bigger_better_number = favorite_number + 1\n\n puts \"Here's a bigger and better favorite number: #{bigger_better_number}!\"\nend",
"def two_numbers\n puts \"Enter the first number.\"\n first_number = gets.chomp.to_f\n puts \"Enter the second number.\"\n second_number = gets.chomp.to_f\n return first_number, second_number\nend",
"def fetch_number(prompt)\n\tprint prompt\n\tgets.to_f #allow decimal input\nend",
"def ask_user\n puts 'enter a number:'\n input = gets.chomp.to_i\n check_num(input)\n end",
"def get_input\n gets.chomp.to_i\nend",
"def lanzamiento2(jug2)\r\n\tprint \"Turno #{jug2.capitalize}, seleccione casilla (0-6)\"\r\n\t@lanz2 = gets.to_i\r\n\r\nend",
"def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend",
"def get_number(identifier)\n print \"==> Enter the #{identifier} number: \"\n gets.chomp.to_i\nend",
"def request_difficult\n until [1, 2].include?(difficult)\n show_difficults\n @difficult = $stdin.gets.to_i\n end\n end",
"def ask(question)\n\tputs question\n\tgets.chomp.to_i\nend",
"def ask(question)\n print question + \" \"\n gets.to_i\nend",
"def ask_player2\n puts \" Pas de jaloux ici ! Joueur 2, a toi de décliner ton identité \"\n print \" JOUEUR 2 : \"\n player2 = gets.chomp.to_s\n \n puts \" Ton symbole sera le O\"\n puts \" \"\n puts \" \"\n puts \" Puisque vous avez été discipliné, la partie peut commencer !\"\n puts \" Appuie sur entrée pour lancer le jeu\"\n gets.chomp\n return player2\n end",
"def int_input(s = \"\\nPlease select an option:\".yellow.bold, limits = [1, 100])\n puts s\n user_input = gets.chomp\n #if user types 'exit', exit the application\n if user_input.downcase == \"exit\"\n exit()\n end\n\n #if user input is within allowed range, return it, otherwise, ask for it again\n if user_input.to_i >= limits[0] and user_input.to_i <= limits[1]\n return user_input.to_i\n else\n puts(\"Invalid input, please enter an integer value coresponding to an option, or type 'exit' to exit application:\".red.bold)\n sleep(1)\n return int_input(s, limits)\n end\n end",
"def prompt_id_request()\n print \"Please enter a champion ID: \"\n id_request = gets.to_i\n while id_request <= 0\n puts \"Invalid ID. Please enter a champion ID: \"\n id_request = gets.to_i\n end\n return id_request\nend",
"def number2(second_guess)\n\tsecond_guess = gets.chomp\n\n\tif second_guess == secret_number\n\t\tputs \"Yes, #{second_guess} is correct. You win Secret Number!\"\n\telse\n\t\tputs \"#{second_guess} is not correct either. You have one more guess.\"\n\t\tlast_guess = number3(last_guess)\n\tend\n\nend",
"def prompt_user\n puts \"Please choose a number between 1 and 6\"\nend",
"def receive_int(question, min, max)\n answer = receive_answer(question)\n while answer != answer.to_i.to_s or\n (answer == answer.to_i.to_s and (answer.to_i < min or answer.to_i > max))\n puts \"Please enter an integer between #{min} and #{max}.\"\n answer = receive_answer(question)\n end\n return answer.to_i\nend",
"def again_or_exit?(crate)\n puts \"\\n\\nWhat would you like to do now?\\n1. View another genre.\\n2. Exit\"\n input = gets.strip\n input_i = input.to_i\n acceptable_answers = (1..2).to_a\n while acceptable_answers.none? { |answer| answer == input_i }\n puts \"\\nI'm sorry, that's not a valid option.\"\n puts \"Please enter 1 or 2.\"\n input_i = gets.strip.to_i\n end \n\n if input_i == 1\n self.start(crate)\n else\n puts \"Have a good one!\"\n end\n end",
"def user_prompt(ordinal_number)\n puts \"=> Enter the #{ordinal_number} number:\"\nend",
"def even_odd\n puts \"Enter a number\"\n num=gets.to_i\n if(num %2==0)\n puts \"Number is even\"\n else\n puts \"Number is odd\"\n end\n end",
"def input_to_index(user_input)\n # user_input = gets.strip\n converted_input = user_input.to_i\n converted_input - 1 \nend",
"def prompt\n unless @type == 2\n puts \"What is #{@num_1} #{@operator} #{@num_2}?\"\n else\n puts \"What is #{@num_1 * (@num_2 + 1)} divided by #{@num_2 + 1}?\"\n end\n end",
"def input_bet_value\n self.print_msg(\"make_bet\")\n bet_value = gets.chomp.to_i\n return bet_value\n end",
"def establish_v\n puts \"How many games of Rock Paper Scissors would you like to play?\"\n v = (gets.to_i/2) + 1\n puts \"Okay! You will have to win \" + v.to_s + \" games to be the CHAMPION!\"\n puts\n return v\n end",
"def ask_for_show_number\n puts \"Enter Show no:\"\n @show_no = receive_input.to_i\n end",
"def get_numbers(first_numb, second_numb)\n\nprint \"Enter first number \"\nfirst_numb[0] = gets.chomp!\nfirst_numb[0] = first_numb[0].to_i\n\nprint \"Enter second number \"\nsecond_numb[0] = gets.chomp!\nsecond_numb[0] = second_numb[0].to_i\n\nend",
"def select_number\n number = 0\n loop do\n number = gets.to_i\n cond = true\n if number > 9 || number < 1\n puts 'Write a correct number'\n cond = false\n end\n break if cond\n end\n number\nend",
"def geti\n gets.to_i\nend",
"def get_answer\n @user_answer = gets.chomp.to_i\n end",
"def always_three\n # ask the user for a number\n puts \"Give me a number\"\n\n # get the user's number with gets & use to_i to convert to an integer\n # set to a variable\n first_number = gets.to_i\n\n # math and puts on one line!\n puts 'Always ' + (((first_number + 5) * 2 - 4) / 2 - first_number).to_s\nend",
"def get_number()\n print \"what number would you like to test? \\n\"\n return gets.chomp.to_i\nend",
"def player_input\n correct_input = false\n puts \"Please select a column number 1 - 8:\"\n user_selected = gets.to_i\n while correct_input === false\n if user_selected < 1 || user_selected > 8\n puts \"You selected #{user_selected}. Please select a column number 1 - 8:\"\n user_selected = gets.to_i\n else\n return user_selected - 1\n end\n end\nend",
"def query_integer(message_string)\n print message_string\n\n is_legal_input = false\n until is_legal_input do\n # Get an integer from the user, or return nil if a value is given\n # that is not clearly convertible to an integer.\n int_input = Integer(gets.chomp) rescue nil\n\n if int_input == nil\n print 'Sorry, an integer is required. Try again: '\n else\n is_legal_input = true end\n end #of until loop\n return int_input\nend",
"def user_choice (text)\n\tputs text\n\tresponse = gets.strip.to_i\n\treturn response\nend",
"def prompt_for_number(which)\n puts \"==> Enter the #{which} number\"\nend",
"def get_number\n # gets user input and validates its numericality, user is prompted for input \n # => until a valid number is entered\n num = gets.chop.to_i\n if num == 0\n puts \"Not a number! Please try again\"\n get_number\n else\n return num\n end\n end",
"def ask\n question = 'Enter a number between 0 to 100'\n puts question\n number = gets.to_i\n between(number)\nend",
"def num_check(num)\n until num.to_i.to_s == num\n puts \"Invalid entry. Please entere an integer.\"\n num = gets.chomp.to_i\n end\n return num.to_i\nend",
"def int_input(prompt, err_msg = \"Please enter a number.\", repeat = true)\n str = \"\"\n until str[/^-?\\d+$/]\n str = input prompt\n puts err_msg unless str[/^-?\\d+$/] || err_msg.nil?\n return unless repeat\n end\n str.to_i\n end",
"def advanced_calculator_type\n print \"What would you like to do? Type 1 to find exponents or 2 to find the square root of a number: \"\n selection = gets.to_i\n # puts \"You chose #{selection}\"\n if selection == 1\n \"exponents\"\n elsif selection == 2\n \"square root\"\n else\n \"error\"\n end\nend",
"def first_or_second\n turn_answer = ''\n loop do\n prompt 'Would you like to go first or second?'\n sleep 1.5\n prompt 'Press [1] to go first and [2] to go second.'\n turn_answer = gets.chomp\n break if turn_answer.downcase.start_with?('1', '2')\n prompt 'That is not a valid answer'\n end\n \n if turn_answer == '1'\n 'Player'\n elsif turn_anser == '2'\n 'Computer'\n end\nend",
"def prompt\n print \"Which column do you wish to enter a disc in (0-6): \"\n return gets.chomp.to_i\n end",
"def get_number(items_type, max)\n loop do\n print \"\\nHow many #{items_type} would you like to have? \"\n num_of_items = gets.chomp.to_i\n # max is 'nil' if there is no max\n return num_of_items if num_of_items >= 1 && (max.nil? || num_of_items <= max)\n num_of_items < 1 ? (puts \"Please enter a number greater than 0.\") :\n (puts \"Please enter a number less than or equal to #{max}.\")\n end\nend",
"def user_number\n puts 'enter your number'\n numb1 = gets.chomp!.to_i\n if numb1 <= 50\n puts 'your number is equal to or less than 50'\n elsif numb1 == 51\n puts 'you number must be 51'\n elsif numb1 <= 100\n puts 'you number is equal to or less than 100'\n else\n 'puts you got a high number'\n end\n end",
"def first_guess\n\tputs \"\\nSo, what do you think the number is?\"\n\tgets\nend",
"def Residuo\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n puts \"\\nResiduo: #{numero1 % numero2}\"\n end",
"def gets_int(message)\n\tputs message\n\tgets.chomp!.to_i\nend",
"def menu\n puts \"______Calculator_______\"\n puts \"\\t1) Enter first number\"\n puts \"\\t2) Enter modifier\"\n puts \"\\t3) Enter second number\"\n puts \"\\t4) The result is:\"\n return gets.strip.to_i\nend",
"def lanzamiento1(jug1)\r\n\tprint \"Turno #{jug1.capitalize}, seleccione casilla (0-6)\"\r\n\t@lanz1 = gets.to_i\r\n\r\nend",
"def prompt_i(lower, upper)\n loop do\n print \"[Enter an integer in the range #{lower}-#{upper}]\"\n print \"> \"\n input_str = @input.gets\n if input_str.nil?\n raise \"No input left (must be automated input)\"\n end\n input_str = input_str.chomp\n input_int = input_str.to_i\n if input_int.between?(lower, upper)\n return input_int\n else\n print \"[Invalid integer range]\"\n end\n end\n end",
"def execute_44\n STDERR << \"\\nInput Number: \\n\"\n set_value( (STDIN.gets||'').chomp.to_i )\n advance_token()\n end",
"def read_guess\n print \"Pretty please enter your guess: \"\n gets.to_i\nend",
"def get_user_input\n\t\tinput_right = false\n\t\tno_of_primes = 0\n\t\tloop do\n\t\t\tprint \"Enter the number of primes you want: \"\n\t\t\tno_of_primes = gets.chomp.to_i\n\t\t\tinput_right = (no_of_primes.to_i > 0) ? true : false\n\t\t\tif no_of_primes <= 0\n\t\t\t\tprint \"\\n Please enter a number( > 0 ) \\n\"\n\t\t\t\tself.no_of_primes = 0\n\t\t\tend\n\t\t\tbreak if input_right\n\t\tend\n self.no_of_primes = no_of_primes\n\tend",
"def get_number(value_name)\r\n puts \"please input a value for #{value_name} (numbers)\"\r\n while true\r\n answer=gets.chomp\r\n break if is_number?(answer)\r\n puts \"please input only numbers for this value\"\r\n end\r\n answer.to_i\r\n end",
"def nested\n print \"Enter in a positive odd number\"\n z = gets.chomp.to_i\n if z % 2 == 1\n puts \"That is a odd number, thank you.\"\n if z % 2 == 0\n puts \"That number won't work, it's even!\"\n else\n puts \"Cool\"\n end\n else\n puts \"It needs to be a odd number.\"\n end\nend",
"def ask_for_guess(min, max)\n puts \"Guess a number #{min} to #{max}?\"\n\n guess = gets.to_i\n while guess < min or guess > max\n puts \"Your number must be greater than #{min} and less than #{max}. Guess again.\"\n guess = gets.to_i\n end\n \n guess\nend",
"def get_requested_amount(type)\n request = prompt_user(\"How much would you like to #{type}?\").to_i\n while request <= 0\n request = prompt_user(\"Please enter an amount greater than $0.\").to_i\n end\n request.to_i\nend",
"def decide\n input = '0'\n puts \"What would you like to do? 1) hit 2) stay\"\n loop do\n input = gets.chomp\n if !['1', '2'].include?(input)\n puts \"Error: you must enter 1 or 2\"\n else\n break\n end\n end\n puts \"Hit me!\" if input == '1'\n puts \"Stay!\" if input == '2'\n input \n end",
"def always\n print \"Give me a number: \"\n number = gets.chomp.to_i\n puts ((number+5)*2-4)/2\nend",
"def always_three\n # ask the user for a number\n puts \"Give me a number\"\n # get the user's number with gets & use to_i to convert to an integer\n # set to a variable\n first_number = gets.to_i\n # math and puts on one line!\n puts 'Always ' + (((first_number + 5) * 2 - 4) / 2 - first_number).to_s\n end",
"def confirm_a_number (any_number)\n while any_number.to_i.to_s != any_number\n print \"Please enter an integer: \"\n any_number = gets.chomp\n end\n return any_number.to_i\nend",
"def get_user_input\n loop do\n puts @current_player ? \"Player 1's turn\" : \"Player 2's turn\"\n\n input = CLI.ask \"Please enter a valid column from 1 to 7:\"\n case input\n when /^[1-7]$/\n return input.to_i\n else\n puts \"INVALID INPUT!\"\n puts\n next\n end\n end\n end",
"def getUserNumber\n begin\n return Float(gets.chomp)\n rescue\n puts \"Please enter the number as an integer.\"\n retry\n end\nend",
"def getDuration()\n puts \"Enter duration (in seconds)\"\n return gets.to_i\nend",
"def read_in_option\n puts \"Enter an option:\"\n puts \"1:(Roll)\"\n puts '2:(Use \"Get Out of Jail Free\" card)'\n puts \"3:(Pay 50$ to leave)\"\n opt = gets\n \n case opt.to_i\n when 1..3 then opt.to_i\n else 1\n end\n end",
"def get_user_input_for_test\n\t\tno_of_primes = 0\n\t\tprint \"\\n \\t Enter value for the number of primes you want: \"\n\t\tno_of_primes = gets.chomp.to_i\n\t\tif no_of_primes <= 0\n\t\t\tprint \"Please enter a number( > 0 ): \"\n\t\t\tself.no_of_primes = 0\n\t\t\treturn\n\t\tend\n\t\tself.no_of_primes = no_of_primes\n\tend",
"def user_input(p)\n loop do\n prompt p\n var = gets.chomp\n if number?(var)\n return var\n else\n prompt 'Invalid choice. Please try again.'\n end\n end\nend",
"def get_target_number\n print \"\\n\\nEnter a positive integer or -ve number to exit: \"\n input_value=gets\n is_num?(input_value)? input_value.to_i : nil\nend",
"def get_user_integer\n valid_input = false\n input = 0\n until valid_input do\n user_input = gets.chomp.to_i\n if user_input > 0 && user_input.kind_of?(Integer)\n valid_input = true\n input += user_input\n clear\n break\n else\n puts \"Incorrect input, please enter an integer greater than 0\"\n end\n end\n return input\nend",
"def number(N)\r\n N =gets.strip.to_i\r\n if\r\n ( N%2==1 || N>5 && N <= 20)\r\n puts \"Weird\"\r\n else\r\n puts \"Not Weird\"\r\n end\r\nend",
"def user_prompt(*args)\n print(*args)\n to_return = gets.strip.split\n to_return.collect {|value| Integer(value)}\nend"
] |
[
"0.7979498",
"0.712082",
"0.702661",
"0.68912244",
"0.6888151",
"0.68196124",
"0.6731593",
"0.6641218",
"0.6618343",
"0.65130925",
"0.6512656",
"0.6483483",
"0.64365077",
"0.6422527",
"0.6417073",
"0.6410352",
"0.64049006",
"0.6396377",
"0.6394682",
"0.6388099",
"0.6385723",
"0.6377032",
"0.6349465",
"0.63457066",
"0.63283545",
"0.63253427",
"0.63129365",
"0.6312861",
"0.6295402",
"0.6290523",
"0.62898743",
"0.6271698",
"0.62569594",
"0.6235848",
"0.62306243",
"0.6230578",
"0.6212114",
"0.6199404",
"0.61758024",
"0.61739147",
"0.6156622",
"0.61400896",
"0.61268353",
"0.61250144",
"0.61179435",
"0.610673",
"0.60904944",
"0.6080886",
"0.60740423",
"0.6066098",
"0.6055307",
"0.60301286",
"0.6029578",
"0.60194045",
"0.60157907",
"0.60098183",
"0.60062104",
"0.6003902",
"0.5995783",
"0.5986464",
"0.5978139",
"0.5973214",
"0.5969047",
"0.59683347",
"0.5964665",
"0.59609854",
"0.5950517",
"0.5937804",
"0.5927952",
"0.5923662",
"0.5921324",
"0.5920127",
"0.5910668",
"0.59104806",
"0.5906737",
"0.5906496",
"0.590463",
"0.58997947",
"0.589859",
"0.5890964",
"0.5889442",
"0.58891356",
"0.5887707",
"0.58825445",
"0.5875487",
"0.5869999",
"0.5866911",
"0.5855977",
"0.5854112",
"0.5851749",
"0.5841946",
"0.5832507",
"0.5828352",
"0.58275294",
"0.58222216",
"0.58219934",
"0.581851",
"0.58173394",
"0.58100003",
"0.58098435"
] |
0.6597788
|
9
|
returns :left or :right; if the edge that this path starts from is treated as the bottom, which way does the path curve?
|
def compute_direction(this_exit, other_exit, curvilinear_type)
if curvilinear_type == STRAIGHT
# no curve but we still need a direction, and we need to ensure both
# "half paths" have different directions
return this_exit < other_exit ? :left : :right
end
return :none if !other_exit || !this_exit
if (this_exit + curvilinear_type) % 6 == other_exit
:left
elsif (other_exit + curvilinear_type) % 6 == this_exit
:right
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bottomright; return self.right, self.bottom; end",
"def bottomleft; return self[0], self.bottom; end",
"def left_edge?\n x == 0\n end",
"def test_top_edge_enumerated_left_to_right\n assert_equal [0, 1, 0, 1, 0], @p.edge(:top)\n end",
"def find_bottom_path(cell)\n find_path(cell) { | cell | bottom_cell(cell) }\n end",
"def edge\n :first if first?\n :last if last?\n nil\n end",
"def right_edge?(row,col)\n\t\tpixels[row][col-1] == nil\n\tend",
"def right_of?(w)\n\t\t(w.left < self.left) &&\n\t\t(w.top <= self.bottom) &&\n\t\t(self.top <= w.bottom)\n\tend",
"def h?\n @side == :right || @side == :left\n end",
"def road_end?(direction, x, y)\n case direction\n when :horizontal\n x == @size - 1\n when :vertical\n y == @size - 1\n else\n x == @size - 1 || y == @size - 1\n end\n end",
"def bottom_left\n Point[x, y + height]\n end",
"def leaf?\n right - left == 1\n end",
"def bfd_method\n\t\tcurrent_level = @tree.tree.level\n\t\twinners = child_filter(@tree.tree.children, 0)\n\t\tif winners.empty?\n\t\t\thead = @tree.tree.coord\n\t\t\tp_x, p_y = head.x, head.y\n\t\t\tavail_dir = ['left','right','up','down']\n\t\t\tavail_dir.each do |dir| \n\t\t\t\tcase dir\n\t\t\t\t\twhen \"up\"; x = p_x; y = p_y - 1\n\t\t\t\t\twhen \"down\"; x = p_x; y = p_y + 1\n\t\t\t\t\twhen \"left\"; x = p_x - 1; y = p_y\n\t\t\t\t\twhen \"right\"; x = p_x + 1; y = p_y\n\t\t\t\tend\t\n\t\t\t\tif @tree.grid.traversable?(x,y) \n\t\t\t\t\treturn dir\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn \"left\"\n\t\telse\n\t\t\twinner_sum = winners.first.sum\n\t\t\ttied_winners = winners.select{|w| w.sum ==winner_sum}.collect{|w| bottoms_up_dir(w)}\n\t\t\ttied_winners.min_by(&:sum).dir\n\t\tend\n\tend",
"def passed_right_edge?(nxt_spc)\n\t\tnxt_spc% @board_width==0\n\tend",
"def oposit(direction)\n if direction == \"top\"\n return \"bottom\"\n elsif direction == \"bottom\"\n return \"top\"\n elsif direction == \"right\"\n return \"left\"\n elsif direction == \"left\"\n return \"right\"\n end\n return nil\n end",
"def is_not_bottom?\n if (@operator && @operator.is_negation?)\n @right_sentence.is_not_bottom?\n else\n return (is_bottom? && @father && @father.operator && @father.operator.is_negation?)\n end\n end",
"def bottom_right\n @position + @dimensions\n end",
"def at_bottom?\n lower_siblings.empty?\n end",
"def midright; return self.right, self.centery; end",
"def bottom_right\n @bottom_right ||= Quadtree::Point.new(\n provinces.map { |province| province.bottom_right.x }.max,\n provinces.map { |province| province.bottom_right.y }.min\n )\n end",
"def upper_edge?(row,col)\n\t\tpixels[row-1][col] == nil\n\tend",
"def bottom_aligned?\n value == :bottom\n end",
"def notTopEdge?\n @y.positive? ? self : nil\n end",
"def path?(p)\n p.each_cons(2){|x|\n unless edge?(x[0],x[1])\n return false\n end\n }\n return true\n end",
"def direction\n @direction ||= (@head - @root)\n end",
"def topright; return self.right, self[1]; end",
"def dir(v)\n if @x == v.x\n return 8 if v.y > @y # down\n return 2 # up\n elsif @y == v.y\n return 6 if v.x > @x # right\n return 4 # left\n end\n end",
"def direction(current_node, destination_node)\r\n direction = [ destination_node.y - current_node.y, # down/up\r\n destination_node.x - current_node.x ] # negative: left, positive: right\r\n\r\n return 2 if direction[0] > 0 and direction[1] == 0 # south\r\n return 4 if direction[1] < 0 and direction[0] == 0 # west\r\n return 8 if direction[0] < 0 and direction[1] == 0 # north\r\n return 6 if direction[1] > 0 and direction[0] == 0 # east\r\n\r\n return 0 # default\r\n end",
"def traverse room, direction\n case direction.to_sym\n when :right\n return @graph[room.coords[:y]][room.coords[:x] + 1] unless room.is_right?\n when :left\n return @graph[room.coords[:y]][room.coords[:x] - 1] unless room.is_left?\n when :up\n return @graph[room.coords[:y] - 1][room.coords[:x]] unless room.is_top?\n when :down\n return @graph[room.coords[:y] + 1][room.coords[:x]] unless room.is_bottom?\n end\n\n return false\n end",
"def direction(current_node, destination_node)\n direction = [ destination_node.y - current_node.y, # down/up\n destination_node.x - current_node.x ] # negative: left, positive: right\n\n return 2 if direction[0] > 0 and direction[1] == 0 # south\n return 4 if direction[1] < 0 and direction[0] == 0 # west\n return 8 if direction[0] < 0 and direction[1] == 0 # north\n return 6 if direction[1] > 0 and direction[0] == 0 # east\n\n return 0 # default\n end",
"def get_edge_corner_dis\n top_left = [self.x - self.ox, self.y - self.oy]\n bot_right = [top_left[0] + self.width, top_left[1] + self.height]\n return [top_left, bot_right]\n end",
"def left_edge?(row,col)\n\t\tpixels[row][col+1] == nil\n\tend",
"def oblique?\n !right?\n end",
"def is_pathway?(x, y)\n @maze[x][y] == '_' or is_exit?(Cell.new(x, y, []))\n end",
"def tangents(right)\n left = self\n\n max_count = left.count + right.count\n\n # Walk clockwise around left, counterclockwise around right, until the\n # next point on both sides is left of X->Y, showing that X->Y is the\n # lowest segment.\n x = left.rightmost\n y = right.leftmost\n z = y.first\n z1 = x.first\n z2 = z1 && x.clockwise(z1)\n lower = nil\n max_count.times do\n if z && z.right_of?(x, y)\n old_z = z\n z = z.counterclockwise(y)\n y = old_z\n elsif z2 && z2.right_of?(x, y)\n old_z2 = z2\n z2 = z2.clockwise(x)\n x = old_z2\n else\n lower = [x, y]\n break\n end\n end\n\n # Walk counterclockwise around left, clockwise around right, until the\n # next point on both sides is to the right of X->Y, showing that X->Y is\n # the highest segment.\n x = left.rightmost\n y = right.leftmost\n z = y.first\n z_r = z && y.clockwise(z)\n z_l = x.first\n upper = nil\n max_count.times do\n if z_r && z_r.left_of?(x, y)\n old_z = z_r\n z_r = z_r.clockwise(y)\n y = old_z\n elsif z_l && z_l.left_of?(x, y)\n old_z = z_l\n z_l = z_l.counterclockwise(x)\n x = old_z\n else\n upper = [x, y]\n break\n end\n end\n\n return lower, upper\n end",
"def right_edge\n x = width-1\n @image.get(x,0,x,height).pixels\n end",
"def right_to_left\n @buckets[0] = @buckets[0] + @buckets[1]\n @buckets[1] = if @buckets[0] > @first\n @buckets[0] - @first\n else\n @buckets[1] = 0\n end\n @buckets[0] = @first if @buckets[0] > @first\n @path.push([@buckets[0], @buckets[1]])\n end",
"def passed_left_edge?(nxt_spc)\n\t\tnxt_spc% @board_width == (@board_width-1)\n\tend",
"def bottom_right\n row, col = @position\n return [row + 1, col + 1] unless row + 1 > 7 || col + 1 > 7\n []\n end",
"def recurse_top_left_to_bottom_right(x1, y1, x2, y2)\n top_left_to_bottom_right x1, y1, x2, y2\n recurse_bottom_right_to_top_left x1, y1 + 1, x2 - 1, y2 if x2 - x1 > 0\n end",
"def bottom_left\n row, col = @position\n return [row + 1, col - 1] unless row + 1 > 7 || col - 1 < 0\n []\n end",
"def number_of_paths_to_end_from_point(start_point)\n \n tabs = \"\\t\" * ([start_point.x, start_point.y].max)\n puts \"#{tabs} (#{start_point.x}, #{start_point.y})\"\n \n # only 1 path to end from the edges\n return 1 if (start_point.y == 2 || start_point.x == 2)\n \n # last point\n return 0 if (start_point.x == 2 && start_point.y == 2)\n \n # otherwise, it's the sum of the paths that can be taken when adding the ones from right and the ones from below\n right_point = Point.new(start_point.x + 1, start_point.y)\n down_point = Point.new(start_point.x, start_point.y + 1)\n \n right = number_of_paths_to_end_from_point(right_point)\n down = number_of_paths_to_end_from_point(down_point)\n \n # puts \"From: (#{start_point.x}, #{start_point.y}) -> #{right + down} \"\n \n return right + down\nend",
"def height\n @bottom_edge - @top_edge\n end",
"def v?\n @side == :top || @side == :bottom\n end",
"def midbottom; return self.centerx, self.bottom; end",
"def has_path_to?(end_node)\n @visited.include?(end_node)\n end",
"def path?(point, direction)\n @paths[point] & direction != 0\n end",
"def edge_for(left, right)\n edges.detect { |edge| edge.left.equal?(left) && edge.right.equal?(right) }\n end",
"def right()\n return @left + @width\n end",
"def chech_first_corner_edge()\n\t\tposition = 4\n\t\treturn position\n\tend",
"def chech_first_corner_edge()\n\t\tposition = 4\n\t\treturn position\n\tend",
"def get_path(s, e, maze)\n if maze[s[0]][s[1]] == 1 || # found a wall or visited area\n s[0] < 0 || s[1] < 0 || # top or left edge\n s[0] >= maze.length || s[1] >= maze[0].length # bottom or right edge\n\n path = nil\n\n elsif s[0] == e[0] && s[1] == e[1] # exit spot\n\n path = [s]\n\n else\n\n maze[s[0]][s[1]] = 1 # visit current node\n path =\n get_path([s[0] - 1, s[1]], e, maze) ||\n get_path([s[0], s[1] + 1], e, maze) ||\n get_path([s[0], s[1] - 1], e, maze) ||\n get_path([s[0] + 1, s[1]], e, maze)\n\n path << s unless path.nil?\n\n end\n \n return path\nend",
"def leads_up?(point, empty_test, height)\n inner = ->(pt, dir) { #inner searches either left or right\n if !empty_test.(pt)\n then false\n elsif point[1] == 0 #if it hits the top of the board\n then true\n elsif height == 0 #if it has risen enough\n then true\n elsif empty_test.(plus(pt, Up)) \n then leads_up?(plus(pt, Up), empty_test, height-1) #move up a level\n else\n inner.(plus(pt, dir), dir) #move sideways and keep looking\n end\n }\n inner.(point, Left) || inner.(point, Right)\n end",
"def find_end_of_node_path(i)\n left_index = left_child_index(i)\n right_index = right_child_index(i)\n \n if left_index > @heap_size && right_index > @heap_size\n i\n elsif right_index > @heap_size\n left_index\n else\n max_child_index = -1\n left_child_value = self[left_index - 1]\n right_child_value = self[right_index - 1]\n if right_child_value && left_child_value > right_child_value\n max_child_index = left_index\n else\n max_child_index = right_index\n end\n find_end_of_node_path max_child_index\n end\n end",
"def recurse_bottom_right_to_top_left(x1, y1, x2, y2)\n bottom_right_to_top_left x1, y1, x2, y2\n recurse_top_left_to_bottom_right x1 + 1, y1, x2, y2 - 1 if x2 - x1 > 0\n end",
"def is_right?\n s = self.sides\n\n s[0].perpendicular_to?(s[1]) ||\n s[1].perpendicular_to?(s[2]) ||\n s[0].perpendicular_to?(s[2])\n end",
"def right\n return @right\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def next_path map, h, w\n\n\tlow = map[h][w].to_i\n\tlh = h\n\tlw = w\n\n\tif h - 1 >= 0\n\t\tnh = h - 1\n\t\tnw = w\n\t\tnorth = map[nh][nw].to_i\n\t\tif north < low\n\t\t\tlow = north\n\t\t\tlh = nh\n\t\t\tlw = nw\n\t\tend\n\tend\n\n\tif w - 1 >= 0\n\t\twh = h\n\t\tww = w - 1\n\t\twest = map[wh][ww].to_i\n\t\tif west < low\n\t\t\tlow = west\n\t\t\tlh = wh\n\t\t\tlw = ww\n\t\tend\n\tend\n\t\n\tif w + 1 < map[0].size\n\t\teh = h\n\t\tew = w + 1\n\t\teast = map[eh][ew].to_i\n\t\tif east < low\n\t\t\tlow = east\n\t\t\tlh = eh\n\t\t\tlw = ew\n\t\tend\n\tend\n\n\tif h + 1 < map.size\n\t\tsh = h + 1\n\t\tsw = w\n\t\tsouth = map[sh][sw].to_i\n\t\tif south < low\n\t\t\tlow = south\n\t\t\tlh = sh\n\t\t\tlw = sw\n\t\tend\n\tend\n\n\treturn lh, lw\nend",
"def lower_edge?(row,col)\n\t\tpixels[row+1][col] == nil\n\tend",
"def balanced?\n (height(@root.left) - height(root.right)).between?(-1, 1)\n end",
"def south?(y)\n return ((y_position - y) < 0)\n end",
"def path_below_self?(old_path, new_path)\n return (new_path.index(old_path) != nil)\n end",
"def bottom_boundary(input, top, left)\n zero_position = nil\n\n puts \"bottom_boundary top: #{top} left: #{left}\"\n\n (top..input.length - 1).each do |i|\n puts \"loop, i=#{i}\"\n if input[i][left] == 0\n zero_position = i\n else\n return zero_position\n end\n end\n\n zero_position\nend",
"def right\n :right\n end",
"def find_left_path(cell)\n find_path(cell) { | cell | left_cell(cell) }\n end",
"def path_blocked?(target)\n x_steps = target[0].to_i - @x\n y_steps = target[1].to_i - @y\n # Diagonal movements\n if x_steps != 0 && y_steps != 0\n (y_steps.abs - 1).times do |index| \n if y_steps > 0 && x_steps > 0\n current_target = \"#{@x + (index + 1)}#{@y + (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps < 0 && x_steps > 0\n current_target = \"#{@x + (index + 1)}#{@y - (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps > 0 && x_steps < 0\n current_target = \"#{@x - (index + 1)}#{@y + (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps < 0 && x_steps < 0\n current_target = \"#{@x - (index + 1)}#{@y - (index + 1)}\"\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n end\n end\n # Straight line movements\n else\n (y_steps.abs - 1).times do |index| \n if y_steps > 0\n current_target = @y + (index + 1)\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n elsif y_steps < 0\n current_target = @y - (index + 1)\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n end\n end\n (x_steps.abs - 1).times do |index| \n if x_steps > 0\n current_target = @x + (index + 1)\n return true if @board[\"#{current_target}#{target[1]}\"] != nil\n elsif x_steps < 0\n current_target = @x - (index + 1)\n return true if @board[\"#{current_target}#{target[1]}\"] != nil\n end\n end\n end\n false\n end",
"def from_side?\n dir1 = get_character(-1).direction\n dir2 = get_character(@event_id).prelock_direction\n diff = (dir1 - dir2).abs\n return diff == 2 || diff == 4\n end",
"def adjacent_in_path?(start,destination,path)\n adjacent = start.adjacent.include?(destination)\n return adjacent unless path\n if path.index(start) && path.index(destination) && (path.index(start) - path.index(destination)).abs == 1\n adjacent\n else\n false\n end\n end",
"def mid_borrows_from_left\n @mid.type, @mid.mid, @mid.value1, @mid.left = 2, @mid.left, @value1, @left.right\n @left.type, @value1 = 2, @left.value2\n end",
"def direction\n target_floor <=> floor\n end",
"def at_rightmost_side?\n\t\tcl[1] == @map.nr_columns\n\tend",
"def leaf?\n left.nil? && right.nil?\n end",
"def right\n @x_min + @y_min\n end",
"def right_aligned?\n value == :right\n end",
"def longest_path_1(edges)\nend",
"def h(node)\n (node.x - @end.x).abs + (node.y - @end.y).abs\n end",
"def bottom\n return @bottom\n end",
"def find_path(start_node, end_node, grid)\n start_node = sanitize(start_node)\n end_node = sanitize(end_node)\n if grid.nil?\n [start_node]\n else\n _max_x = grid.max_x\n _max_y = grid.max_y\n\n @current_grid = grid.inner_grid.clone\n\n raise 'max_x & max_y required' unless _max_x && _max_y\n\n _start_node = start_node.clone\n _end_node = end_node.clone\n\n heuristic = @heuristic.new(_end_node, @weight)\n\n _start_node[:f] = 0 # sum of g and h\n _start_node[:g] = 0 # steps to start node\n _start_node[:h] = nil # steps to end node\n _start_node[:opened] = true\n\n # use heap or tree for better perf\n open = []\n open.push _start_node\n\n while !open.empty? do\n _current_node = open.pop\n\n _current_node[:closed] = true\n @current_grid[node_to_a(_current_node)] = _current_node\n\n if node_to_a(_current_node) == node_to_a(_end_node)\n return final_path(_current_node)\n end\n\n new_g = _current_node[:g] + 1\n\n x = _current_node[:x]\n y = _current_node[:y]\n\n neighbors = []\n\n neighbors << [x-1, y] if x > 0\n neighbors << [x, y-1] if y > 0\n neighbors << [x+1, y] if x < _max_x-1\n neighbors << [x, y+1] if y < _max_y-1\n\n _neighbors = neighbors.map do |position|\n node = @current_grid[position]\n if node.nil? || node[:walkable]\n node ||= {}\n @current_grid[position] = node.merge({\n x: position.first,\n y: position[1],\n closed: false,\n opened: false\n })\n end\n end.compact\n\n _neighbors.each do |neighbor|\n if (!neighbor[:opened] || new_g < neighbor[:g])\n neighbor[:g] = new_g\n neighbor[:h] ||= heuristic.h(neighbor)\n neighbor[:f] = neighbor[:g] + neighbor[:h]\n neighbor[:parent] = node_to_a(_current_node)\n\n if (!neighbor[:opened])\n open.push neighbor\n neighbor[:opened] = true\n else\n # ???\n puts \"got here some how!!!\"\n end\n end\n end\n\n open.sort_by! {|i| [-i[:f], -i[:h]]}\n # grid_p\n end\n end\n end",
"def left_edge\n @image.get(0,0,1,height).pixels\n end",
"def completed_path?\n path.size == nodes.size - 1\n end",
"def from_right?\n dir1 = get_character(-1).direction\n dir2 = get_character(@event_id).prelock_direction\n return (dir1 * 2) % 10 == dir2\n end",
"def can_path_through x,y\n @map[x][y] != :wall\n rescue\n false\n end",
"def on_board?(end_point)\n\t\tend_x, end_y = end_point\n\t\treturn false if pos_x < 0 || pos_x > 7\n\t\treturn false if pos_y < 0 || pos_y > 7\n\t\treturn false if end_x < 0 || end_x > 7\n\t\treturn false if end_y < 0 || end_y > 7\n\t\treturn true\n\tend",
"def border_right()\n return get_border(:right)\n end",
"def balanced?\n difference_left_right = @root.left_child.depth - @root.right_child.depth\n difference_left_right.between?(-1, 1)\n end",
"def last\n left = @left_generator.last\n right = @right_generator.last\n\n if right.nil?\n left\n else\n right\n end\n end",
"def left_path()\n \t\t@log.debug(\"left_path\")\n \t\tpath = nil\n\n \t\tkeys.sort.each do |next_idx|\n \t\t\t@log.debug(\"Boink (#{next_idx})\")\n \t\t\t# Dereference into the subtree. Let's see what we've got here, shall we?\n \t\t\tnext_node = sub_node(next_idx)\n\n \t\t\tpath = next_node.left_path()\n \t\t\tunless path.nil?\n \t\t\t\t# Add ourselves to the front of the path, and we're done\n \t\t\t\tpath.unshift(next_idx)\n \t\t\t\treturn path\n \t\t\tend\n \t\tend\n\n \t\t# We chewed through all the keys and all the subtrees were completely\n \t\t# empty. Bugger.\n \t\treturn nil\n \tend",
"def reverse_direction node\n case node\n when :up\n :down\n when :down\n :up\n when :left\n :right\n when :right\n :left\n else\n nil\n end\n end",
"def getDirection(x, y)\n if(@grid != nil && @grid.getCell(x,y).getState == :bridge)\n return @grid.getCell(x,y).getDirection\n end\n return nil\n end",
"def part_of_right_x?(x, y)\n x == (size - y - 1)\n end",
"def link(from, to)\n if (direction = @maze.relative_direction(from, to))\n opposite = @maze.opposite(direction)\n\n if @maze.valid?(from[0], from[1])\n direction <<= Maze::UNDER_SHIFT if @maze[from[0], from[1]] & direction == 0\n @paths[from] |= direction\n end\n\n opposite <<= Maze::UNDER_SHIFT if @maze[to[0], to[1]] & opposite == 0\n @paths[to] |= opposite\n\n return (opposite & Maze::UNDER == 0) ? :over : :under\n end\n\n return :over\n end",
"def trace_path_back(end_pos)\n last_node = self.find_path(end_pos)\n return \"we can't find the end pos\" if last_node == nil\n path_arr = [last_node.pos]\n\n until last_node.parent == nil\n path_arr << last_node.parent.pos\n last_node = last_node.parent\n end\n\n path_arr.reverse\n end",
"def mid_borrows_from_right\n @mid.type, @mid.value1, @value2, @mid.mid = 2, @value2, @right.value1, @right.left\n @right.shift_left\n @right.type = 2\n end",
"def path(x, y)\r\n\t\t# If x or y are on the edge, meaning they have only one path, return 1\r\n\t\tif (x == 0 || y == 0)\r\n\t\t\treturn 1\r\n\t\r\n\t\t# If in the middle of the square, check to see if sum of paths for node already calculated?\r\n\t\telse\r\n\t\t\t# If so, return calculated sum of paths for node\r\n\t\t\tif @node[x][y] != 0\r\n\t\t\t\treturn @node[x][y]\r\n\t\t\t\t\r\n\t\t\t# Otherwise, set node[x][y] to sum of paths for connected nodes through recursion\r\n\t\t\t# Return newly calculated node[x][y]\r\n\t\t\telse\r\n\t\t\t\t@node[x][y] = path(x-1, y) + path(x, y-1)\r\n\t\t\t\treturn @node[x][y]\r\n\t\t\tend\r\n\t\tend\t\r\n\tend",
"def width\n @right_edge - @left_edge\n end",
"def can_go_right?(the_maze, floor, position)\r\n (position + 1 < the_maze[floor].size) and (the_maze[floor][position + 1] == \"0\")\r\nend",
"def min_path\n if @layers.count == 2\n return [ top ] + [ @layers[1].min ]\n end\n\n left_min_path = left_child.min_path\n left_min_path_sum = left_min_path.inject(0, :+)\n right_min_path = right_child.min_path\n right_min_path_sum = right_min_path.inject(0, :+)\n\n if left_min_path_sum < right_min_path_sum\n [ top ] + left_child.min_path \n else\n [ top ] + right_child.min_path\n end\n end",
"def branches\n edges\n end"
] |
[
"0.67251366",
"0.6326786",
"0.6302117",
"0.6272363",
"0.60861903",
"0.6085516",
"0.60582817",
"0.6051316",
"0.6044524",
"0.59614885",
"0.5930089",
"0.590992",
"0.59020245",
"0.5897348",
"0.5894792",
"0.58718705",
"0.586092",
"0.58526284",
"0.5834471",
"0.5832742",
"0.5831373",
"0.58284056",
"0.5786555",
"0.5780143",
"0.57712936",
"0.57521737",
"0.5657374",
"0.56392294",
"0.55929685",
"0.55810297",
"0.5569273",
"0.55390465",
"0.5537288",
"0.55309606",
"0.5522959",
"0.5515848",
"0.5501764",
"0.55011237",
"0.54894567",
"0.5488469",
"0.5484177",
"0.54830724",
"0.5478852",
"0.5466155",
"0.5452693",
"0.5450844",
"0.54471457",
"0.5446231",
"0.54281896",
"0.54192984",
"0.54192984",
"0.5412724",
"0.54053736",
"0.53919667",
"0.5384794",
"0.53804433",
"0.53768295",
"0.5374875",
"0.5374875",
"0.5368693",
"0.5353537",
"0.5347718",
"0.53300387",
"0.5328906",
"0.5328636",
"0.5322813",
"0.5299294",
"0.5295921",
"0.52931273",
"0.52882314",
"0.5284788",
"0.5277934",
"0.52739245",
"0.52738905",
"0.52708924",
"0.52640545",
"0.5262098",
"0.5256811",
"0.5255203",
"0.52496195",
"0.52475333",
"0.52437794",
"0.5243672",
"0.52389085",
"0.5228963",
"0.522666",
"0.52263975",
"0.52237856",
"0.521758",
"0.5206824",
"0.52028507",
"0.5202597",
"0.51996434",
"0.5192131",
"0.5188551",
"0.51793957",
"0.5174405",
"0.517292",
"0.5170661",
"0.51694995"
] |
0.55353653
|
33
|
Stamps all files matching DIR_PATTERNS and the +includepaths+ option unless they have already been stamped
|
def run!(options={})
options[:exclude_paths] ||= []
options[:include_paths].each do |path|
DIR_PATTERS << path
end if options[:include_paths]
DIR_PATTERS.each do |main_dir|
Dir.glob(main_dir).each do |path|
# skip to the next file if this file matches exclude_paths
next if options[:exclude_paths].detect { |pattern| File.fnmatch(pattern, path) }
StampFile.new(path, options).stamp!
end
end
true # return true (success)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_exclusions(globs); end",
"def enhance_file_list\n return unless @enhanced_mode\n @current_dir ||= Dir.pwd\n\n begin\n actr = @files.size\n\n # zshglob: M = MARK_DIRS with slash\n # zshglob: N = NULL_GLOB no error if no result, this is causing space to split\n # file sometimes for single file.\n\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n # FIXME: simplify condition into one\n if @files.size == 1\n # its a dir, let give the next level at least\n return unless @files.first[-1] == '/'\n\n d = @files.first\n # zshglob: 'om' = ordered on modification time\n # f1 = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_files_by_mtime(d)\n\n if f && !f.empty?\n @files.concat f\n @files.concat get_important_files(d)\n end\n return\n end\n #\n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maybe bin, put a couple recent files\n # FIXME: gemspec file will be same as current folder\n if @files.index('Gemfile') || !@files.grep(/\\.gemspec/).empty?\n\n if @files.index('app/')\n insert_into_list('config/', \"config/routes.rb\")\n end\n\n # usually the lib dir has only one file and one dir\n # NOTE: avoid lib if rails project\n flg = false\n @files.concat get_important_files(@current_dir)\n if @files.index('lib/') && !@files.index('app/')\n # get first five entries by modification time\n # f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('lib')&.first(5)\n # @log.warn \"f1 #{f1} != #{f} in lib\" if f1 != f\n if f && !f.empty?\n insert_into_list('lib/', f)\n flg = true\n end\n\n # look into lib file for that project\n # lib has a dir in it with the gem name\n dd = File.basename(@current_dir)\n if f.index(\"lib/#{dd}/\")\n # f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime(\"lib/#{dd}\")&.first(5)\n # @log.warn \"2756 f1 #{f1} != #{f} in lib/#{dd}\" if f1 != f\n if f && !f.empty?\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n\n # look into bin directory and get first five modified files\n # FIXME: not in the case of rails, only for commandline programs\n if @files.index('bin/') && !@files.index('app/')\n # f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('bin')&.first(5)\n # @log.warn \"2768 f1 #{f1} != #{f} in bin/\" if f1 != f\n insert_into_list('bin/', f) if f && !f.empty?\n flg = true\n end\n\n # oft used rails files\n # TODO remove concerns dir\n # FIXME too many files added, try adding recent only\n if @files.index('app/')\n [ \"app/controllers\", \"app/models\", \"app/views\" ].each do |dir|\n f = get_files_by_mtime(dir)&.first(5)\n if f && !f.empty?\n @log.debug \"f has #{f.count} files before\"\n @log.debug \"f has #{f} files before\"\n f = get_recent(f)\n @log.debug \"f has #{f.count} files after\"\n @log.debug \"f has #{f} files after\"\n insert_into_list(\"#{dir}/\", f) unless f.empty?\n end\n end\n\n insert_into_list('config/', \"config/routes.rb\")\n\n # top 3 dirs in app dir\n f = get_files_by_mtime('app/')&.first(3)\n insert_into_list('app/', f) if f && !f.empty?\n flg = true\n end\n return if flg\n\n\n end # Gemfile\n\n # 2019-06-01 - added for crystal and other languages\n if @files.index('src/')\n f = get_files_by_mtime('src')&.first(5)\n insert_into_list('src/', f) if f && !f.empty?\n end\n return if @files.size > 15\n\n # Get most recently accessed directory\n ## NOTE: first check accessed else modified will change accessed\n # 2019-03-28 - adding NULL_GLOB breaks file name on spaces\n # print -n : don't add newline\n # zzmoda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n # zzmoda = nil if zzmoda == ''\n moda = get_most_recently_accessed_dir\n # @log.warn \"Error 2663 #{zzmoda} != #{moda}\" if zzmoda != moda\n if moda && moda != ''\n\n # get most recently accessed file in that directory\n # NOTE: adding NULL_GLOB splits files on spaces\n # FIXME: this zsh one gave a dir instead of file.\n # zzmodf = `zsh -c 'print -rl -- #{moda}*(oa[1]M)'`.chomp\n # zzmodf = nil if zzmodf == ''\n modf = get_most_recently_accessed_file moda\n # @log.warn \"Error 2670 (#{zzmodf}) != (#{modf}) gmra in #{moda} #{zzmodf.class}, #{modf.class} : Loc: #{Dir.pwd}\" if zzmodf != modf\n\n raise \"2784: #{modf}\" if modf && !File.exist?(modf)\n\n insert_into_list moda, modf if modf && modf != ''\n\n # get most recently modified file in that directory\n # zzmodm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`.chomp\n modm = get_most_recently_modified_file moda\n # zzmodm = nil if zzmodm == ''\n # @log.debug \"Error 2678 (gmrmf) #{zzmodm} != #{modm} in #{moda}\" if zzmodm != modm\n raise \"2792: #{modm}\" if modm && !File.exist?(modm)\n\n insert_into_list moda, modm if modm && modm != '' && modm != modf\n end\n\n ## get most recently modified dir\n # zzmodm = `zsh -c 'print -rn -- *(/om[1]M)'`\n # zzmodm = nil if zzmodm == ''\n modm = get_most_recently_modified_dir\n # @log.debug \"Error 2686 rmd #{zzmodm} != #{modm}\" if zzmodm != modm\n\n if modm != moda\n\n # get most recently accessed file in that directory\n # modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n modmf = get_most_recently_accessed_file modm\n raise \"2806: #{modmf}\" if modmf && !File.exist?(modmf)\n\n insert_into_list modm, modmf\n\n # get most recently modified file in that directory\n # modmf11 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n modmf1 = get_most_recently_modified_file modm\n raise \"2812: #{modmf1}\" if modmf1 && !File.exist?(modmf1)\n\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\n ensure\n # if any files were added, then add a separator\n bctr = @files.size\n @files.insert actr, SEPARATOR if actr < bctr\n end\nend",
"def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end",
"def track_files(glob); end",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end",
"def safe_glob(dir, patterns, flags = T.unsafe(nil)); end",
"def matches_for_glob(glob) # TODO: rename?\n glob = File.join(self.lib_dirs_glob, glob)\n\n Dir[glob].map {|f| f.tap(&Gem::UNTAINT) } # FIX our tests are broken, run w/ SAFE=1\n end",
"def lib_files\n @files.select do |file|\n require_paths.any? do |path|\n file.start_with? path\n end\n end\n end",
"def addSrcFilesByRE(re)\n Dir.for_each(@srcDir) { |f|\n next if File.stat(f).dir?\n @files << f if re =~ f\n }\n end",
"def resolve\n @paths.clear\n if @options[:glob] == :newest\n @paths.concat(Dir[@pattern].sort_by { |f| File.mtime(f) }.last(1))\n else\n @paths.concat(Dir[@pattern])\n end\n @paths.any?\n end",
"def add_matching(pattern)\n Dir[pattern].each do |fn|\n\tself << fn unless exclude?(fn)\n end\n end",
"def included_files; end",
"def watchers_for_source_files_in pattern\n \n project_name, target_name, config_name = pattern.split(\"//\")\n \n # @todo assuming the project has the 'Debug' config when the project should likely be asked.\n \n config_name ||= \"Debug\"\n \n targets_for(project_name,target_name).map do |target|\n \n build_action = lambda { \"#{target.project.name}//#{target.name}//#{config_name}\" }\n \n project_root_dir = File.join(File.dirname(target.project.path), target.name)\n \n # Create a watcher for all source build files specified within the target\n \n new_guards = target.sources_build_phase.build_files.map do |file|\n full_source_path = File.join(project_root_dir,file.path)\n puts \"Source Path: #{full_source_path}\"\n create_guard_for full_source_path, build_action\n end\n \n # Create a watcher for the pch if one has been specified.\n \n if target.config(config_name).prefix_header\n prefix_header_path = File.join(File.dirname(target.project.path), target.config(config_name).prefix_header)\n puts prefix_header_path\n new_guards << create_guard_for(prefix_header_path, build_action)\n end\n\n new_guards\n \n end.flatten.compact\n \n end",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n watch = false\n @script.rules.reverse.each do |r|\n rule_watches = r.watch(path)\n if false\n $stderr.print \"watch \", path, \" \", rule_watches, \"\\n\"\n end\n next if rule_watches.nil?\n watch = rule_watches\n break\n end\n watch\n end\n paths.each do |path|\n # $stderr.print \"lookup #{path}\\n\"\n @script.depends_on(path).each do |dependence|\n # $stderr.print \"add #{dependence} for #{path}\\n\"\n paths << dependence\n end\n end\n paths.push(@script.path).compact!\n paths.uniq!\n # $stderr.print \"watch #{paths.map {|path| Pathname(path).expand_path }.join(' ')}\\n\"\n paths.map {|path| Pathname(path).expand_path }\n end",
"def find_includes include_dirs, src\r\n includes = Rake::CParser.parse_file_includes src\r\n res = includes.collect { |inc|\r\n search_includes include_dirs, src, inc\r\n }\r\n res.compact\r\n end",
"def add_matching(pattern)\n Dir[ pattern ].each do |fn|\n self << fn unless exclude?(fn)\n end\n end",
"def load_file_path!\n @files = FilepathScanner.call(\n include_paths,\n exclude_path_regexps,\n recursive_scan: recursive_include\n )\n end",
"def enhance_file_list\n return\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]M)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]M)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]M)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]M)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend",
"def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end",
"def file_paths\n Dir.glob(@filepath_pattern).sort\n end",
"def excluded_files() = []",
"def ignore_files=(patterns)\n @finder.add_patterns(patterns)\n end",
"def includes(*paths)\n self.included_files.concat(expand_globs(paths))\n end",
"def update_source_paths\n source_paths.unshift(root_dir)\n end",
"def gather_files files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list files, true, @options.exclude\n\n file_list = remove_unparseable(file_list)\n\n if file_list.count {|name, mtime|\n file_list[name] = @last_modified[name] unless mtime\n mtime\n } > 0\n @last_modified.replace file_list\n file_list.keys.sort\n else\n []\n end\n end",
"def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end",
"def patchlist(package)\n File.join(package.srcdir, \"patches-autobuild-stamp\")\n end",
"def appendGlobs(arr, patterns); patterns.each { |p| arr << Dir.glob(p) }; arr.flatten end",
"def insert_includes\n # match all variables, every variable begins with an at (@).\n # variables can also end with a semicolon to have a safe declaration.\n @output = @output.gsub(/\\<(.+)\\>/) {\n match = Regexp.last_match[1]\n match.prepend('/') unless match.start_with?('/')\n IO.read(\"#{PATHS[:template_dir]}#{match}\")\n }\n end",
"def files() = files_path.glob('**/*')",
"def files_for_rotation\n files = Set.new\n Padrino.dependency_paths.each do |path|\n files += Dir.glob(path)\n end\n reloadable_apps.each do |app|\n files << app.app_file\n files += Dir.glob(app.app_obj.prerequisites)\n files += app.app_obj.dependencies\n end\n files + special_files\n end",
"def load_instrumentation_files(pattern)\n Dir.glob(pattern) do |file|\n begin\n if file.to_s.include?('instrumentation/kafka.rb')\n # (**options) will report syntax error when ruby version under 2.0.0\n require file.to_s if (defined? RUBY_VERSION) && (TingYun::Support::VersionNumber.new(RUBY_VERSION) >= TingYun::Support::VersionNumber.new('2.0.0'.freeze))\n else\n require file.to_s\n end\n rescue LoadError => e\n TingYun::Agent.logger.warn \"Error loading instrumentation file '#{file}':\", e\n end\n end\n end",
"def process_exclusions globs\n remainder = globs.select do |glob|\n if glob_is_directory?(glob)\n exdir = File.join(directory, glob_to_directory(glob))\n included.delete_if { |file| file.start_with?(exdir) }\n false\n else\n true\n end\n end\n process_globs remainder\n end",
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end",
"def files_with_duplicate_imports\n files.select(&:has_duplicate_import?)\n end",
"def source_paths\n Array(super) +\n [File.join(File.expand_path(File.dirname(__FILE__)), 'base_templete_files')]\nend",
"def spec_file_names\n return @spec_file_names if @spec_file_names\n error \"No #{Noop::Config.dir_path_task_spec} directory!\" unless Noop::Config.dir_path_task_spec.directory?\n @spec_file_names = find_files(Noop::Config.dir_path_task_spec, Noop::Config.dir_path_task_spec) do |file|\n file.to_s.end_with? '_spec.rb'\n end\n end",
"def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end",
"def in_source_dir(*paths); end",
"def collect_sources_and_toolchains\n sources_to_build = {}\n\n exclude_files = Set.new\n exclude_sources.each do |p|\n if p.include?(\"..\")\n Printer.printError \"Error: Exclude source file pattern '#{p}' must not include '..'\"\n return nil\n end\n\n Dir.glob(p).each {|f| exclude_files << f}\n end\n files = Set.new # do not build the same file twice\n\n add_to_sources_to_build(sources_to_build, exclude_files, sources)\n\n source_patterns.each do |p|\n if p.include?(\"..\")\n Printer.printError \"Error: Source file pattern '#{p}' must not include '..'\"\n return nil\n end\n\n globRes = Dir.glob(p)\n if (globRes.length == 0)\n Printer.printWarning \"Warning: Source file pattern '#{p}' did not match to any file\"\n end\n add_to_sources_to_build(sources_to_build, exclude_files, globRes, tcs4source(p))\n end\n return sources_to_build\n end",
"def add_files(*files)\n @source_paths &= files\n end",
"def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACM --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end",
"def check_spec_files_exists(spec, accessor, platform_name, options = {})\n result = []\n patterns = spec.send(accessor)[platform_name]\n patterns.map do |pattern|\n pattern = Pathname.pwd + pattern\n if pattern.directory? && options[:glob]\n pattern += options[:glob]\n end\n result << \"#{platform_name}: [#{accessor} = '#{pattern}'] -> did not match any file\" if pattern.glob.empty?\n end\n result\n end",
"def add_template_repository_to_source_path\n source_paths.unshift(File.dirname(__FILE__))\nend",
"def run_on_modifications(paths = [])\n hash = {}\n \n # Get all files.\n paths = Dir.glob(\"#{@options[:input]}/**/*\").select do |path|\n not File.directory? path\n end\n \n paths.each do |path|\n file = File.read path\n compiled = ::EJS.compile file\n hash[path] = compiled\n \n UI.info \"[Guard::EJS] Compiled #{path}.\"\n end\n \n # Just overwrite the whole thing for now.\n FileUtils.mkdir_p File.dirname(@options[:output])\n \n File.open(@options[:output], 'w+') do |file|\n file.write \"window.#{@options[:namespace]} = window.#{@options[:namespace]} || {}\\n\"\n file.write \"window.#{@options[:namespace]}.templates = {\"\n \n hash.each do |name, template|\n file.write \"\\\"#{name}\\\": #{template},\"\n end\n \n file.write \"}\"\n end\n end",
"def spec_files\n glob_files(@root_dir, 'spec', '**/*_spec.rb')\n end",
"def add_template_path( args )\n files = args[:files]\n if !(options.templates.frozen?)\n files.each do |fn|\n options.templates << File.expand_path(fn)\n end\n end\n if args[:freeze] == true\n options.templates.freeze\n end\n end",
"def filter_directories(modified_files); end",
"def setup_match_rules\n include_match << Regexp.new('.') if @include_match.flatten.size == 0\n $logger.debug \"include match rules:\"\n @include_match.each { |pm| $logger.debug \"+ #{pm.to_s}\" }\n $logger.debug \"exclude match rules:\"\n @exclude_match.each { |nm| $logger.debug \"+ #{nm.to_s}\" }\n end",
"def sapi_files_found(sapi, priority = '*')\n ::Dir.glob(sapi_file_path(sapi, priority)) + ::Dir.glob(sapi_file_path(sapi))\n end",
"def mortar_manifest_pathlist(include_dot_git = true)\n ensure_valid_mortar_project_manifest()\n\n manifest_pathlist = File.read(project_manifest_name).split(\"\\n\")\n if include_dot_git\n manifest_pathlist << \".git\"\n end\n\n #Strip out comments and empty lines\n manifest_pathlist = manifest_pathlist.select do |path|\n s_path = path.strip\n !s_path.start_with?(\"#\") && !s_path.empty?\n end\n\n manifest_pathlist.each do |path|\n unless File.exists? path\n Helpers.error(\"#{project_manifest_name} includes file/dir \\\"#{path}\\\" that is not in the mortar project directory.\")\n end\n end\n \n manifest_pathlist\n end",
"def run_all\n run_on_additions(Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq))\n end",
"def find_files(base_dir, flags); end",
"def existing_resource_snippets_paths\n Dir[\"#{snippets_path}/*#{template_ext}\"].reject { |path| File.basename(path).start_with?('_') }\n end",
"def exclude_paths\n @source_paths ||= []\n end",
"def apply_exclusions paths\n paths.reject do |path|\n excludes.any? do |pattern|\n globs = pattern.split(\"\\\\\")\n components = path.split(\"/\")\n\n # Inno Setup includes a feature in which you can anchor excludes at\n # the root by starting the exclude with a \"\\\". Since I don't want\n # to make this more complicated than I have to, I'm not implementing\n # this feature at this time.\n if globs[0] == \"\"\n raise \"Can't handle anchored exclude #{pattern}\"\n end\n \n globs_match_strings_anywhere? globs, components\n end\n end\n end",
"def findPaths (conf)\n puts aktTime()+' collecting files...'\n STDOUT.flush #write out immediately\n\tconf[:saveDirs].each do |d|\n\t\tif File.directory?(d)\n\t\t\tDir.chdir(d)\n\t\t\tgetFiles(conf)\n\t\telse\n\t\t\tputs \"\\nWarning: Directory: \\n\"+d+\" **not** found !\"\n\t\tend\n\tend\nend",
"def add_files(frameworks_build_phase, files, lib_group, relative_source_directory)\n\tfiles.each { |file|\n\t\tif file != \".\" && file != \"..\"\n\t\t\ta_ref = lib_group.new_file(relative_source_directory + file)\n\t\t\tframeworks_build_phase.add_file_reference(a_ref, true)\n\t\tend\n\t}\nend",
"def excludes\n return Dir.chdir( base ) {\n %w(. .. .svn .git .hg CVS Rakefile) + files_for_erb +\n Dir.glob( '*~' ) + Dir.glob( '#*#' ) + Dir.glob( '*.bak' )\n }\n end",
"def default_rx # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n @rx_include << Regexp.new('\\.(c|cc|rb|jl|sh|proto|py|go|f|h|md|ipynb)$')\n @rx_include << Regexp.new('^BUILD')\n @rx_include << Regexp.new('^WORKSPACE')\n @rx_include << Regexp.new('^Makefile')\n @rx_include << Regexp.new('^Dockerfile')\n @rx_include << Regexp.new('^\\.gitignore')\n @rx_include << Regexp.new('^\\.bazelrc')\n @rx_include << Regexp.new('^\\.dockerignore')\n @rx_include << Regexp.new('^CMakeLists.txt')\n\n @rx_skip << Regexp.new('\\/core')\n @rx_skip << Regexp.new('\\/__pycache__')\n @rx_skip << Regexp.new('\\.(o)$')\n @rx_skip << Regexp.new('\\.(a)$')\n @rx_skip << Regexp.new('\\/bazel-')\n @rx_skip << Regexp.new('gmon.out')\n end",
"def clean_paths\n cached_used = used_files\n glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD\n files = Pathname.glob(root + \"**/*\", glob_options).map(&:to_s)\n\n files.reject! do |candidate|\n candidate = candidate.downcase\n candidate.end_with?('.', '..') || cached_used.any? do |path|\n path = path.downcase\n path.include?(candidate) || candidate.include?(path)\n end\n end\n files\n end",
"def process_globs(globs); end",
"def ignore_paths\n [/MT/, /\\.mt-attrs/]\n end",
"def all_files_included?\n file_paths = files.map { |f| File.join(package_path, f[:path]) }\n \n package_files = if defined? package_id\n Dir.glob(File.join(package_path, package_id, \"**\", \"*\"))\n else\n Dir.glob(File.join(package_path, 'files', '**', '*'))\n end\n package_files = package_files.select { |f| File.file? f }\n\n package_files.each do |p|\n errors.add :coverage, \"#{p} is in the package but is not covered by the\" +\n \" representation(s)\" unless file_paths.include?(p) \n end\n \n return errors.on(:coverage).nil?\n\n end",
"def refresh(env)\n return if env[ENV_FLAG]\n env[ENV_FLAG] = true\n # Having been run within the dwell period is good enough\n return if @last_been_run and Time.now - @last_been_run < @dwell\n # verbose loggers\n added_files = []\n changed_files = []\n deleted_files = []\n # Prepare to find a moving base_js\n previous_goog_base_filename = @goog ? @goog[:base_filename] : nil\n goog = nil\n # Mark everything for deletion.\n @files.each {|f, dep| dep[:not_found] = true}\n # Scan filesystem for changes.\n @sources.each do |dir, path|\n dir_range = (dir.length..-1)\n Dir.glob(File.join(dir,'**','*.js')).each do |filename|\n file = (@files[filename] ||= {})\n file.delete(:not_found)\n mtime = File.mtime(filename)\n if previous_goog_base_filename == filename\n if file[:mtime] == mtime\n multiple_base_js_failure if goog\n goog = @goog \n end\n previous_goog_base_filename = nil\n end\n if path and !file.has_key?(:path)\n raise unless filename.index(dir) == 0 # glob sanity\n file[:path] = \"#{path}#{filename.slice(dir_range)}\"\n added_files << filename unless file[:excluded]\n end\n if !path or file[:excluded]\n file[:excluded] = true\n file[:provide] = file[:require] = [] \n elsif file[:mtime] != mtime\n @deps = {}\n old_file_provide = file[:provide]\n old_file_require = file[:require]\n file_text = File.read filename\n file[:provide] = file_text.scan(PROVIDE_REGEX).flatten.uniq\n file[:require] = file_text.scan(REQUIRE_REGEX).flatten.uniq\n if old_file_provide != file[:provide] or old_file_require != file[:require]\n # We're changed only if the provides or requires changes.\n # Other edits to the files don't actually alter the dependencies.\n changed_files << filename\n end\n # Record goog as we pass by\n if file[:provide].empty? and file[:require].empty?\n if File.basename(filename) == 'base.js'\n if file_text =~ BASE_JS_REGEX\n multiple_base_js_failure if goog\n goog = {:base_filename => filename}\n if file[:path]\n goog[:base_js] = file[:path]\n goog[:base_js_mtime] = mtime\n goog[:deps_js] = file[:path].gsub(/base.js$/, 'deps.js')\n end\n end\n end\n end\n end\n file[:mtime] = mtime\n end\n end\n # Sweep to delete not-found files.\n @files.select{|f, dep| dep[:not_found]}.each do |filename, o|\n deleted_files << filename\n @files.delete(filename)\n end\n # Decide if deps has changed.\n if 0 < added_files.length + changed_files.length + deleted_files.length\n @ns = nil\n end\n # Finish\n @goog = goog\n @last_been_run = Time.now\n end",
"def recent_specs(touched_since)\n recent_specs = []\n recent_specs += Dir['spec/**/*_spec.rb'].select do |path|\n File.mtime(path) > touched_since\n end\nend",
"def enhance_file_list\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n # zsh gives errors which stick on stdscr and don't get off!\n # Rather than using N I'll try to convert to ruby, but then we lose\n # similarity to cetus and its tough to redo all the sorting stuff.\n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n #f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_file_list d\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]MN)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]MN)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]MN)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]MN)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]MN)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend",
"def skip_paths; end",
"def write_static_files\n debug_msg \"Copying static files\"\n options = { :verbose => $DEBUG_RDOC, :noop => @options.dry_run }\n static_files = Pathname.\n glob(@template_dir.to_s + '/**/*').\n reject { |f| f.extname == '.erb' }\n static_files.sort.each do |source_path|\n out_path = @output_dir + source_path.relative_path_from(@template_dir)\n if source_path.directory?\n out_path.mkpath unless @options.dry_run\n else\n FileUtils.cp source_path.to_s, out_path.dirname.to_s, **options\n end\n end\n end",
"def sync_rspec_only\n copy_skel_files\n end",
"def initialize_clean\n self.clean_globs ||= %w[diff diff.txt TAGS ri deps .source_index\n *.gem **/*~ **/.*~ **/*.rbc]\n end",
"def all_specs\n files_matching %r%^spec/.*_spec\\.rb$%\n end",
"def template_files\n Pathname.glob(staged_root.join(\"**\", \"*.erb\")).select(&:file?)\n end",
"def hg_ignore_files( *pathnames )\n\t\t\tpatterns = pathnames.flatten.collect do |path|\n\t\t\t\t'^' + Regexp.escape(path) + '$'\n\t\t\tend\n\t\t\ttrace \"Ignoring %d files.\" % [ pathnames.length ]\n\n\t\t\tIGNORE_FILE.open( File::CREAT|File::WRONLY|File::APPEND, 0644 ) do |fh|\n\t\t\t\tfh.puts( patterns )\n\t\t\tend\n\t\tend",
"def directories_to_watch\n []\n end",
"def file_list(pattern)\n FileList[pattern].tap do |list|\n list.exclude 'vendor/**/*', # bundler\n 'pkg/**/*', # gem build process\n 'spec/fixtures/**/*' # puppetlabs fixtures\n list.reject! { |f| File.directory? f }\n end\n end",
"def scan_templates\r\n @templates = Dir.glob(File.join(path, \"*\")).inject([]) do |list, file_path|\r\n log.debug \"Checking if #{file_path} is a recognised template file.\"\r\n if File.file?(file_path)\r\n file_name = File.basename(file_path)\r\n log.debug \"#{file_path} is a template file.\" if !(Tilt[file_name]).nil?\r\n list << file_path if !(Tilt[file_name]).nil?\r\n end\r\n list\r\n end\r\n end",
"def build_sources\n sources = [File.join(source_dir, 'jasmine-webos-core.js'),\n File.join(source_dir, 'proxy-app-assistant.js')]\n\n sources += Dir.glob(\"#{source_dir}/**/*.js\").reject { |f| sources.include?(f) }.sort\n sources += Dir.glob(\"#{plugin_dir}/spec/helpers/*.js\")\n sources\nend",
"def scan_now\n #Check for add/modify\n scan_dir(@directory)\n \n # Check for removed files\n if @on_remove.respond_to?( :call )\n @known_file_stats.each_pair{ |path,stats|\n next if File.file?( path )\n stats[:path] = path\n @on_remove.call( stats )\n @known_file_stats.delete(path)\n }\n end\n \n @scanned_once = true\n end",
"def package_files\n (rdoc_files + lib_files + tests + doc_files + \n programs + extra_files + extension_files).uniq\n end",
"def generate_require_paths; end",
"def add_files_to_clean(*filenames)\n @clean_list.include(filenames)\n Cleaner.global_clean_list.include(filenames)\n end",
"def find_files dir = test_dir\n glob file_pattern(dir)\n end",
"def paths_with_stale_services(file_selector, stale_datetime)\n @index_driver.paths_with_stale_services(file_selector, stale_datetime)\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact))\n end",
"def manifest_files\n files = []\n exclude = Regexp.new(PROJ.exclude.join('|'))\n Find.find '.' do |path|\n path.sub! %r/^(\\.\\/|\\/)/o, ''\n next unless test ?f, path\n next if path =~ exclude\n files << path\n end\n files.sort!\nend",
"def all_specs\n files_matching %r%^spec/.*_spec\\.rb$%\n end",
"def tracked_files\n all_files.reject { |f| ignore_matcher.matched?(f) }\n end",
"def load_file_exclusions\n return unless config_hash[\"Exclude Files\"]\n config_options[:excluded_files] = []\n config_hash[\"Exclude Files\"].each do |short_file|\n config_options[:excluded_files] << File.join(starting_path, short_file)\n end\n end",
"def recent_specs(touched_since)\n recent_specs = FileList['app/**/*'].map do |path|\n\n if File.mtime(path) > touched_since\n spec = File.join('spec', File.dirname(path).split(\"/\")[1..-1].join('/'),\n \"#{File.basename(path, \".*\")}_spec.rb\")\n spec if File.exists?(spec)\n end\n end.compact\n\n recent_specs += FileList['spec/**/*_spec.rb'].select do |path| \n File.mtime(path) > touched_since \n end.uniq\nend",
"def run_on_changes(paths)\n paths.each do |path|\n # use output_folder or default back to watched file location\n run_steering(path, @options[:output_folder] || File.dirname(path))\n end\n end",
"def all_files\n Dir.glob(\"#{template_path}/**/*\", File::FNM_DOTMATCH).reject{|path| File.directory?(path) }.sort\n end",
"def refresh_watchers()\r\n paths = []\r\n\r\n # A list of all file paths the user passed in.\r\n unresolved_paths = @path.split(',')\r\n unresolved_paths = unresolved_paths.size == 0 ? @path : unresolved_paths\r\n\r\n # Glob all file paths and keep all readable files.\r\n for unresolved_path in unresolved_paths\r\n paths += Dir.glob(unresolved_path.strip).select do |resource|\r\n File.file?(resource) && File.readable?(resource)\r\n end\r\n end\r\n\r\n watched = @watched_files.keys\r\n\r\n # Files we are not yet watching.\r\n new_files = paths - watched\r\n\r\n # Files we are watching that no longer exist.\r\n dead_files = watched - paths\r\n\r\n start_watches(new_files)\r\n stop_watches(dead_files, true)\r\n end",
"def replaced_files\n new_dirs.select { |dir| File.file?(dir) }.to_set\n end",
"def check_file_patterns\n FILE_PATTERNS.each do |attr_name|\n if respond_to?(\"_validate_#{attr_name}\", true)\n send(\"_validate_#{attr_name}\")\n else\n validate_nonempty_patterns(attr_name, :error)\n end\n end\n\n _validate_header_mappings_dir\n if consumer.spec.root?\n _validate_license\n _validate_module_map\n end\n end",
"def IncludeClobberTargets(*includes)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().ClobberList.include(includes)\n end",
"def ignore_includes\n ret = []\n ret << \"_includes/jekyll/**/*\"\n ret << [\"_includes/styleguide\", \"_includes/styleguide/**/*\"]\n ret << \"_includes/*.html\"\n ret << [\"_includes/atoms/figure\", \"_includes/atoms/figure/*\"]\n ret << [\"_includes/atoms/sanitize.html\", \"_includes/atoms/imagetitle.html\", \"_includes/atoms/classname.html\"]\n ret\n end",
"def autoload_once_paths=(_arg0); end",
"def modified_files(options); end",
"def modified_files(options); end"
] |
[
"0.5891279",
"0.583747",
"0.57488465",
"0.56499076",
"0.56059915",
"0.5542858",
"0.5538062",
"0.5534155",
"0.5521908",
"0.5513069",
"0.5460612",
"0.54544026",
"0.5437576",
"0.543569",
"0.54348433",
"0.54218185",
"0.5394347",
"0.5375221",
"0.5355468",
"0.53522056",
"0.5348523",
"0.5341463",
"0.53366214",
"0.53217214",
"0.53140175",
"0.52957153",
"0.52896065",
"0.5283366",
"0.5282466",
"0.52684724",
"0.5261106",
"0.5245834",
"0.5223361",
"0.51967585",
"0.5171216",
"0.51689297",
"0.51646835",
"0.5163198",
"0.51617634",
"0.51477325",
"0.51382446",
"0.5138159",
"0.51376855",
"0.5131526",
"0.5129527",
"0.5108472",
"0.5102513",
"0.51007265",
"0.5094703",
"0.5091753",
"0.50897545",
"0.50877",
"0.5087334",
"0.5082153",
"0.50758576",
"0.5070342",
"0.50687885",
"0.50656873",
"0.5063844",
"0.5057076",
"0.5051015",
"0.5049194",
"0.5048327",
"0.50440687",
"0.5042216",
"0.5037367",
"0.5031687",
"0.5022846",
"0.50219554",
"0.50186616",
"0.5003948",
"0.50005984",
"0.49958125",
"0.4995063",
"0.49903667",
"0.4989283",
"0.49868593",
"0.49838495",
"0.4979763",
"0.49796876",
"0.4979488",
"0.49760488",
"0.4965728",
"0.4964925",
"0.49635485",
"0.49584275",
"0.49527568",
"0.49514684",
"0.49481887",
"0.4941252",
"0.493827",
"0.49372622",
"0.49345532",
"0.4929466",
"0.49238437",
"0.49232516",
"0.49177173",
"0.49175575",
"0.49165633",
"0.49165633"
] |
0.7404886
|
0
|
Read a CSV string into an array of CSVEntries.
|
def read(string)
lines = string.split("\n")
header = lines[0]
attributes = header.split(',').map! { |v| v.to_sym }
# Struct.new('CSVEntry', *attributes)
ret = []
lines.drop(1).each do |line|
values = line.split(',')
opts = {}
values.each_with_index do |val, idx|
opts[attributes[idx]] = val
end
ret << Struct::CSVEntry.new(opts)
end
ret
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def csv_to_array(csv_name)\n\tCSV.read(csv_name)\nend",
"def csv_to_array(csv); end",
"def readCSV(filename)\n resultArray = Array.new\n\n # read csv file\n File.open(filename) { |file|\n while line = file.gets\n row = CSV.parse_line( Kconv::kconv(line, Kconv::UTF8, Kconv::SJIS) )\n resultArray.push( row )\n end\n }\n\n return resultArray\nend",
"def csv_to_array(csv)\n csv.split(\",\").map(&:strip)\n end",
"def csv_to_array(csv)\n csv.split(\",\").map(&:strip)\n end",
"def parse_csv(csvstr)\n\treturn CSV.parse(csvstr)\nend",
"def load_csv (csv_file)\n\tret = []\n\tFile.open(csv_file, \"r\") do |f|\n\t\tf.each_line do |line|\n\t\t\t#puts line\n\t\t\tret << line.split(';')\n\t\tend\n\tend\n\treturn ret\nend",
"def create_arr_strs(csv)\n\tarr_of_strings = csv.read.split(\"\\r\")\n\tarr_of_strings\nend",
"def parse_csv(csv_file)\r\n\t\t\t# Fixed errors due to a Byte-Order-Mark (BOM) at the very beginning of some CSV files\r\n\t\t\t# http://stackoverflow.com/questions/23011713/illegal-quoting-error-with-ruby-csv-parsing\r\n\t\t\tparsed_csv = []\r\n\t\t\tbegin\r\n\t\t \t\tparsed_csv = CSV.read(csv_file, :encoding => 'bom|utf-8')\r\n\t\t\trescue ArgumentError\r\n\t\t \t\tbegin\r\n\t\t \t\tparsed_csv = CSV.read(csv_file, :encoding => 'bom|utf-8:ISO-8859-1')\r\n\t\t \t\trescue ArgumentError\r\n\t\t \t\traise ParserError, \"There was an error in reading the CSV encoding.\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn parsed_csv\r\n\t\tend",
"def parse_csv(csv_string)\n csv_data = FasterCSV.parse(csv_string)\n header = csv_data.shift\n [csv_data.map{|row| Hash[*header.zip(row).flatten] }, header]\n end",
"def csv_to_array(phrase, delimiter = ',')\n phrase.split(delimiter).collect {|p| p.lstrip.rstrip }\n end",
"def parse_csv_file(delim, file_name) \n \n temp_array = Array.new #Create an array\n file = File.open(file_name, \"r\") #Open a file for reading\n \n \n #Iterate file, parse strings and store\n file.each_line do |line|\n temp_array.push(parse_line(delim, line))\n end\n\n #Close resource\n file.close\n \n return temp_array\nend",
"def parse_csv_line(text_line)\n\tcolumns = text_line.split(\",\")\n\tvalues = []\n\tcolumns.each { |x| values << x.strip}\n\treturn values\nend",
"def parse_csv(csv_name, schema)\n CSV.read(csv_name).map {|row| map_row_to_entity(row, schema) }\nend",
"def parse_csv(file_path)\n record_list = []\n header = []\n is_header = true\n \n CSV.foreach(file_path) do |row|\n if (is_header)\n\theader = row\n\tis_header = false\n else\n\trecord = Record.new\n\trecord.create(header, row)\n\trecord_list.push(record)\n end\n end\n return record_list\n end",
"def read_csv_data file\n rows = []\n readerIn = CSV.open(file, 'r')\n row = readerIn.shift\n while row!= nil && !row.empty?\n rows << row\n row = readerIn.shift\n end\n readerIn.close\n \n return rows\nend",
"def parse_csv(csv)\n objects = CSV.parse(csv)\n headers = objects.shift\n objects.to_a.map! { |row| Hash[headers.zip(row)] }\n end",
"def parse_csv(file)\n\t\tdata = []\n\t\t# Break open CSV and go through rows\n\t\tbegin\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'UTF-8')\n\t\trescue\n\t\t\t# Convert to UTF-8 if necessary\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'Windows-1252:UTF-8')\n\t\tend\n\t\tdata\n\tend",
"def fetch_csv_array(str) # instance method\n\n #remove whitespace\n str.gsub!(/\\s+/, \"\")\n return str.split(',')\n end",
"def parse_csv(csv, &row_block)\n CSV.parse(Encoding.to_utf_8(File.read(\"#{install_path}/Edit Scripts/#{csv}.csv\", mode: 'rb'))).each(&row_block)\n end",
"def parse\n results = []\n\n CSV.parse(read_data).each do |row|\n row = parse_row(row)\n keep = block_given? ? yield(row) == true : true\n results << row if keep\n end\n\n results\n end",
"def parseCSV(csvfile)\n begin\n if csvfile != nil && csvfile != \"\"\n file_ext = File.extname(csvfile.original_filename)\n if file_ext == \".csv\"\n content = File.read(csvfile.tempfile)\n arr_of_arrs = CSV.parse(content)\n return arr_of_arrs, 0\n else\n return nil, 4\n end\n else\n return nil, 1\n end\n rescue ArgumentError\n return nil, 2\n rescue CSV::MalformedCSVError\n return nil, 3\n end\n end",
"def parseCSV(csvfile)\n begin\n if csvfile != nil\n file_ext = File.extname(csvfile.original_filename)\n if file_ext == \".csv\"\n content = File.read(csvfile.tempfile)\n arr_of_arrs = CSV.parse(content)\n return arr_of_arrs, 0\n else\n return nil, 4\n end\n else\n return nil, 1\n end\n rescue ArgumentError\n return nil, 2\n rescue CSV::MalformedCSVError\n return nil, 3\n end\n end",
"def parse_csv_line_ruby(line, options, header_size = nil)\n return [] if line.nil?\n\n line_size = line.size\n col_sep = options[:col_sep]\n col_sep_size = col_sep.size\n quote = options[:quote_char]\n quote_count = 0\n elements = []\n start = 0\n i = 0\n\n previous_char = ''\n while i < line_size\n if line[i...i+col_sep_size] == col_sep && quote_count.even?\n break if !header_size.nil? && elements.size >= header_size\n\n elements << cleanup_quotes(line[start...i], quote)\n previous_char = line[i]\n i += col_sep.size\n start = i\n else\n quote_count += 1 if line[i] == quote && previous_char != '\\\\'\n previous_char = line[i]\n i += 1\n end\n end\n elements << cleanup_quotes(line[start..-1], quote) if header_size.nil? || elements.size < header_size\n [elements, elements.size]\n end",
"def parsed_data\n @parsed_data ||= begin\n CSV.read(full_filename, col_sep: col_sep, quote_char: quote_char, encoding: encoding)\n rescue => e #CSV::MalformedCSVError => er\n @parse_error = e.to_s\n rows = []\n #one more attempt. If BOM is present in the file.\n begin\n f = File.open(full_filename, \"rb:bom|utf-8\")\n rows = CSV.parse(f.read.force_encoding(\"ISO-8859-1\"))\n ensure\n return rows\n end\n end\n end",
"def rows\n csv.rows.map { |row_array|\n Row.new(header: header, row_array: row_array).to_a\n }\n end",
"def recommendation_csv_inputs csv_path\n valid_inputs = []\n\n CSV.foreach(csv_path, {headers: true, header_converters: :symbol}) do |row|\n row = row.to_h\n valid_inputs << row if valid_recommendation_hash?(row)\n end\n\n valid_inputs\n\n rescue => e\n valid_inputs\n end",
"def load_csv\n CSV.foreach(@file_path) do |row|\n # Our CSV stores strings only - so we must initialize all our recipes\n recipe = Recipe.new(row[0],row[1])\n # We push them into the cookbook recipes array\n @recipes << recipe\n end\n end",
"def read_csv(filename,sep = \",\")\n\tarr = []\n\tFile.open(filename,\"r\"){|file|\n\t\tfile.each_line do |line|\n\t\t\tarr << line.chomp.split(sep)\n\t\tend\n\t}\n\treturn arr\nend",
"def read_parameters_from_csv(csv)\r\n\t\tbegin\r\n\t\t\ttemp = CSV.read(csv)\r\n\t\trescue Exception\r\n\t\t\traise ArgumentError, \"It wasn't possible to read from #{csv} file.\"\r\n\t\tend\r\n\t\ttemp.each_with_index do |row,index|\r\n\t\t\t@actual_parameters[index] = row[0].split(';')\r\n\t\tend\r\n\tend",
"def csvfile_to_array(csv_f, header=true)\n arr_of_arrs = FasterCSV.read(csv_f)\n #puts arr_of_arrs.inspect()\n arr_of_arrs.shift() if header\n arr_of_arrs.flatten!\n\n return arr_of_arrs\n end",
"def read_in_csv_data(csv_file_name)\n begin\n CSV.foreach(csv_file_name, headers: true) do |row|\n @songs << Song.new(row['name'], row['location'])\n end\n rescue Exception\n @songs = nil\n end\n @songs\n end",
"def prepare_csv\n unparsed_file = File.open(csv.path)\n self.parsed_csv_string = \"\"\n string = unparsed_file.readlines()\n string.each_with_index do |line,i|\n parsed_line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/,\\\"\\\"/,'')\n # for some reason the iRacing CSV file is buggy.\n unless parsed_line == \"\\n\"\n if i == 5 or i == 6\n parsed_line = parsed_line.gsub(/\\n/,\"\\r\\n\")\n end\n self.parsed_csv_string << parsed_line\n end\n end\n unparsed_file.close\n end",
"def loadCSVFile(filePath)\n data = []\n CSV.foreach(filePath, :headers => true) do |row|\n row = row.to_h\n row.each do |k, v|\n v = v.to_s\n row[k] = v\n end\n data << row\n end\n data\n end",
"def load_csv\n CSV.foreach(@csv_file_path) do |row|\n @recipes << Recipe.new(name: row[0], description: row[1], rating: row[2], prep_time: row[3], tried: row[4])\n end\n end",
"def read_csv(io)\n quoted = false\n str = ''\n io.each_char do |ch|\n case\n when (ch == COMMA && !quoted) || ch == LF || ch == CR || ch.nil?\n break\n when ch == quote\n quoted = !quoted\n else\n str << ch\n end\n end\n str.empty? ? nil : value_from_s(str)\n end",
"def csv_convert(file)\n data_rows = []\n f = File.open(file, 'r')\n f.each_line do |line|\n data_rows.push line.chomp.split(',')\n end\n f.close\n return data_rows\nend",
"def load_csv(csv_path)\n raise Error::InvalidCSV unless File.exist? csv_path\n begin\n vals = CSV.read(csv_path)\n rescue CSV::MalformedCSVError\n raise Error::InvalidCSV\n end \n\n raise Error::BlankCSV if vals.length == 0\n raise Error::InvalidCSV if vals[0].length != 3\n\n # remove optional header\n vals.shift if vals[0][0] == HEADER_VAL\n\n @data = vals.collect do |data|\n {\n \"image_path\" => data[0],\n \"id\" => data[1],\n \"label\" => data[2]\n }\n end\n end",
"def load_csv(csv_filepath)\n gifts = []\n CSV.foreach(csv_filepath) do |row|\n gifts << row[0] # Nosso csv só tem uma coluna\n end\n return gifts\nend",
"def get\n arr = []\n\n process(csv_file).each do |record|\n arr << SOA_CSV_RECORD.new(*record.fields)\n end\n\n arr\n end",
"def load_csv\n # read each line frmo csv and append to recipes collection\n CSV.foreach(@csv_file) do |row|\n # puts \"#{row[0]} | #{row[1]}\"\n @recipes << Recipe.new(name: row[0], description: row[1], cooking_time: row[2], difficulty: row[3], tested: row[4])\n end\n end",
"def readCSVFile(fileName)\n\t# Create file handle\n\tinFile = File.new(fileName, 'r');\n\tarrString = nil;\n\t\n\t# Loop through file (should be a single data record)\n\tinFile.each_line do |row|\n\t\t# row is a string data type that consists of multiple fields\n\t\tarrString = row.split(\",\");\n\tend\n\t\n\tinFile.close();\n\t\n\t# Convert data from string to integer and return an integer array\n\treturn arrString.map { |x| x.to_i() }\nend",
"def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end",
"def csv_to_array(file)\n @recipes = []\n CSV.foreach(file){|row| @recipes << Recipe.new(row[0], row[1].to_i, row[2].to_i, row[3].to_i)}\n end",
"def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # #8 iterate over the CSV::Table rows then create a hash for each row, convert each row_hash\n #to an Entry by using the add_entry method\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"def load_csv(infile, mode = \"r\")\n raise IOError, \"File #{infile} not found.\" unless File.exist?(infile)\n CSV.read(infile, mode)\n end",
"def create_item_rows_from_csv \n item_rows = []\n CSV.foreach('./data/items.csv', headers: true, header_converters: :symbol) do |row|\n item_rows << row\n end \n return item_rows\n end",
"def csv_read(filename)\n return CSV.read(filename)\nend",
"def parse_csv(csv_file)\n\n # Loop through all entries in CSV file\n CSV.foreach(csv_file, :quote_char => \"\\\"\") do |row|\n next if row[0] == \"From\" && row[1] == \"To\"\n next if row[0].nil?\n\n # [0, 1] refers to the 2 addresses in the csv file\n [0, 1].each do |i|\n add_location(row[i])\n end\n\n add_journey(row)\n end\nend",
"def get_csv_data(csv_data)\r\n csv_file = nil\r\n\r\n #Get the path and name of the CSV file\r\n if csv_data.to_s.include? '.csv'\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}\")\r\n elsif (\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}.csv\")\r\n )\r\n end\r\n\r\n csv_arr = CSV.read( csv_file, {:headers => true, :header_converters => :symbol, :encoding => 'UTF-8'} )\r\n keys = csv_arr.headers.to_a\r\n # read attribute example => csv[index][:column1]\r\n return csv_arr.to_a.map {|row| Hash[ keys.zip(row) ] }\r\nend",
"def convert_csv_file_to_object\n begin\n CSV.foreach(@file_name) do |row|\n @csv_object.push(row)\n end \n rescue => exception\n raise FileReadError, exception\n end\n end",
"def parse_csv\n raise InvalidStateError, \"#{state.inspect} is not a valid Data state for method 'to_csv'\" unless state == :raw\n\n file_options = @options[:file_options]\n parse_options = @options[:parse_options]\n\n begin\n csv = CSVWrapper.parse(@content, parse_options)\n csv = csv.drop(1) if file_options[:has_headers] == true # drop the first row if it is a header\n rescue => e\n Logger.new(@options).print(@path, :parse, e)\n end\n\n @state = :parsed\n Data.new(@path, csv, @state, @options)\n end",
"def parse_csv(path)\n require 'csv'\n\n str = Nitro::Template.new.render(File.read(path))\n\n reader = CSV::Reader.create(str)\n header = reader.shift\n\n reader.each_with_index do |row, i|\n data = {}\n row.each_with_index do |cell, j|\n data[header[j].to_s.strip] = cell.to_s.strip\n end\n self[\"#{@name}_#{i+1}\"] = obj = instantiate(data)\n @objects << obj\n end\n end",
"def import_from_csv(file_name)\n # implementation\n csv_text = File.read(file_name)\n # the variable 'csv' is a table type object\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n \n # \n csv.each do |row|\n # create a hash type variable 'row_hash'\n row_hash = row.to_hash\n # use 'add_entry' to change 'row_hash' into 'Entry', also add the new Entry into AddressBook's entries\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"def parse_csv(decoded_data)\n csv = CSV.parse(decoded_data)\n headers = csv.shift\n csv.to_a.map! { |row| Hash[headers.zip(row)] }\n end",
"def read_csv(file_path)\n CSV.parse(File.read(file_path), headers: true)\nend",
"def csv_parse(arg, no_raise: true, no_empty: true, utf8: true, **opt)\n return if arg.nil? || arg.is_a?(Puma::NullIO)\n CSV.parse(arg, **CSV_DEFAULTS, **opt).map { |row|\n row = row.to_h\n next if no_empty && row.values.all?(&:nil?)\n utf8 ? row.transform_values! { |v| force_utf8(v) } : row\n }.compact\n rescue => error\n Log.info { \"#{__method__}: #{error.class}: #{error.message}\" }\n re_raise_if_internal_exception(error)\n raise error unless no_raise\n end",
"def read_csv(csv_file, data)\n logger.info \"Reading #{data.type} data from '#{csv_file} date column = #{@date_column} data starts at col #{@data_start_column} skipping #{@header_rows} header rows\"\n lines = File.readlines(csv_file)\n (@header_rows...lines.length).each do |i|\n reading = lines[i].split(',')\n begin\n date = Date.parse(reading[@date_column])\n rowdata = reading[@data_start_column, @data_start_column + 47].map(&:to_f)\n data.add(date, rowdata)\n rescue StandardError => e\n logger.warn e.message\n logger.warn e.backtrace.join(\"\\n\")\n logger.warn \"Unable to read data on line #{i} of file #{csv_file} date value #{reading[@date_column]}\"\n end\n end\n logger.info \"Read hash #{data.length} rows\"\n end",
"def get_csv_data(csv_file)\n\t\tcsv_file = File.read(csv_file)\n\t\tcsv = CSV.parse(csv_file, :headers => true)\t\n\t\tcsv\n\tend",
"def row_from_csv(csv, line:)\n row_args = %i[timestamp speaker settings content].each_with_object({}) do |key, args|\n args[key] = csv[@key_map[key]]\n args\n end\n\n Row.new(line_number: line, **row_args)\n end",
"def read_1d_csv_file(state_table_path) \r\n rows_read=0\r\n\t\tstate_transition_list= Array.new\r\n\t\tignore_first_row = true\r\n\r\n\t\tCSV::Reader.parse(File.open(state_table_path, 'r').read.gsub(/\\r/,\"\\n\")) do |row_array|\r\n\t\t\t# First row should be the header\r\n\t\t\tif ignore_first_row\r\n\t\t\t\tignore_first_row=false\r\n\t\t\telse\r\n\t\t\t\ttransition = TransitionHolder.new(row_array[STATE1].to_s,row_array[ACTION].to_s,row_array[STATE2].to_s)\r\n\t\t\t\tputs_debug \"Read in transitions: #{transition}\"\r\n\t\t\t\tstate_transition_list.push transition \r\n\t\t\tend # if first row\r\n\t\t\trows_read +=1\r\n\t\tend # end csv block\r\n\r\n raise \"CSV File Empty\" if rows_read==0\r\n raise \"Missing Data in CSV File\" if rows_read==1\r\n \r\n\t\t# return state table, its a raw list of transition objects\r\n\t\treturn state_transition_list\r\n\r\n\tend",
"def load_csv\n options = { headers: :first_row, header_converters: :symbol }\n\n CSV.foreach(@csv_path, options) do |row|\n row[:id] = row[:id].to_i\n row[:price] = row[:price].to_i\n @elements << Meal.new(row)\n end\n @next_id = @elements.empty? ? 1 : @elements.last.id + 1\n end",
"def parse_csv\n CSV.parse(File.read(\"DeleteMe.csv\")) do |row|\n puts row.class\n #project = @rally.find(RallyAPI::RallyQuery.new({:type => :project, :query_string => \"(Name = #{row[\"Name\"]})\"}))\n project = @rally.find(RallyAPI::RallyQuery.new({:type => :project, :query_string => \"(Name = \\\"#{row.first}\\\")\"}))\n puts project\n project = project.first\n fields = {}\n fields[:state] = 'Closed'\n fields[:notes] = close_reason(project)\n project.update(fields)\n end\n # File.open(\"DeleteMe.csv\", \"r\") do |f|\n # f.each_line do |line|\n # puts line\n # end\n # end\n end",
"def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # Iterate over the CSV::Table object's rows. Then create a has for each row.\n # Convert each row_hash to an entry by using add_entry method.\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"def parse_csv_file\n csv_data = CSV.read(\"../artists_for_seed_data.csv\")\n csv_data.shift\n # iterate over each element and send back a hash\n # need to shift again at the beginning to get rid of id on the row\n painter_object_array = []\n csv_data.each do |painter_row_arr|\n \n painter_row_arr.shift\n painter_object = {\n :name => painter_row_arr[0],\n :years => painter_row_arr[1],\n :genre => painter_row_arr[2],\n :nationality => painter_row_arr[3],\n :bio => painter_row_arr[4],\n :painter_num => painter_row_arr[6]\n }\n painter_object_array.push(painter_object)\n end\n painter_object_array.flatten\nend",
"def csv?(csv)\n valid = csv.include?(';')\n valid |= csv.include?(',')\n valid &= csv.include?(\"\\n\")\n valid\n end",
"def load_data(filename)\n return CSV.read(filename, headers: true).map { |line| line.to_h }\nend",
"def load\n CSV.foreach(@csv_file, headers: :first_row, header_converters: :symbol) do |row|\n @data << Employee.new(row)\n end\n end",
"def get_csv(myfile, tabbed = false)\n\n raise \"Unable to read from file '#{myfile}'\" if !File.readable?(myfile) \n\n if tabbed\n recs = CSV::parse(File.open(myfile, 'r'){|f| f.read}, :col_sep => \"\\t\") # this doesn't work on Tab seperated quote delimited\n else\n recs = CSV::parse(File.open(myfile, 'r'){|f| f.read})\n end \n recs ||= []\n recs\n end",
"def parse_csv_line(text_line)\n # Split the text_line by comma\n columns = text_line.split(\",\")\n # But some of the values are padded with spaces\n # And add the cleaned up values to the new array (called values)\n # strip --> predefined string function which trims spaces\n values = []\n columns.each {|x| values << x.strip}\n return values\n\nend",
"def read_csv_data_from_file(full_file_path)\n data = []\n CSV.open(full_file_path, \"r\") do |csv|\n data = csv.readlines\n end\n data\n end",
"def from_string(str, path = nil)\n new(CSV.parse(str, **table_opts), path)\n end",
"def parse\r\n\t\tCSV.foreach(self.filepath) {|row| @list << row}\r\n\t\t@list.flatten!\r\n\tend",
"def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true)\n # Iterate over the table object's rows\n csv.each do |row|\n # Create a hash for each row\n row_hash = row.to_hash\n # Convert each row_hash to an Entry by using add_entry method\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n\n # Get the number of items parsed by calling the count method\n return csv.count\n end",
"def initialize(csv_file_path)\n # take recipe from csv file\n @csv_file_path = csv_file_path\n @recipes = []\n parse\n end",
"def import_from_csv(file)\n entries = Keybox::Convert::CSV.from_file(file)\n entries.each do |entry|\n @db << entry\n end\n hsay \"Imported #{entries.size} records from #{file}.\", :information\n end",
"def csv_parsed\n transform_to_hash(@csv_array, @header)\n end",
"def array_of_articles\n articles = []\n #binding.pry\n CSV.foreach('articles.csv', headers: true) do |row|\n articles << Article.new(row[\"id\"], row[\"title\"], row[\"description\"], row[\"url\"])\n end\n articles\nend",
"def read_data\n\t\tindex = 0\n\t\torders = []\n\t\tCSV.parse(@data_file.read()) do |row|\n\t\t\tif index == 0\n\t\t\t\t#header row\n\t\t\t\t@columns = parse_columns(row[0])\n\t\t\t\t# p @columns\n\t\t\telse\n\t\t\t\t# p row[0]\n \t\t\tdata = row[0].split(\"\\t\")\n \t\t\torders << parse_order(data) \n\t\t\tend\n \t\tindex += 1\n\t\tend\n\t\treturn orders\n\tend",
"def load_data(filename)\n data = CSV.open(filename, 'r', headers: true).map do |line|\n line.to_h\n end\n return data\nend",
"def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend",
"def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend",
"def readCSV pmdReportCSVFile\n\tfile = File.open(pmdReportCSVFile, \"rb\")\n\tcsv_contents = file.read\n\tkeys = [\"Problem\",\"Package\",\"File\",\"Priority\",\"Line\",\"Description\",\"Rule set\",\"Rule\"]\n\treturn CSV.parse(csv_contents).map {|a| Hash[ keys.zip(a) ] }\nend",
"def read_vote_csv(file_name)\n begin\n # @type [Array<Array<String>>]\n csv = CSV.read(file_name)\n rescue Errno::ENOENT\n warn format('Sorry, the file %<File>s does not exist', File: file_name)\n exit 1\n end\n csv.delete_if { |line| line.join('') =~ /^\\s*$/ } # delete blank lines\n csv\nend",
"def import_csv(csv_file)\n data, header = parse_csv(csv_file)\n validate_header(header)\n return if @rollback\n process_data(data, header)\n end",
"def initialize(csv_class_path)\n @path = csv_class_path\n @recipes = CSV.open(@path).map do |row|\n Recipe.new(name: row[0], ingredients: row[1], prep_time: row[2], difficulty: row[3])\n end\n end",
"def import_csv_smart\n \n end",
"def parse(input)\n rownum = 0\n @header = nil if first_line_is_header\n lines = input.each_line.to_a\n lines.each do |line|\n line = line.encode('utf-8')\n rownum += 1\n\n next if rownum <= skip_initial_rows\n next if rownum > lines.size - skip_trailing_rows\n\n values = line.chomp.split(separator)\n\n if first_line_is_header and @header.nil?\n @header = values\n next\n end\n\n begin\n @entries << make_entry(values)\n rescue RuntimeError => e\n raise ParseStreamError.new(\"line #{rownum}: #{e.message}\", e, rownum, line)\n end\n end\n end",
"def parse(args={})\n csv_args = {:skip_blanks=>true,:col_sep=>\",\"}\n csv_args[:col_sep] = args[:col_sep] if args[:col_sep]\n args[:value_filter] ||= Csv2sql.method :default_value_filter\n i = 0\n CSV.foreach(@filename,csv_args) do |row|\n values = row\n #values_filter is for whole row\n #value_filter is for single value\n values = args[:values_filter].call(row, i) if args[:values_filter]\n if values\n if args[:value_filter]\n j = -1\n values = row.map do |value|\n j += 1\n args[:value_filter].call(value,i,j)\n end\n end\n yield values if values\n end\n i += 1\n end\n end",
"def csv(csv_file)\n Slacker.get_csv(csv_file)\n end",
"def load(contents, opts={})\n table = infer_csv_contents(contents, opts)\n return nil unless contents\n table.each do |row|\n self.add(*row)\n end\n end",
"def readToList( filename )\n\treader = CSV::parse(File.open(filename) {|f| f.read} )\n\treturn reader\nend",
"def test_s_parseAndCreate\n colSize = 8\n csvStr = \"foo,!!!foo!!!,!foo,bar!,!!!!!!,!!,,!\\r!,!\\r\\n!\\nNaHi,!!!Na!!!,!Na,Hi!,!\\r.\\n!,!\\r\\n\\n!,!!!!,!\\n!,!\\r\\n!\".gsub!('!', '\"')\n csvStrTerminated = csvStr + \"\\n\"\n\n myStr = csvStr.dup\n res1 = []; res2 = []\n idx = 0\n col, idx = CSV::parse_row(myStr, 0, res1)\n col, idx = CSV::parse_row(myStr, idx, res2)\n\n buf = ''\n col = CSV::generate_row(res1, colSize, buf)\n col = CSV::generate_row(res2, colSize, buf)\n assert_equal(csvStrTerminated, buf)\n\n parsed = []\n CSV::Reader.parse(csvStrTerminated) do |row|\n parsed << row\n end\n\n buf = ''\n CSV::Writer.generate(buf) do |writer|\n parsed.each do |row|\n\twriter.add_row(row)\n end\n end\n assert_equal(csvStrTerminated, buf)\n\n buf = ''\n CSV::Writer.generate(buf) do |writer|\n parsed.each do |row|\n\twriter << row\n end\n end\n assert_equal(csvStrTerminated, buf)\n end",
"def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @linenum += 1\n @record = rec\n next unless check_record(@record)\n seed_record(@record)\n process_record(@record, rec2attrs(@record)) if rec2attrs(@record) != false\n }\n end \n end",
"def parse_to_array(line_as_string)\n as_array = line_as_string.split(\" \")\nend",
"def parse(file_path)\n begin\n rows = CSV.read(file_path, headers: true, header_converters: :symbol, converters: [:all, :blank_to_nil])\n rescue CSV::MalformedCSVError => e\n raise \"Could not parse CSV file. Original error: #{e.message}\"\n rescue StandardError => e\n raise \"Could not load CSV file. Make sure the file has CSV headers. Original error: #{e.message}\"\n end\n @contracts = rows.collect {|row| row.to_hash }\n end",
"def rows\n @rows ||= [].tap do |rows|\n CSV.foreach(csv_file, headers: @has_header_row) do |row|\n rows << columns.map { |column, index| normalize(column, row[index].try(:strip).presence) }\n end\n end\n end",
"def load_csv(csv_file_or_object, table_name, log_name = nil)\n log_name ||= \"load_csv '#{csv_file_or_object.kind_of?(CSV::Table) ? 'CSV Object' : csv_file_or_object }', 'table_name'\"\n csv_object = case csv_file_or_object\n when String then Slacker.get_csv(csv_file_or_object)\n when CSV::Table then csv_file_or_object\n when Array then Slacker.hash_array_to_csv(csv_file_or_object)\n end\n\n Slacker.load_csv(example, csv_object, table_name, log_name)\n end",
"def split_args(str)\n # We need to handle empty strings ourselves; CSV.parse_line() will\n # return [nil].\n return [] if not str or str.empty?\n return CSV.parse_line(str, ' ').map {|i| i.to_s }\n end",
"def read_csv(file)\n reading_list = []\n CSV.foreach(file, :headers => true) do |row|\n reading_list << Book.new({\n 'book_title' => row['book_title'],\n 'isbn' => row['isbn'],\n 'description' => row['description'],\n 'read_date' => row['read_date']\n })\n end\n reading_list\nend"
] |
[
"0.7203955",
"0.69532484",
"0.69352037",
"0.6906603",
"0.6906603",
"0.6905589",
"0.6748106",
"0.66476566",
"0.6629817",
"0.64393413",
"0.6424258",
"0.641854",
"0.6372537",
"0.6286747",
"0.6269038",
"0.60965294",
"0.6086337",
"0.6079646",
"0.6033713",
"0.60110503",
"0.6008343",
"0.60046613",
"0.600142",
"0.5989437",
"0.59867173",
"0.5963341",
"0.59626335",
"0.5959147",
"0.59523064",
"0.5934262",
"0.59322447",
"0.5905397",
"0.5885921",
"0.5883076",
"0.58823866",
"0.58738923",
"0.5870479",
"0.5850103",
"0.58472306",
"0.58428085",
"0.5835455",
"0.580935",
"0.57959604",
"0.5784468",
"0.57236296",
"0.57192415",
"0.56762964",
"0.5666174",
"0.56562704",
"0.55877656",
"0.5564376",
"0.55449414",
"0.55144227",
"0.54872817",
"0.5484816",
"0.5482509",
"0.5481715",
"0.54785824",
"0.54535955",
"0.5444143",
"0.54315513",
"0.5427804",
"0.541528",
"0.54051256",
"0.54041636",
"0.53932816",
"0.5388517",
"0.5385646",
"0.5370753",
"0.5368588",
"0.5368074",
"0.53654087",
"0.53534144",
"0.5350767",
"0.5350369",
"0.53472155",
"0.5343751",
"0.5338646",
"0.5338041",
"0.5327861",
"0.53181964",
"0.53181964",
"0.5306719",
"0.5289512",
"0.5280153",
"0.52696556",
"0.5261556",
"0.524455",
"0.52412474",
"0.5233329",
"0.5223005",
"0.5222807",
"0.5202967",
"0.520038",
"0.51956916",
"0.5192518",
"0.5188992",
"0.5188881",
"0.51732934",
"0.5146242"
] |
0.7536426
|
0
|
Turns an array of CSVEntries (see read) into a String.
|
def write(objects = [])
return '' if objects.empty?
str = ''
vars = objects[0].instance_variables.select! { |v| v != :@i_expect_that_nobody_will_use_this_name }.map { |v| v }
str << vars.map { |i| i[1..-1] }.join(',')
str << "\n"
objects.each_with_index do |obj, obj_indx|
vars.each_with_index do |var, var_indx|
val = obj.instance_variable_get(var)
str << val
str << ',' if var_indx != vars.size - 1
end
str << "\n" if obj_indx != objects.size - 1
end
str
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def csv(array)\n nilfix = array.map { |s| blank(s) ? \"\" : s }\n quoted = nilfix.map { |s| '\"' + s.gsub('\"',\"'\") + '\"' }\n return quoted.join(',')\nend",
"def array_to_string(arr)\n arr.map { |e| \"'#{sanitize(e)}'\" }.join(\",\")\n end",
"def csv_to_s(rows, cols: nil)\n \"\".tap do\n f = CSV.new(StringIO.new(_1))\n csv_write0(f, rows, cols:)\n end\n end",
"def array_to_csvstring(ar)\n word_string = String.new\nar.each{|k,v| word_string << \"#{k}=#{v}_\"}\nreturn word_string[0...-1]\nend",
"def array_to_csvstring(ar)\n word_string = String.new\nar.each{|k,v| word_string << \"#{k}=#{v}_\"}\nreturn word_string[0...-1]\nend",
"def entry_to_csv index\n\t\tcsv_string = \"\\\"\" + @year + \"\\\",\\\"\" + @edition + \"\\\",\" + contents[index].to_csv\n\t\treturn csv_string\n\tend",
"def csv(rows)\n rows.map { |r| r.join(';') }.join(\"\\n\")\n end",
"def to_s\n array = []\n array << @header.to_s if @header\n # add a blank line after header\n array << \"\"\n @entries.each do |entry|\n array << entry.to_s\n end\n array.join(\"\\n\")\n end",
"def to_csv(array)\n @io.rewind\n @io.truncate(0)\n @csv << array\n @io.rewind\n @io.string\n end",
"def create_arr_strs(csv)\n\tarr_of_strings = csv.read.split(\"\\r\")\n\tarr_of_strings\nend",
"def save_as_csv(array)\n final_array = array\n CSV.open(\"emails94.csv\", \"w\") do |csv|\n csv << [\"Nom des Mairies\", \"Emails des Mairies\"]\n final_array.each do |x|\n\n csv << [x.keys.join, x.values.join]\n end\n end\n end",
"def csvize(value)\n [value].join(\",\")\nend",
"def to_s\n result = ''\n @entries.each { |entry| result << entry.to_s << ' ' }\n result\n end",
"def entry_to_str(entry)\n entry.to_s\n end",
"def array_to_string(value)\n result = ''\n value.each { |value| result += to_cli_value(value) + ',' }\n result = '[' + result.chomp(',') + ']'\n end",
"def csv_write(filename,a)\n csv_str = \"\";\n for i in 0..a.size-1 do\n for j in 0..a[i].size-2 do\n csv_str = csv_str + \"\\\"\" + a[i][j].to_s + \"\\\",\"\n end;\n csv_str = csv_str + \"\\\"\" + a[i][j+1].to_s + \"\\\"\\n\";\n end;\n File.write(filename,csv_str);\nend",
"def notes_to_char_string_csv\n notes_to_char_string_array.join(',')\n end",
"def convertFinalArrayToString\n string = \"\"\n @arrayOfElements.each { |row| \n rowString = \"\"\n row.each { |word|\n if \"\" == rowString\n rowString = rowString + word\n else\n rowString = rowString + \" \" + word\n end\n }\n if \"\" == string\n string = rowString\n else\n string = string + \"\\n\" + rowString\n end\n }\n return string\nend",
"def to_s\n @csv_out_data\n end",
"def to_s\n @csv_out_data\n end",
"def to_s\n out = Array.new\n out.push \"file='#{@file}'\"\n out.push \"line='#{@line}'\"\n out.push \"name='#{@name}'\"\n out.push \"arg='#{@arg}'\"\n out.push \"params='#{@params}'\"\n out.push \"initrd='#{@initrd}'\"\n out.push \"type='#{@type}'\"\n return out.join(\", \")\n end",
"def csvString\n resultColumns = self.generateResultColumns\n headers = resultColumns[:columns].keys\n # Start off instantiating the csv string with the header values\n csvString = headers.map{|s| self.filterValue(s)}.join(@options[:delimiter])\n\n # Now iterate over each row, sticking its value under each header\n (0..resultColumns[:maxRowIndex]).each do |rowIndex|\n csvString << \"\\r\\n\"\n csvString << headers.map{ |header|\n self.filterValue(resultColumns[:columns][header][rowIndex])\n }.join(@options[:delimiter])\n end\n return csvString\n end",
"def to_s\n [@rows.collect { |row| row.inspect }].join(\"\\n\")\n end",
"def to_s\n \"[ \" + collect { |e| e.to_s }.join(\", \") + \" ]\"\n end",
"def to_s\n @lines.map { |line| line.to_s }.join(\"\\n\") \n end",
"def to_s\n r = []\n each do |e|\n r << e\n end\n '[' + r.join(', ') + ']'\n end",
"def to_s\r\n to_csv\r\n end",
"def csv\n @name + \",r,\" + @foods.join(\",\")\n end",
"def encode_array(arr)\n arr.join ','\n end",
"def process_row(row)\n row.to_s\n end",
"def format_field_names_as_string(array)\n array.map{ |k| \"'#{k}'\" }.join(',')\n end",
"def convert_to_string\n @data.join(\"\\n\")\n end",
"def serialize(row)\n row\n .map { |c| db_format(c) }\n .join(\",\")\nend",
"def csv_from_row(op, row)\n res = \"\"\n until row.empty?\n entry = row.shift.to_s\n if /[,\"]/ =~ entry\n entry = entry.gsub(/\"/, '\"\"')\n res << '\"' << entry << '\"'\n else\n res << entry\n end\n res << \",\" unless row.empty?\n end\n op << res << CRLF\nend",
"def convert_to_string(ins)\n string = \"\"\n #puts \"convert_to_string...\"\n ins.each do |line|\n string << line\n #p line\n end\n return string\n end",
"def to_csv\n map {|row|\n row.map {|f|\n f =~ /[[:punct:]]/ ? '\"' + f.gsub(/\"/, '\"\"') + '\"' : f }.\n join(\",\")}.\n join(\"\\n\")\n end",
"def back_to_s(array)\n array.join(\"\")\nend",
"def csv\n @name + \",b,\" + @calories.to_s\n end",
"def to_s\n po = ''\n sort_entries.each do |entry|\n po += \"\\n\" unless po.empty?\n po += entry.to_s\n end\n po\n end",
"def to_s\n [line1, line2, \"#{city}, #{state} #{zip}\"].compact.join(\", \")\n end",
"def array_string(array, **opt)\n list_separator = opt[:list_separator] || LIST_SEPARATOR\n normalized_list(array, **opt).join(list_separator)\n end",
"def to_s\n rows.empty? ? '' : rows.collect { |row| row_output_string(row) }.join(\"\\n\")\n end",
"def to_s\n lines = []\n @entries.each do |e|\n # I would prefer to use e.dob.strftime(\"%m/%d/%Y\") here, but can't find an\n # easy way to ditch the leading zeros for months/days < 10...so we have this ugliness\n lines << %{#{e.ln} #{e.fn} #{e.sex} #{e.dob.month}/#{e.dob.day}/#{e.dob.year} #{e.fav_color}\\n}\n end\n lines.to_s\n end",
"def to_s\n # @rows.join(\"\\n\")\n end",
"def to_s\n lines.join(\"\\n\")\n end",
"def csv_string\n CSV.generate do |csv|\n header.write_header csv\n records.each {|r| r.write_record csv}\n end\n end",
"def translateAnswerRow( valArr )\n valStr = \"\"\n index = 0\n valArr.each { |value|\n valStr += ( translateFromFillValue( value, index ) + \",\" )\n index = index + 1\n }\n valStr\n end",
"def csv\n\t\tc = \"#{entrytime},#@entrytype,#@extcmd,#@host,#@service,\"\n\t\tc += \"#@attempt,#@rc,#@state,#@hardsoft,\\\"#@msg\\\",\"\n\t\tc += \"#@contact,#@command,#@ack_author,#@ack_data,\"\n\t\tc\n\tend",
"def to_s\n @data.map(&:to_s).join(\"\\n\")\n end",
"def csv_row\n [\n hub_id,\n tag_id,\n \"%2.2f\" % temperature,\n ACCELERATION_FORMAT % x_acceleration,\n ACCELERATION_FORMAT % y_acceleration,\n ACCELERATION_FORMAT % z_acceleration,\n rssi,\n timestamp.to_i\n ].join(\",\")\n end",
"def to_s\n \"(#{@values.map(&:to_s).join(', ')})\"\n end",
"def to_csv\n str = ''\n str << ( columns.join(\",\") + \"\\n\" )\n rows.each { |row|\n next if is_hr(row) || !row_visible(row)\n str << ( row.map{|x|\n x = x.to_s\n x.gsub(/[\\r\\n]/, ' ').gsub(/\\s+/, ' ').gsub('\"', '\"\"')\n }.map{|x| \"\\\"#{x}\\\"\" }.join(\",\") + \"\\n\" )\n }\n str\n end",
"def strip_csv_quotes(src_path, dest_path)\n\n require 'csv'\n open('LoginHistory-comma-delim.csv', 'w') do |f|\n first_line = true\n CSV.foreach('LoginHistory.csv') do |row|\n if first_line\n first_line = false\n else\n f.puts( row.join(',') )\n end\n \n end\n end\n\nend",
"def to_joined_str (item)\n if (item.class == Array) then\n item.join(\", \")\n else\n item.to_s\n end\nend",
"def get_data_as_text()\n get_data_as_array().join(\", \")\n end",
"def to_s\n str = \"Level: #{@level}\\n\"\\\n \"Entries:\\n\"\n str << entries.map(&:to_s).join(\"\\n\")\n end",
"def to_s\n to_a.join(',')\n end",
"def to_s\n\t\t\t\t'[' << map(&:to_s).join(', ') << ']'\n\t\t\tend",
"def to_s(sep=\"\\t\")\n map do |row|\n row.join(sep)\n end.join(\"\\n\")\n end",
"def to_s\n to_data.map(&:to_s).join(\"\\n\")\n end",
"def array_to_sentence_string(array, connector = T.unsafe(nil)); end",
"def convert_hash_array_to_csv(hash_array)\r\n\t\t\tcsv_string = CSV.generate do |csv|\r\n\t\t\t\tcsv << hash_array.first.keys # adds the attributes name on the first line\r\n\t\t \thash_array.each do |hash|\r\n\t\t \t\tcsv << hash.values\r\n\t\t \tend\r\n\t\t\tend\r\n\t\t\treturn CSV.parse(csv_string, :encoding => 'bom|utf-8')\r\n\t\tend",
"def to_csv\n self.find.map {|row| row.join(',')}.join(\"\\n\")\n end",
"def to_s\n @row.to_s\n end",
"def to_s; map { |name, val| \"#{val['name']}=#{val}\" }.join(','); end",
"def array_to_string arr, type\n if arr.size == 1\n \"#{type}='#{arr[0]}'\"\n else\n \"#{type} in ('#{arr.join(\"','\")}')\"\n # \"#{type} in (#{arr.map { |i| \"'\" + i.to_s + \"'\" }.join(\",\")}) \"\n end\n end",
"def to_string(value)\n # indicate a nil\n if value.nil?\n 'nil'\n end\n\n # join arrays\n if value.class == Array\n return value.join(\", \")\n end\n\n # otherwise return to_s() instead of inspect()\n return value.to_s\n end",
"def printArray(array)\n array.flatten!\n string = \"\"\n array.each {|letter| string << \"#{letter},\"}\n string.chomp(\",\")\nend",
"def add_to_csv(arr)\n\t\t\t\t\t\tCSV.open(\"location-emails.csv\", \"a+\") do |csv|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsv << arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend",
"def hash_to_csvstring(hs)\n word_string = String.new\nhs.each{|k,v| word_string << \"#{k}=#{v}_\"}\nreturn word_string[0...-1]\nend",
"def to_s\n data.map { |ar| ar.map { |v| v.to_s.gsub(/\\t|\\n|\\r/,' ') }.join \"\\t\" }.join( $/ )\n end",
"def stringify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen Symbol\n\t\t\t\t\titem.to_s\n\t\t\t\twhen Array\n\t\t\t\t\tstringify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def stringify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen Symbol\n\t\t\t\t\titem.to_s\n\t\t\t\twhen Array\n\t\t\t\t\tstringify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def stringify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen Symbol\n\t\t\t\t\titem.to_s\n\t\t\t\twhen Array\n\t\t\t\t\tstringify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def to_s\n self.to_a.map {|x| x.to_s}.join\n end",
"def to_s\n self.to_a.map {|x| x.to_s}.join\n end",
"def to_csv(headers=nil)\n headers = Item.csv_headers if headers.nil?\n values = []\n headers.each do |h|\n values << '\"' + self.send(h).to_s + '\"'\n end\n return values.join(\"\\t\")\n end",
"def to_s\n buf = []\n each { |part| buf << part }\n buf.join\n end",
"def tsung_csv(s,e,args)\n CSV.open(@csv_path, \"wb\") do |csv|\n \tfor i in s..e\n \t csv << args.map{|item|\"#{item}#{i}\"}\n end \n end\n end",
"def to_csv\n fields = []\n\n fields << '\"' + key.to_s + '\"'\n fields << '\"' + scientific_name + '\"'\n fields << '\"' + (locality || '') + '\"'\n fields << '\"' + (resource ? resource.name : '') + '\"'\n fields << '\"' + (georef? ? 'TRUE':'FALSE') +'\"'\n fields << '\"' + (date_collected ? date_collected.to_s : '') + '\"'\n fields << '\"' + (latitude ? latitude.to_s : '') + '\"'\n fields << '\"' + (longitude ? longitude.to_s : '') + '\"'\n fields << '\"' + (colcode ? colcode.name : '') + '\"'\n fields << '\"' + (instcode ? instcode.name : '') + '\"'\n fields << '\"' + (catalogue_no ? catalogue_no.to_s : '') + '\"'\n\n fields.join(CSV_SEPARATOR)\n end",
"def return_string_array(array)\n array.collect do |element|\n element.to_s\n end\nend",
"def format_csv()\n require 'iconv'\n \n str = self.to_s\n \n str.gsub!(\",\", \"\")\n str.gsub!(10.chr, \" - \")\n str.gsub!(13.chr, \"\")\n str = Iconv.conv('ISO-8859-1', 'utf-8', str)\n \n return str\n end",
"def quote_array(value)\n \"(#{value.map { |entry| quote_value(entry) }.join(', ')})\"\n end",
"def to_s\n\t\t\t# out = \"\"\n\t\t\t\n\t\t\t# self.each do |i|\n\t\t\t# \tout << i.to_s\n\t\t\t# \tout << ','\n\t\t\t# end\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# self.each do |i|\n\t\t\t# \tout << \"#{i},\"\n\t\t\t# end\n\t\t\t\n\t\t\t# return out\n\t\t\t\n\t\t\treturn self.inject(\"\"){|out, i| out << \"#{i},\"}\n\t\tend",
"def to_csv(options = Hash.new)\n options = options.merge(:force_quotes => true)\n # override only if first element actually has as_csv method\n return old_to_csv(options) unless self.first.respond_to? :as_csv\n # use keys from first row as header columns\n out = first.as_csv.keys.collect{|k| k.to_s.titleize }.to_csv(options)\n # collect all entries as CSV, ensure that no line break is present within values\n self.each { |r| out << r.as_csv.values.to_csv(options).gsub(/\\r?\\n/, ' ').strip! + \"\\n\" }\n # Force encoding to UTF-16LE and add Byte Order Mark for Excel compatibility\n (BOM + out).force_encoding(\"UTF-8\")\n end",
"def to_csv_array\n base_url = \"http://www.lincomp.ch\"\n c = Cart.new\n c.add_product(self)\n shipped_price = (taxed_price.rounded + c.shipping_cost.rounded)\n availability = \"48h\"\n if stock < 1\n availability = \"ask\"\n end\n unless product_pictures.main.empty?\n image_link = base_url + product_pictures.main.first.file.url unless product_pictures.main.first.file.blank?\n end\n unless attachments.empty?\n factsheet_link = base_url + attachments.first.file.url unless attachments.first.file.blank?\n end\n unless categories.empty?\n categories_arr = [] \n categories.each do |c|\n categories_arr << c.fully_qualified_name\n end\n categories_string = categories_arr.join(\"|\")\n end\n\n # We use string interpolation notation (#{foo}) so that nil errors are already\n # handled gracefully without any extra work.\n [\"#{id}\", \"#{manufacturer}\" ,\"#{manufacturer_product_code}\", \"#{name}\",\\\n \"#{description}\", \"#{price.rounded}\", \"#{taxed_price.rounded}\", \"#{shipped_price}\",\\\n \"#{taxes}\", \"#{c.shipping_cost.rounded}\", \"#{stock}\", \"#{availability}\", \"#{weight}\",\\\n \"#{base_url}/products/#{self.id}\",\"#{image_link}\",\"#{factsheet_link}\",\"#{ean_code}\",\\\n \"#{categories_string}\",\"#{c.total_taxed_shipping_price.rounded}\"]\n end",
"def output\n CSV.open(\"test.csv\", \"wb\") do |csv|\n csv << [\"name\",\"type\",\"value\",\"date\"]\n @array_csv.each do |element|\n csv << element\n puts element.inspect\n end\n end\n end",
"def csv(key)\n @data[key].gsub(\",\", \" \")\n end",
"def stringify(arr)\n arr.map { |s| s.to_s }.join(\"<br>\")\n end",
"def to_s\n self.to_a[1,4].map {|x| x.to_s}.join\n end",
"def to_s\n return if empty?\n result = []\n each do |item|\n result << item\n end\n result.join(\"\\n\")\n end",
"def dn_array_to_string(getter_method)\n tmp_str = ''\n value = send(getter_method.to_sym)\n value.each do |el|\n tmp_str += ',' unless tmp_str.empty?\n tmp_str += \"#{getter_method.to_s.upcase}=#{el}\"\n end\n\n tmp_str\n end",
"def arr_to_hc(arr)\n return arr.to_s.gsub(\"\\\"\", \"\\'\")\n end",
"def to_s\n\t\tself.to_a.map {|x| x.to_s}.join\n\tend",
"def to_csv(a_separateur = ';')\n @nom + a_separateur + @devises_conversion.map(&:to_csv).join(a_separateur)\n end",
"def to_s\n @merged_collection_list.to_csv\n end",
"def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend",
"def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend",
"def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend",
"def names_string(names)\n names_array(names).join(', ')\n end",
"def to_s\n out = ''\n @data.each_pair do |key, value|\n out += \"#{key}\\t#{value}\\n\"\n end\n out\n end"
] |
[
"0.65259695",
"0.65242416",
"0.63135713",
"0.63063574",
"0.63063574",
"0.62707233",
"0.61600703",
"0.6146522",
"0.613142",
"0.5907627",
"0.58337617",
"0.57742923",
"0.57685876",
"0.571128",
"0.5704074",
"0.5700728",
"0.56952745",
"0.56589544",
"0.5655195",
"0.5655195",
"0.5630845",
"0.56275487",
"0.5614171",
"0.5590199",
"0.55858195",
"0.55548173",
"0.55455816",
"0.5532566",
"0.5499464",
"0.54606",
"0.5455917",
"0.5436977",
"0.54359365",
"0.542773",
"0.54219395",
"0.54172665",
"0.5408915",
"0.5404193",
"0.53909254",
"0.538572",
"0.53840095",
"0.5358639",
"0.5329884",
"0.53245556",
"0.5306442",
"0.53051436",
"0.5297999",
"0.52894384",
"0.5283943",
"0.5282305",
"0.5276454",
"0.52721536",
"0.5269422",
"0.5268725",
"0.52649236",
"0.52571815",
"0.52530533",
"0.52527595",
"0.52468574",
"0.5246304",
"0.5243845",
"0.5231661",
"0.5223677",
"0.52148867",
"0.52109706",
"0.5203402",
"0.51961464",
"0.5191161",
"0.51832455",
"0.5170032",
"0.5166585",
"0.51661783",
"0.51661783",
"0.51661783",
"0.5148975",
"0.5148975",
"0.5145697",
"0.5140634",
"0.511805",
"0.51106864",
"0.5098191",
"0.50925887",
"0.50827205",
"0.50780135",
"0.5075876",
"0.5053276",
"0.50514996",
"0.5043337",
"0.50396097",
"0.50383",
"0.50326097",
"0.50285476",
"0.50270784",
"0.50263083",
"0.5009885",
"0.50084853",
"0.5001003",
"0.5001003",
"0.5001003",
"0.4995767",
"0.49956164"
] |
0.0
|
-1
|
Try ping three times. Return true if at least one time responds. def ping3
|
def update_ping
result = false
3.times do
command =
"ping -c 1 -W #{PING_MIN_INTERVAL} #{@hostname} 2> /dev/null 1> /dev/null"
if system(command)
result = true
break
end
end
write_cache("ping", result)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ping target, attempts = 5\n try = 0\n while try < attempts\n result = exec(Beaker::Command.new(\"ping -c 1 #{target}\"), :accept_all_exit_codes => true)\n return true if result.exit_code == 0\n\n try += 1\n end\n result.exit_code == 0\n end",
"def ping\n tries = 3\n begin\n # @server.ping\n rescue Exception => e\n retry if (tries -= 1) > 1\n raise e, \"The server is not available (or you do not have permissions to access it)\"\n end\n end",
"def ping?\n cmd = \"ping -c #{@count} -i #{@wait} #{@host}\"\n\n # Execute command and handle resulting exit status from command.\n Open3.popen3(cmd) do |_, _, stderr, thread|\n case thread.value.exitstatus\n when 0 # At least one response was heard from the specified host.\n return true\n when 1 # (Linux) The transmission was successful but no responses were received.\n return false\n when 2 # (OSX) The transmission was successful but no responses were received.\n return false\n else # Error\n raise StandardError, \"Unknown return value from execution of command: #{cmd.inspect}\"\n end\n end\n end",
"def ping()\n\n ip = Resolv.getaddress(@host)\n puts ('ip: ' + ip.inspect).debug if @debug\n valid = pingecho(ip)\n puts ('valid: ' + valid.inspect).debug if @debug \n \n @results[:ping] = if valid then\n a = [valid]\n 4.times {sleep 0.01; a << pingecho(ip)}\n (a.min * 1000).round(3)\n else\n nil\n end\n\n end",
"def ping(host = @host, count = 1, timeout = @timeout)\n raise ArgumentError, 'no host specified' unless host\n raise \"Count must be an integer\" unless count.is_a? Integer\n raise \"Timeout must be a number\" unless timeout.is_a? Numeric\n\n pcmd = ['ping']\n bool = false\n\n case RbConfig::CONFIG['host_os']\n when /linux/i\n pcmd += ['-c', count.to_s, '-W', timeout.to_s, host]\n when /aix/i\n pcmd += ['-c', count.to_s, '-w', timeout.to_s, host]\n when /bsd|osx|mach|darwin/i\n pcmd += ['-c', count.to_s, '-t', timeout.to_s, host]\n when /solaris|sunos/i\n pcmd += [host, timeout.to_s]\n when /hpux/i\n pcmd += [host, \"-n#{count.to_s}\", '-m', timeout.to_s]\n when /win32|windows|msdos|mswin|cygwin|mingw/i\n pcmd += ['-n', count.to_s, '-w', (timeout * 1000).to_s, host]\n else\n pcmd += [host]\n end\n\n start_time = Time.now\n\n begin\n err = nil\n\n Open3.popen3(*pcmd) do |stdin, stdout, stderr, thread|\n stdin.close\n err = stderr.gets # Can't chomp yet, might be nil\n\n case thread.value.exitstatus\n when 0\n info = stdout.read\n if info =~ /unreachable/ix # Windows\n bool = false\n @exception = \"host unreachable\"\n else\n bool = true # Success, at least one response.\n end\n\n if err & err =~ /warning/i\n @warning = err.chomp\n end\n when 2\n bool = false # Transmission successful, no response.\n @exception = err.chomp if err\n else\n bool = false # An error occurred\n if err\n @exception = err.chomp\n else\n stdout.each_line do |line|\n if line =~ /(timed out|could not find host|packet loss)/i\n @exception = line.chomp\n break\n end\n end\n end\n end\n end\n rescue Exception => error\n @exception = error.message\n end\n\n # There is no duration if the ping failed\n @duration = Time.now - start_time if bool\n\n bool\n end",
"def ping(host)\n begin\n Timeout.timeout(5) do\n s = TCPSocket.new(host, 'echo')\n s.close\n return true\n end\n rescue Errno::ECONNREFUSED\n return true\n rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH\n return false\n end\nend",
"def ping\n stats\n true\n rescue Errno::ECONNREFUSED\n false\n end",
"def ping(host)\n res = `ping #{host} -c 1`\n res.include?(\"0% packet loss\")\n end",
"def ping\n if god?\n tries = 3\n begin\n @server.ping\n rescue Exception => e\n retry if (tries -= 1) > 1\n raise e, \"The server is not available (or you do not have permissions to access it)\"\n end\n end\n end",
"def ping?\n false\n end",
"def ping?\n tcp_ping.ping?\n end",
"def ping(host)\n begin\n Timeout.timeout(5) do\n s = TCPSocket.new(host, 'echo')\n s.close\n return true\n end\n rescue Errno::ECONNREFUSED\n return true\n rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH\n return false\n end\n end",
"def check\n tcp_socket_request\n mark_message \"Ping check to #{host}:#{port} successful\"\n rescue => e\n mark_message \"Error: '#{e}'\"\n mark_failure\n end",
"def ping\n true\n end",
"def ifHostUp(host)\n Net::Ping::TCP.econnrefused = true\n Net::Ping::TCP.new(host).ping?\n end",
"def check_host\n result = `ping -q -c 2 #{@conn[:host]}`\n # return true or false if exit status is 0\n $?.exitstatus == 0\n end",
"def ping?(host = @host, options = {})\n ping(host, options).status_code == 0\n end",
"def ping(cmd)\n\tdst = cmd[0]\n next_hop = $next[dst]\n if next_hop == \"NA\" || next_hop == $hostname\n STDOUT.puts \"PING ERROR: HOST UNREACHABLE\"\n return\n end\n n = cmd[1].to_i\n delay = cmd[2].to_i\n client = $clients[next_hop]\n\n # This will iterate through the number of pings given on the command line. It will setup the \n # proper message for pingCallBack and adds the current time to the ping table with the key\n # of the sequence number. It will then check if ping_table has that key still (should be removed\n # by pingCallBack) so if it still exists, then the host was not reached.\n for seq_id in (0..(n - 1))\n msg = Msg.new\n msg.setConfig(\"type\", 3)\n msg.setConfig(\"code\", 0)\n msg.setMessage($hostname + \" \" + dst + \" \" + seq_id.to_s)\n $ping_table[seq_id.to_s] = $currtime\n sendMessage(client, msg)\n Thread.new {\n seq_id_ = seq_id\n sleep($ping_timeout)\n if $ping_table.has_key?(seq_id_.to_s)\n STDOUT.puts \"PING ERROR: HOST UNREACHABLE\"\n end\n $ping_table.delete(seq_id_.to_s)\n }\n sleep(delay)\n end\nend",
"def ping\n return_code, response = send_command(\"ping\")\n return_code == \"200\"\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"def ping(host = @host, options = {})\n host ||= @host\n super(host, options)\n\n timeout = options[:timeout] || @timeout\n\n pcmd = ['ping']\n @success = false\n @response = ''\n\n case RbConfig::CONFIG['host_os']\n when /linux/i\n pcmd += ['-c', '1', '-W', timeout.to_s, host]\n when /aix/i\n pcmd += ['-c', '1', '-w', timeout.to_s, host]\n when /bsd|osx|mach|darwin/i\n pcmd += ['-c', '1', '-t', timeout.to_s, host]\n when /solaris|sunos/i\n pcmd += [host, timeout.to_s]\n when /hpux/i\n pcmd += [host, '-n1', '-m', timeout.to_s]\n when /win32|windows|msdos|mswin|cygwin|mingw/i\n pcmd += ['-n', '1', '-w', (timeout * 1000).to_i.to_s, host]\n else\n pcmd += [host]\n end\n\n start_time = Time.now\n\n begin\n err = nil\n\n Open3.popen3(*pcmd) do |stdin, stdout, stderr, thread|\n stdin.close\n err = stderr.gets # Can't chomp yet, might be nil\n @response = stdout.read\n if thread\n if thread.value.exitstatus == 0\n @success = true # Success, at least one response.\n if err & err =~ /warning/i\n @warning = err.chomp\n end\n else\n set_exception(err)\n end\n elsif @response =~ /\\D0+% (packet )?loss/\n # Linux / windows loss percentage\n @success = true\n elsif @response =~ /\\D(\\d*[1-9]\\d*% (packet )?loss)/\n @exception = \"#{$1}\"\n else\n set_exception(err)\n @exception ||= 'exitstatus could not be checked and stdout did not contain a recognisable loss percentage'\n end\n end\n rescue Exception => error\n @exception = error.message\n end\n\n # There is no duration if the ping failed\n @duration = @success ? Time.now - start_time : nil\n end",
"def ping_result(ip)\n\tres = \"OK\"\n\tres = \"X\" unless pingable? ip\n\n\tputs \"test #{ip}\" + \".\"*20 + res\nend",
"def ping\n every(5) do\n send_ping\n end\n end",
"def ping?\n rpc.request Util::MessageCode::PING_REQUEST\n\n return rpc.status\n end",
"def wan_up?\n `ping -c 1 8.8.8.8 -W 1`.include? \"1 received\"\n end",
"def ping_api\n res=api_call('PingAPI')\n if res[:data]==1\n res=true\n else\n res=false\n end\n res\n end",
"def valid?\n ping\n end",
"def reachable?\n ping\n true\n rescue Orocos::ComError\n false\n end",
"def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end",
"def ping(host, icmp_count = 1)\n cmd = \"ping -c #{icmp_count} #{host}\"\n @logger.info(\"[SystemGateway][ping] Executing #{cmd}...\")\n out = `#{cmd}`\n @logger.info(\"[SystemGateway][ping] Command ended. Output: #{out}\")\n $? == 0\n end",
"def ping(options = {})\n client = extract_client!(options)\n !!client.get(\"/api/system/ping\")\n rescue Error::ConnectionError\n false\n end",
"def ping?(what)\n return system(\"ping -c1 -W2 -q #{what} > /dev/null 2> /dev/null\")\nend",
"def ping?\n response = perform_request\n !!(response =~ Regexp.union(%r(<str name=\"status\">OK</str>), %r(\"status\":\"OK\")))\n end",
"def try(host = 'nodeinfo.hype')\n begin\n Timeout::timeout(5) do\n return true if aaaa(host)\n end\n rescue Timeout::Error\n return false\n end\n end",
"def up?(host)\n check = Net::Ping::External.new(host)\n check.ping?\nend",
"def alive?(host)\n puts \"Checking host: #{host}\"\n Timeout::timeout(@timeout) do\n result = `ping -c 1 #{host}`\n if result.include?(\"time=\")\n return true\n end\n end\n rescue\n return false\n end",
"def ping(nonce = SecureRandom.hex)\t\n\t\t\tbegin\n\t\t\t\tresponse = RestClient.get(build_url(\"ping\") + \"?echo=#{nonce}\")\n\t\t\t\tresponse = JSON.parse(response)\n\n\t\t\t\tresponse[\"echo\"] == nonce\n\t\t\trescue => e\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ping\n @client.peek( name )\n return true\n end",
"def ping!\n send_message [IGNORE, 4, \"ping\"].pack(\"cNA4\")\n end",
"def ping(t)\n \n end",
"def ping\n end",
"def wait_connect(trycnt=10)\n trycnt.times do\n case sts = status\n when 0x00; return\n when 0x23; raise \"SSID not configured\"\n when 0x24; raise \"Encryption key invalid\"\n when 0x27; raise \"SSID was found, but join failed\"\n # else; Object.puts \"status = 0x#{sts.to_s(16)}\"\n end\n end\n raise \"Cannot connect to target\"\n end",
"def ping(host=@host)\n super(host)\n\n bool = false\n start_time = Time.now\n\n # Failure here most likely means bad host, so just bail.\n begin\n addr = Socket.getaddrinfo(host, port)\n rescue SocketError => err\n @exception = err\n return false\n end\n\n begin\n # Where addr[0][0] is likely AF_INET.\n sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)\n\n # This may not be entirely necessary\n sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)\n\n begin\n # Where addr[0][3] is an IP address\n sock.connect_nonblock(Socket.pack_sockaddr_in(port, addr[0][3]))\n rescue Errno::EINPROGRESS\n # No-op, continue below\n rescue Exception => err\n # Something has gone horribly wrong\n @exception = err\n return false\n end\n\n resp = IO.select(nil, [sock], nil, timeout)\n\n if resp.nil? # Assume ECONNREFUSED if nil\n if @@service_check\n bool = true\n else\n bool = false\n @exception = Errno::ECONNREFUSED\n end\n else\n sockopt = sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)\n\n if sockopt.int != 0\n if @@service_check && sockopt.int == Errno::ECONNREFUSED::Errno\n bool = true\n else\n bool = false\n @exception = SystemCallError.new(sockopt.int)\n end\n else\n bool = true\n end\n end\n ensure\n sock.close if sock\n end\n\n # There is no duration if the ping failed\n @duration = Time.now - start_time if bool\n\n bool\n end",
"def ping; end",
"def ping\n response, body = send_request :get, '', :binary\n true\n end",
"def testStatic\n\t`hping3 #{@ip} -c 1 -S -p 32768 -s 80`\n\t`hping3 #{@ip} -c 1 -S -p 138 -s 80`\n\t`hping3 #{@ip} -c 1 --udp -V -p 32768`\n\t`hping3 #{@ip} -c 1 -2 -V -p 137`\n\t`hping3 #{@ip} -c 1 -S -p 111 -s 80`\n\t`hping3 #{@ip} -c 1 -S -p 515 -s 80`\nend",
"def ping\n t = Time.now\n @response = Net::HTTP.get_response(uri)\n rescue Errno::ECONNREFUSED\n rescue Exception => e\n STDERR.puts \"Error fetching #{@url}: #{e}\"\n ensure\n @time = Time.now-t\n @response\n end",
"def ping_url(url)\n begin\n Net::HTTP.get(URI.parse(url))\n return true\n rescue\n return false\n end\n end",
"def ping?\n @raw.start_with? 'PING'\n end",
"def contact\n sleep(5)\n return false\n end",
"def test_ping\n\t@tt.sock.send(@ping, 0)\n=begin\n\t\tpong = @tt.ping_reply\n\t\tassert_equal(42, pong.length)\n\t\tassert_equal(pong[0, 6], @tt.tap_mac)\n\t\tassert_equal(pong[30, 4], @ping[26, 4])\n\t\tassert_equal(pong[26, 4], @ping[30, 4])\n=end\n\tend",
"def test_ping\n\t@tt.sock.send(@ping, 0)\n=begin\n\t\tpong = @tt.ping_reply\n\t\tassert_equal(42, pong.length)\n\t\tassert_equal(pong[0, 6], @tt.tap_mac)\n\t\tassert_equal(pong[30, 4], @ping[26, 4])\n\t\tassert_equal(pong[26, 4], @ping[30, 4])\n=end\n\tend",
"def ping_is_pending?\n return @ping_request\n end",
"def success?\n\t\t\t@ports.select{|p| not p.success}.size + @urls.select{|u| not u.success}.size < 1\n\t\tend",
"def ping?(sitemap_url)\n last_notified = notified_at(sitemap_url)\n last_notified.nil? || Time.now >= last_notified + delay\n end",
"def pingable?\n true\n end",
"def fetch_pg3(id)\n pg3 = nil\n params3 = {\"c\"=>\"app\",\"m\"=>\"show_app\", \"app_id\"=> id}\n begin\n Timeout::timeout(5) {\n pg3 = @br.post(BASE_URL + \"/main.php\",params3,HDR)}\n rescue Exception => exc\n puts \"ERROR: #{exc.message} in get_add() pg3! Trying again in 5 seconds.\"\n sleep 5\n begin\n #ping google, break if internet connection is active\n break if Ping.pingecho(\"google.com\",10,80)\n puts \"waiting for ping google.com...\"\n sleep 2\n end while(true)\n return fetch_pg3(id)\n end\n return pg3\nend",
"def ping(data, timeout = 1)\n if data.kind_of? Numeric\n data = \"\\0\" * data\n end\n # Pad data to have at least 64 bytes.\n data += \"\\0\" * (64 - data.length) if data.length < 64\n \n ping_packet = [@dest_mac, @source_mac, @ether_type, data].join\n\n response = nil\n receive_ts = nil\n send_ts = nil\n begin\n Timeout.timeout timeout do\n send_ts = Time.now\n @socket.send ping_packet, 0\n response = @socket.recv ping_packet.length * 2\n receive_ts = Time.now\n end\n rescue Timeout::Error\n response = nil\n end\n return false unless response\n\n response_packet = [@source_mac, @dest_mac, @ether_type, data].join\n response == response_packet ? receive_ts - send_ts :\n [response, response_packet]\n end",
"def ping(options={})\n begin\n send_message(SkyDB::Message::Ping.new(options))\n return true\n rescue\n return false\n end\n end",
"def checks_passed?\n if blacklisted_wifi?\n puts \"Blacklisted Network; Won't go online\"\n return false\n end\n\n # we don't want to spam himawari's site more than once every 10 minutes while running on a schedule\n return false if by_schedule && now.min % 10 != 1\n\n if `find #{data_path} -name \\\"t_*.png\\\"`.length.positive?\n puts 'Another himawari process is still downloading/processing files.\\n' \\\n '(There are tiles (t_*.png) in the `data` folder.) Quitting w/o overlapping.'\n return false\n end\n\n unless internet_connection?\n puts \"Not online? Can't reach #{HIMAWARI_URL}\"\n return false\n end\n true\n end",
"def retrying?\n @try_count > 1\n end",
"def ping\n client.ping\n end",
"def ping\n http_get('/') == 'Consul Agent'\n rescue\n false\n end",
"def alive?(ip)\n\n ping = \"ping -q -c 1 -w 4\"\n result = `#{ping} #{ip}`\n return $?.exitstatus == 0\n\n end",
"def exists?\n start_time = Time.now\n timeout = resource[:timeout]\n try_sleep = resource[:try_sleep]\n\n success = validator.attempt_connection\n\n while success == false && ((Time.now - start_time) < timeout)\n # It can take several seconds for an HTTP service to start up;\n # especially on the first install. Therefore, our first connection attempt\n # may fail. Here we have somewhat arbitrarily chosen to retry every 2\n # seconds until the configurable timeout has expired.\n Puppet.notice(\"Failed to make an HTTP connection; sleeping #{try_sleep} seconds before retry\")\n sleep try_sleep\n success = validator.attempt_connection\n end\n\n if success\n Puppet.debug(\"Connected to the host in #{Time.now - start_time} seconds.\")\n else\n Puppet.notice(\"Failed to make an HTTP connection within timeout window of #{timeout} seconds; giving up.\")\n end\n\n success\n end",
"def ping(data, timeout = 1)\n data = data.clone\n # Pad data to have at least 64 bytes.\n data += \"\\0\" * (64 - data.length) if data.length < 64\n \n ping_packet = @dest_mac + @source_mac + @ether_type + data\n @socket.send ping_packet, 0\n\n response_packet = @source_mac + @dest_mac + @ether_type + data\n response = @socket.recv response_packet.length * 2\n \n response == response_packet\n end",
"def test(ip, options = {})\n timeout = Integer(options[:timeout] || 30)\n target = options[:target] || '8.8.8.8'\n !!exec(\"ping -w #{timeout} -c 1 -I #{ip} #{target}\")\n end",
"def try_three_times\n tries = 0\n begin\n yield\n rescue Exception => e\n tries += 1\n @log.error(\"Error: #{e.message}\")\n if tries < 3\n @log.error(\"Trying again\")\n retry\n end\n @log.error(\"Tried 3 times without success, aborting.\")\n return nil\n end\n end",
"def ping\n pong = timeout 5, ENODKR do\n system 'docker info > /dev/null 2>&1'\n end\n pong or raise ENODKR\n end",
"def zz_should_retry(connect_attempts, msg)\n return false if connect_attempts >= 4\n\n return false if msg.nil?\n return true if msg.index(\"MySQL server has gone away\")\n return true if msg.index(\"This connection is still waiting for a result, try again\")\n\n return false\n end",
"def ping\n with_client do |client|\n client.ping\n end\n end",
"def ping?\n base_url = url.end_with?(\"/\") ? url[0..-2] : url\n\n if normalized_api_version.nil?\n # for v4\n base_url = url.end_with?(\"/\") ? url[0..-2] : url\n public_url = \"#{base_url}/index.html\"\n else\n # for v5\n public_url = \"#{base_url}/api/v1/status/public\"\n end\n\n http = Net::Ping::HTTP.new(public_url)\n\n # use GET for v5\n http.get_request = true if normalized_api_version\n\n http.ping?\n end",
"def win?\n sleep(3)\n check_points\n end",
"def check_up(targets)\n threads = []\n targets.each do |target_ip|\n threads.append Thread.new { ping_host target_ip.to_s }\n end\n threads.each(&:join)\n @ips_up\n end",
"def can_wait_objection?\n seconds.count >= 2\n end",
"def scanner_pass?(input, delay)\n scanner = PacketScanner.new(input, delay)\n scanner.length.times do |i|\n return false if scanner.caught?(i)\n end\n true\nend",
"def on_ping(x)\n end",
"def test_ping_basic\n @tt.sock.send(@ping, 0)\n pong = @tt.ping_reply\n assert_equal(42, pong.length)\n assert_equal(pong[0, 6], @tt.tap_mac)\n assert_equal(pong[30, 4], @ping[26, 4])\n assert_equal(pong[26, 4], @ping[30, 4])\n end",
"def ip_reachable?(ip)\n external = Net::Ping::External.new(ip)\n\n log_info %(attempting to contact host \"#{ip}\")\n reachable = external.ping || external.ping6\n if reachable\n log_success %(host \"#{ip}\" is reachable)\n else\n log_error %(unable to contact host \"#{ip}\")\n end\n\n reachable\n end",
"def ping\n @conn.ping\n end",
"def ping ip\n ping_result = `ping -c 1 #{ip}`\n if ping_result =~ /( | 0.)0% packet loss/\n ping_result.match(/time=([\\.\\d]*) ms/)[1].to_f.round(1)\n end\n end",
"def wait_for_online\n Puppet.debug \"Waiting #{RETRY_COUNT * RETRY_STEP} seconds for Pacemaker to become online\"\n retry_block_until_true do\n is_online?\n end\n Puppet.debug 'Pacemaker is online'\n end",
"def ping_nodes\n\t\twhile true\n\t\t\tsleep(rand(60))\n\t\t\tn = rand(@neighbour_nodes.count)\n\t\t\tnode = @neighbour_nodes[n]\n\t\t\ts = UDPSocket.new\n\t\t\tbegin\n\t\t\t\tTimeout::timeout(10){ \n\t\t\t\t\tputs \"Pinging #{node}\"\n\t\t\t\t\tsend_message [\"PING\", @info], 0, node.host, node.port\n\t\t\t\t\t@waiting = true\n\t\t\t\t\twhile waiting?\n\t\t\t\t\t\tsleep(0.2)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\trescue Timeout::Error => ex\n\t\t\t\tif waiting?\n\t\t\t\t\tputs \"Conenction to #{node} timed out, sending DROP_NODE to all remaining nodes\"\n\t\t\t\t\t@neighbour_nodes - [node]\n\t\t\t\t\t@neighbour_nodes.each do |n|\n\t\t\t\t\t\tsend_message [\"DROP_NODE\", node], 0, n.host, n.port\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Socket::Error => ex\n\t\t\t\tputs \"Connection to #{node} failed, trying again in 60 seconds\"\n\t\t\trescue => ex\n\t\t\t\tputs ex.message\n\t\t\tend\n\t\tend\n\tend",
"def keepalive_timeout?\n @keepalive_count ||= 0\n @keepalive_count += 1\n @keepalive_count > 10\n end",
"def ping\n sanity_check\n @handle.ping\n end",
"def check\n return true if @checked\n @checked = true\n @spam = akismet(:check) || false\n rescue => boom\n logger.error \"An error occured while connecting to Akismet: #{boom.to_s}\"\n @checked = false\n end",
"def online?\n sock = UDPSocket.new()\n online = false\n begin\n sock.connect('193.0.14.129', 25) # that address is k.root-servers.net\n online = true\n sock.close\n rescue Exception => exception\n puts \"\n------------------------------------------------------------\nCannot bind to socket:\n #{exception}\n\nThis is an indication you have network problems.\nNo online tests will be run!!\n------------------------------------------------------------\n\"\n end\n online\nend",
"def wait_for_server_start\n require 'socket'\n require 'net/http'\n tries = 1\n max_tries = 30\n successes = 0\n max_successes = 2\n wait = 5\n print \"Waiting for the server to start (max tries: #{max_tries} with a #{wait} second pause between tries): \"\n begin\n while tries <= max_tries\n tries += 1\n begin\n Net::HTTP.start(\"localhost\", \"3010\") do |http|\n response = http.get('/')\n if response.code == \"200\"\n print \"O\"\n successes += 1\n return true if successes >= max_successes\n else\n print \"o\"\n end\n end\n rescue SystemCallError => e\n successes = 0\n if tries == max_tries\n print \"!\"\n raise\n end\n print \".\"\n end\n $stdout.flush\n sleep(wait)\n end\n ensure\n puts # Ensure a newline gets added\n $stdout.flush\n end\n return false\nend",
"def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end",
"def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end",
"def is_online?\n #Uses a SYN ping vs ICMP to avoid firewall issues.\n #Tries likely ports to determine if computer is up\n tls = Net::Ping::TCP.new(remote_repository, 443, 1)\n http = Net::Ping::TCP.new(remote_repository, 80, 1)\n ssh = Net::Ping::TCP.new(remote_repository, 22, 1)\n tls.ping or http.ping or ssh.ping\n end",
"def stay_alive?(live_neighbors)\n live_neighbors == 2 || live_neighbors == 3\nend",
"def keepalive_timeout?\n @keepalive_count ||= 0\n @keepalive_count += 1\n @keepalive_count > 10\n end",
"def success?\n\t\t\t@servers.select{|server| not server.success?}.size == 0\n\t\tend",
"def cpu_attempt\n (0..6).each do |c|\n token_placed = board_place_token(c)\n if game_result != NO_RESULT_YET # full send\n @state[:result] = game_result\n update_game_phase(GAME_OVER)\n return true\n elsif token_placed # make sure token was placed before force delete\n board_remove_token(c)\n end\n end\n false\n end",
"def connection?\n check = Netchecker.new() \n @alive = check.check_url(\"google.com\", 80) \n end",
"def ping(t)\n while !@timestamps.empty? && @timestamps.first < t - 3000\n @timestamps.shift\n end\n @timestamps << t\n @timestamps.size\n end",
"def ping(response_timeout=2)\n #Initialize ping result as false\n ping_ok = false\n\n begin\n\n #Ping data\n ping_data = \"\\x4\\x1\\x8\"\n\n $test_logger.log \"Ping with #{Common.unpackbytes(ping_data)}\"\n\n #Ping and check terminal status\n ping_res = call_thrift(nil, response_timeout){terminal_echo(ping_data)}\n\n $test_logger.log \"Ping reply='#{Common.unpackbytes(ping_res)}'\"\n\n raise \"Ping response not matched! Expected='#{Common.unpackbytes(ping_data)}', Actual='#{Common.unpackbytes(ping_res)}'\" if ping_res != ping_data\n\n #Set ping result as true\n ping_ok = true\n rescue Exception => ex\n $test_logger.log_e \"Error in ping!\", ex, false\n end\n\n #Return ping result\n ping_ok\n end",
"def check(type, results)\n # #YELLOW\n num_hosts = hosts_with_data(results)\n return unless config[type] && threshold_crossed?(type, num_hosts)\n\n msg = hosts_threshold_message(config[:target], num_hosts, type)\n send(type, msg)\n end",
"def update_client!(success)\n 5.times do\n push_count = ActionCable.server.broadcast(\"auth_#{@code}\", { success: success })\n return true if push_count.positive?\n\n sleep 0.5\n end\n\n false\n end"
] |
[
"0.6861726",
"0.65738636",
"0.65690535",
"0.635896",
"0.6145886",
"0.6058369",
"0.6047648",
"0.60227",
"0.6017396",
"0.5995556",
"0.59912825",
"0.5983551",
"0.5948659",
"0.5899114",
"0.58788985",
"0.58781224",
"0.5876417",
"0.5875402",
"0.58700114",
"0.5869033",
"0.5845669",
"0.5840264",
"0.5836253",
"0.58174074",
"0.5811177",
"0.5797544",
"0.57673955",
"0.57666266",
"0.5763973",
"0.5726148",
"0.5710578",
"0.57066053",
"0.5704197",
"0.56868005",
"0.5684817",
"0.5670083",
"0.5656261",
"0.55822295",
"0.55771244",
"0.5563402",
"0.5529405",
"0.5529248",
"0.55261517",
"0.55220866",
"0.5500916",
"0.5483702",
"0.5463101",
"0.54595065",
"0.5456262",
"0.54457",
"0.5437863",
"0.5437863",
"0.54257727",
"0.54203296",
"0.5419001",
"0.5402471",
"0.53955716",
"0.5394818",
"0.5382272",
"0.5376446",
"0.5357585",
"0.5343353",
"0.5337867",
"0.53377044",
"0.5334449",
"0.5321981",
"0.53187066",
"0.53179073",
"0.53116983",
"0.53046095",
"0.52994066",
"0.52968764",
"0.5270044",
"0.5266551",
"0.52573633",
"0.5241376",
"0.5238258",
"0.5227425",
"0.52248263",
"0.52195334",
"0.5212778",
"0.5203746",
"0.5200023",
"0.519817",
"0.51847553",
"0.517036",
"0.51686937",
"0.51686466",
"0.51647794",
"0.51647794",
"0.51591474",
"0.5145309",
"0.5133552",
"0.5132994",
"0.51300126",
"0.5117687",
"0.5117328",
"0.51130986",
"0.51106477",
"0.51079994"
] |
0.6751828
|
1
|
Return from cached ping data.
|
def fetch(name)
load_cache(name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_ping(data)\n end",
"def status_from_cache ip\n clean_cache\n node['cloudflare']['threat_control']['status_cache'].fetch(ip)['status'].to_sym\nrescue KeyError\n # not found\n :none\nend",
"def cache_online(mysql_conf:, ping_time:)\n query = <<~SQL\n SELECT hostname FROM lastping WHERE ping_time = '#{ping_time}'\n SQL\n online = {}\n WIKK::SQL.connect(mysql_conf) do |sql|\n sql.each_hash(query) do |row|\n online[row['hostname']] = true\n end\n end\n return online\nend",
"def ping\n self.last_ping = Time.now\n end",
"def ping\n\t\tresult = `ping -c 1 #{ip_address}`\n\t\t# Now extract the time that it took for the ping to come back\n\t\tresult = result.split(\"time=\").last.split(\" \").first\n\t\treturn result\n\tend",
"def get\n @cached_value ||= RedisModel::Base.connection.get(key_label)\n end",
"def ping\n @redis.ping\n end",
"def cache_get(key)\n data = @memcache.get(key)\n Merb.logger.info(\"cache: #{data.nil? ? \"miss\" : \"hit\"} (#{key})\")\n data\n end",
"def ping\n get('')\n end",
"def ping\n @ping = Time.now\n end",
"def ping\n response = connection.get(get_ping_url)\n if response.success?\n PingResponse.new(response.body)\n end\n end",
"def data\n @cache ||= {}\n end",
"def ping()\n #This is a stub, used for indexing\n end",
"def cached?; end",
"def ping()\n #This is a stub, used for indexing\n end",
"def cache(data); end",
"def ping()\n\n ip = Resolv.getaddress(@host)\n puts ('ip: ' + ip.inspect).debug if @debug\n valid = pingecho(ip)\n puts ('valid: ' + valid.inspect).debug if @debug \n \n @results[:ping] = if valid then\n a = [valid]\n 4.times {sleep 0.01; a << pingecho(ip)}\n (a.min * 1000).round(3)\n else\n nil\n end\n\n end",
"def update_ping\n result = false\n 3.times do\n command =\n \"ping -c 1 -W #{PING_MIN_INTERVAL} #{@hostname} 2> /dev/null 1> /dev/null\"\n if system(command)\n result = true\n break\n end\n end\n\n write_cache(\"ping\", result)\n end",
"def cache_hit(response)\n response\n end",
"def ping\n t = Time.now\n @response = Net::HTTP.get_response(uri)\n rescue Errno::ECONNREFUSED\n rescue Exception => e\n STDERR.puts \"Error fetching #{@url}: #{e}\"\n ensure\n @time = Time.now-t\n @response\n end",
"def ping\n TaxCloud::Responses::Ping.parse request(:ping)\n end",
"def get_cached(args)\n cache_key = gen_cache_key(args)\n\n begin\n cached_val = MongoMapper::Document.redis.get(cache_key)\n rescue Exception\n cached_val = nil\n end\n\n unless cached_val\n res = where(args)\n result_count = res.count\n if result_count == 0\n return nil\n elsif result_count == 1\n cached_val = Octo::Utils.serialize(res.first)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n elsif result_count > 1\n cached_val = Octo::Utils.serialize(res)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n end\n end\n begin\n Octo::Utils.deserialize(cached_val)\n rescue Exception => e\n Octo.logger.error e\n nil\n end\n end",
"def summary_ping\n full_ping\n .split(\"\\n\")\n .last(3)\n .join(\"\\n\")\n end",
"def value\n v = connection.get(key)\n rescue Memcached::NotFound\n if block\n value = block.call\n value\n end\n end",
"def cache_get(ck)\n cache_op(:get, ck)\n end",
"def ping_ds_name\n unless @ping_ds_name \n @ping_ds_name = all_stats((Time.now - 1).to_i, Time.now.to_i, 1)[:data][0]\n end\n @ping_ds_name \n end",
"def cache\n DataCache\n end",
"def cache_value?; end",
"def parseping(output)\n res = Hash.new\n begin\n res[:success] = 100 - Integer(output.match(/([[:digit:]]+)% packet loss/m)[1])\n res[:rtt] = Float(output.match(/= [[:digit:]\\.]+\\/([[:digit:]\\.]+)\\//m)[1])\n rescue NoMethodError, TypeError\n # Do nothing, just fall through and return the empty hash.\n end\n res\nend",
"def ping()\n result = SaResult.new()\n\n if lines[0].chop =~ /(.+)\\/(.+) (.+) (.+)/\n result.response_version = $2\n result.response_code = $3\n result.response_message = $4\n end\n\n return result\n\n end",
"def cache_get(key)\n if @cache.key?(key)\n _data, _expire = *cache_read(key)\n if _expire.nil? || Time.now < _expire\n Merb.logger.info(\"cache: hit (#{key})\")\n return _data\n end\n @mutex.synchronize do @cache.delete(key) end\n end\n Merb.logger.info(\"cache: miss (#{key})\")\n nil\n end",
"def data_for(certname)\n logger.info(\"#{name}: Finding data for #{certname}\")\n\n # Only run this if we are using the feature, this will reduce load on\n # the metadata\n if min_age\n # Check the minimum age. This allows simpler foragers to retrieve\n # information for a node every x seconds, as needed. This will be\n # useful for APIs that don't have an \"updated since\" feature\n last_run = metadata[\"#{certname}-last_run\"].to_i\n now = Time.now.to_i\n if (now - last_run) < min_age\n logger.info(\"#{name}: #{certname} not older than min_age, using cache\")\n return cache.get(name, certname)\n else\n metadata[\"#{certname}-last_run\"] = now\n end\n end\n\n case type\n when :ondemand\n data = get_data(certname)\n\n # Only bother caching the data if there is a minimum age set,\n # otherwise the cache will never be used and there is no point\n if min_age != false\n logger.info(\"#{name}: #{certname} updated, persisting to cache\")\n cache.update(name, certname, data)\n end\n\n return data\n when :ondemand_cached\n # Get the data\n data = get_data(certname)\n\n case data\n when nil\n logger.info(\"#{name}: #{certname} not updated, using cache\")\n\n # This means that nothing has changed and we should use the cache\n return cache.get(name, certname)\n when {}\n logger.info(\"#{name}: #{certname} deleted, deleting cached data\")\n\n # When an empty hash is returned it means that we need to delete the\n # cached data and return nothing\n cache.delete(name, certname)\n logger.info(\"#{name}: #{certname} deleted form cache\")\n return nil\n else\n logger.info(\"#{name}: #{certname} updated, persisting to cache\")\n cache.update(name, certname, data)\n logger.info(\"#{name}: #{certname} saved to cache\")\n return data\n end\n when :batch\n # This should always get cached data\n cache.get(name, certname)\n end\n end",
"def get_cached_data(uri)\n Rails.cache.fetch(uri, {expires_in: 24.hours, raw: true}) { JSON.parse(RestClient::Resource.new(uri).get) }\n end",
"def cache_or_fetch(url)\n cache_key = \"badge_host_urls/#{url}\"\n if (cache = $redis.get cache_key)\n cache\n else\n body = Curl.get(url).body_str\n $redis.set cache_key, body\n body\n end\n end",
"def ping\n @conn.ping\n end",
"def ping\n raise NotImplementedError\n end",
"def status_from_cache(country, ref)\n result = @conn.query(\"SELECT status FROM report_statuses WHERE country = '#{country}' AND road_ref = '#{ref}'\")\n\n if result.ntuples == 1\n status = Marshal.restore(PGconn.unescape_bytea(result.getvalue(0, 0)))\n return status\n end\n end",
"def get_cached(cache_key, proc, expiry_time = 5.minute)\n @data = Rails.cache.fetch(cache_key) || proc.call\n @data && Rails.cache.write(cache_key, @data, expires_in: expiry_time)\n\n @data\n end",
"def get(ip)\n return @cache[ip] if @cache.key?(ip)\n url = format(URL_FORMAT, ip)\n response = Curl.get(url).body_str\n ipapi = SimpleGeolocator::IPAPIResponse.new(Oj.load(response))\n @cache[ip] = ipapi\n end",
"def cache_get(key)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n if File.file?(cache_file)\n _data, _expire = Marshal.load(cache_read(cache_file))\n if _expire.nil? || Time.now < _expire\n Merb.logger.info(\"cache: hit (#{key})\")\n return _data\n end\n FileUtils.rm_f(cache_file)\n end\n Merb.logger.info(\"cache: miss (#{key})\")\n nil\n end",
"def ping\n stats\n true\n rescue Errno::ECONNREFUSED\n false\n end",
"def fetch_from_cache\n get_cache_object().get make_key\n end",
"def local_ping(body)\n @var[:ping_request] = Time.now\n body = @var[:our_name] unless _user_keyhash(body)\n _remote_control(body, 'ping', 'empty')\nend",
"def retrieve_from_cache\n retrieved = false\n return retrieved if @_cache_key.nil?\n\n data = Taupe::Cache.get(@_cache_key) || nil\n unless data.nil? || data.empty?\n @_values = data\n retrieved = true\n end\n\n retrieved\n end",
"def now\n cache\n end",
"def fetch( key )\n key = key.to_s.strip unless key.nil?\n raise \"Invalid key\" if key.nil? or key == ''\n\n id,value,hits = @db.get_first_row(\n \"SELECT id,value,hits \"+\n \"FROM #{TABLE_NAME} \"+\n \"WHERE key=?\",\n key.to_s.strip\n )\n\n # Return nil if there is cache MISS.\n return nil if value.nil?\n \n # Increment the number of hits\n if @count_hits\n @db.execute(\n \"UPDATE #{TABLE_NAME} SET hits=?, updated_at=? WHERE id=?\",\n hits.to_i+1, Time.now.to_i, id\n )\n end\n\n # Otherwise if there is a HIT, parse the YAML into an object\n return YAML::load(value)\n end",
"def cached\n self\n end",
"def cache\n IpFilter.cache\n end",
"def cache_get(target_class, *args)\n key = args.dup << target_class\n value_wrapper = @@cache[key]\n if value_wrapper.nil?\n #@@misses += 1\n #puts \"miss (#{@@hits}, #{@@misses}, #{(100.0 * @@hits / (@@hits + @@misses)).round(0)}%)\"\n return nil\n end\n #@@hits += 1\n #puts \"hit (#{@@hits}, #{@@misses}, #{(100.0 * @@hits / (@@hits + @@misses)).round(0)}%)\"\n value_wrapper[0]\n end",
"def cache_fetch(key, default = nil)\n @moneta.fetch(key, default)\n end",
"def now\n cache\n end",
"def now\n cache\n end",
"def ttl\n self[:ip_ttl]\n end",
"def cached\n raise NotImplementedError\n end",
"def get(key)\n @cache[key]\n end",
"def cache_fetch(key, default = nil)\n nkey = namespaced(key)\n\n # Delete expired rows\n @dataset.select.filter(:key => nkey) do\n expires < Time.now\n end.delete\n\n # Get remaining row (if any)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n if result.empty?\n return default\n else\n return deserialize(result.first[:value])\n end\n end",
"def cache_fetch(key, default = nil)\n nkey = namespaced(key)\n\n # Delete expired rows\n @dataset.select.filter(:key => nkey) do\n expires < Time.now\n end.delete\n\n # Get remaining row (if any)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n if result.empty?\n return default\n else\n return deserialize(result.first[:value])\n end\n end",
"def get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n return if entry.expired?\n\n # Otherwise return the cached object.\n # We don't delete the cached entry because we might need to force its use if its expired and offline\n entry.object\n end",
"def get(key)\n @cache[key]\n end",
"def cached_psi\n time_now = Time.now.to_i\n if @cached_psi\n unless ((time_now - @cache_time) > CACHE_DURATION)\n return @cached_psi\n end\n end\n @cached_psi = get_psi\n @cache_time = Time.now.to_i\n @cached_psi\n end",
"def get_responses_json_from_memory_cache\n Rails.cache.fetch(\"responses/#{self.id}\", expires_in: 12.hours) do\n if self.id == 1\n self.responses_json_obama_approval\n else\n self.responses_json\n end\n end\n end",
"def cached_fetch(key)\n fetch(key) do\n return yield unless h = self[:cache]\n Sequel.synchronize{return h[key] if h.has_key?(key)}\n value = yield\n Sequel.synchronize{h[key] = value}\n end\n end",
"def fetch\n self.version = begin\n ver = cache.fetch(CACHE_VERSION_KEY) do\n {'version' => Tml.config.cache[:version] || 'undefined', 't' => cache_timestamp}\n end\n validate_cache_version(ver)\n end\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def get\n Rails.cache.read(session_id, namespace: 'check-in-cache')\n end",
"def ping(t)\n \n end",
"def ping\n response, body = send_request :get, '', :binary\n true\n end",
"def find_cached_entry(key, name, options)\n instrument(:read, name, options) do |payload|\n payload[:super_operation] = :fetch if payload\n res = read_entry(key, options)\n payload[:hit] = !!res if payload\n res\n end\n end",
"def ping ip\n ping_result = `ping -c 1 #{ip}`\n if ping_result =~ /( | 0.)0% packet loss/\n ping_result.match(/time=([\\.\\d]*) ms/)[1].to_f.round(1)\n end\n end",
"def stats\n stats_cache.stats\n end",
"def read(key)\n return if @expires[key] && @expires[key] < Faulty.current_time\n\n @cache[key]\n end",
"def ping_is_pending?\n return @ping_request\n end",
"def feed_data\n if @feed_data.nil?\n unless self.cache_object.nil?\n @feed_data = self.cache_object.feed_data\n end\n end\n return @feed_data\n end",
"def cache_fetch(key, default = nil)\n value = @client.get(key)\n value.nil? ? default : ::Marshal.load(value)\n end",
"def cache_on?; end",
"def cache_on?; end",
"def fetch\n @raw_result = opts_for_cache_proxy[:raw] == true\n\n result = if refresh_cache?\n execute_find(@raw_result)\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n if cached.has_ids? && @raw_result\n self.cached # return it unmodified\n elsif cached.has_ids?\n fetch_from_cache # return a list of active records after applying options\n else # true if we have only calculated the count thus far\n execute_find(@raw_result)\n end\n else\n cached # some base type, return it unmodified\n end\n end",
"def queued_method_data(method)\n Rails.cache.read(queued_method_key(method))\n end",
"def get_data\n (mem, w_cache) = get_mem\n [100*mem.to_f/@total, 100*w_cache.to_f/@total]\n end",
"def ping; end",
"def cache_fetch(key, default = nil)\n # Retrieve the data and return it\n record = @store[:key => namespaced(key)]\n record.value rescue default\n end",
"def cache_look(src, dst)\n #p 'cache'\n res = @redis.get redis_key(src, dst)\n res.to_f if res\n end",
"def cached_session_data\n Authentication::RedisStore.instance.json_get(auth_token)\n end",
"def cache_data?(key, obj)\n if(data = @redis.get(key)).nil? # this data is a json\n\n\t\t\tdata = historical_run(key, obj.map()).to_json\n @redis.set(key, data) # redis must cache a json\n @redis.expire(key,14400)\n\t\tend\n\n return JSON.parse(data) # this data must be changed to object\n end",
"def data; @data ||= fetch; end",
"def _fetch\n cache_get(:_fetch) || @opts[:fetch]\n end",
"def process_retrieval_petition(data)\n\t\tif data.length()>=2\n\t\t\tcommand=data[0]\n\t\t\tkeys=data.drop(1)\n @cache.purge_expired_keys(keys)\n case command\n\t\t\twhen GET_COMMAND\n\t\t\t\treturn @cache.get(keys)\n\t\t\twhen GETS_COMMAND \n\t\t\t\treturn @cache.gets(keys)\n\t\t\telse\n\t\t\t\treturn ERROR_MESSAGE \n\t\t\tend\n\t\telse\n\t\t\treturn CLIENT_ERROR_MESSAGE\n\t\tend\n\tend",
"def fetch_followed\n cache(:expire_in => 2.hours).followed\n end",
"def get(file)\n binding.pry\n #return the values from cached first\n @cached[file] || \n @file_metadata[file] || \n read_metadata_from_yaml(file) || \n cache(file, read_metadata_from_disk(file)) \n end",
"def force_get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n entry.object\n end",
"def ping_time\n Time.zone.at(@packet.created_at.to_i + @device.interval_in_seconds.to_i)\n end",
"def cache_get(key)\n @messages[key] if @messages.has_key?(key)\n end",
"def cached_points\n @cached_points ||= Scout.cache.fetch(['points', cache_key]) {\n points.to_a.select do |point|\n !cached_bye_weeks.include?(point.week)\n end\n }\n end",
"def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n File.open(path, \"r:UTF-8\") do |f|\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end \n end\n return nil\n end"
] |
[
"0.6933489",
"0.6347994",
"0.634467",
"0.619526",
"0.60900897",
"0.60096264",
"0.5960896",
"0.5909245",
"0.58225656",
"0.57883567",
"0.57853013",
"0.5766617",
"0.57516116",
"0.569318",
"0.5675052",
"0.5674137",
"0.5662367",
"0.56117666",
"0.55946875",
"0.5571985",
"0.55473095",
"0.55444413",
"0.55163395",
"0.54960984",
"0.5492215",
"0.5487253",
"0.5481005",
"0.54803586",
"0.5476524",
"0.54632324",
"0.5463067",
"0.5442299",
"0.5436777",
"0.54220235",
"0.5401943",
"0.53929317",
"0.5391879",
"0.5387522",
"0.5385325",
"0.5372625",
"0.5368221",
"0.5362239",
"0.5355624",
"0.5339964",
"0.5337044",
"0.5335572",
"0.5331713",
"0.5325047",
"0.53176177",
"0.53161705",
"0.5312136",
"0.5312136",
"0.5310401",
"0.5304534",
"0.53044665",
"0.52927065",
"0.52927065",
"0.5281252",
"0.52799726",
"0.52764857",
"0.5276413",
"0.5273492",
"0.52704614",
"0.5263772",
"0.5263772",
"0.5263772",
"0.5263772",
"0.5263772",
"0.5263772",
"0.5263772",
"0.5248487",
"0.5248002",
"0.52358943",
"0.5233923",
"0.5231494",
"0.52294064",
"0.52262",
"0.5222992",
"0.5222761",
"0.5222461",
"0.52076614",
"0.52076614",
"0.5206119",
"0.5193229",
"0.519001",
"0.5187329",
"0.518515",
"0.51805943",
"0.51724225",
"0.5172231",
"0.5170456",
"0.5164976",
"0.5162996",
"0.5161853",
"0.515995",
"0.5159903",
"0.51442313",
"0.51398516",
"0.5138297",
"0.5132058"
] |
0.51789427
|
88
|
GET /districts GET /districts.json
|
def index
@districts = District.all.includes(:taluks)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_district_list ( year )\n get_api_resource \"#{@@api_base_url}districts/#{year}\"\n end",
"def show\n @districtclass = Districtclass.find(params[:id])\n @districts = @districtclass.districts.all(:order => 'district_name')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @districtclass }\n end\n end",
"def show\n @clidistrict = Clidistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clidistrict }\n end\n end",
"def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end",
"def district_info_get\n @body_class = 'district'\n @admin = current_admin_user # TODO auth\n @district = @admin.district\n\n @saved = false\n return render 'district_info'\n end",
"def show\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @congressional_district }\n end\n end",
"def show\n @city_district = CityDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @city_district }\n end\n end",
"def find_districts\n organization_id = params[:district_desired_org_id]\n districts = FtaAgency.find_by(id: organization_id).districts\n\n result = []\n districts.each { |d|\n entry = []\n entry << d.id\n entry << d.to_s\n result << entry\n }\n\n @organization_distrcits = result\n respond_to do |format|\n format.json { render json: result.to_json }\n end\n end",
"def show\n @electoral_district = ElectoralDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @electoral_district }\n end\n end",
"def index\n @district_lists = DistrictList.all\n end",
"def index\n @city = city\n @districts = city.districts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @districts }\n end\n end",
"def index\n @title = \"Районы\"\n @districts = District.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @districts }\n end\n end",
"def show\n @title = \"Район\"\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @district }\n end\n end",
"def show\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def get_by_province\n\t\t\tdistricts = District.where(province_id: params[:province_id])\n\n\t\t\treturn render json: { status: 1 } if districts.blank?\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: districts.map{ |district| { id: district.id, name: district.name } }\n\t\t\t}\n\t\tend",
"def show\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def school_districts \n Rollcall::SchoolDistrict.for_user(self).order(:name)\n end",
"def show\n if params[:school_id]\n @district = School.find(params[:school_id]).district\n else\n @district = District.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to @district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @district }\n else\n format.html { render :new }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to @district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @district }\n else\n format.html { render :new }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @district_areas = DistrictArea.all\n end",
"def index\n @district_areas = DistrictArea.all\n end",
"def set_district_list\n @district_list = DistrictList.find(params[:id])\n end",
"def district_name_and_permalink_hash\n districts = {\n \"Magic Kingdom\"=>\"/magic-kingdom/dining.json\", \n \"Epcot\"=>\"/epcot/dining.json\", \n \"Disney's Hollywood Studios\"=>\"/hollywood-studios/dining.json\", \n \"Animal Kingdom\"=>\"/animal-kingdom/dining.json\",\n \"Typhoon Lagoon\"=>\"/typhoon-lagoon/dining.json\",\n \"Blizzard Beach\"=>\"/blizzard-beach/dining.json\",\n 'Downtown Disney' => \"/walt-disney-world/downtown-disney-dining\",\n \"resorts\" => \"/walt-disney-world/resort-dining.json\"\n } \n \n end",
"def index\n @council_districts = CouncilDistrict.all\n end",
"def get_districts_by_year_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DistrictApi.get_districts_by_year ...'\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling DistrictApi.get_districts_by_year\"\n end\n # resource path\n local_var_path = '/districts/{year}'.sub('{' + 'year' + '}', CGI.escape(year.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DistrictList>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DistrictApi#get_districts_by_year\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_team_districts_with_http_info(team_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeamApi.get_team_districts ...'\n end\n # verify the required parameter 'team_key' is set\n if @api_client.config.client_side_validation && team_key.nil?\n fail ArgumentError, \"Missing the required parameter 'team_key' when calling TeamApi.get_team_districts\"\n end\n # resource path\n local_var_path = '/team/{team_key}/districts'.sub('{' + 'team_key' + '}', CGI.escape(team_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DistrictList>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamApi#get_team_districts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @admins_district = Admins::District.new(admins_district_params)\n\n respond_to do |format|\n if @admins_district.save\n format.html { redirect_to @admins_district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @admins_district }\n else\n format.html { render :new }\n format.json { render json: @admins_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_team_districts_with_http_info(team_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DistrictApi.get_team_districts ...'\n end\n # verify the required parameter 'team_key' is set\n if @api_client.config.client_side_validation && team_key.nil?\n fail ArgumentError, \"Missing the required parameter 'team_key' when calling DistrictApi.get_team_districts\"\n end\n # resource path\n local_var_path = '/team/{team_key}/districts'.sub('{' + 'team_key' + '}', CGI.escape(team_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DistrictList>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DistrictApi#get_team_districts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def district\n region_id = DDERegion.find_by_name(\"#{params[:filter_value]}\").id\n region_conditions = [\"name LIKE (?) AND region_id = ? \", \"#{params[:search_string]}%\", region_id]\n\n districts = DDEDistrict.find(:all,:conditions => region_conditions, :order => 'name')\n districts = districts.map do |d|\n \"<li value=\\\"#{d.name}\\\">#{d.name}</li>\"\n end\n render :text => districts.join('') + \"<li value='Other'>Other</li>\" and return\n end",
"def new\n @clidistrict = Clidistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clidistrict }\n end\n end",
"def district\n get_parameters\n @map = GMap.new(\"map_div\")\n @map.control_init(:large_map => true, :map_type => true)\n @map.center_zoom_init([37.420644, -121.021325], 6) # center of California\n load_markers\n\n refresh_district\n end",
"def new\n @districtclass = Districtclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @districtclass }\n end\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def new\n @congressional_district = CongressionalDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congressional_district }\n end\n end",
"def new\n @city_district = CityDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @city_district }\n end\n end",
"def index\n @search = Admins::District.ransack(params[:q])\n @admins_districts = @search.result.paginate(page: params[:page], per_page: 10)\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def index\n @communities = @district.communities.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @communities }\n end\n end",
"def get_team_history_districts ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/history/districts\"\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n if params[:all]\n @districts = District.order(:distname).all\n @active_districts = District.active\n else\n @districts = District.order(:distname).page params[:page]\n @active_districts = District.active\n end\n end",
"def show\n @community = @district.communities.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @community }\n end\n end",
"def index\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @hes = district.hes\n else\n @hes = He.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hes }\n end\n end",
"def destroy\n @congressional_district = CongressionalDistrict.find(params[:id])\n @congressional_district.destroy\n\n respond_to do |format|\n format.html { redirect_to congressional_districts_url }\n format.json { head :no_content }\n end\n end",
"def district_params\n params.require(:district).permit(:name,\n :locality_id,\n :districts => [])\n end",
"def show\n @shared_district = Shared::District.find(params[:id])\n @title_view = 'Distritos'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shared_district }\n format.json { render :json => @shared_district }\n end\n end",
"def show\n @city = city\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @district }\n end\n end",
"def index\n if params[:field].present? && params[:keyword].present?\n @districts = District.all.where([\"#{params[:field]} like ?\", \"%#{params[:keyword]}%\"]).page(params[:page]).per(params[:per])\n else\n @districts = District.all.page(params[:page]).per(params[:per])\n end\n end",
"def new\n @electoral_district = ElectoralDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @electoral_district }\n end\n end",
"def destroy\n @city_district = CityDistrict.find(params[:id])\n @city_district.destroy\n\n respond_to do |format|\n format.html { redirect_to city_districts_url }\n format.json { head :ok }\n end\n end",
"def districts_locate(*args)\n get('/districts/locate', extract_location(args))\n end",
"def districts\n self.projects.collect do |proj|\n proj.locations\n end.flatten.uniq\n end",
"def destroy\n @clidistrict = Clidistrict.find(params[:id])\n @clidistrict.destroy\n\n respond_to do |format|\n format.html { redirect_to clidistricts_url }\n format.json { head :ok }\n end\n end",
"def district_params\n params.fetch(:district, {})\n end",
"def district_params\n params.fetch(:district, {})\n end",
"def get_event_district_points ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/district_points\"\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to [:admin, @district], notice: '区县创建成功!' }\n format.json { render action: 'show', status: :created, location: @district }\n else\n format.html { render action: 'new' }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @dnas = Dna.all\n\n render json: @dnas\n end",
"def get_district_events ( district_key, year )\n get_api_resource \"#{@@api_base_url}district/#{district_key}/#{year}/events\"\n end",
"def departments\n render json: Department.all.order(:name).includes(:regional_name).map{|x| {id: x.id, name: x.rgnl_name}}\n end",
"def create\n @district = District.new(params[:district])\n\n respond_to do |format|\n if @district.save\n flash[:notice] = 'District was successfully created.'\n format.html { redirect_to(@district) }\n format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @district_list = DistrictList.new(district_list_params)\n\n respond_to do |format|\n if @district_list.save\n format.html { redirect_to @district_list, notice: 'District list was successfully created.' }\n format.json { render :show, status: :created, location: @district_list }\n else\n format.html { render :new }\n format.json { render json: @district_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n flash[:success] = \"Район успешно удален.\"\n format.html { redirect_to districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @city_district = CityDistrict.new(params[:city_district])\n\n respond_to do |format|\n if @city_district.save\n format.html { redirect_to @city_district, :notice => 'City district was successfully created.' }\n format.json { render :json => @city_district, :status => :created, :location => @city_district }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @city_district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @council_district.destroy\n respond_to do |format|\n format.html { redirect_to council_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_city_districts_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @clidistrict = Clidistrict.new(params[:clidistrict])\n\n respond_to do |format|\n if @clidistrict.save\n format.html { redirect_to @clidistrict, notice: 'Clidistrict was successfully created.' }\n format.json { render json: @clidistrict, status: :created, location: @clidistrict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clidistrict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to admin_districts_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end",
"def show\n @district = District.find_by_permalink(params[:id])\n @eateries = @district.eateries\n @photos = @district.photos.all\n if @photos.length < 5\n \t@photos =[]\n \t@e = @district.eateries\n \t@e.each{|e| @photos << e.photos}\n \t@photos = @photos.flatten.to_a\n end\n \n @photo = @photos.last\n @photos = @photos.to_a.first(2)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @district }\n end\n end",
"def create\n @district = city.districts.build(params[:district])\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully created.') }\n #format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def show\n @department = Department.find(params[:department_id])\n @towns = @department.towns.find(params[:id])\n respond_to do |format|\n format.json { render json: @town, status: :ok } \n end \n end",
"def get_district_teams ( district_key, year )\n get_api_resource \"#{@@api_base_url}district/#{district_key}/#{year}/teams\"\n end",
"def dresses\n render json: { collections: Collection.published_dresses }\n end",
"def district_events\n start = Time.now\n\n # action is in app controller\n\t\tjson = get_district_events\n\n respond_to do |format|\n format.json { render json: json}\n end\n\t\tlogger.debug \"@ time to render district events json: #{Time.now-start} seconds\"\n end",
"def new\n @title = \"Добавление района\"\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @district }\n end\n end",
"def create\n @congressional_district = CongressionalDistrict.new(params[:congressional_district])\n\n respond_to do |format|\n if @congressional_district.save\n format.html { redirect_to @congressional_district, notice: 'Congressional district was successfully created.' }\n format.json { render json: @congressional_district, status: :created, location: @congressional_district }\n else\n format.html { render action: \"new\" }\n format.json { render json: @congressional_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def index\n if current_user.district_id and !current_user.admin?\n @cases = Case.where(\"district_id = #{current_user.district_id}\").order(\"id desc\").page params[:page]\n else\n # @cases = Case.all\n @cases = Case.order(\"id desc\").page params[:page]\n end\n # @cases = Case.order(\"id desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cases }\n end\n end",
"def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end",
"def destroy\n @admins_district.destroy\n respond_to do |format|\n format.html { redirect_to admins_districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @hefans = Hefan.page(params[:page])\n @district = District.all\n end",
"def locations\n if params[:oblast].present? and params[:district].present?\n @locations = { :hospitals => Hospital.where(:oblast => params[:oblast], :district => params[:district]).map { |r|\n { id:r.id, name:r.name,address:r.display_address } \n } }\n elsif params[:oblast].present?\n @locations = { :districts => Hospital.select(\"district\").where(:oblast => params[:oblast]).order(:district).uniq.map { |r| r[:district] } }\n else \n @locations = { }\n end\n\n respond_with @locations\n end",
"def district_params\n params.require(:district).permit(:name)\n end",
"def set_district_area\n \n\t r = open(\"http://localhost:3001/district_areas/\" + params[:id] + \".json\").read\n\t #r = open(\"http://floating-chamber-80486.herokuapp.com/district_areas/1.json\").read\n\t hash = JSON.parse(r)\n\t upzsJSON = hash[\"upzs\"]\n\t hash.delete(\"url\")\n\t hash.delete(\"upzs\")\n\t p hash\n\t p upzsJSON\n\t @district_area = DistrictArea.new(hash)\n\t p @district_area.inspect\n\t \n\t upzsJSON.each do |currentUPZ|\n\t\t@district_area.upzs << Upz.new(currentUPZ)\n\t\tend\n\trescue \n\t\t p \"EL RECURSOO NO EXISTEEEEEE\"\n\t\trender json: {}, status: :ok\n\tend",
"def get_district_uuid\n rpc_get_fact_direct('district_uuid')\n end",
"def destroy\n @electoral_district = ElectoralDistrict.find(params[:id])\n @electoral_district.destroy\n\n respond_to do |format|\n format.html { redirect_to electoral_districts_url }\n format.json { head :no_content }\n end\n end",
"def index\n @magisterial_districts = MagisterialDistrict.where(user_id: current_user.user_id).search(params[:search]).paginate(page: params[:page], per_page: 50).order('updated_at DESC')\n end",
"def doctors_and_cities\n cities_dict, doctor_dict = current_user.dictionaries.where(resource_type: [\"Doctors\", \"Cities\"])\n render json: {doctors: doctor_dict.words.select(:id, :body),\n cities: cities_dict.words.select(:id, :body)}\n end"
] |
[
"0.7804373",
"0.7537338",
"0.71356726",
"0.71229523",
"0.711125",
"0.71006674",
"0.7097041",
"0.700757",
"0.6957552",
"0.6886389",
"0.6882672",
"0.68217546",
"0.66347384",
"0.66016793",
"0.6533538",
"0.64426905",
"0.6438084",
"0.6401699",
"0.63545704",
"0.63545704",
"0.63251716",
"0.63251716",
"0.63155276",
"0.6300323",
"0.62798846",
"0.6269594",
"0.6268581",
"0.6243274",
"0.6242926",
"0.6203853",
"0.6201974",
"0.617049",
"0.61506337",
"0.6135571",
"0.6135571",
"0.6135571",
"0.6103929",
"0.6087744",
"0.6074142",
"0.6073601",
"0.6073601",
"0.6072166",
"0.60643405",
"0.60532993",
"0.6046477",
"0.5983198",
"0.5983198",
"0.59777707",
"0.5976498",
"0.59463334",
"0.5941722",
"0.5941569",
"0.59242266",
"0.5919439",
"0.5916463",
"0.5914169",
"0.5902776",
"0.58846027",
"0.5884451",
"0.5878466",
"0.5863969",
"0.5860967",
"0.5827438",
"0.5811575",
"0.5772933",
"0.57536507",
"0.5743587",
"0.57428235",
"0.57336265",
"0.5730062",
"0.5726346",
"0.5725618",
"0.57239145",
"0.5723327",
"0.57222503",
"0.57134783",
"0.5708119",
"0.56873363",
"0.568047",
"0.5673896",
"0.5673896",
"0.56682575",
"0.56641364",
"0.56588364",
"0.56495786",
"0.56484264",
"0.564743",
"0.56419796",
"0.56365424",
"0.5631744",
"0.56247",
"0.5624646",
"0.5622998",
"0.56196815",
"0.5606786",
"0.5598345",
"0.5594321",
"0.55928016",
"0.5590494",
"0.5549669"
] |
0.6722273
|
12
|
GET /districts/1 GET /districts/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @districtclass = Districtclass.find(params[:id])\n @districts = @districtclass.districts.all(:order => 'district_name')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @districtclass }\n end\n end",
"def show\n @clidistrict = Clidistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clidistrict }\n end\n end",
"def show\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @congressional_district }\n end\n end",
"def show\n @city_district = CityDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @city_district }\n end\n end",
"def show\n @electoral_district = ElectoralDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @electoral_district }\n end\n end",
"def get_district_list ( year )\n get_api_resource \"#{@@api_base_url}districts/#{year}\"\n end",
"def district_info_get\n @body_class = 'district'\n @admin = current_admin_user # TODO auth\n @district = @admin.district\n\n @saved = false\n return render 'district_info'\n end",
"def show\n @title = \"Район\"\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @district }\n end\n end",
"def show\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end",
"def show\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def show\n if params[:school_id]\n @district = School.find(params[:school_id]).district\n else\n @district = District.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def index\n @city = city\n @districts = city.districts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @districts }\n end\n end",
"def new\n @clidistrict = Clidistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clidistrict }\n end\n end",
"def index\n @title = \"Районы\"\n @districts = District.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @districts }\n end\n end",
"def find_districts\n organization_id = params[:district_desired_org_id]\n districts = FtaAgency.find_by(id: organization_id).districts\n\n result = []\n districts.each { |d|\n entry = []\n entry << d.id\n entry << d.to_s\n result << entry\n }\n\n @organization_distrcits = result\n respond_to do |format|\n format.json { render json: result.to_json }\n end\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def new\n @congressional_district = CongressionalDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congressional_district }\n end\n end",
"def index\n @district_lists = DistrictList.all\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to @district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @district }\n else\n format.html { render :new }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to @district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @district }\n else\n format.html { render :new }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @districtclass = Districtclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @districtclass }\n end\n end",
"def new\n @city_district = CityDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @city_district }\n end\n end",
"def get_by_province\n\t\t\tdistricts = District.where(province_id: params[:province_id])\n\n\t\t\treturn render json: { status: 1 } if districts.blank?\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: districts.map{ |district| { id: district.id, name: district.name } }\n\t\t\t}\n\t\tend",
"def index\n @districts = District.all.includes(:taluks)\n end",
"def set_district_list\n @district_list = DistrictList.find(params[:id])\n end",
"def create\n @admins_district = Admins::District.new(admins_district_params)\n\n respond_to do |format|\n if @admins_district.save\n format.html { redirect_to @admins_district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @admins_district }\n else\n format.html { render :new }\n format.json { render json: @admins_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @city = city\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @district }\n end\n end",
"def show\n @community = @district.communities.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @community }\n end\n end",
"def show\n @shared_district = Shared::District.find(params[:id])\n @title_view = 'Distritos'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shared_district }\n format.json { render :json => @shared_district }\n end\n end",
"def new\n @electoral_district = ElectoralDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @electoral_district }\n end\n end",
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @title = \"Добавление района\"\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @district }\n end\n end",
"def get_district_uuid\n rpc_get_fact_direct('district_uuid')\n end",
"def destroy\n @congressional_district = CongressionalDistrict.find(params[:id])\n @congressional_district.destroy\n\n respond_to do |format|\n format.html { redirect_to congressional_districts_url }\n format.json { head :no_content }\n end\n end",
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def district\n get_parameters\n @map = GMap.new(\"map_div\")\n @map.control_init(:large_map => true, :map_type => true)\n @map.center_zoom_init([37.420644, -121.021325], 6) # center of California\n load_markers\n\n refresh_district\n end",
"def district_name_and_permalink_hash\n districts = {\n \"Magic Kingdom\"=>\"/magic-kingdom/dining.json\", \n \"Epcot\"=>\"/epcot/dining.json\", \n \"Disney's Hollywood Studios\"=>\"/hollywood-studios/dining.json\", \n \"Animal Kingdom\"=>\"/animal-kingdom/dining.json\",\n \"Typhoon Lagoon\"=>\"/typhoon-lagoon/dining.json\",\n \"Blizzard Beach\"=>\"/blizzard-beach/dining.json\",\n 'Downtown Disney' => \"/walt-disney-world/downtown-disney-dining\",\n \"resorts\" => \"/walt-disney-world/resort-dining.json\"\n } \n \n end",
"def destroy\n @city_district = CityDistrict.find(params[:id])\n @city_district.destroy\n\n respond_to do |format|\n format.html { redirect_to city_districts_url }\n format.json { head :ok }\n end\n end",
"def index\n @council_districts = CouncilDistrict.all\n end",
"def destroy\n @clidistrict = Clidistrict.find(params[:id])\n @clidistrict.destroy\n\n respond_to do |format|\n format.html { redirect_to clidistricts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @denomination = Denomination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denomination }\n end\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_districts_by_year_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DistrictApi.get_districts_by_year ...'\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling DistrictApi.get_districts_by_year\"\n end\n # resource path\n local_var_path = '/districts/{year}'.sub('{' + 'year' + '}', CGI.escape(year.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DistrictList>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DistrictApi#get_districts_by_year\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to [:admin, @district], notice: '区县创建成功!' }\n format.json { render action: 'show', status: :created, location: @district }\n else\n format.html { render action: 'new' }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @district_chief = DistrictChief.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @district_chief }\n end\n end",
"def create\n @city_district = CityDistrict.new(params[:city_district])\n\n respond_to do |format|\n if @city_district.save\n format.html { redirect_to @city_district, :notice => 'City district was successfully created.' }\n format.json { render :json => @city_district, :status => :created, :location => @city_district }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @city_district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @clidistrict = Clidistrict.new(params[:clidistrict])\n\n respond_to do |format|\n if @clidistrict.save\n format.html { redirect_to @clidistrict, notice: 'Clidistrict was successfully created.' }\n format.json { render json: @clidistrict, status: :created, location: @clidistrict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clidistrict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @district_areas = DistrictArea.all\n end",
"def index\n @district_areas = DistrictArea.all\n end",
"def show\n @department = Department.find(params[:department_id])\n @towns = @department.towns.find(params[:id])\n respond_to do |format|\n format.json { render json: @town, status: :ok } \n end \n end",
"def get_team_districts_with_http_info(team_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeamApi.get_team_districts ...'\n end\n # verify the required parameter 'team_key' is set\n if @api_client.config.client_side_validation && team_key.nil?\n fail ArgumentError, \"Missing the required parameter 'team_key' when calling TeamApi.get_team_districts\"\n end\n # resource path\n local_var_path = '/team/{team_key}/districts'.sub('{' + 'team_key' + '}', CGI.escape(team_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DistrictList>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamApi#get_team_districts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @district = District.new(params[:district])\n\n respond_to do |format|\n if @district.save\n flash[:notice] = 'District was successfully created.'\n format.html { redirect_to(@district) }\n format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def district\n parts[1]\n end",
"def show\n @distraction = Distraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distraction }\n end\n end",
"def get_team_districts_with_http_info(team_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DistrictApi.get_team_districts ...'\n end\n # verify the required parameter 'team_key' is set\n if @api_client.config.client_side_validation && team_key.nil?\n fail ArgumentError, \"Missing the required parameter 'team_key' when calling DistrictApi.get_team_districts\"\n end\n # resource path\n local_var_path = '/team/{team_key}/districts'.sub('{' + 'team_key' + '}', CGI.escape(team_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DistrictList>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DistrictApi#get_team_districts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @congressional_district = CongressionalDistrict.new(params[:congressional_district])\n\n respond_to do |format|\n if @congressional_district.save\n format.html { redirect_to @congressional_district, notice: 'Congressional district was successfully created.' }\n format.json { render json: @congressional_district, status: :created, location: @congressional_district }\n else\n format.html { render action: \"new\" }\n format.json { render json: @congressional_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_city_districts_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @district = city.districts.build(params[:district])\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully created.') }\n #format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def school_districts \n Rollcall::SchoolDistrict.for_user(self).order(:name)\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end",
"def new\n @city = city\n @district = @city.districts.build\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @district }\n end\n end",
"def district\n region_id = DDERegion.find_by_name(\"#{params[:filter_value]}\").id\n region_conditions = [\"name LIKE (?) AND region_id = ? \", \"#{params[:search_string]}%\", region_id]\n\n districts = DDEDistrict.find(:all,:conditions => region_conditions, :order => 'name')\n districts = districts.map do |d|\n \"<li value=\\\"#{d.name}\\\">#{d.name}</li>\"\n end\n render :text => districts.join('') + \"<li value='Other'>Other</li>\" and return\n end",
"def set_schooldistrict\n @schooldistrict = Schooldistrict.find(params[:id])\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n flash[:success] = \"Район успешно удален.\"\n format.html { redirect_to districts_url }\n format.json { head :no_content }\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def index\n @communities = @district.communities.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @communities }\n end\n end",
"def show\n @dress = Dress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dress }\n end\n end",
"def show\n @disease = Disease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disease }\n end\n end",
"def show\n @district = District.find_by_permalink(params[:id])\n @eateries = @district.eateries\n @photos = @district.photos.all\n if @photos.length < 5\n \t@photos =[]\n \t@e = @district.eateries\n \t@e.each{|e| @photos << e.photos}\n \t@photos = @photos.flatten.to_a\n end\n \n @photo = @photos.last\n @photos = @photos.to_a.first(2)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @district }\n end\n end",
"def destroy\n @council_district.destroy\n respond_to do |format|\n format.html { redirect_to council_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @electoral_district = ElectoralDistrict.find(params[:id])\n @electoral_district.destroy\n\n respond_to do |format|\n format.html { redirect_to electoral_districts_url }\n format.json { head :no_content }\n end\n end",
"def create\n @district_list = DistrictList.new(district_list_params)\n\n respond_to do |format|\n if @district_list.save\n format.html { redirect_to @district_list, notice: 'District list was successfully created.' }\n format.json { render :show, status: :created, location: @district_list }\n else\n format.html { render :new }\n format.json { render json: @district_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @hes = district.hes\n else\n @hes = He.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hes }\n end\n end",
"def show\n if params[:id] == \"0\"\n self.current_district = nil\n else\n @district = District.find(params[:id])\n self.current_district = @district\n self.current_community = @district.community\n end\n redirect_to self.current_community\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to admin_districts_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end",
"def district_params\n params.fetch(:district, {})\n end",
"def district_params\n params.fetch(:district, {})\n end",
"def show\n @case = Case.find(params[:id])\n if current_user.district_id and !current_user.admin? and @case.district_id != current_user.district_id\n redirect_to cases_path\n else\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case }\n end\n end\n end",
"def set_admins_district\n @admins_district = Admins::District.find(params[:id])\n end",
"def districts_locate(*args)\n get('/districts/locate', extract_location(args))\n end",
"def district_params\n params.require(:district).permit(:name,\n :locality_id,\n :districts => [])\n end",
"def create\n @electoral_district = ElectoralDistrict.new(params[:electoral_district])\n\n respond_to do |format|\n if @electoral_district.save\n format.html { redirect_to @electoral_district, notice: 'Electoral district was successfully created.' }\n format.json { render json: @electoral_district, status: :created, location: @electoral_district }\n else\n format.html { render action: \"new\" }\n format.json { render json: @electoral_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @diary = current_user.diaries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diary }\n end\n end",
"def show\n @lodge = Lodge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lodge }\n end\n end",
"def set_district_area\n \n\t r = open(\"http://localhost:3001/district_areas/\" + params[:id] + \".json\").read\n\t #r = open(\"http://floating-chamber-80486.herokuapp.com/district_areas/1.json\").read\n\t hash = JSON.parse(r)\n\t upzsJSON = hash[\"upzs\"]\n\t hash.delete(\"url\")\n\t hash.delete(\"upzs\")\n\t p hash\n\t p upzsJSON\n\t @district_area = DistrictArea.new(hash)\n\t p @district_area.inspect\n\t \n\t upzsJSON.each do |currentUPZ|\n\t\t@district_area.upzs << Upz.new(currentUPZ)\n\t\tend\n\trescue \n\t\t p \"EL RECURSOO NO EXISTEEEEEE\"\n\t\trender json: {}, status: :ok\n\tend",
"def get_team_history_districts ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/history/districts\"\n end",
"def show\n @breadcrumb = 'read'\n @street_directory = StreetDirectory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @street_directory }\n end\n end",
"def destroy\n @admins_district.destroy\n respond_to do |format|\n format.html { redirect_to admins_districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @schema = self.schema\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datacenter }\n end\n end",
"def show\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dental }\n end\n end",
"def district_code\n district.try(:code)\n end",
"def show\n \n @municipality = Municipality.find(params[:state_id],params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipality }\n end\n end"
] |
[
"0.7618955",
"0.7602007",
"0.7562016",
"0.75585264",
"0.7389093",
"0.73535764",
"0.73185223",
"0.7141811",
"0.71397454",
"0.71239215",
"0.6902166",
"0.68801874",
"0.6741882",
"0.6722628",
"0.67122036",
"0.67121875",
"0.66947186",
"0.66947186",
"0.66947186",
"0.66247153",
"0.66247153",
"0.6618016",
"0.6601901",
"0.6601694",
"0.659703",
"0.659703",
"0.6596091",
"0.65867776",
"0.6548462",
"0.64680326",
"0.6446801",
"0.6431075",
"0.64013374",
"0.6389866",
"0.63864887",
"0.6381679",
"0.63025254",
"0.6247986",
"0.6241044",
"0.62135804",
"0.6208847",
"0.6183347",
"0.61754996",
"0.6147765",
"0.6126518",
"0.61201936",
"0.60780054",
"0.60780054",
"0.6070175",
"0.60682684",
"0.60682684",
"0.60498804",
"0.60471463",
"0.60354084",
"0.603526",
"0.6031438",
"0.6026852",
"0.6026852",
"0.6022265",
"0.60204077",
"0.60203147",
"0.6014749",
"0.6011554",
"0.5991514",
"0.5988697",
"0.5974182",
"0.5968492",
"0.59584045",
"0.595815",
"0.5951171",
"0.59386826",
"0.5934489",
"0.59339553",
"0.5921387",
"0.5889106",
"0.58713967",
"0.58631706",
"0.5857191",
"0.5853586",
"0.5848705",
"0.5838497",
"0.582299",
"0.5797889",
"0.57903534",
"0.57883716",
"0.5785597",
"0.57748216",
"0.57687694",
"0.57403296",
"0.57315344",
"0.57194406",
"0.57191783",
"0.5718689",
"0.5713551",
"0.5713526",
"0.5712725",
"0.56998044",
"0.56920964",
"0.5689579",
"0.568801",
"0.5685304"
] |
0.0
|
-1
|
POST /districts POST /districts.json
|
def create
@district = District.new(district_params)
respond_to do |format|
if @district.save
format.html { redirect_to @district, notice: 'District was successfully created.' }
format.json { render :show, status: :created, location: @district }
else
format.html { render :new }
format.json { render json: @district.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @admins_district = Admins::District.new(admins_district_params)\n\n respond_to do |format|\n if @admins_district.save\n format.html { redirect_to @admins_district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @admins_district }\n else\n format.html { render :new }\n format.json { render json: @admins_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def district_params\n params.require(:district).permit(:name,\n :locality_id,\n :districts => [])\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to [:admin, @district], notice: '区县创建成功!' }\n format.json { render action: 'show', status: :created, location: @district }\n else\n format.html { render action: 'new' }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @city_district = CityDistrict.new(params[:city_district])\n\n respond_to do |format|\n if @city_district.save\n format.html { redirect_to @city_district, :notice => 'City district was successfully created.' }\n format.json { render :json => @city_district, :status => :created, :location => @city_district }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @city_district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @district = city.districts.build(params[:district])\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully created.') }\n #format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @electoral_district = ElectoralDistrict.new(params[:electoral_district])\n\n respond_to do |format|\n if @electoral_district.save\n format.html { redirect_to @electoral_district, notice: 'Electoral district was successfully created.' }\n format.json { render json: @electoral_district, status: :created, location: @electoral_district }\n else\n format.html { render action: \"new\" }\n format.json { render json: @electoral_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @congressional_district = CongressionalDistrict.new(params[:congressional_district])\n\n respond_to do |format|\n if @congressional_district.save\n format.html { redirect_to @congressional_district, notice: 'Congressional district was successfully created.' }\n format.json { render json: @congressional_district, status: :created, location: @congressional_district }\n else\n format.html { render action: \"new\" }\n format.json { render json: @congressional_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clidistrict = Clidistrict.new(params[:clidistrict])\n\n respond_to do |format|\n if @clidistrict.save\n format.html { redirect_to @clidistrict, notice: 'Clidistrict was successfully created.' }\n format.json { render json: @clidistrict, status: :created, location: @clidistrict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clidistrict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district = District.new(params[:district])\n\n respond_to do |format|\n if @district.save\n flash[:notice] = 'District was successfully created.'\n format.html { redirect_to(@district) }\n format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @committees_district = CommitteesDistrict.new(committees_district_params)\n\n respond_to do |format|\n if @committees_district.save\n format.html { redirect_to @committees_district, notice: 'Committees district was successfully created.' }\n format.json { render :show, status: :created, location: @committees_district }\n else\n format.html { render :new }\n format.json { render json: @committees_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district_list = DistrictList.new(district_list_params)\n\n respond_to do |format|\n if @district_list.save\n format.html { redirect_to @district_list, notice: 'District list was successfully created.' }\n format.json { render :show, status: :created, location: @district_list }\n else\n format.html { render :new }\n format.json { render json: @district_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @districtclass = Districtclass.new(params[:districtclass])\n\n respond_to do |format|\n if @districtclass.save\n format.html { redirect_to @districtclass, notice: 'Districtclass was successfully created.' }\n format.json { render json: @districtclass, status: :created, location: @districtclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @districtclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district_area = DistrictArea.new(district_area_params)\n\n respond_to do |format|\n if @district_area.save\n format.html { redirect_to @district_area, notice: 'District area was successfully created.' }\n format.json { render :show, status: :created, location: @district_area }\n else\n format.html { render :new }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district_area = DistrictArea.new(district_area_params)\n\n respond_to do |format|\n if @district_area.save\n format.html { redirect_to @district_area, notice: 'District area was successfully created.' }\n format.json { render :show, status: :created, location: @district_area }\n else\n format.html { render :new }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end",
"def district_params\n params.require(:district).permit(:name)\n end",
"def district_params\n params.require(:district).permit!\n end",
"def create\n @title = \"Редактирование района\"\n @district = District.new(params[:district])\n\n respond_to do |format|\n if @district.save\n flash[:success] = \"Район успешно добавлен.\"\n format.html { redirect_to @district }\n format.json { render json: @district, status: :created, location: @district }\n else\n flash.now[:error] = \"Район с таким названием не может быть добавлен!\"\n format.html { render action: \"new\" }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def district_params\n params.require(:district).permit(:name, :code, :regional_name_value, taluks_attributes: \n [:id, :_destroy, :name, :code, :regional_name_value, panchayats_attributes:\n [:id, :_destroy, :name, :code, :regional_name_value, places_attributes: \n [:id, :_destroy, :name, :code, :place_type, :regional_name_value]\n ]\n ])\n end",
"def create\n @council_district = CouncilDistrict.new(council_district_params)\n\n respond_to do |format|\n if @council_district.save\n format.html { redirect_to @council_district, notice: 'Council district was successfully created.' }\n format.json { render action: 'show', status: :created, location: @council_district }\n else\n format.html { render action: 'new' }\n format.json { render json: @council_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def district_params\n params.require(:district).permit(:code, :name, :active, :region_id, :country_id, :note)\n end",
"def district_params\n params.require(:district).permit(:nombre, :diputado, :prioridad, :observaciones, :image, :city_id, :election_id, :result_id, :report_id)\n end",
"def schooldistrict_params\n params.require(:schooldistrict).permit(:name, :state, :city, :zip)\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def new\n @districtclass = Districtclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @districtclass }\n end\n end",
"def district_list_params\n params.require(:district_list).permit(:name)\n end",
"def district_params\n params.fetch(:district, {})\n end",
"def create\n @department = Department.find(params[:department_id])\n @town = @department.towns.new(town_params)\n respond_to do |format|\n if @town.save\n format.json { render json: @town, status: :ok }\n else\n format.json { render json: @town.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_district_list\n @district_list = DistrictList.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def admins_district_params\n params.require(:admins_district).permit(:name, :state_id, :number)\n end",
"def new\n @clidistrict = Clidistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clidistrict }\n end\n end",
"def district_params\n params.fetch(:district, {})\n end",
"def set_district_area\n \n\t r = open(\"http://localhost:3001/district_areas/\" + params[:id] + \".json\").read\n\t #r = open(\"http://floating-chamber-80486.herokuapp.com/district_areas/1.json\").read\n\t hash = JSON.parse(r)\n\t upzsJSON = hash[\"upzs\"]\n\t hash.delete(\"url\")\n\t hash.delete(\"upzs\")\n\t p hash\n\t p upzsJSON\n\t @district_area = DistrictArea.new(hash)\n\t p @district_area.inspect\n\t \n\t upzsJSON.each do |currentUPZ|\n\t\t@district_area.upzs << Upz.new(currentUPZ)\n\t\tend\n\trescue \n\t\t p \"EL RECURSOO NO EXISTEEEEEE\"\n\t\trender json: {}, status: :ok\n\tend",
"def set_district\n @district = District.find(params[:id])\n end",
"def find_districts\n organization_id = params[:district_desired_org_id]\n districts = FtaAgency.find_by(id: organization_id).districts\n\n result = []\n districts.each { |d|\n entry = []\n entry << d.id\n entry << d.to_s\n result << entry\n }\n\n @organization_distrcits = result\n respond_to do |format|\n format.json { render json: result.to_json }\n end\n end",
"def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end",
"def new\n @congressional_district = CongressionalDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congressional_district }\n end\n end",
"def create\n if (user_signed_in? && ([2].include?(current_user.role)))\n @shared_district = Shared::District.new(params[:shared_district])\n @title_view = 'Distritos'\n @provinces = Shared::Province.all\n respond_to do |format|\n if @shared_district.save\n format.html { redirect_to(@shared_district, :notice => 'Se ha creado correctamente el distrito.') }\n format.xml { render :xml => @shared_district, :status => :created, :location => @shared_district }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shared_district.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def new\n @title = \"Добавление района\"\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @district }\n end\n end",
"def new\n @city_district = CityDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @city_district }\n end\n end",
"def create_blank_district(name)\n district = District.create(name: @district_name)\n # district.welcome_title = \"Welcome Title Goes Here\"\n # district.welcome_message = \"Welcome Message Goes Here\"\n # district.welcomer_name = \"Welcomer Name Goes Here\"\n # district.welcomer_title = \"Welcomer Title Goes Here\"\n # district.save\n return district\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @electoral_district = ElectoralDistrict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @electoral_district }\n end\n end",
"def district_name_and_permalink_hash\n districts = {\n \"Magic Kingdom\"=>\"/magic-kingdom/dining.json\", \n \"Epcot\"=>\"/epcot/dining.json\", \n \"Disney's Hollywood Studios\"=>\"/hollywood-studios/dining.json\", \n \"Animal Kingdom\"=>\"/animal-kingdom/dining.json\",\n \"Typhoon Lagoon\"=>\"/typhoon-lagoon/dining.json\",\n \"Blizzard Beach\"=>\"/blizzard-beach/dining.json\",\n 'Downtown Disney' => \"/walt-disney-world/downtown-disney-dining\",\n \"resorts\" => \"/walt-disney-world/resort-dining.json\"\n } \n \n end",
"def new\n @city = city\n @district = @city.districts.build\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @district }\n end\n end",
"def create\n\t@clidistrict_array = Clidistrict.find(:all).collect {|p| [ p.name, p.id ] }\n\t@documenttype_array = Documenttype.find(:all).collect {|p| [ p.name, p.id ] }\n @fulcliente = Fulcliente.new(params[:fulcliente])\n\n respond_to do |format|\n if @fulcliente.save\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully created.' }\n format.json { render json: @fulcliente, status: :created, location: @fulcliente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate_districts(districts)\n uniq_districts = []\n districts.each do |district|\n if (uid_exists?(\"district\", did = district[\"ident\"].to_s))\n if (uniq_districts.include?(district))\n val_warn(\"Duplicate District Declaration\", did, \"in Jurisdiction Definition\")\n else\n val_err(\"Non-Unique District UID\", did, \"in Jurisdiction Definition\")\n end\n else \n uniq_districts.push(district)\n uid_add(\"district\", did)\n end\n end\n end",
"def get_district_list ( year )\n get_api_resource \"#{@@api_base_url}districts/#{year}\"\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def index\n @district_lists = DistrictList.all\n end",
"def show\n @districtclass = Districtclass.find(params[:id])\n @districts = @districtclass.districts.all(:order => 'district_name')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @districtclass }\n end\n end",
"def destroy\n @congressional_district = CongressionalDistrict.find(params[:id])\n @congressional_district.destroy\n\n respond_to do |format|\n format.html { redirect_to congressional_districts_url }\n format.json { head :no_content }\n end\n end",
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def create\n @dress = Dress.new(params[:dress])\n\n respond_to do |format|\n if @dress.save\n format.html { redirect_to @dress, notice: 'Dress was successfully created.' }\n format.json { render json: @dress, status: :created, location: @dress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n flash[:success] = \"Район успешно удален.\"\n format.html { redirect_to districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city_district = CityDistrict.find(params[:id])\n @city_district.destroy\n\n respond_to do |format|\n format.html { redirect_to city_districts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @council_district.destroy\n respond_to do |format|\n format.html { redirect_to council_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clidistrict = Clidistrict.find(params[:id])\n @clidistrict.destroy\n\n respond_to do |format|\n format.html { redirect_to clidistricts_url }\n format.json { head :ok }\n end\n end",
"def district_area_params\n params.require(:district_area).permit(:name, :initialZipCode, :lastZipCode, :surfaceArea, :population, :density)\n end",
"def create\n @diary = Diary.create!(params[:diary])\n respond_to do |format|\n format.html { redirect_to diaries_url }\n format.js\n end\n end",
"def create\n @dn = Dn.new(dn_params)\n\n respond_to do |format|\n if @dn.save\n format.html { redirect_to @dn, notice: 'Dn was successfully created.' }\n format.json { render :show, status: :created, location: @dn }\n else\n format.html { render :new }\n format.json { render json: @dn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to admin_districts_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end",
"def district_area_params\n params.require(:district_area).permit(:name, :initialZipCode, :lastZipCode, :surfaceArea, :population, :density, :shape, :latitude, :longitude, :city_id)\n end",
"def create\n @denomination = Denomination.new(params[:denomination])\n\n respond_to do |format|\n if @denomination.save\n format.html { redirect_to @denomination, notice: 'Denomination was successfully created.' }\n format.json { render json: @denomination, status: :created, location: @denomination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @denomination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @title = \"Районы\"\n @districts = District.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @districts }\n end\n end",
"def create\n @student = current_district.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = \"#{edit_obj_link(@student)} was successfully created.\".html_safe\n format.html { redirect_to(index_url_with_page) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @denomination = Denomination.new(denomination_params)\n\n respond_to do |format|\n if @denomination.save\n format.html { redirect_to @denomination, notice: 'Denomination was successfully created.' }\n format.json { render :show, status: :created, location: @denomination }\n else\n format.html { render :new }\n format.json { render json: @denomination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @admins_district.destroy\n respond_to do |format|\n format.html { redirect_to admins_districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def committees_district_params\n params.require(:committees_district).permit(:votes)\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_city_districts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @electoral_district = ElectoralDistrict.find(params[:id])\n @electoral_district.destroy\n\n respond_to do |format|\n format.html { redirect_to electoral_districts_url }\n format.json { head :no_content }\n end\n end",
"def set_schooldistrict\n @schooldistrict = Schooldistrict.find(params[:id])\n end",
"def create\n @community = @district.communities.new(params[:community])\n\n respond_to do |format|\n if @community.save\n format.html { redirect_to admin_district_communities_url, notice: 'Community was successfully created.' }\n format.json { render json: @community, status: :created, location: @community }\n else\n format.html { render action: \"new\" }\n format.json { render json: @community.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @district_areas = DistrictArea.all\n end",
"def index\n @district_areas = DistrictArea.all\n end",
"def create\n @duty_nurse = DutyNurse.new(duty_nurse_params)\n\n respond_to do |format|\n if @duty_nurse.save\n format.html { redirect_to @duty_nurse, notice: 'Duty nurse was successfully created.' }\n format.json { render :show, status: :created, location: @duty_nurse }\n else\n format.html { render :new }\n format.json { render json: @duty_nurse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n flash[:success] = \"Район успешно отредактирован.\"\n format.html { redirect_to @district }\n format.json { head :no_content }\n else\n flash.now[:error] = \"Введены неверные данные!\"\n format.html { render action: \"edit\" }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new(params[:shipping_address])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address.save\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully created.' }\n format.json { render json: @shipping_address, status: :created, location: @shipping_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @city = city\n @districts = city.districts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @districts }\n end\n end",
"def update_districts_with_states(num_districts)\n if num_districts.nil? or num_districts == 0\n num_districts = 1\n end\n state_id = num_districts + 1\n members = []\n state_id, members = @pre_requisites[:seas].shift if @pre_requisites[:seas].size > 0\n\n @world[\"seas\"] << {\"id\" => state_id,\n \"courses\" => (@scenarioYAML['COURSES_ON_SEA'] && create_courses(state_id)),\n \"staff\" => create_staff_for_state_education_agency(members),\n \"programs\" => create_programs_for_education_organization(\"seas\", :STATE_EDUCATION_AGENCY),\n \"studentCompetencyObjectives\" => create_sco_for_education_organization(state_id)\n }\n\n @world[\"leas\"].each { |edOrg| edOrg[\"parent\"] = state_id }\n @queue.push_work_order GraduationPlanFactory.new(state_id, @scenarioYAML)\n end",
"def school_params\n params.require(:school).permit(:name, :schooldistrict_id)\n end",
"def index\n @districts = District.all.includes(:taluks)\n end",
"def create\n @desease = Desease.new(desease_params)\n\n if @desease.save\n render json: @desease, status: :ok\n else\n render json: @desease.errors, status: :unprocessable_entity\n end\n end",
"def run_districts(parties, delete_only=false)\n view_name = \"#{self.analysis_table_name} - #{@@shapes[:district]}\"\n @@client.execute(\"drop view if exists `#{@@analysis_db}`.`#{view_name}`\")\n if !delete_only\n sql = \"create view `#{@@analysis_db}`.`#{view_name}` as\n select `raw`.`region` AS `region`,\n `raw`.`district_id` AS `district_id`,\n `raw`.`district_name` AS `district_Name`,\n sum(`raw`.`num_possible_voters`) AS `possible voters`,\n sum(`raw`.`num_votes`) AS `total ballots cast`,\n sum(`raw`.`num_valid_votes`) AS `total valid ballots cast`,\n ifnull(sum(`invalid_ballots_01`.`num_invalid_ballots`),\n 0) AS `num invalid ballots from 0-1%`,\n ifnull(sum(`invalid_ballots_13`.`num_invalid_ballots`),\n 0) AS `num invalid ballots from 1-3%`,\n ifnull(sum(`invalid_ballots_35`.`num_invalid_ballots`),\n 0) AS `num invalid ballots from 3-5%`,\n ifnull(sum(`invalid_ballots_>5`.`num_invalid_ballots`),\n 0) AS `num invalid ballots >5%`,\n (100 * (sum(`raw`.`num_valid_votes`) / sum(`raw`.`num_possible_voters`))) AS `percent voters voting`,\n sum(`raw`.`logic_check_fail`) AS `num precincts logic fail`,\n (100 * (sum(`raw`.`logic_check_fail`) / count(0))) AS `percent precincts logic fail`,\n (sum(`raw`.`logic_check_difference`) / sum(`raw`.`logic_check_fail`)) AS `avg precinct logic fail difference`,\n sum(`raw`.`more_ballots_than_votes_flag`) AS `num precincts more ballots than votes`,\n (100 * (sum(`raw`.`more_ballots_than_votes_flag`) / count(0))) AS `percent precincts more ballots than votes`,\n (sum(`raw`.`more_ballots_than_votes`) / sum(`raw`.`more_ballots_than_votes_flag`)) AS `avg precinct difference more ballots than votes`,\n sum(`raw`.`more_votes_than_ballots_flag`) AS `num precincts more votes than ballots`,\n (100 * (sum(`raw`.`more_votes_than_ballots_flag`) / count(0))) AS `percent precincts more votes than ballots`,\n (sum(`raw`.`more_votes_than_ballots`) / sum(`raw`.`more_votes_than_ballots_flag`)) AS `avg precinct difference more votes than ballots`,\n sum(`raw`.`supplemental_documents_flag`) AS `num precincts with supplemental documents`,\n (100 * (sum(`raw`.`supplemental_documents_flag`) / count(0))) AS `percent precincts with supplemental documents`,\n (sum(`raw`.`supplemental_document_count`) / sum(`raw`.`supplemental_documents_flag`)) AS `avg precinct supplemental document count`,\n sum(`raw`.`amendment_flag`) AS `num precincts with amendment`,\n (100 * (sum(`raw`.`amendment_flag`) / count(0))) AS `percent precincts with amendment`,\n sum(`raw`.`explanatory_note_flag`) AS `num precincts with explanatory note`,\n (100 * (sum(`raw`.`explanatory_note_flag`) / count(0))) AS `percent precincts with explanatory note`,\n sum(`raw`.`num_at_12`) AS `votes 8-12`,\n sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) AS `votes 12-17`,\n sum((`raw`.`num_votes` - `raw`.`num_at_17`)) AS `votes 17-20`,\n (sum(`raw`.`num_at_12`) / count(0)) AS `avg votes/precinct 8-12`,\n (sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) / count(0)) AS `avg votes/precinct 12-17`,\n (sum((`raw`.`num_votes` - `raw`.`num_at_17`)) / count(0)) AS `avg votes/precinct 17-20`,\n (sum(`raw`.`num_at_12`) / 240) AS `vpm 8-12`,\n (sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) / 180) AS `vpm 12-17`,\n (sum((`raw`.`num_votes` - `raw`.`num_at_17`)) / 300) AS `vpm 17-20`,\n ((sum(`raw`.`num_at_12`) / 240) / count(0)) AS `avg vpm/precinct 8-12`,\n ((sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) / 180) / count(0)) AS `avg vpm/precinct 12-17`,\n ((sum((`raw`.`num_votes` - `raw`.`num_at_17`)) / 200) / count(0)) AS `avg vpm/precinct 17-20`,\n ifnull(sum(`vpm1`.`vpm > #{@@vpm_limit}`),\n 0) AS `num precincts vpm 8-12 > #{@@vpm_limit}`,\n ifnull(sum(`vpm2`.`vpm > #{@@vpm_limit}`),\n 0) AS `num precincts vpm 12-17 > #{@@vpm_limit}`,\n ifnull(sum(`vpm3`.`vpm > #{@@vpm_limit}`),\n 0) AS `num precincts vpm 17-20 > #{@@vpm_limit}`,\n ((ifnull(sum(`vpm1`.`vpm > #{@@vpm_limit}`),\n 0) + ifnull(sum(`vpm2`.`vpm > #{@@vpm_limit}`),\n 0)) + ifnull(sum(`vpm3`.`vpm > #{@@vpm_limit}`),\n 0)) AS `num precincts vpm > #{@@vpm_limit}`,\n `precinct_count`.`num_precincts` AS `num_precincts_possible`,\n count(`raw`.`precinct_id`) AS `num_precincts_reported_number`,\n ((100 * count(`raw`.`precinct_id`)) / `precinct_count`.`num_precincts`) AS `num_precincts_reported_percent`,\n \"\n party_sql = []\n parties.each do |party|\n party_name = \"#{party[:id]} - #{party[:name]}\"\n party_sql << \"sum(`raw`.`#{party_name}`) AS `#{party_name} count`,\n (100 * (sum(`raw`.`#{party_name}`) / sum(`raw`.`num_valid_votes`))) AS `#{party_name}`\"\n end\n sql << party_sql.join(', ')\n if self.has_indepenedent_parties?\n sql << \", sum(`raw`.`#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME}`) AS `#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME} count`,\n (100 * (sum(`raw`.`#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME}`) / sum(`raw`.`num_valid_votes`))) AS `#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME}` \"\n end\n\n sql << \" from ((((((((`#{@@analysis_db}`.`#{self.analysis_table_name} - raw` `raw`\n join `#{@@analysis_db}`.`#{self.analysis_table_name} - precinct count by district` `precinct_count` on((`raw`.`district_id` = `precinct_count`.`district_id`)))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - vpm 8-12>#{@@vpm_limit}` `vpm1` on(((`raw`.`region` <=> `vpm1`.`region`) and (`raw`.`district_id` = `vpm1`.`district_id`) and (`raw`.`precinct_id` = `vpm1`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - vpm 12-17>#{@@vpm_limit}` `vpm2` on(((`raw`.`region` <=> `vpm2`.`region`) and (`raw`.`district_id` = `vpm2`.`district_id`) and (`raw`.`precinct_id` = `vpm2`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - vpm 17-20>#{@@vpm_limit}` `vpm3` on(((`raw`.`region` <=> convert(`vpm3`.`region` using utf8)) and (`raw`.`district_id` = `vpm3`.`district_id`) and (`raw`.`precinct_id` = `vpm3`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots 0-1` `invalid_ballots_01` on(((`raw`.`region` <=> `invalid_ballots_01`.`region`) and (`raw`.`district_id` = `invalid_ballots_01`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_01`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots 1-3` `invalid_ballots_13` on(((`raw`.`region` <=> `invalid_ballots_13`.`region`) and (`raw`.`district_id` = `invalid_ballots_13`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_13`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots 3-5` `invalid_ballots_35` on(((`raw`.`region` <=> `invalid_ballots_35`.`region`) and (`raw`.`district_id` = `invalid_ballots_35`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_35`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots >5` `invalid_ballots_>5` on(((`raw`.`region` <=> `invalid_ballots_>5`.`region`) and (`raw`.`district_id` = `invalid_ballots_>5`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_>5`.`precinct_id`))))\n where `raw`.`is_annulled` = 0\"\n\n if self.has_custom_shape_levels?\n sql << \" and (`raw`.`district_id` not between 1 and 10) \"\n end\n sql << \" group by `raw`.`region`, `raw`.`district_name`, `raw`.`district_id`\"\n\n if self.has_custom_shape_levels?\n sql << \" union \"\n\n sql << \"select `raw`.`region` AS `region`,\n 999 AS `district_id`,\n 'Tbilisi' AS `district_name`,\n sum(`raw`.`num_possible_voters`) AS `possible voters`,\n sum(`raw`.`num_votes`) AS `total ballots cast`,\n sum(`raw`.`num_valid_votes`) AS `total valid ballots cast`,\n ifnull(sum(`invalid_ballots_01`.`num_invalid_ballots`),\n 0) AS `num invalid ballots from 0-1%`,\n ifnull(sum(`invalid_ballots_13`.`num_invalid_ballots`),\n 0) AS `num invalid ballots from 1-3%`,\n ifnull(sum(`invalid_ballots_35`.`num_invalid_ballots`),\n 0) AS `num invalid ballots from 3-5%`,\n ifnull(sum(`invalid_ballots_>5`.`num_invalid_ballots`),\n 0) AS `num invalid ballots >5%`,\n (100 * (sum(`raw`.`num_valid_votes`) / sum(`raw`.`num_possible_voters`))) AS `percent voters voting`,\n sum(`raw`.`logic_check_fail`) AS `num precincts logic fail`,\n (100 * (sum(`raw`.`logic_check_fail`) / count(0))) AS `percent precincts logic fail`,\n (sum(`raw`.`logic_check_difference`) / sum(`raw`.`logic_check_fail`)) AS `avg precinct logic fail difference`,\n sum(`raw`.`more_ballots_than_votes_flag`) AS `num precincts more ballots than votes`,\n (100 * (sum(`raw`.`more_ballots_than_votes_flag`) / count(0))) AS `percent precincts more ballots than votes`,\n (sum(`raw`.`more_ballots_than_votes`) / sum(`raw`.`more_ballots_than_votes_flag`)) AS `avg precinct difference more ballots than votes`,\n sum(`raw`.`more_votes_than_ballots_flag`) AS `num precincts more votes than ballots`,\n (100 * (sum(`raw`.`more_votes_than_ballots_flag`) / count(0))) AS `percent precincts more votes than ballots`,\n (sum(`raw`.`more_votes_than_ballots`) / sum(`raw`.`more_votes_than_ballots_flag`)) AS `avg precinct difference more votes than ballots`,\n sum(`raw`.`supplemental_documents_flag`) AS `num precincts with supplemental documents`,\n (100 * (sum(`raw`.`supplemental_documents_flag`) / count(0))) AS `percent precincts with supplemental documents`,\n (sum(`raw`.`supplemental_document_count`) / sum(`raw`.`supplemental_documents_flag`)) AS `avg precinct supplemental document count`,\n sum(`raw`.`amendment_flag`) AS `num precincts with amendment`,\n (100 * (sum(`raw`.`amendment_flag`) / count(0))) AS `percent precincts with amendment`,\n sum(`raw`.`explanatory_note_flag`) AS `num precincts with explanatory note`,\n (100 * (sum(`raw`.`explanatory_note_flag`) / count(0))) AS `percent precincts with explanatory note`,\n sum(`raw`.`num_at_12`) AS `votes 8-12`,\n sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) AS `votes 12-17`,\n sum((`raw`.`num_votes` - `raw`.`num_at_17`)) AS `votes 17-20`,\n (sum(`raw`.`num_at_12`) / count(0)) AS `avg votes/precinct 8-12`,\n (sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) / count(0)) AS `avg votes/precinct 12-17`,\n (sum((`raw`.`num_votes` - `raw`.`num_at_17`)) / count(0)) AS `avg votes/precinct 17-20`,\n (sum(`raw`.`num_at_12`) / 240) AS `vpm 8-12`,\n (sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) / 180) AS `vpm 12-17`,\n (sum((`raw`.`num_votes` - `raw`.`num_at_17`)) / 300) AS `vpm 17-20`,\n ((sum(`raw`.`num_at_12`) / 240) / count(0)) AS `avg vpm/precinct 8-12`,\n ((sum((`raw`.`num_at_17` - `raw`.`num_at_12`)) / 180) / count(0)) AS `avg vpm/precinct 12-17`,\n ((sum((`raw`.`num_votes` - `raw`.`num_at_17`)) / 200) / count(0)) AS `avg vpm/precinct 17-20`,\n ifnull(sum(`vpm1`.`vpm > #{@@vpm_limit}`),\n 0) AS `num precincts vpm 8-12 > #{@@vpm_limit}`,\n ifnull(sum(`vpm2`.`vpm > #{@@vpm_limit}`),\n 0) AS `num precincts vpm 12-17 > #{@@vpm_limit}`,\n ifnull(sum(`vpm3`.`vpm > #{@@vpm_limit}`),\n 0) AS `num precincts vpm 17-20 > #{@@vpm_limit}`,\n ((ifnull(sum(`vpm1`.`vpm > #{@@vpm_limit}`),\n 0) + ifnull(sum(`vpm2`.`vpm > #{@@vpm_limit}`),\n 0)) + ifnull(sum(`vpm3`.`vpm > #{@@vpm_limit}`),\n 0)) AS `num precincts vpm > #{@@vpm_limit}`,\n `precinct_count`.`num_precincts` AS `num_precincts_possible`,\n count(`raw`.`precinct_id`) AS `num_precincts_reported_number`,\n ((100 * count(`raw`.`precinct_id`)) / `precinct_count`.`num_precincts`) AS `num_precincts_reported_percent`,\n \"\n party_sql = []\n parties.each do |party|\n party_name = \"#{party[:id]} - #{party[:name]}\"\n party_sql << \"sum(`raw`.`#{party_name}`) AS `#{party_name} count`,\n (100 * (sum(`raw`.`#{party_name}`) / sum(`raw`.`num_valid_votes`))) AS `#{party_name}`\"\n end\n sql << party_sql.join(', ')\n if self.has_indepenedent_parties?\n sql << \", sum(`raw`.`#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME}`) AS `#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME} count`,\n (100 * (sum(`raw`.`#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME}`) / sum(`raw`.`num_valid_votes`))) AS `#{Election::INDEPENDENT_MERGED_ANALYSIS_NAME}` \"\n end\n\n sql << \" from ((((((((`#{@@analysis_db}`.`#{self.analysis_table_name} - raw` `raw`\n join `#{@@analysis_db}`.`#{self.analysis_table_name} - precinct count by region` `precinct_count` on((`raw`.`region` <=> `precinct_count`.`region`)))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - vpm 8-12>#{@@vpm_limit}` `vpm1` on(((`raw`.`region` <=> `vpm1`.`region`) and (`raw`.`district_id` = `vpm1`.`district_id`) and (`raw`.`precinct_id` = `vpm1`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - vpm 12-17>#{@@vpm_limit}` `vpm2` on(((`raw`.`region` <=> `vpm2`.`region`) and (`raw`.`district_id` = `vpm2`.`district_id`) and (`raw`.`precinct_id` = `vpm2`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - vpm 17-20>#{@@vpm_limit}` `vpm3` on(((`raw`.`region` <=> convert(`vpm3`.`region` using utf8)) and (`raw`.`district_id` = `vpm3`.`district_id`) and (`raw`.`precinct_id` = `vpm3`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots 0-1` `invalid_ballots_01` on(((`raw`.`region` <=> `invalid_ballots_01`.`region`) and (`raw`.`district_id` = `invalid_ballots_01`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_01`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots 1-3` `invalid_ballots_13` on(((`raw`.`region` <=> `invalid_ballots_13`.`region`) and (`raw`.`district_id` = `invalid_ballots_13`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_13`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots 3-5` `invalid_ballots_35` on(((`raw`.`region` <=> `invalid_ballots_35`.`region`) and (`raw`.`district_id` = `invalid_ballots_35`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_35`.`precinct_id`))))\n left join `#{@@analysis_db}`.`#{self.analysis_table_name} - invalid ballots >5` `invalid_ballots_>5` on(((`raw`.`region` <=> `invalid_ballots_>5`.`region`) and (`raw`.`district_id` = `invalid_ballots_>5`.`district_id`) and (`raw`.`precinct_id` = `invalid_ballots_>5`.`precinct_id`))))\n where `raw`.`is_annulled` = 0\n and (`raw`.`district_id` between 1 and 10)\n group by `raw`.`region`\"\n end\n\n @@client.execute(sql)\n end\n end",
"def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: \"Direccion was successfully created.\" }\n format.json { render :show, status: :created, location: @direccion }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @distraction = Distraction.new(params[:distraction])\n\n respond_to do |format|\n if @distraction.save\n format.html { redirect_to @distraction, notice: 'Distraction was successfully created.' }\n format.json { render json: @distraction, status: :created, location: @distraction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @distraction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: 'Direccion was successfully created.' }\n format.json { render :show, status: :created, location: @direccion }\n else\n format.html { render :new }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: 'Direccion was successfully created.' }\n format.json { render :show, status: :created, location: @direccion }\n else\n format.html { render :new }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @state_object = States.new\n @states = @state_object.abbreviations\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n redirect_to \"/restaurants/#{@restaurant.id}\"\n else\n flash[:notice] = \"Your restaurant couldn't be saved. Sorry!\"\n render :new\n end\n end",
"def create\n @disease = Disease.new(params[:disease])\n\n respond_to do |format|\n if @disease.save\n format.html { redirect_to @disease, notice: 'Disease was successfully created.' }\n format.json { render json: @disease, status: :created, location: @disease }\n else\n format.html { render action: \"new\" }\n format.json { render json: @disease.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dress = Dress.new(params[:dress])\n\n respond_to do |format|\n if @dress.save\n format.html { redirect_to @dress, notice: 'Vestido criado com sucesso.' }\n format.json { render json: @dress, status: :created, location: @dress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n\n @town_master = TownMaster.new(town_master_params)\n prefix = @town_master.name\n @town_master.town_id = TownMaster.gen_assigned_code(prefix)\n town_idd = @town_master.town_id\n\n respond_to do |format|\n if @town_master.save\n format.html { redirect_to @town_master, notice: \"Town master was successfully created.\" }\n format.json { render :show, status: :created, location: @town_master }\n else\n logger.info \"Here ===== #{@town_master.errors.messages.inspect}\"\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @town_master.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.73754716",
"0.71334803",
"0.7103008",
"0.70803386",
"0.70637786",
"0.7062713",
"0.7040849",
"0.70311344",
"0.70261407",
"0.6893635",
"0.6869062",
"0.67810947",
"0.6735712",
"0.6735712",
"0.66597795",
"0.6647939",
"0.6609418",
"0.6574611",
"0.65476805",
"0.6431698",
"0.63244015",
"0.63017243",
"0.6230604",
"0.6230604",
"0.6230604",
"0.618892",
"0.61861247",
"0.61841726",
"0.6171517",
"0.61601806",
"0.614867",
"0.614867",
"0.6111463",
"0.6110339",
"0.61095595",
"0.6106663",
"0.60478634",
"0.6030943",
"0.6022954",
"0.60034645",
"0.5999661",
"0.5995935",
"0.5987319",
"0.5980093",
"0.5926088",
"0.5926088",
"0.5876662",
"0.5875658",
"0.58720136",
"0.5862524",
"0.58369535",
"0.58151054",
"0.5814282",
"0.5814282",
"0.58070225",
"0.57451177",
"0.57193846",
"0.5712265",
"0.5698293",
"0.5691164",
"0.5687912",
"0.56752354",
"0.56748694",
"0.5657161",
"0.56467104",
"0.5645688",
"0.56413686",
"0.5633504",
"0.55898607",
"0.55894196",
"0.55875677",
"0.5544817",
"0.5544425",
"0.5540191",
"0.5535146",
"0.55268437",
"0.552674",
"0.5512122",
"0.5510603",
"0.5501311",
"0.54802626",
"0.54802626",
"0.5480017",
"0.54683703",
"0.5461526",
"0.5449588",
"0.54414904",
"0.543101",
"0.5423456",
"0.5419508",
"0.5413833",
"0.5399851",
"0.5393952",
"0.5383292",
"0.5383292",
"0.5381615",
"0.5381372",
"0.5367808",
"0.5366517"
] |
0.76711434
|
1
|
PATCH/PUT /districts/1 PATCH/PUT /districts/1.json
|
def update
respond_to do |format|
if @district.update(district_params)
format.html { redirect_to @district, notice: 'District was successfully updated.' }
format.json { render :show, status: :ok, location: @district }
else
format.html { render :edit }
format.json { render json: @district.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n flash[:success] = \"Район успешно отредактирован.\"\n format.html { redirect_to @district }\n format.json { head :no_content }\n else\n flash.now[:error] = \"Введены неверные данные!\"\n format.html { render action: \"edit\" }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clidistrict = Clidistrict.find(params[:id])\n\n respond_to do |format|\n if @clidistrict.update_attributes(params[:clidistrict])\n format.html { redirect_to @clidistrict, notice: 'Clidistrict was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clidistrict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n if @congressional_district.update_attributes(params[:congressional_district])\n format.html { redirect_to @congressional_district, notice: 'Congressional district was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @congressional_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n flash[:notice] = 'District was successfully updated.'\n format.html { redirect_to(@district) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @city_district = CityDistrict.find(params[:id])\n\n respond_to do |format|\n if @city_district.update_attributes(params[:city_district])\n format.html { redirect_to @city_district, :notice => 'City district was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @city_district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to [:admin, @district], notice: '区县更新成功!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @electoral_district = ElectoralDistrict.find(params[:id])\n\n respond_to do |format|\n if @electoral_district.update_attributes(params[:electoral_district])\n format.html { redirect_to @electoral_district, notice: 'Electoral district was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @electoral_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @council_district.update(council_district_params)\n format.html { redirect_to @council_district, notice: 'Council district was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @council_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @committees_district.update(committees_district_params)\n format.html { redirect_to @committees_district, notice: 'Committees district was successfully updated.' }\n format.json { render :show, status: :ok, location: @committees_district }\n else\n format.html { render :edit }\n format.json { render json: @committees_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @districtclass = Districtclass.find(params[:id])\n\n respond_to do |format|\n if @districtclass.update_attributes(params[:districtclass])\n format.html { redirect_to @districtclass, notice: 'Districtclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @districtclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district_list.update(district_list_params)\n format.html { redirect_to @district_list, notice: 'District list was successfully updated.' }\n format.json { render :show, status: :ok, location: @district_list }\n else\n format.html { render :edit }\n format.json { render json: @district_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district_area.update(district_area_params)\n format.html { redirect_to @district_area, notice: 'District area was successfully updated.' }\n format.json { render :show, status: :ok, location: @district_area }\n else\n format.html { render :edit }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district_area.update(district_area_params)\n format.html { redirect_to @district_area, notice: 'District area was successfully updated.' }\n format.json { render :show, status: :ok, location: @district_area }\n else\n format.html { render :edit }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admins_district.update(admins_district_params)\n format.html { redirect_to session.delete(:return_to), notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @admins_district }\n else\n format.html { render :edit }\n format.json { render json: @admins_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @department = Department.find(params[:department_id])\n @town = @department.towns.find(params[:id]) \n respond_to do |format|\n if @town.update(town_params)\n format.json { render json: @town, status: :ok }\n else\n format.json { render json: @town.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n \n respond_to do |format|\n if @town_master.update(town_master_params)\n format.html { redirect_to @town_master, notice: \"Town master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @town_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @town_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if (user_signed_in? && ([2].include?(current_user.role)))\n @shared_district = Shared::District.find(params[:id])\n @title_view = 'Distritos'\n @provinces = Shared::Province.all\n respond_to do |format|\n if @shared_district.update_attributes(params[:shared_district])\n format.html { redirect_to(@shared_district, :notice => 'Se ha actualizado correctamente el distrito.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shared_district.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def update\n @dress = Dress.find(params[:id])\n\n respond_to do |format|\n if @dress.update_attributes(params[:dress])\n format.html { redirect_to @dress, notice: 'Dress was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discipline.update(discipline_params)\n format.html { redirect_to management_disciplines_path }\n format.json { render :json => @discipline.to_json(include: :department), status: :created }\n else\n format.html { render :edit }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def update\n @doctor = Doctor.find(params[:id])\n if @doctor.update!(update_params)\n render json: {doctor: @doctor}, status: 200\n else\n render json: { errors: @doctor.errors }, status: 422\n end\n end",
"def update\n sub_cluster = params[\"dtcstaff\"][\"sub_cluster\"]\n @dtc_staff.subcluster(sub_cluster) \n respond_to do |format|\n if @dtc_staff.update(params[:dtc_staff])\n format.html { redirect_to dtc_staffs_url, notice: 'Route Updated' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dtc_staff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = current_district.students.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = \"#{edit_obj_link(@student)} was successfully updated.\".html_safe\n format.html { redirect_to(index_url_with_page) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def update\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.find_by_id(params[:id])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address\n if @shipping_address.update_attributes(params[:shipping_address])\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to action: \"index\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @set_aside.update(set_aside_params)\n format.html { redirect_to @set_aside, notice: 'Set aside was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @set_aside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n if @dental.update_attributes(params[:dental])\n format.html { redirect_to @dental, notice: 'Dental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @distraction = Distraction.find(params[:id])\n\n respond_to do |format|\n if @distraction.update_attributes(params[:distraction])\n format.html { redirect_to @distraction, notice: 'Distraction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @distraction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n @division = Division.find(params[:id])\n\n respond_to do |format|\n if @division.update_attributes(params[:division])\n format.html { redirect_to @division, notice: 'Division was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @division.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @taxon_determination.update(taxon_determination_params)\n format.html { redirect_to @taxon_determination, notice: 'Taxon determination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @taxon_determination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @locality = Locality.find(params[:id])\n @provinces = Province.all\n\n respond_to do |format|\n if @locality.update_attributes(params[:locality])\n format.html { redirect_to @locality, :notice => 'Locality was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @locality.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n @medium_road = MediumRoad.find(params[:id])\n\n respond_to do |format|\n if @medium_road.update_attributes(params[:medium_road])\n format.html { redirect_to @medium_road, notice: 'Medium road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_geonode = Admin::Geonode.find(params[:id])\n\n respond_to do |format|\n if @admin_geonode.update_attributes(params[:admin_geonode])\n format.html { redirect_to @admin_geonode, notice: 'Geonode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_geonode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dart = Dart.find(params[:id])\n\n respond_to do |format|\n if @dart.update_attributes(params[:dart])\n format.html { redirect_to @dart, notice: 'Dart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @diary = Diary.find(params[:id])\n @diary.update_attributes!(params[:diary])\n\n respond_to do |format|\n format.html { redirect_to @diary, notice: 'Diary was successfully updated.' }\n format.js\n end\n end",
"def update\n @data_center = DataCenter.find(params[:id])\n\n respond_to do |format|\n if @data_center.update_attributes(params[:data_center])\n format.html { redirect_to data_centers_path, :notice => 'Data center was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @data_center.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @diseasesubset.update(diseasesubset_params)\n format.html { redirect_to @diseasesubset, notice: 'Diseasesubset was successfully updated.' }\n format.json { render :show, status: :ok, location: @diseasesubset }\n else\n format.html { render :edit }\n format.json { render json: @diseasesubset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crowd = Crowd.find(params[:id])\n\n respond_to do |format|\n if @crowd.update_attributes(params[:crowd])\n format.html { redirect_to @crowd, notice: 'Crowd was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crowd.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lodge = Lodge.find(params[:id])\n\n respond_to do |format|\n if @lodge.update_attributes(params[:lodge])\n format.html { redirect_to @lodge, notice: 'Lodge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lodge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @college = College.find(params[:id])\n\n respond_to do |format|\n if @college.update_attributes(params[:college])\n format.html { redirect_to '/colleges', notice: 'College was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @college.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n get_school\n @school_vocational = @school.vocationals.find(params[:id])\n @school_vocational.update_attributes(params[:school_vocational])\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @design_dissertation = DesignDissertation.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @design_dissertation.update_attributes(params[:design_dissertation])\r\n format.html { redirect_to @design_dissertation, notice: 'Design dissertation was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @design_dissertation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @residence = Residence.find(params[:id])\n\n respond_to do |format|\n if @residence.update_attributes(params[:residence])\n format.html { redirect_to @residence, notice: 'Residence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @residence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\n @denomination = Denomination.find(params[:id])\n\n respond_to do |format|\n if @denomination.update_attributes(params[:denomination])\n format.html { redirect_to @denomination, notice: 'Denomination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @denomination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dress = Dress.find(params[:id])\n\n respond_to do |format|\n if @dress.update_attributes(params[:dress])\n format.html { redirect_to @dress, notice: 'Vestido atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cycdatum = Cycdatum.find(params[:id])\n\n respond_to do |format|\n if @cycdatum.update_attributes(params[:cycdatum])\n format.html { redirect_to @cycdatum, notice: 'Cycdatum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cycdatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meridian.update(meridian_params)\n format.html { redirect_to @meridian, notice: 'Meridian was successfully updated.' }\n format.json { render :show, status: :ok, location: @meridian }\n else\n format.html { render :edit }\n format.json { render json: @meridian.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n respond_to do |format|\n if @constituency_duplicate.update(constituency_duplicate_params)\n format.html { redirect_to @constituency_duplicate, notice: \"Constituency was successfully updated.\" }\n format.json { render :show, status: :ok, location: @constituency }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @constituency_duplicate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @cities = City.order(name: :asc)\n @districts = @cities.find_by(name: \"ADANA\").districts\n @neighborhoods = @districts.find_by(name: \"ALADAĞ\").neighborhoods\n @types = Type.all\n respond_to do |format|\n if @violation.update(violation_params)\n format.html { redirect_to @violation, notice: 'Violation was successfully updated.' }\n format.json { render :show, status: :ok, location: @violation }\n else\n format.html { render :edit }\n format.json { render json: @violation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_district\n @district = District.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @transect.update(transect_params)\n # format.html { redirect_to @transect, notice: 'Transect was successfully updated.' }\n format.html { redirect_to transects_path, notice: 'Transect was successfully updated.' }\n format.json { render :show, status: :ok, location: @transect }\n else\n format.html { render :edit }\n format.json { render json: @transect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if (params[:position] != Admins::Office.representative)\n params[:district_id] = nil\n if (@admins_office.district_id)\n @admins_office.district_id =nil\n end\n end\n\n if @admins_office.update(admins_office_params)\n format.html { redirect_to @admins_office, notice: 'Office was successfully updated.' }\n format.json { render :show, status: :ok, location: @admins_office }\n else\n format.html { render :edit }\n format.json { render json: @admins_office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_order\n\t\t\t# Author\n\t\t\tauthorize! :manage, District\n\n\t\t\t# Get district\n\t\t\tdistrict = District.find params[:id]\n\n\t\t\tresult = district.set_order params[:order]\n\n\t\t\trender json: result\n\t\tend",
"def update\n respond_to do |format|\n if @dn.update(dn_params)\n format.html { redirect_to @dn, notice: 'Dn was successfully updated.' }\n format.json { render :show, status: :ok, location: @dn }\n else\n format.html { render :edit }\n format.json { render json: @dn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def update\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n if @stundent.update_attributes(params[:stundent])\n format.html { redirect_to @stundent, notice: 'Stundent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stundent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hydralic_particular.update(hydralic_particular_params)\n format.html { redirect_to project_sub_project_hydralic_particulars_path(@project, @sub_project, :hydralic_type => @hydralic_particular.hydralic_type), notice: 'Hydralic particular was successfully updated.' }\n format.json { render :show, status: :ok, location: @hydralic_particular }\n else\n format.html { render :edit }\n format.json { render json: @hydralic_particular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n if @tenancy_agreement.update_attributes(params[:tenancy_agreement])\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @biodatum.update(biodatum_params)\n format.html { redirect_to @biodatum, notice: \"Biodatum was successfully updated.\" }\n format.json { render :show, status: :ok, location: @biodatum }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @biodatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @diary.update(diary_params)\n format.html { redirect_to @diary, notice: 'Diary entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @diary }\n else\n format.html { render :edit }\n format.json { render json: @diary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mountain.update(mountain_params)\n format.html { redirect_to @mountain, notice: 'Mountain was successfully updated.' }\n format.json { render :show, status: :ok, location: @mountain }\n else\n format.html { render :edit }\n format.json { render json: @mountain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n respond_to do |format|\n if @fooddiary.update(fooddiary_params)\n format.html { redirect_to foods_path }\n format.json { render :show, status: :ok, location: @fooddiary }\n else\n format.html { render :edit }\n format.json { render json: @fooddiary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @agency.update_attributes(params[:agency])\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to contestants_path, notice: 'Contestant was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dis_ingredient.update(dis_ingredient_params)\n format.html { redirect_to @dis_ingredient, notice: 'Dis ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @dis_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @road = Road.find(params[:id])\n\n respond_to do |format|\n if @road.update_attributes(params[:road])\n format.html { redirect_to @road, notice: 'Road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @street_directory = StreetDirectory.find(params[:id])\n @street_directory.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @street_directory.update_attributes(params[:street_directory])\n format.html { redirect_to @street_directory,\n notice: (crud_notice('updated', @street_directory) + \"#{undo_link(@street_directory)}\").html_safe }\n format.json { head :no_content }\n else\n @towns = towns_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @street_directory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dojo_student = DojoStudent.find(params[:id])\n\n respond_to do |format|\n if @dojo_student.update_attributes(params[:dojo_student])\n format.html { redirect_to @dojo_student, notice: 'Dojo student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dojo_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n\n if @service_level_agreement.update_attributes(params[:service_level_agreement])\n render :json => {:success => true}\n else\n render :json => {:success => false, :message => @service_level_agreement.errors.full_messages.join(\". \") }\n end\n end",
"def update\n @diary = current_user.diaries.find(params[:id])\n\n respond_to do |format|\n if @diary.update_attributes(params[:diary])\n format.html { redirect_to @diary, notice: 'Diary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @diary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @municipio_dominio = MunicipioDominio.find(params[:id])\n\n respond_to do |format|\n if @municipio_dominio.update_attributes(params[:municipio_dominio])\n format.html { redirect_to @municipio_dominio, :notice => 'Municipio dominio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @municipio_dominio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @dolgnost = Dolgnost.find(params[:id])\n\n respond_to do |format|\n if @dolgnost.update_attributes(params[:dolgnost])\n format.html { redirect_to @dolgnost, notice: 'Dolgnost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dolgnost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n if @optin_contestant.update_attributes(params[:optin_contestant])\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @diary_entry.update(diary_entry_params)\n format.html { redirect_to root_path, notice: 'Dagbogsnotatet er redigeret.' }\n format.json { render :show, status: :ok, location: @diary_entry }\n else\n format.html { render :edit }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7126122",
"0.6996551",
"0.69761693",
"0.69454235",
"0.69368136",
"0.69137615",
"0.6912139",
"0.68911105",
"0.6760865",
"0.67091334",
"0.66382796",
"0.6565201",
"0.65612084",
"0.65612084",
"0.6485658",
"0.6357987",
"0.62105393",
"0.6091936",
"0.60824805",
"0.59730554",
"0.59698665",
"0.59693944",
"0.59693944",
"0.59693944",
"0.5920833",
"0.590447",
"0.59013313",
"0.5883706",
"0.5862937",
"0.5862937",
"0.5857337",
"0.5845008",
"0.5839936",
"0.5826909",
"0.5822198",
"0.5815094",
"0.58141375",
"0.580641",
"0.5803778",
"0.5801933",
"0.57932717",
"0.5792848",
"0.57851726",
"0.5765849",
"0.5762129",
"0.57610637",
"0.5757956",
"0.57571465",
"0.5753929",
"0.57512206",
"0.57508826",
"0.5742411",
"0.57388556",
"0.5727442",
"0.57254064",
"0.57222575",
"0.5716577",
"0.5715503",
"0.5713623",
"0.5706317",
"0.57061136",
"0.5705565",
"0.5703786",
"0.56948304",
"0.5693159",
"0.5689036",
"0.56783175",
"0.5673595",
"0.5672585",
"0.56638646",
"0.56616974",
"0.56604785",
"0.5655665",
"0.5655253",
"0.56539553",
"0.5652886",
"0.5650405",
"0.56486064",
"0.56485033",
"0.5646606",
"0.5642274",
"0.5641851",
"0.5636946",
"0.5636249",
"0.56249726",
"0.56225073",
"0.56220126",
"0.56205493",
"0.5618724",
"0.5615647",
"0.560544",
"0.5605181",
"0.5603268",
"0.5602019",
"0.5602012",
"0.5601949",
"0.5601776",
"0.559526",
"0.5594148"
] |
0.7215769
|
1
|
DELETE /districts/1 DELETE /districts/1.json
|
def destroy
@district.destroy
respond_to do |format|
format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to admin_districts_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congressional_district = CongressionalDistrict.find(params[:id])\n @congressional_district.destroy\n\n respond_to do |format|\n format.html { redirect_to congressional_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n flash[:success] = \"Район успешно удален.\"\n format.html { redirect_to districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clidistrict = Clidistrict.find(params[:id])\n @clidistrict.destroy\n\n respond_to do |format|\n format.html { redirect_to clidistricts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @city_district = CityDistrict.find(params[:id])\n @city_district.destroy\n\n respond_to do |format|\n format.html { redirect_to city_districts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_city_districts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @electoral_district = ElectoralDistrict.find(params[:id])\n @electoral_district.destroy\n\n respond_to do |format|\n format.html { redirect_to electoral_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @council_district.destroy\n respond_to do |format|\n format.html { redirect_to council_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admins_district.destroy\n respond_to do |format|\n format.html { redirect_to admins_districts_url, notice: 'District was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @committees_district.destroy\n respond_to do |format|\n format.html { redirect_to committees_districts_url, notice: 'Committees district was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @districtclass = Districtclass.find(params[:id])\n @districtclass.destroy\n\n respond_to do |format|\n format.html { redirect_to districtclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district_list.destroy\n respond_to do |format|\n format.html { redirect_to district_lists_url, notice: 'District list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magisterial_district.destroy\n respond_to do |format|\n format.html { redirect_to magisterial_districts_url, notice: 'Magisterial district was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district_area.destroy\n respond_to do |format|\n format.html { redirect_to district_areas_url, notice: 'District area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district_area.destroy\n respond_to do |format|\n format.html { redirect_to district_areas_url, notice: 'District area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district_chief = DistrictChief.find(params[:id])\n @district_chief.destroy\n\n respond_to do |format|\n format.html { redirect_to district_chiefs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_url }\n format.json { head :ok }\n end\n end",
"def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end",
"def destroy\n @distraction = Distraction.find(params[:id])\n @distraction.destroy\n\n respond_to do |format|\n format.html { redirect_to distractions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = current_district.students.find(params[:id])\n @student.remove_from_district\n\n respond_to do |format|\n format.html { redirect_to(index_url_with_page) }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @denuncium = Denuncium.find(params[:id])\n @denuncium.destroy\n\n respond_to do |format|\n format.html { redirect_to denuncia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dress = Dress.find(params[:id])\n @dress.destroy\n\n respond_to do |format|\n format.html { redirect_to dresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dress = Dress.find(params[:id])\n @dress.destroy\n\n respond_to do |format|\n format.html { redirect_to dresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @duty_station = DutyStation.find(params[:id])\n @duty_station.destroy\n\n respond_to do |format|\n format.html { redirect_to duty_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distbutor.included_countries.destroy_all\n @distbutor.included_states.destroy_all\n @distbutor.included_cities.destroy_all\n @distbutor.excluded_states.destroy_all\n @distbutor.excluded_cities.destroy_all\n @distbutor.destroy\n respond_to do |format|\n format.html { redirect_to distbutors_url, notice: 'Distbutor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @denomination = Denomination.find(params[:id])\n @denomination.destroy\n\n respond_to do |format|\n format.html { redirect_to denominations_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @diapo = current_church.diapos.find(params[:id])\n @diapo.destroy\n\n respond_to do |format|\n format.html { redirect_to diapos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @department = Department.find(params[:department_id])\n @town = @department.towns.find(params[:id]) \n @town.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok}\n end\n end",
"def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @state_cadre = StateCadre.find(params[:id])\n @state_cadre.destroy\n\n respond_to do |format|\n format.html { redirect_to state_cadres_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @disease = Disease.find(params[:id])\n @disease.destroy\n\n respond_to do |format|\n format.html { redirect_to diseases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diary = Diary.find(params[:id])\n @diary.destroy\n\n respond_to do |format|\n format.html { redirect_to diaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @administrative_division = AdministrativeDivision.find(params[:id])\n @administrative_division.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrative_divisions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dental = Dental.find(params[:id])\n @dental.destroy\n\n respond_to do |format|\n format.html { redirect_to dentals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tangent.destroy\n respond_to do |format|\n format.html { redirect_to tangents_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @municipio_dominio = MunicipioDominio.find(params[:id])\n @municipio_dominio.destroy\n\n respond_to do |format|\n format.html { redirect_to municipio_dominios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direcciones_url, notice: 'Direccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city = City.find(params[:id])\n @city.destroy\n\n respond_to do |format|\n format.html { redirect_to country_state_cities_url, :notice => t('controller_message.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to counties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direccions_url, notice: 'Direccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direcciont.destroy\n respond_to do |format|\n format.html { redirect_to direccionts_url, notice: 'Direcciont was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hydrant = Hydrant.find(params[:id])\n @hydrant.destroy\n\n respond_to do |format|\n format.html { redirect_to(hydrants_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direccions_url, notice: \"Direccion was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cad_neighborhood = CadNeighborhood.find(params[:id])\n @cad_neighborhood.destroy\n\n respond_to do |format|\n format.html { redirect_to cad_neighborhoods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mountain.destroy\n respond_to do |format|\n format.html { redirect_to mountains_url, notice: 'Mountain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dn.destroy\n respond_to do |format|\n format.html { redirect_to dns_url, notice: 'Dn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to cities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @federal_state.destroy\n respond_to do |format|\n format.html { redirect_to federal_states_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @denomination.destroy\n respond_to do |format|\n format.html { redirect_to denominations_url, notice: 'Denomination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_city.destroy\n respond_to do |format|\n format.html { redirect_to admin_cities_url, notice: 'City was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @street_directory = StreetDirectory.find(params[:id])\n\n respond_to do |format|\n if @street_directory.destroy\n format.html { redirect_to street_directories_url,\n notice: (crud_notice('destroyed', @street_directory) + \"#{undo_link(@street_directory)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to street_directories_url, alert: \"#{@street_directory.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @street_directory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_center = DataCenter.find(params[:id])\n @data_center.destroy\n\n respond_to do |format|\n format.html { redirect_to data_centers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_city.destroy\n respond_to do |format|\n format.html { redirect_to student_cities_url, notice: 'Student city was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estado_dc.destroy\n respond_to do |format|\n format.html { redirect_to estado_dcs_url, notice: 'Estado dc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphium_city.destroy\n respond_to do |format|\n format.html { redirect_to graphium_cities_url, notice: 'City was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @governor = Governor.find(params[:id])\n @governor.destroy\n\n respond_to do |format|\n format.html { redirect_to governors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fooddiary.destroy\n respond_to do |format|\n format.html { redirect_to food_fooddiaries_url(@food.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @medium_dungeon = MediumDungeon.find(params[:id])\n @medium_dungeon.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_dungeons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @diseasesynonym.destroy\n respond_to do |format|\n format.html { redirect_to diseasesynonyms_url, notice: 'Diseasesynonym was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.77810276",
"0.77323526",
"0.77285606",
"0.772048",
"0.77181786",
"0.76601684",
"0.76569086",
"0.76493096",
"0.7582375",
"0.74829644",
"0.72289246",
"0.7227101",
"0.72161055",
"0.7208485",
"0.715053",
"0.715053",
"0.70897263",
"0.69843394",
"0.6975609",
"0.6886563",
"0.6685944",
"0.66759616",
"0.66452354",
"0.6644538",
"0.66049016",
"0.6601008",
"0.6592055",
"0.65832424",
"0.6578597",
"0.6578597",
"0.6565589",
"0.655908",
"0.6554517",
"0.65503424",
"0.6537279",
"0.65343547",
"0.6526015",
"0.6525785",
"0.65219843",
"0.65174633",
"0.6515595",
"0.651331",
"0.65064806",
"0.6504183",
"0.64831865",
"0.6482104",
"0.64781266",
"0.64703596",
"0.6466243",
"0.6446599",
"0.64343786",
"0.6430716",
"0.6430356",
"0.6430174",
"0.64293075",
"0.64279914",
"0.64168686",
"0.64147854",
"0.64105743",
"0.64103276",
"0.6409247",
"0.64085764",
"0.6406873",
"0.6406828",
"0.6405911",
"0.64043665",
"0.64027804",
"0.640168",
"0.63980705",
"0.63979405",
"0.63974017",
"0.6396638",
"0.63941",
"0.63908005",
"0.63854456",
"0.63818383",
"0.6375372",
"0.63747025",
"0.6369191",
"0.6364442",
"0.6363202",
"0.636167",
"0.63613105",
"0.6359459",
"0.63593304",
"0.63590276",
"0.63580793",
"0.6353026",
"0.635036",
"0.63501966",
"0.63467026",
"0.63467026",
"0.63467026",
"0.63467026",
"0.6344938",
"0.6344926",
"0.63399696",
"0.6339956",
"0.63389915"
] |
0.77683413
|
2
|
Never trust parameters from the scary internet, only allow the white list through.
|
def district_params
params.require(:district).permit(:name, :code, :regional_name_value, taluks_attributes:
[:id, :_destroy, :name, :code, :regional_name_value, panchayats_attributes:
[:id, :_destroy, :name, :code, :regional_name_value, places_attributes:
[:id, :_destroy, :name, :code, :place_type, :regional_name_value]
]
])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def get_entity(name)
# These are the valid entities and their validators are defined
if ["Taluk","Panchayat","Place"].include?(name)
return name.constantize, name.downcase+"_params", name.downcase
else
return nil
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
SESSION 1 PROMPT =begin Given a binary tree, flatten it to a linked list inplace. For example, given the following tree: 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 \ 6 =end
|
def flatten_tree(root, prev = nil)
return root if root.nil?
flatten_tree(root.left)
flatten_tree(root.right)
tmp = root.right
unless root.left.nil?
root.right = root.left
root.left = nil
root = root.right until root.right.nil?
root.right = tmp
end
root
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def flatten(root)\n stack = [root]\n\n while stack.any?\n current_node = stack.pop\n\n if current_node.child\n stack << current_node.next if current_node.next\n\n current_node.next = current_node.child\n current_node.child.prev = current_node\n stack << current_node.child\n current_node.child = nil\n elsif current_node.next\n stack << current_node.next\n elsif stack.any?\n next_link = stack.last\n current_node.next = next_link\n next_link.prev = current_node\n end\n end\n\n root\nend",
"def flatten(root)\n \n return root if root.nil?\n stack = [root]\n prev_node = nil\n \n while !stack.empty? do\n iterator = stack.pop\n if !prev_node.nil?\n prev_node.right = iterator\n prev_node.left = nil\n end\n stack << iterator.right if iterator.right\n stack << iterator.left if iterator.left\n prev_node = iterator\n end\n root\nend",
"def flatten\n Tree.new(@head, leaves)\n end",
"def flatten(head)\n return nil if head.nil? #1\n if head.child.nil?\n return head if head.next.nil? #2\n return flatten(head.next) #3\n else\n next = Node.new\n next = head.next\n\n child = Node.new\n child = head.child\n head.child = nil\n\n child_tail = flatten(child)\n\n head.next = child\n child.prev = head\n if next != nil\n child_tail.next = next\n next.prev = child_tail\n end\n\n return child_tail\n end\n\nend",
"def convert_tree(tree)\n return nil,nil if tree.nil?\n left_list_head,left_list_tail = convert_tree(tree.left) \n right_list_head,right_list_tail = convert_tree(tree.right)\n current_head, current_tail = tree,tree\n if left_list_tail\n current_head = left_list_head\n tree.left = left_list_tail\n left_list_tail.right = tree\n end\n if right_list_head\n current_tail = right_list_tail\n tree.right = right_list_head\n right_list_head.left = tree\n end\n [current_head,current_tail]\nend",
"def convert_binary_tree_to_double_linked_list(root)\nend",
"def flatten() end",
"def flatten!() end",
"def flatten\n nodes = []\n queue = [node]\n\n while node = queue.shift\n nodes << node\n queue.unshift(*node.children) unless node.leaf?\n end\n\n nodes\n end",
"def normalise!(tree)\n tree.each.with_index do |node, i|\n if node.is_a?(Array)\n if node.first == :loop && tree[i+1]\n key = tree[i+1][0]\n if key == :block\n tree[i+1][0] = :lblock\n elsif key == :query # wrap queries like `c.each(&:destroy)` \n tree[i+1] = [:lblock, tree[i+1]]\n end\n end\n tree[i] = normalise!(node)\n end\n end\n tree\n end",
"def convert_binary_tree_to_double_linked_list_with_aux(root)\n return if root.nil?\n\n stack = Array.new\n prev = nil\n head = nil\n\n while(stack.length > 0 || root)\n if root\n stack.push(root)\n root = root.left\n else\n root = stack.pop\n\n node = LinkedListNode.new(root.value)\n\n if head.nil?\n head = node\n end\n\n if prev\n prev.next = node\n node.prev = prev\n end\n\n prev = node\n\n root = root.right\n end\n end\n\n return head\nend",
"def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end",
"def convert_bst_to_singly_linked_list(root, head)\n # if tree is empty, do nothing\n if root.nil?\n return head\n end\n # convert left sub-tree\n head = convert_bst_to_singly_linked_list root.left, head\n # append the root itself\n root.left = head\n puts \"appending #{root.value} to \" + (head.nil? ? \"nil\" : \"#{head.value}\") if $debug\n # convert right sub-tree\n head = convert_bst_to_singly_linked_list root.right, root\n # return the new head\n return head\nend",
"def produce_tree(ary); end",
"def invert_tree_dfs_iter(root)\n stack = [root]\n while !stack.empty?\n node = stack.pop()\n next if !node\n node.left, node.right = node.right, node.left\n stack += [node.left, node.right]\n end\n\n root\nend",
"def flatten(data, path = Path.new([]))\n case data\n when Array\n data.each_with_index.map do |d,i|\n pathi = path + [i]\n pathi.add_index path.length\n flatten(d, pathi)\n end\n when Hash\n data.map {|k,v| flatten(v, path + [k.to_s])}\n else \n leaf = Leaf.new(path,data)\n @leaves << leaf\n end\n @leaves\n end",
"def preorder(node)\n # 1->2->4->5->3->6\n if node\n print node.value.to_s + '->'\n preorder(node.left_child)\n preorder(node.right_child)\n end\n end",
"def flatten_task_tree\n tasks = [self]\n start_index = 0\n loop do\n end_index = tasks.length\n while start_index < end_index\n tasks.concat(tasks[start_index].next_tasks) unless tasks[start_index].next_tasks.nil?\n start_index += 1\n end\n break if end_index == tasks.length\n\n start_index = end_index\n end\n tasks\n end",
"def invert_tree(root)\n return root if !root\n stack = [root]\n while stack.length > 0\n node = stack.pop\n node.left , node.right = node.right, node.left\n stack << node.left if node.left\n stack << node.right if node.right\n end\n root\nend",
"def DFT_pre_order_recursive(root)\n if root == nil\n return\n end\n print \"#{root.value}\\n\"\n DFT_pre_order_recursive(root.left)\n DFT_pre_order_recursive(root.right)\n end",
"def preorder\n return [] if @root == nil\n\n current = @root \n tree = []\n \n return preorder_helper(current, tree)\n end",
"def inorder_traversal(root)\n #Base: when root is at the end\n return [] if root.nil?\n #Declare empty array\n result = []\n #push recursive call of root.left\n result.concat(inorder_traversal(root.left))\n #push root vale itself\n result << root.val\n #push recursive call of root.right\n result.concat(inorder_traversal(root.right))\n # return result \n result\nend",
"def preorder_traverse(root=@root)\n unless !root\n result = \"#{root.data}\"\n result << preorder_traverse(root.left) unless !root.left\n result << preorder_traverse(root.right) unless !root.right\n result\n end\n end",
"def flatten\n\t\t\treturn @root.generate_from(@substitutions).join('\\n')\n\t\tend",
"def preorder(node)\n return if !node\n print node.value, \" \"\n preorder(node.left_child)\n preorder(node.right_child)\n end",
"def convert_binary_tree_to_mirror(root)\n return if !root\n temp_node = Node.new()\n # recursively call the method on both left and right subtrees\n convert_binary_tree_to_mirror(root.left_child)\n convert_binary_tree_to_mirror(root.right_child)\n\n # swap the left and right subtrees\n temp_node = root.left_child\n root.left_child = root.right_child\n root.right_child = temp_node\n\n return root\nend",
"def preorder_traversal root\n result = []\n\n result << root.val\n result << preorder_traversal(root.left) unless root.left.nil?\n result << preorder_traversal(root.right) unless root.right.nil?\n\n result\nend",
"def DFT_pre_order_iterative(root)\n print '[\"I\", \"O\", \"L\", \"A\", \"G\", \"R\", \"H\", \"T\", \"M\"]' + \"\\n\"\n st = Stack.new\n if root == nil\n return\n end\n st.push(root)\n while !st.empty?\n root = st.pop\n print \"#{root.value}\\n\"\n if root.right\n st.push(root.right)\n end\n if root.left\n st.push(root.left)\n end\n end\n end",
"def tree\n root = Node.new(1)\n root.left = Node.new(2)\n root.right = Node.new(3)\n root.left.left = Node.new(4)\n root.left.right = Node.new(5)\n root.right.left = Node.new(6)\n root.right.right = Node.new(7)\n root.right.right.right = Node.new(8)\n root\nend",
"def bfs(tree)\n Enumerator.new do |yielder|\n queue = [tree]\n while !queue.empty?\n node = queue.shift\n children = node[1..-1]\n yielder << node.first\n children.each do |child|\n queue << child\n end\n end\n end\nend",
"def to_tree() = puts(TTY::Tree.new({ '.' => as_tree }).render)",
"def test_tree_parser_rewrite_flat_list\n grammar = \"grammar T;\\n\" + \"options {output=AST;}\\n\" + \"a : ID INT;\\n\" + \"ID : 'a'..'z'+ ;\\n\" + \"INT : '0'..'9'+;\\n\" + \"WS : (' '|'\\\\n') {$channel=HIDDEN;} ;\\n\"\n tree_grammar = \"tree grammar TP;\\n\" + \"options {output=AST; ASTLabelType=CommonTree; tokenVocab=T;}\\n\" + \"@members {\\n\" + \"static class V extends CommonTree {\\n\" + \" public V(Object t) { super((CommonTree)t); }\\n\" + \" public String toString() { return token.getText()+\\\"<V>\\\";}\\n\" + \"}\\n\" + \"static class W extends CommonTree {\\n\" + \" public W(Object t) { super((CommonTree)t); }\\n\" + \" public String toString() { return token.getText()+\\\"<W>\\\";}\\n\" + \"}\\n\" + \"}\\n\" + \"a : ID INT -> INT<V> ID<W>\\n\" + \" ;\\n\"\n found = exec_tree_parser(\"T.g\", grammar, \"TParser\", \"TP.g\", tree_grammar, \"TP\", \"TLexer\", \"a\", \"a\", \"abc 34\")\n assert_equals(\"34<V> abc<W>\\n\", found)\n end",
"def flatten\n # strip & remove the space surrounding '/'\n str = strip.gsub(%r{\\s*\\/\\s*}, '/')\n return str unless str.include? '/'\n return f_semicolon(str) if str.include?(';')\n return f_parenthese(str) if str.include? '('\n f_convert(str)\n end",
"def tree(object, locals = {})\n locals = {\n depth: [],\n }.merge(locals)\n\n if locals[:depth].size > @options[:drop]\n if object == object.parent.children.last\n prefix_char = @options[:edge_char]\n else\n prefix_char = @options[:connect_char]\n end\n else\n prefix_char = \"\"\n end\n\n indents = locals[:depth].each.with_index.collect {|e, i|\n if i > @options[:drop]\n tab = e ? @options[:tab_visible_char] : \"\"\n tab.toeuc.ljust(@options[:tab_space]).toutf8\n end\n }.join\n\n if @block\n label = @block.call(object, locals)\n else\n if locals[:depth].empty? && @options[:root_label] # Change if there is root and alternative label\n label = @options[:root_label]\n else\n label = TreeSupport.node_name(object)\n end\n end\n\n buffer = \"\"\n branch_char = nil\n\n if locals[:depth].size > @options[:drop]\n branch_char = @options[:branch_char]\n end\n if locals[:depth].size < @options[:take]\n if locals[:depth].size >= @options[:drop]\n buffer = \"#{indents}#{prefix_char}#{branch_char}#{label}#{@options[:debug] ? locals[:depth].inspect : \"\"}\\n\"\n end\n end\n\n flag = false\n if object.parent\n flag = (object != object.parent.children.last)\n end\n\n locals[:depth].push(flag)\n if locals[:depth].size < @options[:take]\n buffer << object.children.collect {|node| tree(node, locals)}.join\n end\n locals[:depth].pop\n\n buffer\n end",
"def flatten\n out = []\n _recursively_flatten_to!(self, out)\n list = NodeList.new(out)\n list.parent = self.parent\n list\n end",
"def BSTtoDLL(node)\n if !node\n return node\n end\n\n l_head = BSTtoDLL(node.left)\n r_head = BSTtoDLL(node.right)\n\n if l_head\n rightmost = l_head\n while rightmost.right != nil\n rightmost = rightmost.right\n end\n node.left = rightmost\n rightmost.right = node\n else\n l_head = node\n end\n\n if r_head\n node.right = r_head\n r_head.left = node\n else\n node.right = nil\n end\n\n return l_head\n\nend",
"def flatten!\n nil\n end",
"def sorted_list_to_bst(head)\n return nil if head.nil?\n return TreeNode.new(head.val) if head.next.nil?\n half = head\n prev = head\n finish = head.next\n while finish && finish.next\n prev = half\n half = half.next\n finish = finish.next.next\n end\n \n mid = prev.next\n prev.next = nil\n result = TreeNode.new(mid.val)\n result.left = sorted_list_to_bst(head)\n result.right = sorted_list_to_bst(mid.next)\n result\nend",
"def invert_binary_tree(tree)\n\n queue = [tree]\n while queue.length != 0\n current = queue.shift\n\n if current.nil?\n next\n end\n\n swap_left_and_right(current)\n queue.append(current.left)\n queue.append(current.right)\n\n end\n\n return tree\n\nend",
"def postorder_traverse(root=@root)\n unless !root\n result = root.left ? \"#{postorder_traverse(root.left)}\" : \"\"\n result << postorder_traverse(root.right) unless !root.right\n result << root.data\n result\n end\n end",
"def binary_tree_inorder_iterative(root)\n return if root.nil?\n\n stack = Array.new\n\n while (stack.length != 0 || root)\n if root\n stack.push(root)\n root = root.left\n else\n root = stack.pop()\n print \"#{root.value} \"\n root = root.right\n end\n end\nend",
"def invert_tree(root)\n return if root.nil?\n root.left, root.right = root.right, root.left\n invert_tree(root.left)\n invert_tree(root.right)\n\n root\nend",
"def invert_tree(root)\n # recursive base case\n return nil if root.nil?\n\n # perform operation (switching left and right children) on root\n root.left, root.right = root.right, root.left\n\n # recursively perform operation on children\n invert_tree(root.left)\n invert_tree(root.right)\n\n root\nend",
"def invert_tree(root)\n return nil if root.nil?\n\n invert_tree(root.left)\n invert_tree(root.right)\n\n temp = root.left\n root.left = root.right\n root.right = temp\n\n root\nend",
"def invert_tree(root)\n return root unless root\n\n temp = root.left\n root.left = invert_tree(root.right)\n root.right = invert_tree(temp)\n\n root\nend",
"def print_preorder\n return \"Empty BST\" if is_empty\n\n stack = [@root]\n\n until stack.empty?\n current = stack.pop\n\n puts current.value\n\n stack << current.right unless current.right.nil?\n stack << current.left unless current.left.nil?\n end\n end",
"def preOrderTraversal(root)\n return nil if root == nil\n\n stack = [root]\n while !stack.empty?\n node = stack.pop\n print \" #{node.value}\"\n if node.right != nil\n stack.push(node.right)\n end\n if node.left != nil\n stack.push(node.left)\n end\n end\nend",
"def flatten\n dup\n end",
"def preorder\n return [] if @root.nil?\n result = []\n return preorder_helper(@root, result)\n end",
"def preorder_transversal(root)\n\treturn if root.nil?\n\n\tp root.value\n\n\tpreorder_transversal(root.left)\n\tpreorder_transversal(root.right)\nend",
"def preorder\n array = []\n return [] if @root.nil?\n current = @root\n\n return preorder_recursive(current, array)\n end",
"def preorder (root = self, array = [])\n array << root.value\n preorder(root.left, array) unless root.left.nil?\n preorder(root.right, array) unless root.right.nil?\n array\n end",
"def in_order_traversal(root)\n result = []\n\n result << in_order_traversal(root.left) unless root.left.nil?\n result << root.val\n result << in_order_traversal(root.right) unless root.right.nil?\n\n result.flatten\nend",
"def invert_tree(root)\n return nil if root == nil\n left = invert_tree(root.left);\n right = invert_tree(root.right);\n root.left = right;\n root.right = left;\n return root;\nend",
"def structure_reform(curNode, addNode)\n # reset branches for reform\n @branches = []\n @branch_count = 0\n # puts 'before cleanup'\n # lNode.print_tree\n # rNode.print_tree\n # rNode.print_tree\n # remove_PH_node(lNode)\n # remove_PH_node(rNode)\n # remove_PH_node(curNode)\n # puts 'after cleanup'\n # curNode.print_tree\n # addNode.print_tree\n # rNode.print_tree\n curChildren = curNode.children.count == 0 ? [curNode] : curNode.children\n addChildren = addNode.children.count == 0 ? [addNode] : addNode.children\n count = 0\n # p 'lnode'\n # pp lChildren\n # p 'rnode'\n curChildren.each do |ln|\n curNode.remove!(ln)\n addChildren.each do |rn|\n # p '--------------'\n # p 'ln'\n # ln.print_tree\n # p 'rn'\n # rn.print_tree\n # binding.pry\n # phName=\"PH#{@branch_count}\"\n # ph =Tree::TreeNode.new(phName, '')\n ln_append = ln.detached_subtree_copy\n # p 'ln_append before'\n # ln_append.print_tree\n append_to_end(ln_append, rn)\n # p 'ln_append'\n # ln_append.print_tree\n # ph<<ln_append #unless curNode==newNode\n ln_append = add_branch(ln_append)\n # p 'ln_append after'\n # ln_append.print_tree\n curNode << ln_append\n # p 'ph'\n # ph.print_tree\n # p 'curNode'\n # curNode.print_tree\n end\n end\n end",
"def preorder\n return [] if @root == nil\n return preorder_helper(@root, [])\n end",
"def build_tree_unsorted(arr)\n root = nil\n arr.each do |item|\n root = insert_tree(item, root)\n end\n\n root\nend",
"def flatten(array)\n return [] if array.empty? \n list = []\n head = array[0]\n rest = array[1..-1]\n if head.is_a? Array \n flatten(head) + flatten(rest)\n else \n list += [head] + flatten(rest)\n end \nend",
"def build_tree(data)\n @root = Node.new(data[0])\n data.shift\n data.each { |value| @root.insert(value) }\n end",
"def binary_tree_connect_siblings(root)\n return if root.nil?\n\n current = last = root\n\n while current\n if (current.left)\n last.next = current.left\n last = current.left\n end\n\n if current.right\n last.next = current.right\n last = current.right\n end\n\n last.next = nil\n current = current.next\n end\nend",
"def preorder_traversal(node=@root)\n return if (node == nil)\n preorder_traversal(node.left)\n preorder_traversal(node.right)\n puts node.value.to_s\n end",
"def build_tree(preorder, inorder)\n return nil if preorder.empty? || inorder.empty?\n \n root = TreeNode.new(preorder.first)\n idx = inorder.find_index(preorder.first)\n preorder.shift\n\n root.left = build_tree(preorder, inorder.slice(0..(idx-1))) unless idx==0\n root.right = build_tree(preorder, inorder.slice((idx+1)..-1)) if idx!=inorder.size-1\n \n return root\nend",
"def build_tree(arr)\n @root = insert_node(nil, arr.shift)\n arr.each { |value| insert_node(@root, value) }\n end",
"def _recursively_flatten_to!(array, out)\n array.each do |o|\n if NodeList === o\n _recursively_flatten_to!(o.nodes, out)\n elsif o.respond_to?(:to_ary)\n ary = Array === o ? o : o.to_ary\n _recursively_flatten_to!(ary, out)\n else\n out << o\n end\n end\n end",
"def make_tree(in_list, pid = self.pid)\n [].tap do |top_level|\n left_over = []\n # Categorize into top level, or not top level\n in_list.each do |node|\n if node['parent_page_id'].blank? || node['parent_page_id'] == pid\n top_level.unshift node\n else\n left_over.unshift node\n end\n end\n\n # For each of the top_level nodes make a subtree with the leftovers.\n top_level.each do |node|\n node['children'] = make_tree(left_over, node['id'])\n end\n end\n end",
"def flatten(arr)\n\n flat = []\n\n arr.each do |el|\n if el.class != Array\n flat << el \n else\n #flatten(el).each {|char| flat << char}\n flat.push(*flatten(el))\n end\n end\n flat \nend",
"def flatten(list)\n list.flatten\nend",
"def transform(tree); end",
"def reconstruct_bst_from_traversal(pre_order)\n reconstruct_bst_rec(0, pre_order.length - 1, pre_order)\nend",
"def pre_order_traverse(tree, array)\n if !tree.nil?\n array.append(tree.value)\n pre_order_traverse(tree.left, array)\n pre_order_traverse(tree.right, array)\n end\n \n return array\n\nend",
"def inorder_traverse(root=@root)\n unless !root\n result = root.left ? \"#{inorder_traverse(root.left)}\" : \"\"\n result << root.data\n result << inorder_traverse(root.right) unless !root.right\n result\n end\n end",
"def get_all_trees_from_preorder(array, start=0, end_index=array.size-1)\n #Pre-order visits root first. So 1st element is always root of the tree. next element could be left or right\n #Form all trees with next element being its left, then trees with next element as its right etc.\n # [1,2,3,4] => Use DP approach, bottom up approach. Go all the way down to last 2 nodes\n # 3 3\n # 4 and 4\n # Now 2 can be added as the root and left could be 3 and right could be 3\n # 4 4\n # And follow this till root\n if (start == array.size-1)\n return [Node.new(array[start])]\n end\n results = []\n trees = get_all_trees_from_preorder(array, start+1, end_index-1)\n trees.each do |tree|\n node1 = Node.new(array[start])\n node1.left = tree\n results << node1\n node2 = Node.new(array[start])\n node2.right = tree\n results << node2\n end\n results\nend",
"def buildTree(node,arr)\n node.value = arr.shift\n size = (arr.size/2.0).round\n if size > 0\n left, right = arr.each_slice( size ).to_a\n if left and left.count > 0\n node.left = TreeNode.new\n buildTree(node.left, left)\n end\n if right and right.count > 0\n node.right = TreeNode.new\n buildTree(node.right, right)\n end\n end\nend",
"def test_unflatten_process\r\n proc = @mymodel.node_list.add_node(1, 'proc1', PROCESS)\r\n proc.commentary='com'\r\n proc.description='dsc' \r\n proc.evidence=0.23\r\n \r\n data = proc.flatten_data\r\n \r\n @mymodel.node_list.delete_node(proc)\r\n \r\n livenode = @mymodel.node_list.node_from_data(data)\r\n \r\n assert_equal(proc.ident, livenode.ident) \r\n assert_equal(proc.name, livenode.name) \r\n assert_equal(proc.node_type, livenode.node_type) \r\n assert_equal(proc.commentary, livenode.commentary) \r\n assert_equal(proc.description, livenode.description) \r\n assert_equal(proc.evidence, livenode.evidence) \r\n end",
"def reverse_recursive_list(node)\n # After reaching end of list we point head to end node and return\n if node.next == nil\n @head = node\n return\n end\n reverse_recursive_list(node.next)\n # Recursion starts folding up\n temp = node.next\n temp.next = node\n node.next = nil\n end",
"def reverse_recursive_list(node)\n # After reaching end of list we point head to end node and return\n if node.next == nil\n @head = node\n return\n end\n reverse_recursive_list(node.next)\n # Recursion starts folding up\n temp = node.next\n temp.next = node\n node.next = nil\n end",
"def invert_tree root\n temp_pointer = root.left\n root.left = root.right\n root.right = temp_pointer\n\n invert_tree(root.left) if root.left\n invert_tree(root.right) if root.right\n root\nend",
"def print_tree\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n if current.parent.nil?\n puts current.tag\n else\n puts \"#{current.tag}\\t<=\\t#{current.parent.tag}\"\n end\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end",
"def dfs(root, result)\n return if root.nil?\n result << root.val if root.left.nil? && root.right.nil?\n dfs(root.left, result)\n dfs(root.right, result)\nend",
"def build_tree_2(data_array)\n root = nil\n \n data_array.each do |elem|\n node = insert_node(root, nil, elem) \n\troot ||= node\n end\n \n root\nend",
"def flatten( level = 1 )\n\n load_parent_state\n \n return super\n\n end",
"def preOrder(root) # O(n)\n\n return nil if root == nil\n\n print \" #{root.value}\"\n preOrder(root.left)\n preOrder(root.right)\n\nend",
"def reduceTree( rootNode=@root )\n return if rootNode.nil?\n return if (rootNode.leftChild.nil? && rootNode.rightChild.nil? )\n reduceTree( rootNode.leftChild ) \n reduceTree( rootNode.rightChild )\n\n # If both children are numeric values, we can just perform the proper\n # operation on the children values and then replace the current node's\n # data with the result\n if( rootNode.leftChild.isNumeric? && rootNode.rightChild.isNumeric? )\n # This is a little verbose\n case rootNode.data\n when '+'\n rootNode.data = ( Float( rootNode.leftChild.data.to_f + rootNode.rightChild.data.to_f).to_s )\n when '-'\n rootNode.data = ( Float( rootNode.leftChild.data.to_f - rootNode.rightChild.data.to_f).to_s )\n when '*'\n rootNode.data = ( Float( rootNode.leftChild.data.to_f * rootNode.rightChild.data.to_f).to_s )\n when '/'\n rootNode.data = ( Float( rootNode.leftChild.data.to_f / rootNode.rightChild.data.to_f).to_s )\n end\n rootNode.leftChild = nil\n rootNode.rightChild = nil\n end\n\n end",
"def print_tree\n ''\n end",
"def preorder\n preorder_traversal(@root, [])\n end",
"def flatten!\n self.replace(flatten)\n end",
"def tree2path_helper(tree, current, path)\n path << '/' << current\n if !tree.children.empty?\n set = []\n # use reverse to be consistent with the sample in the problem\n tree.children.reverse_each do |child|\n set << child.data unless child.data.include?('-')\n end\n acc = set.inject('') {|acc, e| acc + e + '|'}[0..-2]\n tree2path_helper(tree.children[0], acc, path)\n end\n end",
"def pre_order_array(tree)\n output = tree.nil? || tree.data == 0 ? \"\" : tree.data.to_s + \" \"\n left = tree.left.nil? ? \"\" : pre_order_array(tree.left)\n right = tree.right.nil? ? \"\" : pre_order_array(tree.right)\n output + left + right\nend",
"def preorder(node)\n p node.value if node.value \n preorder(node.left) if node.left\n preorder(node.right) if node.right\nend",
"def serialize2(root, results = [])\n if root.nil?\n results.push('None')\n return\n end\n\n results.push(root.val)\n\n serialize2(root.left, results)\n serialize2(root.right, results)\n\n results.join(',')\nend",
"def preorder\n tree_array = []\n if root.nil?\n return tree_array\n else\n root.preorder(tree_array)\n return tree_array\n end\n end",
"def serialize(root, array)\n if root == nil\n array.push('N')\n return\n else\n array.push(root.val)\n serialize(root.left, array)\n serialize(root.right, array)\n end\n array.join(\",\")\nend",
"def prepend(root); end",
"def test_unflatten_perfind2\r\n pi = @mymodel.node_list.add_node(4, 'perfind4', PERFIND)\r\n \r\n data = pi.flatten_data\r\n \r\n @mymodel.node_list.delete_node(pi)\r\n \r\n livenode = @mymodel.node_list.node_from_data(data)\r\n \r\n assert_equal(pi.ident, livenode.ident) \r\n assert_equal(pi.value_function, livenode.value_function) \r\n end",
"def make_tree(pre, inord)\n return if pre.size == 0\n root_node = Node.new(pre[0])\n idx = inord.index(pre[0])\n root_node.left = make_tree(pre[1..idx], inord[0...idx])\n root_node.right = make_tree(pre[idx+1...pre.size], inord[idx+1...inord.size])\n return root_node\nend",
"def preorder_iterative(&block)\n stack = []\n\n stack.push(@root)\n until stack.empty?\n node = stack.pop\n yield node\n\n stack.push(node.right) if node.right\n stack.push(node.left) if node.left\n end\n end",
"def invert_tree(root)\n return nil unless root\n\n left_inverted = invert_tree(root.left)\n right_inverted = invert_tree(root.right)\n\n root.left = right_inverted\n root.right = left_inverted\n\n root\nend",
"def invert_tree(root)\n return root unless root\n\n temp = root.left\n root.left = root.right\n root.right = temp\n\n invert_tree root.left if root.left\n invert_tree root.right if root.right\n\n return root\nend",
"def postOrder(root)\n return nil if root == nil\n\n postOrder(root.left)\n postOrder(root.right)\n print \" #{root.value}\"\nend",
"def flatten(depth = -1)\n to_a.flatten(depth)\n end"
] |
[
"0.72990847",
"0.7271779",
"0.68742156",
"0.67825526",
"0.67161083",
"0.66788054",
"0.64865303",
"0.6417936",
"0.63861215",
"0.61944836",
"0.6142488",
"0.60923606",
"0.6083021",
"0.60218424",
"0.6000489",
"0.5998313",
"0.5996439",
"0.59837335",
"0.5980911",
"0.5943467",
"0.5937737",
"0.5901078",
"0.58876127",
"0.58708966",
"0.58578694",
"0.5856723",
"0.5840696",
"0.58361226",
"0.58354515",
"0.58329093",
"0.5817567",
"0.58168024",
"0.58145565",
"0.58073914",
"0.57832605",
"0.57712984",
"0.57531196",
"0.57459825",
"0.5742845",
"0.57361484",
"0.5727884",
"0.5719474",
"0.57139003",
"0.5713519",
"0.5710995",
"0.5705157",
"0.5700422",
"0.5699278",
"0.56892455",
"0.5657831",
"0.5627324",
"0.5626613",
"0.5624825",
"0.5613437",
"0.56029004",
"0.5602581",
"0.5601557",
"0.5596857",
"0.5596218",
"0.5593949",
"0.5593863",
"0.55936265",
"0.5592046",
"0.5586495",
"0.55835074",
"0.558045",
"0.5579905",
"0.5579802",
"0.55661094",
"0.55635875",
"0.55614793",
"0.5559535",
"0.5546381",
"0.554404",
"0.5541691",
"0.5541691",
"0.5541217",
"0.5533387",
"0.55291396",
"0.55190414",
"0.5518668",
"0.55162007",
"0.55146265",
"0.55135196",
"0.55129343",
"0.5511113",
"0.5510903",
"0.5503793",
"0.55008036",
"0.55003786",
"0.54913306",
"0.5485267",
"0.54781693",
"0.546314",
"0.5459212",
"0.5457875",
"0.54535407",
"0.544851",
"0.5445074",
"0.5444666"
] |
0.6872538
|
3
|
fetches the product referenced by the id.
|
def fetch_product
@product = Product.visible.find(params[:id]) if params[:id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_by_id(id)\n get_product_by_id(id)\n end",
"def get_product_by_id(product_id)\n return Product.find(product_id)\n end",
"def getProduct(id)\n @products.find {|prod| prod.productId.to_i == id.to_i}\n end",
"def getProduct( product_id)\n params = Hash.new\n params['product_id'] = product_id\n return doCurl(\"get\",\"/product\",params)\n end",
"def get_product\n @product = Product.find(params[:id])\n end",
"def product(product_id)\n FarMar::Product.all.find { |product| product.id == product_id }\n end",
"def getItem\n Product.select(:product).find(params[:id])\n end",
"def get(product_id)\n get_request(t_url(:product, product_id))\n end",
"def find(product_id, options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(product_id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"product\"]\n \n \n obj = Product.new(@client)\n return_values.push(obj.fill_with_data(body))\n \n\n \n return_values[0]\n end",
"def product\n id = self.product_id\n found_product = FarMar::Product.find(id)\n return found_product\n end",
"def product\n FarMar::Product.find(@product_id)\n end",
"def load_product\n @product = Product.find(params[:product_id])\n end",
"def get_product\n @product = Product.find_by_uuid(params[:product_id])\n if @product.nil?\n raise Repia::Errors::NotFound\n end\n end",
"def product\n @product ||= Product.find(params[:id])\n end",
"def product\n FarMar::Product.find(self.product_id)\n end",
"def find(product_id)\n path = \"/product-view/products/#{product_id}\"\n\n response, status = BeyondApi::Request.get(@session,\n path)\n\n handle_response(response, status)\n end",
"def product(product)\n products.find(product.id)\n end",
"def find(product_id)\n all.each do |product|\n if product.product_id == product_id\n return product\n end\n end\n return nil\n end",
"def find(productline_id)\n setup_request \"#{@@resource_url}/#{productline_id}\"\n end",
"def get_product(rid, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n }\n api_call('/stores/:uid/products/:rid(.:format)',:get,params,add_params)\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def find_for_reload\n self.class.find(self.product_id, self.id)\n end",
"def get_product_by_id_with_http_info(product_id, opts = {})\n if api_client.config.debugging\n api_client.config.logger.debug 'Calling API: Product.get_product_by_id ...'\n end\n # verify the required parameter 'product_id' is set\n if api_client.config.client_side_validation && product_id.nil?\n fail ArgumentError, \"Missing the required parameter 'product_id' when calling Product.get_product_by_id\"\n end\n # resource path\n local_var_path = '/products/{productId}'.sub('{' + 'productId' + '}', product_id.to_s)\n\n # query parameters\n query_params = opts\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Product')\n if api_client.config.debugging\n api_client.config.logger.debug \"API called: Product#get_product_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve\n self.class.get( id )\n end",
"def show\n @product=Product.full.find(params[:id])\n end",
"def set_product\n @product = Product.find_by_hashid(params[:id])\n end",
"def product\n FarMar::Product.all.select { |product| product.product_id == product_info }\n end",
"def show\n @product = Product.find_by(productID: params[:productID])\n end",
"def show\n @product = Product.find(@params[:id])\n end",
"def set_product\n @product = Product.with_default_includes.find(params[:id])\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.name} with ID=#{id}\")\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.class.name} with ID=#{id}\")\n end",
"def set_product\n @product = current_api_v1_user.products.find(params[:id])\n end",
"def set_product\n @product = Product.includes(:lotteries, :ranking_config_items).find(params[:id])\n end",
"def show\r\n @product = Product.find(params[:id])\r\n end",
"def retrieve(id)\n @client.make_request(:get, \"parcels/#{id}\", MODEL_CLASS)\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def get_by_id\n\t\t# Parse query string\n\t\taccess_token = params[:access_token]\n\t\trefresh_token = params[:refresh_token]\n\t\tproduct_id = params[:id]\n\n\t\t# Create the Meli instance\t\t\n\t\tmeli = MeliFactory.create(access_token, refresh_token)\n\n\t\t# Get the item using the MeLi API\n\t\turl = Url.get_item(product_id)\n\t\tresponse = meli.get(url)\n\t\titem = JSON.parse response.body\n\n\t\t# Get the item questions using the MeLi API\n\t\titem_response = meli.get(url)\n\t\titem_json = JSON.parse item_response.body\n\n\t\t# Get the questions\n\t\tq_url = \"/my/received_questions/search?access_token=#{access_token}\"\n\t\tq_response = meli.get(q_url)\n\t\tquestions = JSON.parse q_response.body\n\t\t\n\t\tmy_questions = []\n\t\tquestions[\"questions\"].each { | question |\n\t\t\tif question[\"item_id\"] == product_id \n\t\t\t\tmy_questions.push question\n\t\t\tend\n\t\t}\n\n\t\tp = Product.new(Integer(item[\"initial_quantity\"]), Integer(item[\"available_quantity\"]), Integer(item[\"price\"]), Date.parse(item[\"start_time\"]), my_questions.length)\n\n\t\t# Creates the Product instance\n\t\trespond_to do |format|\n\t\t\tformat.json {render :json => p}\n\t\tend\n\n\tend",
"def product\n Product.find_by_outer_id(outer_id) || Product.find_by_num_iid(num_iid)\n end",
"def product_id\n read('product_id')\n end",
"def show\n @product = Product.find_by(id: @order.product_id)\n end",
"def set_product\n begin \n @product = Product.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n puts e\n end\n end",
"def fetch\n @product = Product.new(\n params\n .require(:product)\n .permit(:category_id, :sub_category_id, :product_url)\n ).fetch_from_url\n end",
"def quick_view_product_by(id)\r\n product_description = nil\r\n detail_pdp_name = nil\r\n\r\n # Make sure quick view link is displayed\r\n page.execute_script(\"$('.resultList \\##{id} div div a.quick-view.btn.btn-green.btn-small').removeAttr('class');\")\r\n find(:xpath, \"(//div[@class='resultList']//a[contains(@data-params,'id=#{id}')])[1]\").click\r\n\r\n product_description = find(:xpath, \".//*[@id='#{id}QuickView']/div[3]/div[1]\").text if has_xpath?(\".//*[@id='#{id}QuickView']/div[3]/div[1]\", wait: 3)\r\n detail_pdp_name = find(:xpath, \".//*[@id='#{id}QuickView']//span[@class='format-title']\").text if has_xpath?(\".//*[@id='#{id}QuickView']//span[@class='format-title']\", wait: 0)\r\n\r\n # Close QuickView box\r\n close_quick_view_btn.click if has_close_quick_view_btn?\r\n\r\n { description: product_description, detail_pdp_name: detail_pdp_name }\r\n end",
"def find_product\n @stock_product = Product.where(id: params[:product_id]).take\n if @stock_product.present?\n @stockitem = Stockitem.new\n else\n render json: { msg: 'Produto não existe em estoque' }\n end\n end",
"def set_product\n @product = Product.find_by( :id => params[:id] )\n end",
"def set_product\n @product = @products.find(params[:id])\n end",
"def set_product\n \n @product = Product.find(params[:id].to_i)\n end",
"def init_product\n @product = current_facility_products.find_by!(url_name: params[:\"#{singular_object_name}_id\"] || params[:id])\n end",
"def get_product_by_id(product_id, opts = {})\n data, _status_code, _headers = get_product_by_id_with_http_info(product_id, opts)\n data\n end",
"def set_product\n @product = LowestPrice.where(id: params[:id]).first\n end",
"def find_resource\n if !params[:format].nil? && params[:format] == \"json\"\n begin\n p \"i came in\"\n p params[:id]\n Product.find_by_id(params[:id])\n rescue Exception => e\n error = error_response_method($e2)\n render :json => error\n end\n else\n Product.find_by_permalink!(params[:id])\n end\n end",
"def show\n @productshow = Product.find_by_id(params[:product_id])\n \n end",
"def procurement_products_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProductsItemApi.procurement_products_id_get ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling ProductsItemApi.procurement_products_id_get\" if id.nil?\n # resource path\n local_var_path = \"/procurement/products/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ProductItem')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductsItemApi#procurement_products_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_product\n @product = product.find(params[:id])\n end",
"def get(id)\n Ribs.with_handle(self.database) do |h|\n h.get(self.metadata.persistent_class.entity_name, id)\n end\n end",
"def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id => id\n\n resource_hash.nil? ? nil : self.new(resource_hash)\n end",
"def fetch(id)\n build_resource(raw.fetch(id))\n end",
"def edit\n @product = Product.find_by(productID: params[:id])\n end",
"def show\n # @product = Product.find(params[:id])\n end",
"def set_product\n if params[:id] =~ /[[:alpha:]]/\n @product = Product.find_by(url: params[:id])\n else\n @product = Product.find(params[:id])\n end\n end",
"def set_prod\n @product = Product.find(params[:id])\n end",
"def set_my_product\n @my_product = Product.includes(:tweets).find(params[:id])\n end",
"def retrieve(id)\n raise NotFound.new(\"id '#{id}'\") unless ids.include?(id)\n\n storage[id]\n end",
"def obtains_product\n product = Product.find(params[:product_id])\n @product = product.user_id == @current_user.id ? product : nil\n (render(json: { e: 'AUTH' }, status: :unauthorized) && nil) if @product.nil?\n end",
"def set_product\n @product = Product.with_deleted.find(params[:id])\n end",
"def get_product_image\n @product_image = ProductImage.find_by_uuid(params[:id])\n if @product_image.nil?\n raise Repia::Errors::NotFound\n end\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n\t @product = Product.friendly.find(params[:id])\n\t end",
"def set_product\r\n\t\t\t@product = @application.products.find(params[:id])\r\n\t\tend",
"def get_product\n Rpc::GetProductResp.new(\n product: Rpc::Product.new(\n id: 1,\n name: 'name',\n price: 2\n )\n )\n end",
"def show\n @products = Product.find(params[:id])\n end",
"def set_product\r\n @product = Product.find(params[:id])\r\n end",
"def set_product\r\n @product = Product.find(params[:id])\r\n end",
"def product\n product_sold = nil\n products = FarMar::Product.all\n products.each do |product|\n if product.id == self.product_id\n product_sold = product\n return product_sold\n end#of if\n end#of do\n end",
"def set_product\n @products = Product.find(params[:id])\n end",
"def set_product\n \t@product = Product.find(params[:id])\n end",
"def show_details(id_to_show_details_from_db)\n @db.query(\"SELECT * FROM products WHERE id = '#{id_to_show_details_from_db}'\", :symbolize_keys => true).first\n end",
"def set_product\n\t @product = Product.find(params[:id])\n\t end",
"def fetch(id)\n search(id: id)[:records].first\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n @product = Product.find(params[:id])\n end",
"def set_product\n @product = Product.find(params[:id])\n end"
] |
[
"0.80749166",
"0.7794719",
"0.7640569",
"0.7373178",
"0.73709536",
"0.73395765",
"0.73023564",
"0.7291947",
"0.72218937",
"0.7219605",
"0.71767926",
"0.7139996",
"0.70568436",
"0.70204425",
"0.6978034",
"0.6946414",
"0.69326305",
"0.6916953",
"0.6833144",
"0.676108",
"0.67127746",
"0.65372014",
"0.6518053",
"0.65149283",
"0.6459229",
"0.6454147",
"0.64506847",
"0.6448417",
"0.6423326",
"0.6420765",
"0.63917625",
"0.6391225",
"0.6387415",
"0.6386636",
"0.6384295",
"0.6380573",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.63784873",
"0.6376913",
"0.6359537",
"0.6356045",
"0.6341416",
"0.6332685",
"0.6331142",
"0.63236415",
"0.6307143",
"0.6287535",
"0.6267313",
"0.62639725",
"0.6255446",
"0.62447613",
"0.6243979",
"0.62428963",
"0.62365973",
"0.6233884",
"0.6231073",
"0.6225394",
"0.6222377",
"0.6215826",
"0.6210956",
"0.61881477",
"0.6177173",
"0.6173097",
"0.61611897",
"0.6159738",
"0.6149208",
"0.61478204",
"0.6146823",
"0.61389345",
"0.6134651",
"0.6134651",
"0.6134651",
"0.6134651",
"0.6134651",
"0.6129937",
"0.61274534",
"0.61241245",
"0.61200416",
"0.6109246",
"0.6109246",
"0.6107241",
"0.61010164",
"0.6096262",
"0.6091441",
"0.60885036",
"0.6088074",
"0.60870403",
"0.60870403",
"0.60870403"
] |
0.78149086
|
1
|
creates a cookie that will store the products this user viewed.
|
def store_visited_product
id = @product.id
unless cookies[:user_visited_products]
cookies[:user_visited_products] = id
else
cookies_array = cookies[:user_visited_products].to_s.split(',')
if cookies_array.size < 20
cookies_array << id unless cookies_array.include?("#{id}")
cookies[:user_visited_products] = cookies_array.join(",")
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_products_to_cookies\n if cookies[:product].blank?\n cookies[:product] = [params[:id]]\n else\n @recently = cookies[:product].split('&').last(8)\n unless @recently.include?(params[:id])\n cookies[:product] = [cookies[:product]] << params[:id]\n end\n end\n\n end",
"def setUser\n cookies[:user_id]=current_user.id\n cookies[:is_tech]=current_user.tech\n end",
"def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end",
"def save_viewer_info\n recent_product_ids = cookies[:recent_product_ids].present? ? JSON.parse( cookies[:recent_product_ids] ) : []\n is_newly_viewed = false\n if spree_current_user\n ::Users::ResourceAction.save_resource_action_for(spree_current_user, resource) do|resource_action|\n logger.info \"| #{resource.class}(#{resource.id}) viewed by #{spree_current_user.login}(#{spree_current_user.id}) => #{resource.view_count + 1}\"\n is_newly_viewed = true\n end\n else # only use cookies\n unless recent_product_ids.include?(resource.id)\n is_newly_viewed = true\n recent_product_ids << resource.id\n cookies[:recent_product_ids] = recent_product_ids.uniq.to_json\n end\n end\n\n if is_newly_viewed\n if resource.respond_to?(:view_count)\n resource.update(view_count: resource.view_count.to_i + 1)\n end\n end\n end",
"def remember_customer\n if cookies[AppConfig['reference_cookie_name']].nil?\n @affiliate = Affiliate.find_by_slug(params[:slug])\n unless @affiliate.nil?\n @reference = Reference.create(:affiliate_id => @affiliate.id)\n cookies[AppConfig['reference_cookie_name']] = {\n :value => @reference.cookie_token,\n :expires => AppConfig['reference_registration_span'].to_i.days.from_now\n }\n end\n end\n\n redirect_to :action => :pricing\n end",
"def store_session(res)\n my_cookie = WEBrick::Cookie.new('_rails_lite_app', @cookies.to_json)\n res.cookies << my_cookie\n end",
"def install_offers_cookie \n if @lead_was_created\n if tracking_cookie.user.blank? && resource.effective_user\n tracking_cookie.update_attribute(:user_id, resource.effective_user.id)\n end\n\n cookied_offer_array = Marshal.load(cookies['_e9_offers']) rescue []\n cookied_offer_array |= [@offer.id]\n\n cookies['_e9_offers'] = {\n :value => Marshal.dump(cookied_offer_array),\n :expires => 1.year.from_now\n }\n end\n end",
"def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @cookie.to_json)\n res.cookies << cookie\n end",
"def create_accesses_cookie\n cookies[:accesses] = {}.to_json\n end",
"def store_session(res)\n res_cookie = WEBrick::Cookie.new(\n \"_rails_lite_app\",\n @value.to_json\n )\n\n res_cookie.path = \"/\"\n res.cookies << res_cookie\n end",
"def store_session(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app', @hash.to_json)\n end",
"def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\tend",
"def store_session(res)\n res.set_cookie(:_rails_lite_app, {path:'/', value: @cookie.to_json})\n end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def bake_vote_cookie_for(question)\n cookies[\"voted_for_#{question.id}\"] = {\n :value => '1',\n :expires => 1.year.from_now # Expire not anytime soon.\n }\n end",
"def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end",
"def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end",
"def cookies\n call_once\n @cookies\n end",
"def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end",
"def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @session.to_json)\n res.cookies << cookie\n end",
"def store_session(res)\n cookie = { path: '/', value: @cookie_hash.to_json }\n res.set_cookie(\"_rails_lite_app\", cookie )\n end",
"def create_params_cookies\n cookies[:name]={ :expires => 5.minutes.from_now, :value => params[:name] } unless params[:name].nil?\n cookies[:item_id]={ :expires => 5.minutes.from_now, :value => params[:item_id] } unless params[:item_id].nil?\n cookies[:displayed]={ :expires => 5.minutes.from_now, :value => params[:displayed] } unless params[:displayed].nil?\n cookies[:for_sale]={ :expires => 5.minutes.from_now, :value => params[:for_sale] } unless params[:for_sale].nil?\n cookies[:min_price]={ :expires => 5.minutes.from_now, :value => params[:min_price] } unless params[:min_price].nil?\n cookies[:max_price]={ :expires => 5.minutes.from_now, :value => params[:max_price] } unless params[:max_price].nil?\n cookies[:category]={ :expires => 5.minutes.from_now, :value => params[:category] } unless params[:category].nil?\n cookies[:sort]={ :expires => 5.minutes.from_now, :value => params[:sort] } unless params[:sort].nil?\n cookies[:page]={ :expires => 5.minutes.from_now, :value => params[:page] } unless params[:page].nil?\n cookies[:direction]={ :expires => 5.minutes.from_now, :value => params[:direction] } unless params[:direction].nil?\n cookies[:per_page]={ :expires => 5.minutes.from_now, :value => params[:per_page] } unless params[:per_page].nil?\n cookies[:per_page]={ :expires => 5.minutes.from_now, :value => 10 } if cookies[:per_page].blank?\n end",
"def set_cookie_value\n cookie_value = User.using_client_shard(client: @client).get_cookie_value(@user.id, @user.password, @browser_user_agent)\n success_with_data({cookie_value: cookie_value, user_token_sale_state: @user.get_token_sale_state_page_name})\n end",
"def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end",
"def remember(user)\n user.remember # Defined in the User model\n cookies[:user_id] = { value: user.id,\n expires: 20.years.from_now.utc }\n\n cookies[:remember_token] = { value: user.remember_token,\n expires: 20.years.from_now.utc }\n end",
"def show\n cookies[:arch_nombre] = { value: @archive.nombre, expires: 10.minutes.from_now }\n cookies[:arch_email] = { value: @archive.email, expires: 10.minutes.from_now }\n cookies[:arch_tel] = { value: @archive.telefono, expires: 10.minutes.from_now }\n end",
"def store_session(res)\n res.set_cookie(\"_rails_lite_app\", { path: \"/\", value: \"#{@cookie.to_json}\" })\n # p res\n # res[\"_rails_lite_app\"] = @cookie.to_json\n end",
"def set_cookies_for_user(resource)\n cookies[:c_user] = {value: resource.email, expires: 2.year.from_now}\n end",
"def cookieMe\n if user_signed_in?\n cookies[:user_id] = current_user.id\n cookies[:user_token] = current_user.salt\n cookies[:user_username] = current_user.username\n cookies[:language] = current_user.language\n elsif !user_signed_in?()\n cookies.delete :user_id\n cookies.delete :user_token\n cookies.delete :user_username\n end\n end",
"def set_uuid_cookie\n uuid = cookies[:uuid] || UUIDTools::UUID.random_create.to_s\n cookies[:uuid] = { value: uuid, expires: 5.years.from_now }\n end",
"def cookieMe\n if user_signed_in?\n cookies[:user_id] = current_user.id\n cookies[:user_token] = current_user.salt\n cookies[:user_username] = current_user.username\n cookies[:language] = current_user.language\n elsif !user_signed_in?()\n cookies.delete :user_id\n cookies.delete :user_token\n cookies.delete :user_username\n end\n end",
"def new\n\t\tcookies[:sign_up] = { value: \"XJ-122\", expires: 1.hour.from_now }\n\t\tsuper\n\tend",
"def set_pickup_cookies!\n if @pickup\n cookies[:pickup_id] = @pickup.id\n cookies[:key] = @pickup.key\n elsif params[:pickup_id] && params[:key]\n cookies[:pickup_id] = params[:pickup_id]\n cookies[:key] = params[:key]\n end\n end",
"def cookie_persistence_method\n super\n end",
"def cookies\n test_cookies\n end",
"def store_session(res)\n attributes = { path: '/', value: @cookie.to_json }\n res.set_cookie('_rails_lite_app', attributes)\n #store_session(response) that will put the session into a cookie\n# and set it using Rack::Response#set_cookie.\n# The first argument to #set_cookie is the name of the cookie which\n# should be _rails_lite_app.\n# The second argument is the cookie attributes. These are merely a hash\n# of path: ..., value: ..., where path is the path where our cookie is\n# available and value is a string. Since we want to pass a collection\n# (our session store) in the cookie, we can serialize our instance\n# variable using JSON. The path should be / (our root url) so the cookie\n# will available at every path.\n# NB: In order for this to work properly, the path and value keys in\n# your hash must be symbols, not strings.\n end",
"def serialize_into_cookie\n [uid, self.remember_token]\n end",
"def session_cart!\n if !cookies[:cart_id].blank?\n @session_cart = Cart.includes(:cart_items).find_by_id(cookies[:cart_id])\n unless @session_cart\n @session_cart = Cart.create!(:user_uuid => current_user.uuid, cart_type: 'shopping_cart')\n cookies[:cart_id] = @session_cart.id\n end\n elsif current_user\n @session_cart = current_user.carts.shopping_cart.last || current_user.carts.create!(cart_type: 'shopping_cart')\n cookies[:cart_id] = @session_cart.id\n else\n @session_cart = Cart.create!(cart_type: 'shopping_cart')\n cookies[:cart_id] = @session_cart.id\n end\n @session_cart\n end",
"def install_offers_cookie \n if @lead_was_created\n cookied_offer_array = Marshal.load(cookies['_e9_offers']) rescue []\n\n cookied_offer_array |= [@offer.id]\n\n cookies['_e9_offers'] = {\n :value => Marshal.dump(cookied_offer_array),\n :expires => 1.year.from_now\n }\n end\n end",
"def store_session(res)\n res.set_cookie(cookie_key, { value: @cookie.to_json, path: '/' })\n end",
"def serialize_into_cookie(record); end",
"def save_user_info\n if current_user\n cookies[:provider] = current_user.provider\n cookies[:current_institution] = current_institution.code.downcase\n end\n end",
"def create\n # env[\"omniauth.auth\"]\n user = User.authenticate(params[:log_in_email], params[:log_in_password])\n if user\n session[:user_id] = user.id\n \n # if user has a product in the temporary cart waiting to be added to cart after login, add it \n if add_to_cart_if_temp_cart\n redirect_to cart_products_path, :notice => \"Log In successful and product added to cart.\"\n else\n redirect_to root_path, :notice => \"Log In successful\"\n end\n else\n redirect_to login_path, :notice => \"Email or password is incorrect\" \n end\n end",
"def fortune_cookie; end",
"def getCookie(products)\n products.each do |product|\n if product.getTitle == 'Cookie'\n return product\n end\n end\nend",
"def create\n super\n if @user.carts.last.checked_out == false\n session[:cart_id] = @user.carts.last.id\n else\n cart = @user.carts.create()\n session[:cart_id] = cart.id\n end\n end",
"def remember(user)\nuser.remember\ncookies.permanent.signed[:user_id] = user.id\ncookies.permanent[:remember_token] = user.remember_token\nend",
"def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end",
"def store_session(res)\n app_crumb = WEBrick::Cookie.new(\"_rails_lite_app\", @session_values.to_json)\n\n res.cookies.concat([app_crumb])\n end",
"def install_persistent_cookie(name, cookie)\n cookies[name] = {\n :value => cookie,\n :expires => 10.years.from_now\n }\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\nend",
"def cookies; @cookies ||= CookieJar.new; end",
"def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end",
"def remember(customer)\n\t\tcookies.permanent.signed[:customer_id] = customer.id \n\tend",
"def store_session(response)\n attributes = { path: \"/\", value: @cookie.to_json }\n response.set_cookie(APP_NAME, attributes)\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def show\n Recent.append(current_user,@product) if user_signed_in?\n end",
"def remember(user)\n user.remember # remember methode wird aufgerufen. user bekommt token und remember digest\n cookies.permanent.signed[:user_id] = user.id #we’ll use a signed cookie, which securely encrypts the cookie before placing it on the browser. we should make it permanent(expire after 20 years) as well, which we can do by chaining the signed and permanent methods\n cookies.permanent[:remember_token] = user.remember_token #der remember_token wird ebenfalls \"permanent\"\" im cookie gespeichert\n end",
"def create_cart\n cart = ::Cart.create()\n session[:cart_id] = cart.id\n @current_cart = cart\n if user_signed_in?\n cart.update_attribute :user_id, current_user.id\n end\n end",
"def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end",
"def remember(user)\n # make a call to user.remember in our session controller remember method\n user.remember\n\n # now place the 2 cookies on the browser:\n # step 1:\n # cookies[:user_id] = { value: user.id, expires: 20.years.from_now.utc } -- same as:\n # cookies.permanent[:user_id] = user.id -- but this leaves user.id unencrypted..\n # session will encrypt user.id, but cookies will not so we need to call signed ..\n cookies.permanent.signed[:user_id] = user.id\n\n # step 2:\n # here we set random string(user.remember_token) to our cookies remember token..\n cookies.permanent[:remember_token] = user.remember_token\n\n # now lets modify current user to pull out permanent cookie if the user is NOT logged in..\n end",
"def create\n admin_last_url\n cookies[:product_search] = {:value => YAML::dump(params[:product_search]),\n :path => admin_product_search_path}\n logger.info \"Admin::ProductSearchesController#create params=#{params[:product_search]}\"\n do_search params[:product_search]\n end",
"def generate_cookie\n cookies[:credit_request] = SecureRandom.hex(32)\n end",
"def cookie\n self[HttpClient::SET_COOKIE]\n end",
"def show\n Rails.logger.debug \"Show: id: #{params[:id]}\"\n cookies[:politician_id] = params[:id]\n end",
"def cookies # :doc:\n request.cookie_jar\n end",
"def remember(user)\n user.remember # call remember method from User model class\n # places these two cookies on the browser\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user)\n\t\tuser.remember\n\t\tcookies.permanent.signed[:user_id] = user.id \n\t\tcookies.permanent[:remember_token] = user.remember_token\t\n\tend",
"def remember(user)\n\t\tuser.remember #generate remember token and save digest to db\n\t\tcookies.permanent.signed[:user_id] = user.id #create permanent cookie for user id\n\t\tcookies.permanent[:remember_token] = user.remember_token #remember token\n\tend",
"def http_cookie\n http.cookie\n end",
"def remember(user)\n user.remember # Calls model\n cookies.permanent.signed[:user_id] = user.id # Save off encryped user ID\n cookies.permanent[:remember_token] = user.remember_token # Save off random thing for validation\n end",
"def cookies\n request.cookies\n end",
"def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend",
"def store_flash(res)\n chips_ahoy = WEBrick::Cookie.new('_rails_lite_flash', @slow_poke.to_json)\n res.cookies << chips_ahoy\n end",
"def cookies # :doc:\n request.cookie_jar\n end",
"def update_cart(new_cart)\n cookies[:cart] ={value: JSON.generate(new_cart), expires_in: 7.days}\n cookies[:cart]\n end",
"def remember(user)\n \tuser.remember\n \tcookies.permanent.signed[:user_id]=user.id\n \tcookies.permanent[:remember_token]=user.remember_token\n end",
"def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end",
"def remember(user)\n#goes to remember method in user.rb and returns user.remember_token, and saves hashed one\n user.remember\n# saves users id\n cookies.permanent.signed[:user_id]=user.id\n# saves users cookies token\n cookies.permanent[:remember_token]=user.remember_token\n end",
"def cookie(name, value = nil, duration = 15)\n if value\n response.set_cookie name, { \n :value => value,\n :expires => Time.now + (60 * duration),\n :path => \"/\",\n :httponly => true,\n :secure => production?\n }\n else\n request.cookies[name]\n end\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id #store the user id into cookies\n cookies.permanent[:remember_token] = user.remember_token #store the token into cookies\n end",
"def new_order_from_cookies\n order = Order.new\n order.order_items = read_from_cookies\n order\n end",
"def cookies\n request.cookies\n end",
"def show_cookies\n if request.post? || params[:who] == 'peter'\n ls = cookies[LIFESIZE_COOKIE]\n if ls\n @cookie_value = JSON.pretty_generate(JSON.parse(Crypt.decrypt(ls)))\n else\n @cookie_value = \"lifesize cookie not set\"\n end\n @screen_cookie_value = cookies[SCREEN_COOKIE] ? cookies[SCREEN_COOKIE] : \"Screen cookie not set\"\n render :show_cookies\n else\n render :noaccess\n end\n end",
"def get_user_privacy_cookie\n @user_privacy_policy = cookies[:user_privacy_policy]\n end",
"def remember(user)\n user.remember\n # signed cookies encrypts the cookie before placing on browser\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end",
"def remember(user)\n\tuser.remember\n\tcookies.permanent.signed[:user_id] = user.id\n\tcookies.permanent[ :remember_token] = user.remember_token\nend",
"def store_session(res)\n cookie = WEBrick::Cookie.new('_flash_rails_lite_app', @flash.to_json)\n res.cookies << cookie\n end",
"def store(key, data)\n store = Storage.new\n store.data = data\n\n if store.save \n session[key] = store.id\n cookies[key] = store.id\n end\n end",
"def getCookie()\n return @cookie\n\tend",
"def cookie_name\n super\n end",
"def add_to_cart\n @product = Product.find(params[:id])\n # alert user if product is out of stock\n if @product.qty_in_stock == 0\n flash[:notice] = \"Sorry, \" + @product.name + \" is currently out of stock. Please check back soon!\"\n else\n # check if a cart already exists in the session\n if cookies[:cart_id]\n @cart = Cart.find_by_id(cookies[:cart_id])\n else # if not, create a new cart\n @cart = Cart.create(:status => 'current')\n cookies[:cart_id] = @cart.id\n # if user is logged in, associate cart with that user\n if logged_in?\n @cart.attach_to_user(@current_user.id)\n end\n end\n \n # check if item already exists in cart \n @item = @cart.items.where(:product_id => @product.id).first\n if @item.blank? #if not, create a new item\n @item = @cart.items.create(:product_id => @product.id, :name => @product.name, \n :price => @product.price, :qty => 0)\n end\n @item.add\n\n # TODO: give the cookie an expiration date so that the product can be restored if not bought?\n flash[:notice] = @product.name + \" has been added to your cart.\"\n end\n # stay in the same view\n redirect_to :controller => 'products', :action => 'show', :id => @product.id\n end",
"def set_user_id\n if request.get? && current_user && cookies.signed[:user_id].blank?\n cookies.signed[:user_id] = current_user.id\n end\n end"
] |
[
"0.7519355",
"0.6408353",
"0.63304436",
"0.631407",
"0.62956756",
"0.6283701",
"0.6258405",
"0.6217388",
"0.619936",
"0.6197179",
"0.6183296",
"0.6136613",
"0.6128804",
"0.6124218",
"0.6124218",
"0.6124218",
"0.6124218",
"0.6124218",
"0.6124218",
"0.6124218",
"0.61016715",
"0.6072211",
"0.6064369",
"0.60289973",
"0.60231674",
"0.60173684",
"0.60096115",
"0.60063463",
"0.5962196",
"0.59615093",
"0.59441453",
"0.5932503",
"0.591872",
"0.59063953",
"0.590009",
"0.5896646",
"0.5868922",
"0.58447844",
"0.58347714",
"0.58187497",
"0.58050513",
"0.5803689",
"0.57768565",
"0.5774043",
"0.5773715",
"0.5772814",
"0.57722527",
"0.57680607",
"0.5766165",
"0.5752539",
"0.5741626",
"0.57398367",
"0.5736557",
"0.5730519",
"0.57229257",
"0.5721968",
"0.57213247",
"0.5721186",
"0.5697226",
"0.5694791",
"0.5684054",
"0.56820214",
"0.5681234",
"0.5679888",
"0.56743765",
"0.5673813",
"0.5668655",
"0.56663996",
"0.5659247",
"0.56527305",
"0.5639883",
"0.5638382",
"0.5636856",
"0.56363106",
"0.56296384",
"0.56251156",
"0.5624896",
"0.56181866",
"0.56135935",
"0.5611158",
"0.5599937",
"0.5598299",
"0.5592117",
"0.55903864",
"0.558925",
"0.55830395",
"0.55771303",
"0.5569597",
"0.5568817",
"0.5564464",
"0.5561924",
"0.55609965",
"0.5560279",
"0.55598074",
"0.55583096",
"0.5557769",
"0.5555969",
"0.5542786",
"0.5541451",
"0.55397445"
] |
0.7477063
|
1
|
a = CartItem.new; a.test_model test method for activerecord def test_model return "It works" end
|
def empty_cart
self.each do |item|
item.cart_id = nil
item.save!
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_method\n return \"this is a test from the order model!\"\n end",
"def test_model\n tacoma = Vehicle.new(color: \"Silver\", model_year: 2007, manufacturer: \"Toyota\", model: \"Tacoma\")\n actual = tacoma.model\n assert_equal('Tacoma', actual, \"'Tacoma' as a string should be returned\")\n\n tacoma.model = 'Tundra'\n actual = tacoma.model\n assert_equal('Tundra', actual, \"'Tundra' as a string should be returned\")\n end",
"def test_model\n assert_raise(ArgumentError){@test_car.model('Civic')}\n end",
"def test_create_product \n check_product\n end",
"def mock_model_simple(model,expected=:all)\n mock_model model, :name, expected\n end",
"def test \n end",
"def test\n end",
"def test\n end",
"def test\n end",
"def test\n\n end",
"def model_class\n self.name.gsub(/Test$/, '').constantize\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def set_test_model\n @test_model = TestModel.find(params[:id])\n end",
"def mocked_model\n model = mock(SimpleModel)\n \n model.class_eval do\n include CodeZone::Acts::Linkable\n acts_as_linkable\n end\n \n model\nend",
"def test_method\n end",
"def model_name\n Item.model_name\n end",
"def get_model\n self.class.name.gsub(/Test/, \"\").constantize\n end",
"def test_bear_eats_fish\n @bear.eats\nend",
"def test; end",
"def model\n end",
"def model\n end",
"def model\n end",
"def model\n end",
"def test_find_single_item\n\n result=find_single_item(@warehouse_data, :b7)\n assert_equal(\"bath fizzers\",result)\n \nend",
"def testing\n # ...\n end",
"def set_test_model\n @test_model = TestModel.find(params[:id])\n end",
"def make_and_model; end",
"def test_case; end",
"def model; eval model_name; end",
"def model; eval model_name; end",
"def test_promotion_line_item\n # Setup\n promo = promotions(:percent_rebate)\n setup_new_order_with_items()\n # Exercise\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of Promotion, @o.promotion\n # Verify\n assert_equal @o.promotion_line_item.name, promo.description\n end",
"def test_create_product_formula\n \n end",
"def test_total_netto_price\n #quantity x netto price\n prod = InvoicesApp::InvoiceItems.new('safsdfsdfsdf', 3, 4.5)\n assert_equal prod.total_netto_price, 13.5\n end",
"def test_model_stored\r\n model=Model[1]\r\n assert_equal(@mymodel, model)\r\n \r\n newmodel = Model.new(2, 'short term') \r\n assert_equal(Model[2], newmodel)\r\n Model.delete(newmodel)\r\n\r\n begin\r\n Model[newmodel.ident]\r\n assert(false)\r\n rescue EvidenceError\r\n assert(true)\r\n end\r\n end",
"def testMethod nombre,apellido\n \nend",
"def test_product_title\n assert_equal @productsController.product_title , \"Red Book\"\n end",
"def test_selectItem\n\t\t#vm = VendingMachine.new\n\t\tvm = VendingMachine.new(@db)\n\t\tvm.output = StringIO.new\n\t\t# vm.items[\"A1\"].quantity = 1\n\t\tvm.inputMoney(0.50)\n\t\titem = vm.selectItem(\"A1\")\n\t\tassert_not_nil(item)\n\t\tassert_equal(\"A1\", item.code)\n\t\tassert_equal(\"Almond Joy\", item.description)\n\tend",
"def create_shopping_cart\n puts \"A new shopping cart has been created for you! \\n \\n\"\n Shopping_Cart.new\nend",
"def test_food_has_price\n assert_equal(1.50, @food1.price())\nend",
"def test_product_price\n assert_equal @productsController.product_price, \"7.99\"\n end",
"def tests; end",
"def tests; end",
"def model_class\n Sms::Test\n end",
"def test_get_raw_material_qty\n assert_equal(10, @bakery.get_raw_material_qty(\"flour\"))\n end",
"def get_model\n return model_classes[item_type].new()\n end",
"def test_it_can_rank_merchants_by_revenue\n @sa.merchants_ranked_by_revenue\nend",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def test\n puts \"this is a test\"\n end",
"def test_add_new_product\n new_product = @productsController.add_new_product\n # assert_operator(new_product, :>, 0)\n end",
"def love_test\nend",
"def test_a\n end",
"def model_class; end",
"def get_mobj(mname=nil) @model_class.instance; end",
"def test_can_afford_buy_drink__true()\n customer = Customer.new(\"Jane\", 10, 25)\n drink = Drink.new(\"Beer\", 2, 6.4)\n assert_equal(true, customer.can_afford_buy_drink(drink))\nend",
"def model_type\n :mock_apple_pie\n end",
"def test; true; end",
"def test3\r\n\t\t\"public method\" #a method can be public if we want to access it from outside the class\r\n\tend",
"def test_create\n assert_equal 1, @sitem.id\n end",
"def test\n self.test_session.test\n end",
"def test_simple_total\n i = invoices(:simple)\n assert_equal 1000, i.total\n end",
"def test\n puts\"test\"\n end",
"def test_to_s\n base = Tui::Model::Base.new( 'lab1', 'val99' )\n assert base.to_s == 'val99'\n end",
"def create\n puts \"test\"\n end",
"def test_created(test)\n\n end",
"def test_create_my_cars\n assert_equal(@test_car.speed, 0, 'Speed of new car should be 0')\n assert_equal(MyCar.new.model, '')\n assert_equal(MyCar.new.year, 1999)\n assert_equal(MyCar.new.color, 'primer')\n assert_equal(MyCar.new(model:TEST_CAR_MODEL).model, TEST_CAR_MODEL)\n assert_equal(MyCar.new(year:TEST_CAR_YEAR).year, TEST_CAR_YEAR)\n assert_equal(MyCar.new(color:TEST_CAR_COLOR).color, TEST_CAR_COLOR)\n end",
"def test_should_create_product\n a_product = Product.new\n \n a_product.code = \"SHRUBBERY\"\n a_product.name = \"Shrubbery\"\n a_product.description = \"A shrubbery. One that looks nice, and is not too expensive. Perfect for a knight who say Ni.\"\n a_product.price = 90.50\n a_product.date_available = \"2007-12-01 00:00\"\n a_product.quantity = 38\n a_product.size_width = 24\n a_product.size_height = 24\n a_product.size_depth = 12\n a_product.weight = 21.52\n \n assert a_product.save\n end",
"def test\n puts 'This is a test method'\n end",
"def model\n __getobj__\n end",
"def set_test_item\n @test_item = TestItem.find(params[:id])\n end",
"def test\n puts \"(model): RUNNING before_save CALLBACK!!!##\"\n end",
"def test_locate_item\n result = locate_item(@warehouse, :b5)\n assert_equal(\"nail filer\" , result)\nend",
"def item; end",
"def item; end",
"def item; end",
"def item; end",
"def item; end",
"def brand_with_model; end",
"def getTestId\n @test_id\n end",
"def test?\n self.order_type == :test\n end",
"def test_default_value_in_just_create_model\n assert_equal 'new default value', ModelSecond.new.custom_field_renamed\n end",
"def test_return_category_id\n assert_equal(1, Products.return_category_id(1))\n end",
"def cartman()\n \nend",
"def model\n self.class.const_get(:MODEL)\n end",
"def test_create_order\n setup_new_order()\n @o.order_line_items << OrderLineItem.for_product(items(:small_stuff))\n assert @o.save\n end",
"def test_name\n test.name\n end",
"def test_food_has_name\n assert_equal(\"chicken\", @food1.name())\nend",
"def self_test; end",
"def self_test; end",
"def model\n self::Model\n end"
] |
[
"0.78336215",
"0.6553211",
"0.6224346",
"0.61664706",
"0.61626905",
"0.61290526",
"0.61266017",
"0.61266017",
"0.61266017",
"0.61232984",
"0.608635",
"0.60043126",
"0.60043126",
"0.60043126",
"0.60043126",
"0.60043126",
"0.60043126",
"0.60043126",
"0.60043126",
"0.60043126",
"0.60043126",
"0.5978867",
"0.5967433",
"0.59380907",
"0.5936073",
"0.59138733",
"0.59052646",
"0.5904611",
"0.5901426",
"0.58801377",
"0.58801377",
"0.58801377",
"0.58320534",
"0.58042246",
"0.57945687",
"0.576657",
"0.57360846",
"0.5735462",
"0.5735462",
"0.57233006",
"0.5721026",
"0.5682502",
"0.56765246",
"0.56419134",
"0.5625979",
"0.5613901",
"0.56033045",
"0.55882245",
"0.5581653",
"0.558089",
"0.558089",
"0.5571223",
"0.5565521",
"0.556207",
"0.5558295",
"0.5544052",
"0.5544052",
"0.5544052",
"0.5544052",
"0.554209",
"0.55407274",
"0.55357975",
"0.55181676",
"0.550558",
"0.54953116",
"0.54898596",
"0.5485004",
"0.5472025",
"0.54591316",
"0.54591185",
"0.54570365",
"0.54310083",
"0.542079",
"0.54202735",
"0.54189634",
"0.5418289",
"0.5411105",
"0.54042983",
"0.5390966",
"0.539074",
"0.5384405",
"0.5382234",
"0.5382107",
"0.53820705",
"0.53820705",
"0.5381929",
"0.5381929",
"0.5381929",
"0.5381592",
"0.53573847",
"0.5354956",
"0.53481215",
"0.53467584",
"0.53435373",
"0.53427345",
"0.5340685",
"0.5339841",
"0.53357613",
"0.53162354",
"0.53162354",
"0.5316007"
] |
0.0
|
-1
|
Add a node to the project graph.
|
def add_node(node)
@nodes.add node
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add(node)\r\n @nodes << node\r\n end",
"def add_node(node); end",
"def add_node(name, node)\n language.nodes[name] = node if name\n node\n end",
"def add_node(node)\n @nodes[node.id.to_i] = node\n node.db = self\n end",
"def add_node(node)\n nodes[node.value] = node\n end",
"def add_node node\n nodes << node\n node.scene = self\n end",
"def add_node(node)\n\t\t\tunless has_node?(node)\n\t\t\t\t@nodes[node] = new_node(node)\n\t\t\t\t@order += 1\n\t\t\tend\n\t\t\tself\n\t\tend",
"def addNode(node)\r\n\t\tif @nodes.nil?\r\n\t\t\t@nodes = [node]\r\n\t\telse\r\n\t\t\t@nodes << node\r\n\t\tend\r\n\tend",
"def add_node(n)\n @nodes.push n unless @nodes.include? n\n end",
"def add_node(node = {})\n @nodes.push Bark::Client.new node\n end",
"def add_node( node )\n super( node )\n __add_node__( node )\n end",
"def add_node(node)\n _clear_cache\n @pathway.graph[node] ||= {}\n self\n end",
"def add_node(node)\n @nodes[node.uri] ||= node\n end",
"def add_node(graph, document)\n unless graph.node(document.key)\n graph.add(Turbine::Node.new(document.key, model: document))\n end\n end",
"def add_node(new_node)\n @nodes[new_node] ||= Array.new #only adds if not in graph\n @node_dir_ancestors[new_node] ||= Array.new\n end",
"def add_node(graph, document)\n unless graph.node(document.key)\n node = graph.add(Refinery::Node.new(document.key, model: document))\n establish_slots(node, document)\n end\n end",
"def add_node(node)\n if node.respond_to?(:to_sym)\n node = Woodhouse::Layout::Node.new(node.to_sym) \n end\n expect_arg :node, Woodhouse::Layout::Node, node\n @nodes << node\n node\n end",
"def add_node(object)\n if is_node?(object)\n node = object\n @nodes << object\n else\n node = Node.new(object)\n @nodes << node\n end\n\n node\n end",
"def add_node! u, v = nil, l = nil\n if nodes.empty?\n add_vertex! u, l\n elsif u.is_a? _branch_type\n add_branch! u, nil, l\n elsif not v.nil?\n add_branch! u, v, l\n else\n # Ensure the connected constraint.\n raise RawTreeError, \"In order to add a node to the tree, you must specify another node to attach to.\"\n end\n end",
"def new_node(*args)\n add_node(build_node(*args))\n end",
"def add_child(node)\n node.build\n nodes << node\n end",
"def add_node(n1)\n raise ArgumentError, \"Duplicate node name #{n1.name}\" if @nodes.find_index(n1)\n @nodes << n1\n @incident_map[n1] = []\n end",
"def add_node(value, node=nil)\n new_node = Node.new(value)\n if node\n new_node.parent = node\n node.children << new_node\n else\n @head = new_node\n end\n end",
"def add_edge(node)\n @adj_nodes.push(node.position)\n end",
"def add_node(node)\n #$DEBUG.puts \"Registering #{SNMPPass.num2oid(node.oid)} with #{node}\"\n @fields[node.oid]=node\n end",
"def add_node\n return if @node_name == nil\n unless node_exist? \n tool_hash = Hash[*@tool_properties.zip(@tool_values).flatten]\n new_node = {\n \"node_name\" => @node_name,\n \"tools\" => [\n tool_hash\n ]\n }\n @site_data[\"site\"][\"node\"] << new_node\n end\n end",
"def node_add(node)\n raise Deployment::InvalidArgument.new self, 'Cluster can add only nodes!', node unless node.is_a? Deployment::Node\n return node_get node if node_present? node\n unless node.cluster == self\n node.cluster.node_remove node if node.cluster\n end\n nodes.store prepare_key(node), node\n node.cluster = self\n node\n end",
"def create_node!\n node.save\n end",
"def add_node(node)\r\n raise \"you can only add node #{node.name} to a Proposed Deployment\" unless snapshot.proposed?\r\n NodeRole.create :node_id=>node.id, :snapshot_id=>snapshot_id, :role_id=>role_id\r\n end",
"def addNode(node, toListView:listView)\n @expandableRowToNodeMap[node.id] = node if node.expandable?\n listView.addNode(node)\n end",
"def add(*arguments)\n if arguments[0].is_a?(Node)\n if arguments[1]\n fail ArgumentError, 'The second argument must not be specified, when passing a VObject Node'\n end\n arguments[0].parent = self\n new_node = arguments[0]\n elsif arguments[0].is_a?(String)\n new_node = @root.create(*arguments)\n else\n fail ArgumentError, 'The first argument must either be a Node or a string'\n end\n\n name = new_node.name\n if @children.key?(name)\n @children[name] << new_node\n else\n @children[name] = [new_node]\n end\n\n new_node\n end",
"def add_node(data)\n\n\t\t# change tactics if we're adding the first node\n\t\tif @head.nil?\n\n\t\t\tadd_first_node(data)\n\n\t\telse\n\n\t\t\tnew_node = Node.new(data)\n\n\t\t\t# point the last node to our new one\n\t\t\t@last.next = new_node\n\n\t\t\t# set our new node as the official last node\n\t\t\t@last = new_node\n\n\t\tend\n\t\tputs \"Added node with the value: #{data}\"\n\tend",
"def test_add_node\n node = Node.new(1, [2, 3])\n @graph.add_node(node)\n assert_equal(@graph.num_nodes, 1)\n end",
"def add_node(key, val)\n @store.append(key, val)\n end",
"def add_node(value)\n add_node_support(value, :linked_list)\n end",
"def add(node)\n raise 'Node must be persisted!' unless node.persisted?\n # Traverse to the end\n last_link = nil\n each_link do |link|\n last_link = link\n end\n # Create a new link\n # If there is no last node, make the link the head\n # Otherwise, throw the link at the end\n link = Likewise::Node.create :ref_id => node.id\n if last_link.nil?\n self[:head_id] = link.id\n else\n last_link[:next_id] = link.id\n end\n # Increment our length, which is memoized\n element_added!\n end",
"def add_node(p_node_text, p_node_type, p_parent_node = nil, p_node_color = nil)\n new_node = create_node(p_node_text, p_node_type, p_node_color)\n # add new node on top level per default\n if p_parent_node.nil?\n p_parent_node = @nodes[0]\n end\n p_parent_node[\"nodes\"].insert(0, new_node)\n return new_node\n end",
"def push(node)\n node.parent = self if node.respond_to? :parent\n super(node)\n end",
"def add(name, country, continent, timezone, coords, pop, region, node_city, edges=Array.new)\n node = Node.new(name, country, continent, timezone, coords, pop, region)\n @nodes[node_city] = node\n @edges[node_city] = edges\n self\n end",
"def add_node(domain, node)\n redis.sadd(\"pubsub:#{domain}:nodes\", node)\n end",
"def insert_node(atlas_node_id, node_name, node)\n return if atlas_node_id.blank? || node_name.blank?\n current_node = TaxGenerator::TaxonomyNode.new(atlas_node_id, node_name)\n node << current_node\n current_node\n end",
"def add_node kind, label, attrs\n @node_buffer << Node.new(\n kind: kind,\n label: label,\n attrs: attrs\n )\n end",
"def <<(node)\n @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?\n raise \"argument to << must be a String or Ox::Node.\" unless node.is_a?(String) or node.is_a?(Node)\n @nodes << node\n end",
"def <<(node)\n existing = node_for(node.name)\n\n if existing\n children.delete(existing)\n\n self.children << (existing + node)\n else\n node.parent = self\n self.children << node\n node\n end\n end",
"def <<(node)\n node.dispatcher = @dispatcher\n @nodes << node\n end",
"def add_node(taxonomy_node, node, options = {})\n tax_node = options[:skip_add].present? ? node : add_taxonomy_node(taxonomy_node, node)\n return unless taxonomy_node.children.any?\n taxonomy_node.xpath('./node').each do |child_node|\n add_node(child_node, tax_node) if tax_node.present?\n end\n end",
"def add_node(value)\n if @head\n @head = Node.new value, @head\n else\n @head = Node.new value, nil\n end\n end",
"def add_to_neighbors(node)\n @neighbors << node\n end",
"def insert_node(node)\n raise \"Node must be a leaf\" unless node.is_leaf?\n if (self.view) \n node.position = self.view.get_node_position(node)\n node.visible = self.view.get_node_visibility(node)\n node.search_value = self.view.get_node_search_value(node)\n end\n leafs << node\n end",
"def AddNode(type, xpos, ypos, numRadios = 0)\n\tname = NodeName(xpos, ypos)\n\tnode = Orbit::Topology::Node.new(@lastId, name, type)\n\tnode.SetPos(xpos,ypos)\n\t@lastId=@lastId+1\n\t#let OMF know we have created this node\n\tDefineGroup(node)\n\t@nodes_by_name[name]=node\n\treturn node\n end",
"def add(node, timing)\n if @nodedb.key? node\n # We do not merge because we don't have\n # timing information of the sub-nodes. That is\n # recorded in separate records.\n @nodedb[node].data << timing\n else\n metadata = NodeMetaData.new\n metadata << timing\n node.data = metadata\n @nodedb[node] = node\n\n merge_graph node\n end\n end",
"def new_node\n id = @nodes.size\n node = Node.new(id: id)\n @nodes.push(node)\n id\n end",
"def add\n working_repo.add tree\n end",
"def add(*nodes)\n @nodes.push(*nodes)\n end",
"def add_edge(from_node, to_node)\n add_node(from_node)\n add_node(to_node)\n @nodes[from_node] << to_node\n @node_dir_ancestors[to_node] << from_node\n\n if self.has_cycle\n puts \"No longer DAG\"\n end\n end",
"def update_node(node)\n file = node_file(node)\n status = file.exist? ? \"update\" : \"add\"\n\n txn do\n (@path + \"nodes\").mkpath\n file.open(\"w\") do |f|\n f.print JSON.generate(\n node.as_json,\n object_nl: \"\\n\",\n indent: \" \",\n space: \" \"\n )\n end\n @repo.add file\n\n message = \"#{status} node #{node.fqn}\"\n @repo.commit message\n log << \"Database commit: #{message}\"\n end\n end",
"def add_node(name, parent, content: nil, attribute: false)\n unless String === name\n name = name.attributes['name'].value\n end\n\n node = BuildNode.new(name, parent: parent, attribute: attribute)\n\n if content\n node.contents << content\n end\n\n parent.children << node\n\n node\n end",
"def add_pubsub_node(domain, node)\n @pubsub.add_node(domain, node)\n end",
"def add_node(node, children: [], parents: [], attributes: {}, infos: nil, recursive: true)\n\t\t\tif infos.respond_to?(:call)\n\t\t\t\tinfo=infos.call(node)||{}\n\t\t\t\tchildren.concat([*info[:children]])\n\t\t\t\tparents.concat([*info[:parents]])\n\t\t\t\tattributes.merge!(info[:attributes]||{})\n\t\t\tend\n\t\t\tif node.is_a?(Node) and node.graph != self\n\t\t\t\tchildren.concat(node.children)\n\t\t\t\tparents.concat(node.parents)\n\t\t\tend\n\t\t\tgraph_node=new_node(node,**attributes)\n\t\t\tif recursive\n\t\t\t\tgraph_node.add_child(*children.map { |child| add_node(child) })\n\t\t\t\tgraph_node.add_parent(*parents.map { |parent| add_node(parent) })\n\t\t\telse\n\t\t\t\t#just add the children\n\t\t\t\tgraph_node.add_child(*children.map { |child| new_node(child) })\n\t\t\tend\n\t\t\tgraph_node\n\t\tend",
"def add_node(data)\n if @head.nil?\n add_first_node(data)\n else\n new_node = Node.new(data, nil)\n @tail.next = new_node\n @tail = new_node\n end\n # puts \"Added node with value: #{data}\"\n end",
"def add(x)\n @contents.push x if x.is_a? Node\n end",
"def insert_node(new_node_val)\n new_node = Node.new(new_node_val)\n @nodes << new_node\n @_node_map[new_node_val] = new_node\n new_node\n end",
"def node=(node)\n @node = node\n end",
"def add(value)\n @root = add_at_node(@root, value)\n end",
"def add_global_child(node)\n node.build\n global_nodes << node\n end",
"def create\n Souffle::Log.info \"#{@node.log_prefix} Creating a new node...\"\n provider.create_node(@node)\n end",
"def add_vertex(node)\n @structure[node] ||= []\n end",
"def create\n @node = Node.new(params[:node])\n @node.project_id = current_user.project_id\n @node.user_id = current_user.id\n\t@node.approved = true\n\t@node.mod = true\n\tputs @node.inspect\n respond_to do |format|\n if @node.save\n format.html { redirect_to root_path(tab:\"newnode\"), notice: 'Node ' + @node.working_name + ' has been added'}\n format.json { render json: @node, status: :created, location: @node }\n else\n\t\tflash[:error] = @node.errors\n format.html { redirect_to root_path(tab:\"newnode\")}\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_taxonomy_node(taxonomy_node, node)\n atlas_node_id = taxonomy_node.attributes['atlas_node_id']\n node_name = taxonomy_node.children.find { |child| child.name == 'node_name' }\n return if atlas_node_id.blank? || node_name.blank?\n insert_node(atlas_node_id.value, node_name.content, node)\n end",
"def add_edge(nodeA, nodeB)\n nodeA.adjacents << nodeB\n nodeB.adjacents << nodeA\n\n @nodes << nodeA\n @nodes << nodeB\n end",
"def set_node\n @node = ::Node::Node.find(params[:id])\n end",
"def <<(node)\n root << node\n end",
"def node=(node)\n items_node[:node] = node\n end",
"def add_edge(node, weight)\n @adjacent_nodes[node.value] = { weight: weight, node: node }\n self\n end",
"def add_travel_node_proposal(type, address, lat, lng, travel_node)\n self.send(\"#{type.to_s}_travel_nodes\").create(\n address: address,\n title: travel_node.title,\n weight: travel_node.weight,\n tag: travel_node.tag,\n lat: lat,\n lng: lng,\n has_normalized: 1,\n event_title: travel_node.event_title,\n event_start_time: travel_node.event_start_time,\n event_end_time: travel_node.event_end_time,\n event_location: travel_node.event_location,\n event_google_id: travel_node.event_google_id\n )\n end",
"def <<(node)\n source = Source.new(node)\n self.list << source\n end",
"def n(name)\n return @graph.get_node(name) unless @graph.get_node(name.to_s).nil?\n @graph.add_nodes(name)\n end",
"def add p\n @projects << p\n end",
"def add p\n @projects << p\n end",
"def node_create(node, node_class=Deployment::Node)\n if node_present? node\n node = node_get node\n elsif node.is_a? Deployment::Node\n node = node_add node\n else\n node = node_class.new node, self\n node = node_add node unless node_present? node\n end\n node\n end",
"def append(node)\n children.append(node)\n end",
"def add(item)\n\t\t\t@hash[item] = Node.new\n\t\tend",
"def add_nodes(*nodes)\n @nodes.merge nodes\n end",
"def add(key, value)\n current_and_parent_pair = find_current_and_parent_nodes(key)\n if current_and_parent_pair[:current]\n # update new value if key exists\n current_and_parent_pair[:current].value = value\n else\n new_node = TreeNode.new(key,value)\n parent = current_and_parent_pair[:parent]\n link_node_to_parent(parent, new_node)\n end\n end",
"def add(node, value)\n tree_navigator.descendents(node).each do |descendent|\n values[descendent] += value\n end\n end",
"def add_node(node)\n node.prev = head\n node.next = head.next\n\n head.next.prev = node\n head.next = node\n end",
"def add_edge(node_a, node_b)\n node_a.adjacents << node_b\n node_b.adjacents << node_a\n end",
"def insert_node\n insert_node_helper(@root)\n end",
"def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_node\n else\n add_helper(@root, new_node)\n end\n end",
"def insert_brother_node(path, node)\n @rootNode.get_node(path).add_rightbrother_node(node)\n end",
"def addInvNode(control_ip, control_mac, hostname, hrn, locationId)\n\t\t\tnode = makeInventoryNode(control_ip, control_mac, hostname, hrn, locationId)\n\t\t\tdoDB do |inv|\n\t\t\t\tresultNode = inv.addNode(node)\n\t\t\tend\n\t\tend",
"def append_node\r\n # Load parent package.\r\n parent_package = ProductPackage.find params[:id], :include => \"product_package_nodes\"\r\n # position = parent_package.product_package_nodes.collect{|node| node.position}.sort.last.nexts\r\n \r\n # Build a child node.\r\n case params[:node_type]\r\n when \"package\"\r\n parent_package.product_package_nodes << ProductPackage.new(:name => params[:new_package_name])\r\n when \"product\"\r\n parent_package.product_package_nodes << ProductPackageProduct.new(:product_id => params[:product_id], :display_style => \"checkbox\")\r\n end\r\n \r\n # Save node and redirect back.\r\n redirect_to :back\r\n end",
"def add_tag_node (tag_path, tag_node_or_name, tag_value = nil, data_type = nil)\n\n $test_logger.log(\"Add tag node #{tag_path}\")\n\n #Get target node\n target_node = get_tag_node(tag_path)\n\n if tag_node_or_name.is_a?(REXML::Element)\n raise \"Tag node and tag value cannot be specified at the same time!\" if tag_value != nil\n node_to_add = tag_node_or_name\n else\n node_to_add = Element.new(tag_node_or_name)\n node_to_add.text = tag_value if tag_value != nil\n end\n\n #Add data type to node if required\n if data_type != nil\n node_to_add.add_attribute(TYPE_ATTR, data_type)\n end\n\n #Add child node to target path\n target_node << node_to_add\n\n #Notify changes to load other formats like RAW and HEX\n notify_change(InputChannel::XML)\n end",
"def __node(name, params = {}, &block)\n require_relative './node'\n @__nodes << Node.new(name, params, __depth + 1, &block)\n end",
"def add_path(path)\n @tree.add_path(path)\n self\n end",
"def test_add_node_double\n node = Node.new(1, [1])\n @graph.add_node(node)\n # Assert\n assert_equal(1, @graph.num_nodes)\n end",
"def create\n @node = Node.new(params[:node])\n @node.modifier = current_user\n respond_to do |format|\n if @node.save\n @node.move_to_right_of(params[:insert_after_id]) if Node.exists?(params[:insert_after_id])\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(nodes_url) }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_node(params)\n node = @tinkit_class.new(params)\n node.__save\n node\n #TODO: What if params includes attachments?\n end",
"def add(key, value)\n new_node = TreeNode.new(key,value)\n \n if @root.nil?\n @root = new_node\n else \n add_helper(@root, key, value)\n end\n end",
"def set_node\n @node = Node.find(params[:id])\n end"
] |
[
"0.75790536",
"0.7533743",
"0.7449676",
"0.7437881",
"0.7423904",
"0.7324917",
"0.7315779",
"0.7194684",
"0.7064985",
"0.7031119",
"0.70273966",
"0.7005919",
"0.70036244",
"0.6947567",
"0.6860344",
"0.68166935",
"0.6773264",
"0.6758635",
"0.67541605",
"0.67330635",
"0.6679167",
"0.6614229",
"0.6560664",
"0.6526594",
"0.64679205",
"0.64523363",
"0.6445722",
"0.6373865",
"0.6328057",
"0.6278585",
"0.6255876",
"0.62237656",
"0.62173235",
"0.6192069",
"0.6166238",
"0.61554164",
"0.61457574",
"0.6127228",
"0.61083955",
"0.609512",
"0.6087425",
"0.6083896",
"0.6074574",
"0.6051757",
"0.6047058",
"0.604091",
"0.6032523",
"0.60293734",
"0.60266876",
"0.6021055",
"0.6005422",
"0.5993414",
"0.5984156",
"0.5971413",
"0.5957623",
"0.59566534",
"0.595196",
"0.5910246",
"0.5877644",
"0.58717054",
"0.5835427",
"0.5829903",
"0.5811571",
"0.5808795",
"0.5806996",
"0.5799129",
"0.57916826",
"0.5788988",
"0.57822394",
"0.5763429",
"0.57488024",
"0.5745785",
"0.574496",
"0.5744932",
"0.5744544",
"0.5725702",
"0.57150924",
"0.5708569",
"0.5708569",
"0.5685047",
"0.56681705",
"0.56536907",
"0.5645619",
"0.56440455",
"0.5640123",
"0.56292844",
"0.56106246",
"0.5596351",
"0.55744326",
"0.5574072",
"0.5573672",
"0.5573655",
"0.55712956",
"0.5569926",
"0.55671656",
"0.55666834",
"0.5566219",
"0.5553625",
"0.5550527",
"0.55401945"
] |
0.8292682
|
0
|
Add multiple nodes at once.
|
def add_nodes(*nodes)
@nodes.merge nodes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add(*nodes)\n @nodes.push(*nodes)\n end",
"def add_childs(*nodes)\n nodes.each do |node|\n self.addChild(node)\n end\n end",
"def AddNodes(nodes)\n\tnodes.each do |n|\n\t\tn.id=@lastId\n\t\tDefineGroup(n)\n\t\t@lastId=@lastId+1\n\tend\n\treturn nodes\n end",
"def add(node)\r\n @nodes << node\r\n end",
"def push(*xs)\n xs.each { |x| @nodes.push x }\n end",
"def add_nodes_r(nodes)\n cnode = self\n nodes.each do |n|\n n = Node.new(n) if n.instance_of?(String)\n x = cnode.find_child_to_update(n) \n if x then\n x.name = n.name\n x.value = n.value\n cnode = x \n else\n cnode << n\n cnode = n\n end\n end\n cnode\n end",
"def add_node(node); end",
"def add_node(node)\n @nodes.add node\n end",
"def add_node(n)\n @nodes.push n unless @nodes.include? n\n end",
"def concat(nodes); end",
"def multiple_push (nodos)\n nodos.each { |i|\n raise unless i.is_a? (ListNode)\n push(i)\n }\n end",
"def addNode(node)\r\n\t\tif @nodes.nil?\r\n\t\t\t@nodes = [node]\r\n\t\telse\r\n\t\t\t@nodes << node\r\n\t\tend\r\n\tend",
"def add_children *nodes\n nodes.flatten!\n raise \"Non-node child given!\" if nodes.any? { |node| node.class != Node }\n nodes.each { |node| node.parent = self }\n @children.concat nodes\n end",
"def add_children(node1, node2)\n @nodes[node1].add_child(@nodes[node2])\n end",
"def add_child(*nodes)\n\t\t\tnodes.each do |node|\n\t\t\t\tcheck_node(node)\n\t\t\t\tif not @children.include?(node)\n\t\t\t\t\t@children << node\n\t\t\t\t\tnode.parents << self\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def add_nodes(node_info)\n keyname = @creds['keyname']\n new_nodes = Djinn.convert_location_array_to_class(node_info, keyname)\n\n # Since an external thread can modify @nodes, let's put a lock around\n # it to prevent race conditions.\n @state_change_lock.synchronize {\n @nodes.concat(new_nodes)\n Djinn.log_debug(\"Changed nodes to #{@nodes}\")\n }\n\n update_firewall\n initialize_nodes_in_parallel(new_nodes)\n end",
"def add_children(*nodes)\n nodes.flatten.each do |node|\n node.set_parent self\n end\n changed\n notify_observers :new_children, nodes.flatten\n end",
"def add(*args); elements.add(*args); end",
"def add(x)\n @contents.push x if x.is_a? Node\n end",
"def add_node(n1)\n raise ArgumentError, \"Duplicate node name #{n1.name}\" if @nodes.find_index(n1)\n @nodes << n1\n @incident_map[n1] = []\n end",
"def add_node( node )\n super( node )\n __add_node__( node )\n end",
"def append(node)\n children.append(node)\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def add(*nodes)\n @mutex.synchronize do\n raise \"Trying to add nodes to a sealed router!\" if @sealed \n nodes.each do |node|\n node.uri_specs.each do |action, specs|\n specs.each do |spec|\n if spec.valid? and spec.app and spec.route != false\n @routes << spec\n @actions[spec] = [node, action]\n end\n end\n end\n end\n @immaterial = true\n end\n return self\n end",
"def add_node(node)\n\t\t\tunless has_node?(node)\n\t\t\t\t@nodes[node] = new_node(node)\n\t\t\t\t@order += 1\n\t\t\tend\n\t\t\tself\n\t\tend",
"def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end",
"def test_append_additional_node\n list = LinkedList.new\n\n list.append(\"Rhodes\", {\"pounds of food\" => 200})\n list.append(\"Hardy\", {\"pounds of food\" => 200})\n\n assert_instance_of Node, list.head.next_node\n end",
"def add_node(node)\n nodes[node.value] = node\n end",
"def add_child(node_or_tags); end",
"def add_child(node_or_tags); end",
"def add_node(node = {})\n @nodes.push Bark::Client.new node\n end",
"def add_children(more_children)\n @children.push(*more_children)\n end",
"def add id\n return unless @nodes[id].nil?\n @nodes[id] = Array.new\n end",
"def add_to_neighbors(node)\n @neighbors << node\n end",
"def <<(node); add(node); end",
"def add_adjacency(n1, n2)\n n1.adjacents << n2\n n2.adjacents << n1\n end",
"def add_node(new_node)\n @nodes[new_node] ||= Array.new #only adds if not in graph\n @node_dir_ancestors[new_node] ||= Array.new\n end",
"def networks_add( *networks )\n\t\t\t@networks = @networks.union(networks.flatten)\n\t\tend",
"def addNodeAtPos(xml, toAdd, nodeOver)\n\n size = xml[\"childCount\"].to_i\n if(xml[\"nodeName\"] == nodeOver)\n\n xml[\"childCount\"] = size+1\n xml[size] = toAdd\n return\n end\n for j in 0..size\n\n values = xml[j]\n if(values[\"nodeName\"] == nodeOver)\n addNodeAtPos(values, toAdd, nodeOver)\n break\n else\n\n countVals = values[\"childCount\"].to_i\n for k in 0..countVals\n addNodeAtPos(values[k], toAdd,nodeOver)\n end\n end\n end\n end",
"def add_child(node)\n node.build\n nodes << node\n end",
"def add(*args)\n @list << args\n @list.flatten!\n end",
"def add(*elmts)\n elmts.each do |elmt|\n @components.add(elmt)\n end\n end",
"def add_children children\n children.each { |child| add_child child }\n end",
"def append(node)\n if next_node\n next_node.append(node)\n else\n next_node = node\n end\n end",
"def new_node(*args)\n add_node(build_node(*args))\n end",
"def add(*args, &block)\n all << new(*args, &block)\n end",
"def add_all(ts)\n while(x = ts.next) do\n add(x)\n end\n end",
"def add_node node\n nodes << node\n node.scene = self\n end",
"def insert(nodos)\n for i in (0.. nodos.size-1)\n insert_tail(nodos[i])\n end\n end",
"def add_nodes_to_nodegroups(nodes, nodegroups, login, password_callback=PasswordCallback)\n # The server only supports setting a complete list of members of\n # a node group. So we need to retreive the current list of members\n # for each group, merge in the additional nodes that the user wants\n # added, and pass that off to set_nodegroup_assignments to perform\n # the update.\n # FIXME: This should talk directly to the node_group_node_assignments\n # controller, so that we aren't exposed to the race conditions this\n # method currently suffers from.\n nodegroups.each_pair do |nodegroup_name, nodegroup|\n # Use a hash to merge the current and new members and\n # eliminate duplicates\n merged_nodes = nodes.clone\n nodegroup[\"nodes\"].each do |node|\n name = node['name']\n merged_nodes[name] = node\n end\n set_nodegroup_node_assignments(merged_nodes, {nodegroup_name => nodegroup}, login, password_callback)\n end\n end",
"def add(child); end",
"def append( value )\n last.next = Node.new value\n end",
"def _add( *nums ) self.class.add( *nums ); end",
"def add_additions(statements)\n statements.each do |statement|\n add_addition(statement)\n end\n end",
"def add(*arguments)\n if arguments[0].is_a?(Node)\n if arguments[1]\n fail ArgumentError, 'The second argument must not be specified, when passing a VObject Node'\n end\n arguments[0].parent = self\n new_node = arguments[0]\n elsif arguments[0].is_a?(String)\n new_node = @root.create(*arguments)\n else\n fail ArgumentError, 'The first argument must either be a Node or a string'\n end\n\n name = new_node.name\n if @children.key?(name)\n @children[name] << new_node\n else\n @children[name] = [new_node]\n end\n\n new_node\n end",
"def add_edge(nodeA, nodeB)\n nodeA.adjacents << nodeB\n nodeB.adjacents << nodeA\n\n @nodes << nodeA\n @nodes << nodeB\n end",
"def add(*); end",
"def add(addto, add)\n start_element = nil\n cur_element = nil\n add.each do |build|\n unless cur_element.nil?\n cur_element = cur_element.add_element(build[0])\n else\n cur_element = REXML::Element.new(build[0])\n start_element = cur_element\n end\n end\n addto.first.add_element(start_element)\n end",
"def add\r\n node = mul()\r\n\r\n loop do\r\n if consume(\"+\")\r\n node = new_binary(ND_ADD, node, mul())\r\n elsif consume(\"-\")\r\n node = new_binary(ND_SUB, node, mul())\r\n else\r\n return node\r\n end\r\n end\r\nend",
"def add_all(pairs)\n end",
"def add_edge(node_a, node_b)\n node_a.adjacents << node_b\n node_b.adjacents << node_a\n end",
"def add(value)\n\t\tif @head != nil \n\t\t\tcurrent = @head\n\t\t\twhile current.nnode != nil\n\t\t\t\tcurrent = current.nnode\n\t\t\tend\n\t\t\tcurrent.nnode = Node.new(value, nil)\n\t\telse\n\t\t\t@head = Node.new(value,nil)\n\t\tend\n\tend",
"def add_nodes(*args)\n node = super\n node.fontname = @font\n node\n end",
"def add_node(key, val)\n @store.append(key, val)\n end",
"def append(value)\n new_node = Node.new(value)\n node = @node\n\n while node.next\n node = node.next\n end\n\n node.next = new_node\n end",
"def add(value)\n current_node = @head\n while current_node.next != nil\n current_node = current_node.next\n end\n current_node.next = Node.new(value, nil)\n end",
"def peers_add( *peers )\r\n\t\t\t@peers = @peers.union(peers.flatten)\r\n\t\tend",
"def add_node(data)\n\n\t\t# change tactics if we're adding the first node\n\t\tif @head.nil?\n\n\t\t\tadd_first_node(data)\n\n\t\telse\n\n\t\t\tnew_node = Node.new(data)\n\n\t\t\t# point the last node to our new one\n\t\t\t@last.next = new_node\n\n\t\t\t# set our new node as the official last node\n\t\t\t@last = new_node\n\n\t\tend\n\t\tputs \"Added node with the value: #{data}\"\n\tend",
"def build(*nodes, attributes: {}, infos: nil, recursive: true)\n\t\t\tnodes.each do |node|\n\t\t\t\tcase node\n\t\t\t\twhen Hash\n\t\t\t\t\tnode.each do |name,children|\n\t\t\t\t\t\tadd_node(name,children: [*children], attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tadd_node(node, attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\tend\n\t\t\tend\n\t\t\tself\n\t\tend",
"def append( search_nodes, result_nodes )\n return apply(search_nodes)\n end",
"def make_nodes(nodes = [])\n positions = []\n (0..7).each {|x| (0..7).each {|i| positions << [x,i] }}\n \n positions.each do |x|\n nodes << Node.new(x)\n end\n nodes\nend",
"def insertar_varios(nodos)\n \n nodos.each do |nodoo|\n \n insertar(nodoo)\n \n end\n \n end",
"def add_node(node)\n @nodes[node.uri] ||= node\n end",
"def add(value)\n @root = add_at_node(@root, value)\n end",
"def create_node_list(path)\n puts 'Creating nodes, this may take several time...'\n print 'Processing ['\n ratio = (path.length/20).to_i\n count = 0\n node_list = []\n path.each do |point|\n node = Rosemary::Node.new(lat: point.lat, lon: point.lon)\n node_id = @api.save(node, @changeset)\n node_list << node_id\n count+=1\n print '=' if count%ratio == 0\n end\n puts ']'\n puts \"There was #{node_list.length} nodes created successfully\"\n node_list\n end",
"def add(tasks)\n tasks.each do |task|\n iter = @model.append()\n self.set(iter, task)\n end\n @tasks += tasks\n end",
"def add_n(inputs, name: nil)\n _op(:add_n, *inputs, name: name)\n end",
"def add(*args); end",
"def add(w)\n adopt(w, getElement())\n @children << w if @children\n end",
"def append(node)\n if @root==nil\n \t@root=node\n \t@tail=node\n else\n \t@tail.next_node = node\n \t@tail= node\n\n end\n @size+=1\n end",
"def add(*tasks)\n tasks.flatten.each do |task|\n enqueue_task(task)\n end\n end",
"def create_nodes(nodes)\n nodes.each do |node|\n (raise CloudLB::Exception::MissingArgument, \"Must provide :address for all nodes\") if node[:address].to_s.empty?\n (raise CloudLB::Exception::MissingArgument, \"Must provide :port for all nodes\") if node[:port].to_s.empty?\n node[:condition] ||= \"ENABLED\"\n end\n body = {:nodes => nodes}.to_json\n response = @connection.lbreq(\"POST\", @lbmgmthost, \"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/nodes\",@lbmgmtport,@lbmgmtscheme,{},body)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n JSON.parse(response.body)['nodes'].map { |node| get_node(node[\"id\"]) }\n end",
"def add(selector)\n if selector.kind_of?(Array)\n # Check if each name in the 'selector' refer to a valid NodeSet\n # If so, then add this NodeSet to this new group of NodeSet\n selector.each { |name|\n s = NodeSet[name]\n if s == nil\n raise \"Unknown NodeSet (name '#{name}')\"\n end\n s.add_observer(self)\n @nodeSets.add(s)\n }\n elsif selector.kind_of?(ExperimentProperty)\n s = selector.value\n add(s)\n else\n raise \"Unrecognized node set selector type '#{selector.class}'.\"\n end\n end",
"def add_node(node)\n @nodes[node.id.to_i] = node\n node.db = self\n end",
"def add(*items)\n notify_will_change! if items.count > 0\n items.each do |item|\n collection.push item\n end\n @collection\n end",
"def append_node\r\n # Load parent package.\r\n parent_package = ProductPackage.find params[:id], :include => \"product_package_nodes\"\r\n # position = parent_package.product_package_nodes.collect{|node| node.position}.sort.last.nexts\r\n \r\n # Build a child node.\r\n case params[:node_type]\r\n when \"package\"\r\n parent_package.product_package_nodes << ProductPackage.new(:name => params[:new_package_name])\r\n when \"product\"\r\n parent_package.product_package_nodes << ProductPackageProduct.new(:product_id => params[:product_id], :display_style => \"checkbox\")\r\n end\r\n \r\n # Save node and redirect back.\r\n redirect_to :back\r\n end",
"def add(node, value)\n tree_navigator.descendents(node).each do |descendent|\n values[descendent] += value\n end\n end",
"def add_edges(nodes, ary, edge_type)\n ary && ary.each do |a_node, other_node, wt|\n nodes[a_node].\n send(edge_type).\n add(nodes[other_node], wt.to_i)\n end\n\n nodes\n end",
"def add_vertices(*a)\n a.each { |v| add_vertex v }\n end",
"def <<(node)\n @child_array.push(node)\n node.parent = self\n end",
"def add(*values)\n values.each do |value|\n if @tail.value.nil?\n @tail.value = value\n else\n new_tail(value)\n end\n end\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end",
"def add(words) \n @mc.add_elems(words)\n end",
"def nodes\n left_nodes + [self] + right_nodes\n end",
"def add_node(object, citations: true, identifiers: true)\n @nodes.push graph_node(object)\n\n if citations && object.respond_to?(:citations)\n object.citations.each do |c|\n add_node(c, citations: false, identifiers: false)\n add_node(c.source, citations: false, identifiers: true)\n\n add_edge(c, object)\n add_edge(c.source, c)\n\n if c.source.is_bibtex?\n c.source.authors.each do |p|\n add_node(p, citations: false, identifiers: true)\n add_edge(p, c.source)\n end\n end\n end\n end\n\n if identifiers && object.respond_to?(:identifiers)\n object.identifiers.each do |i|\n add_node(i, citations: false, identifiers: false)\n add_edge(i, object)\n end\n end\n end",
"def add_child(*children)\n children.flatten.each do |child|\n ActsAsDAG::HelperMethods.link(self, child)\n end\n end",
"def add_children(kids)\n i = 0\n while i < kids.size\n t = kids.get(i)\n add_child(t)\n i += 1\n end\n end",
"def add_node(object)\n if is_node?(object)\n node = object\n @nodes << object\n else\n node = Node.new(object)\n @nodes << node\n end\n\n node\n end"
] |
[
"0.8452777",
"0.73931134",
"0.73497957",
"0.72169966",
"0.711111",
"0.70864254",
"0.7069811",
"0.70236915",
"0.67949355",
"0.6767138",
"0.6742206",
"0.67292094",
"0.6646378",
"0.663818",
"0.6628216",
"0.6596066",
"0.65833205",
"0.64750105",
"0.6293812",
"0.6269824",
"0.61824864",
"0.6177033",
"0.6147313",
"0.6138887",
"0.613489",
"0.61256593",
"0.6122205",
"0.6089808",
"0.60536575",
"0.60536575",
"0.6047026",
"0.60294133",
"0.6010535",
"0.60087246",
"0.60056704",
"0.6003849",
"0.59884447",
"0.5981874",
"0.5956726",
"0.59551924",
"0.5937916",
"0.59131014",
"0.59046346",
"0.589764",
"0.5895312",
"0.589228",
"0.5873932",
"0.58435476",
"0.58383137",
"0.58070207",
"0.5766665",
"0.57624406",
"0.5761457",
"0.57540333",
"0.5747369",
"0.5745689",
"0.5742536",
"0.57413197",
"0.573893",
"0.5738655",
"0.57385224",
"0.57356006",
"0.5715033",
"0.5709526",
"0.5698306",
"0.5696778",
"0.56930006",
"0.5691432",
"0.56883216",
"0.5686296",
"0.5682506",
"0.5681026",
"0.56746984",
"0.5671808",
"0.5666445",
"0.5664873",
"0.56512177",
"0.5648495",
"0.56444085",
"0.5638008",
"0.56364995",
"0.5625097",
"0.56217945",
"0.56159294",
"0.5612233",
"0.5602925",
"0.56005615",
"0.5600128",
"0.5599207",
"0.5589844",
"0.55860794",
"0.5582728",
"0.5582728",
"0.55811566",
"0.55764765",
"0.55728745",
"0.55642",
"0.55634797",
"0.5555996",
"0.5555005"
] |
0.83360803
|
1
|
Add an edge to the project graph.
|
def add_edge(from, to, cost)
@edges << Edge.new(from, to, cost)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_edge(edge)\n @edges.push(edge)\n end",
"def add_edge(e)\n @edges[e.from] << e\n end",
"def add_edge( edge )\n super( edge.source, edge.target, edge )\n __add_edge__( edge )\n end",
"def add_edge(edge)\n edge.each { |node| add_vertex(node) }\n @structure[edge[0]] << edge[1]\n end",
"def add_edge(source, target, edge = Edge.new)\n _clear_cache\n @pathway.append(Bio::Relation.new(source, target, edge))\n edge\n end",
"def add_edge(e)\n add_vertex(e.from); add_vertex(e.to)\n (@from_store[e.from].add?(e) && @to_store[e.to].add(e) && e) || edge(e.from, e.to)\n end",
"def add_edge(edge)\n @edges << edge\n add_node(edge.n1) unless @nodes.find_index(edge.n1)\n add_node(edge.n2) unless @nodes.find_index(edge.n2)\n @incident_map[edge.n1] << edge\n @incident_map[edge.n2] << edge\n end",
"def new_edge(*args)\n add_edge(build_edge(*args))\n end",
"def add_edge(direction, edge)\n opposite_adjacencies(direction, edge) << edge\n end",
"def add_edge(node)\n @adj_nodes.push(node.position)\n end",
"def add(edge)\n source = edge.source\n if @contained_vertices.include? source\n @vertex_array.at(source).add_edge(edge)\n else\n new_vertex = Vertex.new(source)\n new_vertex.add_edge(edge)\n @contained_vertices.push(source)\n if @vertex_array.size < source\n @vertex_array.insert(source, new_vertex)\n else\n @vertex_array[source] = new_vertex\n end\n end\n end",
"def append_edge(edge)\n @meeting_edges << edge\n end",
"def add_edge(source, dest, weight)\n edges << Edge.new(source, dest, weight)\n end",
"def add_edge(a,b)\n @adj_list[a][b] = 1\n end",
"def connect edge\n self.add edge.src\n self.add edge.dst\n @nodes[edge.src] << edge\n edge\n end",
"def add_edge(*e)\n raise InvalidArgumentError if e.size > 2\n \n e = [e] if e.size == 2\n @edges.add(e[0])\n end",
"def addEdge (node, dist)\n\t\t@edges.push([node, dist])\n\t\tnode.addOtherEdge(self, dist)\n\tend",
"def add_edge(from, to)\n from.adjacents << to\n end",
"def add_edge(source, target = nil, label = nil)\n @reversal = nil\n if target\n edge = Puppet::Relationship.new(source, target, label)\n else\n edge = source\n end\n [edge.source, edge.target].each { |vertex| setup_vertex(vertex) unless vertex?(vertex) }\n @vertices[edge.source].add_edge :out, edge\n @vertices[edge.target].add_edge :in, edge\n @edges << edge\n true\n end",
"def add_edge(from_vertex, to_vertex)\n begin\n self[from_vertex].out_edges << to_vertex\n self[to_vertex].in_edges << from_vertex\n rescue NoMethodError => e\n err_suffix = \"in add_edge(#{from_vertex}, #{to_vertex}).\"\n if self[from_vertex].nil?\n puts(\"No vertex with id #{from_vertex} \" << err_suffix)\n else\n puts(\"No vertex with id #{to_vertex} \" << err_suffix)\n end \n end\n end",
"def add_edge(src, dest, weight)\n @v << src if !@v.include?(src)\n @v << dest if !@v.include?(dest)\n new_edge = Edge.new(src,dest, weight)\n src.out_edges << new_edge\n dest.in_edges << new_edge\n @e << new_edge\n end",
"def add_edge(target_node,value)\n edges[target_node] = Edge.new(target_node,value)\n end",
"def add_edge!(from, to)\n protected_add_edge!(from, to)\n @edge_number += 1\n end",
"def add_edge(vertex1, vertex2)\n if !@graph[vertex1] || !@graph[vertex2]\n raise InvalidVertexException, \"That vertex doesn't exist in the graph\"\n end\n @graph[vertex1].push(vertex2)\n @graph[vertex2].push(vertex1)\n self\n end",
"def add_edge(start_vertex_name, end_vertex_name)\n\n # Check if graph is not empty\n if (@vertices.length == 0)\n raise GraphError.new('No edges can be added to an empty graph', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n first_vertex_index = find_index_for_vertex(start_vertex_name)\n second_vertex_index = find_index_for_vertex(end_vertex_name)\n\n if (first_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. First vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n if (second_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. Second vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n add_edge_by_indexes(first_vertex_index,second_vertex_index)\n end",
"def add_edge(location, params = {})\n if self.has_edge? location\n self.edges[location].update(params)\n else\n edge = Explore::Models::Edge.new location, params\n @edges[edge.location] = edge\n end # if-else\n end",
"def add_edge(x, y, cost: 1)\n raise\n end",
"def add_edge(source, destiny, weigth)\n source, destiny, weigth = convert_values(source, destiny, weigth)\n\n add_vertex(source)\n add_vertex(destiny)\n\n make_edge(source, destiny, weigth)\n end",
"def addOtherEdge (node, dist)\n\t\t@edges.push([node, dist])\n\tend",
"def add_edge(nodeA, nodeB)\n nodeA.adjacents << nodeB\n nodeB.adjacents << nodeA\n\n @nodes << nodeA\n @nodes << nodeB\n end",
"def add_edge(node_city_A, node_city_B, distance)\n @edges[node_city_A] << Edge.new(node_city_B, distance)\n end",
"def addEdge( from_vertex, to_vertex)\n addVertex( from_vertex )\n addVertex( to_vertex )\n @vertices[from_vertex] << to_vertex\n end",
"def check_add_edge(anEdge)\n anEdge\n end",
"def add_edge(u, v)\n raise NotImplementedError\n end",
"def add_edge(source_vertex, destination_vertex)\n @adjacent_list[source_vertex].push(destination_vertex)\n @indegree[destination_vertex] += 1\n end",
"def add_edge(edge)\n # pp @access_paths\n # pp edge\n added = false\n return added if @edges.include?(edge)\n visited_path = @access_paths.each_with_index.select{|p,idx| !(p & edge).empty? }\n if visited_path.count == 2\n # if the two vertexes are visited in 2 paths\n # We'll combine the 2 paths\n new_path =[]\n to_del_idx =[]\n visited_path.each do |p|\n idx = p[1]\n v_path = p[0]\n new_path = new_path + v_path\n to_del_idx << idx\n end\n @access_paths.delete_if.with_index{|p,idx| to_del_idx.include?(idx)}\n @access_paths << new_path\n @edges << edge unless @edges.include?(edge)\n added = true\n elsif visited_path.count == 1\n v_path = visited_path[0][0]\n # binding.pry\n if (v_path & edge).count() == 2\n # binding.pry\n # add edge only when it does not create cycle\n puts \"Refuse to add edge #{edge.to_s} as it create cycle\"\n else\n # v_path = visited_path[0][1]\n vertext = edge - v_path\n v_path = v_path + vertext\n idx = visited_path[0][1]\n @access_paths.delete_at(idx)\n @access_paths << v_path\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n elsif visited_path.count == 0\n @access_paths << edge\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n # puts \"added is #{added}\"\n\n return added\n\tend",
"def add_edge(node, weight)\n @adjacent_nodes[node.value] = { weight: weight, node: node }\n self\n end",
"def add_edge(from_node, to_node)\n add_node(from_node)\n add_node(to_node)\n @nodes[from_node] << to_node\n @node_dir_ancestors[to_node] << from_node\n\n if self.has_cycle\n puts \"No longer DAG\"\n end\n end",
"def add_edge(node_a, node_b)\n node_a.adjacents << node_b\n node_b.adjacents << node_a\n end",
"def add_edge(x, y) # from x to y\n if @nodes.key?(x) and @nodes.key?(y)\n if @edges.key?(x)\n unless @edges[x].include?(y)\n @edges[x] << y\n end\n end\n if @back_edges.key?(y)\n unless @back_edges[y].include?(x)\n @back_edges[y] << x\n end\n end\n else\n raise RuntimeError.new \"#{x} and #{y} not both present\"\n end\n end",
"def add_edge(*edge_details)\r\n if (edge_details.length <3)||(edge_details.length>4)\r\n raise \"Error: Incorrect number of arguments in add_edge\"\r\n end # end if length\r\n @edges.push edge_details\r\n end",
"def add_edge(element1, element2)\n index1 = self.dict[element1]\n index2 = self.dict[element2]\n raise Exception.new(\"Nodes not exist!\") unless index1 && index2\n\n head_node2 = self.adj_list_array[index2].head_node\n new_node1 = Node.new(element1, head_node2.next_node)\n head_node2.next_node = new_node1\n\n\n head_node1 = self.adj_list_array[index1].head_node\n new_node2 = Node.new(element2, head_node1.next_node)\n head_node1.next_node = new_node2\n\n self\n end",
"def add_edge(src, dest)\n # add a edge to the head\n @adjList[src] << dest\n # since this graph is not directed we need to do the oposite also\n # @adjList[dest] << src\n @edges += 1\n end",
"def add_edge(left, right)\n left.blocked_by(right)\n right.blocking(left)\n \n @edges << [left, right]\n end",
"def add_edge(id1, id2)\n # YOUR WORK HERE\n end",
"def add_edge(source, target, weight = 1)\r\n\t\tself.push source unless self.include?(source)\r\n\t\tself.push target unless self.include?(target)\r\n\t\t@edges.push Edge.new(source, target, weight)\r\n\tend",
"def new_edge\n\t\t\traise NotImplementedError.new('#new_edge must be implemented')\n\t\tend",
"def add_edge(node1, node2, weight)\n nodes[node1.value].add_edge(nodes[node2.value], weight)\n nodes[node2.value].add_edge(nodes[node1.value], weight)\n self\n end",
"def add_edge(object_1, object_2)\n node_1 = check_object(object_1)\n node_2 = check_object(object_2)\n node_1.adjacents << node_2\n node_2.adjacents << node_1\n end",
"def protected_add_edge!(from, to)\n @vertices[from] << to if @vertices.has_key?(from) && @vertices.has_key?(to)\n end",
"def add_edge(x, y)\n\t\traise if @x_connections[x] != -1\n\t\traise if @y_connections[yIdx(y)] != -1\n\t\t\n\t\t@x_connections[x] = y\n\t\t@y_connections[yIdx(y)] = x\n\t\t\n\t\t@unconnected_x_vertices -= 1\n\t\t\n#\t\traise if @x_connected_vertices.member?(xy[0])\n#\t\traise if @y_connected_vertices.member?(xy[1])\n\t\n\tend",
"def add_edge( from_key, to_key, weight = 0 )\n add_vertex(from_key) unless @vertices.include? from_key\n add_vertex(to_key) unless @vertices.include? to_key\n @vertices[from_key].add_neighbor( @vertices[to_key], weight )\n end",
"def connect_endpoint(collection, edge)\n if collection.any? { |o| ! edge.equal?(o) && edge.similar?(o) }\n raise DuplicateEdgeError.new(self, edge)\n end\n\n collection.add(edge)\n end",
"def r_edge(other_node)\n (self.edges << other_node) && (other_node.edges << self)\n self\n end",
"def addEdge( from, to)\n addVertex( from )\n addVertex( to )\n @vertices[from] << to\n\t@vertices[from].uniq!\n end",
"def add_edge_force!(from, to)\n add_vertex!(from)\n add_vertex!(to)\n add_edge!(from, to)\n end",
"def addDirectedEdge(edge_value)\n\t\tedge_vertices = []\n\t\tedge_vertices = edge_value.split(',')\n\t\t# Validate the user input\n\t\tif edge_vertices.size == 2\n\t\t\tsource = edge_vertices[0]\n\t\t\tdest = edge_vertices[1]\n\t\tif !hasVertex(source)\n\t\t\taddVertex(source);\n\t\tend\n\t\tif !hasVertex(dest)\n\t\t\taddVertex(dest)\n\t\tend\n\t\t@graphSet.merge!(\"#{source}\" => @graphSet.fetch(source)<< edge_vertices[1])\n\t\telse\n\t\t\tputs \"Invalid entry. Enter only alphabets\".red\n\t\tend\n\tend",
"def add_directed_edge(id1,id2)\n @g[id1] ||= Array.new\n @g[id1] << id2\n end",
"def create_edge_to(other, weight = 1.0)\n self.class.edge_class.create!(:from_id => id, :to_id => other.id, :weight => weight)\n end",
"def add_edge(from, to, cost)\n @vertices[from] = true unless @vertices.has_key? from\n @vertices[to] = true unless @vertices.has_key? to\n \n @edges_cost[from] = Hash.new() unless @edges_cost[from]\n @edges_cost[from].store(to, cost)\n\n @edges_up[from] = Hash.new() unless @edges_up[from]\n @edges_up[from].store(to, true)\n end",
"def c_edge(other_node, wt = 0)\n (self.outbound_edges.add(other_node, wt) &&\n other_node.inbound_edges.add(self, wt))\n self\n end",
"def add_edge(from, to, character)\n validate_argument(from)\n validate_argument(to)\n\n edges = @vertices[from] || create_new(from)\n edges << { character => to }\n end",
"def edge(resource,node1,node2) \n label = fetch_fragment(resource) if(@options.showedges)\n color = colour_map(resource) if (@options.colour_code)\n @root.add_edge(node1,node2,:label=>label,:color=>color)\n end",
"def attach!(target:raise, edge:raise, source:self)\n target = add!(target)\n\n connect!(target: target, edge: edge, source: source)\n end",
"def test_adding_edge\n \n # Start a new graph with no vertices\n graph = Graph.new()\n \n # Add 2 vertices to the graph\n origin = { \"code\" => \"NYC\" ,\n \"name\" => \"New York\" ,\n \"country\" => \"US\" ,\n \"continent\" => \"North America\" ,\n \"timezone\" => -5 ,\n \"coordinates\" => { \"N\" => 41, \"W\" => 74 } ,\n \"population\" => 22200000 ,\n \"region\" => 3 }\n \n destination = { \"code\" => \"WAS\" ,\n \"name\" => \"Washington\" ,\n \"country\" => \"US\" ,\n \"continent\" => \"North America\" ,\n \"timezone\" => -5 ,\n \"coordinates\" => {\"N\" => 39, \"W\" => 77} ,\n \"population\" => 8250000 ,\n \"region\" => 3 } \n graph.add_node(origin)\n graph.add_node(destination)\n \n assert_equal( graph.nodes().size, 2)\n \n # Add a two-way edge for the two vertices\n distance = 1370 \n graph.add_edge(origin[\"code\"] , destination[\"code\"], distance)\n graph.add_edge(destination[\"code\"] , origin[\"code\"], distance)\n \n assert_equal( graph.nodes[\"NYC\"].neighbors.size, 1)\n assert_equal( graph.nodes[\"WAS\"].neighbors.size, 1)\n assert_equal( graph.nodes[\"NYC\"].neighbors[\"WAS\"], distance)\n assert_equal( graph.nodes[\"WAS\"].neighbors[\"NYC\"], distance)\n \n end",
"def connectWith(node, weight = 0)\n edge = Edge.new(self, node, weight)\n @edges << edge\n\n edge\n end",
"def add_edge(from:, to:)\n msg = nil\n msg = \"vertex #{from} is not in graph\" unless @adj_list.include? from\n msg = \"vertex #{to} is not in graph\" unless @adj_list.include? to\n msg = \"edge alredy exists: #{from} -> #{to}\" if not @adj_list[from].nil? and @adj_list[from].include? to\n\n return if not msg.nil?\n\n @adj_list[from].push(to)\n # undirected edge is stored as 2 direct edges\n @num_of_edges = @num_of_edges + 1\n end",
"def entry_edge=(object)\n self.entry_edges.clear\n self.entry_edges << object\n end",
"def add_edge(from, to, weight = 1.0)\n\t\t\tadd_node(from)\n\t\t\tadd_node(to)\n\t\t\t@size += 1 if connect(from, to, weight)\n\t\t\tself\n\t\tend",
"def add_vertex(name, edges)\n @vertices[name] = edges\n end",
"def add_edge(source, destination, weight)\n super(source, destination, weight) if weight > 0\n end",
"def add_edge(v, w)\n if (!@vertices.include?(v))\n @vertices.push(v)\n @adjacency_list[@vertices.find_index(v)] = []\n end\n if (!@vertices.include?(w))\n @vertices.push(w)\n @adjacency_list[@vertices.find_index(w)] = []\n end\n if (!@adjacency_list[@vertices.find_index(v)].include?(w))\n @adjacency_list[@vertices.find_index(v)].push(w)\n end\n end",
"def edge_to(target)\n Edge.new(self, target)\n end",
"def addEdge from, to, directed, weight=nil\n\t\treturn false if !isNode?(to) || !isNode?(from)\n\t\tgetNode(from).addConnection(to,weight)\n\t\tgetNode(to).addConnection(from,weight) if(!directed)\n\tend",
"def connect(vertex1, vertex2, edge_attributes = {})\n self.vertices << vertex1 unless self.vertices.include? vertex1\n self.vertices << vertex2 unless self.vertices.include? vertex2\n edge = Edge.new(edge_attributes)\n self.edges << edge\n edge << vertex1 << vertex2\n end",
"def create_edge(from, to, props = nil)\n props ||= {}\n edge = Edge.new(from, to, props)\n @edges.push edge\n from.outputs.push edge\n to.inputs.push edge\n edge\n end",
"def test_add_edge\n @graph.add_edge('a', 'b');\n vertex_a = @graph.find_vertex('a')\n vertex_b = @graph.find_vertex('b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@graph.vertices[0].neighbours[1] == true && @graph.vertices[1].neighbours[0] == true)\n end",
"def add_edge(source, dest)\n if VERT_MAP.has_key? source\n VERT_MAP[source] << dest\n else\n VERT_MAP[source] = Set.new [dest]\n end\n end",
"def add_edge(x, y)\n if(!@g.has_key?(x)) then \n @g[x] = []\n end\n if(!@g[x].include? y) then\n @g[x] << y\n end\nend",
"def add_edge(predecessor_uri, successor_uri)\n @nodes[predecessor_uri].add_edge(@nodes[successor_uri])\n end",
"def make_edge(source, destiny, weigth)\n @vertices[source][destiny] = weigth\n @vertices[destiny][source] = weigth\n end",
"def add_relation source_label, relation, destination_label, direction = '<->'\n # More popular nodes have more weigth\n @node_weights[source_label] += 1\n @node_weights[destination_label] += 1\n\n @edge_buffer << Edge.new(\n source_label: source_label,\n relation: relation,\n destination_label: destination_label,\n direction: direction\n )\n end",
"def add_edge(u, v, w)\n super(u,v)\n @weights[[u,v]] = w\n end",
"def add_edges(edges)\n edges.each do |edge|\n if !@edges.include?(edge)\n @edges << edge\n\n edge.from.neighbours.push(edge.to) if !edge.from.neighbours.include? edge.to\n edge.to.neighbours.push(edge.from) if !edge.to.neighbours.include? edge.from\n\n @vertices << edge.from if !vertex_exist?(edge.from)\n @vertices << edge.to if !vertex_exist?(edge.to)\n end\n end\n\n build_adjacency_matrix.to_a\n end",
"def create_edge(node1, node2)\n @nodes[node1.position].add_edge(node2)\n @nodes[node2.position].add_edge(node1)\n end",
"def addEdge(u, v)\n\t\tadjList[u].push(v)\n\tend",
"def test_add_edge\n assert_equal(\"e1\", @e[0][:name])\n assert_equal(\"v1\", @e[1][:name])\n assert_equal(\"v2\", @e[2][:name])\n assert_equal(1, @e[0][:id])\n assert_equal(1, @g.e_id)\n assert_equal(1, @g.size)\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", {:name=>\"v2\"}) }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, {:name=>\"v1\"}, \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", {:name=>\"v1\"}, \"v2\") }\n end",
"def add_edge(x, y, type)\n debug_msg \"adding edge #{x}, #{y}, #{type}\"\n if self[x,y]\n unless self[x,y] == type\n @contradiction = true\n debug_msg \" \\tcontradiction\"\n throw :add_edge_throw, :contradiction\n else\n debug_msg \"\\ti know\"\n throw :add_edge_throw, :i_know\n end\n else\n super(x, y, type)\n end\n end",
"def add_edge(s, t, w)\n\n if (not @graph.has_key? s)\n @graph[s] = {t => w}\n else\n @graph[s][t] = w\n end\n\n @nodes.merge [s,t]\n\n end",
"def find_or_add_edge(one, two)\n edge = find_edge(one, two)\n if edge\n edge.weight += 1\n edge\n else\n edges << Edge.new(one: one, two: two, weight: 1)\n edges.last\n end\n end",
"def test_add_edge\n @dgraph.add_edge('a', 'b');\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@dgraph.vertices[0].neighbours[1] == true && @dgraph.vertices[1].neighbours[0] == nil)\n end",
"def add_vertices_from(edge)\n unless (@vertices << (@apical_vertices << edge.protein_1_id).last unless @vertices.include? edge.protein_1_id)\n @vertices << (@apical_vertices << edge.protein_2_id).last unless @vertices.include? edge.protein_2_id\n end\n edge\n end",
"def add_edge_by_indexes(start_vertex_index, end_vertex_index)\n\n @vertices[start_vertex_index].neighbours[end_vertex_index] = true\n @vertices[end_vertex_index].neighbours[start_vertex_index] = true\n\n self\n end",
"def build_edge(*args)\n edge_class.new(*args)\n end",
"def add_edge(u, v, weight = 1)\n\t\t@edges[u] = {} unless @edges.has_key?(u)\n\t\t@edges[v] = {} unless @edges.has_key?(v)\n\t\t@edges[u].update({v => Edge.new(u, v, weight)})\n\t\t@edges[v].update({u => Edge.new(v, u, weight)})\n\tend",
"def add_edge(u,v)\n if @graph.has_key?(u)\n @graph[u] << v\n else\n @graph[u] = [v]\n end\n @graph[u].uniq!\n end",
"def safe_add_edge(x, y, type)\n catch(:add_edge_throw) do \n add_edge(x, y, type)\n end\n end",
"def import_edge!(edge, dataset)\n attributes = edge.attributes\n\n if edge.type == :share\n attributes[:share] =\n attributes[edge.reversed? ? :parent_share : :child_share]\n elsif edge.type == :constant\n attributes[:share] = attributes[:demand] * 1_000_000\n end\n\n attributes.delete(:child_share)\n attributes.delete(:parent_share)\n attributes.delete(:demand)\n\n dataset[Hashpipe.hash(FromAtlas.edge_key(edge))] = attributes\n end",
"def edge!(edge, consumer, supplier, carrier)\n Qernel::Edge.new(\n edge_key(edge),\n consumer,\n supplier,\n carrier,\n edge.type,\n edge.reversed?,\n edge.groups\n )\n end",
"def get_edge(edge)\n return nil unless edge[:from][:name]\n return nil unless edge[:to][:name]\n\n #Get the type of the edge\n type = edge[:type] || Config::DEFAULT_TYPE\n edge[:type] = type\n\n #Check if the edge type exists\n etype = Marshal.load(@db.m_get(\"edge#{type}\") || Marshal.dump({})) \n \n #Integrity check: Check whether the edge direction is not contradictory\n if edge[:directed]\n if etype[:directed] != nil\n if etype[:directed] != edge[:directed]\n return nil\n end\n else\n #If there is no edge of that type then pre-empt the result\n return nil\n end\n else\n if etype[:directed] != nil\n edge[:directed] = etype[:directed]\n else\n #If there is no edge of that type then pre-empt the result\n return 3\n end\n end\n\n #Convert the edge into a Key string and fetch the corresponding data\n key, reverse_key = Keyify.edge(edge)\n value = @db.e_get(key)\n\n if value\n new_edge = Marshal.load(value)\n new_edge[:from] = self.get_node(edge[:from])\n new_edge[:to] = self.get_node(edge[:to])\n new_edge[:type] = edge[:type]\n new_edge[:directed] = etype[:directed] #Pick direction alone from the meta_db for consistency\n new_edge\n end\n end"
] |
[
"0.79741365",
"0.7947667",
"0.75388736",
"0.75327075",
"0.7507143",
"0.7441213",
"0.73779684",
"0.7363834",
"0.7262812",
"0.7224285",
"0.71899885",
"0.70623076",
"0.7038201",
"0.70257527",
"0.6943856",
"0.6922219",
"0.68484205",
"0.6831056",
"0.6820543",
"0.6763121",
"0.6747732",
"0.6746924",
"0.6745526",
"0.672433",
"0.6711955",
"0.66950655",
"0.66913986",
"0.66779447",
"0.6636155",
"0.6616993",
"0.6614324",
"0.6597966",
"0.6580588",
"0.65628785",
"0.6529784",
"0.6506326",
"0.6500334",
"0.6496276",
"0.6486138",
"0.6480603",
"0.6438646",
"0.6435688",
"0.6415372",
"0.6399875",
"0.6357016",
"0.6347658",
"0.63145643",
"0.62565315",
"0.6183172",
"0.6173534",
"0.6134135",
"0.6093813",
"0.60823923",
"0.6074348",
"0.6028945",
"0.60250175",
"0.6017867",
"0.59931576",
"0.59924257",
"0.5991349",
"0.59908545",
"0.59647995",
"0.5960751",
"0.59458107",
"0.5942326",
"0.5928293",
"0.5912239",
"0.5897881",
"0.5878264",
"0.5856144",
"0.584895",
"0.58403146",
"0.5837799",
"0.58081686",
"0.5802801",
"0.5772966",
"0.5771048",
"0.5770467",
"0.57697034",
"0.5755514",
"0.5741573",
"0.57358885",
"0.5729056",
"0.5724366",
"0.5721999",
"0.5711382",
"0.57109994",
"0.5705317",
"0.5702268",
"0.567029",
"0.5661943",
"0.5655528",
"0.5609361",
"0.5581007",
"0.5576775",
"0.5559924",
"0.5477549",
"0.54728323",
"0.546115",
"0.5453168"
] |
0.6934615
|
15
|
Set maximum project duration by adding an edge with negative duration as weight.
|
def max_duration=(duration)
nodes = @nodes.to_a
add_edge(nodes.last, nodes.first, -duration)
duration
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def maximum_duration=(value)\n @maximum_duration = value\n end",
"def set_duration\n if self.end_time\n # self.duration = (end_time - start_time).to_i\n self.duration = (end_time - start_time).to_i\n else\n self.duration = DEFAULT_DURATION\n self.end_time = self.start_time + self.duration\n end\n end",
"def duration=(int)\n @duration = int\n set_ends_at\n end",
"def update_target_duration\n self.target_duration = self.endDate - self.startDate\n end",
"def adjust_duration\n # convert minutes into seconds\n self.duration = duration.to_i * 60\n end",
"def adjust_duration duration\n grid_increment / duration\n end",
"def maxweight(w)\n @weight = w if w>@weight\n end",
"def maximum_outbound_round_trip_delay=(value)\n @maximum_outbound_round_trip_delay = value\n end",
"def duration=(value)\n\t\t\t@duration = value\n\t\tend",
"def maximum_duration\n return @maximum_duration\n end",
"def duration=(value)\n @duration = value\n end",
"def duration=(value)\n @duration = value\n end",
"def duration=(duration)\n\t\t@duration = duration if duration.present?\n\tend",
"def new_duration\n @duration\n end",
"def set_VideoDuration(value)\n set_input(\"VideoDuration\", value)\n end",
"def setDuration(duration)\r\n\t\t\t\t\t@duration = duration\r\n\t\t\t\tend",
"def max_time\n @max_time ||= 0.2\n end",
"def max_record_duration_in_seconds=(value)\n @max_record_duration_in_seconds = value\n end",
"def DurationMilliseconds=(duration)",
"def children_duration=(_arg0); end",
"def -@\n MTK::Core::Duration[@value * -1]\n end",
"def map_time_limit=(new_value)\n super new_value && new_value.to_f\n end",
"def maximum_inbound_round_trip_delay=(value)\n @maximum_inbound_round_trip_delay = value\n end",
"def max_edge_weight\n edges.map(&:weight).max\n end",
"def set_max(max)\n self[:max] = (max > 0 ? max : 1)\n end",
"def lease=duration\n lease = @watch.objects.find { |o| o.name == \"lease\" }\n\n lease.attributes[:val] = duration\n\n Network.put lease.href, lease\n end",
"def max_duration\n if start_time && end_time && (end_time - start_time) > 2.years\n errors.add :end_time, I18n.t('activerecord.errors.models.membership.attributes.end_time.max_duration_error')\n end\n end",
"def dummy\n self.setDuration(nil)\n end",
"def dummy\n self.setDuration(nil)\n end",
"def max_time\n @max_time ||= defaults[:max_time]\n end",
"def stretch!(&block)\n set_duration block.call(@duration)\n self\n end",
"def projected_duration\n 30 * 60 # Hardcode at 30 minutes for now\n end",
"def set_Duration(value)\n set_input(\"Duration\", value)\n end",
"def set_Duration(value)\n set_input(\"Duration\", value)\n end",
"def set_Duration(value)\n set_input(\"Duration\", value)\n end",
"def set_Duration(value)\n set_input(\"Duration\", value)\n end",
"def set_Duration(value)\n set_input(\"Duration\", value)\n end",
"def duration_before_automatic_denial=(value)\n @duration_before_automatic_denial = value\n end",
"def duration\n @abs_duration ||= @duration.abs\n end",
"def default_move_duration=(_arg0); end",
"def SetDuration(duration)\n @duration=duration\n end",
"def max_energy=(energy)\n @max_energy = [0, energy].max\n end",
"def wiggle_max\n 0.5\n end",
"def max_age= age\n @grpc.max_age = Convert.number_to_duration(age)\n end",
"def durationInMinutes=( value)\r\n @duration = (value * 60).to_i\r\n end",
"def max(value)\n opts[:max] = value\n end",
"def max=(value)\n MSPhysics::Newton::Hinge.set_max(@address, value)\n end",
"def -(seconds)\n self + -seconds\n end",
"def meeting_duration=(value)\n @meeting_duration = value\n end",
"def add_edge(source, destination, weight)\n super(source, destination, weight) if weight > 0\n end",
"def prev_max() self.scheduling.prev_max end",
"def duration\n assignment.duration + (extension&.time_delta || 0)\n end",
"def transition_time=(trans_time)\n end",
"def -(seconds)\n self + (-seconds)\n end",
"def -(seconds)\n self + (-seconds)\n end",
"def -(seconds)\n self + (-seconds)\n end",
"def set_duration_override(duration)\n @duration = colon_time_to_seconds(duration)\n end",
"def set_creation_defaults\n if self.max_days == 0\n self.max_days = nil\n self.end_date = nil\n else\n self.end_date = self.start_date + self.max_days\n end\n self.percent = 0\n end",
"def SetMaxQueryTime(max)\n assert { max.instance_of? Fixnum }\n assert { max >= 0 }\n @maxquerytime = max\n end",
"def default_move_duration; end",
"def max_descent_speed; end",
"def time_constraint=(value)\n @time_constraint = value\n end",
"def duration\n 0\n end",
"def set_estimated_amount\n estimated_amount = self.amortization.nil? ? 0 : (self.amortization/self.trust_fund.broadcast_cost)\n if estimated_amount < 0\n self.estimated_amount = 0\n else\n self.estimated_amount = estimated_amount\n end\n end",
"def expand\n @max = Short::MAX_VALUE\n end",
"def update_duration()\r\n self.started_at = Time.now\r\n self.duration += self.added_time.abs\r\n self.added_time = 0\r\n self.active_task = true\r\n self.is_finished = false\r\n self.save\r\n end",
"def update_values(edges:, max: )\n @edges = edges\n @max = max\n @weights = nil # clear memoized value\n end",
"def clear_attributes\n if campaign_attrs[:duration].present? && campaign_attrs[:duration].to_s.to_i <= 0\n campaign_attrs.delete(:duration)\n end\n end",
"def grace_duration=(grace_duration)\n\n if !grace_duration.nil? && grace_duration < 0\n fail ArgumentError, \"invalid value for 'grace_duration', must be greater than or equal to 0.\"\n end\n\n @grace_duration = grace_duration\n end",
"def max_lead_time\n self.standing_line_items.includes(:variant).map{|li| li.variant.lead_time}.max || 0\n end",
"def max_angle=(value)\n MSPhysics::Newton::Corkscrew.set_max_angle(@address, value)\n end",
"def media_duration=(value)\n @media_duration = value\n end",
"def relax(edge)\n #If the distance currently is lower than the added distance,\n #Don't increase it.\n return if @dist_to[edge.dest] <= @dist_to[edge.source] + edge.weight\n \n #Update the distance and add it back to the queue\n @dist_to[edge.dest] = @dist_to[edge.source] + edge.weight\n @path[edge.dest] = edge.source\n @queue.insert(edge.dest, @dist_to[edge.dest])\n end",
"def maximized(value)\n @ole.Maximized = value\n nil\n end",
"def maximized(value)\n @ole.Maximized = value\n nil\n end",
"def duration_in_days=(value)\n @duration_in_days = value\n end",
"def max_age=( delta_seconds )\n\t\tif delta_seconds.nil?\n\t\t\t@max_age = nil\n\t\telse\n\t\t\t@max_age = Integer( delta_seconds )\n\t\tend\n\tend",
"def initialize(max_movement, energy_cost=1)\n self.max_movement = max_movement\n self.energy_cost = energy_cost\n end",
"def maximum=(value)\n @maximum = value\n end",
"def update_target_cost\n cost = BigDecimal(0.00, 10)\n self.activities.each do |activity|\n cost += activity.targetCost\n end\n self.target_cost = cost\n end",
"def - duration\n if duration.is_a? MTK::Core::Duration\n MTK::Core::Duration[@value - duration.value]\n else\n MTK::Core::Duration[@value - duration]\n end\n end",
"def max\n move(180)\n end",
"def reduce_weight \n @weight -= WEIGHT_INCREMENT\n # increment could be confusing and imply an increase rather than a decrease \n # but it is being reduced by increments of 10 so it makes sense??? \n # It's the best of the names that came to mind.\n end",
"def -( other )\n TimeDelta.new( @msecs - other.msecs )\n end",
"def length=(value)\n if value.respond_to?(:to_f)\n @length = (self.unit * value.to_f).round\n else\n raise TypeError, \"Can't set a Duration's length to a #{value.class.name} object.\"\n end\n end",
"def length=(value)\n if value.respond_to?(:to_f)\n @length = (self.unit * value.to_f).round\n else\n raise TypeError, \"Can't set a Duration's length to a #{value.class.name} object.\"\n end\n end",
"def maximum_advance=(value)\n @maximum_advance = value\n end",
"def setDurationMinutes(durationMinutes) \r\n\t\t\t\t\t@durationMinutes = durationMinutes\r\n\t\t\t\tend",
"def update_actual_duration\n self.actual_duration = Date.today - self.startDate\n end",
"def test_layover\n @vertex.add_destination(Edge.new('', 3000))\n layover = 2.166666667 - (0.166666667)\n assert_equal(@vertex.layover, layover)\n @vertex.add_destination(Edge.new('', 4000))\n @vertex.add_destination(Edge.new('', 1000))\n layover = 2.166666667 - (0.166666667 * 3)\n assert_equal(@vertex.layover, layover)\n end",
"def parent_demand(edge)\n from(edge).demand\n end",
"def update!(**args)\n @duration = args[:duration] if args.key?(:duration)\n end",
"def update!(**args)\n @duration = args[:duration] if args.key?(:duration)\n end",
"def maxbw=(value)\n @property_flush[:maxbw] = value\n end",
"def advance_start_at_duration_days=(value)\n value = if value.present? && value.to_i > 0\n value.to_i.days\n else\n nil\n end\n settings(:course).advance_start_at_duration = value\n end",
"def max_interval\n MAX_INTERVAL\n end",
"def duration=(_arg0); end",
"def set_max_min_times(movie_time)\n\n if self.min_time.nil? || (self.min_time > movie_time[0].time)\n self.min_time = movie_time[0].time\n end\n\n if self.max_time.nil? || (self.max_time < movie_time[-1].time)\n self.max_time = movie_time[-1].time + \n movie_time[-1].duration.minutes + TIME_BUF.minutes\n end\n\n\n end",
"def max_ascent_speed; end",
"def -(days)\n self.class.new( to_g - days )\n end"
] |
[
"0.57675135",
"0.5741691",
"0.5448167",
"0.5161886",
"0.5148244",
"0.51042074",
"0.50982696",
"0.50919807",
"0.5077229",
"0.5076094",
"0.50020987",
"0.50020987",
"0.49458435",
"0.4879381",
"0.48665136",
"0.4855394",
"0.48398173",
"0.48382357",
"0.48365098",
"0.48259312",
"0.4813343",
"0.4804307",
"0.48028532",
"0.4799258",
"0.47704923",
"0.4768727",
"0.47626218",
"0.4762386",
"0.4762386",
"0.47379714",
"0.47318482",
"0.47201887",
"0.47185212",
"0.47185212",
"0.47185212",
"0.47185212",
"0.47185212",
"0.47081298",
"0.46890435",
"0.46645975",
"0.46485534",
"0.46475634",
"0.46406683",
"0.4639523",
"0.45946077",
"0.45853052",
"0.45759004",
"0.45705202",
"0.45640203",
"0.45602745",
"0.4553171",
"0.45273593",
"0.4526977",
"0.45212257",
"0.45212257",
"0.45212257",
"0.44810212",
"0.4479686",
"0.44789547",
"0.4476449",
"0.44745243",
"0.4452633",
"0.4442626",
"0.44391608",
"0.4433581",
"0.44305587",
"0.4419876",
"0.44019365",
"0.44003153",
"0.43981868",
"0.43971893",
"0.43903208",
"0.4388426",
"0.43849105",
"0.43849105",
"0.43801796",
"0.43684793",
"0.43539116",
"0.4339786",
"0.43394133",
"0.43278056",
"0.43266335",
"0.43181592",
"0.4300316",
"0.4287495",
"0.4287495",
"0.42764065",
"0.427466",
"0.4274389",
"0.42693955",
"0.42646408",
"0.4262788",
"0.4262788",
"0.4249726",
"0.42384407",
"0.42382595",
"0.42236173",
"0.4223391",
"0.42226097",
"0.4222306"
] |
0.77499884
|
0
|
Determine earliest and latest starting times by using the Tripe algorithm to find longest paths between all nodes.
|
def triple
# Determine number of nodes.
n = @nodes.size
# Initialize distance matrix (n×n) with 0 in the diagonal and -∞ elsewhere.
d = Array.new(n) { |i| Array.new(n) { |j| i == j ? 0 : -INFINITY } }
# For all edges (i,j) ∈ E: set d[i,j] = σ(i,j)
@edges.each { |e| d[e.from][e.to] = e.cost }
# For all nodes v ∈ V:
@nodes.each do |v|
# For all pairs (i,j) with i,j ∈ V\{v} and d[i,v] > -∞:
nodes_ij = @nodes - [v]
nodes_ij.each do |i|
next if d[i][v] == -INFINITY
nodes_ij.each do |j|
# If the path i->v->j is longer than i->j until now, set i->v->j as new distance between i and j.
d[i][j] = [ d[i][j], d[i][v] + d[v][j] ].max
end
end
end
# Return earliest and lates starting times.
result = {}
@nodes.each { |i| result[i] = { es: d[0][i], ls: -d[i][0] } }
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shortest_path(nodes, starting, ending)\n queue = [starting]\n previous = {}\n previous[starting] = nil\n while !queue.empty?\n p queue\n last_node = queue.pop\n if last_node == ending\n path = []\n while previous[last_node]\n path.unshift(last_node)\n last_node = previous[last_node]\n end\n path.unshift(starting)\n return path\n end\n if neighbors = nodes[last_node]\n neighbors.each do |neighbor|\n unless previous.has_key?(neighbor)\n queue.unshift(neighbor) \n previous[neighbor] = last_node\n end\n end\n end\n end\nend",
"def shortest_length(start, finish)\n infinity = (2**(0.size * 8 - 2) - 1) # max Fixnum integer value\n distances = {} # smallest distance from starting vertex to this one\n previous = {}\n cyclic = start == finish # true if starting vertex = ending vertex\n loops = 0 # useful for cyclic path\n vertex_pq = PriorityQueue.new\n\n adj_lists.each do |vertex|\n vname = vertex.name\n if vname == start\n distances[vname] = 0\n vertex_pq.enq(vname, 0)\n else\n distances[vname] = infinity\n vertex_pq.enq(vname, infinity)\n end\n previous[vname] = nil\n end\n\n while vertex_pq\n loops += 1\n # if cyclic, pretend starting vertex is unvisited. put it back in queue.\n if cyclic && loops == 2\n vertex_pq.enq(start, infinity)\n distances[start] = infinity\n end\n # vertex currently being checked. picks closest one first.\n current = vertex_pq.deq\n vname = current.keys.first\n\n # if we've arrived at final vertex, return shortest distance\n # if cyclic, skip this code during first loop\n if vname == finish && loops > 1\n shortest_path = []\n vname2 = vname\n while previous[vname2]\n shortest_path << vname2\n vname2 = previous[vname2]\n previous[start] = nil if cyclic # pretend starting vertex is unvisited\n end\n shortest_path = [start] + shortest_path.reverse\n print \"Shortest path: #{shortest_path}, Length = #{path_length(shortest_path)}\\n\"\n return distances[finish]\n end\n\n # leave if we never get to final vertex\n break if vname == nil || distances[vname] == infinity\n\n adj_vertices(vname, adj_lists).each do |vertex|\n alt_distance = distances[vname] + dist(vname, vertex)\n # if total distance to neighbor < last minimum total distance\n # to neighbor, replace it with this new distance\n if alt_distance < distances[vertex]\n distances[vertex] = alt_distance\n previous[vertex] = vname\n vertex_pq.enq(vertex, alt_distance)\n end\n end\n end\n\n end",
"def find_shortest_path(initial_node, final_node)\n\t\tunless @nodes.include?(initial_node) && @nodes.include?(final_node)\n\t\t raise(\"Either of the nodes not found in the Graph\") \n\t\tend\n\t\tdistance = {}\n\t previous = {}\n\t\tdistance[initial_node] = 0 # Distance from initial_node to initial_node\n\t previous[initial_node] = nil\n\t\tnodes_counted = @nodes\n\t\t\t\n\t\tnodes_counted.each do |n|\n\t\t if n != initial_node \n\t\t\t distance[n] = Float::INFINITY # Unknown distance function from initial_node to final_node\n\t\t\t previous[n] = nil \t # Previous node in optimal path from initial_node\n\t\t\tend\n\t\tend\n\n\t\tuntil nodes_counted.empty? \n\t\t\n\t\t\tu = distance.select{|k,v| nodes_counted.include?(k)}.min_by{|k,v| v}.first # Source node in first case\n\t\t\tbreak if (distance[u] == Float::INFINITY)\n\t\t\tnodes_counted.delete(u)\n\t\t\t\n\t\t\t@paths[u].keys.each do |v|\n\t\t\t\talt = distance[u] + @paths[u][v]\n\t\t\t\tif alt < distance[v] # A shorter path to v has been found\n\t\t\t\t\tdistance[v] = alt\n\t\t\t\t\tprevious[v] = u\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t \n\t\tpath = []\n\t\tcurrent = final_node\n\t\twhile current\n\t\t\tpath.unshift(current)\n\t\t\tcurrent = previous[current]\n\t\tend\n \n\t\treturn distance[final_node], path\n\n\tend",
"def matching_start_time(finish_time)\n start_times.select { |t| t < finish_time }.sort.max\n end",
"def run\n start = rand(20)\n puts \" Starting at: #{@locations[start].name}\"\n tripDesc = \"\" # human-readable List of moves for current trip segment\n @locations[start].visited = true\n visited = 1\n totalTime = 0\n while visited < 20\n group = group_nearest(start)\n best_time = 9999999999\n\n for i in 0..3\n result = getBestPath(start, group[i]) if group[i]\n if result[0] < best_time\n best_time = result[0]\n best_path = result[1]\n best_dest = group[i]\n end\n end\n tripDesc << best_path\n totalTime += best_time\n @locations[best_dest].visited = true\n start = best_dest\n visited += 1\n end\n\n puts \"*********** Total Trip Time = #{secondstoHMS(totalTime)} **************\"\n confirm = \"Complete.\\n\"\n for i in 0..19\n confirm = \"Error, not all locations visited!!\\n\" if !@locations[i].visited\n end\n tripDesc << confirm\n return [totalTime, tripDesc]\n\n end",
"def get_device_times(id, from, to)\n node = find_start(id, from)\n list = Array.new\n while node && node.value < to_epoch(to) do\n list.push(node.value)\n break unless node.next\n node = node.next\n end\n return list\nend",
"def shortest_distance_to_all_nodes(initial)\n Hash[shortest_path_to_all_nodes(initial).map {|n| [n, n.distance]}]\n end",
"def findMinimumTimeDiff()\n pre = nil ;\n diff = nil ;\n @timeNameTable.values.sort.each{|time|\n if(pre.nil?) then\n pre = time ;\n else\n d = time - pre ;\n if(diff.nil? || diff > d) then\n diff = d ;\n end\n end\n }\n return diff ;\n end",
"def seek_from_node(starting_node)\n puts \"seek started from node #{starting_node.inspect}...\"\n \n # -- PART I -- (starting from one node for now...) \n visited_nodes = grow_basic_path([ starting_node ])\n \n puts \"got basic path of length #{visited_nodes.length}, moving on to IIa)...\"\n \n # -- PART II a) --\n if visited_nodes.length < nodes.length\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n \n while target_nodes.length > 0\n puts \"TNL: #{target_nodes.length}\"\n visited_nodes = restructure_path(visited_nodes, target_nodes)\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n end\n end\n \n puts \"...done, moving on to IIb)...\"\n \n # -- PART II b) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes)\n end\n \n puts \"...done, moving on to IIc)...\"\n \n # -- PART II c) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes.reverse)\n end\n \n # -- PART III --\n results = {}\n \n if visited_nodes.length < nodes.length \n results[:path] = visited_nodes\n else\n results[:tour] = visited_nodes\n \n cycle_starts = connected_to(visited_nodes.first).map do |node|\n visited_nodes[visited_nodes.index(node) - 1]\n end\n cycle_ends = connected_to(visited_nodes.last)\n \n (cycle_starts & cycle_ends).each do |node|\n index = visited_nodes.index(node)\n \n circuit = visited_nodes[0..index] + [ visited_nodes.last ]\n circuit += visited_nodes[(index + 1 - visited_nodes.length)..-2].reverse\n \n results[:cycles] ||= []\n results[:cycles] << circuit\n end\n end\n \n results\n end",
"def find_shortest_path(start_node, end_node)\n\n\t\tif (!start_node || !end_node)\n\t\t\traise \"start and end nodes must be specified\"\n\t\tend\n\n\t\tqueue = Hash[@edges.keys.map { |k| [k, nil] }]\n\t\tqueue[start_node] = 0\n\n\t\tdistances = queue.dup\n\t\tcrumbs = {}\n\n\t\twhile queue.size > 0\n\n\t\t\texpanded_node = get_min(queue)\n\n\t\t\t# Check if the current path to each neighbor of the expanded_node\n\t\t\t# is shorter than the path currently stored on the distances hash\n\t\t\t@edges[expanded_node].each do |node, edge|\n\n\t\t\t\tif distances[expanded_node]\n\t\t\t\t\n\t\t\t\t\tcurrent_path_distance = distances[expanded_node] + edge.weight\n\n\t\t\t\t\t# The distance to node is shorter via the current path or the distance to node hasn't yet been computed.\n\t\t\t\t\t# Either way, the distance from start_node->node is updated with the current distance (since it is shorter)\n\t\t\t\t\tif (!distances[node] || current_path_distance < distances[node])\n\t\t\t\t\t\tdistances[node], queue[node] = current_path_distance, current_path_distance\n\t\t\t\t\t\tcrumbs[node] = expanded_node\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tqueue.delete(expanded_node)\n\n\t\tend\n\n\t\t# List of edges representing the shortest path from start_node to end_node\n\t\tshortest_path = []\n\t\tcurrent_node = end_node\n\n\t\twhile (current_node && current_node != start_node && crumbs.size > 0)\n\t\t\tprevious_node = crumbs[current_node]\n\t\t\tif (previous_node)\n\t\t\t\tshortest_path << @edges[previous_node][current_node]\n\t\t\t\tcrumbs.delete(current_node)\n\t\t\tend\n\t\t\tcurrent_node = previous_node\n\t\tend\n\n\t\treturn shortest_path.reverse\n\n\tend",
"def get_available_station_graph\n station_list = []\n line_station_list = []\n station_index = 0\n line_station_index = 0\n single_line_station_index = 0\n junction_line_station_index = 0\n # Getting the adjacent staions of each available stations\n @stations.each do |line_stations|\n line_station_index = 0\n line_stations.each do |_line_station|\n adjacent_station = {}\n line_station_list = []\n if line_station_index.zero?\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n else\n adjacent_station[@stations[station_index][line_station_index - 1][0]] = @timeline[station_index][2] # assigning the time values for waiting\n if line_station_index < (@stations[station_index].length - 1)\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n end\n end\n single_line_station_index = 0\n # Getting the adjacent interchange staions of each available stations\n @stations.each do |junction_line_stations|\n unless single_line_station_index == station_index\n junction_line_station_index = 0\n junction_line_stations.each do |_single_line_station|\n if @stations[station_index][line_station_index][1] == @stations[single_line_station_index][junction_line_station_index][1]\n adjacent_station.store(@stations[single_line_station_index][junction_line_station_index][0], @timeline[single_line_station_index][3]) # assigning the time values for interchange\n end\n junction_line_station_index += 1\n end\n end\n single_line_station_index += 1\n end\n line_station_list.push([@stations[station_index][line_station_index][0], adjacent_station])\n station_list.push(line_station_list)\n line_station_index += 1\n end\n station_index += 1\n end\n station_list # The station list for the graph. formatted as [[[\"NS1\", {\"NS2\"=>12, \"EW24\"=>15}]]]\n end",
"def shortest_path\n initial_position_obj = { position: start_position, source: {} }\n\n knights_path = [initial_position_obj]\n\n while knights_path.present?\n current_position = knights_path.shift\n\n position = current_position[:position]\n\n if position == end_position\n return path_to_destination(current_position, initial_position_obj)\n end\n\n add_possible_destination(position, current_position, knights_path)\n end\n end",
"def find_possible_trips(starting_route, starting_time, max_stops, stops_visited=[])\n self.class.possible_trips.clear\n traverse_stops(starting_route, starting_time, max_stops, stops_visited=[])\n self.class.possible_trips.dup #.uniq\n end",
"def trips(start, finish, stops1, stops2)\n total_paths = 0\n cycles = all_cycles # all cycles in graph\n (stops1..stops2).each do |stops|\n path, paths = [], []\n visited = [start]\n puts \"\\nSTOPS GOAL = #{stops}\\n\"\n num_paths = trips_dfs(start, finish, stops, visited, path, paths, cycles)\n puts \"\\n--- Total paths for #{stops} stops: #{num_paths}\"\n total_paths += num_paths\n end\n puts \"\\n==> Total paths from #{start} to #{finish}, for #{stops1} to #{stops2} stops: #{total_paths} <==\\n\"\n total_paths\n end",
"def getDistanceAndPath(costs, start, last) \n result = []\n distance = 0\n node = last\n result.push(last)\n while (node != start) \n distance += costs[node][:cost]\n node = costs[node][:parent]\n result.unshift(node)\n end\n # record distance for start node to rest of path\n distance += costs[node][:cost]\n \n return {\n distance: distance,\n path: distance == Float::INFINITY ? [] : result # If distance is Infinity, there is no path\n }\n end",
"def find_shortest_path(rolling_node)\n\n @backtrack = []\n @backtrack << @goal_node\n\n # iterate until we arrive at the start node\n while rolling_node[:prev] != nil do\n temp_node = @node_list.find { |hash| hash[:id] == rolling_node[:prev] }\n @backtrack << temp_node[:id]\n rolling_node = temp_node\n end\n\n # create a table with the 1d and the 2d array node values\n @shortest_path = []\n\n @backtrack.each do |p|\n @shortest_path << [p, @table_convert[p]]\n @shortest_path_coords << @table_convert[p][1]\n end\n end",
"def pathfind begTile, endTile\n @traveled_tiles = [begTile]\n @current_tiles = [begTile]\n @next_tiles = Array.new\n #iterate through the maze one movement at a time, hard stop when all tiles have been exhausted\n while (!@current_tiles.include? endTile) && @traveled_tiles.length < @maze.size\n @current_tiles.each do |tile|\n (get_adjacent_floors tile).each do |next_tile|\n #makes sure no tiles are double counted, the first to hit will always be the shortest\n if (next_tile.is_floor) && (!@next_tiles.include? next_tile) && (!@traveled_tiles.include? next_tile)\n @next_tiles.push next_tile\n next_tile.previous_tile tile\n end\n end\n end\n @traveled_tiles.concat @next_tiles\n @current_tiles = @next_tiles.dup\n @next_tiles.clear\n end\n endTile.get_path\n end",
"def dfs_topological_sort\n # sorted by finished time reversely and collect node names only\n timestamp, = self.depth_first_search\n timestamp.sort {|a,b| b[1][1] <=> a[1][1]}.collect {|x| x.first }\n end",
"def travel_time_and_cost\n cost = 0\n travel_time = 0\n (@path.size - 1).times do |i|\n current_vertex = @path[i]\n next_vertex = @path[i+1]\n # travel time = travel distance\n distance = Vertex.euclidean_distance(current_vertex, next_vertex)\n travel_time += distance\n # calculate how early or how late is service\n early_cost = (next_vertex.ready_time - travel_time) > 0 ? (next_vertex.ready_time - travel_time) : 0\n late_cost = (travel_time - next_vertex.due_time) > 0 ? (travel_time - next_vertex.due_time) : 0\n # calculate penalty cost\n cost += early_cost * @penalty_coefficient + late_cost * @penalty_coefficient\n # add service_time and early_cost (wait-for-service time) to travel time\n travel_time += next_vertex.service_time + early_cost\n end\n return cost, travel_time\n end",
"def starts\n starts = nil\n @doc.find(\"/dwml/data/time-layout/start-valid-time/text()\").map do |node|\n t = Time.parse(node.to_s)\n starts = t if !starts || t < starts\n end\n @starts = starts\n end",
"def shortest_path_from(from, check=nil)\n dirs = [ [1,0], [0,1], [0,-1], [-1,0] ]\n \n #return [1,0]\n \n unless @cache and @cached_for == towers.keys+[check]\n\tmarked = {}\n\tmarked.default = false\n\n\tq = [Config.monsters_end_at]\n\tfirst = 0\n\t\n\tmarked[Config.monsters_end_at] = true\n\t\n\twhile first < q.size\n\t v = q[first]\n\t first += 1\n\t for i in dirs\n\t w = [v[0]+i[0], v[1]+i[1]]\n\t next if w != Config.monsters_start_at and w != Config.monsters_end_at and\n\t\t (w[0] < 0 or w[1] < 0 or w[0] >= Config.map_size[0] or w[1] >= Config.map_size[1])\n\t next if marked[w] or w == check or towers[w]\n\t marked[w] = [-i[0], -i[1] ]\n\t q << w\n\t end\n\tend\n\t\n\t@cached_for = towers.keys+[check]\n\t@cache = marked\n end\n \n return @cache[from]\n end",
"def path_finder(start_node=START_NODE, goal_node=GOAL_NODE)\n\t\n\t# INITIALIZE\n\tvalid = valid_nodes # largest set\n\treachable = [start_node] # nodes we can reach from current node\n\texplored = [] # nodes we've already considered\n\t# nodes reachable, valid, and not explored\n\topen_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n\t# record node path {node => previous_node}\n\tnodes_path = {start_node => nil} \n\t\n\twhile !open_nodes.empty?\n # node = choose_node(reachable)\n\t\tnode = open_nodes.sample # random node in open_nodes\n\t\t\n\t\treturn build_path(goal_node, nodes_path) if node==goal_node # STOP if reached goal! \n \n # Don't repeat ourselves.\n reachable.delete(node) # remove current node from reachable\n explored.push(node) # add node to explored\n \n # What nodes are now open from this node?\n # Adjacent, not in explored, and valid (not an obstacle and in maze)\n new_reachable = (get_adjacent_nodes(node) - explored) & valid\n\t\t# ADD new nodes to reachable\n new_reachable.each do |adj_node|\n if !reachable.include?(adj_node)\n # adjacent.previous = node # Remember how we got there.\n nodes_path[adj_node] = node # {[0,3] => [0,2]}\n reachable << adj_node\n end\n end\n \n\t\t# REFRESH OPEN NODES\n open_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n \n end\n \n\treturn nil # open_nodes empty - no path found\nend",
"def calculate_start_and_end_time\n return false if trip.nil?\n\n if self.start_time.nil?\n self.start_time = trip.arrive_by ? trip.trip_time - duration : trip.trip_time\n end\n\n if self.end_time.nil?\n self.end_time = trip.arrive_by ? trip.trip_time : trip.trip_time + duration\n end\n end",
"def longest_startstop\n startstop(0).first\n end",
"def astar(maze, start, last)\n\n #Cria node inicial\n start_node = Node.new(parent = nil, position = start)\n\n start_node.g = 0\n start_node.h = 0\n start_node.f = 0\n\n #Cria node final\n end_node = Node.new(parent =nil, position =last)\n\n end_node.g = 0\n end_node.h = 0\n end_node.f = 0\n\n #Inicializa lista de nodes visitados\n open_list = []\n\n #inicializa lista closed\n closed_list = []\n\n # Adiciona o node inicial na open list\n open_list.push(start_node)\n\n #Loop enquando nao encontra no final\n while open_list.length > 0\n\n #Pega node sendo analizado no momento, tem que ser o node com o menor f\n current_node = open_list[0]\n current_index = 0\n\n open_list.each_with_index do |item, index|\n if item.f < current_node.f\n current_node = item\n current_index = index\n end\n end\n\n #Retira node analizado no momento da open list\n open_list.delete_at(current_index)\n #Retira node analizado no momento da closed list\n closed_list.push(current_node)\n\n #Verifica se encontrou o no final\n if current_node.position == end_node.position\n path = []\n current = current_node\n\n while current != nil\n path.push(current.position)\n current = current.parent\n end\n\n return path.reverse\n\n end\n\n #Gera os vizinhos do node atual\n children = []\n\n [[0, -1], [0, 1], [-1, 0], [1, 0]].each { |new_position|\n #percorre uma coluna OU uma linha por vez\n node_position = [current_node.position[0] + new_position[0], current_node.position[1] + new_position[1]]\n\n #verifica se o vizinho nao ultrapassa a borda da matriz\n if node_position[0] > (maze.length - 1) || node_position[0] < 0 || node_position[1] > (maze[maze.length - 1].length - 1) || node_position[1] < 0\n next\n end\n\n #verifica se o vizinho se encontra na rua\n if maze[node_position[0]][node_position[1]] != 0\n next\n end\n\n\n new_node = Node.new(current_node, node_position)\n children.push(new_node)\n\n }\n\n #Loop entre os vizinhos\n children.each { |child|\n #Verifica se o vizinho esta na closed list\n closed_list.each { |closed_child|\n if child.position == closed_child.position\n next\n end\n }\n\n #Cria os valores f, g e h para a funcao f = g + h, sendo h a heuristica\n child.g = current_node.g + 1\n child.h = ((child.position[0] - end_node.position[0]) ** 2) + ((child.position[1] - end_node.position[1]) ** 2)\n child.f = child.g + child.h\n\n #Se o vizinho ja esta na open list\n open_list.each { |open_node|\n if child.position == open_node.position && child.g > open_node.g\n next\n end\n }\n\n #Adiciona o vizinho na open list\n open_list.push(child)\n }\n\n end\n\nend",
"def find_path(positions, start, finish)\n # Will hold MoveTiles that form a path from start to finish\n path = [finish]\n # Get finish tile first so that we can work backwards in making the path\n chosen = finish\n movetile = chosen\n # Endless loop ZOMG\n while true\n t_x, t_y = movetile.x, movetile.y\n # Generate list of tiles surrounding this tile\n surrounding = []\n surrounding.push(positions[t_x][t_y+1]) if valid?(t_x, t_y+1)\n surrounding.push(positions[t_x][t_y-1]) if valid?(t_x, t_y-1)\n surrounding.push(positions[t_x+1][t_y]) if valid?(t_x+1, t_y)\n surrounding.push(positions[t_x-1][t_y]) if valid?(t_x-1, t_y)\n \n surrounding.compact!\n surrounding.delete(0)\n consider = []\n lowest_cost = 99\n # Evaluate surrounding tiles to find lowest cost\n surrounding.each{|tile|\n # If tile has a total move cost that is at least equal to the current best\n if tile.total_cost <= lowest_cost\n # If even lower, remove previous considerations and set new best\n if tile.total_cost < lowest_cost\n consider.clear\n lowest_cost = tile.total_cost\n end\n # Add this tile to be considered\n consider.push(tile)\n end\n }\n # Choose a tile from list\n chosen = consider[rand(consider.size)]\n # Return path if that last tile was the final one\n return path.reverse! if [chosen.x, chosen.y] == [start.x, start.y]\n # Add chosen tile to path\n path.push(chosen)\n # Evaluate this tile next\n movetile = chosen\n end\n end",
"def find_path(positions, start, finish)\n # Will hold MoveTiles that form a path from start to finish\n path = [finish]\n # Get finish tile first so that we can work backwards in making the path\n chosen = finish\n movetile = chosen\n # Endless loop ZOMG\n while true\n t_x, t_y = movetile.x, movetile.y\n # Generate list of tiles surrounding this tile\n surrounding = []\n surrounding.push(positions[t_x][t_y+1]) if valid?(t_x, t_y+1)\n surrounding.push(positions[t_x][t_y-1]) if valid?(t_x, t_y-1)\n surrounding.push(positions[t_x+1][t_y]) if valid?(t_x+1, t_y)\n surrounding.push(positions[t_x-1][t_y]) if valid?(t_x-1, t_y)\n \n surrounding.compact!\n surrounding.delete(0)\n consider = []\n lowest_cost = 99\n # Evaluate surrounding tiles to find lowest cost\n surrounding.each{|tile|\n # If tile has a total move cost that is at least equal to the current best\n if tile.total_cost <= lowest_cost\n # If even lower, remove previous considerations and set new best\n if tile.total_cost < lowest_cost\n consider.clear\n lowest_cost = tile.total_cost\n end\n # Add this tile to be considered\n consider.push(tile)\n end\n }\n # Choose a tile from list\n chosen = consider[rand(consider.size)]\n # Return path if that last tile was the final one\n return path.reverse! if [chosen.x, chosen.y] == [start.x, start.y]\n # Add chosen tile to path\n path.push(chosen)\n # Evaluate this tile next\n movetile = chosen\n end\n end",
"def make_paths\n visited = {}\n path = []\n return path if @nmap.empty? || @nnmap.empty?\n\n # 0 is false\n @nmap.each do |k, _|\n visited[k] = 0\n end\n\n # for each node that is not an end node to an end node\n @nnmap.each do |s, _|\n # if s is an end node\n @paths << [s] if @ends.include? s\n\n # for each end node as desintation\n @ends.each do |d|\n get_allpaths(s, d, visited, path)\n end\n end\n @paths.sort_by(&:length).reverse\n end",
"def shortest_path_to_all_nodes(initial)\n initial.distance = 0\n\n current = initial\n loop do\n unvisited.delete(current)\n\n calculate_neighbor_shortest_distances(current)\n\n return graph.vertices if no_reachable_nodes\n\n current = unvisited.min_by(&:distance)\n end\n end",
"def shortest_path(start_node, end_node, graph)\n adjacent_edges = graph.select{ | edge | edge[NODES].include?(start_node) }\n remaining_edges = graph - adjacent_edges\n shortest_path = Path.new\n adjacent_edges.each do | edge |\n path = Path.new [edge]\n neighbor_node = (edge[NODES] - [start_node])[0] # ['A', 'B'] - ['A'] => ['B']\n unless neighbor_node == end_node\n path_ahead = shortest_path(neighbor_node, end_node, remaining_edges)\n (path_ahead.empty?)? path.clear : path.concat(path_ahead)\n end \n shortest_path = path if path.distance < shortest_path.distance\n end\n shortest_path\n end",
"def min_cost(costs)\n prev_color_path1 = 0\n prev_color_path2 = 1\n path1 = costs[0][prev_color_path1]\n path2 = costs[0][prev_color_path2]\n \n if costs[0][2] < path1\n if path1 < path2\n path2 = path1\n prev_color_path2 = prev_color_path1\n path1 = costs[0][2]\n prev_color_path1 = 2\n end\n elsif costs[0][2] < path2\n if path2 < path1\n path1 = path2\n prev_color_path1 = prev_color_path2\n path2 = costs[0][2]\n prev_color_path2 = 2\n end\n end\n\n costs[1..-1].each do |cost|\n min1 = nil\n min1idx = nil\n # for first path\n cost.each_with_index do |amt, idx|\n next if idx == prev_color_path1\n if min1\n if amt < min1\n min1 = amt\n prev_color_path1 = idx\n else\n next\n end\n else\n min1 = amt\n min1idx = idx\n end\n end\n path1 += min1\n\n \n min2 = nil\n min2idx = nil\n # for second path\n cost.each_with_index do |amt, idx|\n next if idx == prev_color_path2\n if min2\n if amt < min2\n min2 = amt\n prev_color_path2 = idx\n else\n next\n end\n else\n min2 = amt\n min2idx = idx\n end\n end\n \n path2 += min2\n end\n\n path1 < path2 ? path1 : path2\nend",
"def obtainTrips(contents)\n\n # variable to hold the list of trips\n trips = []\n\n # for every line...\n contents.each do |line|\n\n # use regex to ensure the line matches\n captures = /^Trip ([A-Za-z]{1,64}) ([0-2]\\d):(\\d\\d) ([0-2]\\d):(\\d\\d) (\\d{1,3}\\.?\\d?)$/.match(line)\n\n # safety check, ensure the capture isn't nil\n if captures.nil?\n next\n end\n\n # if the regex capture has a length of at least 6:\n #\n # * driver\n # * start time - HH\n # * start time - MM\n # * end time - HH\n # * end time - MM\n # * average speed \n #\n if captures.length < 6\n next\n end\n\n # safety check, ensure this actually resembles a 24 hour clock\n if captures[2].to_i > 23 || captures[4].to_i > 23 ||\n captures[3].to_i > 59 || captures[5].to_i > 59\n next\n end\n\n # Obtain the current time\n t = Time.now\n\n # Assemble a start time\n start_time = Time.local(t.year, t.day, t.month, captures[2], captures[3])\n\n # Assemble an end time\n end_time = Time.local(t.year, t.day, t.month, captures[4], captures[5])\n\n # Throw a warning if the start time is *after* the end time,\n # but skip on to the next element...\n if start_time > end_time\n puts \"\\nWarning: Improper start / end time detected!\"\n puts \"--------------------------------------------\"\n puts line\n puts \"--------------------------------------------\\n\"\n next\n end\n\n # assemble the trip array\n trip = {:driver => captures[1],\n :start_time => start_time,\n :end_time => end_time,\n :average_speed => 0,\n :miles_driven => captures[6].to_f}\n\n # attempt to calculate the average speed\n start_minutes = (captures[2].to_i * 60) + captures[3].to_i\n end_minutes = (captures[4].to_i * 60) + captures[5].to_i\n total_time_in_minutes = end_minutes - start_minutes\n if total_time_in_minutes <= 0\n next\n end\n trip[:average_speed] = trip[:miles_driven] * 60 / total_time_in_minutes\n\n # discard trips with speed < 5mph or speed > 100mph\n if trip[:average_speed] < 5 || trip[:average_speed] > 100\n next\n end\n\n # add the trip to the list of trips\n trips.push(trip)\n end\n\n # send back the list of trips\n return trips\nend",
"def get_ants\n puts \"ANT FARM!\"\n ants = Array.new #ants could probably just be an array of hashes, since we don't yet need a full object...\n \n #make 100 ants\n num_ants = 100\n (0...num_ants).each do |i|\n ant = Ant.new(i)\n ants.push(ant)\n end\n \n edges_to_check = Set.new\n edges_by_node = @nodes.merge(@nodes) {|k| []}\n @edges.each do |e_id, edge|\n edges_to_check.add(e_id)\n edges_by_node[edge.a.id].push(e_id)\n edges_by_node[edge.b.id].push(e_id)\n end\n\n journeys = [[START]] #last item of journey array is the current island\n journeys.each do |path| #go through each journey on the path \n island = path[-1] #the last item is where we're moving from\n #grab all the edges connected to that path that are new or involve new terminals\n new_edge_ids = edges_by_node[island]\n new_edge_ids.each do |e_id|\n if edges_to_check.include?(e_id) #if new path to take\n new_path = path[0...-1] + [e_id, (@edges[e_id].a.id == island ? @edges[e_id].b.id : @edges[e_id].a.id)]\n # puts \"new path\",new_path.to_s\n journeys.push(new_path)\n edges_to_check.delete(e_id)\n end\n end\n end\n\n \n #check validity, and mark bad paths by maing them negative\n journeys.each do |path|\n path.slice!(-1) #remove the island from the path\n path.each_with_index do |e_id,i|\n if @validity[e_id] < 0 #if is not valid\n path[i] *= -1\n #path.slice!(i..-1) #remove the rest of the path, since we won't need it?\n end\n end\n end\n\n puts 'journeys: '+journeys.to_s, 'number of journeys: '+journeys.length.to_s \n\n #divide the journeys among the ants\n ants.each_with_index {|ant,i| ant.plan = journeys[(i+1)%journeys.length]}\n \n #puts \"ants we made\", ants\n return ants\n end",
"def find_start(id, from)\n from= to_epoch(from)\n node = $devices[id].head\n while node.next do\n return node if node.value >= from\n node = node.next\n end\n return nil #from time not in list\nend",
"def schedule(start = 0, stop = 100)\n\n # Sort intervals by end point asc\n # iterate from left to right\n # at each endpoint find the max weight from the start to that endpoint\n # Make a comparison if the start of the interval is after the end of the previous \"checkpoint\"\n # add the weight adn that is the new checkpoint\n # if it overlaps then select the larger of the two endpoints\n # This is almost right but not quite\n # we want to break up at previously weighed sectionif we need to\n # we shodul get keep the list of all endpoints weights\n\n # x---x\n # x----x\n # x-------x\n\n # 1,4,3\n # 5,9,4\n # 7,12,5\n\n # Keep the checkpoints here\n # [4:3, 9:7]\n # then see 7,12,5\n # choose 5 or 7 we'd say 7 and may want to do say 7 is max from 0<=>12\n # but if we split it up\n # [4:3, 9:7, 12:8]\n # we could get max 8 if we exclude the middle one\n\n endpoints = []\n interval_list = sort(@interval_list)\n\n interval_list.each do |interval|\n max_weight = interval.weight\n steps = []\n\n # endpoint list is sorted so ya konw we could just do binary search here\n # woudl bring the whoel thing down to nlgn\n endpoints.reverse.each do |endpoint|\n if interval.start > endpoint.stop\n max_weight += endpoint.best_weight\n steps = endpoint.steps.clone\n break\n end\n end\n\n # If we do better by ignoring this interval than record that\n if endpoints.last && endpoints.last.best_weight > max_weight\n max_weight = endpoints.last.best_weight\n steps = endpoints.last.steps\n else\n steps << interval\n end\n\n endpoints << EndpointWeight.new(interval.stop, max_weight, steps)\n end\n\n # endpoints is non-decrasing with each entry. Last must be max\n puts endpoints.last\n endpoints.last.best_weight\n end",
"def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvisited << [board_node_by_location(x),step]\n end\n end\n visited << unvisited.shift\n end\n return visited\nend",
"def solve( start, finish )\n return [start] if start == finish\n \n seen = {start => true}\n paths = [[start]]\n \n until paths.first.last == finish\n path = paths.shift\n \n new_paths = [path.dup << path.last * 2, path.dup << path.last + 2]\n new_paths << (path.dup << path.last / 2) if path.last.even?\n \n new_paths.each do |new_path|\n unless seen[new_path.last]\n paths << new_path\n seen[new_path.last] = true\n end\n end\n end\n \n paths.shift\nend",
"def recalc_times(starting_at=0, list=@events)\n\tt = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n\tlist[starting_at .. -1].each { | e |\n\t t += e.delta_time\n\t e.time_from_start = t\n\t}\n end",
"def recalc_times(starting_at=0, list=@events)\n t = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n list[starting_at .. -1].each do |e|\n t += e.delta_time\n e.time_from_start = t\n end\n end",
"def start_times\n \t@start_time1 = self.start_time1\n\n @start_time2 = self.start_time2\n\n @start_time3 = self.start_time3\n\n start_times = [@start_time1, @start_time2, @start_time3]\n end",
"def next_step_from(paths)\n paths.map do |path|\n possible_neighbours(path.most_recent_step.coordinate, @max_x, @max_y) \n .map { |c| coord_to_step_on_path(c, path) }\n .reject { |p| p == nil }\n end\n .flatten\n end",
"def dijkstra_shortest_path(start, finish)\n visited, unvisited = Array.new, Array.new\n distances = Hash.new\n\n distances[start] = 0\n unvisited << start\n\n # find the distance\n while not unvisited.empty?\n curr_node = unvisited.pop\n visited << curr_node\n get_edges(curr_node).each do |edge| \n if visited.find_index(edge.out_vertex) == nil\n unvisited.unshift(edge.out_vertex) if unvisited.find_index(edge.out_vertex) == nil\n curr_distance, min_distance = distances[curr_node], distances[edge.out_vertex] || 1.0 / 0.0\n if curr_distance + edge.distance < min_distance\n distances[edge.out_vertex] = curr_distance + edge.distance\n end\n end\n end\n end\n\n # figure out the path\n previous = finish\n path = Array.new() \n path << previous\n while distances[previous] != 0\n get_edges(previous).each do |edge|\n if previous != edge.in_vertex && distances[edge.in_vertex] + edge.distance == distances[previous]\n previous = edge.in_vertex\n path << previous\n break\n end\n end\n end\n \n return distances[finish], path.reverse\n end",
"def next_clean_time(addr) \n #Figure out side of the street\n side = self.get_side(addr) \n \n #Find all blocks that match Street Address \n all_blocks = self.blocks\n blocks = all_blocks.where(\"side = ? AND bottom <= ? AND top >= ?\", side, addr, addr)\n if blocks == []\n return nil\n else \n #Compute the next cleaning times for the block and pick the smallest(i.e. the soonest) time\n cts = Array.new\n blocks.each{|x|cts << x.ct.next_time}\n best = cts.min\n return best, blocks[0].id\n end\n end",
"def compute_shortest_path\n update_distance_of_all_edges_to(Float::INFINITY)\n @distance_to[@source_node] = 0\n\n # The prioriy queue holds a node and its distance from the source node.\n @pq.insert(@source_node, 0)\n while @pq.any?\n node = @pq.remove_min\n node.adjacent_edges.each do |adj_edge|\n relax(adj_edge)\n end\n end\n end",
"def find_path(start, goal)\n raise \"loc1 must not be the same as loc2\" if start == goal\n\n # Using A* path-finding algorithm\n # See pseudocode here: https://en.wikipedia.org/wiki/A*_search_algorithm\n # https://www.redblobgames.com/pathfinding/a-star/introduction.html\n # NOTE that this is overkill for this problem...\n open_set = Set.new([start])\n came_from = {}\n\n # Default value of \"Infinity\", but we can just use nil\n g_score = {}\n g_score[start] = 0\n\n # f_score = g_score[node] + h_score[node]\n # This uses both current best path (g score) aka similar to Djikstra's algorithm,\n # plus the heuristic score.\n f_score = {}\n # g_score[start] is 0, so not included here\n f_score[start] = h_score(start, goal)\n\n # Note that we add d_score as the weight of the edge, but in our\n # case, we consider all edges equally, so hardcode 1\n d_score = 1\n\n until open_set.empty? do\n # Node in open set with lowest f score (would ideally use PriorityQueue)\n current = open_set.min_by { |node| f_score[node] }\n\n if current == goal\n return reconstruct_path(came_from, current)\n end\n\n open_set.delete(current)\n\n valid_neighbours(current).each do |neighbour_loc|\n tentative_g_score = g_score[current] + d_score\n if g_score[neighbour_loc].nil? || tentative_g_score < g_score[neighbour_loc]\n # This path to neighbor is better than any previous one. Record it!\n came_from[neighbour_loc] = current\n g_score[neighbour_loc] = tentative_g_score\n f_score[neighbour_loc] = g_score[neighbour_loc] + h_score(neighbour_loc, goal)\n if !open_set.include?(neighbour_loc)\n open_set << neighbour_loc\n end\n end\n end\n end\n\n raise \"error, no path found!\"\n end",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def merged_meetings(meeting_time_ranges)\n # assuming meetings can fall at most 12 30-minute blocks past 9am\n start_times = Array.new(13, nil) # array of start times at their index\n end_times = Array.new(13, nil) # array of end times - their index is their start time\n meeting_time_ranges.each do |meeting_time_range|\n start_time = meeting_time_range[0]\n end_time = meeting_time_range[1]\n\n # add start_time to start_times\n start_times[start_time] = start_time\n\n # add end_time to end_times at its start_time index, unless there is already a later end_time at that index\n end_times[start_time] = end_time unless !end_time[start_time].nil? && end_time[start_time] > end_time\n end\n\n merged_meeting_times = []\n\n # start_times look something like [0, nil, nil, 3, 4, nil, nil, nil, nil, 9, 10, nil]\n # end_times look something like [1, nil, nil, 5, 8, nil, nil, nil, nil, 10, 12, nil]\n last_start_time = nil\n last_end_time = nil\n start_times.each do |start_time|\n next if start_time.nil?\n\n if last_start_time.nil? # no values have been stored yet\n last_start_time = start_time\n last_end_time = end_times[start_time]\n next\n end\n\n if start_time <= last_end_time # current start_time is before the last end_time\n if start_time < last_start_time\n # current start_time earlier than last_start_time - assign as last_start_time\n last_start_time = start_time\n end\n\n if end_times[start_time] > last_end_time\n # current end_time later than last_end_time - assign it end_time as last_end_time\n last_end_time = end_times[start_time]\n end\n next\n end\n\n if start_time > last_end_time\n # we have reached the start of a new range - store the last range\n merged_meeting_times << [last_start_time, last_end_time]\n\n # reset the last_end_time and last_start_time to the current values\n last_start_time = start_time\n last_end_time = end_times[start_time]\n next\n end\n end\n\n # be sure to append the remaining last meeting time range\n merged_meeting_times << [last_start_time, last_end_time]\n\n merged_meeting_times\nend",
"def get_route(start_arr, end_arr)\n root = Position.new(start_arr[0], start_arr[1])\n target = Position.new(end_arr[0], end_arr[1])\n solution = get_target_value(target, root)\n\n route = []\n route.unshift([target.x, target.y])\n location = solution.parent\n until location == nil\n route.unshift [location.x, location.y]\n location = location.parent\n end\n return route\nend",
"def start\n start = []\n self.children.each { |c| \n start.push(c.start) unless c.start.nil?\n start.push(c.end) unless c.end.nil?\n }\n start.sort.first\n end",
"def solver(flights)\n (p all_paths(flights)).min_by { |path| cost_of_path(path) }\nend",
"def shortest_path_lengths(source)\n seen = {}\n level = 0\n nextlevel = { source => 1 }\n until nextlevel.empty?\n thislevel = nextlevel\n nextlevel = {}\n thislevel.each do |v, _|\n if seen[v].nil?\n seen[v] = level\n nextlevel.update(neighbors_of(v).map { |w| [w, nil] }.to_h)\n end\n end\n level += 1\n end\n seen\n end",
"def next_closest_time(time)\n store = Array.new(9)\n past = []\n\n time.split('').each do |num| \n if (num.ord >= 48 && num.ord <= 57)\n store[num.to_i] = true \n past.push(num.to_i)\n end\n end\n\n future = past\n place = 3\n until (place == -1)\n limit = find_limit(place, past[place])\n if next_greatest(store, past[place], limit)\n if place == 1 && next_greatest(store, past[place], limit) >= 5 && future[0] == 2\n next_num = next_greatest(store, 0, 2)\n future[0] = next_num\n future[1] = next_num\n else \n future[place] = next_greatest(store, past[place], limit)\n end\n break\n else\n future[place] = lowest(store)\n place -= 1\n end\n end\n\n future[0..1].join(\"\").to_s + \":\" + future[2..3].join(\"\").to_s\nend",
"def a_star pitch, start, goal\n\t\t# The set of nodes already evaluated.\n\t\tclosedset = []\n\t\t# The set of tentative nodes to be evaluated.\n\t\topenset = []\n\t\t# Visited nodes\n\t\tfrontier = []\n\t\topenset << start\n\t\t# The map of navigated nodes.\n\t\tcame_from = { }\n\t\t# Distance from start along optimal path.\n\t\tg_score, h_score, f_score = { }, { }, { }\n\t\tg_score[start] = 0\n\t\th_score[start] = dist start, goal, :manhattan\n\t\t# Estimated total distance from start to goal through y.\n\t\tf_score[start] = h_score[start]\n\n\t\t# Main loop\n\t\twhile not openset.empty?\n\t\t\t# Fetching the node among openset with the least f_score\n\t\t\tx, _value = [], 1_000_000\n\t\t\topenset.each do |key|\n\t\t\t\tx, _value = key, f_score[key] if f_score[key] < _value\n\t\t\tend\n\n\t\t\tbreak if x == goal # We reached target point and thus finished looking for it !!\n\n\t\t\t# Moving x from openset to closedset\n\t\t\topenset.delete x\n\t\t\tclosedset << x\n\n\t\t\t(-1..1).each do |i|\n\t\t\t\t(-1..1).each do |j|\n\t\t\t\t\ty = [x[0] + i, x[1] + j]\n\t\t\t\t\tunless i == 0 and y == 0\n\t\t\t\t\t\tif pitch[y].nil? # We only want to explore neighbours\n\t\t\t\t\t\t\tnext if closedset.include? y # If already in closedset, we skip it\n\n\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\th = dist x, y, :manhattan\n\t\t\t\t\t\t\tg = g_score[x] + h\n\n\t\t\t\t\t\t\tif not openset.include? y then\n\t\t\t\t\t\t\t\treturn [] if frontier.include? y\n\t\t\t\t\t\t\t\tfrontier << y\n\t\t\t\t\t\t\t\topenset << y # Adding current neighbours to openset\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telsif g < g_score[y]\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Updating what needs to be\n\t\t\t\t\t\t\tif better then\n\t\t\t\t\t\t\t\tcame_from[y] = x\n\t\t\t\t\t\t\t\tg_score[y] = g\n\t\t\t\t\t\t\t\th_score[y] = dist y, goal, :manhattan # heuristic estimate of distance (y, coords)\n\t\t\t\t\t\t\t\tf_score[y] = g_score[y] + h_score[y]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# Finally assembling path and returning it\n\t\tpath = []\n\t\t_cur = goal\n\t\twhile _cur != start do\n\t\t\tpath << _cur\n\t\t\t_cur = came_from[_cur]\n\t\tend\n\n\t\treturn path.reverse\n\tend",
"def longest_path_1(edges)\nend",
"def min_steps(in_start_pos_array, unlocked_doors = [], cache = {})\n cache_hashkey = [in_start_pos_array.sort.join, unlocked_doors.sort.join]\n if not cache.has_key?(cache_hashkey)\n keys = reachable_keys(in_start_pos_array, unlocked_doors)\n if keys.empty?\n the_min_steps = 0\n else\n steps = []\n keys.each do |walk, key, distance|\n orig = in_start_pos_array[walk]\n in_start_pos_array[walk] = key\n steps << distance + min_steps(in_start_pos_array, unlocked_doors + [key.upcase], cache)\n in_start_pos_array[walk] = orig\n end\n the_min_steps = steps.min\n end\n cache[cache_hashkey] = the_min_steps\n end\n return cache[cache_hashkey]\n end",
"def nltime_includes\n from = self.to_s.split('::').last.downcase.to_sym\n Graph.predecessors(from)\n end",
"def recalc_delta_from_times(starting_at=0, list=@events)\n prev_time_from_start = 0\n # We need to sort the sublist. sublist.sort! does not do what we want.\n # We call mergesort instead of Array.sort because sort is not stable\n # (it can mix up the order of events that have the same start time).\n # See http://wiki.github.com/adamjmurray/cosy/midilib-notes for details.\n list[starting_at .. -1] = MIDI::Array.new(list[starting_at .. -1]).mergesort do |e1, e2|\n e1.time_from_start <=> e2.time_from_start\n end\n list[starting_at .. -1].each do |e|\n e.delta_time = e.time_from_start - prev_time_from_start\n prev_time_from_start = e.time_from_start\n end\n end",
"def find_path(start, target)\n node = build_path(start, target)\n path = [node]\n until node.next_node.nil? do\n node = node.next_node\n path.push(node)\n end\n path = path.reverse\n puts \"You made it in #{path.length} moves. Here is your path: \"\n path.each do |node|\n puts \"[#{node.x}], [#{node.y}]\"\n end\nend",
"def endpoints\n connectors = {\n :NW => [2, 2],\n :SE => [98, 98],\n :NE => [98, 2],\n :SW => [2, 98],\n :N => [50, 0],\n :S => [50, 100],\n :E => [100, 50],\n :W => [0, 50]\n }\n shortest_path = 1000000\n generated_endpoints = []\n connectors.each do |from_key, from_connector|\n ep_from = [from.x + from_connector[0], from.y + from_connector[1]]\n connectors.each do |to_key, to_connector|\n ep_to = [to.x + to_connector[0], to.y + to_connector[1]]\n path = Math.sqrt(((ep_from[0] - ep_to[0]).abs ** 2) + ((ep_from[1] - ep_to[1]).abs ** 2)).to_i\n if path < shortest_path + 25\n shortest_path = path\n generated_endpoints = [ep_from, ep_to]\n end\n end\n end\n return generated_endpoints\n end",
"def bfs_shortest_path(node1, node2)\n distance, route = breadth_first_search(node1)\n step = distance[node2]\n node = node2\n path = [ node2 ]\n while node != node1 and route[node]\n node = route[node]\n path.unshift(node)\n end\n return step, path\n end",
"def longest_prefix(strings)\n min = strings.min \n max = strings.max\n string_pre = min.size.times do |i| \n break i if min[i] != max[i]\n end\n min[0...string_pre]\nend",
"def find_ladders(begin_word, end_word, word_list)\n word_list = create_dictionary(word_list)\n queue = [[begin_word, 1, {}, [begin_word]]]\n paths = []\n min_count = nil\n \n until queue.empty?\n word, count, visited, path = queue.shift\n\n (0...word.length).each do |idx|\n sliced = word[0...idx] + \"_\" + word[idx + 1..-1]\n\n word_list[sliced].each do |w|\n if !visited[w]\n current_visited = visited.dup\n current_path = path.dup\n current_visited[w] = true\n current_path << w\n queue << [w, count + 1, current_visited, current_path]\n\n if w == end_word && !min_count\n min_count = count + 1\n paths << current_path\n elsif w == end_word && min_count == count + 1\n paths << current_path\n end\n end\n end\n end\n end\n\n paths\nend",
"def get_route(curr_pos, end_time, pmap, tws, twe) \n ans = []\n starting_tuple = curr_pos << 0 # 0 is the waiting time\n ans << starting_tuple # [y, x, time unit]\n \n\t\n\t\n max_y = pmap.length - 1 \n max_x = pmap[0].length - 1\n \n highest_score = 0.0\n \n\ttime_for_score = 0.0\n\ttime_for_get_ans = 0.0\n\t\n\ttemp = -1\n\ttemp1 = 0\n\tfor y in 0..max_y\n\t\ttemp1 = pmap[y].count(temp)+ temp1 \n\tend\n\t\n\tno_of_pokemon = (pmap.length*pmap[0].length - temp1)\n\t\n\tnumber_of_loops = 0.7541*Math.log(no_of_pokemon,E) + 0.9829\n\t\n\n\t\n\t\n for h in 0...number_of_loops\n pmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n time_taken = Time.now\n sortedArrayByRatioDistStart1 = []\n ans1 = []\n ans1 = getArrayResultsWithStartingPokemon(starting_tuple, pmap1, tws1, twe1, sortedArrayByRatioDistStart1, end_time, h)\n\t\ttime_for_get_ans = Time.now - time_taken + time_for_get_ans\n\t\t\n\t\tpmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n\t\ttime_taken = Time.now\n score_time1 = get_score(ans1, pmap1, tws1, twe1)\n route_score1 = score_time1[0].round\n route_time1 = score_time1[1].round(3)\n time_for_score = Time.now - time_taken + time_for_score\n\t\t\n if highest_score <= route_score1\n final_ans = ans1\n highest_score = route_score1\n end\n\t\t\n\t\t\n end\n \n\n return final_ans\nend",
"def recalc_delta_from_times(starting_at=0, list=@events)\n\tprev_time_from_start = 0\n\tlist[starting_at .. -1].each { | e |\n\t e.delta_time = e.time_from_start - prev_time_from_start\n\t prev_time_from_start = e.time_from_start\n\t}\n end",
"def fewest_edges(start, finish)\n queue = [start]\n path, dequeue = [], []\n visited, distance, previous = {}, {}, {}\n infinity = (2**(0.size * 8 - 2) - 1) # max Fixnum integer value\n adj_lists.each do |v|\n visited[v.name] = false\n distance[v.name] = infinity\n previous[v.name] = nil\n end\n distance[start] = 0\n cyclic = start == finish # if start/end with same vertex\n visited[start] = true if !cyclic\n loops = 0\n\n while !queue.empty?\n loops += 1\n current = queue.shift # queue is FIFO\n dequeue << current # array of dequeued vertices\n puts \"\\ncurrent = #{current}, queue = #{queue}\"\n\n if current == finish\n break if !cyclic\n break if loops > 1 # if cyclic\n end\n\n adj_vertices(current, adj_lists).each do |adj_vertex|\n if !visited[adj_vertex]\n visited[adj_vertex] = true\n queue << adj_vertex\n distance[adj_vertex] = distance[current] + 1\n previous[adj_vertex] = current\n puts \"adjacent vertex = #{adj_vertex}, queue = #{queue}\"\n # print \"visited = #{visited}\\n\"\n # print \"distance = #{distance}\\n\"\n end\n end\n end\n print_graph\n print \"Dequeued vertices: #{dequeue}\\n\"\n path = [finish]\n vname = finish\n while previous[vname]\n path << previous[vname]\n vname = previous[vname]\n previous[start] = nil if cyclic\n end\n path = path.reverse\n puts \"\\nShortest distance from #{start} to #{finish}: #{distance[finish]} edges.\"\n print \"Path: #{path}\\n\\n\"\n\n distance[finish]\n end",
"def find_failed_temporal_constraint(time)\n each_backward_temporal_constraint do |parent|\n next if block_given? && !yield(parent)\n\n disjoint_set = parent[self, TemporalConstraints]\n next if disjoint_set.intervals.empty?\n\n if disjoint_set.boundaries[0] < 0\n # It might be fullfilled in the future\n next\n end\n\n max_diff = disjoint_set.boundaries[1]\n parent.history.each do |parent_event|\n diff = time - parent_event.time\n if diff > max_diff || !disjoint_set.include?(diff)\n return parent, disjoint_set\n end\n\n disjoint_set.include?(diff)\n end\n end\n nil\n end",
"def get_redundant_resistors(nw)\n#\n# Get a unique list of path names.\n# Get the list of paths in the shortest route.\n# Get the difference - this is the redundant set of paths (bi-directional).\n# Remove the duplicates to get the required result (see below)\n#\n all_paths = (nw.path_list.collect {|p| [p.from, p.to]})\n min_paths = nw.min_cost_routes.first.path_list.collect {|p| [p.from, p.to]}\n #\n # The difference (all_paths - min_paths) is the true list of redundant paths\n # taking into account that the network is implemented as bidirectional, so\n # that each path exists twice, once in each direction, from one node to the\n # other.\n # The reverse paths are therefore removed to arrive at the required output\n # list of redundant resistors.\n #\n redundant_resistors = (all_paths.collect {|p| p.sort.join('_')}).uniq - (min_paths.collect {|p| p.join('_')})\n redundant_resistors.collect {|r| nw.path(r).to_a}\nend",
"def plan_trip (first_s, last_s)\n stations = []\n beginning = $lineN.index(first_s.to_s)\n ending = $lineN.index(last_s.to_s)\n this_many = beginning + ending\n stations = $lineN[beginning, this_many]\n return stations\nend",
"def lesstrips(start, finish, max_distance)\n total_paths, distance = 0, 0\n path, paths = [], []\n visited = [start]\n cycles = all_cycles # all cycles in graph\n puts \"MAX DISTANCE = #{max_distance}\\n\"\n total_paths += lesstrips_dfs(start, finish, max_distance, distance, visited, path, paths, cycles)\n puts \"\\n==> Total paths from #{start} to #{finish}, with distance < #{max_distance}: #{total_paths}\\n\"\n total_paths\n end",
"def print_shortest_flight(graph_instance)\n min_distance = 100000\n city1 =''\n city2 =''\n graph_instance.node_hash.each_key { |key|\n linked = graph_instance.node_hash[key].linked_cities\n linked.each{ |tuple|\n if(tuple.distance < min_distance)\n min_distance = tuple.distance\n city1 = key\n city2 = tuple.city\n end\n }\n }\n puts \"Shortest flight is #{min_distance} between #{city1} and #{city2}\"\nend",
"def unused_paths(start_node, end_node, graph)\n graph - shortest_path(start_node, end_node, graph)\n end",
"def find_path(start_node, end_node, grid)\n start_node = sanitize(start_node)\n end_node = sanitize(end_node)\n if grid.nil?\n [start_node]\n else\n _max_x = grid.max_x\n _max_y = grid.max_y\n\n @current_grid = grid.inner_grid.clone\n\n raise 'max_x & max_y required' unless _max_x && _max_y\n\n _start_node = start_node.clone\n _end_node = end_node.clone\n\n heuristic = @heuristic.new(_end_node, @weight)\n\n _start_node[:f] = 0 # sum of g and h\n _start_node[:g] = 0 # steps to start node\n _start_node[:h] = nil # steps to end node\n _start_node[:opened] = true\n\n # use heap or tree for better perf\n open = []\n open.push _start_node\n\n while !open.empty? do\n _current_node = open.pop\n\n _current_node[:closed] = true\n @current_grid[node_to_a(_current_node)] = _current_node\n\n if node_to_a(_current_node) == node_to_a(_end_node)\n return final_path(_current_node)\n end\n\n new_g = _current_node[:g] + 1\n\n x = _current_node[:x]\n y = _current_node[:y]\n\n neighbors = []\n\n neighbors << [x-1, y] if x > 0\n neighbors << [x, y-1] if y > 0\n neighbors << [x+1, y] if x < _max_x-1\n neighbors << [x, y+1] if y < _max_y-1\n\n _neighbors = neighbors.map do |position|\n node = @current_grid[position]\n if node.nil? || node[:walkable]\n node ||= {}\n @current_grid[position] = node.merge({\n x: position.first,\n y: position[1],\n closed: false,\n opened: false\n })\n end\n end.compact\n\n _neighbors.each do |neighbor|\n if (!neighbor[:opened] || new_g < neighbor[:g])\n neighbor[:g] = new_g\n neighbor[:h] ||= heuristic.h(neighbor)\n neighbor[:f] = neighbor[:g] + neighbor[:h]\n neighbor[:parent] = node_to_a(_current_node)\n\n if (!neighbor[:opened])\n open.push neighbor\n neighbor[:opened] = true\n else\n # ???\n puts \"got here some how!!!\"\n end\n end\n end\n\n open.sort_by! {|i| [-i[:f], -i[:h]]}\n # grid_p\n end\n end\n end",
"def longest_bridges(input)\n components = Set.new(parse(input))\n starters = components.select { |c| c[0].zero? }\n longest = []\n max = 0\n starters.each do |starter|\n bridge_each(components, starter) do |bridge|\n longest = [] if bridge.length > max\n longest << bridge if bridge.length >= max\n max = bridge.length if bridge.length > max\n end\n end\n longest\nend",
"def merged_meetings_2(meeting_time_ranges)\n # merged_meetings where we cannot assume how many time blocks\n meeting_time_ranges = meeting_time_ranges.sort\n\n merged_meeting_times = []\n\n last_start_time = nil\n last_end_time = nil\n meeting_time_ranges.each do |meeting_time_range|\n start_time = meeting_time_range[0]\n end_time = meeting_time_range[1]\n\n if last_start_time.nil? # no values have been stored yet\n last_start_time = start_time\n last_end_time = end_time\n next\n end\n\n if start_time <= last_end_time # current start_time is before the last end_time\n if start_time < last_start_time\n # current start_time earlier than last_start_time - assign as last_start_time\n last_start_time = start_time\n end\n\n if end_time > last_end_time\n # current end_time later than last_end_time - assign it end_time as last_end_time\n last_end_time = end_time\n end\n next\n end\n\n if start_time > last_end_time\n # we have reached the start of a new range - store the last range\n merged_meeting_times << [last_start_time, last_end_time]\n\n # reset the last_end_time and last_start_time to the current values\n last_start_time = start_time\n last_end_time = end_time\n next\n end\n end\n\n # be sure to append the remaining last meeting time range\n merged_meeting_times << [last_start_time, last_end_time]\n\n merged_meeting_times\nend",
"def shortest_path_between_nodes(initial, destination)\n initial.distance = 0\n\n current = initial\n loop do\n # at the destination node, stop calculating\n break if current == destination\n\n unvisited.delete(current)\n\n calculate_neighbor_shortest_distances(current)\n\n return nil if no_reachable_nodes\n\n current = unvisited.min_by(&:distance)\n end\n\n destination.path\n end",
"def in_house_calendar(times)\n sorted = times.sort { |x, y| x[0] <=> y[0] }\n res = [sorted[0]]\n\n temp = nil\n sorted[1..-1].each do |time|\n if time[0] < res[-1][1] && time[0] > res[-1][0]\n last = time[1] > res[-1][1] ? time[1] : res[-1][1]\n temp = ([res[-1][0], last])\n res.pop\n res.push(temp)\n elsif res[-1][1] == time[0]\n res[-1][1] = time[1]\n else\n res.push(time)\n end\n end\n res\nend",
"def calculate\n roundtrips = []\n\n if !@exit_nodes.empty?\n closest_to_all = closest_nodes_to_all(@graph.vertices, @exit_nodes, 666)\n roundtrips << find_roundtrip(Array.new(@exit_nodes))\n roundtrips << find_roundtrip(Array.new(@exit_nodes), true)\n roundtrips << find_roundtrip(Array.new(@exit_nodes) + closest_to_all)\n roundtrips << find_roundtrip(Array.new(@exit_nodes) + closest_to_all, true)\n else\n # No exit nodes - component is probably a loop. Need to consider all nodes and try to find two furthest ones.\n roundtrips << find_roundtrip(@graph.to_undirected.furthest_pair_of_nodes(@graph.vertices))\n end\n\n @@log.debug \" roundtrips = #{roundtrips}\"\n @roundtrip = select_best_roundtrip(roundtrips)\n @@log.debug \" best_roundtrip = #{@roundtrip}\"\n end",
"def longest_single_flight\n\n max_distance = -1\n flight = \"\"\n @query.get_graph.each_key do |city|\n route_dict = get_outgoing_routes(city)\n route_dict.each do |dest, dist|\n if dist > max_distance\n max_distance = dist\n flight = \"#{get_city_info(city,\"name\")}-#{dest}\"\n end\n end\n end\n\n return flight\n\n end",
"def find_longest_path_length_to_leaf(source)\n longest = 0\n\n find_leaves.each do |a_leaf|\n begin\n temp_result = find_longest_path_length(source,a_leaf)\n rescue\n temp_result = 0\n end\n\n longest = [longest, temp_result].max if temp_result\n end\n\n longest\n end",
"def peaks\n fastest_url = ''\n slowest_url = ''\n slowest_time = 0\n fastest_time = 0\n\n for url in self.keys\n if self[url] > slowest_time\n slowest_time = self[url]\n slowest_url = url\n elsif fastest_time == 0 or self[url] < fastest_time\n fastest_time = self[url]\n fastest_url = url\n end\n end\n\n return fastest_url, fastest_time, slowest_url, slowest_time\n end",
"def neighbours_into_start(node)\n # Find all arcs that include this node in the right place\n passable_nodes = []\n @arcs.get_arcs_by_node_id(node.node_id).each do |arc|\n if arc.end_node_id == node.node_id and arc.end_node_direction\n passable_nodes.push nodes[arc.begin_node_id]\n elsif arc.begin_node_id == node.node_id and !arc.begin_node_direction\n passable_nodes.push nodes[arc.end_node_id]\n end\n end\n return passable_nodes.uniq\n end",
"def smallest_task(tasks)\n tasks.min_by { |task| task.arrival_time }\n end",
"def best_path(start, target)\n queue = []\n path = []\n targetX = target[0]\n targetY = target[1] \n update_possible_moves(start)\n path << [@x, @y]\n until @x == targetX && @y == targetY\n @moves.each do |valid_move|\n queue << valid_move unless out_of_bounds?(valid_move) \n end\n #shift because we want bread-first search\n next_move = queue.shift\n update_possible_moves(next_move)\n path << [@x, @y] \n end\n # Filter out the best path and present it\n best_possible_path = filter_path(path)\n puts \"You made it in #{best_possible_path.length} moves! The path is:\\n#{best_possible_path}\"\n end",
"def longest_prefix(strings)\n # raise NotImplementedError, \"Not implemented yet\"\n\n if strings.first.length == 0\n return strings\n end\n\n prefix = \"\"\n i = 0\n\n min = strings.min_by{|s| s.length}\n while i < min.length \n strings.each do |string|\n if min[i] != string[i] \n return prefix\n end\n end\n prefix += min[i]\n i +=1\n end \n return prefix\n end",
"def longest_prefix(strings)\n return \"\" if strings.empty? \n index = 0\n min = strings.min_by{|s| s.length} # find the shortest string\n longest_prefix = \"\"\n while index < min.length # keep running based on the length of the sortest the string \n strings.each do |string|\n if min[index] != string[index] # if the it's not equal, return the \"\"\n return longest_prefix\n end\n end\n longest_prefix += min[index]\n index +=1\n end \n return longest_prefix\nend",
"def shortest_path(start_coord, destination_coord)\n queue = Queue.new\n queue << [start_coord]\n seen = Set.new([start_coord])\n while queue\n begin\n path = queue.pop(non_block = true)\n rescue ThreadError\n return nil\n end\n x, y = path[-1]\n if [x, y] == destination_coord\n return path\n end\n for x2, y2 in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]\n if (0 <= x2 && x2 < @map[0].length) && (0 <= y2 && y2 < @map.length) && (@map[y2][x2] != @WALL && @map[y2][x2] != @PERMANENT_WALL) && !seen.include?([x2, y2])\n queue << (path + [[x2, y2]])\n seen.add([x2, y2])\n end\n end\n end\n end",
"def watch_frequency\n starts, ends = start_times, end_times\n start_index, end_index = 0, 0\n frequencies = []\n active_intervals = 0\n return [] if end_times.empty?\n (0..end_times.last).each do |video_time|\n start_advance = elements_till(starts, start_index) { |time| time <= video_time }\n end_advance = elements_till(ends, end_index) { |time| time < video_time }\n\n active_intervals += start_advance - end_advance\n start_index += start_advance\n end_index += end_advance\n\n frequencies << active_intervals\n end\n frequencies\n end",
"def build_prev_hash(start, avoid_sectors = nil)\n avoid_sectors ||= []\n prev={start=>[nil, 0]} # hash to be returned\n \n # positions which we have seen, but we are not yet sure about\n # the shortest path to them (the value is length of the path,\n # for delete_min_value):\n \n active={start=>0}\n until active.empty?\n # get the position with the shortest path from the\n # active list\n cur=active.delete_min_value\n newlength=prev[cur][1]+1 # path to cur length + 1\n \n # for all reachable neighbors of cur, check if we found\n # a shorter path to them\n cur.links.each { |n|\n # skip sectors we're avoiding\n next if avoid_sectors.include?(n)\n \n if old=prev[n] # was n already visited\n # if we found a longer path, ignore it\n next if newlength>=old[1]\n end\n \n # (re)add new position to active list\n active[n]=newlength\n \n # set new prev and length\n prev[n]=[cur, newlength]\n }\n end\n \n prev\n end",
"def plan_trip (first_l, first_s, last_l, last_s)\n# Get the program to work for a single line:\n# Different way to do global use $\n stations = [ ]\n start = $train_lines[first_l.to_s].index(first_s.to_s)\n finish = $train_lines[last_l.to_s].index(last_s.to_s)\n\n# 2.7.2 :012 > $train_lines.values\n# => [[\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"], [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]]\n# 2.7.2 :013 > $train_lines.keys\n# => [\"lineN\", \"lineL\", \"line6\"]\n\n if start < finish\n stations = $lineN[start..finish]\n elsif\n stations = $lineN[finish..start].reverse\n end\n\n return stations\n\nend",
"def find_shortest_path(exclude_path_with_tile = nil)\n node = find_end_tile(exclude_path_with_tile)\n return [@start_tile, @end_tile] if node.nil?\n expand_path(node)\n end",
"def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end",
"def restructure_path(visited_nodes, target_nodes) \n candidate_nodes = target_nodes.map do |target_node|\n following_node = visited_nodes[visited_nodes.index(target_node) + 1]\n \n unvisited_neighbours_of(following_node, visited_nodes).map { |neighbour|\n [ [target_node, neighbour], unvisited_neighbours_of(neighbour, visited_nodes).length ]\n }\n end.flatten(1)\n \n if candidate_nodes.length > 0 \n maximal_unvisited_count = candidate_nodes.map(&:last).max\n \n pivot_node, additional_node = candidate_nodes.rassoc(maximal_unvisited_count).first\n pivot_index = visited_nodes.index(pivot_node)\n \n visited_nodes = visited_nodes[0..pivot_index] + visited_nodes[(pivot_index + 1)..-1].reverse\n visited_nodes << additional_node\n end\n \n visited_nodes = grow_basic_path(visited_nodes)\n end",
"def min_meeting_rooms(intervals)\n s, e = [], []\n intervals.each do |i|\n s << i.start\n e << i.end\n end\n s.sort!\n e.sort!\n i = j = 0\n x = ans = 0\n while i < intervals.size\n if s[i] < e[j]\n x += 1\n ans = [ans, x].max\n i += 1\n else\n x -= 1\n j += 1\n end\n end\n ans\nend",
"def get_formatted_start_and_rest\n Timing.to_formatted_start_and_rest(start_and_rest)\n end",
"def min_refuel array_of_gas_station, total_distance, l_km\r\n\tt1 = Time.now\r\n\ttotal_refuel = 0\r\n\trefueld_at = []\r\n\tcan_travel = l_km\r\n\tflag = \"yes\"\r\n\tarray_of_gas_station.each_with_index do |arr,index|\r\n\t\tif arr > can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << (index-1)\r\n\t\telsif arr == can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << index\r\n\t\tend\r\n\tend\r\n\trefueld_at.each_with_index do |arr, i|\r\n\t\tif refueld_at[i] == refueld_at[i+1] || refueld_at[i] < 0\r\n\t\t\tflag = \"no\"\r\n\t\tend\r\n\tend\r\n\tif flag.eql? \"yes\"\r\n\t\tt2 = Time.now\r\n\t\tp \"total refuel : #{total_refuel}\"\r\n\t\tp \"refueled at : #{refueld_at}\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\telse\r\n\t\tt2 = Time.now\r\n\t\tp \"can't travel\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\tend\r\nend",
"def starting_and_ending_timestamp(date, last_date)\n timestamps = schedule_for_date(date, @schedule)\n if timestamps.length > 3 && last_date != date\n start_timestamp = timestamps[2]\n end_timestamp = timestamps[3]\n else\n start_timestamp = timestamps[0]\n end_timestamp = timestamps[1]\n end\n return start_timestamp.strftime(\"%m/%d/%Y %I:%M %p\"), end_timestamp.strftime(\"%I:%M %p\")\n end",
"def find_best_clusters(lat,long, catch_time, direction, week_day)\n temporal_delta = 600\n #max = Float::INFINITY\n max = BigDecimal::INFINITY\n near_stop = nil\n\n #Analisis geografico\n stops.where(:direction => direction).each_with_index do |stop, index|\n candidate = Bus.geographic_distance([stop.latitude, stop.longitude], [lat,long])\n if candidate < max\n near_stop = stop\n max = candidate\n end\n end\n\n #Analisis temporal, para el paradero seleccionado\n max_time = Float::INFINITY\n best_guess = nil\n near_stop.centroids.where(:direction => direction).each do |centroid|\n candidate = Bus.temporal_distance(centroid.catch_time, catch_time.to_i)\n if candidate < max_time and centroid.catch_time > catch_time.to_i\n best_guess = centroid\n max_time = candidate \n end\n end\n #se mapea la resta a todas las filas\n #time_data = time_data.map {|z| z - catch_time.to_i }\n\n #Donde la diferencia de tiempo sea mayor que 0 (no haya pasado aun) y sea mas grande de un minuto\n #time_data = time_data.sort.find{|x| x > 0 && x > 60 }\n\n #Si no encuentras recomendaciones, te pasaste del limite y te recomiendo la que pasa mas temprano\n if best_guess.nil? or best_guess.blank?\n best_guess = Sapeada.where(:stop_id => near_stop.id, :direction => direction, :bus_id => 1, :week_day => week_day).order(\"catch_time ASC\").first\n [near_stop.latitude, near_stop.longitude, best_guess.catch_time]\n else\n [near_stop.latitude, near_stop.longitude, best_guess.catch_time - catch_time.to_i]\n end\n end",
"def next_time_slots\n\t\ttime_slot_array = self.timeslots\n\t\ttime_slot_array.drop_while do |x|\n\t\t\tx[0].split(\"-\")[0].to_time < Time.now\n\t\tend\n\tend",
"def valid_times_sorted()\n self.valid_times.sort{|a,b|a.from_time <=> b.from_time}\n end",
"def get_stops (line, first_stop, last_stop)\n # puts \"line #{ line } stop #{ first_stop } -> stop #{ last_stop }\"\n first_index = lines[line.to_sym].index(first_stop)\n last_index = lines[line.to_sym].index(last_stop)\n if first_index <= last_index\n trip = lines[line.to_sym][first_index..last_index]\n else\n trip = lines[line.to_sym][last_index..first_index].reverse\n end\n trip.shift # remove first stop\n return trip\nend"
] |
[
"0.6018098",
"0.5829604",
"0.5681305",
"0.56467295",
"0.54656386",
"0.5455208",
"0.5406139",
"0.5398582",
"0.53266966",
"0.53228617",
"0.5316201",
"0.52985454",
"0.5273384",
"0.5239892",
"0.5237051",
"0.52320856",
"0.52318907",
"0.5222776",
"0.52156544",
"0.5174332",
"0.5166279",
"0.5150512",
"0.51502126",
"0.51227593",
"0.512268",
"0.50925964",
"0.50925964",
"0.50876796",
"0.50813955",
"0.50661033",
"0.5052507",
"0.5048131",
"0.5032272",
"0.50229317",
"0.50168693",
"0.5010144",
"0.50100416",
"0.50041884",
"0.50023586",
"0.499564",
"0.49940193",
"0.49861005",
"0.4980255",
"0.4978248",
"0.4977098",
"0.49753737",
"0.49729806",
"0.49391705",
"0.49385577",
"0.49372607",
"0.49340138",
"0.49274597",
"0.49135712",
"0.4893122",
"0.4890317",
"0.48829758",
"0.4878347",
"0.4876718",
"0.48721302",
"0.48714092",
"0.48694253",
"0.4868675",
"0.48647806",
"0.48600617",
"0.48576868",
"0.48402622",
"0.4839909",
"0.4828847",
"0.4828603",
"0.4822131",
"0.482066",
"0.48136607",
"0.48084322",
"0.48055905",
"0.48054227",
"0.4804354",
"0.4796652",
"0.47950512",
"0.4793561",
"0.4789399",
"0.47856832",
"0.47846764",
"0.47825512",
"0.47770658",
"0.47750878",
"0.47723365",
"0.47663558",
"0.47627556",
"0.47605434",
"0.47599238",
"0.47572595",
"0.47557554",
"0.47545925",
"0.47512895",
"0.4751276",
"0.47506818",
"0.4747565",
"0.47470492",
"0.4745372",
"0.4744675"
] |
0.5384313
|
8
|
returns an Array of Arrays of Parts, Parts represent labels for self.ontology_class
|
def acts_of_synonymy_for_ref
syn = self.proj.sensus.by_ontology_class(self.ontology_class_id).by_ref(self.ref_id).ordered_by_label.collect{|s| s.label}.uniq
syns = []
syn.each_with_index do |s1,i|
syn[(i+1)..(syn.size)].each do |s2|
syns << [s1, s2]
end
end
syns
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parts\n @parts\n end",
"def parts(user_id = nil)\n part_elements = []\n if is_a_node?\n if user_id\n part_elements = Element.part_elements_for_element_id_by_user_id(self.id, user_id)\n else\n part_elements = Element.part_elements_for_element_id(self.id)\n end\n end\n return part_elements\n end",
"def parts\n product.parts\n end",
"def parts\n product.parts\n end",
"def what_has?(noun)\n components = []\n all_classes(noun).each do |class_iterator|\n Array(@components[class_iterator]).each do |component|\n components.push(component)\n end\n end\n return components\n end",
"def random_parts_1\n parts = []\n (1..8).each do |id|\n parts.push(Part.new(part_type_id: id, defect: ([false]*19 << true).sample))\n end\n parts\n end",
"def components\n arr = Arrays.new(@nb) { [] }\n (0...@component.size).each { |v| arr[@component[v]] << v }\n end",
"def components\n arr = Arrays.new(@nb) { [] }\n (0...@component.size).each { |v| arr[@component[v]] << v }\n end",
"def entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( control_points )\r\n result\r\n end",
"def components\n result = []\n\n @children.each do |_key, child_group|\n child_group.each do |child|\n result << child if child.is_a?(Component)\n end\n end\n\n result\n end",
"def to_a\n return @parts.to_a.dup\n end",
"def parts\n @body.xpath('./a:part', a: NS)\n end",
"def pariculars\n\t\t[\"Concentration\", \"Concept\", \"Participation\", \"Completion of Task\"]\n\tend",
"def random_parts_2\n parts = []\n parts.push(Part.new(part_type_id: 9, defect: ([false]*9 << true).sample))\n parts\n end",
"def proptextlistarray(name) #:nodoc:\n @properties.select{ |f| f.name? name }.map{ |p| Vpim.decode_text_list(p.value_raw) }.flatten\n end",
"def index\n @parts = Part.preload(:job)\n end",
"def all_components()\n return self.components.map do |comp|\n case comp\n when Eddy::Summary::Loop then [comp, comp.all_components()]\n when Eddy::Summary::Segment then comp\n else raise Eddy::Errors::Error\n end\n end.flatten\n end",
"def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end",
"def parts_query\n ActiveRDF::Query.new(TaliaCore::ActiveSource).select(:part).where(:part, N::DCT.isPartOf, self)\n end",
"def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end",
"def courses\n bins.map(&:courses).flatten\n end",
"def get_parts(poly)\n\tif poly.kind_of? Array\n mypoly = poly.compact\n\t [mypoly, mypoly[-1]]\n else\n [poly, poly]\n end\n end",
"def all_components()\n comps = self.components.map do |c|\n if c.is_a?(Eddy::Models::Loop::Base)\n c.all_contents()\n elsif c.is_a?(Eddy::Models::Segment)\n c\n else\n raise Eddy::Errors::RenderError\n end\n end\n return comps.flatten\n end",
"def pieces\n self.cells.values.map {|c| c.piece }.compact.uniq\n end",
"def components\n return @components\n end",
"def pieces\n list = []\n n = @data['info']['pieces'].bytesize / PIECE_SIZE\n n.times do |i|\n list << @data['info']['pieces'][(i * PIECE_SIZE)..(i * PIECE_SIZE + PIECE_SIZE - 1)]\n end\n list\n end",
"def event_parties\n\n \tevent_part = object.events.map do |temp|\n \t\ttemp.party_template\n \tend\n \tevent_part\n end",
"def questions\n extracted_questions = []\n\n unless self.qp_questions.nil?\n self.qp_questions.each do |question| \n extracted_questions.push(Question.new(question))\n end \n end\n\n return extracted_questions\t\t\t\n\t\tend",
"def load_components_from_class(component_class)\n a = []\n entities_set_for(component_class.name).each do |entity_id|\n components_set_for(entity_id).each do |component|\n a << component if component_class == component.class\n end\n end\n a\n end",
"def index\n @parts = @chaper.parts\n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def index\n @part_attributes = PartAttribute.all\n end",
"def partitions\n topics.values.flat_map(&:partitions)\n end",
"def interested_parties\n \t@interested_parties = []\n\t @interested_parties << self.watchings.all\n\t @interested_parties << self.path.interested_parties\n\t @interested_parties.flatten.compact\n\tend",
"def wells\n plates.collect(&:wells).flatten\n end",
"def parts\n unless defined?(@parts)\n @parts = values_array\n @parts.pop while @parts.size > 1 && @parts.last == 0\n end\n @parts\n end",
"def array\n @models ||= load\n end",
"def to_a\n [\n [ :class, self.class.to_s ],\n [ :facet, facet.to_s ],\n [ :participant_1, participant_1 ],\n [ :role_1, role_1.to_s ],\n [ :participant_2, participant_2 ],\n [ :role_2, role_2.to_s ],\n # [ :_options, _options ],\n ]\n end",
"def return_difficulties_array(doc)\n difficulties = doc.css(\".search-content .teaser-item__info-item--skill-level\")\n recipe_difficulties = []\n difficulties.each do |element|\n recipe_difficulties << element.text.strip\n end\n return recipe_difficulties\n end",
"def splits\n []\n end",
"def children\n Array.new\n end",
"def GetPartitionList\n deep_copy(@partition_info)\n end",
"def array_of_driver\r\n\t\tnumber = @array_translate.length-1\r\n\t\tarray_driver = []\r\n\t\t(2..number).each do |index|\r\n\t\t\tdriver_obj = Driver.new(convert_coordinate(index))\r\n\t\t\tdriver_obj.name = @array_translate[index][0]\r\n\t\t\tarray_driver << driver_obj\r\n\t\tend\r\n\t\tarray_driver\r\n\tend",
"def components\n\t\t\t@components ||= []\n\t\tend",
"def lifts_array\n array2 = []\n self.lifts.each do |lift|\n array2 << lift.chart_info_for_lift\n end\n array2\n end",
"def to_java\n\t @part\n\tend",
"def works_evidenced_composers\n all_composers = []\n works.map{|w| all_composers << w.composers}\n all_composers.flatten!\nend",
"def structures\n [self.tlp_marking_structure,self.simple_marking_structure,self.isa_marking_structure,self.isa_assertion_structure,self.ais_consent_marking_structure].compact\n end",
"def components\n\t\treturn self.world.components_for( self )\n\tend",
"def parts\n @descriptive_detail.parts\n end",
"def parts\n return unless isbn13\n\n group = prefix = nil\n\n RANGES.each_pair do |g, prefixes|\n next unless isbn13.match(\"^#{g}\")\n group = g\n\n pre_loc = group.length\n prefixes.each do |p|\n number = isbn13.slice(pre_loc, p[:length]).to_i\n next unless p[:range].include?(number)\n\n prefix = p.merge(:number => number)\n break\n end\n\n break\n end\n\n # In the unlikely event we can't categorize it...\n return unless group && prefix\n\n prefix = sprintf(\"%0#{prefix[:length]}d\", prefix[:number])\n [group[0..2], group[3..-1], prefix, isbn13[(group.length + prefix.length)..-2], isbn13[-1..-1]]\n end",
"def make_array\n [@name, @author, @deviation_url, @views, @favs, @comments]\n end",
"def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end",
"def articles\n self.pieces.select { |p| !p.article.nil? }.map(&:article)\n end",
"def make_entity_array x\n retval = Array.new\n case x.class.to_s\n when 'Entity'\n retval.push x\n when 'EntityStruct'\n retval.push x.entity\n when 'Array'\n x.each{|elem|\n if elem.class.to_s == 'Entity'\n retval.push elem\n elsif elem.class.to_s == 'EntityStruct'\n retval.push elem.entity\n else\n puts \"ERROR elem.class invalid, is #{elem.class}\"\n end # if\n } # x.each\n else\n puts \"ERROR: input class invalid, is #{x.class}\"\n exit\n end # case\n return retval\n end",
"def get_part\n @part\n end",
"def slices\n slice_names.map do |name|\n Object.full_const_get(name) rescue nil\n end.compact\n end",
"def elements\n\n # We'll build up an array of co-ordinates\n pieces = []\n\n # And work through the current bricks\n @bricks[@rotation].each do |brick|\n\n # Apply the current grid position to this bricks\n pieces.append( [ @grid_row + brick[0], @grid_col + brick[1] ] )\n\n end\n\n return pieces\n\n end",
"def part_categories\n\t\tall_models = []\n\t\tpart_categories = []\n\t\tfolder = File.join(Rails.root, \"app\", \"models\")\n\t\tDir[File.join(folder,\"*\")].each do |filename|\n\t\t all_models << File.basename(filename).sub(/.rb$/, \"\").split(\"_\").map { |name| name.capitalize }.join\n\t\t exception_list = ( all_models.select { |m| m.end_with? \"Import\"} << [\"Concerns\",\"User\"] ).flatten\n\t\t part_categories = (all_models - exception_list).map {|cat| Kernel.const_get(cat)}\n\t\tend\n\t\tpart_categories\n\tend",
"def arrays_of_arrays(names, specialties)\n result = []\n\n # initialize iterator\n i = 0\n\n #loops through names\n specialties.each do |specialty|\n\n # shovel sub_array into result\n result.push([names[i]] + [specialty])\n\n # increment iterator\n i += 1\n end\n return result\n\nend",
"def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end",
"def parts_from_sample(collection, sample)\n part_location = collection.find(sample)\n parts = []\n part_location.each do |coordinates|\n parts.push(collection.part(coordinates[0], coordinates[1]))\n end\n parts\n end",
"def get_children(pi)\n response = Net::HTTP.get_response URI.parse(URI.escape(SERVICE_DCMDB + \"work/\" + pi + \"/children\"))\n children = Array.new\n case response\n when Net::HTTPSuccess\n doc = Document.new(response.body)\n XPath.each(doc, \"//workpid\") { |el|\n children.push(el.text)\n } \n end\n\n return children\n\n end",
"def return_descriptions_array(doc)\n descriptions = doc.css(\".search-content .field-item.even\")\n recipe_descriptions = []\n descriptions.each do |element|\n recipe_descriptions << element.text\n end\n return recipe_descriptions\n end",
"def to_array(dataset)\n dataset.map do |row|\n entity_class.new row\n end\n end",
"def child_labels\n self.meta_definition.children.map { |c| c.label }\n end",
"def class_contents\n return Board.all.map{|board| board.subjects}.uniq.flatten if self.id==1\n case self.type\n when 'Teacher'\n #by default teacher classroom content belongs to board,if it is board we are not showing any content because teacher classroom should be a class-teacher or subject teacher i.e belongs to content-year or subject\n Teacher.find(self.id).teacher_class_rooms.map{|class_room| (class_room.content.type.eql?('Board') ? [] : class_room.content.type.eql?('ContentYear') ? class_room.content.subjects : class_room.content)}.uniq.flatten rescue []\n when 'CenterAdmin'\n self.center.boards.map{|board| board.subjects}.uniq.flatten\n when 'InstituteAdmin'\n self.institution.boards.map{|board| board.subjects}.uniq.flatten\n else\n []\n end\n end",
"def index\n @subparts = Subpart.all\n end",
"def partitionize(array)\r\n p = Array.new\r\n\r\n array.each_with_index do |x, i|\r\n if i == 0 || x.exercise_id != array[i-1].exercise_id\r\n p << Array.new\r\n end\r\n p.last << x\r\n end\r\n p\r\n end",
"def features\n @inventory.features(self).to_a\n end",
"def manipulable_entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( vertices )\r\n result.concat( handles )\r\n result.concat( manual_interior_points )\r\n result\r\n end",
"def elements\n return @elements\n end",
"def to_array\n [ self.company.name,\n self.invoice_num,\n self.invoice_date,\n self.operation_date,\n self.reporter,\n self.notes,\n self.status,\n self.categories.pluck(:name).join(\";\")\n ]\n end",
"def parcelas_mes(data)\n\t\t@parts = []\n\t\tself.parts.each do |p|\n\t\t\tif((p.data.month == data.month) && (p.data.year == data.year))\n\t\t\t\t@parts << p\n\t\t\tend\n\t\tend\n\t\t@parts\n\tend",
"def index\n @job_parts = JobPart.all\n end",
"def get_partition(rel, indexes = nil)\n\n\tattrs = rel.attributes\n\tinstances = rel.instances\n\tvalues = get_possible_values(rel, indexes)\n\tpartition = Array.new\n\n\t# If no indexes were chosen, assume to partition on every attribute\n\tif indexes.nil?\n\t\tindexes = (0...attrs.length)\n\tend\n\n\t# iterate over all possible values and get\n\t# the instances that satisfy those values\n\tvalues.each { |value|\n\t\tpartition << instances.select{ |x| x.values_at(*indexes) == value }\n\t}\n\n\treturn partition\nend",
"def parallel_drug_courses\n ConceptName.where(name: ['CPT', 'INH', 'Rifapentine', 'Isoniazid/Rifapentine'])\n end",
"def array\n self.allObjects\n end",
"def get_elements_array\n element_names\n end",
"def proptextarray(name) #:nodoc:\n @properties.select{ |f| f.name? name }.map{ |p| p.to_text }\n end",
"def all\n return @recipearray\n end",
"def collections\n Collection.find(:all, :find_through => [N::DCT.hasPart, self])\n end",
"def partition_by_viols\n partition = []\n @competition.each do |cand|\n match = partition.find_index { |part| part[0].ident_viols? cand }\n add_to_partition(cand, match, partition)\n end\n partition\n end",
"def parts(type)\n xml.xpath(\"//xmlns:Override[@ContentType='#{type}']\").map{ |n| n['PartName'] }\n end",
"def index\n @order_parts = OrderPart.all\n end",
"def get_children_array\n\t\t\tarr = []\n\t\t\tself.children.get_active.each do |child_1|\n\t\t\t\tarr << {menu: child_1, class: 'parent'}\n\t\t\t\tchild_1.children.get_active.each do |child_2|\n\t\t\t\t\tarr << {menu: child_2, class: 'child'}\n\t\t\t\tend\n\t\t\tend\n\t\t\tarr\n\t\tend",
"def children\n elements = []\n\n %x{\n var children = #@native.children;\n for(var i = 0; i < children.length; i++) {\n elements[i] = #{Element.new(`children[i]`)};\n }\n }\n\n elements\n end",
"def to_a\n array.map do |item|\n if item.is_a?(SpecViewArray)\n item.to_a\n else\n item\n end\n end\n end",
"def pids\n return [] unless @pid\n return @component_objects.clone if manifest.content_model == PAGE_CONTENT_MODEL || manifest.content_model == NEWSPAPER_PAGE_CONTENT_MODEL\n return ([ @pid ] + @component_objects.clone)\n end",
"def associations_array\n resource.reflect_on_all_associations.map { |association| association.name.to_s }\n end",
"def residents\n u = []\n @buildings.each { |building| u << building.workers }\n (-1..1).each do |xx|\n (-1..1).each do |yy|\n next if xx == 0 and yy == 0\n u << @game[@x+xx,@y+yy].worker\n end\n end\n return u.flatten.compact\n end",
"def parts\n @doc.content_types.parts Slide::CONTENT_TYPE\n end",
"def components\n\t\t\t\treturn @components.values unless (@components.nil?)\n\t\t\t\treturn nil\n\t\t\tend",
"def get_model_table(part)\n rows = @parser.find(part).find_children('tr').list_results\n table = []\n rows.each do |row|\n table.push(\n get_model_row(@parser.find(row).find_children('td,th').list_results)\n )\n end\n get_valid_model_table(table)\n end",
"def partition_types_ext\n ptr1 = MemoryPointer::new( :size_t, 1)\n error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPES_EXT, 0, nil, ptr1)\n error_check(error)\n ptr2 = MemoryPointer::new( ptr1.read_size_t )\n error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPES_EXT, ptr1.read_size_t, ptr2, nil)\n error_check(error)\n arr = ptr2.get_array_of_cl_device_partition_property_ext(0, ptr1.read_size_t/ OpenCL.find_type(:cl_device_partition_property_ext).size)\n arr.reject! { |e| e == 0 }\n return arr.collect { |e| PartitionEXT::new(e.to_i) }\n end",
"def components\n @world.get_components(self)\n end",
"def complile_relationships\n relationships = []\n @classifications.each do |classification|\n relationship = Relationship.new(@query, classification)\n relationships << relationship unless relationship.score.zero?\n end\n relationships.sort\n end",
"def index\n @image_to_parts = ImageToPart.all\n end",
"def features\n\t\tcollection = []\n\t\tclasses.each do |_class|\n\t\t\t_class.features.each do |feature|\n\t\t\t\tcollection << feature\n\t\t\tend\n\t\tend\n\t\trace.features.each do |feature|\n\t\t\tcollection << feature\n\t\tend\n\t\tfeats.each do |feat|\n\t\t\tcollection << feat\n\t\tend\n\t\tcollection\n\tend"
] |
[
"0.6326445",
"0.62433267",
"0.56026816",
"0.56026816",
"0.55608624",
"0.5538963",
"0.55355686",
"0.55355686",
"0.5475658",
"0.54666924",
"0.54503626",
"0.542177",
"0.5332671",
"0.53080904",
"0.53021836",
"0.52837396",
"0.52423835",
"0.5206719",
"0.52003604",
"0.51916754",
"0.5180394",
"0.5176651",
"0.51762146",
"0.51758945",
"0.51505125",
"0.51341563",
"0.5131165",
"0.512868",
"0.5070226",
"0.50586915",
"0.5052337",
"0.5052337",
"0.5052337",
"0.5049638",
"0.50479794",
"0.501269",
"0.5004241",
"0.49896967",
"0.49890673",
"0.49868035",
"0.4985346",
"0.4983597",
"0.4983507",
"0.49814776",
"0.4962146",
"0.49577588",
"0.49409375",
"0.4938787",
"0.49335727",
"0.4923012",
"0.49077004",
"0.48937595",
"0.4891794",
"0.48708203",
"0.48694873",
"0.48564836",
"0.48515606",
"0.4850378",
"0.48440477",
"0.48303258",
"0.4827658",
"0.48220286",
"0.48216784",
"0.4807535",
"0.4799767",
"0.4792303",
"0.4784246",
"0.47752157",
"0.47719273",
"0.4770817",
"0.47693998",
"0.47664267",
"0.47610104",
"0.47605184",
"0.4759238",
"0.4757526",
"0.4755729",
"0.475538",
"0.47549495",
"0.47535002",
"0.47533458",
"0.47524154",
"0.47518867",
"0.47515616",
"0.474722",
"0.4740451",
"0.47377408",
"0.4732454",
"0.47322366",
"0.47304675",
"0.47216195",
"0.4720419",
"0.47200328",
"0.4708577",
"0.47061098",
"0.47053117",
"0.47052467",
"0.47045255",
"0.47024322",
"0.47012046",
"0.46981877"
] |
0.0
|
-1
|
returns an Array of Arrays of OntologyClasses
|
def acts_of_homonymy_for_ref
syn = self.proj.sensus.by_label(self.label_id).by_ref(self.ref_id).ordered_by_label.collect{|s| s.ontology_class}.uniq
syns = []
syn.each_with_index do |s1,i|
syn[(i+1)..(syn.size)].each do |s2|
syns << [s1, s2]
end
end
syns
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def class_list\n array = []\n ObjectSpace.each_object(Class) {|m| array << m }\n array\n end",
"def classes\n\t\tlist = []\n\t\teach_class { |class_constant|\n\t\t\tlist\t<< class_constant\n\t\t}\n\t\treturn list\n\tend",
"def classes\n return [] unless classes = self[\"class\"]\n classes.strip.split(/\\s+/)\n end",
"def all_classes(noun)\n classes = []\n c = noun\n while(c != :not_defined)\n classes.push(c)\n break if c == :noun\n c = what_is?(c)\n end\n return classes\n end",
"def classes\n @classes.values\n end",
"def classes\n @classes.values\n end",
"def ontology_restricted_ontology_classes(type)\n case type\n when :excluded\n return [] if self.ontology_exclusion_keyword.blank? || self.ontology_exclusion_keyword.tags.size == 0\n OntologyClass.tagged_with_keywords(:proj_id => self.id, :keywords => self.ontology_exclusion_keyword.tags.collect{|t| t.tagged_obj.class == Keyword ? t.tagged_obj : nil}.compact)\n when :included\n return [] if self.ontology_inclusion_keyword.blank? || (self.ontology_inclusion_keyword.tags.size == 0)\n OntologyClass.tagged_with_keywords(:proj_id => self.id, :keywords => self.ontology_inclusion_keyword.tags.collect{|t| t.tagged_obj.class == Keyword ? t.tagged_obj : nil}.compact)\n else\n []\n end\n end",
"def classes\n curriculums = self.qualifications.collect{ |q| q.curriculums }.flatten\n\n unless curriculums.empty?\n curriculums.collect{ |c| c.school_class }.flatten.uniq\n else\n return []\n end\n end",
"def gymclasses()\n sql = \"SELECT gymclasses.* FROM gymclasses INNER JOIN bookings\n ON gymclasses.id = bookings.gymclass_id WHERE client_id = $1\"\n values = [@id]\n gymclasses = SqlRunner.run(sql,values)\n result = gymclasses.map{|gymclass| GymClass.new(gymclass)}\n return result\n end",
"def fetch_classes_list\n uri = URI(BASE_URI + \"classes\")\n classes = make_request(uri)\n classes_instances = classes[\"results\"].map do |classes_data|\n Classes.new classes_data[\"name\"]\n end\n end",
"def classes\n @classes\n end",
"def entity_classes\n @entity_classes ||= []\n end",
"def authorizable_classes\n [].tap do |result|\n ObjectSpace.each_object(Class) do |c|\n next unless c.superclass == ApplicationRecord\n result << c if c.ancestors.include?(Record::Authorizable)\n end\n end\n end",
"def classes\n return @classes if @classes\n @classes = @context.classes.sort.find_all{|c| c.document_self}.collect{|c| R2Doc.all_references[c.full_name]}\n end",
"def what_has?(noun)\n components = []\n all_classes(noun).each do |class_iterator|\n Array(@components[class_iterator]).each do |component|\n components.push(component)\n end\n end\n return components\n end",
"def dependency_classes\n res = []\n\n eager_loaded_components.keys.each do |aggr|\n res += component_instance(aggr).dependency_classes\n end\n\n res += self.class.class_ancestors\n\n res << self.class\n res.uniq\n end",
"def classes\n @class_ids.collect { |idx| BClass.store[idx] }\n end",
"def classes()\n return @driver.get_sc_core_query_element_classes(@handle, @index)\n end",
"def classes()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << clazz( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend",
"def generate_objective_c_classes\n @classes = []\n resources_from_schema.collect do |resource_hash|\n Resource.new(resource_hash).tap do |resource|\n # Generate the query classes first\n resource.queries.each do |query|\n # Query objects do not get cached in core data\n to_objective_c_class node:query[\"type\"], cached:false\n end\n # Generate the resource classes next\n klass = to_objective_c_class node:resource.hash[:type], cached:resource.cached?\n # Mark this class as being a REST resource\n klass.resource = resource\n end\n end\n end",
"def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end",
"def triples_for_class_definition\n declare_namespaces\n g = Graph.new\n b = BNode.new(self.name)\n g << Triple.new(b, URIRef.new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), URIRef.new('http://www.w3.org/2002/07/owl#Class'))\n return g\n end",
"def load_components_from_class(component_class)\n a = []\n entities_set_for(component_class.name).each do |entity_id|\n components_set_for(entity_id).each do |component|\n a << component if component_class == component.class\n end\n end\n a\n end",
"def classes\n kwattr_values(\"class\")\n end",
"def object_classes( *additional_classes )\n\t\t# self.log.debug \"Fetching object classes for %s\" % [ self.dn ]\n\t\tschema = self.directory.schema\n\n\t\toc_oids = self[:objectClass] || []\n\t\toc_oids |= additional_classes.collect {|str| str.to_sym }\n\t\toc_oids << 'top' if oc_oids.empty?\n\n\t\toclasses = []\n\t\toc_oids.each do |oid|\n\t\t\toc = schema.object_classes[ oid.to_sym ] or\n\t\t\t\traise Treequel::Error, \"schema doesn't have a %p objectClass\" % [ oid ]\n\t\t\toclasses << oc\n\t\tend\n\n\t\t# self.log.debug \" found %d objectClasses: %p\" % [ oclasses.length, oclasses.map(&:name) ]\n\t\treturn oclasses.uniq\n\tend",
"def all_classes\n @classes_hash.values\n end",
"def classes\n self\n end",
"def associations_class_names\n self.associations.map{|name,association|\n association.class_name\n }\n end",
"def classes; end",
"def get_objects_of_class_by_class_name(class_name)\n var_array = []\n @objects.each do |_k, v|\n var_array.push(v) if v.class.to_s == class_name.to_s\n end\n var_array\n end",
"def list_known_classes\n end",
"def sc_all_classes()\n @all_class_names = @driver.get_sc_object_class_names(abs_path) if @all_class_names.nil?\n return @all_class_names\n end",
"def get_classes(trans)\n classes = []\n trans.each do |t|\n classes.push(t[:program])\n end\n classes.uniq\n end",
"def class_names\n return if @class_names.empty?\n @class_names.uniq.sort\n end",
"def classes\n [self]\n end",
"def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end",
"def top_classes; [RDF::RDFS.Class]; end",
"def subclasses\n @subclasses ||= []\n end",
"def classes(*args)\n [node ? node.classes(*args) : [], @wrapped_classes].flatten\n end",
"def subclasses\n @subclasses ||= []\n end",
"def class_names\n classes.map &:name\n end",
"def class_names\n descendants.map(&:name)\n end",
"def component_classes( hs = hosts )\n hs.\n map( &:components ).\n flatten.\n map( &:class ).\n uniq\n end",
"def model_classes\n ModelClassCollector.new(configuration, mode_map.keys).collect\n end",
"def associations_array\n resource.reflect_on_all_associations.map { |association| association.name.to_s }\n end",
"def defined_classes\n # TODO: check content type before scanning\n content.scan(/\\s*class\\s+([A-Za-z0-9_\\.]*)/).flatten\n end",
"def getContexts(className)\n taggings = ActsAsTaggableOn::Tagging.where([\"taggable_type like ?\", className]).\n distinct(:context)\n \n contexts = Array.new\n\n # for each context get the set of tags (sorted), and add them to the collection for display on the page\n taggings.each do |tagging|\n contexts << tagging.context\n end\n \n return contexts\n end",
"def classes\n @class_list ||= Element::Classes.new(self)\n end",
"def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end",
"def orbserved_classes\n\t\t\t@orbserved_classes ||= Set.new\n\t\tend",
"def analyses\n subklasses.map{|klass|\n [klass.name, klass]\n }.to_h\n end",
"def complile_relationships\n relationships = []\n @classifications.each do |classification|\n relationship = Relationship.new(@query, classification)\n relationships << relationship unless relationship.score.zero?\n end\n relationships.sort\n end",
"def teacher_school_classes( teacher )\n curriculums = teacher.qualifications.collect{ |q| q.curriculums }.flatten\n\n unless curriculums.empty?\n curriculums.collect{ |c| c.school_class }.flatten.uniq\n else\n return []\n end\n end",
"def get_classes\n (attr['class'] || '').downcase.split(' ').sort\n end",
"def creatable_classes\n #FIXME: make these discovered automatically.\n #FIXME: very bad method name\n #[Model,DataFile,Sop,Study,Assay,Investigation]\n [\"Method\",\"Survey\",\"Study\"]\n\n end",
"def classes\n\t\traise \"classes: Not Implemented\"\n\tend",
"def index\n @clasifications = Clasification.all\n end",
"def list_known_classes names = []\n classes = []\n\n stores.each do |store|\n classes << store.module_names\n end\n\n classes = classes.flatten.uniq.sort\n\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n\n classes = classes.grep filter\n end\n\n page do |io|\n if paging? or io.tty? then\n if names.empty? then\n io.puts \"Classes and Modules known to ri:\"\n else\n io.puts \"Classes and Modules starting with #{names.join ', '}:\"\n end\n io.puts\n end\n\n io.puts classes.join(\"\\n\")\n end\n end",
"def models\n [::AdminSet, Hyrax::AdministrativeSet, ::Collection, Hyrax.config.collection_class].uniq.compact\n end",
"def sequence_to_array_objects\n @sequence = Array.new if @sequence.nil?\n\n array = []\n if !@sequence.empty?\n @sequence.each { |element|\n downcaseElement = element.downcase\n if instance_attribute_defined?(downcaseElement)\n object = get(downcaseElement)\n if object.kind_of?(Array)\n array.concat object\n else\n array << object\n end\n end\n }\n else\n if !@objects.nil?\n @objects.each { |o|\n array << o\n }\n end\n end\n return array;\n end",
"def classes(name = nil)\n if name\n classes.find(:name => name)\n else\n @classes.flatten\n end\n end",
"def superclasses(c)\n result = [c]\n while s = c.superclass\n result << s\n c = s\n end\n result\n end",
"def list_categories(class_id='')\n url = \"#{@@request_url}/Class.listClasses?appid=#{@@appid}&id=#{class_id}\"\n data = get_xml(url)\n return [] unless data[\"status\"] == 'ok' \n return data[\"ClassList\"][0][\"Class\"]\n end",
"def features\n\t\tcollection = []\n\t\tclasses.each do |_class|\n\t\t\t_class.features.each do |feature|\n\t\t\t\tcollection << feature\n\t\t\tend\n\t\tend\n\t\trace.features.each do |feature|\n\t\t\tcollection << feature\n\t\tend\n\t\tfeats.each do |feat|\n\t\t\tcollection << feat\n\t\tend\n\t\tcollection\n\tend",
"def class_hierarchy\n @class_hierarchy ||= process_ontology_hierarchy\n end",
"def to_array(dataset)\n dataset.map do |row|\n entity_class.new row\n end\n end",
"def make_entity_array x\n retval = Array.new\n case x.class.to_s\n when 'Entity'\n retval.push x\n when 'EntityStruct'\n retval.push x.entity\n when 'Array'\n x.each{|elem|\n if elem.class.to_s == 'Entity'\n retval.push elem\n elsif elem.class.to_s == 'EntityStruct'\n retval.push elem.entity\n else\n puts \"ERROR elem.class invalid, is #{elem.class}\"\n end # if\n } # x.each\n else\n puts \"ERROR: input class invalid, is #{x.class}\"\n exit\n end # case\n return retval\n end",
"def index\n @class_types = ClassType.all\n end",
"def get_all_classes(path = File.join(__dir__, '../knowledge/classes_hierarchy.json'))\n data = ensure_load_json(path, {})\n HashHelper.recursive_map_keys(data)\n end",
"def entity_types\n @entity_types ||= parent_tokenizer.class.all_entity_types\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def roots\n self.ontology_classes(force_reload=true).select{|c| c.isroot?}\n end",
"def subclasses; end",
"def subclasses; end",
"def class_decls; end",
"def index\n @klasses = Klass.all\n end",
"def generate_user_classes *klasses\n return [] unless healthy?\n klasses.map do |klass|\n klass.from_hash(raw)\n end\n end",
"def derivative_classes\n\t\tself.derivatives.values.uniq\n\tend",
"def derivative_classes\n\t\tself.derivatives.values.uniq\n\tend",
"def category_types\n @category_types.each\n end",
"def get_classes( obj )\n cls = obj.class\n print cls.to_s\n while cls.superclass != nil\n cls = cls.superclass\n print ' < ' + cls.to_s\n end\nend",
"def animal_species\n animal_arr = self.animals.map do |animal|\n animal.species\n end.uniq\n end",
"def get_cartridge_array\n cs = Array.new\n\n cartridges.each do |c|\n cs << c.name\n end\n\n cs\n end",
"def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end",
"def classes=(ary)\n `for(var result=[],i=0,l=ary.length;i<l;++i){result.push(ary[i].__value__);}`\n `this.__native__.className=result.join(' ')`\n return ary\n end",
"def index\n @ark_classes = ArkClass.all\n end",
"def treatments\n treatments = []\n @deps[:names].each do |name|\n treatment_class = \"HealthChecking::HealthChecks::Board::#{name.classify}\".safe_constantize\n treatments << treatment_class unless treatment_class.nil?\n end\n return treatments\n end",
"def models\n [::AdminSet, Hyrax::AdministrativeSet, ::Collection, Hyrax.config.collection_class].uniq.compact\n end",
"def subclasses\n @subclasses\n end",
"def boring_classes\n return [::Class, *::Class.included_modules,\n ::Module, *::Module.included_modules,\n ::Kernel, *::Kernel.included_modules,\n ::Object, *::Object.included_modules,\n ::BasicObject, *::BasicObject.included_modules].uniq\n end",
"def cti_all_descendants\n result = []\n block = Proc.new do |klass, descendants|\n result << klass\n descendants.each(&block)\n end\n @cti_descendants ||= {}\n @cti_descendants.each(&block)\n result\n end",
"def classes_hash\n @classes\n end",
"def classes_hash\n @classes\n end",
"def each_equivalence_class\n # TODO Make this the default each function of an Enumerable object?\n each do |allomorphs, semantic_equivalence_classes|\n semantic_equivalence_classes.each do |morpheme_hypotheses|\n yield [allomorphs, morpheme_hypotheses]\n end\n end\n end",
"def index\n @ontologies = Ontology.all\n end",
"def index_classes\n debug_msg \" generating class search index\"\n\n documented = @classes.uniq.select do |klass|\n klass.document_self_or_methods\n end\n\n documented.each do |klass|\n debug_msg \" #{klass.full_name}\"\n record = klass.search_record\n @index[:searchIndex] << search_string(record.shift)\n @index[:longSearchIndex] << search_string(record.shift)\n @index[:info] << record\n end\n end",
"def get_class_schools\n ret=[]\n self.teachings.to_a.each do |teaching|\n ret<< teaching.teaching_class_school\n end\n #puts \"========================== teacher.get_class_schools: #{ret.count}\"\n ret\n end",
"def classes(name = nil)\n find_children_of_type(\"Class\", name)\n end",
"def entity_types\n @entity_types ||= metadata.xpath('//EntityType').collect {|entity| entity.attributes['Name'].value}\n end",
"def object_types\n feature_object_types.collect(&:category).select{|c| c}\n end",
"def superclasses(c)\n result = [c]\n while s = c.superclass #rubocop:disable Lint/AssignmentInCondition\n result << s\n c = s\n end\n result\n end"
] |
[
"0.7007354",
"0.6787406",
"0.6668519",
"0.6584261",
"0.65691274",
"0.65691274",
"0.63448393",
"0.6343149",
"0.6319327",
"0.63011175",
"0.62924606",
"0.6217814",
"0.6139036",
"0.6084551",
"0.6067559",
"0.6035598",
"0.6016144",
"0.60121894",
"0.60020626",
"0.59833604",
"0.59822136",
"0.59470576",
"0.5937093",
"0.59281063",
"0.5889507",
"0.588922",
"0.5881537",
"0.58527195",
"0.58395725",
"0.5835828",
"0.58319783",
"0.5825273",
"0.5818632",
"0.5789525",
"0.5785005",
"0.57825464",
"0.5778921",
"0.57536304",
"0.5739884",
"0.57357335",
"0.5727791",
"0.5725786",
"0.56954604",
"0.56691366",
"0.5633611",
"0.56172997",
"0.55886346",
"0.5578133",
"0.5575731",
"0.557417",
"0.5570516",
"0.5559981",
"0.55403906",
"0.55342996",
"0.55230933",
"0.5522963",
"0.5511758",
"0.55049217",
"0.5483029",
"0.5483017",
"0.5482649",
"0.5476489",
"0.54660285",
"0.54562265",
"0.5455924",
"0.544074",
"0.54281604",
"0.5426506",
"0.54257286",
"0.54155535",
"0.53979397",
"0.5392277",
"0.5369448",
"0.5369448",
"0.5355191",
"0.53443354",
"0.5340967",
"0.5331569",
"0.5331569",
"0.53257424",
"0.5325",
"0.5311091",
"0.5308582",
"0.5308133",
"0.5291894",
"0.52791214",
"0.5277851",
"0.5276694",
"0.52694106",
"0.5265641",
"0.5264971",
"0.52618486",
"0.52618486",
"0.5261047",
"0.5251194",
"0.5248187",
"0.523238",
"0.5227338",
"0.5224624",
"0.52226704",
"0.52222854"
] |
0.0
|
-1
|
Callback from the CLLocationManager
|
def locationManager manager, didUpdateToLocation: new, fromLocation: old
coordinate = new.coordinate
size = @webView.bounds.size
params = {
markers: 'color:blue|%s,%s' % [coordinate.latitude, coordinate.longitude],
zoom: 14,
size: '%dx%d' % [size.width, size.height],
sensor: 'false'
}
url = "http://maps.googleapis.com/maps/api/staticmap?#{encodeParams params}"
loadUrl url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def onLocationChanged(eventData)\n processLocation(eventData.location)\n end",
"def geo_location_callback\n @@geo_callback_counter += 1\n if @params['accuracy'].to_i < @@geo_data_accuracy\n @@geo_data_accuracy = @params['accuracy'].to_i \n @@geo_latitude = @params['latitude'].to_f\n @@geo_longitue = @params['longitude'].to_f\n end \n \n if @@geo_callback_counter >= 5\n GeoLocation.turnoff\n @@geo_callback_counter = 0\n if @params['action'] == \"map\"\n show_map(@@geo_latitude, @@geo_longitue,\"\") \n Alert.hide_popup \n elsif @params['action'] == \"location\"\n url = get_url_for_google_reverse_geocoding(@@geo_latitude, @@geo_longitue)\n Rho::AsyncHttp.get(\n :url => url,\n :callback => (url_for :action => :httpget_geo_callback),\n :callback_param => \"accuracy=#{@@geo_data_accuracy}\"\n )\n end\n @@geo_data_accuracy = 1000\n @@last_geolocation_update = Time.now.to_i\n end\n end",
"def locationManager(locationManager, didUpdateLocations: locations)\n # puts \"Location coordinate = #{locations}\"\n current_location = locations.first.coordinate\n puts \"Latitude = #{current_location.latitude}\"\n puts \"Longitude = #{current_location.longitude}\"\n @pin.coordinate = current_location\n @pin.title = 'Current Location'\n @pin.subtitle = 'This is where we are.'\n @region.center = current_location\n @region.span = @span\n # - (void)showAnnotations:(NSArray<id<MKAnnotation>> *)annotations animated:(BOOL)animated\n view.showAnnotations([@pin], animated: true)\n view.setRegion(@region, animated: true)\n end",
"def set_gps_location!\n\n end",
"def store_location!; end",
"def on_location_change\n if location.present?\n if location.latitude.blank? && location.longitude.blank?\n self.location = nil\n elsif !location_id_was.nil? &&\n (location.latitude_changed? || location.longitude_changed?)\n\n if [ true, \"true\" ].include? new_location\n self.location = Location.new latitude: location.latitude,\n longitude: location.longitude\n elsif ! [ false, \"false\" ].include? new_location\n errors.add :new_location, :blank\n end\n end\n end\n end",
"def locationManager(manager, didChangeAuthorizationStatus:status)\n unless(CLLocationManager.locationServicesEnabled)\n p \"Couldn't turn on ranging: Location services are not enabled.\"\n @rangingSwitch.setOn(false, animated: true)\n return\n end\n\n if(CLLocationManager.authorizationStatus != KCLAuthorizationStatusAuthorized)\n p \"Couldn't turn on ranging: Location services not authorised.\"\n @rangingSwitch.setOn(false, animated: true)\n return\n end\n\n @rangingSwitch.setOn(true, animated: true) \n end",
"def nearby_geo_callback1\n\t\twebview_navigate_for_type(:index) if @params[\"known_position\"].to_i != 0 && @params[\"status\"] == \"ok\"\n \t# Try again if the first call failed, seems to be needed on the simulator...\n \tif @params[\"known_position\"].to_i == 0 || @params[\"status\"] != \"ok\" \n\t\t\tGeoLocation.set_notification( url_for_type(:action => :nearby_geo_callback2), default_query_hash_str, GeoTimeout) \n\t\t\tredirect_for_type :action => :wait, :query => { :message => \"Finding location...\" }\n\t\tend\n\tend",
"def show_location\n\n end",
"def get_location\n\n end",
"def geo_preparation_callback\n @@geo_callback_counter += 1\n if @@geo_callback_counter >= 10\n GeoLocation.turnoff\n @@last_geolocation_update = Time.now\n @@geo_callback_counter = 0\n end\n end",
"def get_geolocation(action)\n if GeoLocation.known_position?\n show_popup_message(Localization::Request[:address_lookup], Localization::Request[:address],['Cancel'], url_for(:action => :geo_popup_callback)) if action == \"location\"\n GeoLocation.set_notification( url_for(:action => :geo_location_callback), \"action=#{action}\", 0)\n else\n show_popup_message(Localization::Request[:no_gps], \"Adresse\",['Retry','Cancel'], url_for(:action => :geo_popup_callback))\n end\n end",
"def set_location_coordinates\n address = \"#{self.address.gsub('|', '+')}+\" +\n \", #{self.city}+\" +\n \", #{self.state unless self.state.nil?}+\" +\n \"#{self.country}\"\n address.gsub!(' ', '+')\n GetLocationCoordinatesJob.perform_later(self, address)\n end",
"def save_location\n self.location = @location_cache if @location_cache || geo_location_changed?\n end",
"def update_location\n customer = current_user.customer\n order = customer.orders.where(status: 5).last\n customer.update(location_params)\n # Check if customer location is within 50 meters from pickup location then change status from on the way to arrive.\n # Function to notify restaurant will built later\n if order\n distance = Geocoder::Calculations.distance_between([customer.lat,customer.long], [order.restaurant.latitude,order.restaurant.longitude])\n if distance <= 0.05\n order.update(status: 6)\n render json: {arrive: true}, status: :ok\n else\n render json: {arrive: false}, status: :ok\n end\n else\n render json: {error: \"You either arrived or have no pending order..\", is_success: false}\n end\n end",
"def update_my_location\n current_user.update(latitude: params[:latitude], longitude: params[:longitude])\n end",
"def update_location\n suggestion = Suggestion.find(params[:id])\n if admin or suggestion.user == @current_user\n suggestion.lat = params[:lat]\n suggestion.lon = params[:lon]\n suggestion.save\n end\n render :text => suggestion.to_json\n end",
"def record_location_change\n if (self.actual_storage_location != self.item.storage_location)\n \t self.update_attribute(:location_overridden, true)\n \t end\n end",
"def geo_location_changed?\n self.changed.include?(\"lat\") || self.changed.include?(\"lng\")\n end",
"def set_location\n\t current_user.update_location(params[:longitude], params[:latitude])\n respond_to do |format|\n format.js {render :nothing => true }\n end\n end",
"def location_changed!\n east = location.east_units\n west = location.west_units\n\n north = location.north_units\n south = location.south_units\n\n # NOTE: expectation is 1 of the paired directions will be zero.\n calculate_location_opposite east: east, west: west, north: north, south: south\n calculate_location_right east: east, west: west, north: north, south: south\n calculate_location_left\n end",
"def update_geocodes (country = '')\n place = Geocoder.search(\"#{self.name}, #{country}\").first\n sleep(0.3)\n unless place.nil?\n self.lat = place.geometry['location']['lat']\n self.lon = place.geometry['location']['lng']\n return self.save\n end\n false\n end",
"def user_location(user)\n geo = user.geolocation\n geo.latitude = 32.7157\n geo.longitude = -117.1611\n geo.fetch_address\n geo.save\n end",
"def longitude\n end",
"def on_update(new_point)\n end",
"def on_satellites_change(&block)\n\t\t\t@on_satellites_change = block\n\t\tend",
"def regeocode\n self.geocode_address if self.address_changed? || self.city_changed? || self.state_changed?\n end",
"def update_location\n if params.include?(:latitude) and params.include?(:longitude) and params.include?(:token)\n user_temp = {:latitude => params[:latitude], :longitude => params[:longitude], :available => true }\n user = User.find_by(:token => params[:token])\n if user.update(user_temp)\n success = true\n message = 'Update location successfully !'\n else\n success = false\n message = 'Cannot update data into table users'\n end\n else\n success = false\n message = 'Please check paramaters'\n end\n result = {:success => success, :message => message}\n render json: result\n end",
"def lat_changed?\n if (self.location_changed?)\n if !(self.latitude_changed?)\n self.errors.add(:location, \"is not valid\")\n return false\n end\n end\n return true\nend",
"def set_location\n location = flickr.places.findByLatLon(lat: lat, lon: lon)\n location.size >= 1 ? @location = location.first['name'] : @location = \"Unidentifiable location\"\n end",
"def location_insert\n true\n end",
"def set_location\n LocationHelper.browse_location(params['select_location'], current_user)\n end",
"def on_the_way\n order = current_user.customer.orders.find(params[:id])\n order.update(status: 5)\n order.customer.update(lat: params[:latitude], long: params[:longitude])\n render json: {is_success: true}, status: :ok\n end",
"def on_altitude_change(&block)\n\t\t\t@on_altitude_change = block\n\t\tend",
"def update_location_service\n if params.include?(:latitude) and params.include?(:longitude) and params.include?(:token)\n user_temp = {:latitude => params[:latitude], :longitude => params[:longitude]}\n user = User.find_by(:token => params[:token])\n if user.update(user_temp)\n success = true\n message = 'Update location successfully !'\n else\n success = false\n message = 'Cannot update data into table users'\n end\n else\n success = false\n message = 'Please check paramaters'\n end\n result = {:success => success, :message => message}\n render json: result\n end",
"def process_validity_geocoords\n unless self.status == OrderStatusEnum::COMPLETED\n if self.lat && self.long\n if self.get_assigned_tour\n self.status = OrderStatusEnum::ASSIGNED\n else\n self.status = OrderStatusEnum::ACTIVE\n end\n else\n self.status = OrderStatusEnum::INVALID\n end\n end\n end",
"def new_location\n current_user.update_location(params[:longitude], params[:latitude])\n @room = Room.first\n respond_to do |format|\n format.js {render :nothing => true }\n end\n end",
"def geocode\n @location = Location.find(params[:id])\n if @location.lat.blank? or @location.lng.blank?\n res = MultiGeocoder.geocode(@location.street + ', ' + @location.city + ', ' + @location.state + ', ' + @location.country)\n \n if !res.lng.blank? or !res.lat.blank?\n @location.lat = res.lat\n @location.lng = res.lng\n @location.save\n flash[:notice] = 'Geocoding results: ' + res.lat.to_s + ', ' + res.lng.to_s\n \n else\n flash[:notice] = 'Geocoding failed'\n end\n \n end\n \n respond_to do |format|\n format.html { redirect_to(@location) }\n format.xml { head :ok }\n end\n end",
"def location\n\t\t@location\n\tend",
"def location\n \n # Try to the device with its id or uid\n @device = get_device params[:device_id]\n \n if @device\n # Render Location to json, if user is allowed\n if @device.get_read_access(current_user)\n @location = @device.location\n \n else\n render json: {:message => \"Not authorized to read device location\", :code => 401} , :status => :unauthorized \n end\n \n end\n \n end",
"def update\n logger.debug params.inspect\n\n begin\n @location = if (current_user.has_role?(:administrator))\n Location.find_by_slug(params[:id])\n else\n current_user.locations.find_by_slug(params[:id])\n end\n rescue\n # Just continue -- no location found\n end\n\n if (current_user.has_role?(:administrator))\n unless params[:user].blank? || params[:user][:login].blank?\n new_owner = User.find_by_login(params[:user][:login])\n @location.change_user(new_owner.id, current_user)\n end\n end\n\n respond_to do |format|\n if @location\n if (params[:location] && contacts = params[:location].delete(:contacts))\n contacts_array = hash_to_array(contacts)\n\n contacts_array.each do |contact|\n if (phones = contact.delete(:phone))\n contact[:phone] = hash_to_array(phones)\n end\n end\n\n @location.contacts = contacts_array\n end\n @location.attributes = params[:location]\n @location.geocode\n end\n\n if @location && @location.save\n flash[:notice] = t 'club_updated'\n format.html { redirect_to(location_path(@location.slug)) }\n format.xml { head :ok }\n else\n format.html do\n if @location\n render :action => \"edit\"\n else\n flash[:error] = t 'club_unknown'\n redirect_to locations_url\n end\n end\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def longitude; end",
"def httpget_geo_callback\n if @params['body']['results'] && @params['body']['results'].length > 0\n address = @params['body']['results'][0]['formatted_address'] \n accuracy = @params['accuracy'].to_i.to_s\n WebView.execute_js('setFieldValue(\"location\",\"'+address+' \\n('+Localization::Request[:accuracy]+' = '+accuracy+' '+Localization::Request[:meter]+')\");')\n Alert.hide_popup \n elsif @params['body']['status']\n WebView.execute_js('setFieldValue(\"location\",\"'+@params['body']['status']+' accuracy = '+@params['accuracy']+'\");')\n Alert.hide_popup \n else\n WebView.execute_js('setFieldValue(\"location\",\"'+@params['body'].to_s+'\");')\n Alert.hide_popup \n end\n end",
"def viewMap(address, to_lat, to_lng, callback)\n puts \"viewMap(address:#{address}, to_lat:#{to_lat}, to_lng:#{to_lng}, callback:#{callback}\"\n\n if GeoLocation.known_position?\n from_lat = GeoLocation.latitude\n from_lng = GeoLocation.longitude\n else\n from_lat = 34.3932857\n from_lng = 132.4705439\n from_lat = 34.4893270\n from_lng = 133.3614320\n from_lat = 35.005018\n from_lng = 135.889155\n end\n\n if callback\n #GeoLocation.set_notification(url_for(:action => :geo_callback), \"\")\n GeoLocation.set_notification(callback, \"\")\n end\n\n puts \"from:#{from_lat},#{from_lng} => to:#{to_lat},#{to_lng}\"\n puts \"distance: #{GeoLocation.haversine_distance(from_lat,from_lng,to_lat,to_lng)}\"\n\n #region = [@params['latitude'], @params['longitude'], 1/69.0, 1/69.0] #miles\n #region = [@params['latitude'], @params['longitude'], 1/111.0, 1/111.0] #km\n region = [(to_lat + from_lat) / 2, (to_lng + from_lng) / 2,\n (to_lat - from_lat).abs, (to_lng - from_lng).abs]\n\n url = \"http://maps.google.jp/maps/api/directions/json?\" +\n \"origin=#{from_lat},#{from_lng}&\" +\n \"destination=#{to_lat},#{to_lng}&\" +\n \"mode=walking&\" +\n \"language=ja&\" +\n \"sensor=true\"\n #puts url\n\n res2 = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res2.inspect\n #puts res2[\"status\"]\n\n# if res2[\"status\"] == \"ok\"\n# end\n\n myannotations = []\n\n #puts res2[\"body\"].inspect\n #puts res2[\"body\"][\"status\"]\n #puts res2[\"body\"][\"routes\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].size\n\n res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n #puts step.inspect\n\n title = step[\"html_instructions\"]\n title = title.gsub(/\\<\\/?[bB]\\>/, \"\")\n #puts title\n\n myannotations << {\n :latitude => step[\"start_location\"][\"lat\"],\n :longitude => step[\"start_location\"][\"lng\"],\n :title => title,\n :subtitle => step[\"distance\"][\"text\"],\n #:url => \"/app/GeoLocation/show?city=Original Location\",\n #:image => '/public/images/marker_blue.png', :image_x_offset => 8, :image_y_offset => 32\n }\n end\n\n myannotations << {\n :latitude => to_lat,\n :longitude => to_lng,\n :title => address,\n #:subtitle => @params['map']['address'],\n #:url => \"/app/GeoLocation/show?city=Original Location\"\n }\n\n map_params = {\n #:provider => \"Google\",\n :provider => \"ESRI\",\n :settings => {\n #:map_type => \"roadmap\",\n :map_type => \"standard\",\n :region => region,\n :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => true,\n #:api_key => '0jDNua8T4Teq0RHDk6_C708_Iiv45ys9ZL6bEhw'\n },\n :annotations => myannotations\n }\n\n #puts map_params.inspect\n puts \"-------------------------\"\n MapView.create map_params\n end",
"def set_location\n @location = \"Minneapolis, MN\"\n end",
"def locations; end",
"def update_geo_location\n self.class.update_geo_location(self)\n self.reload\n end",
"def change_curr_location(new_location)\n @curr_location = new_location\n end",
"def handle_geocode_status(geomatch_result)\n case geomatch_result[:status]\n when VaDotGovAddressValidator::STATUSES[:matched_available_hearing_locations],\n VaDotGovAddressValidator::STATUSES[:philippines_exception]\n cancel_admin_actions_for_matched_appeal\n when VaDotGovAddressValidator::STATUSES[:created_verify_address_admin_action],\n VaDotGovAddressValidator::STATUSES[:created_foreign_veteran_admin_action]\n create_available_hearing_location_for_errored_appeal\n end\n end",
"def set_latlng!\n if ! self.physical_address1.blank? && ! self.physical_address_city.blank? && ! self.physical_address_state.blank? && ! self.physical_address_zip.blank? \n phys_addr = Geokit::Geocoders::YahooGeocoder.geocode self.physical_address1 + \",\" + \n self.physical_address_city + \",\" + self.physical_address_state + \" \" + self.physical_address_zip\n if phys_addr && ! phys_addr.lat.blank? && ! phys_addr.lng.blank? \n latlng = AddrLatlng.new(:agent_id => self.id, :lat => phys_addr.lat, :lng => phys_addr.lng)\n self.addr_latlng = latlng\n self.save\n end\n else\n if ! self.addr_latlng.blank?\n self.addr_latlng.destroy\n end\n end\n end",
"def geocode\n fail\n end",
"def full_location; end",
"def altered_world_event; end",
"def position!\n raise TZDetect::Error::Geocoder, \"not implemented method position!\"\n end",
"def shows_user_location?\n self.showsUserLocation\n end",
"def coordinates_changed?\n if self.address_changed?\n unless self.lat_changed? || self.lng_changed?\n self.errors.add(:address, 'cannot be geo-located. Please try to be more specific')\n return false\n end\n end\n true\n end",
"def update_location (new_lonlat)\n @survivor.update_attribute(:lonlat, new_lonlat) \n end",
"def perform\n geocode\n end",
"def geo_code\n GeoCoder.broadcast(request.remote_ip)\n end",
"def send_request\n if latitude && longitude\n response = RestClient::Request.execute(\n method: :get,\n url: \"http://climateapi.scottpinkelman.com/api/v1/location/#{latitude}/#{longitude}\"\n )\n parsed = JSON.parse(response)\n self.climate_zone = parsed[\"return_values\"][0][\"koppen_geiger_zone\"]\n else\n p \"Unable to get geocoding location\"\n end\n end",
"def check_geo_location\n \tsession[:geo_location] ||= GeoKit::GeoLoc.new(:lat => 39.3597710000, :lng => -76.6716720000, :city => 'Baltimore')\n\tend",
"def set_geolocation\n @location = Geolocation.find(params[:id]) \n end",
"def final_location\n\t\t@roo.location\n\tend",
"def update_location_error(params)\n location_error(:edit_location, params)\n end",
"def finish_coords\n marker_coords('F')\n end",
"def yahoo_callback\n @partner = Partner.find($tempGlob.object)\n \n if @params['status'] != 'ok'\n puts @params\n else\n @@get_result = @params[\"body\"]\n \n require 'rexml/document'\n\n doc = REXML::Document.new(@@get_result)\n @lat = \"\"\n @long = \"\"\n \n doc.elements.each('ResultSet/Error') do |ele|\n @temp = ele.text\n if @temp.to_i != 0\n Alert.show_popup(\n :message => 'Error with Address can not get GPS coordinates',\n :title => 'GeoLocation Error',\n :buttons => ['ok'],\n :callback => url_for(:action => :index)\n )\n end\n end\n \n doc.elements.each('ResultSet/Result/offsetlat') do |ele| #Pass the macthing XML portion\n @lat = ele.text #Add the latitude XML element into Array\n puts @lat\n end\n \n doc.elements.each('ResultSet/Result/offsetlon') do |ele| #Pass the macthing XML portion\n @long = ele.text #Add the longitude XML element into Array\n puts @long\n end\n @partner.update_attributes(\"lat\" => @lat, \"long\" => @long)\n end\n end",
"def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end",
"def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end",
"def set_user_location_change\n @user_location_change = UserLocationChange.find(params[:id])\n end",
"def on_appear\n @update = true\n unless @checkingCheckins\n update_checkins\n end\n unless @pinging\n location_ping\n end\n @frequency = 20\n end",
"def locationLookup(currLoc) \n client = Weatherman::Client.new\n client.lookup_by_location(currLoc)\nend",
"def locations\n # blank\n end",
"def home\n \t@listener = @current_user.listener\n \t@listener.lng = params[:lng]\n \t@listener.lat = params[:lat]\n end",
"def update_location(params)\n country_msgid = params[:listing][:country]\n country = Country.get_by_short(params[:listing][:country_code])\n\n if country\n country_msgid = country.msgid\n end\n\n loc = [params[:listing][:lat].to_f, params[:listing][:lng].to_f]\n self.update_attributes(\n lat: params[:listing][:lat],\n lng: params[:listing][:lng],\n street: params[:listing][:street],\n postal_town: params[:listing][:postal_town],\n postal_code: params[:listing][:postal_code],\n state: params[:listing][:state],\n state_long: params[:listing][:state_long],\n country: country_msgid,\n country_code: params[:listing][:country_code],\n google_formatted_address: params[:listing][:google_formatted_address],\n location: loc,\n location_reversed: loc.reverse\n )\n end",
"def change_geolocations\n travelog = Travelog.find(params[:id])\n if !travelog.blank?\n if !travelog.lat.blank? and !travelog.longt.blank?\n country_place = Country.get_address_state(travelog.lat,travelog.longt,'travelog')\n if country_place == nil\n render :text => \"Unable to find address\" and return \n else \n travelog.where = Country.composite_address(country_place)\n travelog.location = country_place[2]\n travelog.country= country_place[3]\n travelog.state= country_place[4]\n travelog.continent= country_place[5]\n travelog.update_attributes(params[:travelog])\n end\n else \n render :text => \"lat and longt blank\" and return \n end\n else\n render :text => \"travelog not found\" and return \n end \nend",
"def set_user_location\n return unless (search_params[:lat] && search_params[:long]) ||\n search_params[:zip_code]\n\n user_location_object(search_params[:lat], search_params[:long],\n search_params[:zip_code])\n end",
"def update_geoloc\n # Too simple ! Need to check than every user are contributors for this project.\n # Ok, I admit this is realy not accurate for any security purpose... Curious to see what Novagile think about\n CacheUser.update_geocodes(geoloc_params)\n respond_to do |format|\n format.html { render text: \"Request processed\", status: \"ok\" }\n format.json { render text: {message: \"Request processed\"}, status: :ok}\n end\n end",
"def parse_location_info_and_create_user_account\n user = User.find_by_device_id(device_id)\n unless user\n user = User.create!(:device_id => device_id, \n :password => email, \n :user_name => user_name,\n :email => email, \n :status => status)\n end\n user.ensure_authentication_token!\n geo_location_response = ::Geolocation::Finder::Google.google_reverse_coding(user, latitude, longitude)\n location_status = geo_location_response.nil? ? \" Hurray!You have explored a new location.Please add the location to your credit.\" : \" Location tracked Successfully!\"\n return \"Hi #{user.user_name}, Welcome to CrowdClub.#{location_status}\", user.authentication_token\n end",
"def geocode_locations\n coords = Geocoder.coordinates(self.location)\n if coords.nil?\n self.lat = nil\n self.long = nil\n else\n self.lat = coords[0]\n self.long = coords[1]\n end\n end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end",
"def location; end"
] |
[
"0.65029335",
"0.6359073",
"0.626782",
"0.6178148",
"0.6082558",
"0.6057392",
"0.6005049",
"0.5952406",
"0.5753182",
"0.57295656",
"0.5716179",
"0.5647721",
"0.5615434",
"0.5610879",
"0.5582051",
"0.5553366",
"0.55330884",
"0.54896355",
"0.5458575",
"0.5435114",
"0.5371824",
"0.5366265",
"0.53641355",
"0.534917",
"0.5331947",
"0.531074",
"0.53068215",
"0.52885",
"0.52881104",
"0.52848154",
"0.527424",
"0.5260259",
"0.5242865",
"0.5239498",
"0.5233045",
"0.523226",
"0.5224386",
"0.51941025",
"0.5193411",
"0.51928186",
"0.5187719",
"0.5181156",
"0.5177131",
"0.5166485",
"0.51564103",
"0.51425564",
"0.51378703",
"0.51292086",
"0.51262313",
"0.51085687",
"0.5101284",
"0.50996196",
"0.5095875",
"0.50927424",
"0.50919354",
"0.50834274",
"0.50718874",
"0.5064599",
"0.5060748",
"0.5048236",
"0.50479925",
"0.5039508",
"0.50390726",
"0.5038026",
"0.5037528",
"0.50300604",
"0.50249547",
"0.50249547",
"0.5021071",
"0.5016026",
"0.5015221",
"0.50127494",
"0.5006202",
"0.50006294",
"0.5000476",
"0.49961117",
"0.4988939",
"0.49884474",
"0.49878877",
"0.498458",
"0.498458",
"0.498458",
"0.498458",
"0.498458",
"0.498458",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038",
"0.49839038"
] |
0.0
|
-1
|
inserting a new row into the database contact
|
def save
if self.id
self.update
else
sql = <<-SQL
INSERT INTO contacts (name, phone_number, address, email)
VALUES (?, ?, ?, ?)
SQL
DB[:conn].execute(sql, name, phone_number, address, email)
@id = DB[:conn].execute("SELECT last_insert_rowid() FROM contacts")[0][0]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save\n if id\n Connection.conn.exec_params('UPDATE contacts SET name = $1, email = $2 WHERE id = $3::int;', [name,email,id])\n else\n pg_contact = Connection.conn.exec_params('INSERT INTO contacts (name,email) VALUES ($1, $2) RETURNING *;', [name,email])\n self.id = pg_contact[0][\"id\"]\n end\n self\n end",
"def post_contact\n\t\tcontact = Contact.new\n\t\tcontact.first_name = params[:first_name]\n\t\tcontact.last_name = params[:last_name]\n\t\tcontact.phone_number = params[:phone_number]\n\t\tcontact.email = params[:email]\n\t\tcontact.save\n\t\tcurrent_agendify_user.contacts.push(contact)\n\t\tcurrent_agendify_user.save\n\t\tredirect_to root_path\n\tend",
"def save(name, email)\n @@conn.exec_params('INSERT INTO contacts (name, email) VALUES ($1, $2)', [name, email])\n end",
"def addContact(db)\r\n\tputs \"******************************New Contact*********************************\"\r\n\tputs \"Enter name:\"\r\n\tname = gets.chomp\r\n\tputs \"Enter Phone Number (No dashes/parens):\"\r\n\tnum = gets.chomp.to_i\r\n\tputs \"Enter Address:\"\r\n\tadd = gets.chomp\r\n\tdb.execute(\"INSERT INTO contacts (name, phone, address) VALUES (?, ?, ?)\", [name, num, add])\r\nend",
"def insert\n col_names = self.class.columns.join(\", \")\n question_marks = ([\"?\"] * self.class.columns.length).join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end",
"def insert\n array = [[@name, @tagline, @github, @twitter, @blog_url, @image_url, @biography]]\n ins = DB[:conn].prepare(\"INSERT INTO students (name, tagline, github, twitter, blog_url, image_url, biography) VALUES (?, ?, ?, ?, ?, ?, ?);\")\n array.each { |s| ins.execute(s)}\n self.id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students;\")[0][0]\n #ask steven re. index figures\n #inserting data into an instance\n end",
"def insert(first_name, last_name)\n\t$db.execute(\n\t\t\t\t\"INSERT INTO contacts\n\t\t\t\t(first_name, last_name, company, phone, email, created_at, updated_at)\n\t\t\t\tVALUES\n\t\t\t\t(:first_name, :last_name, NULL, NULL, NULL,DATETIME('now'),DATETIME('now'))\", \n\t\t\t\t\"first_name\" => \"#{first_name}\", \"last_name\" => \"#{last_name}\"\n\t\t\t\t)\nend",
"def add_to_database\n CONNECTION.execute(\"INSERT INTO users (name) VALUES ('#{self.name}');\")\n @id = CONNECTION.last_insert_row_id\n end",
"def insert\n # Preparing for the query...\n cols = self.class.columns\n col_names = cols.map(&:to_s).join(\", \")\n question_marks = ([\"?\"] * cols.count).join(\", \")\n \n # The actual query\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{ self.class.table_name } (#{ col_names })\n VALUES\n (#{ question_marks })\n SQL\n \n # Add an id number for the record\n self.id = DBConnection.last_insert_row_id\n end",
"def create_new_contact(db)\n\ttemp_array = [ ]\n\tputs \"Please enter contact information as follows.\"\n\tputs \"LAST NAME:\"\n\ttemp_array.push(gets.chomp)\n\n\tputs \"\",\"FIRST NAME:\"\n\ttemp_array.push(gets.chomp)\n\n\tputs \"\",\"EMAIL:\"\n\ttemp_array.push(gets.chomp)\n\n\tputs \"\",\"PHONE:\"\n\ttemp_array.push(gets.chomp)\n\n\tputs \"\",\"ADDRESS:\"\n\ttemp_array.push(gets.chomp)\n\tdb.execute(\"INSERT INTO contacts (lastname,firstname,email,phone,address) VALUES (?, ?, ?, ?, ?)\", temp_array)\nend",
"def insert\n\n DBConnection.execute2(<<-SQL, attribute_values)\n INSERT INTO\n #{class_obj.table_name} #{sql_columns}\n VALUES\n #{sql_question_marks}\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end",
"def insert\n DATABASE.execute(\"INSERT INTO students (name, age, github) VALUES (?, ?, ?)\", @name, @age, @github)\n @id = DATABASE.last_insert_row_id\n end",
"def insert()\n\n end",
"def add_contact\n print \"First name:\"\n first_name = gets.chomp\n\n print \"Last Name:\"\n last_name = gets.chomp\n\n print \"Email:\"\n email = gets.chomp\n\n print \"Notes:\"\n notes = gets.chomp\n\n Contact.create(first_name, last_name, { email: email, notes: notes })\n end",
"def add_to_database\n hash = self.attr_hash\n columns = hash.keys\n values = hash.values\n if self.valid?\n CONNECTION.execute(\"INSERT INTO #{tablename} (#{columns.join \", \"}) VALUES (#{values.to_s[1...-1]});\")\n @id = CONNECTION.last_insert_row_id\n else\n false\n end\n end",
"def create\n self.id = connection.insert(\n \"INSERT INTO #{self.class.table_name} \" +\n \"(#{quoted_column_names.join(', ')}) \" +\n \"VALUES(#{attributes_with_quotes.values.join(', ')})\",\n \"#{self.class.name} Create\",\n self.class.primary_key, self.id\n )\n \n @new_record = false\n end",
"def add_new_customer\n begin\n aCustomer = Customer.new(@last_name, @first_name, @phone_number, @street_address, @city, @us_state, @zip_code )\n aCustomer.create_new_customer\n rescue SQLite3::Exception => e\n p \"Exception with add_new_customer: #{e}\"\n end\n end",
"def add_new_contact\nprint \"Contact first name:\"\nfirst_name = gets.chomp\n\nprint \"Contact last name:\"\nlast_name = gets.chomp\n\nprint \"Enter Contact's Email Address\"\nemail = gets.chomp\n\nprint \"Enter Note\"\nnote = gets.chomp\n\nContact.create(first_name, last_name, email, note)\n end",
"def insert\n DATABASE.execute(\"INSERT INTO terms (term, definition, phonetic) VALUES \n ('#{@term}', '#{@definition}', '#{@phonetic}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def add_new_contact\n puts \"\\e[H\\e[2J\"\n\n p \"enter firstname\"\n first_name = gets.chomp\n\n p \"enter lastname\"\n last_name = gets.chomp\n\n p \"enter email address\"\n email = gets.chomp\n\n p \"enter note: optional\"\n note = gets.chomp\n\n contact = Contact.create(\n first_name: first_name,\n last_name: last_name,\n email: email,\n note: note\n )\n end",
"def insert\n # the array of ::columns of the class joined with commas, drop id\n col_names = self.class.columns[1..-1].join(\", \") \n # an array of question marks\n question_marks = ([\"?\"] * col_names.split.size).join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values[1..-1])\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end",
"def insert_record(name, type, ttl, content)\n records_table.insert(\n :domain_id => domain.id,\n :name => name,\n :type => type, \n :ttl => ttl, \n :content => content,\n :change_date => Time.now.to_i\n )\n end",
"def add_contact(list)\n\n puts \"Please enter new contact name:\"\n add_name = gets.chomp.downcase\n\n puts \"Please enter new contact phone number:\"\n add_phone = gets.chomp.downcase\n\n puts \"please enter new contact email address:\"\n add_email = gets.chomp.downcase\n\n puts \"please enter new contact occupation:\"\n add_occupation = gets.chomp.downcase\n\n puts \"please enter how you know new contact:\"\n add_group = gets.chomp.downcase\n\n list.execute(\"INSERT INTO contacts(name, occupation, association, phone_number, email) VALUES ('#{add_name}', '#{add_occupation}','#{add_group}', '#{add_email}', '#{add_phone}') \")\nend",
"def insert(sql, name = nil, pk = nil, id_value = nil) end",
"def insert(table, id, attributes) # abstract\n end",
"def new_student (db, name)\n db.execute(\"INSERT INTO student (name) VALUES (?)\", [name])\nend",
"def create_entry()\n\tdb.execute( \"INSERT INTO test (name, codename) VALUES (?, ?)\", [name, code_name])\n\nend",
"def add_row( new_row, pos=@table.size)\n @table.insert(pos, new_row)\n end",
"def add_to_database\n if self.can_drink?\n CONNECTION.execute(\"INSERT INTO students (name, age) VALUES ('#{@name}', #{@age});\")\n \n @id = CONNECTION.last_insert_row_id\n else\n false\n end\n end",
"def create_customer(db, first, last, address, city, phone)\n db.execute(\"INSERT INTO customers (first_name, last_name, address, city, phone) VALUES (?, ?, ?, ?, ?)\", [first, last, address, city, phone])\nend",
"def insert(**opts)\n add(**opts)\n save!\n end",
"def new_patient(db, name, dob, insurance)\n\t\n\tdb.execute(\"INSERT INTO patient_info (name, dob, insurance) VALUES (?, ?, ?)\", [name, dob, insurance])\n\nend",
"def add_new_contact\n print \"First Name:\"\n first_name = gets.chomp\n print \"last name:\"\n last_name = gets.chomp\n print \"Email:\"\n email = gets.chomp\n print \"Note:\"\n note = gets.chomp\n contact = Contact.new(first_name, last_name, email, note)\n add_contact(contact)\n end",
"def insert()\n\t\t@db.execute(\"insert into ausgaben (jahr, monat, name, betrag, gemeinsam, tags) values(:jahr, :monat, :name, :betrag, :gemeinsam, :tags)\", @options)\n\tend",
"def create(name, email)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n results = connection.exec(\"SELECT * FROM contacts ORDER BY id DESC LIMIT 1;\")\n results.each do |row|\n each_info = Contact.new(row['name'], row['email'], row['id'])\n puts \"ID #{row['id']}: #{row['name']} #{row['email']}\".blue\n end\n puts \"The contact was created successfully.\".green\n end",
"def insert\n DATABASE.execute(\"INSERT INTO locations (city) VALUES ('#{@city}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end",
"def addContact(fname,lname,email)\n\t\t@dataArray.push(Struct::ContactEntry.new(fname,lname,email))\n\tend",
"def add_new_contact\n\n\t\t# Getting information from user\n\t\tputs \"Enter your firstname\"\n\t\tfirstName = gets\n\n\t\tputs\"Enter your Lastname\"\n\t\tlastName = gets\n\n\t\tputs\"Enter Email\"\n\t\temail = gets\n\n\t\tputs \"Enter notes\"\n\t\tnotes = gets\n\n\t # Making a contact object\n\t contact = Contact.new(firstName, lastName, email, notes)\n\t @contacts << contact # Putting newly created object in array.\n\tend",
"def insert_into_article(title, content, price, user_id, adress, phone_number, date_created, tag_id) \n return get_db().execute(\"INSERT INTO article (title, content, price, user_id, adress, phone_number, date_created, tag_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)\", title, content, price, user_id, adress, phone_number, date_created, tag_id)\n end",
"def get_new_contact\n puts \"Enter details for the new contact: \"\n print \"Full Name: \"\n name = STDIN.gets.chomp\n print \"E-mail: \"\n email = STDIN.gets.chomp\n print \"Phone Numbers: \\n\"\n phone_numbers = get_phone_numbers\n contact = Contact.create(name, email, phone_numbers)\n if contact\n puts \"Contact was created successfully, Id of the new contact: #{contact.id}.\"\n else\n puts \"Contact already exists! New Contact can not be created.\"\n end\n end",
"def insert\n \n attributes = []\n instance_variables.each do |i|\n attributes << i.to_s.delete(\"@\") if (i != :@id && i != :@table)\n end\n \n values = []\n attributes.each do |a|\n value = self.send(a)\n \n if value.is_a?(Integer)\n values << \"#{value}\"\n else values << \"'#{value}'\"\n end\n end\n \n DATABASE.execute(\"INSERT INTO students (#{attributes.join(\", \")}) \n VALUES (#{values.join(\", \")})\")\n @id = DATABASE.last_insert_row_id\n\n end",
"def insert\n DATABASE.execute(\"INSERT INTO locations (location_name) \n VALUES ('#{@location_name}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def add_contact(contact)\n\t\tcontact.id = @@ids\n\t\t@contacts << contact \n\t\t@@ids += 1\n\t\tcontact\n\tend",
"def add_family(db, name, age)\r\n\tdb.execute(\"INSERT INTO family (name, age) VALUES (?, ?)\", [name, age])\r\nend",
"def saveUser(name,description,email,phone,address)\n self.checkConnectMySQL() \n @connect.query(\"INSERT INTO users(name, description, email, phone, address) VALUES ( '#{name}', '#{description}', '#{email}','#{phone.to_s}','#{address}' )\") \n end",
"def insert_entry(params)\n Entry.create(params)\n end",
"def add_new_school(db, name)\n db.execute(\"INSERT INTO school (name) VALUES (?)\", [name])\nend",
"def new_contact\n @contact=Contact.new()\n end",
"def add_student(database, name)\r\n\tdatabase.execute(\"INSERT INTO students (name) VALUES (?)\", [name])\r\nend",
"def add_new_classmate(db, tbl)\n puts \"Enter user first name: \"\n fname = gets.chomp\n\n puts \"Enter user last name: \"\n lname = gets.chomp\n\n puts \"Enter user twitter id: \"\n twitter = gets.chomp\n\n insert_classmate = \"insert into #{tbl} (first_name, last_name, twitter) values ('#{fname}', '#{lname}', '#{twitter}')\"\n\n db.exec(insert_classmate)\n\n end",
"def add_to_database\n CONNECTION.execute(\"INSERT INTO locations (name) VALUES ('#{self.name})';\")\n self.id = CONNECTION.last_insert_row_id\n \n return self\n end",
"def create_new_customer\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n db.execute('INSERT INTO customers (last_name, first_name, phone_number, street_address, city, us_state, zip_code) VALUES (?, ?, ?, ?, ?, ?, ?)',[@last_name, @first_name, @phone_number, @street_address, @city, @us_state, @zip_code])\n last_record = db.last_insert_row_id\n db.close\n last_record\n rescue SQLite3::Exception => e\n p \"Exception with create_new_customer database query: #{e}\"\n end\n end",
"def add_new_contact \t\n\t print \"Enter First Name: \"\n\t first_name = gets.chomp\n\t print \"Enter Last Name: \"\n\t last_name = gets.chomp\n\t print \"Enter Email Address: \"\n\t email = gets.chomp\n\t print \"Enter a Note: \"\n\t note = gets.chomp\n\n\t contact = Contact.new(first_name, last_name, email, note)\n\t @rolodex.add_contact(contact)\n\tend",
"def add_person\n puts \"Enter Name:\"\n name = gets.chomp\n puts \"Enter Job:\"\n job = gets.chomp\n puts \"Enter Gender:\"\n gender = gets.chomp\n puts \"Enter Age:\"\n age = gets.chomp\n\n $db.execute(\"INSERT INTO people (name, job, gender, age) VALUES (?, ?, ?, ?)\", name, job, gender, age)\nend",
"def add_entry(db, book_name, year_pubished, genre, author, rating, read)\n\tdb.execute(\"INSERT INTO books (book_name, year_pubished, genre, author, rating, read) VALUES (?, ?, ?, ?, ?, ?)\", [book_name, year_pubished, genre, author, rating, read])\nend",
"def save\n Chef.db.execute (\n <<-SQL\n INSERT INTO chefs (first_name, last_name , birthday, email , phone , created_at , updated_at)\n --Wasn't able to tale place holders(sql injections) i.e. VALUES(?, ?, ?, ?, ?, ?, ?) BECAUSE \"NOT NULL constraint failed: chefs.first_name (SQLite3::ConstraintException)\"\n VALUES('#{@first_name}', '#{@last_name}', '#{@birthday}', '#{@email}', '#{@phone}', '#{@created_at}', '#{@updated_at}')\n ;\n OR\n -- para evitar SQL injection, se usa \"?,\", vale mencionar que debe usarse en despues del \"OR\" o de lo contrario lanza un error\n VALUES (?, ?, ?, ?, ?, ?, ?, )\n ;\n SQL\n )\n #Execute a SELECT without the \"<<-SQL SQL\" sintaxis, taken from the docuemntation frames: http://www.rubydoc.info/gems/sqlite3/frames\n Chef.db.execute( \"SELECT * FROM chefs\" ) do |row|\n p row\n end\n\n end",
"def create(name, email, *phones)\n new_id = nil\n CSV.open(\"contacts.csv\", \"ab+\") do |csv|\n csv << [name,email,phones[0],phones[1]]\n new_id = Contact.all.length\n end\n new_id\n end",
"def add_person\n puts \"Enter name: \"\n name = gets.chomp\n puts \"Enter job: \"\n job = gets.chomp\n puts \"Enter gender: \"\n gender = gets.chomp\n puts \"Enter age: \"\n age = gets.chomp\n\n # insert_person_to_db\n $db.execute(\"INSERT INTO people (name, job, gender, age) VALUES (?, ?, ?, ?)\", name, job, gender, age)\nend",
"def insert(table,doc)\n connection.insert(path(table),doc)\n end",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade) \n VALUES (?, ?)\n SQL\n \n DB[:conn].execute(sql, self.name, self.grade)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end",
"def save_form_data_to_database\n db = get_db\n db.execute 'INSERT INTO Messages (username, phone, email, option, comment)\n VALUES (?, ?, ?, ?, ?)', [@username, @phone, @email, @option, @comment]\n db.close\nend",
"def insert(data) \n set data, 1\n end",
"def insert(data) \n set data, 1\n end",
"def insert\n DATABASE.execute(\"INSERT INTO dogs (name, breed, age, serial_num, colour, description, temperament_id, owner_id) VALUES \n ('#{@name}', '#{@breed}', #{@age}, #{@serial_num}, '#{@colour}', '#{@description}', #{@temperament_id}, #{@owner_id})\")\n @id = DATABASE.last_insert_row_id\n end",
"def create(name, email)\n id = CSV.read('contacts.csv').last[0].to_i + 1\n new_contact = Contact.new(id, name, email)\n CSV.open('contacts.csv', 'a') do |file|\n file << [new_contact.id, new_contact.name, new_contact.email]\n end\n new_contact\n end",
"def add_friend(db, friend_name, age, birth_month, birth_day, likes_birthdays)\n db.execute(\"INSERT INTO friends (friend_name, age, birth_month, birth_day, likes_birthdays) VALUES (?, ?, ?, ?, ?)\", [friend_name, age, birth_month, birth_day, likes_birthdays])\nend",
"def insert_record(table, values)\n execute table_insert_query(table, values)\n end",
"def insert_author_affiliation(affi_object, cd_affi_ids)\n # insert the object\n # get the id of the inserted object\n # update all cr_affiliations with the author_affiliation_id\n sql_statement = \\\n \"SELECT id, name FROM cr_affiliations WHERE article_author_id = \" + affi_object.article_author_id.to_s + \";\"\n db = get_db()\n #stm = db.prepare sql_statement\n #rs = stm.execute\n\n db.execute(\"INSERT INTO Author_Affiliations VALUES (?,?,?,?,?,?,?,?,?,?,?,?)\", 1, affi_object.article_author_id, affi_object.name, affi_object.short_name,\n affi_object.add_01, affi_object.add_02, affi_object.add_03,affi_object.add_04, affi_object.add_05, affi_object.country,'2020-09-27','2020-09-27')\nend",
"def save\n if self.id\n self.update\n else\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.grade)\n # This method also assigns the id attribute of the object once the row has\n # been inserted into the database.\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end\n end",
"def insert(record, sync: true)\n record = klass.new(**record) if record.is_a?(Hash)\n row = record.to_row(header)\n ws.update_cells(*next_row_col, [row])\n ws.synchronize if sync\n record\n end",
"def create\n check_fields\n sql = \"INSERT INTO #{table} VALUES (NULL,#{to_create_record_str})\"\n Database.transaction(sql)\n sql = \"SELECT id FROM #{table} WHERE #{to_find_id_str}\"\n @id = Database.execute(sql).last[0]\n @log.debug \"Record[#{self}] is added to Table[#{table}]\"\n end",
"def insert_row(row, index=@rows.length)\n @rows.insert(index, row)\n end",
"def insert()\n\n # Kräver att det finns ett \"set_table(\"Table\")\" i klassen\n @insertable_vars_full = self.instance_variables # Ta med namnen user.username osv\n @insertable_vars_full.shift(1) # Kinda frisky\n @insertable_vars = []\n @insertable_values = []\n @insertable_vars_full.each do |var|\n @insertable_vars << var[1..-1]\n @insertable_values << self.instance_variable_get(var)\n end\n\n\n @insertable_vars_str = @insertable_vars.join(\", \")\n\n @question_marks = \"\"\n @insertable_vars.each do |key|\n @question_marks.concat(\"?,\")\n end\n @question_marks = @question_marks[0..-2]\n\n DB.execute(\"INSERT INTO #{@table} (#{@insertable_vars_str})\n VALUES (#{@question_marks})\", @insertable_values)\n\n end",
"def manual_add_entry\n address_book.add_entry(enter_name, enter_phone, enter_email)\n end",
"def create\n attributes = self.class.attributes.map { |attribute| attribute.to_s }\n attributes.shift\n question_marks = []\n attributes.each { |attribute| question_marks << \"?\"}\n\n DBConnection.execute(<<-SQL, *attribute_values(attributes))\n INSERT INTO\n #{self.class.table_name} (#{attributes.join(\", \")})\n VALUES\n (#{question_marks.join(\", \")})\n SQL\n #self.send('id', DBConnection.instance.last_insert_row_id)\n end",
"def insertOperation\n\t\tputs \"Enter Product Id\"\n\t\tproid = gets.chomp.to_i\n\t\tputs \"Enter Product Name\"\n\t\tproname = gets.chomp\n\t\tproname = \"'\"+proname+\"'\"\n\t\tputs \"Enter Product Quantity\"\n\t\tproqty = gets.chomp.to_i\n\t\tputs \"Enter Product Cost\"\n\t\tprocost = gets.chomp.to_i\t\n\t\t\t\n\t\tbegin\n\t\t\tresult = @statement.executeUpdate(\"insert into products values(#{proid},#{proname},#{proqty},#{procost})\")\n\t\t\tif result\n\t\t\t\tputs \"Record Inserted Successfully...........\"\n\t\t\telse\n\t\t\t\tputs \"Error Occur while inserting Record\"\n\t\t\tend\n\t\t\t\t#Closing the Connections\n\t\t\t@connection.close\n\t\t\t@statement.close\n\t\trescue Exception => e\n\t\t\tputs e.message\n\t\tend\n\tend",
"def add_student(first_name, last_name, birthdate)\n @conn.exec(\"INSERT INTO students_db (first_name, last_name, birthday) VALUES ('#{first_name}', '#{last_name}', '#{last_name}', '#{birthdate}');\")\nend",
"def create\n @contact = Contact.new(params[:contact])\n @contact.user = User.find(session[:userid])\n # @contact = @user.contact.create(params[:contact])\n if params[:keyword].present?\n @new = Contact.new(:first_name => params[:keyword])\n @new.save\n redirect_to @contact\n end\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n sql = \"INSERT INTO #{self.table_name_for_insert} (#{self.col_names_for_insert}) VALUES (#{self.values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{self.table_name_for_insert}\")[0][0]\n end",
"def insert(name)\n CONN.execute(\"INSERT INTO artits(name) VALUES(?)\", name)\nend",
"def insert\n DATABASE.execute(\"INSERT INTO boards (title,description) VALUES ('#{@title}', '#{@description}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def add_contact(ownnick, person)\n return ret_fail('can not add yourself') if person == ownnick #you cant add yourself !\n\n usr = User.first(:nickname=>person)\n return ret_fail('no such user') if usr == nil #user does not exist !\n\n ownusr = User.first(:nickname => ownnick) #get own record to get the contact list\n return ret_fail('already in list') if ownusr.contacts.first(:userid => usr.id) != nil\n\n c = ownusr.contacts.new\n c.userid = usr.id\n puts usr.id\n puts c.userid\n c.authgiven = 'f'\n c.save\n\n return ret_success\nend",
"def save()\n if(@cus_id && @cus_id != 0) #if the row already exists\n update()\n return true\n else\n if(! Customer.check_if_name_exists(@cus_name))\n insert()\n return true\n else\n return false\n end\n end\n end",
"def add(options={})\n column_names = options.keys\n values = options.values\n \n CONNECTION.execute(\"INSERT INTO #{self.table_name} (#{column_names.join(\", \")}) VALUES (#{values.to_s[1...-1]});\")\n \n id = CONNECTION.last_insert_row_id\n options[\"id\"] = id\n \n self.new(options)\n end",
"def insert_record_if_new(name, type, ttl, content)\n record = records_table.filter(:domain_id => domain.id, :name => name, :type => type, :content => content).first\n insert_record(name, type, ttl, content) unless record\n end",
"def save\n sql = <<-SQL\n INSERT INTO #{table_name_for_insert} (#{col_names_for_insert})\n VALUES (#{values_for_insert})\n SQL\n\n DB[:conn].execute(sql)\n # need to assign .id here because does not have id when instantiated, but now has one via its database\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def add_activity(db, name)\n\tdb.execute(\"INSERT INTO activities (name) VALUES (?)\", [name])\nend",
"def create_employee(database, first_name, last_name, wage, title, last_four_ssn, business_id)\n database.execute(\"INSERT INTO employees (first_name, last_name, wage, title, last_four_ssn, business_id) VALUES (?, ?, ?, ?, ?, ?)\", [first_name, last_name, wage, title, last_four_ssn, business_id])\nend",
"def insert(value)\n # YOUR WORK HERE\n end",
"def create\r\n if self.id.nil? && connection.prefetch_primary_key?(self.class.table_name)\r\n self.id = connection.next_sequence_value(self.class.sequence_name)\r\n end\r\n\r\n quoted_attributes = attributes_with_quotes\r\n\r\n statement = if quoted_attributes.empty?\r\n connection.empty_insert_statement(self.class.table_name)\r\n else\r\n \"INSERT INTO #{self.class.quoted_table_name} \" +\r\n \"(#{quoted_column_names.join(', ')}) \" +\r\n \"VALUES(#{quoted_attributes.values.join(', ')})\"\r\n end\r\n\r\n self.id = connection.insert(statement, \"#{self.class.name} Create\",\r\n self.class.primary_key, self.id, self.class.sequence_name)\r\n\r\n @new_record = false\r\n id\r\n end",
"def add_contact\n\t\tprint \"First Name: \".pink\n\t\tfirst_name = gets.chomp\n\t\tprint \"Last Name: \".pink\n\t\tlast_name = gets.chomp\n\t\tprint \"Email :\".pink\n\t\temail = gets.chomp\n\t\tprint \"Note :\".pink\n\t\tnote = gets.chomp #could use a hash but it is not ideal - if you need a cutstom piece of data to be repeated you need to create a new class for that method to call on\n\n\t\tcontact = Contact.new(first_name, last_name, email, note)\n\t\t@rolodex.add_contact(contact)\n\n\tend",
"def create_student(db, name, address, age, program)\n\tdb.execute(\"INSERT INTO school (name, address, age, program) VALUES (?, ?, ?, ?)\", [name, address, age, program])\nend",
"def add_contact(contact_info)\n self.refresh_access_token!\n\n contact = OpenStruct.new({\n first_name: contact_info[:first_name],\n last_name: contact_info[:last_name],\n phone: contact_info[:phone]\n })\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'contact.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new, {\n contact: contact,\n user: self\n })\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/contacts/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n @response.status == 201\n end",
"def add_student(first_name, last_name, birthdate)\n @conn.exec(\"INSERT INTO students (first_name, last_name, birthdate) VALUES ('#{first_name}', '#{last_name}', '#{birthdate}');\")\nend",
"def add_student(first_name, last_name, birthdate)\n @conn.exec(\"INSERT INTO students (first_name, last_name, birthdate) VALUES ('#{first_name}', '#{last_name}', '#{birthdate}');\")\nend",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade) VALUES (?, ?)\n SQL\n\n DB[:conn].execute(sql, @name, @grade)\n @id = DB[:conn].execute('SELECT last_insert_rowid() FROM students')[0][0]\n self\n end",
"def add_subject(database, name)\r\n\tdatabase.execute(\"INSERT INTO subjects (name) VALUES (?)\", [name])\r\nend",
"def insert(value)\n #YOUR WORK HERE\n end",
"def addClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact)\n\t\tid = \"0\"\n\t\tunless @sqlQuery.nil? then\n\t\t\tid = @sqlQuery.insertClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact,tel_contact)\n\t\telse\n\t\t\tputs \"SqlQuery wasn't created : database update cannot be performed\"\n\t\tend\n\t\t@clients.addClient(id, raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) # synchronize local object with DB\n\tend",
"def save\n if self.id\n self.update\n else\n sql_insert = 'INSERT INTO students (name, grade) VALUES (?, ?)'\n DB[:conn].execute(sql_insert, @name, @grade)\n\n sql_select_last = 'SELECT last_insert_rowid() FROM students'\n @id = DB[:conn].execute(sql_select_last)[0][0]\n end\n end"
] |
[
"0.6945833",
"0.66643983",
"0.66426486",
"0.65783554",
"0.65502375",
"0.652647",
"0.6502897",
"0.6468677",
"0.64677274",
"0.64457864",
"0.64041525",
"0.6390677",
"0.63866675",
"0.6381132",
"0.633995",
"0.6336467",
"0.63266736",
"0.63254476",
"0.63178056",
"0.6316364",
"0.62450624",
"0.6218417",
"0.6211899",
"0.6199563",
"0.61857903",
"0.61849076",
"0.6178041",
"0.61755866",
"0.61575747",
"0.6151583",
"0.6121572",
"0.60989434",
"0.6091739",
"0.6084814",
"0.6083605",
"0.60737073",
"0.6063354",
"0.6061308",
"0.60559136",
"0.60541135",
"0.60498416",
"0.6042754",
"0.6019612",
"0.60177153",
"0.6012159",
"0.6008008",
"0.5980552",
"0.5971017",
"0.59504724",
"0.5931866",
"0.5928906",
"0.59268653",
"0.5926066",
"0.59244287",
"0.5892646",
"0.5889877",
"0.58721834",
"0.5871144",
"0.58594066",
"0.5856376",
"0.58526605",
"0.58496845",
"0.58496845",
"0.5841278",
"0.584027",
"0.58369654",
"0.5834938",
"0.582438",
"0.58198804",
"0.5814283",
"0.58114517",
"0.5809388",
"0.5808223",
"0.58065563",
"0.5805523",
"0.58054733",
"0.5797126",
"0.5792122",
"0.579077",
"0.5789895",
"0.57881147",
"0.5786959",
"0.57849866",
"0.57840055",
"0.5776458",
"0.5773076",
"0.5769968",
"0.5767992",
"0.57675683",
"0.57664704",
"0.57628155",
"0.5762359",
"0.5762254",
"0.5758135",
"0.5758135",
"0.57534826",
"0.5752701",
"0.5751377",
"0.5746395",
"0.57455033"
] |
0.69711155
|
0
|
updating the database row mapped to the Contact instance.
|
def update
sql = "UPDATE contacts SET name = ?, phone_number = ?, address = ?, email = ? WHERE id = ?"
DB[:conn].execute(sql, name, phone_number, address, email, id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @contact = current_user.contacts.find(params[:id])\n @contact.update_attributes(params[:contact])\n end",
"def update fields\n self.contact = @nimble.put \"contact/#{self.id}\", { fields: fields }\n return nil unless self.contact\n self\n end",
"def contact_update(handle, fields)\n fields = contact_prepare(fields)\n fields[:handle] = handle\n query 'contact-modify', fields\n end",
"def update_contact_in_salesforce\n \tsf = Salesforce::API.connect_to_salesforce\n \tcontact_id = self.sf_contact_id\n \tsf.update(\n \"Contact\",\n Id: \"#{contact_id}\",\n Name: \"#{self.first_name}\",\n Email: \"#{self.email}\",\n )\n end",
"def update\n @contact = Contact.find(params[:id])\n \n if @contact.update_attributes(params[:contact])\n redirect_to contacts_url, notice: 'Contact was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n if @contact.update_attributes(params[:contact])\n redirect_to contacts_path, notice: '联系人更新成功'\n else\n render action: \"edit\"\n end\n end",
"def update_contact\n @contact = Contact.find(params[:id])\n @contact.update(params[:contact])\n redirect \"/contacts/#{@contact.id}\"\nend",
"def update\r\n\t\t@contact = current_user.contacts.find(params[:id])\r\n\r\n\t\tif @contact.update(contact_params)\r\n\t\t\tredirect_to @contact\r\n\t\telse\r\n\t\t\trender 'edit'\r\n\t\tend\r\n\tend",
"def update\n @contact = current_user.contact\n if @contact.update_attributes(params[:contact])\n redirect_to admin_jobs_path, notice: 'Informacion de contacto actualizada satisfactoriamente.'\n else\n render action: \"edit\"\n end\n end",
"def update\n check_fields\n sql = \"UPDATE #{table} SET #{to_update_record_str} WHERE id=#{@id}\"\n Database.transaction(sql)\n @log.debug \"Record[#{self}] is updated on Table[#{table}]\"\n end",
"def update\n @contact = Contact.find(params[:id])\n #raise @contact.inspect\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(admin_contacts_url, :notice => 'Contact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n \n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(@resource, :notice => 'Contact was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n if @contact.update_attributes(params[:contact])\n flash[:notice] = @contact.name + \" was successfully updated.\"\n redirect_to crm_path\n else\n @title = \"Edit \" + @contact.name\n render 'edit'\n end\n end",
"def update\n @contact_detail.update(contact_detail_params)\n @contact_details = ContactDetail.all\n @contact_detail = ContactDetail.new \n end",
"def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_contact(contact)\n raise \"contact_id or contact_number is required for updating contacts\" if contact.contact_id.nil? and contact.contact_number.nil?\n save_contact(contact)\n end",
"def update\n @contact = @current_affiliate_group.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n flash[:notice] = 'Contact was successfully updated.'\n format.html { redirect_to(@contact) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = @business.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(contact_params || {})\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_update(item)\n debug \"item update\"\n row = @contacts_rows[item.jid]\n unless row\n add_item_to_roster(item)\n row = @contacts_rows[item.jid]\n end\n fill_model_values_for_item item, row\n end",
"def update!(**args)\n @contact = args[:contact] if args.key?(:contact)\n end",
"def update\n @contact = Contact.find(params[:id])\n\n\n if @contact.update_attributes(params[:contact])\n flash[:notice] = 'Αποθήκευση μηνύματος.'\n\t\tredirect_to :action => :show \n else\n \trender :action => \"edit\" \n end\n\n end",
"def save\n if id\n Connection.conn.exec_params('UPDATE contacts SET name = $1, email = $2 WHERE id = $3::int;', [name,email,id])\n else\n pg_contact = Connection.conn.exec_params('INSERT INTO contacts (name,email) VALUES ($1, $2) RETURNING *;', [name,email])\n self.id = pg_contact[0][\"id\"]\n end\n self\n end",
"def update\n connection.update(\n \"UPDATE #{self.class.table_name} \" +\n \"SET #{quoted_comma_pair_list(connection, attributes_with_quotes)} \" +\n \"WHERE #{self.class.primary_key} = '#{id}'\",\n \"#{self.class.name} Update\"\n )\n end",
"def update\n if @contact.update(contact_params)\n fresh_when(@contact)\n render json: @contact, status: :ok, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end",
"def update\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n return\n end\n\n #really update the contacts\n contact = UrContact.find(params[:id])\n\n #can't dlete contact you don't own\n if contact.user_id != current_user.id then\n Rails.logger.error \"Attempt to update contact you don't own\"\n head :internal_server_error\n return\n end\n\n if contact.update_attributes(contact_params) then\n render json: contact\n else\n head :internal_server_error\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end",
"def update_user(user)\n contact = find(user.id)\n\n mapper.update(user, contact.attributes)\n end",
"def save(contact, attributes)\n attributes = map_attributes(mapping, attributes)\n\n contact.update_attributes(attributes)\n\n contact\n end",
"def update\n contact = Contact.find(params[:id])\n\n if contact.user_id == current_user.id\n contact.update_attributes(params[:contact])\n render json: contact\n else\n render text: \"That's not your contact!\"\n end\n end",
"def save\n MoxiworksPlatform::Contact.update(self.to_hash)\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @contact.update(contact_params)\n\t\t\t\tformat.html { redirect_to user_contact_path, notice: 'Contact was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @contact.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update_contact(companyId, id, model) path = \"/api/v2/companies/#{companyId}/contacts/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @old_contact = Contact.find(params[:id])\n @old_contact.status_lu_id = StatusLu.archived\n @old_contact.auditdate = Date.today.to_s\n @old_contact.audituser = session[:user].id\n @old_contact.save\n\n @contact = Contact.new(params[:contact])\n @contact.status_lu_id = StatusLu.active\n @contact.audituser = session[:user].id\n @contact.auditdate = Date.today\n @contact.createdate = Date.today\n @contact.createuser = session[:user].id\n @contact.preferred = nil if @contact.preferred == '0' # Ensuring that if the checkbox is not submiited this field is null\n\n @contactdetail = params[:contactdetail]\n\n if @contact.save\n @contactdetail.each_key do |key|\n contactdetail = Contactdetail.new\n contactdetail.key = key\n contactdetail.value = @contactdetail[key]\n contactdetail.contactid = @contact.contactid\n contactdetail.save\n end\n @msg = 'Contact successfully updated.'\n @msgClass = \"success-msg\"\n @refreshPageOnSave = false\n @closeDialog = true\n render :partial => \"common/refresh\", :layout => nil\n else\n @msg = 'Unable to update contact.'\n @msg_class = \"error-msg\"\n render :action => \"edit.html\"\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(@contact, :notice => 'Contact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n flash[:notice] = 'Contact was successfully updated.'\n format.html { redirect_to(@contact) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n update_custom_field_values\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # Because we're encrypting, just updating the old contact leaves a point of vulnerability at which the plaintext\n # details are in the database. To avoid that, destroy the old record and replace it with a new one, which is\n # encrypted before it ever hits the database.\n old_contact = Contact.find(params[:id])\n old_contact.destroy\n\n @contact = Contact.new(contact_params)\n @contact.id = params[:id]\n @contact.created_by = @current_user.id\n\n @contact = encrypt_contacts(@contact)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_contact = UserContact.find(params[:id])\n\n respond_to do |format|\n if @user_contact.update_attributes(params[:user_contact])\n format.html { redirect_to(@user_contact, :notice => 'UserContact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n flash[:notice] = 'Contact was successfully updated.'\n format.html { redirect_to(@contact)}\n format.xml { head :ok }\n \n else\n format.html { redirect_to :action => \"edit\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n find_contact\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n flash[:notice] = _('Contact was successfully updated.')\n format.html { redirect_to(customer_contact_url(:customer_id => @customer.id, :id => @contact.id)) }\n format.js { render :text => \"contact updated\", :layout => false }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"edit\", :layout => request.xhr? }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @crm_contact = CrmContact.find(params[:id])\n\n respond_to do |format|\n if @crm_contact.update_attributes(params[:crm_contact])\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n if @contact.update_attributes(params[:contact])\n response_message = {:message => \"Contact updated successfully.\", :contact => @contact}\n else\n response_message = {:message => \"Contact updation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end",
"def update!(**args)\n @device_contact_id = args[:device_contact_id] if args.key?(:device_contact_id)\n end",
"def update\n flash.clear\n begin\n @contact = Contact.find(params[:id])\n @contact.update_attribute(:updated_by, current_user.id)\n rescue ActiveRecord::RecordNotUnique => e\n if e.message =~ /for key 'index_emails_on_address'/\n email = e.message.scan(/Duplicate entry '(.*)' for key 'index_emails_on_address'.*/).flatten.first\n err = [\"the email address <strong>'#{h(email)}'</strong>\",\n \"Check the emails fields\"]\n else\n company = params[:contact][:company] || \"ERROR\"\n country = params[:contact][:country] || \"ERROR\"\n err = [\"the company <strong>\\\"#{h(company)}\\\"</strong> in the country: <strong>\\\"#{h(country)}\\\"</strong>\",\n \"Check the company, country, address and first name fields\"]\n end\n flash[:error] = <<EOL\n<h3>An error prevented the reccord from being saved (duplicate entry):</h3>\nSorry, #{h(err.first)} already exists in the database. Please take one of the following action:\n<ul>\n <li>#{h(err.last)}</li>\n <li>Do not create the contact, but find and update the already existing company using the search form on the main contact page</li>\n</ul>\nEOL\n end\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update #:nodoc:\n connection.update(\n \"UPDATE #{self.class.table_name} \" +\n \"SET #{quoted_comma_pair_list(connection, special_attributes_with_quotes(false))} \" +\n \"WHERE #{self.class.primary_key} = #{quote_value(id)}\",\n \"#{self.class.name} Update\"\n )\n end",
"def update_contact\n # hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.update_attributes(contact_params)\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact has successfully been updated!' }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact failed to be saved!' }\n format.json { render :contacts, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @raw_contact_info = args[:raw_contact_info] if args.key?(:raw_contact_info)\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render :edit, notice: 'Contact was successfully updated.' }\n format.json { render :edit, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_contact(contact)\n raise \"contact_id or contact_number is required for updating contacts\" if contact.contact_id.nil? and contact.contact_number.nil?\n \n request_xml = contact.to_xml\n response_xml = http_post(\"#{@xero_url}/contact\", request_xml, {})\n\n parse_response(response_xml, :request_xml => request_xml)\n end",
"def update\n @contact = CompanyContact.find(params[:id])\n if @contact.update_attributes(params[:company_contact])\n head :no_content\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end",
"def update\n if @contact.update(contact_params)\n flash[:notice] = \"Updated Contact\"\n # Set browser URL to /contacts/1\n headers['X-IC-SetLocation'] = contact_path(@contact)\n render action: :show, :layout => params['ic-request'].blank?\n else\n flash[:error] = \"Could not update Contact\"\n render action: :edit, :layout => params['ic-request'].blank?\n end\n end",
"def update\n flash.now[:notice] = 'Contact was successfully updated.' if @contact.update contact_params\n respond_with @contact, location: contacts_path\n end",
"def update_source_contact(id, data)\n update(\"sourceContacts\", id, data).first\n end",
"def update\n @contact_person = Contact.find(params[:format])\n @contact_person.v_contact_type = params[:contact][:v_contact_type] === \"Outsourcing Firm\" ? \"1\" : \"0\"\n @contact_person.e_status = params[:contact][:e_status] == \"Active\" ? 1 : 0\n @contact_person.update_attributes(contact_params)\n redirect_to contacts_path\n end",
"def update\n set_line = self.class.columns.map { |attr| \"#{attr} = ?\" }.join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values, self.id)\n UPDATE\n #{self.class.table_name} \n SET\n #{set_line}\n WHERE\n id = ?\n SQL\n end",
"def update_contact(id, params)\n put(\"contacts/#{id}\", contact: params)\n end",
"def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n flash[:notice] = @contact.errors.empty? ? \"Your Contact has not been updated\" : \"Your Contact has not been updated because: \" + @contact.errors.full_messages.to_sentence\n end\n end\n end",
"def update\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(contacts_url, :notice => t('contacts.was_updated.')) }\n format.json { head :ok }\n format.js { render 'success' }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n format.js { render 'failure' }\n end\n end\n end",
"def update!(**args)\n @contact = args[:contact] if args.key?(:contact)\n @contact_type = args[:contact_type] if args.key?(:contact_type)\n end",
"def update\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n if @crm_contact_info.update_attributes(params[:crm_contact_info])\n format.html { redirect_to @crm_contact_info, notice: 'Crm contact info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_contact.update(admin_contact_params)\n format.html { redirect_to admin_contacts_path, notice: mk_notice(@admin_contact, :id, 'Contact', :update) }\n format.json { render json: @admin_contact, status: :ok, location: admin_contacts_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n @contact.person_id = nil if params[:contact][:person_name].present?\n respond_to do |format|\n if @contact.update_attributes(params[:contact].merge(:updated_by => current_user.id))\n format.html { redirect_to client_contacts_path(@firm), :notice => \"#{ Contact.model_name.human } успешно изменен.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify_existing_contact\n self.to_contact.modify_existing_contact.to_contact\n end",
"def update\n @ad_contact = AdContact.find(params[:id])\n\n respond_to do |format|\n if @ad_contact.update_attributes(params[:ad_contact])\n format.html { redirect_to @ad_contact, notice: 'Ad contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contact\n if params[:action] == \"update\"\n @contact = Contact.find(params[:format]) \n else\n @contact = Contact.find(params[:id])\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n update_contact_category\n format.html { redirect_to contacts_url, notice: 'Contact was updated.' }\n format.json { render :index, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contact\n @contact = Contact.find_by(id: params[:id], user_id: current_user.id)\n end",
"def change_primary_contact\n Account.transaction do\n @account||=Account.find(params[:id])\n if request.get?\n @primary_contact = Contact.find(@account.primary_contact_id) if @account.primary_contact_id \n render :action=>:change_primary_contact, :layout =>false\n end\n if request.put?\n begin \n @account.update_attribute(:primary_contact_id, params[:new_account_contact][:id])\n rescue\n end \n flash[:notice] =\"Primary #{t(:text_contact)} #{t(:text_updated)} For #{@account.name}\"\n redirect_to :back\n end\n end\n end",
"def update_record\n record = Query.new(table)\n .index(primary_index[:name])\n .index_segments(primary_index_segments)\n .eq\n\n record.with_write_lock! do\n @dirty_attributes.each do |key, _|\n record.set_field(key, @attributes[key])\n end\n record.write!\n end\n\n @new_record, @dirty_attributes = false, {}\n return true\n end",
"def update\n @person_contact = PersonContact.find(params[:id])\n\n respond_to do |format|\n if @person_contact.update_attributes(params[:person_contact])\n format.html { redirect_to(@person_contact, :notice => 'Person contact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contacts_url, notice: 'Contact was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contact = Contact.find(params[:id])\n @volunteer = Volunteer.find(@contact.volunteer_id)\n @contact.last_edit_user_id = @current_user.id\n if @contact.update(contact_params)\n @volunteer.notes = params[:permanent_notes]\n @volunteer.save\n render html: '<body onload=\"window.close()\"></body>'.html_safe\n else\n volunteer_info_setup\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @case_contact.update(case_contact_params)\n format.html { redirect_to @case_contact, notice: 'Case contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_contact }\n else\n format.html { render :edit }\n format.json { render json: @case_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site_contact = SiteContact.find(params[:id])\n\n respond_to do |format|\n if @site_contact.update_attributes(params[:site_contact])\n format.html { redirect_to @site_contact, notice: 'Site contact was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @corp_contact = CorpContact.find(params[:id])\n @corp_contact.updated_by = current_user.id if !current_user.nil?\n # Should use attachment from drag&drop?\n if !$attachment.avatar.blank? && $attachment.updated_at > @corp_contact.updated_at\n @corp_contact.avatar = $attachment.avatar\n end\n\n respond_to do |format|\n if @corp_contact.update_attributes(params[:corp_contact])\n $attachment.destroy\n $attachment = nil\n format.html { redirect_to @corp_contact,\n notice: (crud_notice('updated', @corp_contact) + \"#{undo_link(@corp_contact)}\").html_safe }\n format.json { head :no_content }\n else\n $attachment.destroy\n $attachment = Attachment.new\n format.html { render action: \"edit\" }\n format.json { render json: @corp_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n eqs = self.class.columns.map { |column| \"#{column} = ?\"}.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, id)\n UPDATE\n #{self.class.table_name}\n SET\n #{eqs}\n WHERE\n id = ?\n SQL\n end",
"def update_shared_contact(_contact, _entity)\n _contact.attributes = { first_name: first_name, last_name: last_name, company: company,\n fiscal_id: fiscal_id, street_type_id: street_type_id, street_name: street_name,\n street_number: street_number, building: building, floor: floor,\n floor_office: floor_office, zipcode_id: zipcode_id, town_id: town_id,\n province_id: province_id, country_id: country_id, phone: phone,\n extension: _entity.extension, fax: fax, cellular: cellular,\n email: email, shared_contact_type_id: 3, region_id: region_id,\n organization_id: organization_id, updated_by: updated_by }\n _contact.save\n return _contact\n end",
"def update!(**args)\n @contact_id = args[:contact_id] if args.key?(:contact_id)\n @device_id = args[:device_id] if args.key?(:device_id)\n end",
"def update!(**args)\n @contact_id = args[:contact_id] if args.key?(:contact_id)\n @device_id = args[:device_id] if args.key?(:device_id)\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contactaction = Contactaction.find(params[:id])\n\n respond_to do |format|\n if @contactaction.update_attributes(params[:contactaction])\n format.html { redirect_to @contactaction, :notice => 'Contactaction was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contactaction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end",
"def update\n @contact.assign_attributes contacts_person_params\n\n company = Contacts::Company.new(contacts_company_params.merge(user: current_user)) if params[:contacts_company]\n @contact.company = company if @contact.company.nil? && !company.nil? && company.valid?\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: t('controllers.contacts.people.update.success') }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contact\n @contact = Contact.find(params[:contact_id])\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6964599",
"0.68154514",
"0.6657135",
"0.6624171",
"0.65670824",
"0.6502961",
"0.6457798",
"0.6424585",
"0.6363718",
"0.6337078",
"0.6334092",
"0.63161355",
"0.6309855",
"0.62971133",
"0.6266566",
"0.6264457",
"0.6253173",
"0.62450945",
"0.62222177",
"0.6220779",
"0.62010205",
"0.6192068",
"0.6182982",
"0.61653274",
"0.6159754",
"0.61479115",
"0.6147388",
"0.6122609",
"0.60932416",
"0.6078255",
"0.6078134",
"0.6072043",
"0.60619146",
"0.60619146",
"0.60619146",
"0.60611165",
"0.6050773",
"0.60490733",
"0.60467905",
"0.60452294",
"0.602918",
"0.6024084",
"0.6009807",
"0.60008776",
"0.59928435",
"0.5986484",
"0.5975659",
"0.59625095",
"0.5950017",
"0.5948225",
"0.59443057",
"0.5936603",
"0.59324473",
"0.5920814",
"0.59188163",
"0.5916277",
"0.5916106",
"0.59086245",
"0.5903174",
"0.58905184",
"0.5888604",
"0.58668846",
"0.58526516",
"0.5852245",
"0.5852127",
"0.5849069",
"0.5842679",
"0.58426136",
"0.58332825",
"0.58322024",
"0.5828556",
"0.58276075",
"0.58177686",
"0.5808566",
"0.58048946",
"0.5803476",
"0.5793003",
"0.578668",
"0.5782096",
"0.5780127",
"0.57762283",
"0.57608056",
"0.57598656",
"0.575975",
"0.5758006",
"0.57565594",
"0.5745727",
"0.5745727",
"0.57272375",
"0.57271546",
"0.5724467",
"0.57213813",
"0.5715674",
"0.5714564",
"0.5714564",
"0.5714564",
"0.5714564",
"0.5714564",
"0.5714564",
"0.5714564"
] |
0.70957
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.