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 /stories/1/chapters/all GET /stories/1/all
def showall session[:adult] = true if params[:adult] if @story.is_adult? && !can_see_adult? @page_title = 'Warning' render 'users/adulttemp' else @page_title = @story.title render :show, locals: { chapters: @story.get_chapters } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @chapters = Chapter.all\n end", "def index\n @course = Course.find(params[:course_id])\n @chapters = @course.chapters\n end", "def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end", "def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @chapters }\n end\n end", "def index\n chapters = @project.chapters.all\n render json: { chapters: chapters }\n end", "def index\n @stories = Story.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end", "def index\n @story_pages = StoryPage.all\n end", "def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end", "def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end", "def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end", "def index\n @chapters = @book.chapters\n @chapter_list = @chapters.to_json(:only => [:name, :chapter_start, :chapter_end]) if @chapters.present?\n respond_to do |format|\n format.html\n format.json { \n render_json(@chapter_list)\n }\n end\n end", "def index\n @flow_chapters = FlowChapter.all\n end", "def index\n @stories = Story.all\n render json: @stories, root: false\n end", "def index\n @ab_chapters = AbChapter.all\n end", "def get_chapters\n @subject = Subject.find(params[:id]) unless params[:id].blank?\n if current_user.is?(\"EA\") or current_user.is?(\"IA\")\n list = @subject.chapters.map {|u| Hash[value: u.id, name: u.name]}\n else\n chapter_ids = ContentUserLayout.get_unlocked_chapters(@subject,current_user)\n if !chapter_ids.nil?\n list = @subject.chapters.where(:id=>chapter_ids).map {|u| Hash[value: u.id, name: u.name]}\n else\n list = @subject.chapters.map {|u| Hash[value: u.id, name: u.name]}\n end\n end\n render json: list\n end", "def index\n @chapters = Chapter.find(:all)\n\n respond_to do |format|\n format.xml { render :xml => @chapters }\n format.js { render :json => @chapters }\n end\n end", "def index\n @audio_stories = AudioStory.all\n end", "def index\n @chapter_views = ChapterView.all\n end", "def index\n @stories = Story(:all, :order => 'value')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end", "def index\n @stories = Story.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories }\n end\n end", "def show\n @chapter = Chapter.find(params[:id])\n @topics = @chapter.topics.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end", "def stories ; @stories || get_stories ; end", "def stories ; @stories || get_stories ; end", "def get_stories\n api_url = \"#{CONFIG[:api_location]}/projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| Story.new(:story => story, :project_id => @id, :token => @token)}\n end", "def index\n\t@story = Story.find(params[:story_id])\n @characters = Character.all\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", ''\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def get_stories\n api_url = \"#{CONFIG[:api_url]}projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| TrackR::Story.new(:story => story, :project_id => @id, :token => @token)}\n end", "def index\n @stories = Story.order(params[:sort]).page(params[:page]).per(10)\n end", "def index\n @books = current_user.books.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books.map { |e| e.chapters }.flatten }\n end\n end", "def index\n @user_stories = UserStory.all\n end", "def index\n render json: Story.all\n end", "def index\n page = 1\n page = params[:page] if params[:page]\n @stories = Story.paginate :page => page, :order => 'created_at DESC', :per_page => 5\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end", "def index\n @chapter_authors = ChapterAuthor.all\n end", "def show\n @subject = Subject.find(params[:id])\n @chapters = @subject.chapters.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject }\n end\n end", "def show\n @stories = Story.find_by(id: params[:id])\n \n end", "def index\n @stories = Story.sorted\n end", "def index\n @story_tellers = StoryTeller.all\n end", "def chapters\n @body.xpath('./a:chapter', a: NS)\n end", "def index\n @dpi_chapters = DpiChapter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dpi_chapters }\n end\n end", "def index\n @stories = Story.all\n authorize! :index, @story\n end", "def task_stories(id, options = {})\n request(:get, \"tasks/#{id}/stories\", options)\n end", "def index\n @news_stories = NewsStory.all\n end", "def index\n @project_stories = ProjectStory.all\n end", "def get_mashable_stories\n\n\ts = JSON.load(RestClient.get('http://mashable.com/stories.json')) \n\ts[\"hot\"].map do |story|\n\ts = {story: story[\"title\"], category: story[\"channel\"]}\n\tget_upvotes(story)\n\tdisplay_new_story\n\tstory\n\tend\nend", "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end", "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end", "def stories\n @stories.keys.each_with_index.map { |story_name, i| get_story(story_name, i) }\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 index\n @stories = Story.where(user_id: current_user.id)\n end", "def index\n @page_title = 'Stories'\n if params[:tag_id]\n @obj = Tag.find_by_name(params[:tag_id])\n elsif params[:character_id]\n @obj = Character.find(params[:character_id])\n elsif params[:source_id]\n @obj = Source.find(params[:source_id])\n else\n @base_stories = Story.all\n unless can_see_adult?\n @base_stories = Story.non_adult(@base_stories)\n .or(stories.where(user: current_user_or_guest))\n end\n end\n if @obj.present?\n @base_stories = @obj.visible_stories(current_user_or_guest)\n # @page_title.prepend(@obj.name + ' ')\n @page_title += \" in \\\"#{@obj.name}\\\"\"\n end\n\n @base_stories = do_filtering(@base_stories)\n # exact_filters = {}\n # fuzzy_filters = {}\n #\n # %i[tags sources characters].each do |tp|\n # exact_filters[tp] = params[\"filter_#{tp}\".to_sym]\n # fuzzy_filters[tp] = params[\"other_#{tp}\".to_sym]\n # end\n # @base_stories = Story.tsc_wrapper(@base_stories, exact_filters, true)\n # @base_stories = Story.tsc_wrapper(@base_stories, fuzzy_filters, false)\n\n # query_params = {\n # tags: params[:other_tags],\n # sources: params[:other_sources],\n # characters: params[:other_characters]\n # }\n # @base_stories = Story.tsc_search(@base_stories, query_params)\n # @base_stories = Story.tsc_search(@base_stories, params)\n\n # sort_by = params[:sort_by] ? params[:sort_by].to_sym : :updated_at\n # sort_dir = params[:sort_direction] ? params[:sort_direction].to_sym : :desc\n\n # if sort_by == :num_comments\n # @stories = @base_stories.left_outer_joins(:comments)\n # .select('stories.*, COUNT(comments.*)')\n # .group('stories.id')\n # .order(\"COUNT(comments.*) #{sort_dir}\")\n # else\n # @stories = @base_stories.order(sort_by => sort_dir)\n # end\n\n # unless can_see_adult?\n # # @base_stories = @base_stories.reject(&:is_adult?)\n # @base_stories = Story.non_adult(@base_stories)\n # end\n\n @stories = Story.s_sort(@base_stories, params[:sort_by], params[:sort_direction])\n @stories = @stories.paginate(page: params[:page], per_page: 10)\n end", "def show\n redirect_to sections_story_path(params[:id])\n # @story = Story.find_by_id(params[:id])\n\n # respond_to do |format|\n # format.html #show.html.erb\n # format.json { render json: @story }\n # end\n end", "def pages\n @chapters.current.pages\n end", "def show\n @manga = Manga.find(params[:id])\n @chapters = @manga.ordered_chapters.page(params[:page]).per 15\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manga }\n end\n end", "def index\n #unless current_user.is?(\"ET\")\n #@chapters = Chapter.page(params[:page])\n #else\n #@chapters = current_user.chapters.page(params[:page])\n #end\n @chapters = case current_user.role.name\n when 'Edutor Admin'\n Chapter.page(params[:page])\n when 'Institute Admin'\n #Chapter.by_boards_and_published_by_assets(current_user.institution.board_ids,current_user.institution.publisher_ids).page(params[:page])\n Chapter.where(:board_id=>current_user.institution.board_ids).page(params[:page])\n when 'Center Representative'\n #Chapter.by_boards_and_published_by_assets(current_user.center.board_ids,current_user.institution.publisher_ids).page(params[:page])\n Chapter.where(:board_id=>current_user.center.board_ids).page(params[:page])\n when 'Teacher'\n current_user.chapters.page(params[:page])\n else\n Chapter.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end", "def stories\n project.stories_in_iteration(self)\n end", "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end", "def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end", "def index\n render json: @chapter.reposoitories, status: :ok\n end", "def index\n\t\t@username = \"funkyb\" #added a username\n\t\t@righthere_rightnow = Time.now\n\n\n\t\t#@stories = [\"Google\", \"Yahoo\", \"kobestarr\", \"iTunes\", \"dancing spiderman\"]\n\n\t\t#set the variables @stories to all of the records in our story db\n\n\t\t#@stories = Story.order(\"votes_count desc, title asc\" )\n\n\n\t\t# if it has ?sort=recent in the url then sort by \n\t\t# created at\n\t\t# if it has nothing then do the popular ones\n\n\t\tif params[:sort] == \"recent\"\n\t\t\t#sort by created_at\n\t\t\t@stories = Story.order(\"created_at desc\" )\n\n\t\telsif params[:sort] == \"featured\"\n\n\t\t\t#sort by featured\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t.order(\"is_featured desc, title asc\" )\n\n\t\t\t\t\n\t\telse\n\t\t\t#sort by popular\n\t\t\t@stories = Story.order(\"votes_count desc, title asc\" )\n\t\tend\n\n\t\t# this is where we are gonna add the pagination\n\t\t# overwrite the @stories variable with a paginated version\n\t\t# infor from documentation User.page(7).per(50)\n\t\t@stories = @stories.page(params[:page]).per(4)\n\t\t\n\tend", "def chapters\n\t\t@chapters ||= parse_chapters(@contents)\n\tend", "def show\n @chapter = @book.chapters.find(params[:id])\n # @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_book_chapter_verses_url(@book_series, @collection, @book, @chapter) }\n format.json { head :no_content }\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @chapter }\n end\n end", "def show\n @chapter = @book.chapters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chapter }\n end\n end", "def index\n @stories = @current_tag ? Story.tagged_with(@current_tag.name) : @current_channel.stories\n @stories = @stories.in_category(@current_category) if @current_category\n @stories = @stories.paginate(:page => params[:page], :per_page => 20)\n\n @feed_title = @current_category ? \"All #{@current_category.name} Stories \" : \"All Stories \"\n @feed_title += @current_tag ? \"Tagged with #{@current_tag.name}\" : \"in #{@current_channel.name} Channel\"\n\n @site_description += ',' + @stories.map(&:title).join(',')\n \n respond_to do |format|\n format.html\n format.atom do \n render :layout => false\n end\n end\n end", "def index\n @in_play_stories = current_user.in_play_stories\n @friends_stories = current_user.finished_friends_stories\n @top_stories = current_user.top_stories\n @your_stories = current_user.finished_own_stories\n end", "def index\n @stories = Story.all.page(params[:page]).per(30)\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def index\r\n @story = Story.find(params[:story_id])\r\n @nodes = @story.nodes\r\n end", "def show\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n @lessons = @course.lessons.all\n @courses = Course.all\n @pages = @lesson.pages.all\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lesson }\n end\n end", "def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end", "def stories_list\n @stories.values\n end", "def index\n\t\t@username = \"Timothy\"\n\t\t@now = Time.now\n\n\t\t#@stories = [\"google\",\"facebook\", \"twitter\", \"linkedin\" , \"Andy\"]\n\n\n\t\t#set the variable stories\n\t\t#to all the records in our story database table\n\n\t\t# @stories = Story.order(\"created_at desc\")\n\n\t\t# @stories = Story.order(\"votes_count desc, title asc\")\n\n\t\t# if it has ?sort=recent in the url\n\t\t# sort by created at\n\t\t# if it has nothing, then do the popular ones\n\n\t\tif params[:sort] == \"recent\"\t\n\t\t\t# sort by created at, \n\n\n\t\t\t@stories = Story.order(\"created_at desc\")\n\n\t\telsif params[:sort]==\"featured\"\n\n\t\t\t# sort by featured\n\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t\t\t.order(\"is_featured desc, title asc\")\n\t\t\t\t\n\n\t\telse\n\n\t\t\t@stories = Story.order(\"votes_count desc, title asc\")\n\t\t\t# sort by popular\n\t\tend\n\n\t\t# add in my pagination\n\n\t\t# overwrite the @stories variable with a paginated version\n\n\t\t@stories = @stories.page(params[:page]).per(3)\n\n\tend", "def index\n @q = Story.search(params[:q])\n @stories = @q.result(:distinct => true).by_flagged(false).order(\"created_at DESC\").all(:conditions => { :draft => false }).to_a\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stories }\n end\n end", "def show\n redirect_to @story.first_chapter\n end", "def show\n @book = Book.find(params[:id])\n @chapters = @book.chapters\n wl = WhatLanguage.new(:all)\n @lang = \"\"\n @book.chapters.each do\n @lang = wl.language(@book.chapters[0].content).to_s.capitalize\n end\n\n do_response @book.to_json(:include => :chapters)\n end", "def index\n\t\t@username = \"trev\"\n\t\t@now = Time.now\n\n\t\t# @stories = [\"Google\", \"Facebook\", \"Twitter\", \"blinq\"]\n\n\t\t#set the variable @stories to all the records in our database table\n\t\t#@stories = Story.order(\"votes_count desc, title asc, created_at desc\")\n\n\n\t\t#if it has ?sort=recet in the url, then sort by created at, if it has nothing sort by popular ones\n\n\t\tif params[:sort] == \"recent\"\n\t\t\t#sort by created at\n\t\t\t@stories = Story.order(\"created_at desc\")\n\n\t\telsif params[:sort] == \"featured\"\n\n\t\t\t#sort by featured\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t\t\t.order(\"id_featured desc, title asc\")\n\t\t\t\t\n\n\t\telse\n\t\t\t#sort by popular\n\t\t\t@stories = Story.order(\"votes_count desc, title asc, created_at desc\")\n\t\tend\n\n\t\t#add in my pagination\n\t\t#overwrite the @stories variabl with a paginated version\n\t\t@stories = @stories.page(params[:page]).per(20)\n\n\n\tend", "def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end", "def index # Renvoie les story avec plus de 5 votes à la vue pour affichage en utilisant la classe Story (<activerecord)\n fetch_stories 'votes_count >= 5' #:order peut prendre ASC, DESC, ou RANDOM()\n end", "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def index\n @chapter_events = ChapterEvent.all\n end", "def report_get_chapters(report)\n\t\t\tpost = {'token' => @token, 'report' => report}\n\t\t\tchapters = nessus_http_request('chapter/list',post)\n\t\t\treturn Nokogiri::XML.parse(chapters).xpath('//chapter').children.map(&:text)\n\t\t\treturn chapters\n\t\tend", "def show\n render json: @story, root: false\n end", "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end", "def index\n @primary_tags = get_primary_tags\n\n @desires, @total_chapters = get_desires( params[:tag], params[:page], params[:chapter])\n session[:current_desires_chapter] = params[:chapter]\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\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 @story = Story.all(:include => :role, :conditions => {:stories => { :id => params[:id] } })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end", "def index\n @stories = Story.scoped\n\n @stories = @stories.where(:user_id => params[:user]) if params[:user].present? \n @stories = @stories.where(:state => params[:state]) if params[:state].present? \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories.all }\n end\n end", "def show\n @exercises = Exercise.where(\"chapter_id = ?\", params[:id]).order(:number)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end", "def stories\n @stories ||= Stories.new(data)\n end", "def index\n @favorite_chapters = FavoriteChapter.all\n end", "def show\n @course = Course.find(params[:course_id])\n @chapters = @package.chapters.all\n end" ]
[ "0.71855634", "0.7164543", "0.7064827", "0.7064827", "0.6989245", "0.6989245", "0.6989245", "0.6989245", "0.6989245", "0.6989245", "0.69878286", "0.6817308", "0.6810551", "0.6763531", "0.67417914", "0.6710561", "0.6710561", "0.66886646", "0.6666882", "0.66522294", "0.6633266", "0.66199875", "0.65776074", "0.654804", "0.653203", "0.65190405", "0.6517124", "0.6507541", "0.64843273", "0.64769894", "0.64769894", "0.64726156", "0.6470042", "0.6447119", "0.64342767", "0.63758105", "0.6370283", "0.6359781", "0.63546926", "0.62902415", "0.6273929", "0.6269951", "0.6259633", "0.62251705", "0.62044716", "0.6198122", "0.6197436", "0.6196559", "0.6190181", "0.6177133", "0.6172044", "0.6150841", "0.6150841", "0.6150007", "0.6139912", "0.61308783", "0.6098547", "0.6053565", "0.60483766", "0.60322756", "0.6028604", "0.601246", "0.60020065", "0.59843326", "0.59843326", "0.59756225", "0.5970279", "0.5962829", "0.594676", "0.5946277", "0.59432596", "0.594203", "0.593983", "0.59348714", "0.5928642", "0.59230983", "0.59222466", "0.59159416", "0.5911775", "0.59060013", "0.59039605", "0.5882835", "0.5882435", "0.5874986", "0.5869938", "0.5869611", "0.5869611", "0.5863392", "0.58601135", "0.5859547", "0.5858801", "0.58482903", "0.58478713", "0.5846202", "0.5828795", "0.5823248", "0.5817968", "0.58162385", "0.58099157", "0.58080155" ]
0.59180814
77
POST /stories POST /stories.json
def create @story = Story.new(story_params) if @story.valid? current_user.stories << @story redirect_to @story else # @errors = @story.errors.messages render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @story = Story.new(story_params)\n if @story.save\n render json: @story, status: :ok\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to stories_path }\n format.json { render :json => @story }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n story_params = {\n title: params[:title],\n summary: params[:summary],\n }\n @story = Story.new(story_params)\n\n if @story.save\n # render :show, status: :created, location: @story\n render json: @story\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end", "def create\n # Used to make sure a created story is given to current_user\n @story = current_user.stories.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.json { render json: @story, root: false, status: :created, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = @game.stories.build story_params\n story_creator = StoryCreator.new @story\n\n respond_to do |format|\n if story_creator.save\n format.json do\n render status: :created, location: game_story_url(@story.game, @story)\n end\n format.html do\n redirect_to game_path(@game)\n end\n else\n format.json do\n render status: :unprocessable_entity\n end\n format.html do\n redirect_to game_path(@game)\n end\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, :notice => 'Story was successfully created.' }\n format.json { render :json => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, :notice => 'Story was successfully created.' }\n format.json { render :json => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story }\n else\n format.html { render action: 'new' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story \n successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to admin_story_path(@story), notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @yourstory = Yourstory.new(params[:yourstory])\n\n respond_to do |format|\n if @yourstory.save\n format.html { redirect_to @yourstory, notice: 'Yourstory was successfully created.' }\n format.json { render json: @yourstory, status: :created, location: @yourstory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @yourstory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params)\n @story.user = current_user\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params)\n @book = @story.book\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to story_path(@story), notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new, book_id: @book.id }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n\t\t@title = \"Nowy news\"\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Wiadomość utworzono pomyślnie.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to(@story, :notice => 'Story was successfully created.') }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_story(attributes = {})\n api_url = URI.parse(\"#{CONFIG[:api_location]}/projects/#{@id}/stories\")\n query_string = attributes.map { |key, value| \"story[#{key}]=#{CGI::escape(value)}\"}.join('&')\n response = Net::HTTP.start(api_url.host, api_url.port) do |http|\n http.post(api_url.path, query_string.concat(\"&token=#{@token}\"))\n end\n\n story = (Hpricot(response.body)/:story)\n Story.new(:story => story, :project_id => @id, :token => @token)\n end", "def index\n @stories = Story.all\n render json: @stories, root: false\n end", "def create_story(attributes = {})\n api_url = URI.parse(\"#{CONFIG[:api_url]}projects/#{@id}/stories\")\n query_string = attributes.map { |key, value| \"story[#{key}]=#{CGI::escape(value)}\"}.join('&')\n begin\n http = Net::HTTP.new(api_url.host, api_url.port)\n http.use_ssl = true\n response, data = http.post(api_url.path, query_string.concat(\"&token=#{@token}\"))\n\n raise ResponseError, \"Wrong response code\" unless response.code.to_i == 200\n story = (Hpricot(response.body)/:story)\n TrackR::Story.new(:story => story, :project_id => @id, :token => @token)\n rescue ResponseError => e\n print \"Got response code [#{response.code}]:\\t\"\n puts response.message\n raise\n end\n end", "def create\n @story = Story.new(params[:story])\n @story.user = User.first\n @story.state = State.first\n @story.project = Project.first\n\n if @story.save\n if request.xhr?\n render 'new_story'\n else\n redirect_to root_path\n end\n end\n end", "def create\n @story = Story.create()\n url_string = Base64.encode64 @story.id.to_s\n \n story_id = @story.id\n render :json => story_id\n \n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n format.html { redirect_to(@story) }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sprintstory = Sprintstory.new(params[:sprintstory])\n\n respond_to do |format|\n if @sprintstory.save\n format.html { redirect_to [:alumno, @sprintstory], notice: 'Sprintstory was successfully created.' }\n format.json { render json: @sprintstory, status: :created, location: @sprintstory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sprintstory.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 create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n\n @snippet = @story.snippets.create(params[:story][:snippet].permit(:content))\n\n format.html { redirect_to root_path, notice: 'Story was successfully created.' }\n #format.html { redirect_to @story, notice: 'Story was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @story }\n else\n format.html { render action: 'new' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @news_story = NewsStory.new(news_story_params)\n\n respond_to do |format|\n if @news_story.save\n format.html { redirect_to @news_story, notice: 'News story was successfully created.' }\n format.json { render :show, status: :created, location: @news_story }\n else\n format.html { render :new }\n format.json { render json: @news_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n @changed << @story.id\n\n format.html { redirect_to stories_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @story, status: :created, location: @story }\n else\n @edited << 'new'\n @expanded << 'new'\n\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'story'; flash.discard }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to admin_stories_path, notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.page_content', count: 1))}\n else\n set_date\n format.html { render :new }\n end\n end\n end", "def index\n @stories = Story.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories }\n end\n end", "def create\n @story_page = StoryPage.new(story_page_params)\n\n respond_to do |format|\n if @story_page.save\n format.html { redirect_to @story_page, notice: 'Story page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @story_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_input_mashable(stories)\n response = JSON.parse(RestClient.get 'http://mashable.com/stories.json')\n response['new'].each do |story|\n story[:title] = story['title']\n story[:category] = story['channel']\n stories << {s_title: story[:title], s_story: story[:category]} \n end \n stories\nend", "def create\n # story_params[:creator] = current_user.id\n @story = Story.new(story_params)\n @story.developer_id = current_user.id\n\n respond_to do |format|\n @story.developer_id = current_user.id\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pic_story = current_user.pic_stories.new(params[:pic_story])\n\n respond_to do |format|\n if @pic_story.save\n format.html { redirect_to @pic_story, notice: 'Pic story was successfully created.' }\n format.json { render json: @pic_story, status: :created, location: @pic_story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pic_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story_status = StoryStatus.new(params[:story_status])\n\n respond_to do |format|\n if @story_status.save\n format.html { redirect_to @story_status, :notice => 'Story status was successfully created.' }\n format.json { render :json => @story_status, :status => :created, :location => @story_status }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.new(params[:story])\n @story.user_id = current_user.id\n\n if !params[:draft].nil? \n @story.draft = true\n end\n \n if @story.save && @story.update_contents(params[:story][:content])\n respond_to do |format|\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.js { render :js => \"window.location.href = ('#{story_path(@story)}');\"}\n format.json { render json: @story, status: :created, location: @story }\n end\n else\n @errormsg = @story.errors.to_a.each { |e| e.capitalize }.join(\". \")\n story_errors(@errormsg)\n end\n end", "def create\n \n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n format.html { redirect_to product_story_url(@product,@story) }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to [:admin,@story], notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.story', count: 1))}\n else\n format.html { render :new }\n end\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def create\n @text_story = current_user.text_stories.new(params[:text_story])\n @text_story.save\n\n respond_to do |format|\n if @text_story.save\n format.html { redirect_to profile_index_url, notice: 'Text story was successfully created.' }\n format.json { render json: @text_story, status: :created, location: @text_story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n render json: Story.all\n end", "def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to stories_path, notice: @story.is_public? ? t('app.msgs.story_add_moderate_public') : t('app.msgs.story_add_moderate') }\n format.json { render json: @story, status: :created, location: @story }\n else\n @css.push('stories.css')\n @genders = [ [t('gender.F'), 'F'], [t('gender.M'), 'M'] ]\n @types = DiscriminationType.sorted.map{|x| [x.name, x.id]}\n\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def stories\n @stories ||= Stories.new(data)\n end", "def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end", "def create\n @project_story = ProjectStory.new(project_story_params)\n\n respond_to do |format|\n if @project_story.save\n format.html { redirect_to @project_story, notice: 'Project story was successfully created.' }\n format.json { render :show, status: :created, location: @project_story }\n else\n format.html { render :new }\n format.json { render json: @project_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def story_params\n params.require(:story).permit(:title, :content, :status)\n end", "def create\n # validation the user\n if params[:story][:user_id] && User.find(params[ :story ][ :user_id ]) != current_user\n raise \"This operation could be done\"\n end\n\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story }\n else\n format.html { render action: 'new' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_story(board, params)\n params[\"position\"] = board.stories.empty? ? 1 : board.stories.length + 1\n return new_story(board.id, params).merge({\"id\" => get_uuids.first})\n end", "def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end", "def new\n @sprintstory = Sprintstory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sprintstory }\n end\n end", "def create\n @topic = Topic.find(params[:topic_id])\n @story = @topic.stories.build(params[:story])\n @story.views = 0\n\n if logged_in?\n @story.user_id = current_user.id\n @story.update_popularity\n if @story.save\n if @story.is_link?\n current_user.activity_items.create(\n :story_id => @story.id,\n :topic_id => @topic.id,\n :kind => ActivityItem::CreateLinkType)\n else\n current_user.activity_items.create(\n :story_id => @story.id,\n :topic_id => @topic.id,\n :kind => ActivityItem::CreatePostType)\n end\n\n if params[:redirect]\n redirect_to(params[:redirect])\n else\n flash[:notice] = 'Story was successfully created.'\n redirect_to(@story)\n end\n else\n flash[:alert] = 'Story could not be saved.'\n logger.debug \"[DEBUG] Story couldn't be saved, errors: \" + @story.errors.to_s\n render :action => 'new'\n end\n else\n flash[:alert] = \"You need to login to post stories!\"\n logger.debug \"[DEBUG] User didn't log on before trying to create a story.\"\n render :action => 'new'\n end\n end", "def create\n @story = Story.new(story_params.merge(user_id: current_user.id))\n\n @story.save\n redirect_to stories_path\n end", "def create\n\t\t@story = Story.new(story_params)\n\n\t\tif @story.save\n\t\t\tflash[:success] = \"Thanks for sharing\"\n\t\t\tredirect_to story_path(@story)\n\t\telse\n\t\t\tflash[:error] = \"Oops, sorry, something went wrong\"\n\t\t\trender :new\n\t\tend\n\tend", "def create\n @story = current_user.stories.new(params[:story])\n @story.permalink = create_permalink(@story.title)\n\n @story.permalink += \"-#{Time.now.to_i}\" if Story.find_by_permalink(@story.permalink)\n\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n format.html { redirect_to :action => :show, :id => @story.permalink }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n @categories = Category.find(:all)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def stories() @stories = Stories.new end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def index\n @stories = Story.all\n end", "def create\n if current_user\n story = current_user.stories.new(story_params)\n story.save\n redirect_to story_path(story)\n else\n redirect_to login_path\n end\n # @story.user = current_user\n # redirect_to story_path(story)\n end", "def create\n @story = Story.new(params[:story])\n @story.domain_id = session[:domain].id\n @story.bright_text_application_id = session[:br_application_id]\n @story.user_id = session[:user_id]\n @story.story_authors.build().user_id = session[:user_id]\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n format.json { render json: @story, status: :created, location: @story }\n format.js\n else\n #debugger\n format.json{ render :json=> @story.errors }\n# format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n\n\n end", "def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end", "def create\n @story = Story.new(params[:story])\n @story.title[0]=@story.title[0].capitalize\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Nowa baśń została dodana.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @new_story = @game.stories.build\n end", "def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end", "def create\n @storyboard = Storyboard.new(params[:storyboard])\n\n respond_to do |format|\n if @storyboard.save\n format.html { redirect_to @storyboard, notice: 'Storyboard was successfully created.' }\n format.json { render json: @storyboard, status: :created, location: @storyboard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @storyboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # make story be a blank story but with fields filled in\n @story = Story.new(story_params)\n\n # save this story to the database IF validations pass\n if @story.save\n # let's add a notification to the user to let them know\n # it's been saved to the db\n flash[:success] = \"Yay, you've submitted a story\"\n # make this go back to the homepage\n redirect_to root_path\n else\n render 'new'\n end\n end", "def create\n @story_comment = StoryComment.new(params[:story_comment])\n @story_comment.user_id = self.current_user.id\n @story = Story.find(params[:story_comment][:story_id])\n @story_comment.story_id = @story.id\n respond_to do |format|\n if @story_comment.save\n format.html { redirect_to @story, :notice => 'Story comment was successfully created.' }\n format.json { render :json => @story_comment, :status => :created, :location => @story_comment }\n else\n format.html { render @story , :notice => 'error' }\n format.json { render :json => @story_comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @story_choice = StoryChoice.new(params[:story_choice])\n\n respond_to do |format|\n if @story_choice.save\n format.html { redirect_to @story_choice, notice: 'Story choice was successfully created.' }\n format.json { render json: @story_choice, status: :created, location: @story_choice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story_choice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @yourstory = Yourstory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yourstory }\n end\n end", "def save\n @@stories << self \n end", "def story_params\n params.require(:story).permit(:title, :summary)\n end", "def create\n @trip_story = TripStory.new(params[:trip_story])\n\n respond_to do |format|\n if @trip_story.save\n flash[:notice] = 'TripStory was successfully created.'\n format.html { redirect_to(@trip_story) }\n format.xml { render :xml => @trip_story, :status => :created, :location => @trip_story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip_story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def story_params\r\n params.require(:story).permit(:date, :story_type, :description, :person_id)\r\n end", "def create\n @story = Story.new(story_params)\n @story.project_id = params[:project_id] if current_user.projects.where(id: params[:project_id])\n @story.state = \"to do\"\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story.project, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @story = Story.new\n @roles = Role.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def create\n @social = Story.create(social_params)\n\n redirect_to social_path(@social)\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end", "def story_params\n params.require(:story).permit(:headline, :body, :image)\n end", "def show\n render json: @story, root: false\n end", "def create\n\t#create story set\n story_set = StorySet.new(name: \"storyset#{StorySet.count + 1}\")\n story_set.domain_id = session[:domain].id\n story_set.bright_text_application_id = session[:br_application_id]\n story_set.user_id = current_user.id\n #create story\n @story = Story.new(user_id: current_user.id, story_set: story_set, name: params[:story][:name], category: params[:story][:category], description: \"\", descriptor: \"\")\n @story.name = \"Apology#{Story.where(:user_id => current_user.id).count + 1}\" if @story.name.blank?\n @story.domain_id = session[:domain].id\n @story.bright_text_application_id = session[:br_application_id]\n @story.user_id = session[:user_id]\n @story.story_authors.build().user_id = session[:user_id]\n #set category details\n @story.story_set.story_set_category.domain_id = session[:domain].id\n @story.story_set.story_set_category.application_id = session[:br_application_id]\n @story.story_set.story_set_category.user_id = current_user.id\n @story.rank = 0\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n format.json { render json: @story, status: :created}\n format.js\n else\n #debugger\n format.json{ render :json=> @story.errors }\n# format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @audio_story = AudioStory.new(audio_story_params)\n\n respond_to do |format|\n if @audio_story.save\n format.html { redirect_to @audio_story, notice: 'Audio story was successfully created.' }\n format.json { render :show, status: :created, location: @audio_story }\n else\n format.html { render :new }\n format.json { render json: @audio_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @story = Story.new\n\t\t@title = \"Nowy news\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def get_stories\n api_url = \"#{CONFIG[:api_location]}/projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| Story.new(:story => story, :project_id => @id, :token => @token)}\n end", "def create\n\t\t@story = Story.new(story_params)\n\n\t\tif @story.save\n\n\t\t\t#lets add a flash of content to tell the user we've added this\n\t\t\tflash[:success] = \"You've added a link! yeeehaaa!!!!\"\n\n\t\t\t#go back to homepage\n\t\t\tredirect_to root_path\n\n\t\telse\n\t\t\trender \"new\"\n\n\n\n\t\tend\n\n\tend", "def create\n @story_image = StoryImage.new(story_image_params)\n\n respond_to do |format|\n if @story_image.save\n format.html { redirect_to @story_image, notice: 'Story image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story_image }\n else\n format.html { render action: 'new' }\n format.json { render json: @story_image.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.772964", "0.76415455", "0.7610398", "0.7505145", "0.74521095", "0.7439946", "0.7439946", "0.73842067", "0.73842067", "0.73842067", "0.7328209", "0.7292121", "0.7206045", "0.69638777", "0.6957411", "0.692288", "0.6892234", "0.68875116", "0.6872017", "0.6849194", "0.6840574", "0.6811445", "0.68036234", "0.67816", "0.6775205", "0.6765651", "0.6711131", "0.6701762", "0.665583", "0.66263855", "0.65896004", "0.6565658", "0.6516478", "0.6513372", "0.64847445", "0.6480912", "0.6443523", "0.64294314", "0.64288986", "0.6411624", "0.6410646", "0.6410646", "0.6410646", "0.6410646", "0.6377441", "0.6371173", "0.6371173", "0.6371173", "0.6371173", "0.6368733", "0.63681036", "0.63253903", "0.6325229", "0.6314178", "0.62991333", "0.6287308", "0.62754196", "0.62725466", "0.624936", "0.6249308", "0.62431574", "0.6240405", "0.6235713", "0.6230363", "0.62153995", "0.6205952", "0.6205952", "0.6205952", "0.6205952", "0.6205952", "0.6205952", "0.6203963", "0.61975116", "0.6186763", "0.6185042", "0.61820024", "0.61799955", "0.6176388", "0.6162632", "0.6139586", "0.6133527", "0.61053437", "0.6097853", "0.60651714", "0.604961", "0.6039826", "0.6035629", "0.6026045", "0.60192364", "0.6018801", "0.60169435", "0.6015309", "0.60096264", "0.60056734", "0.5998939", "0.59952706", "0.5992781", "0.59876096", "0.5982057", "0.59796214" ]
0.67087775
27
PATCH/PUT /stories/1 PATCH/PUT /stories/1.json
def update #we do this here rather than in the model because we don't want timestamps #to update when tag implications are changed old_holder = {} assocs = %w[tag character source] # old_tags = @story.tag_ids.sort assocs.each do |assoc| old_holder[assoc] = @story.send((assoc + '_ids').to_sym).sort end pars = story_params if @story.update(pars) assocs.each do |assoc| #need to do this to force Rails to refresh from the DB @story.send((assoc + 's').to_sym).reload new_holder = @story.send((assoc + '_ids').to_sym).sort @story.touch unless old_holder[assoc] == new_holder end redirect_to @story, notice: 'Story was successfully updated.' else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n @story.update_attributes(params[:story])\n respond_with @story\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @story.update(story_params)\n head :no_content\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n \n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Zmiany zostały zapisane.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n #@story = Story.friendly.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n if @yourstory.update_attributes(params[:yourstory])\n format.html { redirect_to @yourstory, notice: 'Yourstory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yourstory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to story_url(@story), notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit, book_id: @book.id }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to(@story, :notice => 'Story was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story.project, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n \n # If the user publishes it, mark the story as published\n if params[:draft].nil?\n @story.draft = false\n end\n\n if @story.update_attributes(params[:story]) && @story.update_contents(params[:story][:content])\n respond_to do |format|\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.js { render :js => \"window.location.href = ('#{story_path(@story)}');\"}\n format.json { head :no_content }\n end\n else\n @errormsg = @story.errors.to_a.each { |e| e.capitalize }.join(\". \")\n story_errors(@errormsg)\n end\n end", "def update\n respond_to do |format|\n if @story.update_attributes(params[:story])\n flash[:notice] = 'Story was successfully updated.'\n @changed << @story.id\n \n format.html { redirect_to stories_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n else\n @edited << @story.id\n @expanded << @story.id\n\n format.html { render action: 'edit', template: 'shared/edit' }\n format.js { render 'story'; flash.discard }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n flash[:notice] = 'Story was successfully updated.'\n format.html { redirect_to(@story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n flash[:notice] = 'Story was successfully updated.'\n format.html { redirect_to(@story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to project_path(id: @story.project_id), notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n story = Story.find(params[:id])\n authorize story # check policies/story_policy.rb for auth rules\n\n if story_params[:tags]\n story_params[:tags].each do |tag|\n # If tag exists then use existing tag name\n if Tag.exists?(tag)\n story.tags << Tag.find_by_name(tag[\"name\"])\n else\n story.tags << Tag.new(tag)\n end\n end\n end\n\n if story.update(story_params.except(:tags)) && story.save\n response_with('Story successfully saved', 200)\n else\n response_with('Could not update story', 400)\n end\n end", "def update\n @story = Story.find(params[:id])\n\t\t@title = \"Edycja newsa\"\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Wiadomość zapisano pomyślnie.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story_status = StoryStatus.find(params[:id])\n\n respond_to do |format|\n if @story_status.update_attributes(params[:story_status])\n format.html { redirect_to @story_status, :notice => 'Story status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n if @sprintstory.update_attributes(params[:sprintstory])\n format.html { redirect_to [:alumno, @sprintstory], notice: 'Sprintstory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprintstory.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 update\n @pic_story = current_user.pic_stories.find(params[:id])\n\n respond_to do |format|\n if @pic_story.update_attributes(params[:pic_story])\n format.html { redirect_to @pic_story, notice: 'Pic story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pic_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n flash[:notice] = 'Story was successfully updated.'\n format.html { redirect_to product_story_url(@product,@story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @text_story = current_user.text_stories.find(params[:id])\n\n respond_to do |format|\n if @text_story.update_attributes(params[:text_story])\n format.html { redirect_to @text_story, notice: 'Text story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to [:admin,@story], notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.story', count: 1))}\n else\n format.html { render :edit }\n end\n end\n end", "def edit\n render json: UserTrainingStory.find(params[:id])\n end", "def update\n @story_choice = StoryChoice.find(params[:id])\n\n respond_to do |format|\n if @story_choice.update_attributes(params[:story_choice])\n format.html { redirect_to @story_choice, notice: 'Story choice was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story_choice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @news_story.update(news_story_params)\n format.html { redirect_to @news_story, notice: 'News story was successfully updated.' }\n format.json { render :show, status: :ok, location: @news_story }\n else\n format.html { render :edit }\n format.json { render json: @news_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to admin_stories_path, notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.page_content', count: 1))}\n else\n set_date\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n @story.working_article.update_story_content(@story) if @story.selected\n format.html { redirect_to @story, notice: '기사가 수정되었습니다!' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trip_story = TripStory.find(params[:id])\n\n respond_to do |format|\n if @trip_story.update_attributes(params[:trip_story])\n flash[:notice] = 'TripStory was successfully updated.'\n format.html { redirect_to(@trip_story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip_story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story_page.update(story_page_params)\n format.html { redirect_to @story_page, notice: 'Story page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @story_modality.update(story_modality_params)\n format.html { redirect_to @story_modality, notice: 'Story modality was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story_modality.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # find the story based on the url\n @story = Story.find(params[:id])\n end", "def update\n if (story = Story.find(params[:id])).update_attributes(params[:story])\n redirect_to story, :notice => \"Story was successfully updated.\"\n else\n render :edit, :notice => \"История не была обновлена\"\n end\n end", "def update\n\n\t# @story = Story.find(params[:id])\n\n\tif @story.update(story_params)\n\n\t\tflash[:success] = \"All good , all updated\"\n\n\t\tredirect_to story_path(@story)\n\t\t\n\t\telse\n\n\t\t\trender \"edit\"\n\n\tend\n\nend", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:link])\n flash[:notice] = 'Story was successfully updated.'\n format.html { redirect_to(@story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_story.update(project_story_params)\n format.html { redirect_to @project_story, notice: 'Project story was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_story }\n else\n format.html { render :edit }\n format.json { render json: @project_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_story(story)\n post(\"v1/fundraising/pages/#{@short_name}\", {:basic_auth => true}.merge({:storySupplement => story}))\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hike_story = HikeStory.find(params[:id])\n\n respond_to do |format|\n if @hike_story.update_attributes(params[:hike_story])\n flash[:notice] = 'HikeStory was successfully updated.'\n format.html { redirect_to(@hike_story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hike_story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @storyboard = Storyboard.find(params[:id])\n\n respond_to do |format|\n if @storyboard.update_attributes(params[:storyboard])\n format.html { redirect_to @storyboard, notice: 'Storyboard was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storyboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @story = Story.find(params[:story_id])\n\n @frame = @story.frames.find(params[:id])\n\n respond_to do |format|\n if @frame.update_attributes(frame_params)\n format.html { redirect_to story_path(@story), notice: 'Frame was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\n\t\t# @story = Story.find(params[:id])\n\n\t# actually update the database \n\n\tend", "def update\n @story = Story.find(params[:id])\n @application = find_application\n if(@story.brighttext==false)\n params[:story][:description] = \"\"\n end\n \n @story_author = StoryAuthor.where(:user_id=>session[:user_id], :story_id=>@story.id).first\n if(@story_author.nil?)\n @story.story_authors.build().user_id = session[:user_id] \n end\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.xml { render :xml => @story, :status => :updated, :location => @story }\n format.json { render json: @story, status: :updated, location: @story }\n format.js\n else\n logger.debug \"#{@story}\" \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n format.json{ render :json=> {:success => \"false\"} }\n format.js\n end\n end\n end", "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.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 @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story_teller.update(story_teller_params)\n format.html { redirect_to @story_teller, notice: 'Story teller was successfully updated.' }\n format.json { render :show, status: :ok, location: @story_teller }\n else\n format.html { render :edit }\n format.json { render json: @story_teller.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end", "def edit\n @story = Story.find(params[:id])\n end", "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hunter_backstory.update(hunter_backstory_params)\n format.html { redirect_to @hunter_backstory, notice: t('.success') }\n format.json { render :show, status: :ok, location: @hunter_backstory }\n else\n format.html { render :edit }\n format.json { render json: @hunter_backstory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource_response(@headline, headline_params)\n end", "def update\n row = UserTrainingStory.find_by_id( params[:id] )\n is_ok = row && row.update_attributes( user_training_story_params )\n render( status: (is_ok ? :ok : 400), json: { success: is_ok } )\n end", "def update\n respond_to do |format|\n if @audio_story.update(audio_story_params)\n format.html { redirect_to @audio_story, notice: 'Audio story was successfully updated.' }\n format.json { render :show, status: :ok, location: @audio_story }\n else\n format.html { render :edit }\n format.json { render json: @audio_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit \n\n\t# @story = Story.find(params[:id])\n\n\nend", "def update\n respond_to do |format|\n if @headline.update(headline_params)\n format.html { redirect_to @headline, notice: 'Headline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @headline.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 @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 @story = Story.find(params[:id])\n\n # update the record with the form data\n if @story.update(story_params)\n flash[:success] = \"You've updated a story\"\n redirect_to story_path(@story)\n else\n render 'edit'\n end\n end", "def update\n\t\t# @story = Story.find(params[:id])\n\n\t\tif @story.update(story_params)\n\n\t\t\tflash[:success] = \"HOLLA! you've updated this story!\"\n\n\t\t\tredirect_to story_path(@story)\n\t\t\n\t\telse\n\n\t\t\trender \"edit\"\n\n\t\tend\n\n\tend", "def update\n respond_to do |format|\n if @story_image.update(story_image_params)\n format.html { redirect_to @story_image, notice: 'Story image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @sentence = Sentence.find(params[:id])\n\n success = @sentence.add_sentence(params[:sentence])\n @story.save if success\n\n respond_to do |format|\n if success && @story.update_attributes(params[:story])\n if @story.finished\n format.html { redirect_to story_path(@story) }\n else\n format.html { redirect_to stories_path, notice: 'Story was successfully updated.' }\n format.json { head :ok }\n end\n else\n format.html { render \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @storyline_tag.update(storyline_tag_params)\n format.html { redirect_to @storyline_tag, notice: 'Storyline tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @storyline_tag }\n else\n format.html { render :edit }\n format.json { render json: @storyline_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @news_hit.update(news_hit_params)\n format.html { redirect_to @news_hit, notice: 'News hit was successfully updated.' }\n format.json { render :show, status: :ok, location: @news_hit }\n else\n format.html { render :edit }\n format.json { render json: @news_hit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n if params[:remove_photo].present?\n @story.update(photo: nil)\n end\n if params[:remove_fr_photo].present?\n @story.update(fr_photo: nil)\n end\n format.html { redirect_to edit_admin_story_path(@story), notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_story.update(user_story_params)\n format.html { redirect_to [@project, @theme, @user_story], notice: 'User story atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @user_story }\n else\n format.html { render :edit }\n format.json { render json: @user_story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n if @gist.update_attributes(params[:gist])\n format.html { redirect_to @gist, notice: 'Gist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_story( args )\n return if args[:bundle].nil?\n return unless args[:bundle].valid?\n\n if args[:bundle].ruleset.rules.empty?\n app.alert(title: 'Entschuldigung',\n message: 'Diese Story kann nicht bearbeitet werden.')\n else\n StartScreen.next_story = args[:bundle]\n StartScreen.next_screen = :story_editor\n StartScreen.last_screen = :story_list\n rmq.screen.open_root_screen(StartScreen)\n end\n end", "def update\n @storylink = Storylink.find(params[:id])\n\n respond_to do |format|\n if @storylink.update_attributes(params[:storylink])\n format.html { redirect_to @storylink, notice: 'Storylink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storylink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @interesting_thing.update(interesting_thing_params)\n format.html { redirect_to student_interesting_things_path(@student), notice: 'Interesting thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @interesting_thing }\n else\n format.html { render :edit }\n format.json { render json: @interesting_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end" ]
[ "0.7267746", "0.7099299", "0.7072093", "0.7072093", "0.706577", "0.70631224", "0.7057944", "0.7057944", "0.69516414", "0.6916157", "0.6916157", "0.6916157", "0.6916157", "0.69078785", "0.68319225", "0.68319225", "0.68319225", "0.68319225", "0.68319225", "0.6823768", "0.67423356", "0.6701193", "0.6686298", "0.6641912", "0.66327655", "0.66235834", "0.65956086", "0.65956086", "0.65837413", "0.65371686", "0.642389", "0.6420959", "0.64163536", "0.6397688", "0.63896894", "0.6385306", "0.6346414", "0.6264665", "0.62338513", "0.61960924", "0.6110833", "0.6110159", "0.60733265", "0.60688186", "0.6057693", "0.60570526", "0.6056543", "0.60358214", "0.60348445", "0.6025248", "0.6018788", "0.60161185", "0.600883", "0.5992071", "0.5982221", "0.59769654", "0.5961569", "0.59561366", "0.5947318", "0.5942934", "0.59370947", "0.59320134", "0.59294415", "0.59255296", "0.59014434", "0.58943105", "0.5870501", "0.58696353", "0.586731", "0.58673096", "0.58653235", "0.58652306", "0.58619905", "0.58548766", "0.58316845", "0.582974", "0.5821019", "0.5819165", "0.5819103", "0.5807496", "0.5802538", "0.5797485", "0.57949173", "0.57859534", "0.57858443", "0.57858443", "0.5770101", "0.5769417", "0.5760981", "0.5756094", "0.5754594", "0.5753709", "0.57490367", "0.5746054", "0.57451755", "0.5734699", "0.5734224", "0.5733168", "0.57311", "0.57309526", "0.57300436" ]
0.0
-1
DELETE /stories/1 DELETE /stories/1.json
def destroy @story.destroy redirect_to stories_path # respond_to do |format| # format.html { redirect_to stories_url, notice: 'Story was successfully destroyed.' } # format.json { head :no_content } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_story(id)\n @client.raw('delete', \"/content/stories/#{id}\")\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @yourstory = Yourstory.find(params[:id])\n @yourstory.destroy\n\n respond_to do |format|\n format.html { redirect_to yourstories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n #@story = Story.friendly.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to(stories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to(stories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to(stories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_stories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to admin_stories_path, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to project_stories_url, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n\n client.delete(\"/stories/#{gid}\") && true\n end", "def destroy\n @storyline = Storyline.find(params[:id])\n @storyline.destroy\n\n respond_to do |format|\n format.html { redirect_to storylines_url }\n format.json { head :no_content }\n end\n end", "def delete_story(story)\n if story.is_a?(Story)\n api_url = URI.parse(\"#{CONFIG[:api_location]}/projects/#{@id}/stories/#{story.id}\")\n elsif story.is_a?(Integer) || story.to_i.is_a?(Integer)\n api_url = URI.parse(\"#{CONFIG[:api_location]}/projects/#{@id}/stories/#{story}\")\n else\n raise ArgumentError, \"Should receive a story id or a Story object.\"\n end\n response = Net::HTTP.start(api_url.host, api_url.port) do |http|\n http.delete(api_url.path, {\"X-TrackerToken\" => @token})\n end\n story = (Hpricot(response.body)/:story)\n Story.new(:story => story, :project_id => @id, :token => @token)\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to stories_url, notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n head :no_content\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\t\t@title = \"Usuwanie newsa\"\n\n respond_to do |format|\n format.html { redirect_to stories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @story_status = StoryStatus.find(params[:id])\n @story_status.destroy\n\n respond_to do |format|\n format.html { redirect_to story_statuses_url }\n format.json { head :ok }\n end\n end", "def delete_story(story)\n if story.is_a?(TrackR::Story)\n api_url = URI.parse(\"#{CONFIG[:api_url]}projects/#{@id}/stories/#{story.id}\")\n elsif story.is_a?(Integer) || story.to_i.is_a?(Integer)\n api_url = URI.parse(\"#{CONFIG[:api_url]}projects/#{@id}/stories/#{story}\")\n else\n raise ArgumentError, \"Should receive a story id or a TrackR::Story object.\"\n end\n begin\n http = Net::HTTP.new(api_url.host, api_url.port)\n http.use_ssl = true\n response, data = http.delete(api_url.path, {\"X-TrackerToken\" => @token})\n raise ResponseError, \"Wrong response code\" unless response.code.to_i == 200\n story = (Hpricot(response.body)/:story)\n TrackR::Story.new(:story => story, :project_id => @id, :token => @token)\n rescue ResponseError => e\n print \"Got response code [#{response.code}]:\\t\"\n puts response.message\n raise\n end\n end", "def destroy\n @sprintstory = Sprintstory.find(params[:id])\n @sprintstory.destroy\n\n respond_to do |format|\n format.html { redirect_to sprintstories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to book_stories_url(book_id: @book.id), notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_story_version(id)\n @client.raw('delete', \"/content/story-versions/#{id}\")\n end", "def delete_story(story_id)\n delete_request(\"stories/#{story_id}\")\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to admin_stories_url, notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.story', count: 1))}\n end\n end", "def destroy\n @story = Story.find_by_id(params[:id])\n \n @story.destroy\n if @story.destroyed? \n flash[:success] = \"Item was removed from the tree.\" \n else \n flash[:error] = \"Removing data failed [\" + @story.errors.full_messages.to_sentence + \"]\" \n end\n \n respond_to do |format| \n format.html { redirect_to stories_url }\n format.json { head :ok } \n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to project_path(id: @story.project_id), notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_stories_url(@product)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @story_page.destroy\n respond_to do |format|\n format.html { redirect_to story_pages_url }\n format.json { head :no_content }\n end\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\t@story = Story.find(params[:id])\n\n\n\t@story.destroy\n\n\tflash[:success] = \"Deleted \"\n\n\tredirect_to root_path\n\n\nend", "def destroy\n story_part_id = @story_part.id\n @story_part.destroy\n render :json => story_part_id\n end", "def destroy\n @trip_story = TripStory.find(params[:id])\n @trip_story.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_stories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hike_story = HikeStory.find(params[:id])\n @hike_story.destroy\n\n respond_to do |format|\n format.html { redirect_to(hike_stories_url) }\n format.xml { head :ok }\n end\n end", "def test_can_delete_a_story\n # skip\n story = Story.create\n delete \"/story_delete/#{:id}\"\n # response = last_response.body\n # binding.pry\n assert_equal false, Story.exists?(story.id)\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n flash[:success] = \"You've deleted the #{@story.title} story\"\n redirect_to root_path\n end", "def destroy\n @page = params[:page]\n @story = Story.find(params[:id])\n @story.destroy \n \n respond_to do |format|\n format.html { redirect_to(\"/admin/stories?filter=\" + @story.story_set_id.to_s + \"&page=\" + @page.to_s) }\n format.xml { head :ok }\n end\n end", "def destroy\n @story.destroy\n\n flash[:notice] = 'Story was successfully deleted.'\n\n respond_to do |format|\n format.html { redirect_to stories_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => \"user\", :action => \"welcome\" }\n flash[:message]=\"Story was successfully deleted\"\n format.json { head :ok }\n end\n end", "def destroy\n @storylink = Storylink.find(params[:id])\n @storylink.destroy\n\n respond_to do |format|\n format.html { redirect_to storylinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pic_story = current_user.pic_stories.find(params[:id])\n @pic_story.destroy\n\n respond_to do |format|\n format.html { redirect_to pic_stories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to project_path({:id => current_user.project_id}), notice: 'Story was successfully destroyed.' }\n format.json { head :no_content }\n end\n # redirect_to project_path({:id => current_user.project_id})\n end", "def destroy\n @news_story.destroy\n respond_to do |format|\n format.html { redirect_to news_stories_url, notice: 'News story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @storyboard = Storyboard.find(params[:id])\n @storyboard.destroy\n\n respond_to do |format|\n format.html { redirect_to storyboards_url }\n format.json { head :ok }\n end\n end", "def destroy\n @story_choice = StoryChoice.find(params[:id])\n @story_choice.destroy\n\n respond_to do |format|\n format.html { redirect_to story_choices_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @audio_story.destroy\n respond_to do |format|\n format.html { redirect_to audio_stories_url, notice: 'Audio story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story_image.destroy\n respond_to do |format|\n format.html { redirect_to story_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.html { redirect_to admin_stories_url, notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.page_content', count: 1))}\n end\n end", "def destroy\n\n\t\t# @story = Story.find(params[:id])\n\n\t\t@story.destroy\n\n\t\tflash[:success] = \"You've deleted this story\"\n\n\t\tredirect_to root_path\n\n\tend", "def destroy\n @hunter_backstory.destroy\n respond_to do |format|\n format.html { redirect_to hunter_backstories_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @story_comment = StoryComment.find(params[:id])\n @story_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to story_comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project_story.destroy\n respond_to do |format|\n format.html { redirect_to project_stories_url, notice: 'Project story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @storyline_tag.destroy\n respond_to do |format|\n format.html { redirect_to storyline_tags_url, notice: 'Storyline tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story_modality.destroy\n respond_to do |format|\n format.html { redirect_to story_modalities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @text_story = current_user.text_stories.find(params[:id])\n @text_story.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t#@story = Story.find(params[:id])\n\n\t\t@story.destroy\n\n\t\tflash[:success] = \"its a goner\"\n\n\t\tredirect_to root_path\n\tend", "def destroy\n @story = @review.story\n @review.destroy\n redirect_to story_url(@story), notice: 'Review was successfully destroyed.'\n end", "def destroy\n @stash = Stash.find(params[:id])\n @stash.destroy\n\n respond_to do |format|\n format.html { redirect_to stashes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @study = Study.find(params[:id])\n @study.destroy\n\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to(shots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Story.find(params[:id]).destroy\n redirect_to :controller => 'stories', :notice => 'История №' + params[:id].to_s + ' была успешно запушена в космос)'\n end", "def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t# @story = Story.find(params[:id])\n\n\t\t@story.destroy\n\n\t\tflash[:success] = \"you BASTARD! - you just deleted iT\"\n\n\t\tredirect_to root_path\n\t\t\n\tend", "def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @news_hit.destroy\n respond_to do |format|\n format.html { redirect_to news_hits_url, notice: 'News hit was successfully destroyed.' }\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 @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to [:alumno, Story.where(:id => @task.story_id).first] }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story = Story.find(params[:id])\n if @story.destroy\n flash[:notice] = \"Artigo apagado\"\t\t\t\n else\t\t\t\t\t\t\t\t\t\t\t\n flash[:error] = \"Houve um problema ao apagar o artigo\"\t\n end\t\t\t\t\t\t\t\t\t\t\t\t\n redirect_to stories_path\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n api_url = URI.parse(\"http://www.pivotaltracker.com/services/v2/projects/#{@project_id}/stories/#{@id}\")\n response = Net::HTTP.start(api_url.host, api_url.port) do |http|\n http.delete(api_url.path, {\"X-TrackerToken\" => @token.to_s})\n end\n end", "def destroy\n @story = @success_criterion.user_story\n @success_criterion.destroy\n respond_to do |format|\n format.html { redirect_to crits_path(@story), notice: 'Success criterion 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 destroy\n @story_teller.destroy\n respond_to do |format|\n format.html { redirect_to story_tellers_url, notice: 'Story teller was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_city_hall_story.destroy\n respond_to do |format|\n format.html { redirect_to admin_city_hall_stories_url, notice: 'Dati Comune cancellata con successo!.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @news.destroy\n respond_to do |format|\n format.html { redirect_to news_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shot.destroy\n respond_to do |format|\n format.html { redirect_to shots_url, notice: 'Shot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.8022553", "0.7939624", "0.7939624", "0.7932404", "0.7932404", "0.7932404", "0.7932404", "0.7932064", "0.7927896", "0.7873805", "0.7873805", "0.7873805", "0.77658767", "0.7757827", "0.7713006", "0.7713006", "0.7713006", "0.76207054", "0.7600566", "0.7600566", "0.7600566", "0.7600566", "0.76000255", "0.7560892", "0.7552782", "0.75495183", "0.75400645", "0.75226414", "0.75058734", "0.747253", "0.7469954", "0.7465642", "0.7435975", "0.7402072", "0.7397846", "0.7383577", "0.73363185", "0.7307967", "0.7270986", "0.72463244", "0.7235247", "0.72222114", "0.7207816", "0.72071236", "0.7191075", "0.71753067", "0.7159914", "0.7140405", "0.70940983", "0.7089629", "0.7061915", "0.7058198", "0.7056492", "0.70418507", "0.7036214", "0.70312333", "0.70269006", "0.70020765", "0.6997899", "0.69899213", "0.69783986", "0.69779795", "0.6942506", "0.69269776", "0.69044566", "0.6883644", "0.68591416", "0.6835502", "0.6821153", "0.6820334", "0.67998725", "0.67993945", "0.6799095", "0.6783439", "0.67657137", "0.6760557", "0.6756794", "0.6734712", "0.6733278", "0.6725647", "0.67245054", "0.67245054", "0.6719083", "0.66865456", "0.6683804", "0.66837764", "0.6682145", "0.66807806", "0.66795355", "0.66763335", "0.66763335", "0.6667873", "0.6666783", "0.6662434", "0.6652275", "0.6635861", "0.66206056", "0.66205037", "0.66205037", "0.6609182" ]
0.73521495
36
todo: do we always need tags?
def set_story @story = Story.find(params[:id]) @tags = @story.tags end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag; end", "def tag; end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tagged?; end", "def tag_name; end", "def tag_name; end", "def tag_name; end", "def tag(tag); end", "def tag(tag); end", "def tag(name); end", "def tag\n end", "def tag\n end", "def tagline; end", "def see_tag(text); end", "def complete_tags\n\n end", "def tags=(_arg0); end", "def tags() []; end", "def tag(string); end", "def tag(new_tag); end", "def tags() ; info[:tags] ; end", "def tags() ; info[:tags] ; end", "def example_tag(text); end", "def tags(name = T.unsafe(nil)); end", "def tag\n raise NotImplementedError\n end", "def tag\n raise NotImplementedError\n end", "def abstract_tag(text); end", "def allowed_tags; end", "def allowed_tags; end", "def tag_name=(_arg0); end", "def has_tag?(name); end", "def create_tags\n\tend", "def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end", "def add_tags\n raise NotImplementedError\n end", "def return_tag(text); end", "def get_tag(tag_class); end", "def abstract_tag(definition); end", "def inline_tags; end", "def api_tag(text); end", "def tag_list; []; end", "def add_tags chars\n # TODO: write your code here\nend", "def todo_tag(text); end", "def fragment(tags); end", "def tag\n @tag\n end", "def convert_ref_tags; end", "def allowed_tags=(_arg0); end", "def allowed_tags=(_arg0); end", "def initialize_html_tags; end", "def tag; raise 'Override this method'; end", "def log_tags; end", "def log_tags; end", "def log_tags; end", "def attr_reader_tag(text); end", "def parse(tags); end", "def transitive_tags; end", "def test_cases_by_tag_name; end", "def tag_text()\n return self.tag(true)\n end", "def tags\n send_tags('tags', @handle, @security)\n end", "def tagging_raw_handle\n name\n end", "def tagging_raw_handle\n name\n end", "def title\n \"#{super} #{self.tags.map(&:name).join(\" \")}\"\n end", "def name\n tag.name\n end", "def handle_raw_html_tag(name); end", "def retrieve_tags\n # noop\n end", "def tag_content\n return @tag_content\n end", "def auto_create_tag\n\t\n\tget_tags.each do |tag|\n\t\t@items << Nanoc3::Item.new(\n\t\t\"<%= render 'tag', :tag => '#{tag}' %>\",\n\t { :title => \"Category: #{tag}\", :is_hidden => true, :tag => \"#{tag}\"}, # do not include in sitemap.xml\n\t \"/tags/#{tag}/\", # identifier\n\t :binary => false\n\t)\n\n\tend\n\tnil\nend", "def tag_end name\n end", "def markup_context; end", "def before(node_or_tags); end", "def before(node_or_tags); end", "def access_tags\n tags = []\n tags << 'admin' if admin?\n tags << 'speaker' if speaker?\n tags << 'staff' if staff?\n tags\n end", "def wrap(node_or_tags); end", "def author_tag(text); end", "def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end", "def mytag(opts)\n Rails.logger.info \"Own method mytag is active\"\n \"<b>#{opts[:text]}</b>\"\n end", "def tags\n ['any'] + @tags\n end", "def tags\n ['any'] + @tags\n end", "def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end", "def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end", "def make_tags(item)\n\ttags_for(item, { :base_url => @site.config()[:base_url] + \"/tags/\" })\nend", "def _tag_name\n @tag_name\n end", "def tag(*tags)\n p tags\n tags.each do |tag|\n tag << self\n @tags << tag\n end\n end", "def tag(*tags)\n p tags\n tags.each do |tag|\n tag << self\n @tags << tag\n end\n end", "def tag(tagname, text)\n html = \"<#{tagname}>#{text}</#{tagname}>\"\n yield html\nend", "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def tag(tagname, attributes={})\n# Output the tag name\n@out << \"<#{tagname}\"\n# Get the allowed attributes for this tag.\nallowed = self.class.allowed_attributes[tagname]\n# First, make sure that each of the attributes is allowed.\n# Assuming they are allowed, output all of the specified ones.\nattributes.each_pair do |key,value|\nraise \"unknown attribute: #{key}\" unless allowed.include?(key)\n@out << \" #{key}='#{value}'\"\nend\nend", "def raise_tag(text); end", "def init_tags\n add_tag :BOLD, '+b', '-b'\n add_tag :EM, '+_', '-_'\n add_tag :TT, '' , '' # we need in_tt information maintained\n end", "def taglist\n\tself.tags.map {|t| t.name}\n end", "def test_tag_no_attributes_1\n expected_tag = \"<h1>Hello World!</h1>\"\n\n tag = \"h1\"\n content = \"Hello World!\"\n actual_tag = @page_generator.generate_simple_tag tag, content\n\n assert_equal expected_tag, actual_tag\n end", "def tags\n @tags ||= []\n end", "def register_tags(*additional_tags); end", "def private; end", "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end", "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end", "def parse_tag_with_types_and_title(tag_name, text); end", "def download_tags\n\n end", "def attr_tag(text); end" ]
[ "0.7914961", "0.7914961", "0.76468027", "0.76468027", "0.76468027", "0.76468027", "0.76468027", "0.7600823", "0.7528347", "0.7528347", "0.7528347", "0.74943966", "0.74943966", "0.74654865", "0.7345116", "0.7345116", "0.72881633", "0.7261277", "0.72215647", "0.72203225", "0.7125796", "0.7091619", "0.70118743", "0.6987334", "0.6987334", "0.69228023", "0.68153924", "0.68050396", "0.68050396", "0.6800883", "0.67631066", "0.67631066", "0.6731106", "0.67245275", "0.66863734", "0.65701675", "0.65568274", "0.6542959", "0.65142643", "0.6497062", "0.64921457", "0.6476042", "0.6470451", "0.64613736", "0.645949", "0.64533246", "0.6445208", "0.6434035", "0.64083385", "0.64083385", "0.6404897", "0.6401053", "0.63636625", "0.63636625", "0.63636625", "0.63584137", "0.6338682", "0.6292994", "0.62731427", "0.62525946", "0.6248717", "0.62309194", "0.62309194", "0.62138045", "0.62028974", "0.61921626", "0.6184394", "0.61843354", "0.6180249", "0.61785454", "0.6175271", "0.6166546", "0.6166546", "0.6154611", "0.61486655", "0.6140277", "0.6137706", "0.61282825", "0.6125694", "0.6125694", "0.6124277", "0.6124277", "0.6122342", "0.6115058", "0.61138684", "0.61138684", "0.6112988", "0.6111103", "0.61109734", "0.6110745", "0.61099356", "0.61090493", "0.6099535", "0.6075703", "0.60522777", "0.6044585", "0.602815", "0.602815", "0.60145783", "0.60124904", "0.6006371" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = FortyTwo::Project.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
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) min = nil out = nil name_hash.each{|k,v,i| #puts i if !min||v<min out=k min=v end } out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n \n min_val = Float::INFINITY\n min_key = nil\n hash.each do |k, v|\n if min_val > v\n min_val = v\n min_key = k\n end\n end\n return min_key\nend", "def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend", "def key_for_min_value(hash)\n int_hash = hash.select { |key, val| val.class == Fixnum }\n smallest = int_hash[int_hash.keys.sample]\n # debugger\n int_hash.each do |key, val|\n if val < smallest\n smallest = val \n end\n end\n int_hash.key(smallest)\nend", "def key_for_min_value(hash)\r\n smallest_key = nil\r\n tiniest_value = nil\r\n hash.each do |key, value|\r\n if tiniest_value == nil || value < tiniest_value\r\n tiniest_value = value\r\n smallest_key = key\r\n end\r\n end\r\n smallest_key\r\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = 0\n\n\n hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n min = nil\n hash.each_pair do |key, value|\n min ||= value\n min = value if value < min\n end\n hash.key(min)\nend", "def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |key, value|\n if hash_value == nil || value < hash_value\n hash_value = value\n hash_key = key\n end\n end\n hash_key\nend", "def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n min = 99999999\n min_key = nil\n hash.select do |key, value|\n if value < min\n min = value\n min_key = key\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend", "def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend", "def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil \n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value \n lowest_value = value \n lowest_key = key \n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowestnum = 1000\n name_hash.each_value do |hashvalue|\n if hashvalue < lowestnum\n lowestnum = hashvalue\n end\n end\n name_hash.index(lowestnum)\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_number = nil\n name_hash.each do |name, number|\n if lowest_number == nil || number < lowest_number\n lowest_number = number\n lowest_key = name\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n # first iteration\n ## this creates a starting point for comparison\n if lowest_value == nil || lowest_value > v\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n low = Float::INFINITY\n name_hash.each do |k,v|\n if v < low\n low = v\n end\n end\n name_hash.key(low)\nend", "def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend", "def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend", "def key_for_min_value(name_hash)\n lowest = nil\n key = nil\n if name_hash.length == 0\n return \n end\n \n name_hash.each do |name, number|\n if lowest == nil\n lowest = number\n end\n if key == nil\n key = name\n end\n if number < lowest\n lowest = number\n key = name\n end\n end\n key\nend", "def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend", "def key_for_min_value(name_hash)\n\tif name_hash == {}\n\t\tnil\n\tend\n\n\tsmallest_key = nil\n\tsmallest_value = nil\n\tname_hash.each do |key, value|\n\t\tif !smallest_value || value < smallest_value\n\t\t\tsmallest_key = key\n\t\t\tsmallest_value = value\n\t\tend\n\tend\n\tsmallest_key\nend", "def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |name, amount|\n if amount < lowest_value\n lowest_value = amount\n lowest_key = name\n end\n end\n lowest_key\n end", "def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end", "def key_for_min_value(hash)\n\n lowest_key = nil \n lowest_value = nil \n \n hash.each do |key,value|\n if lowest_value == nil || lowest_value > value\n\n lowest_key = key\n lowest_value = value \n end \n \n end \n lowest_key\nend", "def key_for_min_value(name_hash)\n small_num = Float::INFINITY\n smallest_key = \"\"\n if name_hash.length == 0\n return nil\n end\n name_hash.each do |key, value|\n if value < small_num\n small_num = value\n smallest_key = key\n end\n end\nsmallest_key\nend", "def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend", "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend", "def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend", "def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_value=Float::INFINITY\n name_hash.each{|key, value| \n if value<lowest_value\n lowest_value=value\n lowest_key=key\n end\n }\n lowest_key\nend", "def key_for_min_value(name_hash)\n empty_hash = nil\n lowest_value = 10000000000000000000000\n name_hash.collect do |name, value|\n if value < lowest_value\n lowest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend", "def key_for_min_value(name_hash)\n lowest = \"\"\n lowest = nil if name_hash.empty?\n high_num = 100000000000000000\n name_hash.each do | key, value |\n lowest = key if value < high_num\n high_num = value if value < high_num\n end\n lowest\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name, num|\n if lowest_key == nil || num < lowest_value\n lowest_key = name\n lowest_value = num\n elsif name_hash == nil\n nil\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n num = nil\n name_hash.collect do |key, value|\n if value < num\n num = value\n end\n end \n name_hash.key(num)\nend", "def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = nil\n name_hash.each do|key, val|\n if smallest_val == 0 || val < smallest_val\n smallest_val = val\n smallest_key = key\n end\n end\n smallest_key\n\nend", "def key_for_min_value(name_hash)\n smallest_hash_key = nil\n name_hash.each do |key, val|\n if smallest_hash_key == nil\n smallest_hash_key = key\n next\n elsif val < name_hash[smallest_hash_key]\n smallest_hash_key = key\n end\n end\n smallest_hash_key\nend", "def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend", "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_number = name_hash.first[1];\n key_value = \"\"\n name_hash.each do |key, value|\n if value <= lowest_number\n lowest_number = value\n key_value = key\n end\n end\n key_value\nend", "def key_for_min_value(name_hash)\n current = 0\n lowest = 0\n lowest_key = nil\n name_hash.collect do |key, value|\n current = value\n if current < lowest || lowest == 0\n lowest = current\n lowest_key = key\n end\n\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowestvalue = 1000\n name_hash.each do |name, value|\n if value < lowestvalue\n lowest_key = name\n lowestvalue = value\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n small_value = 10000000000\n small_key = nil\n name_hash.each do |k,v|\n if v < small_value\n small_value = v\n small_key = k\n end\n end\n small_key\nend", "def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |k, v|\n if low_value == nil || v < low_value\n low_value = v\n low_key = k\n end\n end\n low_key\n end", "def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil # tell me if this makes sense\n lowest_value = value\n lowest_key = key\n elsif lowest_value > value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key #you want to return the key for min\nend", "def key_for_min_value(hash)\n \n if hash.empty?\n return nil\n end\n min_value=500\n min_key=:symbol\n \n hash.each do |key, value|\n if value<min_value\n min_value=value\n min_key=key\n end\n end\n return min_key\nend", "def key_for_min_value(name_hash)\n lowestKey = nil\n lowestValue = Float::INFINITY\n name_hash.each do |k, v|\n if v < lowestValue\n lowestValue = v\n lowestKey = k\n end\n end\n lowestKey\n\nend", "def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = 0\n comp = nil\n name_hash.each do |key,val|\n comp = val\n if smallest_key == 0\n smallest_key = key\n smallest_val = val\n end \n if comp < smallest_val\n smallest_val = comp\n smallest_key = key\n end\n end\n if smallest_key == 0 \n return nil \n else\n return smallest_key\n end\nend", "def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_val=0\n name_hash.collect do |key,value|\n if value<lowest_val or lowest_val==0\n lowest_key=key\n lowest_val=value\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend", "def key_for_min_value(name_hash)\n rkey = nil\n rvalue = 10000000000000000\n name_hash.each do |key, value|\n if value < rvalue\n rkey = key\n rvalue = value\n end\n end\n rkey\nend", "def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend", "def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n hash.key(hash.values.min)\nend", "def key_for_min_value(hash)\n hash.key(hash.values.min)\nend", "def key_for_min_value(name_hash)\n smallest_value = 100\n name_hash.each do |key, value| \n if value < smallest_value\n smallest_value = value \n end \n end\n name_hash.key(smallest_value)\nend", "def key_for_min_value(name_hash)\n lowest=\"\"\n lowest=nil if name_hash.empty?\n tracker=100000000\n name_hash.each do |key,value|\n lowest=key if value<tracker\n tracker=value if value<tracker\n # if value<tracker\n end\n lowest\nend", "def key_for_min_value(name_hash)\n if name_hash.length == 0 \n nil\n else\n smallest_num = nil\n smallest_num_key = nil\n name_hash.collect do |key, value|\n if smallest_num == nil\n smallest_num = value\n smallest_num_key = key\n elsif smallest_num > value\n smallest_num = value\n smallest_num_key = key\n end\n end\n smallest_num_key\n end\n\nend", "def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |n, s|\n if low_value == nil\n low_value = s\n low_key = n\n elsif low_value > s\n low_value = s\n low_key = n\n end\n end\n low_key\nend", "def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend", "def key_for_min_value(name_hash)\n lowestId = nil\n lowestNum = 0\n name_hash.each{ |id, val|\n if lowestNum == 0 \n lowestNum = val\n end\n if val <= lowestNum\n lowestNum = val\n lowestId = id\n end\n }\n return lowestId\nend", "def key_for_min_value(name_hash)\n lowest_v = nil\n lowest_k = nil\n name_hash.each do |name, value|\n if lowest_v == nil\n lowest_v = value\n lowest_k = name\n elsif value < lowest_v\n lowest_v = value\n lowest_k = name\n end\n end\n lowest_k\n end", "def key_for_min_value(name_hash)\n smallest_key = nil\n smallest_value = nil\n name_hash.each do |j, r|\n if smallest_value == nil || r < smallest_value\n smallest_value = r\n smallest_key = j\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\nlowest = 1000000\n low_key = nil\n name_hash.each {|key, value|\n if value < lowest\n lowest = value\n low_key = key\n end\n }\n low_key\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n name_hash.each_key do |key|\n if lowest_key == nil\n lowest_key = key\n elsif name_hash[key] < name_hash[lowest_key]\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n\n if name_hash.empty?\n return nil\n end\n lowest = Float::INFINITY\n name_hash.each_pair do |k, v|\n if v < lowest\n lowest = v\n end\n end\n name_hash.each_pair do |k, v|\n if v == lowest\n return k\n end\n end\nend", "def key_for_min_value(name_hash)\n output = 0\n smallest = nil\n name_hash.map do |key, value|\n if value < output || output == 0\n output = value\n smallest = key\n end\n end\n\n smallest\nend", "def key_for_min_value(my_hash)\n #what is my value?\n lowest_value = 500\n lowest_key = nil\n\n my_hash.collect do |key, value|\n # what is my value?\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowest_num = 1000000000\n lowest_num_key = \" \"\n if name_hash == {}\n return nil\n else\n name_hash.each do |name, num|\n if num < lowest_num\n lowest_num = num\n lowest_num_key = name\n end\n end\n return lowest_num_key\n end\nend", "def key_for_min_value(name_hash)\n nums = name_hash.collect do |item, num|\n num\n end\n nums.sort!\n nums[0]\n \n min_key = nil\n name_hash.map do |item, num|\n if num == nums[0]\n min_key = item\n end\n end\n min_key\nend", "def key_for_min_value(name_hash)\n vals = name_hash.collect { |key, value| value }\n keys = name_hash.collect { |key, value| key }\n low = vals[0]\n lowkey = keys[0]\n if name_hash.empty?\n nil\n else\n name_hash.collect do |key, value|\n if value < low\n low = value\n lowkey = key\n end\n end\n lowkey\n end\nend", "def key_for_min_value(name_hash)\n value1 = 0\n lowestKey = nil\n name_hash.each do |key, value|\n if(value1 == 0)\n value1 = value\n lowestKey = key\n end\n if(value1 > value)\n value1 = value\n lowestKey = key\n elsif (value1 < value)\n lowestKey = lowestKey\n value1 = value1\n end\n end\n return lowestKey\nend", "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend", "def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend", "def key_for_min_value(name_hash)\n key = \"\"\n low_value = nil\n if name_hash.empty? == true\n return nil\n end\n name_hash.each do |name, number|\n if low_value == nil || number < low_value\n low_value = number\n key = name\n end\n end\n key\nend", "def key_for_min_value(name_hash)\n answer = nil\n smallest = nil\n name_hash.each {|key, value|\n if smallest.nil?\n smallest = value\n end\n if value <= smallest\n smallest = value\n answer = key\n end\n }\n answer\nend", "def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend", "def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = \"\"\n if name_hash.empty? == true\n nil\n else\n name_hash.each_with_index do |(key, value), i|\n if i == 0\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\n end\nend", "def key_for_min_value(name_hash)\n low=10000000000000000000\n return_key=nil\n name_hash.each do |key, value|\n if value<low\n low=value\n return_key=key\n end\n end\n return_key\nend", "def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend", "def key_for_min_value(name_hash)\n \n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name_key, name_value|\n if lowest_value == nil || name_value < lowest_value\n lowest_value = name_value\n lowest_key = name_key\n end\n end\n lowest_key\n \n end", "def key_for_min_value(name_hash)\n the_key = nil \n the_value = 1/0.0\n # Infinity...can also be expressed as FLOAT::Infinity\n name_hash.each do |id, num|\n if num <= the_value\n the_value = num\n the_key = id\n end\n end\n the_key\nend", "def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |k,v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end \nend\nlowest_key\nend", "def key_for_min_value(name_hash)\n return nil if name_hash == {}\n smallest_key = name_hash.first[0]\n smallest_val = name_hash.first[1]\n\n name_hash.each do |pair|\n if pair[1] < smallest_val\n smallest_key = pair[0]\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend", "def key_for_min_value(name_hash)\n smallest_value = Float::INFINITY\n key_for_smallest_val = nil\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_for_smallest_val = key\n end \n end \n key_for_smallest_val\nend", "def key_for_min_value(name_hash)\n minKey = nil\n minVal = 2 ** (64 - 2) - 1\n name_hash.each {|key, value|\n if value < minVal\n minVal = value\n minKey = key\n end}\n minKey\nend", "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n lowest_number = nil\n name_hash.collect do |name, value|\n if lowest_number == nil\n lowest_number = value\n elsif lowest_number > value\n lowest_number = value\n end\n end\n \n name_hash.each do |name, value|\n if lowest_number == value\n return name\n end\n end\nend", "def key_for_min_value(hash)\n min_value = hash.values.min\n keys = hash.collect do |key, num|\n \tkey if num == min_value\n end\n keys\nend", "def key_for_min_value(name_hash)\n lowest_value = nil\n key_value = nil\n name_hash.collect do |name, number|\n if lowest_value == nil || number < lowest_value\n lowest_value = number\n key_value = name\n end\n end\n key_value\nend", "def key_for_min_value(name_hash)\n smallest_value = 1/0.0\n key_of_smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value > value\n key_of_smallest_value = key\n smallest_value = value\n end\n end\n return key_of_smallest_value\nend" ]
[ "0.8821222", "0.8777674", "0.87769854", "0.8745862", "0.8689437", "0.86553806", "0.865241", "0.86165065", "0.8587693", "0.8572328", "0.85674095", "0.8550907", "0.8529734", "0.8529734", "0.85182345", "0.84936565", "0.8475531", "0.8475531", "0.8466132", "0.8449126", "0.84490585", "0.84359556", "0.84328413", "0.8430745", "0.8428166", "0.84090126", "0.8388222", "0.83684903", "0.83568215", "0.83524764", "0.8345625", "0.8343887", "0.8328773", "0.83284044", "0.83269894", "0.83253354", "0.83201903", "0.83164364", "0.8312503", "0.8312319", "0.8304851", "0.83014053", "0.83008987", "0.82917446", "0.8288315", "0.82870966", "0.8274123", "0.82674986", "0.8267187", "0.82527804", "0.8250538", "0.82443976", "0.82439804", "0.8243696", "0.82416916", "0.8240566", "0.823854", "0.82375354", "0.82283455", "0.82274485", "0.82205135", "0.82190055", "0.82136935", "0.82136935", "0.82102376", "0.82101446", "0.82060164", "0.8200657", "0.81985617", "0.81966525", "0.81958514", "0.81932545", "0.81874573", "0.8186549", "0.8185174", "0.8183619", "0.8183068", "0.8182941", "0.8179895", "0.8173536", "0.81732464", "0.8172825", "0.81721044", "0.8171692", "0.81681263", "0.8165602", "0.81609225", "0.8160289", "0.81587887", "0.815757", "0.8154019", "0.81534094", "0.8152752", "0.81524456", "0.8151455", "0.81511825", "0.8151019", "0.8146792", "0.814368", "0.8142542", "0.81412685" ]
0.0
-1
Remind user to fill in payment details
def payment_settings_reminder(listing, recipient, community) set_up_layout_variables(recipient, community) with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do @listing = listing @recipient = recipient if community.payments_in_use? @payment_settings_link = paypal_account_settings_payment_url(recipient, @url_params.merge(locale: recipient.locale)) end premailer_mail(:to => recipient.confirmed_notification_emails_to, :from => community_specific_sender(community), :subject => t("emails.payment_settings_reminder.remember_to_add_payment_details")) do |format| format.html {render :locals => {:skip_unsubscribe_footer => true} } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_params\n params.require(:payment).permit(:first_name, :last_name, :last4, :card_security_code, :credit_card_number, :expiration_month, :expiration_year, :amount, :amount, :success, :authorization_code, :user_id, :notify, :parking_id)\n end", "def payment_form \n unless params[:payment_method_token].blank?\n @payment_method = Samurai::PaymentMethod.find params[:payment_method_token]\n else\n @payment_method = Samurai::PaymentMethod.new :is_sensitive_data_valid => false\n end\n\n unless params[:reference_id].blank?\n @transaction = Samurai::Transaction.find params[:reference_id]\n end\n end", "def set_ProofOfPayment(value)\n set_input(\"ProofOfPayment\", value)\n end", "def set_ProofOfPayment(value)\n set_input(\"ProofOfPayment\", value)\n end", "def set_ProofOfPayment(value)\n set_input(\"ProofOfPayment\", value)\n end", "def payment\n {\n :credit_card => credit_card\n }\n end", "def payment_params\n params.require(:payment).permit(:address, :city, :state, :paid)\n end", "def payment_instruction\n end", "def fill_in_buyer_stripe_form(obj = billing_address_example_data)\n fill_in('account[billing_address][name]', with: obj[:first_name])\n fill_in('account[billing_address][address1]', with: obj[:street_address])\n fill_in('account[billing_address][address2]', with: obj[:extra_address])\n fill_in('account[billing_address][city]', with: obj[:locality])\n find_field('account[billing_address][country]').find(:option, obj[:country_name]).select_option\n fill_in('account[billing_address][state]', with: obj[:region])\n fill_in('account[billing_address][phone]', with: obj[:phone])\n fill_in('account[billing_address][zip]', with: obj[:postal_code])\nend", "def payment_params\n params.require(:payment).permit(:id, :user_id, :fullname, :country, :city, :district_id, :address, :phone, :cart_id, :subtotal, :total, :status_id)\n end", "def payment_params\n params.permit(:amount, :token, :user_email, :first_name, :user_phone)\n end", "def wepay_postfill\n # If the user approved the 'preapproval' and \n if params.has_key?('preapproval_id')\n @order = Order.find_by_token(params[:preapproval_id])\n unless @order.nil?\n wepay = WePay.new(Settings.wepay_client_id, Settings.wepay_access_token, _use_stage = (!Rails.env.production?))\n # Let's find the user information on Wepay end..\n response = wepay.call('/preapproval', Settings.wepay_access_token, {\n :preapproval_id => params[:preapproval_id]\n })\n \n @order.wepay_postfill(response)\n if params['status'] != 'approved' \n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n end", "def register_payout_details(person)\n # nothing to do by default\n end", "def payment_params\n params.require(:payment).permit(:fact_firstname, :fact_lastname, :fact_address, :fact_addresscomplement, :fact_addresscomplementbis, :fact_zipcode, :fact_city, :deliver_firstname, :deliver_lastname, :deliver_address, :deliver_addresscomplement, :deliver_addresscomplementbis, :deliver_zipcode, :deliver_city)\n end", "def payment_params\n # params.require(:payment).permit(:user_id, :customer, :funding_source, :routing_number, :account_number, :type, :account_name)\n params.require(:payment).permit!\n end", "def creator_payment\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n redirect_to button_user_path(@user)\n end\n @nav = \"signup\"\n end", "def new\n @payment = Payment.new(:person_id => params[:person_id],:amount => params[:amount].blank? ? 0.0 : params[:amount].to_f / 100.0)\n @person_id = params[:person_id]\n end", "def new\n @payment = Payment.new(:person_id => params[:person_id],:amount => params[:amount].blank? ? 0.0 : params[:amount].to_f / 100.0)\n @person_id = params[:person_id]\n end", "def payment_params\n params.require(:payment).permit(:numcard, :name_owner, :expiry_date, :code, :dues_number)\n end", "def payment_params\n params.require(:payment).permit(:cardNo, :expires, :name, :amount, :order_id)\n end", "def payment_params\n params.require(:payment).permit(:form, :amount, :note, :buyer_id)\n end", "def payment_params\n params.require(:payment).permit(:legalname, :request)\n end", "def payment_params\n #params.require(:payment).permit(:amount, :profile_id, :reference_key, :status, :succeed_time)\n params.require(:payment).permit(:amount)\n end", "def fill_in_address_personal_order\n # if not on the cart page, go there\n (URI.parse(current_url).path == '/cart') ? nil : (visit '/cart')\n # click checkout to start address process\n all(:xpath, '//button[@id=\"checkout-link\"]')[0].click # \"Checkout\"\n #select personal order\n choose 'order_retail_staff_order_detail_attributes__destroy_1'\n # fill in billing/contact info\n fill_in_billing_info_macro(FactoryGirl.create(:bill_address))\n #use same shipping as billing address\n check 'order_use_billing'\n # continue to shipping\n click_button I18n.t('actions.save_and_continue_to_delivery') # \"Continue to Shipping\"\nend", "def payment_params\n params.require(:payment).permit(:amount, :receiver, :refunded, :completed, :user_id)\n end", "def payments(customer_name)\n puts \"Welcome to payments for #{customer_name}, enter payment amount\"\n end", "def valitation\n # Create a payment and send ID\n end", "def paid_params\n params.require(:paid).permit(:pay)\n end", "def checkout\n \n # there must be a payment\n @payment = session[:payment]\n if !@payment || !@payment.amount\n @message = \"Sorry an internal error has occured\"\n render :action => 'error'\n return\n end\n\n # the donation can change based on parameters supplied\n if @payment.amount < 1\n # collect both possible donations\n donation = params[:donation]\n donation2 = params[:donation2]\n donation2 = donation if donation2\n donation = donation2.to_i\n @payment.update_attributes( :amount => donation )\n end\n if @payment.amount < 1\n @message = \" bad donation amount entered. Please hit back and try again\"\n render :action => 'error'\n return\n end\n\n # capture the company match if there is one\n matching_company = params[:matching_company]\n if matching_company\n @payment.update_attributes( :matching_company => matching_company)\n end\n\n # try get a party if there is one passed - this overrides anything from before.\n @party = nil\n @party = User.find(params[:party].to_i) if params[:party]\n @partyid = 0\n @partyid = @party.id if @party\n @payment.update_attributes( :owner_id => @partyid ) if @partyid > 0\n \n #if @payment.owner_id == 0\n # @message = \"Sorry no person to donate to found\"\n # render :action => 'error'\n # return\n #end\n\n # move payment along to the next stage\n @payment.update_attributes( :description=> Payment::CHECKOUT , :amount => donation )\n\n @notify_url = url_for(\n :controller=>\"payment\",\n :action => 'payment_received',\n :id => @payment.id,\n :only_path => false\n )\n\n @return_url = url_for(\n :controller=>\"payment\",\n :action => 'confirm_standard',\n :only_path => false\n )\n\n @paypal_business_email = SETTINGS[:paypal_business_email]\n @business_key = PAYPAL_MYPRIVKEY\n @business_cert = PAYPAL_MYPUBCERT\n @business_certid = SETTINGS[:paypal_cert]\n @action_url = \"http://www.paypal.com/cgi-bin/webscr\"\n Paypal::Notification.ipn_url = @action_url\n Paypal::Notification.paypal_cert = PAYPAL_CERT\n\n end", "def payment_params\n params.require(:payment).permit(:customer_id, :visit_id, :method, :credit_card_no, :paid, :paid_at, billing_address_attributes: [ :street1, :street2, :city, :state, :zip, :name_on_card ])\n end", "def new\n @user = User.find(params[:id])\n @order = Order.new\n @order.user = @user\n @order.first_name = @user.profile.firstname\n @order.last_name = @user.profile.lastname\n if params[:companyIdToSell]\n @order.amount = 29 # Basic user to pay $29 when posting a company to sell\n @companyIdToSell = params[:companyIdToSell]\n else\n if params[:upgrade]\n @order.order_type = \"membership_upgrade\"\n if params[:plan_id]\n @order.plan = Plan.find(params[:plan_id])\n else\n @order.plan = Plan.membership_plan(params[:upgrade_plan][:plan_type],@user) #new plan received not the current plan\n if @order.plan.duration==\"1 month\"\n @user.end_date=@user.start_date.to_date>>(1)\n elsif @order.plan.duration==\"14 month\"\n @user.end_date=@user.start_date.to_date>>(14)\n end\n @user.save\n end\n if @order.plan.fee<0\n flash[:notice]=\"Please contact Trusted Insight for fee payment.\"\n redirect_to \"/\"\n else\n @order.amount = @order.plan.fee\n end\n else\n @order.order_type = \"sign_up\"\n @order.plan = @user.plan\n if @order.plan.fee<0\n flash[:notice]=\"Please contact Trusted Insight for fee payment.\"\n redirect_to \"/\"\n else\n @order.amount = @user.plan.fee\n end\n end\n end\n end", "def payment_params\n params.require(:payment).permit(:mpesa_code, :user_id, :transacted, :timed_out)\n end", "def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def confirm\n @order = Order.new(params[:order])\n session[:order]= params[:order]\n @companyIdToSell = params[:companyIdToSell] if params[:companyIdToSell] \n @user = User.find(current_user.id)\n unless @order.valid?\n render :action => 'new'\n end\n# flash[:notice] = \"Card information invalid!!\"\n end", "def set_PaymentID(value)\n set_input(\"PaymentID\", value)\n end", "def set_PaymentID(value)\n set_input(\"PaymentID\", value)\n end", "def notify_payment\n begin\n user = User.find(params['referenceId'].split(\"-\").first)\n check_payment(\"POST\", user)\n render :text => \"Thank you!\"\n rescue Exception => ex\n logger.error \"params: #{params.inspect}\"\n logger.error \"a problem occured when processing a payment: #{ex.message} \\n #{ex.backtrace}\"\n render :text => \"A problem occured\"\n end\n end", "def create\n\t\t# @payment = Payment.new({\n\t\t# :intent => \"sale\",\n\t\t# :payer => {\n\t\t# :payment_method => \"credit_card\",\n\t\t# :funding_instruments => [{\n\t\t# :credit_card => {\n\t\t# \t:type => params[:payment][:card_type], #\"visa\",\n\t\t# :number => params[:payment][:card_number], #\"4242424242424242\",\n\t\t# :expire_month => params[:payment][\"card_expires_on(2i)\"], #\"1\",\n\t\t# :expire_year => params[:payment][\"card_expires_on(1i)\"], #\"2018\",\n\t\t# :cvv2 => params[:payment][:cvv2], #\"874\",\n\t\t# :first_name => params[:payment][:first_name], #\"Joe\",\n\t\t# :last_name => params[:payment][:last_name], #\"Shopper\",\n\t\t# :billing_address => {\n\t\t# :line1 => params[:payment][:address], #\"52 N Main ST\",\n\t\t# :city => params[:payment][:city], #\"Johnstown\",\n\t\t# :state => params[:payment][:state], #\"OH\",\n\t\t# :postal_code => params[:payment][:postal_code], #\"43210\",\n\t\t# :country_code => params[:payment][:country_code] #\"US\" \n\t\t# }}}]},\n\t\t# :transactions => [{\n\t\t# :amount => {\n\t\t# :total => \"10.00\",\n\t\t# :currency => \"USD\" },\n\t\t# :description => \"This is the payment transaction description.\" }]})\n\n\t\t# @payment.create\n\t\t# if @payment.id.nil?\n\t\t# \terror = @payment.error\n\t\t# \tredirect_to payment_index_url, :alert => error.name+\"\\n\"+error.details.to_s\n\t\t# else\n\t\t# \tparams[:payment][:transaction_id] = @payment.id\n\t\t# \tparams[:payment][:amount] = 10\n\t\t# \t@data = current_user.build_payment(payment_params)\n\t\t# \tif @data.save\n\t\t# \t\tredirect_to payment_index_url, :notice => \"Payment Done with payment id #{@payment.id}\"\n\t\t# \telse\n\t\t# \t\tredirect_to payment_index_url, :alert => \"Something went wrong.\"\n\t\t# \tend\n\t\t# end\n\tend", "def payment_params\n params.require(:payment).permit(:amount, :identification, :card_number, :expiration_month, :expiration_year, :security_code)\n end", "def manual_pay!\n validate_pre_pay_status!\n self.status = 'available'\n self.paid_at = Time.zone.now\n self.amount = DEFAULT_AMOUNT\n self.gross_amount = DEFAULT_AMOUNT\n self.discount_amount = 0.0\n self.fee_amount = 0.0\n self.extra_amount = 0.0\n self.net_amount = DEFAULT_AMOUNT\n self.installments = 1\n self.escrow_ends_at = self.paid_at\n self.save!\n end", "def payment_params\n params.require(:payment).permit(:total_fee, :pay_method, :customer, :ip, :equipment)\n end", "def set_payment\n # I'm not getting the payment directly from here because ActiveRecord\n # makes joined models read only\n user_payments = Payment.all_for_user(current_user).collect { |p| p.id }\n @payment = Payment.find(params[:id])\n unless user_payments.include? @payment.id\n flash[:notice] = \"Could not find requested payment\"\n redirect_to payments_path\n end\n end", "def new\n\t\tif params[:trip_id]\n store_trip_in_session(params[:trip_id].to_i)\n\t\tend\n\n\t\tif session[:trip_id]\n trip = Trip.scoped_by_account_id(current_user.account_id).find(session[:trip_id])\n\t\t\t@payment.trip_id = trip.id\n @payment.payee_name = trip.customer.name_with_title\n end\n\n if session[:customer_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n else\n redirect_to guests_url,\n alert: 'New payments can only be created after selecting a guest / agency.'\n end\n end", "def set_payment\n @payment = check_owner_user_id(Payment.find(params[:id]))\n end", "def paypal\n if params[:token]\n if @subscription.complete_paypal(params[:token])\n if admin_user_pending?\n redirect_to activate_path(@user.activation_code)\n else\n flash[:notice] = 'Your billing information has been updated'\n redirect_to :action => \"billing\"\n end\n else\n render :action => 'billing'\n end\n else\n redirect_to :action => \"billing\"\n end\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n end", "def checkout\n @appointment = current_user.appointments.find(params[:appointment_id])\n\n # TO DO: Process the credit card of the user here\n end", "def payment_params\n params.require(:payment).permit(:custid, :payment_amount)\n end", "def payment_params\n params.require(:payment).permit(:amount, :responseCode, :responseMessage)\n end", "def payment_params\n params.require(:payment).permit(:stripe_customer_token, :user_id, :email, :plan)\n end", "def set_payment\n @payment = Payment.find(params[:id])\n user_not_authorized unless @payment.owner? current_student.current_application\n end", "def set_payment\n @payment = Payment.where(order_id: params[:order_id]).first\n end", "def pay\n unless self.payment_id\n payment = create_payment\n self.payment_id = payment.id\n self.status = 'paid'\n self.pay_date = Time.now\n self.save\n add_to_balance\n end\n end", "def payment_params\n params.require(:payment).permit(:card, :option)\n end", "def received (payment)\n @payment = payment\n\n mail to: payment.user.email, subject: \"Подтверждение пополнения баланса на kupibazar.com\"\n end", "def payment_params\n params.require(:payment).permit(:customer_id, :payment_ammount, :receiver, :giver, :previous_ammount, :left_ammount)\n end", "def create\n if current_user.product_name == 'gold'\n redirect_to root_path\n end \n\n @order = current_user.orders.build(order_params)\n\n respond_to do |format|\n if @order.save\n \n if order_params[:product] == '$25 - Gold Plan'\n add_pin = 100\n plan = 'gold'\n else\n add_pin = 25\n plan = 'silver'\n end\n \n #Increase User pin on successfully payment recevied\n user = User.find(current_user.id)\n user.allowed_pins += add_pin\n user.product_name = plan\n user.save()\n\n format.html { redirect_to edit_user_registration_path, notice: 'Your Payment successfully received.' }\n # format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n # format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def select_credit_card\n chooses \"credit card\"\n clicks_button \"Continue\"\n end", "def payment_params\n \tparams.require(:payment).permit(:cash_pay)\n \tend", "def create\n @payment = @user.payments.build(payment_params)\n if @payment.save\n redirect_to user_payment_url(@user, @payment)\n else\n render :action => \"new\"\n end\n end", "def paypal_return\r\n user_id = params[:user_id]\r\n @user = User.find(user_id)\r\n session[:user_id] = @user[:id]\r\n session[:user_email] = @user[:email]\r\n #render :text => params \r\n if Purchase.exists?(params[:id])\r\n redirect_to(:action=>'order_confirmed/'+params[:id].to_s)\r\n else\r\n flash[:notice] = I18n.t 'event.purchase.pur_can'\r\n redirect_to(:controller => 'home', :action=>'index') \r\n end \r\n end", "def billing\n authorize current_user.organization\n if request.get?\n load_receipts\n if current_user.organization.stripe_customer.present?\n @default_card = current_user.organization.default_card\n\n if @default_card.present?\n @masked_card_number = \"**** **** **** #{@default_card.last4}\"\n @button_label = \"Update Credit Card\"\n else\n @button_label = \"Add Credit Card\"\n end\n else\n @button_label = \"Add Credit Card\"\n end\n else\n #{\"stripeToken\"=>\"tok_1DMMCKBtjjIyBvbaLqcBqsD4\", \"stripeTokenType\"=>\"card\", \"stripeEmail\"=>\"user@gmail.com\", \"controller\"=>\"home\", \"action\"=>\"stripe\"}\n if current_user.organization.stripe_customer_id.blank?\n #You do not have to assign a source to create a customer.\n # However, if you set the customer up on a subscription, they will require a source to be available, and the charges will be made to the customer's default_source.\n # If a customer has only one source, it is automatically the default_source.\n customer = Stripe::Customer.create(\n source: params.fetch(:stripeToken),\n email: params.fetch(:stripeEmail)\n )\n organization = current_user.organization\n organization.stripe_customer_id = customer.id\n organization.save!\n else\n #you can also add a new card to an existing customer, using a token:\n customer = Stripe::Customer.retrieve(current_user.organization.stripe_customer_id)\n stripe_card = customer.sources.create(source: params.fetch(:stripeToken))\n\n #Once you have a card assigned to the customer, you can make it the default_source, using this:\n customer.default_source = customer.sources.retrieve(stripe_card.id)\n customer.save\n end\n\n # so that you can't simulate same POST request multiple times(stripeToken must be unique)\n redirect_to profile_billing_path\n end\n end", "def payment_params\n params.require(:payment).permit(:amount, :received_on, :transaction_type, :memo)\n end", "def contact_us_to_complete_payment\n # Horrible hack: when the user triggers a £40 edit charge, chooses a payment\n # method but then navigates backward, we get into a state where we can no\n # longer compare the \"old\" and \"new\" carrier types (because we no longer\n # know what the \"old\" type was as its now been overwritten in Mongo). This\n # means the new charge determination will output no charge, potentially\n # making the change of carrier type free.\n setup_registration('payment', true)\n render_not_found and return unless @registration\n end", "def new\n @appointment_payment = AppointmentPayment.new\n @session_id=session[:id]\n\t@session = Session.find(session[:id])\n\t@person = Person.find(@session.person_id)\n\t@org_code=@person.org_code\n\t@org_location=@person.org_location\n \n\t\n\t# Get updated receipt/bill no\n\treceipt_no=Number.new\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Create object to number table\n\t@appointment_payment.bill_no11=receipt_no.get_number('receipt',@org_code) \t# Method calling \n\t# end\n\t@referral=\"\"\n\tif(params[:mr_no])\n\t\t@registrations = Registration.find_by_mr_no_and_org_code(params[:mr_no],@org_code)\n\t\t@appointment_payment.mr_no=@registrations.mr_no\n\t\t@appointment_payment.patient_name=@registrations.title+\".\"+@registrations.patient_name\n\t\t@appointment_payment.age=@registrations.age\n\t\t@appointment_payment.gender=@registrations.gender\n\t\t@appointment_payment.appt_type=\"OP\"\n\t\t@referral=@registrations.referral_name\n\tend\n\trespond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment_payment }\n end\n\t \n end", "def verify!\n raise \"Payment details not active anymore\" if active == false\n end", "def checkout_params\n params.require(:checkout).permit(:first_name, :last_name, :address, :city, :country, :postal_code, :phone, :email, :stripeToken)\n end", "def problem (payment)\n @payment = payment\n\n mail to: payment.user.email, subject: \"Ууупс, проблема с подтверждением Вашего платежа на kupibazar.com\"\n end", "def donate\n @campaign = Campaign.find_by_id(params[:campaign_id])\n @user = User.find_by_id(@campaign.user_id)\n if(@user.checkout_method == \"iframe\")\n redirect_to(\"/campaign/donate_iframe/#{@campaign.id}\")\n end\n params[:user_name] ||= \"Test User\"\n params[:user_email] ||= \"test@example.com\"\n params[:cc_number] ||= \"5496198584584769\"\n params[:cvv] ||= \"123\"\n params[:zip] ||= \"12345\"\n params[:expiration_month] ||= \"11\"\n params[:expiration_year] ||= \"2025\"\n end", "def payment_params\n params[:payment][:bill_id] = params[:bill_id] if params[:bill_id]\n params.require(:payment).permit(:date, :amount, :notes, :payment_type_id,\n :patient_id, :claim_type_id,\n :payment_type_id, :insurance_company_id, :bill_id)\n end", "def payment_params\n params.require(:payment).permit(:user_transaction_id, :programmed_date, :done_date, :amount, :confirm_payer, :confirm_payee)\n end", "def receipt\n check_payment(\"GET\", current_user)\n if @payment.failed?\n flash.now[:error] = \"We are sorry, we were not able to verify your payment from Amazon.com\"\n render \"sorry\"\n end\n end", "def paypal\n if params[:token]\n if @subscription.complete_paypal(params[:token])\n login_and_email\n render :action => :thanks\n else\n render :action => 'billing'\n end\n else\n redirect_to :action => \"billing\"\n end\n end", "def new\n if Payable.find(session[:pay_id]).settled\n flash[:notice] = \"Cobrança já está quitada\"\n redirect_to \"/payable_billings/?id=#{session[:pay_id]}\"\n end\n @payable_billing = PayableBilling.new\n @payable_billing.payable_id = session[:pay_id]\n @payable_billing.provider_id = Payable.find(session[:pay_id]).provider_id\n\n # respond_to do |format|\n # format.html # new.html.erb\n # end\n end", "def update_info_one\n if sel.first(\"h1\", text: \"Sign-In\", minimum: 0, wait:2)\n ret = helper_checkout_signin()\n end\n \n radio = sel.first(\"div.a-radio input\", minimum: 0 )\n if ! radio\n puts \"skipping: #{order_id} - no button\"\n return\n end\n\n radio.click()\n if (input = sel.first(\"div.apx-add-credit-card-number input\", minimum: 0, wait: 5))\n input.set(CC_STR)\n sel.click_button(\"Verify card\")\n sleep(1)\n end\n sel.first(\"input[name='ppw-widgetEvent:SetPaymentPlanSelectContinueEvent']\").click()\n # sel.click_button(\"Continue\")\n sleep(2)\n if sel.first(\"h4\", text: \"Payment information has been updated\", minimum: 0, wait: 10)\n puts(\"done: \") # would be nice to print order_id here\n else\n puts(\"**** ERROR #{order_id}\")\n end\n\n end", "def payment_params\n params.require(:payment).permit(:ref, :company_id, :user_id, :paymethod_id, :companyaccount_id, :price, :vat, :total, :date, :inc_type, :notes, :state)\n end", "def paid(id)\n\t\t@user = User.find(id)\t\n\t\t\tmail(\n\t\t :subject => 'New Sign Up' ,\n\t\t :to => 'patrick@relationally.net' ,\n\t\t :track_opens => 'true'\n\t\t\t)\n\tend", "def show\n p session[:payment_id]\n if params[:paymentId] && params[:PayerID] && params[:paymentId] == session[:payment_id]\n if PayPal::SDK::REST::Payment.find(params[:paymentId]).execute( :payer_id => params[:PayerID] )\n @order.update(approved: true, paid: true)\n p 'succes payments'\n CinemaMailer.sale(@order).deliver_later(wait: 1.seconds)\n else\n puts @payment.error # Error Hash\n @tmp = 1\n @order\n end\n else\n p 'error payments'\n @tmp = 0\n end\n end", "def show\n @payment = Payment.new\n @creditcard = ActiveMerchant::Billing::CreditCard.new\n \n end", "def payments\n if params['form_payment']\n results = CsApi::Member.update(current_access_token, @current_user.username, params['form_payment'])\n #check for errors!!\n if results['success'].eql?('false')\n flash.now[:error] = results['message']\n else\n flash.now[:notice] = 'Your payment information has been updated.'\n get_account\n end\n end\n # set the member's id for docusign\n @memberId = @account['id']\n @payments = CsApi::Member.payments(current_access_token, @current_user.username)\n @payments.each do |record| \n if record['status'].eql?('Paid')\n @show_paid_section = true\n else \n @show_outstanding_section = true\n end\n end\n @page_title = 'Your Payments and Payment Info'\n respond_to do |format|\n format.html\n format.json { render :json => @payments }\n end\n end", "def create\n @user = User.find_by(id: payment_params[:user_id])\n # puts @user.name\n if (@user)\n #set user entered params\n @payment = Payment.new\n @payment.user_id = payment_params[:user_id]\n @payment.routing_number = payment_params[:routing_number]\n @payment.account_number = payment_params[:account_number]\n @payment.account_name = payment_params[:account_name]\n if (payment_params[:account_type] != \"checking\" && payment_params[:account_type] != \"savings\")\n @payment.account_type = \"checking\"\n else\n @payment.account_type = payment_params[:account_type]\n end\n\n #set dwolla generated params\n @payment.customer = Payment.create_dwolla_customer(@user)\n @payment.funding_source = Payment.link_funding_source(@payment)\n Payment.verify_customer(@payment.funding_source)\n\n if @payment.save\n render :show, status: :created, location: @payment\n else\n render json: @payment.errors, status: :unprocessable_entity\n end \n\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end", "def payment_params\n params.require(:payment).permit(:user_id, :unit_id, :utility_charge_id, :total_paid, :pay_type)\n end", "def create\n params[:payment][:amount].gsub!(/[$,]/, \"\")\n params[:payment][:amount] = (params[:payment][:amount].to_f * 100).to_i\n @payment = Payment.new(payment_params)\n\n if params[:booth_id]\n @payable = @booth = Booth.find(params[:booth_id])\n @payer = @booth.vendor\n else\n @payer = Vendor.find(params[:vendor_id])\n end\n\n @payment.payer = @payer\n @payment.payable = @payable\n\n if @payment.save\n if @payment.errors.empty?\n redirect_to(@payment.payable || @payment.payer, notice: \"Payment was successfully created.\")\n else\n redirect_to(@payment.payable || @payment.payer, alert: @payment.errors.full_messages.join(\".\\n\") + \".\")\n end\n else\n @editable = true\n render(:new)\n end\n end", "def create\n @profile = current_user.profile\n @payment = Payment.new(payment_params)\n @payment.profile = current_user.profile\n if @payment.save\n uri = URI('http://acm.ut.ac.ir/epayment/payments')\n parameters = {\n 'merchant' => \"4452A141\",\n 'amount' => @payment.amount,\n 'redirect' => \"http://acm.ut.ac.ir/events/payments/approve\"}\n response = transact(uri, parameters)\n puts response.body\n @payment.response = response.body\n parsed_response = JSON.parse(response.body)\n if parsed_response[\"status\"] != 1\n redirect_to payments_path, notice: \"در ارتباط با بانک خطایی رخ داده‌است.\"\n return\n end\n @payment.reference_key = parsed_response[\"reference\"]\n if @payment.save\n redirect_to parsed_response[\"bank\"]\n return\n else\n render :new\n end\n else\n render :new\n end\n\n end", "def create\n # You maybe want to log this notification\n notify = Paypal::Notification.new request.raw_post\n \n # Split the item_id\n account_id = notify.item_id\n \n @user = User.find account_id\n\n if notify.acknowledge\n # Make sure you received the expected payment!\n if notify.complete? and 9.99 == Decimal.new( params[:mc_gross] ) and notify.type == \"subscr_payment\"\n # All your bussiness logic goes here\n @user.premium = true\n @user.valid_till = Date.today + 1.month\n @user.save\n render :nothing => true\n end\n end\n end", "def process_payment \n if params != nil \n @order =Checkout.new( \n :name => params[:name],\n :pay_method => params[:pay_method] ,\n :total_price => params[:total_price].to_i)\n end \n\n if not params[:pay_err]\n render :layout => \"paygate\" \n else\n # @err = params[:pay_err].force_encoding('utf-8')\n @error_code = params[:replycode] \n flash[:error] = @error_code\n redirect_to pay_url\n end \n end", "def create_the_payment_exhibition\n if((params[:invoicing_info][:payment_medium] == \"visa\") or (params[:invoicing_info][:payment_medium] == \"paypal\") or (params[:invoicing_info][:payment_medium] == \"master_card\")) \n credit_card = CreditCard.find_by_user_id(current_user.id)\n if credit_card.blank?\n credit_card = CreditCard.new()\n end\n credit_card.number = params[:credit_card][:number0]+params[:credit_card][:number1]+params[:credit_card][:number2]+params[:credit_card][:number3]+params[:credit_card][:number4]+params[:credit_card][:number5]+params[:credit_card][:number6]+params[:credit_card][:number7]+params[:credit_card][:number8]+params[:credit_card][:number9]+params[:credit_card][:number10]+params[:credit_card][:number11]+params[:credit_card][:number12]+params[:credit_card][:number13]+params[:credit_card][:number14]+params[:credit_card][:number15]\n credit_card.user_id = current_user.id\n credit_card.first_name = params[:credit_card][:first_name]\n credit_card.last_name = params[:credit_card][:last_name]\n credit_card.expiring_date = Date.civil(params[:credit_card][\"expiring_date(1i)\"].to_i,params[:credit_card][\"expiring_date(2i)\"].to_i,params[:credit_card][\"expiring_date(3i)\"].to_i).strftime(\"%y-%m-%d\") \n credit_card.save\n else\n end \n creditcardnumber = params[:credit_card][:number0]+params[:credit_card][:number1]+params[:credit_card][:number2]+params[:credit_card][:number3]+params[:credit_card][:number4]+params[:credit_card][:number5]+params[:credit_card][:number6]+params[:credit_card][:number7]+params[:credit_card][:number8]+params[:credit_card][:number9]+params[:credit_card][:number10]+params[:credit_card][:number11]+params[:credit_card][:number12]+params[:credit_card][:number13]+params[:credit_card][:number14]+params[:credit_card][:number15]\n #######################################this is im copying here is something from payment controller create method\n @order = session[:purchasable] \n if @order.blank?\n render :text =>\"Please Refresh The Page And Try Again\"\n return\n else \n @order.save\n current_user.profile.biography = params[:biography]\n current_user.profile.save\n end\n @current_object = Payment.new(params[:payment])\t\t#@invoice = session[:invoice]\t\t\n \n if @order.instance_of? ExhibitionsUser\n @current_object.amount_in_cents =params[:invoice_amount].to_i*100\n elsif @order.instance_of? CompetitionsUser\n @current_object.amount_in_cents = (@order.find_price(@order.competition.id) ) * 100\n else \n end\n @current_object.user = @current_user\t\t#@current_object.invoice = @invoice\n if @order.instance_of? ExhibitionsUser\n if params[:invoicing_info][:payment_medium] == \"visa\" or params[:invoicing_info][:payment_medium] == \"master_card\" \n @current_object.common_wealth_bank_process((params[:invoice_amount].to_i*100),params,creditcardnumber)\n \n elsif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n elsif params[:invoicing_info][:payment_medium] == \"paypal\" \n #@current_object.make_paypal_payment((params[:invoice_amount].to_i),params) \n session[:paypal_amount] = params[:invoice_amount].to_i*100\n set_the_token#from here i need to redirect him to paypal after getting the token\n session[:invoice_id] = params[:invoice_id]\n session[:order] = @order\n session[:exhibition_id] = @order.exhibition.id\n session[:current_object_id] = @current_object\n render :update do |page|\n page[\"modal_space_answer\"].hide \n page[\"paypal_form\"].replace_html :partial=>\"paypal_form\",:locals=>{:token =>@token,:amt=>params[:invoice_amount].to_i}\n page.call 'submit_my_form'\n end\n return\n end\n elsif @order.instance_of? CompetitionsUser\n if @order.invoices.last \n total_amount = 0\n @order.invoices.each {|x| total_amount = total_amount + x.final_amount}\n if total_amount < @order.find_price(@order.competition.id) \n more_amount = (@order.find_price(@order.competition.id) ) - total_amount\n @current_object.amount_in_cents = more_amount * 100\n if params[:invoicing_info][:payment_medium] == \"visa\" or params[:invoicing_info][:payment_medium] == \"master card\" \n @current_object.common_wealth_bank_process((more_amount * 100),params)\n elsif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n elsif params[:invoicing_info][:payment_medium] == \"paypal\" \n @current_object.make_paypal_payment((more_amount * 100),params) \n end\n else\n render :text=>\"You Did not changed the entry field or if you decremented it then send email to admin \"\n return\n end \n else\n if params[:invoicing_info][:payment_medium] == \"visa\" or params[:invoicing_info][:payment_medium] == \"master card\" \n @current_object.common_wealth_bank_process(((@order.find_price(@order.competition.id) ) * 100),params)#payment is done if invoice is not yet created. for competition user\n elsif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n elsif params[:invoicing_info][:payment_medium] == \"paypal\" \n @current_object.make_paypal_payment(((@order.find_price(@order.competition.id) ) * 100),params) \n end \n end \n else #here it may be come that while working in this method and it fails somewhere and session[:purchasable] = nil. generaly this is not the normal case\n if @order.instance_of? Order\n make_order_payment\n return\n else\n render :text=>\"There Is Internal Error While Making the payment Please Try Go Back And Try Again<a href='/admin/profiles/#{current_user.id}'>Back</a> \"\n end\n return\n end#bank procedure if end\n\t\t#here after the payment is done what message is required to be sent is get decided and the invoice is get generated\n if @current_object.state == 'online_validated'\t # flash[:notice] = 'Your Payment Is Done And Invoice Will Be Sent To You By Email'\n if @order.instance_of? CompetitionsUser \n if @order and @order.invoices.last\n total_amount = 0\n @order.invoices.each {|x| total_amount = total_amount + x.final_amount}\n if total_amount < @order.find_price(@order.competition.id) \n make_the_payment\n render :partial=>\"extra_payment_done\",:locals=>{:competition=>@order.competition,:order=>@order} \n return \n else\n # flash[:error] = \"Your Payment Is Already Done Please Go To Home Page <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n end\n render :text => @template.blank_main_div(:title => 'System error', :hsize => 'sixH', :modal => true), :layout => false\n return\n else \n make_the_payment\n end\n else\n if @order.instance_of? ExhibitionsUser \n make_the_payment_exhibition\n end\n end \n if @order.instance_of? ExhibitionsUser \n \n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. <a href='/admin/exhibitions/#{@order.exhibition.id}'>Select Artwork</a>\"\n else\n invoice = Invoice.find(:last,:conditions=>[\"purchasable_type = ? and client_id = ? and purchasable_id = ?\",\"ExhibitionsUser\" , @order.user,@order.id])\n \n if invoice.state == \"created\"\n alreadypaidamt = @order.price - invoice.final_amount\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n create_pdf(invoice.id,invoice.number,@order.exhibition.timing.starting_date.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,@order.price.to_i,note,@order.price - alreadypaidamt,alreadypaidamt,true,@order.exhibition.timing.ending_date,\"\")\n QueuedMail.add('UserMailer','send_invoice_exhibition',[@current_object.user.profile.email_address,\"invoice#{invoice.id}\",\"Your Exhibition Payment Is Done And An Invoice Is Sent to Your Email.\",invoice, @current_object.user],0,true,@current_object.user.profile.email_address,\"test@pragtech.co.in\") \n end \n \n #render :text=>\"Your Payment Is Done Now Upload And Then Select The Artworks <a href='/admin/exhibitions/#{@order.exhibition.id}'>Select Artwork</a>\"\n #render :partial => \"online_response_exhibition_payment\",:locals=>{:exhibition_user_id=>@order.id,:artwork_count=>0}\n add_exhibition_artwork_insamediv\n\t\t\t \n end \n elsif @order.instance_of? CompetitionsUser\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n #render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. Please Make The Payment Before #{@order.submission_date} <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n render :partial=> \"cash_cheque_response\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order_id=>@order.id,:total_entry=>@order.total_entry}\n else\n #session[:total_entry] = @order.total_entry\n #render :update do |page|\n # session[:store_for_submitting_the_artwork] = @order.id\n #page[\"show_me_the_error\"].replace_html :partial=>\"add_artwork_link\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order_id=>@order.id}\n #end\n render :partial=>\"add_artwork_link\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order_id=>@order.id}\n #render :text=>\"Your Payment Is Done . The Invoice Is Sent To You By Email. <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n end \t \n end\n else\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n if @order.instance_of? CompetitionsUser\n make_the_payment\n else\n make_the_payment_exhibition\n invoice = Invoice.find(:last,:conditions=>[\"purchasable_type = ? and client_id = ? and purchasable_id = ?\",\"ExhibitionsUser\" , @order.user,@order.id])\n if invoice.state == \"created\"\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n senttime \n if invoice.sent_at\n senttime = invoice.sent_at.strftime(\"%d %b %Y\")\n else\n senttime = Time.now.strftime(\"%d %b %Y\")\n end\n \n \n create_pdf(invoice.id,invoice.number,senttime,invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,note)\n \n QueuedMail.add('UserMailer', 'send_invoice_exhibition', [invoice, @order.user], 0, true)\n end \n end \n if @order.instance_of? CompetitionsUser \n # render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. Please Make The Payment Before #{@order.competition.submission_deadline} <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n render :partial=> \"cash_cheque_response\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order=>@order,:total_entry=>@order.total_entry}\n return \n else\n #exhibition cash_cheque_response\n # render :partial => \"cash_cheque_response_exhibition\",:locals=>{:exhibition_user_id=>@order.id,:artwork_count=>0}\n #instead of this response i need to give the option to add the artwork to user\n \n render :update do |page|\n page[\"add_the_artwork0\"].replace_html :partial=>\"add_the_artwork_exhibition\",:locals=>{:exhibition_user_id => @order.id,:exhibition_id=>@order.exhibition.id,:messageforimageuploaded=>\"After Your Payment Is Done Admin Will Validate You. Please Upload The Artwork\"}\n page[\"description_competition_ex_py\"].hide\n page[\"enterartworkcompetition\"].show\n page[\"add_the_artwork0\"].show\n page[\"iteam_image0\"].show\n page[\"iteam_image_uploaded\"].hide\n \n end\n #render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. <a href='admin/exhibitions/#{@order.exhibition.id}'>Select Artwork</a>\"\n end \t \n return\n end\n\t \n #flash[:error] = 'Error during the payment save '+@current_object.state.to_s\n\t \n #render :partial => 'new', :layout => false\n render :text=>\"Your payment has not been successful. Please check your details and try again\"\n end\n\n end", "def payment_params\n params.require(:payment).permit(:account_id, :customer_name, :amount, :status, :current_balance)\n end", "def payment_params\n params.require(:payment).permit(:value, :date, :bill_id, :source_hash, :bill_hash)\n end", "def fill_visit\n begin\n claim = Claim.find(params[:id],:include=>'policy')\n @payments = Payment.paginate(:all,\n :conditions=>[\"practice_id=? and unattributed_amount > 0 and carrier_id = ? and type = 'CarrierPayment'\",session[:practice_id],claim.policy.carrier_id],\n :page=>params[:page],\n :per_page=>PER_PAGE)\n @payment_no_of_record=@payments.length\n @payment_current_action = \"fill_visit\"\n @payment_controller_name = 'payment'\n payment_paging \n if params[:payment_task] != \"payment_paging\" \n visit_details\n else\n render :partial=>'payment_info' \n end\n rescue => e\n render :text=> \" #{e.message}\"\n end\n end", "def paid(order)\n @order = order\n\n mail :to => order.billing_address.email\n end", "def paypal_confirm\n @token, @payer_id = params[:token], params[:PayerID]\n if @token and @payer_id\n @details = EXPRESS_GATEWAY.details_for(@token)\n\n if @details.success?\n @address = \"#{@details.address['company']} #{@details.address['address1']} #{@details.address['address2']} #{@details.address['city']} #{@details.address['state']} #{@details.address['zip']} #{@details.address['country']}\"\n @cart.update_attributes! :name => @details.name,\n :address => @address,\n :email => @details.email,\n :phone => @details.contact_phone,\n :instructions => @details.message\n else\n flash[:error] = \"could not perform EXPRESS_GATEWAY.details\"\n redirect_to :controller=>:store, :action=>:error\n end\n else\n flash[:error] = \"could not find token or payer id\"\n redirect_to :controller=>:store, :action=>:error\n end\n end", "def create\n @payment = Payment.new(payment_params)\n @order = Order.find(params[:order_id])\n @payment.order_id = @order.id\n @payment.total = @order.total\n @payment.state = \"Completed\"\n @payment.token = \"tkn\" #ONLY DURING TESTS\n @payment.payment_method_id = params[:payment][:payment_method_id]\n @order.state = \"Completed\"\n @order.save\n respond_to do |format|\n if @payment.save\n format.html { redirect_to root_path, notice: \"Payment was successfully created.\" }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment_params\n params.require(:payment).permit(:order_id, :customer_id, :amounts, :payment_method, :note)\n end", "def save_with_payment\n if valid? # We did added some validation to make sure user filled in properly ::contact.rb\n # After Stripe get this info, Stripe will do the charging, this method comes from Stripe gem\n # Stripe will return an id after charging\n customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token) # Stripe had upgrade their API from card: -> source:\n # Set a property to the user after received the id Stripe returned(stripe will return customer hash)\n # 'self' means the target of this function, in this case is User, and we set a new atribute stripe_customer_token to User. \n self.stripe_customer_token = customer.id # Setting stripe_customer_token to Stripe::customer.id \n save!\n end\n \n end", "def user_payment_callback\n @user = User.find_by(bill_id: params[:id])\n @user.skip_icpassport_validation = true\n @last_ezi = User.all.where.not(:ezi_id => nil).order(:ezi_id).last.ezi_id.gsub(/[^0-9]/, '').to_i\n @ezi_id = @last_ezi + 1\n @ezi_id_string = \"Q\" + @ezi_id.to_s.rjust(4,'0')\n @expiry = @user.package * 365\n response = BillplzReg.check_status(@user.id)\n if (response['paid'] == true) && (response['state']=='paid')\n @user.update_attributes(status: 1, :ezi_id => @ezi_id_string, :expiry => @expiry.days.from_now)\n render body: nil\n end\n end", "def express_checkout_complete \n paypal_token = params[:token] \n @prize = Prize.find_by_paypal_token(paypal_token, :conditions => [\"paypal_state = 'purchase_setup'\"]) \n @details = gateway.details_for(paypal_token) \n \n if !@details.success?\n #paypal has reported error back to our system\n paypal_error(@details) \n else \n \n #might want to add to debug\n logger.info \"Customer name: #{@details.params['name']}\" \n logger.info \"Customer e-mail: #{@details.params['payer']}\" \n \n @response = gateway.purchase( \n amount_in_cents(@prize.paypal_prizecost), \n :token => @details.params['token'], \n :payer_id => @details.params['payer_id'] \n )\n \n if !@response.success? \n paypal_error(@response) \n else \n @prize.update_attributes(\n :paypal_state => 'closed',\n :paypal_amount => @response.params['gross_amount'] \n ) \n \n #send to prize confirmation page \n end #!@response.success? \n end #!@details.success?\nend", "def payment_params\n params.require(:payment).permit(:card_number, :exp_month, :exp_year, :name, :cvc)\n end", "def show\n pr params\n pr payu_verify_return\n # IF payed, push to queue - onl once\n # todo\n end", "def edit\n @user = current_user\n @order = Order.find(params[:id])\n @price_plan = Country.get_price_plan_by_country_and_id(current_user.account.country_short, @order.price_plan_id)\n\n if @price_plan.country.paypal_email.blank?\n @order.set(:express_subject, Rails.application.config.paypal_options[:subject])\n else\n @order.set(:express_subject, @price_plan.country.paypal_email)\n end\n\n express_gateway = Order.paypal_express_gateway(@order.express_subject)\n @paypal_details = express_gateway.details_for(params[:token])\n\n begin\n PaypalDetail.log_details(params, @paypal_details, @order, 'edit')\n rescue => e\n NotificationMailer.oddity(\"Could not log PayPal details in edit. Error #{e}\").deliver\n end\n\n error_code_token_already_used = \"10415\"\n respond_to do |format|\n if (@paypal_details.params['ack'] == \"Failure\" or @paypal_details.payer_id.nil?) and @paypal_details.params['error_codes'] != error_code_token_already_used\n @order.update_attributes(state: 'failed', express_token: params[:token], express_payer_id: @paypal_details.payer_id)\n format.html { redirect_to(action: 'failure') }\n else\n @order.update_attributes(state: 'review', express_token: params[:token], express_payer_id: @paypal_details.payer_id)\n format.html {render(layout: 'registration')}\n end\n end\n end", "def postfill!(customer)\n self.price = customer.subscription.plan.amount / 100\n self.stripe_id = customer.id\n self.exp_month = customer.active_card.exp_month\n self.exp_year = customer.active_card.exp_year\n self.last4 = customer.active_card.last4\n self.status = \"active\"\n self.save!\n self\n end" ]
[ "0.6366082", "0.6306154", "0.62494206", "0.62494206", "0.62494206", "0.62202424", "0.62132996", "0.6206791", "0.61795735", "0.6153279", "0.61506045", "0.60996294", "0.60972005", "0.6079605", "0.60698265", "0.6047013", "0.6025383", "0.6025383", "0.6025342", "0.60138553", "0.60134274", "0.60023993", "0.5998148", "0.59948725", "0.5993218", "0.5985416", "0.5974632", "0.59478253", "0.5937983", "0.59317994", "0.59177524", "0.5911337", "0.5906978", "0.5899405", "0.5898718", "0.5898718", "0.5894667", "0.58885306", "0.5884761", "0.5884428", "0.5877345", "0.5870519", "0.58667594", "0.5863586", "0.5848561", "0.58340394", "0.58275133", "0.5823458", "0.5823116", "0.58228344", "0.58161837", "0.5815404", "0.58137524", "0.58087146", "0.5800851", "0.57995677", "0.5798819", "0.5797509", "0.57974", "0.5789554", "0.5784803", "0.5782797", "0.57822", "0.57815397", "0.5780676", "0.57769305", "0.57749885", "0.57724017", "0.5770838", "0.57628554", "0.5762213", "0.57615596", "0.57608527", "0.57603025", "0.575917", "0.57587224", "0.57534295", "0.5752807", "0.57453", "0.57439476", "0.5738823", "0.57371175", "0.5736964", "0.57351685", "0.5725167", "0.5722738", "0.57198226", "0.57197857", "0.5715926", "0.57152086", "0.5711906", "0.5709804", "0.5701811", "0.5700083", "0.5698442", "0.56966037", "0.56943315", "0.5686297", "0.56827116", "0.5682602", "0.5682134" ]
0.0
-1
Remind users of conversations that have not been accepted or rejected
def confirm_reminder(conversation, recipient, community, days_to_cancel) @email_type = "email_about_confirm_reminders" recipient = conversation.buyer set_up_layout_variables(recipient, community, @email_type) with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do @conversation = conversation @days_to_cancel = days_to_cancel template = "confirm_reminder" premailer_mail(:to => recipient.confirmed_notification_emails_to, :from => community_specific_sender(community), :subject => t("emails.confirm_reminder.remember_to_confirm_request")) do |format| format.html { render template } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_pending\n if user.incoming_friend_requests.pluck(:user_id).include?(friend_id)\n errors.add(:friend, 'already requested friendship')\n end\n end", "def user_candidates_for_reminder\n states = ['submitted', 'under_review', 'reviewed', 'scheduled', 'received',\n 'receiving', 'inactive'] # NOT draft, closed or cancelled\n user_ids = Offer.where(state: states).distinct.pluck(:created_by_id)\n User.joins(subscriptions: [:message]).\n where('users.id IN (?)', user_ids).\n where(\"COALESCE(users.sms_reminder_sent_at, users.created_at) < (?)\", delta.iso8601).\n where('subscriptions.state': 'unread').\n where(\"messages.created_at > COALESCE(users.sms_reminder_sent_at, users.created_at)\").\n where('messages.sender_id != users.id').\n distinct\n end", "def pending_friends\n inverse_friendships.map{ |fs| fs.user unless fs.accepted? }.compact\n end", "def accepted_invitees\n (collaborations.where(is_accepted: true) + Collaboration.where(collaboration_level: documents, is_accepted: true)).uniq(&:collaborator_id)\n end", "def refused_users(users)\n emails = email_list(users.map(&:email))\n if users.count == 0\n nil\n else\n \"#{emails} indicated that they were not present for the meeting.\".html_safe\n end\n end", "def index\n\n @users_with_conversation = []\n @messages = Message.where(receiver_id: params[:user_id]).reverse_order\n @new_messages = @messages.where(unread: true)\n @messages.each do |message|\n unless @users_with_conversation.include?(message.sender)\n @users_with_conversation.push(message.sender)\n end\n end\n @messages = Message.all\n end", "def pending_accept\n received_requests.where(confirmed: nil)\n end", "def pending\n pending_friends | pending_friend_requests\n end", "def teams_unaccepted\n requests.where(is_accepted: false).map(&:team).flatten\n end", "def pending_acceptance\n inverse_friendships.map(&:user_id) - friendships.map(&:friend_id)\n end", "def pending\n pending_friends | inverse_pending_friends\n end", "def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end", "def index\n @messages = @conversation.messages\n @messages.where(\"user_id != ? AND read = ?\", current_user.id, false).update_all(read: true)\n if @conversation.sender == current_user\n @msg_not = @conversation.recipient\n else\n @msg_not = @conversation.sender\n end\n if current_user != @conversation.sender \n if current_user != @conversation.recipient\n redirect_to conversations_path\n end\n end\n @message = @conversation.messages.new\n end", "def pending_friend_acceptance\n friendships.map(&:friend_id) - inverse_friendships.map(&:user_id)\n end", "def pending_acceptance\n merge(CourseUser.with_invited_state)\n end", "def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end", "def friend_candidates(for_channels)\n User.all.keep_if { |other|\n (for_channels == other.channel?) && # Select for channels or regular users\n User.public?(other.id) && # Exclude invisible users\n (other.channel? || (other.sign_in_count && (other.sign_in_count > 0))) && # Excluded unconfirmed invites\n (other.id != id) # Don't include this user\n }\n end", "def accept\n # a notification message will be delivered to the the requestor anyway;\n # it may contain a personal note, if any was supplied\n group = Network.find(@membership.network_id)\n invite = @membership.is_invite?\n \n personal_message = \"NONE\"\n if params[:accept_msg] && !params[:accept_msg].blank?\n personal_message = ae_some_html(params[:accept_msg])\n end\n\n # the messages will appear as 'deleted-by-sender', because the owner of the account effectively didn't send it,\n # so there is no reason for showing this message in their 'sent messages' folder\n\n if invite\n from = User.find(@membership.user_id)\n\n subject = \"Invitation to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted an invitation to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).each {|to| \n send_action_message(from.id, to.id, subject, body)\n }\n else\n from = current_user\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted your request to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %>:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n send_action_message(from.id, @membership.user_id, subject, body)\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :other => @membership.user_id, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted a request by <%= name(other) %> to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %> to user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).select{|admin| admin.id != from.id}.each {|to|\n send_action_message(from.id, to.id, subject, body)\n }\n end\n\n respond_to do |format|\n if @membership.accept!\n flash[:notice] = 'Membership was successfully accepted.'\n format.html { redirect_to network_path(@membership.network_id) }\n else\n flash[:error] = \"Membership already accepted.\"\n end\n format.html { redirect_to network_path(@membership.network_id) }\n end\n end", "def sent_friend_requests\n Friendship.where(:sender_uid => self.uid, :accepted => false)\nend", "def pending_or_accepted_friends\n self.friends + self.pending_friends\n end", "def friend_requests\n @user_fr.inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end", "def verify_banned_message\n if sender.banned?\n self.body = \"This user’s messages have been removed because #{sender.the_sex_prefix} activities violates the LoveRealm community standards. Do not correspond with #{sender.the_sex_prefix}\"\n self.kind = 'text'\n end\n end", "def friendable_users\n User.all.where.not('id IN (?)', [id] + friends.ids +\n friend_requests_sent.pending.pluck(:receiver_id) + friend_requests_received.pending.pluck(:sender_id))\n end", "def pending\n pending_friends | requested_friendships\n end", "def pending\n pending_friends | requested_friendships\n end", "def notify_users\n board = Conversation.find(conversation_id).board\n if (board.public)\n users = User.ids - [user_id]\n users.each do |u|\n Notification.create(user_id: u, comment_id: id, conversation_id: conversation_id)\n end\n else #if the board is not public, Notifications are sent to the specific people.\n role_applications = RoleApplication.where(status: 'Approved')\n role_applications.each do |app|\n Notification.create(user_id: app.user_id, comment_id: id, conversation_id: conversation_id) if app.user_id != user_id\n notify_production_team\n end\n end\n end", "def invite_rejected\n\t\t@players[0].socket.send({\"inviteRejected\"=>true}.to_json)\t\t\n\t\t@state = :CLOSED\n\tend", "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end", "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end", "def pending_friend_requests_from\n self.inverse_friendships.where(state: \"pending\")\n end", "def tweet_rejected_by_influencer_in_dialog(tweet)\n @tweet = tweet\n\n set_attachments\n\n @screen_name = tweet.influencer.user.twitter_screen_name\n\n tweet.campaign.influencers.each do |influencer|\n mail(to: influencer.user.email, subject: \"Notificaciones @ Social Target - Una campaña en la que participas fue cancelada. Tweet rechazado por @\"+@screen_name+ \". \")\n end\n\n mail(to: tweet.campaign.advertiser.user.email, subject: \"Notificaciones @ Social Target - Tweet rechazado por @\"+@screen_name+ \". \"+@tweet.reject_cause)\n\n case APP_CONFIG['app_country']\n when 'AR'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - Un tweet realizado por \"+tweet.campaign.advertiser.user.email+\" fue rechazado por @\"+@screen_name+ \". \"+@tweet.reject_cause)\n when 'CO'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - Un tweet realizado por \"+tweet.campaign.advertiser.user.email+\" fue rechazado por @\"+@screen_name+ \". \"+@tweet.reject_cause)\n when 'MX'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - Un tweet realizado por \"+tweet.campaign.advertiser.user.email+\" fue rechazado por @\"+@screen_name+ \". \"+@tweet.reject_cause)\n end\n\n end", "def candidates_applied\n users.where('users.status <> :s', s: USER_STATUS_DELETED)\n end", "def rejected_comments\n comments.select {|comment| comment.approved == false }\n end", "def sent_friend_requests\n self.followed_users.where(\"friend_status = 'PENDING'\")\n end", "def members_not_responding\n memb = sent_messages.map { |sm| (sm.msg_status || -1) < MessagesHelper::MsgDelivered ? sm.member : nil }.compact\n end", "def candidates_forwarded_or_rejected\n users.where('users.status <> :us AND user_campaigns.status in (:cs)', us: USER_STATUS_DELETED, cs: [USER_CAMPAIGN_STATUS_FORWARDED, USER_CAMPAIGN_STATUS_REJECTED])\n end", "def confirmations_for(invitation)\n self.confirmations.find(:all, \n :conditions => ['invitation_id = ? AND status_id != ? AND status_id != ?', invitation.id, Status['approved'].id, Status['new'].id])\n end", "def pending_friend_requests_from\n \tself.inverse_friendships.where(state: \"pending\")\n end", "def completed\n email_id = Email.find_by_email(current_user.email).id\n @reminds = Remind.where(:email => email_id)\n end", "def sent_friends\n Friendship.where(:sender_uid => self.uid, :accepted => true)\nend", "def accepted\n FriendshipsMailer.accepted(User.last, User.first)\n end", "def pending_or_accepted_friends\n \t friends + pending_friends\n \t end", "def people(convo)\n @recipients = convo.conversation.users.where('user_id <> ?', current_user)\n end", "def pending_friends\n friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end", "def pending_friends\n friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end", "def pending_invited\n self.class.find(pending_friend_ids)\n end", "def transferrable_to_users\n collaborator_users.where.not(id: user_id)\n end", "def pending_friends\n @user_fr.friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end", "def unanswered_questions\n Question.all.reject do |question|\n responsers_id = question.responses.pluck(:user_id)\n responsers_id.include?(self.id)\n end\n end", "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end", "def deny_users(deny_ids)\n deny_ids.each do |id|\n user = User.find(id)\n if user.update_attributes({approval: -1}, as: :admin)\n @@message = \"The users have been denied.\"\n end\n end\n end", "def conversations\n Conversation.where(\"sender_id = ? or recipient_id = ?\",self.id,self.id)\n end", "def total_messages_not_viewed\n @conversations = @current_user.conversations\n @not_viewed = 0\n @conversations.each do |c|\n @not_viewed += c.how_many_not_viewed(@current_user) unless c.how_many_not_viewed(@current_user) == nil\n end\n end", "def reject_invalid_messages(email_body, last_email_id)\n return true if email_body.id == last_email_id || email_body.label_ids.include?('CHAT')\n false\n end", "def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end", "def suggestions\n @users = User.all.to_ary.select { |user| user != current_user &&\n !current_user.to_fr_ids.include?(user.id) &&\n !current_user.friends.include?(user) &&\n !current_user.from_fr_ids.include?(user.id)\n }\n @requests = current_user.received_friend_requests\n end", "def exclude_sender_in_team_from_recognition_recipients\n sender_recipients = recognition_recipients.select {|rr| rr.user_id == sender&.id }\n if sender_recipients.any?{|rr| rr.team_id.present? } && sender_recipients.none?{|rr| rr.team_id.nil? }\n self.recognition_recipients = self.recognition_recipients.reject{|rr| rr.team_id.present? && rr.user_id == sender.id}\n end\n end", "def pending\n\t\tpending_friends | requested_friendships\n\tend", "def conversations\n Conversation.where(\"sender_id = ? OR recipient_id = ?\", id,id)\n end", "def unanswered_finding_to_manager_notification\n conditions = { state: Finding::STATUS[:unanswered] }\n users = User.joins(:findings).merge(Finding.where(conditions)).limit(1)\n finding = users.take.findings.where(conditions).take\n\n NotifierMailer.unanswered_finding_to_manager_notification finding, users, 1\n end", "def unanswered_finding_notification\n conditions = { state: Finding::STATUS[:unanswered] }\n user = User.joins(:findings).merge(Finding.where(conditions)).take\n\n NotifierMailer.unanswered_finding_notification user, user.findings.find_by(conditions)\n end", "def block_from_invitation?\n false\n end", "def refute_told_to(message)\n return unless messages.map(&:first).include? message\n raise \"Was told to #{message.inspect}, but should not have been!\"\n end", "def accepted_tutor\n if waiting?\n UserMailer.accepted_tutor(self).deliver_now if waiting?\n self.accepted!\n end\n end", "def index\n if !user_signed_in?\n flash.alert = \"You must be logged in to use Messaging\"\n redirect_to root_path\n return\n elsif current_user.rolable.class.name != \"Charity\" && current_user.rolable.class.name != \"Business\"\n flash.alert = \"Messaging is available to Charities and Businesses only\"\n redirect_to root_path\n return\n end\n\n all_messages = (Message.where(\"user_received_id = \" + current_user.id.to_s + \" OR user_sent_id = \" + current_user.id.to_s)).order(:id)\n \n @friends = []\n \n # get people online\n @friends << User.where.not(rolable_type: \"Donor\").where(\"last_ping_time >= ? AND id != ?\", Time.current - 1.minutes, current_user.id) \n\n # get existing conversations\n all_messages.each do |x|\n if(x.user_received_id == current_user.id)\n @friends << User.find(x.user_sent_id) unless @friends.include?(User.find(x.user_sent_id))\n else\n @friends << User.find(x.user_received_id) unless @friends.include?(User.find(x.user_sent_id))\n end\n end\n\n # get people up to 10 total people\n if(@friends.count < 9) \n @friends << User.where.not(rolable_type: [\"Donor\", current_user.rolable_type]).where(\"last_ping_time <= ? or last_ping_time is null\", Time.current - 1.minutes).limit(10 - @friends.count)\n end\n\n @friends.flatten!\n @friends.uniq!\n @search_users = searchUsers()\n @last_message = all_messages.last()\n end", "def unassigned_approvers_for_contract(contract)\n\n # todo: shouldnt have to use select here... theres a better way\n user_ids = contract.approver_users.map {|user| user.id}\n self.approver_users.select {|user| !user_ids.include?(user.id)}\n\n end", "def invited_user_is_not_invited_by_himself\n\t errors[:base] << 'You cannot invite yourself!' if invited_user == invited_by_user\n\t end", "def pending_friend_requests_to\n \tself.friendships.where(state: \"pending\")\n end", "def user_is_not_blocked\n return errors.add(:user, 'You cannot block yourself')\\\n if user_id == blocked_id\n end", "def thanked_by?(user)\n result = self.notifications.where(:sender_id => user.id)\n !result.empty?\n end", "def send_pending_messages\n self.mailbox.conversations.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id).each do |conversation|\n # Get the message that should have been sent\n message = conversation.messages.first\n # Select the admin who should receive the message\n recipient = message.recipients.detect{ |recipient| recipient.is_a? Admin }\n MailboxerMessageMailer.delay(queue: 'mailers').new_message_email_to_admin(message, recipient)\n end\n nil\n end", "def notify_status_denied(user, redemption)\n @reward = redemption.reward\n @denier = redemption.denier\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_denied\", reward_title: redemption.reward.title))\n end", "def agreed\n @choosen = []\n @my_mentees = Pair.find_by_user_id(current_user.id).mentee_id\n if @my_mentees.is_a?(Integer)\n if Pair.find_by_user_id(@my_mentees) != nil\n @my_mentees_choice = Pair.find_by_user_id(@my_mentees).mentee_id\n if @my_mentees_choice == current_user.id\n @choosen.push(@my_mentees)\n end\n end\n else\n @my_mentees.each do |mentee|\n @mentees_matches = Pair.find_by_user_id(mentee).mentee_id\n if @mentees_matches.is_a?(Integer)\n if @mentees_matches == current_user.id\n @choosen.push(@mentees_matches)\n end\n elsif @mentees_matches != nil\n @mentees_matches.each do |me|\n if me == current_user.id\n @choosen.push(me)\n end\n end\n end\n end\n end\n return @choosen.last\n end", "def cancel_pending_requests_if_from_same_club\n self.class.preloaded_data.where(sadhak_profile_id: self.sadhak_profile_id, from_club_id: self.from_club_id, status: self.class.statuses['requested']).each do |sy_club_member_transfer|\n sy_club_member_transfer.responder_user = self.requester_user\n unless sy_club_member_transfer.cancel!\n errors.add(:there, \"is some error while canceling the previous request ##{sy_club_member_transfer.id}. Please contact to board members.\")\n end\n end\n errors.empty?\n end", "def received_friend_requests\n Friendship.where(:reciever_uid => self.uid, :accepted => false)\nend", "def pending_friend_requests_to\n self.friendships.where(state: \"pending\")\n end", "def index\n @conversations = @current_user.conversations\n @not_viewed = 0\n @conversations.each do |c|\n @not_viewed += c.how_many_not_viewed(@current_user) unless c.how_many_not_viewed(@current_user) == nil\n end\n @current_user\n end", "def users_not_responding\n # subscriptions_user_ids = self.plan_subscriptions.map {|subscription| subscription.user.id }\n subscribers_user_ids = subscribers.pluck(:id) #subscribers.map {|user| user.id }\n return group.users if subscribers_user_ids.empty?\n group.users.where('id NOT IN (?)',subscribers_user_ids)\n end", "def find_pending\n notifications.where sent: false\n end", "def accepted_invitations\n User.joins(:attended_events).where( invitations: { accepted: true, event_id: self.id } )\n end", "def participates?(user)\n \tsender == user || recipient == user\n\tend", "def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end", "def recipient_has_not_already_been_invited\n # this will catch if a person wanting beta access already invited themselves\n email = email_asking_for_invite.strip.downcase\n errors.add(:email_asking_for_invite, \"^#{email_asking_for_invite} has already been added to the invitation list\") if InvitationLink.where(:email_asking_for_invite => email).exists?\n end", "def has_swimmer_confirmations?\n user_swimmer_confirmations ? user_swimmer_confirmations.count > 0 : false\n end", "def unanswered\n request('unanswered')\n end", "def check_user_invite_status\n return if @user.accepted_or_not_invited?\n\n redirect_to users_path,\n alert: 'This user has not accepted his invitation yet.'\n end", "def notify_all_users_in_the_conversation(current_user, video, video_owner)\n # send e-mail to the video owner unless the person commented on their own video\n # or their notification settings say not to\n unless (video.user_id == self.user_id)\n # for whatever reason, delayed_job won't send the email unless you do it as a delayed_job\n UserMailer.delay(:priority => 40).new_comment(self, video_owner, false) if video_owner.send_email_for_new_comments\n # Add event to activity feed\n UserEvent.delay(:priority => 40).create(:event_type => UserEvent.event_type_value(:comment), \n :event_object_id => self.id,\n :user_id => video_owner.id,\n :event_creator_id => current_user.id)\n end\n # send e-mail to other people (except the video owner, or the person that just commented) \n # that have commented on the video unless their notification settings say not to\n users_we_will_not_notify = []\n users_we_will_not_notify << video_owner.id << self.user_id\n \n commenters = Comment.where('video_id = ? AND user_id NOT IN (?)', self.video_id, users_we_will_not_notify).group_by(&:user_id)\n unless commenters.blank?\n commenters.each do |comment_owner_id, comment|\n the_commenter = User.find_by_id(comment_owner_id)\n # for whatever reason, delayed_job won't send the email unless you do it as a delayed_job\n UserMailer.delay(:priority => 40).new_comment(self, the_commenter, true) if the_commenter.send_email_for_replies_to_a_prior_comment\n # Add event to activity feed\n UserEvent.delay(:priority => 40).create(:event_type => UserEvent.event_type_value(:comment_response), \n :event_object_id => self.id,\n :user_id => the_commenter.id,\n :event_creator_id => current_user.id)\n end\n end\n end", "def not_currently_shared\n return false unless Share.where(recipient: recipient, user: user, birth_record: birth_record).kept.any?\n\n errors.add(:recipient, 'is currently shared with this entity')\n end", "def prune!\n inactive_approvers.each do |user|\n CurrentUser.scoped(User.system) do\n user.update!(level: User::Levels::CONTRIBUTOR)\n user.feedback.create!(category: \"neutral\", body: \"Lost approval privileges\", creator: User.system, disable_dmail_notification: true)\n\n Dmail.create_automated(\n to_id: user.id,\n title: \"Approver inactivity\",\n body: \"You've approved fewer than #{MINIMUM_APPROVALS} posts in the past #{APPROVAL_PERIOD.inspect}. In order to make sure the list of active approvers is up-to-date, you have lost your approval privileges. If you wish to dispute this, you can message an admin to have your permission reinstated.\"\n )\n end\n end\n end", "def wrong_answered_flashcards\n Flashcard.joins(:user_flashcards).where(user_flashcards: {\n user: self,\n correct: false\n })\n end", "def pending_request\n sent_requests.where(confirmed: nil)\n end", "def send_sms_reminder\n return true # Disable sms sender\n if phone_number and sms_opt_in?\n _participation_requests = participation_requests.where(date: Date.tomorrow, state: 'accepted')\n return false if _participation_requests.empty?\n\n if _participation_requests.length > 1\n message = I18n.t('sms.users.day_before_reminder.multiple_course',\n nb_courses: _participation_requests.length,\n start_time: I18n.l(_participation_requests.first.start_time, format: :short))\n else\n message = _participation_requests.first.decorate.sms_reminder_message\n end\n\n self.delay.send_sms(message, phone_number)\n end\n end", "def receives_emails_for\n recips = user.things_i_track.email_delivery.tracked_item_is_user.map(&:tracked_item_id)\n recips = User.find(:all, :conditions => {:id => recips}) unless recips.blank?\n return recips.uniq.select {|u| user.is_self_or_owner?(u)}\n end", "def pending_friends\n \tself.passive_relationships.where(status_flag: 0)\n end", "def reject_suggestion\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"You have declined the invitation suggestion.\"\n end", "def received_friends\n Friendship.where(:reciever_uid => self.uid, :accepted => true)\nend", "def friendships_pending\n friendships_pending = []\n friendships.where(confirmed: false).each { |fs| friendships_pending << User.find(fs.friend_id) }\n friendships_pending\n end", "def send_confirmations_to_owner\n return @send_confirmations_to_owner\n end", "def can_reject?\n !accepted? && !rejected? && !withdrawn?\n end", "def pending_friend_requests\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n render_json :entry => @user.pending_contacts\n end", "def pending_friends\n Relationship.find_all_by_friend_id_and_approved(self,false)\n end" ]
[ "0.6336204", "0.6250958", "0.6188405", "0.6093664", "0.607747", "0.60472023", "0.6013192", "0.5955956", "0.5931874", "0.59276783", "0.58668715", "0.5860761", "0.5856417", "0.5840829", "0.58334833", "0.5832425", "0.5827985", "0.5823412", "0.5819636", "0.58138144", "0.58131665", "0.58092076", "0.58025444", "0.58022636", "0.58022636", "0.5793698", "0.5791575", "0.5788505", "0.5788505", "0.57736385", "0.57624435", "0.57610184", "0.57567227", "0.5751882", "0.57494307", "0.57487607", "0.5731469", "0.572596", "0.57115644", "0.5707195", "0.57070166", "0.5701523", "0.56997526", "0.5697206", "0.5697206", "0.5689889", "0.5675324", "0.5674241", "0.56681037", "0.5664294", "0.56498134", "0.5641662", "0.56113994", "0.56002426", "0.55958897", "0.5593015", "0.55918944", "0.55803674", "0.55765265", "0.5569753", "0.55632806", "0.55587935", "0.55575156", "0.55492884", "0.5544978", "0.55383795", "0.55373675", "0.5537274", "0.5533439", "0.5530721", "0.55285037", "0.5526674", "0.5525029", "0.55219465", "0.5508069", "0.5500359", "0.5489536", "0.54872835", "0.54867333", "0.5485771", "0.547935", "0.54779243", "0.54767793", "0.5473386", "0.54716164", "0.54684263", "0.5465094", "0.5450331", "0.54451954", "0.543796", "0.5437585", "0.54374045", "0.5436317", "0.5433227", "0.5427445", "0.54255146", "0.5425418", "0.5421426", "0.5420286", "0.542011", "0.5417944" ]
0.0
-1
Remind users to give feedback
def testimonial_reminder(conversation, recipient, community) @email_type = "email_about_testimonial_reminders" set_up_layout_variables(recipient, community, @email_type) with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do @conversation = conversation @other_party = @conversation.other_party(recipient) premailer_mail(:to => recipient.confirmed_notification_emails_to, :from => community_specific_sender(community), :subject => t("emails.testimonial_reminder.remember_to_give_feedback_to", :name => @other_party.name(community))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback\n end", "def feedback\n if correct?\n \"Correct!\"\n else\n \"Incorrect.\"\n end\n end", "def ask_for_feedback\n feedback = show do\n title \"We want your feedback\"\n \n note \"Notice anything weird with this protocol? Tell us below!\"\n \n get \"text\", var: \"feedback_user\", label: \"Enter your feedback here\", default: \"\"\n end\n feedback[:feedback_user] # return\n end", "def feedback\n # check to see if correct is true\n if correct?\n # if correct is true return \"Correct!\"\n \"Correct!\"\n # or else return \"Incorrect.\"\n else\n \"Incorrect.\"\n end\n end", "def ask\n if @help_request.valid?\n MyousicaMailer.deliver_help_request(@help_request)\n flash[:notice] = \"Thanks for contacting us! Your question has been sent to our help desk, you'll receive a reply in few hours.\"\n else\n flash[:error] = \"Your help request could not be sent. Please correct the errors and try again!\"\n end \n\n params[:return_to] ? redirect_to(:action => 'show', :id => params[:return_to]) : redirect_to(:action => 'index')\n end", "def feedback\n SystemMailer.user_feedback(current_user, params[:type], params[:message]).deliver!\n return_message(200, :ok)\n end", "def on_ask(ask)\r\n warn \"Ask \" + ask.to_s\r\n end", "def feedback\n NotebookMailer.feedback\n end", "def feedback()\n return $prompt # $prompt is conditionally populated by good_letter(), word_test() and wrong_letter()\nend", "def prompt_user(message)\n \"no\"\n end", "def user_send_feedback\n\t\t# send feed back to the admin\n\t\tif UserMailer.feedback(current_user,params[:feedback_text]).deliver_now\n\t\t# response to the JSON\n \t render json: { success: true, message: \"Feedback has sent successfully\" },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"problem with sending feedback\" },:status=> 203\n\t end\t\n\tend", "def congrats\n\t\tp \"Congrats on Guessing the Word\"\n\tend", "def prompt_message(pre)\n @greeting = \"Hi\"\n @pre = pre\n @prompt = pre.prompt\n\n mail to: \"#{@pre.user.email}\",\n subject: \"#{@prompt.name}\"\n end", "def ask_again\n\n end", "def submission_confirmation(nominee_conf, client_conf, award_level_conf)\n puts \"You have successfully nominated: #{nominee_conf}\"\n puts \"Client: #{client_conf} and Level of Influence: #{award_level_conf}\"\n puts \"If this is incorrect, please refresh and try again.\"\nend", "def forgot\r\n \r\n end", "def show_wrong\n para \"Sorry, try again.\"\n end", "def forgot\n\n\n\t\t#if user already exists,\n\t\t#attempt to send txt to user\n\t\t#and redirect to session controller to ask user to sign in w pin\n\tend", "def new_feedback\n\n end", "def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end", "def assist\n @email = params[:email]\n if request.post? && !@email.blank?\n user = User.find_by_email(@email)\n if user.nil? || (!user.active? && !user.pending?)\n flash.now[:error] = \"We don't have an active account for '#{@email}'. Please try again, or contact us at #{SUPPORT_EMAIL} if you need assistance.\"\n else\n user.send_reset_password_email!\n flash[:notice] = \"An email has been sent to #{@email}.<br />\".html_safe\n flash[:notice] << \"Follow the instructions in the email to reset your password.\"\n redirect_to signin_url\n end\n end\n end", "def feedback\n NewsletterMailer.feedback\n end", "def user_feedback(user, type, message)\n @user = user\n @type = type\n @message = message\n\n mail(:subject => \"User Feedback (#{type})\")\n end", "def continue_bot_questions\n flash[:notice] = \"This feature has been disabled. Please contact to administrator\"\n return redirect_to home_path\n end", "def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end", "def reject_suggestion\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"You have declined the invitation suggestion.\"\n end", "def confirmed?; end", "def author_feedback_popup\n @response_id = params[:response_id]\n @reviewee_id = params[:reviewee_id]\n unless @response_id.nil?\n first_question_in_questionnaire = Answer.where(response_id: @response_id).first.question_id\n questionnaire_id = Question.find(first_question_in_questionnaire).questionnaire_id\n questionnaire = Questionnaire.find(questionnaire_id)\n @maxscore = questionnaire.max_question_score\n @scores = Answer.where(response_id: @response_id)\n @response = Response.find(@response_id)\n @total_percentage = @response.get_average_score\n @sum = @response.get_total_score\n @total_possible = @response.get_maximum_score\n end\n\n @maxscore = 5 if @maxscore.nil?\n\n unless @response_id.nil?\n participant = Participant.find(@reviewee_id)\n @user = User.find(participant.user_id)\n end\n end", "def pregnancy_to_confirm\n # TODO: add (Just to confirm) . . . if participant known to be pregnant\n \"A\"\n end", "def answer_accepted\n UserMailer.answer_accepted Answer.last\n end", "def new_feedback\n UserMailer.new_feedback\n end", "def feedback\n client.feedback app_id\n end", "def received_feedback(feedback)\n @feedback = feedback\n\n mail :to => \"yahivin@gmail.com\", :reply_to => feedback.email_address || (feedback.user ? feedback.user.email : nil)\n end", "def question_asked\n redirect_to game_question_url unless question?\n end", "def feedback\n\t\t@submission = Submission.find(params[:submissionFeedback][:id])\n\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t# if the assessment exists\n\t\tif @assessment\n\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\tend\n\t\t@submission.send_feedback(params[:submissionFeedback][:Feedback], @creator, @assessment)\n\t\tredirect_to '/submissions/'+params[:submissionFeedback][:id]\n\t\tflash[:info] = 'Feedback was successfully sent.'\n\tend", "def thanks\n end", "def waiting\n code = params[:user] ? params[:user][:promo_code] : nil\n if code and Doers::Config.promo_codes.include?(code)\n current_account.update_attributes(user_params.merge(:confirmed => true))\n notice = _(\"Code worked! Please don't forget to leave your feedback.\")\n redirect_to root_path, :notice => notice\n else\n flash[:alert] =\n _(\"Sorry, but we couldn't validate that promo code.\") if code\n end\n end", "def feedback\n @trader = current_trader\n @trade = Trade.find(params[:formid].to_i)\n if @trade.trader_id == @trader.id\n @trade.feedback = params[:content]\n if params[:rating] <= \"5\"\n @trade.rating = params[:rating]\n end\n @trade.rating = params[:rating]\n @trade.save\n render :text => @trade.feedback\n else\n render :text => \"Whatever you need to response\"\n end\n end", "def NPC_feedback\n\nend", "def user_feedback()\n message = ''\n if flash.has_key?(:notice)\n message = content_tag('div', content_tag('div', content_tag('p',\n flash[:notice]), :class => 'content'), :id => 'flash')\n elsif flash.has_key?(:error)\n message = content_tag('div', content_tag('div', content_tag('p',\n flash[:error]), :class => 'content'), :id => 'flash', :class => 'error')\n else\n message = content_tag('div', '', :id => 'flash')\n end\n message\n end", "def responses\n\t\t_score = Password. new(@pass).strength\n\t\tif (_score >= 50)\n\t\t\treturn \"Congratulations is Strong Password.\"\n\t\telsif (_score > 10 && _score < 50)\n\t\t\treturn \"Weak Password. try with '#{suggestion}'\"\n\t\telse\n\t\t\treturn \"Unacceptable Password, try again with a better password.\"\n\t\tend\n\tend", "def ask_question\n\n end", "def timeis_up\n current_user.submit_answers\n render text: true\n end", "def showing_message\n #if self.user.find_by(User.find(session[:user_id]))\n errors.add(:base, 'A user can vote only once!')\n\n end", "def warning(msg, ask_continue: true)\n tell(colorize(\"☞ \", :magenta) + colorize(msg, :yellow))\n exit(-1) if ask_continue && !quiz(\"continue\")\n end", "def refuse\n @presentation.refuse!\n redirect_to admin_submissions_path((@presentation.poster ? :poster : :contributed) => 1), notice: 'The presentation has been unaccepted.'\n end", "def nlu_handle_input\n # Wit processing will take a while, so we want to show activity\n @message.mark_seen\n @message.typing_on\n return if acted_on_non_questions?\n # Non-questions ruled out, we can\n # save a question to correct later, if needed\n @user.session[:needs_correction] = @message.text\n # Act on a type of question\n act_on_question_types\n # We're done replying\n @message.typing_off\n end", "def confirm(prompt); end", "def prompt_text(form, answer, hint)\n form.text_field :answer, :class => 'form-control input-lg', :placeholder => hint\n end", "def guess_without_choosing_anyone\n click_button(\"Guess\")\n end", "def get_feedback\n @title_page = 'Feedback'\n\n params.each { |question, answer| $game.quiz.user_answer << answer.to_i }\n\n $game.player.score = ($game.quiz.number_corrects * 100) / $game.quiz.question_answer.length\n @feedback = $game.player.score\n\n @questions = $game.quiz.questions\n @user_answer = $game.quiz.user_answer\n\n erb :feedback, layout: :template\nend", "def notice(review)\n @review = review\n @user = \"#{review.movie.user.first_name}, \"\n @greeting = \"Your movie has been reviewed.\"\n\n mail(\n to: review.movie.user.email,\n subject: \"New review posted for #{review.movie.title}\"\n )\n end", "def emailOnFeedback(revieweeId)\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n user=User.find_by_id(participant)\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_feedback\"\r\n if(user.email_on_feedback)\r\n email(user.email,\"feedback\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end", "def get_help \n @booking = Booking.find(params[:id])\n owner = @booking.creator\n Notification.notify_admin(\"#{owner.first_name} #{owner.last_name} has asked for help choosing a presenter for their booking\", booking_path(@booking), :get_help)\n flash[:info] = \"An admin has been notified that you would like help choosing. They will be in contact with you shortly\"\n @booking.help_required = true\n @booking.save\n redirect_to booking_path(@booking)\n end", "def thank_you\n end", "def thank_you\n end", "def thank_you\n end", "def handle_yes_no_question\n answer = %w[Yes No].sample\n @user.session[:last_answer] = answer\n say answer\n end", "def greet\n puts 'Welcome to the school review app, the best resource for school information in the world!'\n @prompt.select(\"Are you a returning user or a new user?\") do |menu|\n menu.choice \"Returning User\", -> { User.handle_returning_user }\n menu.choice \"New User\", -> { User.handle_new_user }\n end\n end", "def feedback_can_be_given?\n !has_feedback? && !feedback_skipped?\n end", "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end", "def notify_question_owner(answer)\n \t@answer = answer\n \t@question = answer.question\n \t@receiver = @question.user\n \tmail(to: @receiver.email,\n \t\t\t subject: \"You've got a new answer!\")\n end", "def feedback(bike)\n @bike = bike\n\n mail to: \"antoine.escarrat@gmail.com\", subject: \"trouducul\"\n end", "def chose_correct_answer\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/questions/#{@answer.question.id}\")\n subject = \"[bootcamp] #{@answer.receiver.login_name}さんの質問【 #{@answer.question.title} 】で#{@answer.sender.login_name}さんの回答がベストアンサーに選ばれました。\"\n mail to: @user.email, subject: subject\n end", "def response_sent_advisee(user, message)\n @user = user\n @message = message\n mail to: @user.email, subject: \"New response message from Advisor\"\n end", "def warning(msg, ask_continue: true)\n tell \"#{☞} {y{#{msg}}}\"\n exit(-1) if ask_continue && !ask(\"continue\")\n end", "def thankyou\n end", "def thankyou\n end", "def new_feedback(user)\n @user = user\n mail to: user.email, subject: \"New Feedback is added\"\n end", "def pre_resend\n \t@user = User.find(params[:id])\n \tif @user.user_state == \"confirmed\"\n flash[:notice] = \"\" + @user.first_name + \", your account is already confirmed.\"\n redirect_to(:action => 'already_confirmed', :id => params[:id])\n else\n render :layout => 'clean'\n end\n end", "def ask_user_question\n return unless (@target = find_or_goto_index(User, params[:id].to_s)) &&\n can_email_user_question?(@target) &&\n request.method == \"POST\"\n\n subject = params[:email][:subject]\n content = params[:email][:content]\n QueuedEmail::UserQuestion.create_email(@user, @target, subject, content)\n flash_notice(:runtime_ask_user_question_success.t)\n redirect_to(user_path(@target.id))\n end", "def verify_banned_message\n if sender.banned?\n self.body = \"This user’s messages have been removed because #{sender.the_sex_prefix} activities violates the LoveRealm community standards. Do not correspond with #{sender.the_sex_prefix}\"\n self.kind = 'text'\n end\n end", "def send_feedback(email,name,text)\n @email = email\n @name = name\n @text = text\n mail to: \"grandison@mail.ru\", :subject => \"Feedback from email: #{email}, name: #{name}\"\n end", "def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end", "def deny_upgrade\r\n @user = UpgradeRequest.find_by_user_id(params[:id])\r\n @user.processed = true\r\n @user.processed_by = session[:user_id]\r\n @user.processed_at = Date.today\r\n @user.refused = true\r\n @user.save\r\n @user = User.find(@user.user_id)\r\n email = RegistrationMailer.create_refuse_upgrade_to_agent(@user)\r\n email.set_content_type(\"text/html\")\r\n RegistrationMailer.deliver(email)\r\n redirect_to :action => 'show_upgrade_requests', :id => true \r\n end", "def ask_for_recipient\n\n end", "def play_game_with_user_as_codebreaker\n @display.welcome_message_for_user_as_codebreaker\n generate_secret_code\n collect_first_guess_and_provide_feedback\n let_the_user_provide_successive_guesses_and_provide_feedback\n end", "def accepted(target, question)\n @question = question\n\n mail to: target.email, subject: \"Your answer has been accepted!\"\n end", "def send_feedback_to_slack\n send_request_to_slack(make_positive_response)\n end", "def confirm\n\t\tusersnumber = params[\"From\"]\n\n\t\t@ix = Telapi::InboundXml.new do\n\t\t Gather(:action => '',\n\t\t :method => 'POST',\n\t\t :numDigits => '1',\n\t\t :finishOnKey => '#') {\n\t\t Say 'Thank you for confirming'\n \t\t}\t\t \n \t\tend\n\n\t \trespond_to do |format| \n\t \t\tformat.xml { render :xml => @ix.response } \n\t\tend\n\n\t\tuser = Caller.where(:number => usersnumber).first\n\n\t\t#Change back to this for testing purposes\n\t\tschedtime= Time.parse(\"#{Date.today} #{user.time} #{user.ampm} #{user.timezone}\")\n\t\t#schedtime= Time.parse(\"#{Date.tomorrow} #{user.time} #{user.ampm} #{user.timezone}\")\n\n\t\tscheduler = Rufus::Scheduler.start_new\n\n\t\t#Date.tomorrow + \" \" + \n\t\t#scheduler.at \"#{Date.tomorrow} #{schedtime}\" do\n\t\tscheduler.at \"#{schedtime}\" do\n\n \t\tTelapi::Call.make(usersnumber, '(201) 604-4992', 'https://www.telapi.com/data/inboundxml/404c735f21d00fee39a13210d54844f3cec069c7')\n\tend\n\n#Todo\n#When calling the user ask them to press 1, if it is not pressed after 5 seconds\n#it will hangup and call them again\n\n#Cool idea\n#Let the user record a message and it will call a friend if they do not pickup\n\n#Another idea, we could use <GetSpeech> with a grammer file for the IVRs\n\n\tend", "def ask(question)\n ui.ask question\n end", "def remind\n @title = \"Password Reminder\"\n if param_posted?(:user)\n email = params[:user][:email]\n user = User.find_by_email(email)\n if user\n UserMailer.reminder(user).deliver\n flash[:success] = \"Login information sent to #{email}\"\n redirect_to root_path\n else\n flash[:error] = \"There is no user the email #{email}\"\n end\n end\n end", "def new_feedback(name, email, hear, can_publish, held, message)\n\t\t@name = name\n\t\t@email = email\n\t\t@message = message\n\t\t@hear = hear\n\t\t@can_publish = can_publish\n\t\t@held = held\n\t\t# Mail it to/from/subject\n\t\tmail(to: 'info@tailordevents.com', from: @email, subject: 'Message from ' + @name)\n\tend", "def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end", "def not_author_response\n if author_respondent?\n errors[:author] << 'cannot answer their own poll'\n end\n end", "def confirm\n puts \"#{@gre}[ok] #{@lastMsg}. #{@ncl}\"\n end", "def ask_user\n\tmessages = [\"You will get it!\", \"Sorry it won't happen\", \"You bet\", \"No way\", \"Maybe\", \"It depends on you\", \"I believe in you\", \"The odds are against you\"]\n\tquestion = puts \"This is magic 8-Ball. Do you want to shake the eight ball? Y/N\"\n\tuser_response = gets.chomp.capitalize\n\twhile(true)\n\t\tif user_response == \"Y\" || user_response == \"Yes\"\n\t\t\tputs messages[rand(0..7)]\n\t\t\task_user\n\t\t\tbreak\n\t\telsif user_response == \"N\" || user_response == \"No\"\n\t\t\tputs \"Bye!\"\n\t\t\tbreak\n\t\telse\n\t puts \"Type Y/N please\"\n\t ask_user\n\t\t\tbreak\n\t\tend\n\tend\nend", "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end", "def ask\n end", "def confirm\n\n end", "def show\n @feedback_active = !!current_user\n @new_answer = @question.answers.new\n end", "def prompting(v = true)\n @at_prompt = v\n end", "def feedback(feedback, url)\n @notebook = feedback.notebook\n @url = url.chomp('/')\n @submitter = feedback.user\n @feedback = feedback\n @email_needs_to_be_simplified = need_to_simplify_email?(@notebook, @feedback)\n mail(\n bcc: @notebook.owner_email + [@submitter.email],\n subject: \"You have feedback on a Jupyter notebook\"\n )\n end", "def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end", "def prompt_user(msg)\n puts \" => #{msg}\"\nend", "def new_answer(answer, commenter, author, question)\n if author.privacy_setting.notify_on_answer\n @answer, @commenter, @author, @question = answer, commenter, author, question\n mail(\n :subject => \"#{@commenter.name.titleize} just answered your question.\",\n :from => \"noreply@studyhall.com\",\n :to => author.email,\n :date => Time.now\n )\n end\n end", "def resend_confirmation_instructions; end", "def pending_any_confirmation; end", "def prompt(mess) # prompt for all questions\n puts \"==> #{mess}\"\nend" ]
[ "0.75590616", "0.72524184", "0.700369", "0.689417", "0.6792127", "0.66878545", "0.6589748", "0.65879005", "0.65505856", "0.65366846", "0.63776594", "0.63468504", "0.63351595", "0.63336164", "0.6292917", "0.62878555", "0.6244287", "0.62211484", "0.62141013", "0.61952555", "0.6176783", "0.61687195", "0.6167858", "0.6133699", "0.6118377", "0.61104035", "0.6073025", "0.6060239", "0.605706", "0.6056966", "0.6042451", "0.60402423", "0.60388577", "0.60335076", "0.6021083", "0.6019422", "0.601425", "0.6010092", "0.6009996", "0.6003922", "0.5988343", "0.598344", "0.59752995", "0.5973109", "0.5968926", "0.5965072", "0.5949401", "0.5946778", "0.5938605", "0.59372646", "0.59307045", "0.5926797", "0.5926172", "0.5915156", "0.59146845", "0.59146845", "0.59146845", "0.5913893", "0.59087664", "0.59078956", "0.59004986", "0.5894003", "0.58935034", "0.58914155", "0.58882916", "0.5882102", "0.587784", "0.587784", "0.58764917", "0.586056", "0.584016", "0.5839361", "0.5837395", "0.5833782", "0.58305943", "0.5828109", "0.5825677", "0.5800382", "0.5798971", "0.5797123", "0.5796171", "0.57911336", "0.57907736", "0.57870424", "0.5783143", "0.57781756", "0.5772808", "0.5771799", "0.57707965", "0.576385", "0.57625264", "0.5760798", "0.57585293", "0.57553047", "0.57545626", "0.57531303", "0.57515216", "0.5750061", "0.57472754", "0.5745516", "0.5742339" ]
0.0
-1
A message from the community admin to a single community member
def community_member_email(sender, recipient, email_subject, email_content, community) @email_type = "email_from_admins" set_up_layout_variables(recipient, community, @email_type) with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do @email_content = email_content @no_recipient_name = true premailer_mail(:to => recipient.confirmed_notification_emails_to, :from => community_specific_sender(community), :subject => email_subject, :reply_to => "\"#{sender.name(community)}\"<#{sender.confirmed_notification_email_to}>") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toAdmin(message, sessionID); end", "def send_message\n if self.id != 1\n admin_sender = User.find(1)\n user_receiver = self\n message = Message.new\n message.subject = \"It's Official! You're in.\"\n message.body = \"As a member of the VVI community, you're now able to contact other volunteers directly, share your own experiences online, and stay active in our mission to make the world of international volunteering more transparent, more organized, and more excellent. \n <br /><br />We can't thank you enough for joining the cause! And we're here if you need anything.\n <br /><br />--VolunteerVoice Team\"\n message.recipient = user_receiver\n message.sender = admin_sender\n message.save\n end\n end", "def message_sender_or_admin\n @message = Message.find(params[:id])\n @post = @message.post\n @lesson = @post.lesson\n @course = @lesson.course\n back_to_course unless current_user?(@message.sender) or current_user.admin?\n end", "def fromAdmin(message, sessionID); end", "def send_to_single(pars)\n @message = Message.new(pars)\n @message.sender = current_user\n if @message.save\n flash[:info] = \"Your message has been sent to #{@message.receiver.full_name}\"\n else\n flash[:error] = \"Your message could not be sent to #{@message.receiver.full_name}\"\n end\n end", "def event_admin_message_to_attendee(event, attendee, message)\n @event = event\n @attendee = attendee\n @message = message\n\n return nil if attendee.user.email.blank?\n mail(:to => attendee.user.email, :subject => \"A new message from the organizer - #{event.title}\")\n end", "def message(to, message)\n send_raw_line(\"PRIVMSG \"+to.to_s+\" :\"+message.chomp)\n end", "def new_message_admin(from_user, to_user, message)\n @from_user = from_user\n @to_user = to_user\n @message = message\n\n mail(:subject => \"#{@to_user.full_name} has a new message!\")\n end", "def messaging\n end", "def set_admin_message\n @admin_message = Message.find(params[:id])\n end", "def event_admin_message_notice(action, user, event)\n @action = action\n @user = user\n @event = event\n \n mail(:to => @user.email, :subject => \"#{@action.user.name} posted on your StreetMeet - #{event.title}\") unless @user.email.blank?\n end", "def set_admin_message\n @admin_message = Admin::Message.find(params[:id])\n end", "def set_message\n @message = current_user.all_messages.find(params[:id]) # Can only access own msgs\n end", "def send_message_to_members(message)\n response = ''\n to_list = @members.map do |member|\n '[To:' + member.to_s + ']'\n end.join()\n uri = URI.encode(\"/v1/rooms/#{@user_info['room_id']}/messages?body=#{to_list}\\n#{message}\")\n\n @api_https_.start do\n response = @api_https_.post(uri, '', @api_header_)\n end\n end", "def send_community(event)\n # Parse message parameters\n msg = event.content\n tabs = parse_tabs(msg)\n cond = !(tabs&[:SS, :SS2]).empty? || tabs.empty?\n\n # Retrieve community's total and average scores\n levels = Score.total_scores(Level, tabs, true)\n episodes = Score.total_scores(Episode, tabs, false)\n levels_no_secrets = (cond ? Score.total_scores(Level, tabs, false) : levels)\n difference = levels_no_secrets[0] - 4 * 90 * episodes[1] - episodes[0]\n\n # Format response\n pad = (\"%.3f\" % levels[0]).length\n str = ''\n str << \"Total level score (TLS): #{\"%#{pad}.3f\" % levels[0]}\\n\"\n str << \"Total episode score (TES): #{\"%#{pad}.3f\" % episodes[0]}\\n\"\n str << \"TLS (w/o secrets): #{\"%#{pad}.3f\" % levels_no_secrets[0]}\\n\" if cond\n str << \"Difference (TLS - TES): #{\"%#{pad}.3f\" % [difference]}\\n\\n\"\n str << \"Average level score: #{\"%#{pad}.3f\" % [levels[0]/levels[1]]}\\n\"\n str << \"Average episode score: #{\"%#{pad}.3f\" % [episodes[0]/episodes[1]]}\\n\"\n str << \"Average difference: #{\"%#{pad}.3f\" % [difference/episodes[1]]}\\n\"\n event << \"Community's total #{format_tabs(tabs)} scores #{format_time}:\\n\".squish\n event << format_block(str)\nrescue => e\n lex(e, \"Error computing community total scores.\", event: event)\nend", "def message\n \n end", "def to user_id, message\n return yield false, USER_NOT_FOUND unless user = User.find(user_id)\n return yield false, INVALID_JOINABLE unless joinable_is_valid?\n\n owner_join_request = JoinRequest.where(joinable: @joinable, user_id: user_id, role: member_type).first_or_create\n\n ApplicationRecord.transaction do\n creator_join_requests.update_all(role: member_type)\n\n owner_join_request.update(status: :accepted, role: creator_type)\n\n @joinable.update_attribute(:user_id, user_id)\n end\n\n if message.present?\n ChatServices::ChatMessageBuilder.new(\n user: user,\n joinable: @joinable,\n join_request: owner_join_request,\n params: {\n message_type: :text,\n content: message,\n }\n ).create\n end\n\n yield true\n end", "def set_admin_message\n @admin_message = AdminMessage.find(params[:id])\n end", "def set_message\n @message = current_user.is_support? ? Message.where(id: params[:id]).first : Message.where(user_id: current_user.id, id: params[:id]).first\n end", "def process_message(msg)\n if admin && authenticated?\n Socky::Message.process(self, msg)\n else\n self.send_message \"You are not authorized to post messages\"\n end\n end", "def event_admin_message_notice(comment, organizer, event)\n @comment = comment\n @organizer = organizer\n @event = event\n\n return nil if organizer.email.blank?\n mail(:to => @organizer.email, :subject => \"#{@comment.user.name} posted on your StreetMeet - #{event.title}\")\n end", "def message\n\t\t@message \n\tend", "def ws_administrator_request(admin, user, type, msg)\n\t\tsetup_email(User.find(admin))\n\t\tfrom User.find(user).email\n\t\tsubject self.site_name+\" : \"+type\n\t\tbody :msg => msg\n end", "def create\n @message = Message.new(message_params)\n @message.user = current_user\n if @message.save\n #ActionCable.server.broadcast \"messages_#{params[:authid]}\", message: @message.content, user: current_user.name\n head :ok\n else\n render :edit\n end\n end", "def sendAdmin(message)\n\n @message = message\n\n mail(to: App::PayMeQuick::App::developer[:email], subject: @message)\n end", "def user_message(recip, from, from_name, message)\n recipients recip\n from from\n subject \"Message from Weefolio User #{from_name}\"\n sent_on Time.now\n body message\n end", "def add_to_community_channel\n if community_channel_user = User.find(Settings::Channels.community_channel_user_id)\n GT::Framer.create_dashboard_entry(self, ::DashboardEntry::ENTRY_TYPE[:new_community_frame], community_channel_user)\n end\n end", "def set_members\n members_ids = params[:message][:recipient_ids].reject(&:empty?)\n members_ids.each do |members_id|\n @message = current_user.messages.create(:conversation_id => members_id , :body => params[:message][:body])\n\n #send notification\n reciver = User.find(members_id)\n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has send a message #{@message.topic} \", notificable: @message, :accept => false)\n end\n end\n end", "def contact_message\n @contact_message = params[:contact_message]\n mail to: self.class.admin_emails\n end", "def set_admins_message\n @admins_message = Admins::Message.find(params[:id])\n end", "def msg(message)\n end", "def accept\n # a notification message will be delivered to the the requestor anyway;\n # it may contain a personal note, if any was supplied\n group = Network.find(@membership.network_id)\n invite = @membership.is_invite?\n \n personal_message = \"NONE\"\n if params[:accept_msg] && !params[:accept_msg].blank?\n personal_message = ae_some_html(params[:accept_msg])\n end\n\n # the messages will appear as 'deleted-by-sender', because the owner of the account effectively didn't send it,\n # so there is no reason for showing this message in their 'sent messages' folder\n\n if invite\n from = User.find(@membership.user_id)\n\n subject = \"Invitation to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted an invitation to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).each {|to| \n send_action_message(from.id, to.id, subject, body)\n }\n else\n from = current_user\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted your request to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %>:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n send_action_message(from.id, @membership.user_id, subject, body)\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :other => @membership.user_id, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted a request by <%= name(other) %> to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %> to user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).select{|admin| admin.id != from.id}.each {|to|\n send_action_message(from.id, to.id, subject, body)\n }\n end\n\n respond_to do |format|\n if @membership.accept!\n flash[:notice] = 'Membership was successfully accepted.'\n format.html { redirect_to network_path(@membership.network_id) }\n else\n flash[:error] = \"Membership already accepted.\"\n end\n format.html { redirect_to network_path(@membership.network_id) }\n end\n end", "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end", "def community; end", "def send_dm(client, user_name, message)\n user = client.users_info(user: \"@\" + user_name.to_s)\n conversation = client.conversations_open(users: user.user.id)\n client.chat_postMessage(channel: conversation.channel.id, text: message, as_user: true)\nend", "def new_message(user, message)\n @user = user\n @message = message\n @service = @message.service\n mail(to: @user.email, subject: 'New message sent through SocialPresence')\n end", "def new_message\n end", "def message(msg)\n\t\t@messager.message(msg)\n\tend", "def message\n @message\n end", "def message_user\n return self.username\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def membership_notification(membership)\n @dashboard_url = root_url\n @user = membership.user\n @creator = membership.creator\n @target = membership.whiteboard || membership.board || membership.project\n mail(:to => @user.email, :subject => _('%s added you to %s on %s.') % [\n @creator.nicename, @target.title, Doers::Config.app_name])\n end", "def set_message\n # TBD: verify that either user is admin or the message is from/to the current user\n MessagesController.current_message = @message = Message.find(params[:id])\n end", "def broadcast_msg( msg )\n\t\t@users.each do |cl|\n\t\t\tcl.add_output( msg )\n\t\tend\n\tend", "def notify_admin_about_newbie(user)\n @user = user\n mail \n end", "def message( message )\n\tend", "def update\n @community = Community.where(street: params[:subscriber][:community]).first\n @subscriber.community = @community\n respond_to do |format|\n if @subscriber.update_attributes(:community => @community)\n format.html { redirect_to \"/subscribers/new?lon=#{params[:lon]}&lat=#{params[:lat]}\", notice: \"您当前绑定社区为: #{@community.street}.\" }\n format.json { render :show, status: :ok, location: @subscriber }\n else\n format.html { render :edit }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "def admin_message\n redirect_to root_path unless admin_user?\n end", "def message\n info['Message']\n end", "def create\n @community = Community.new(params[:community])\n\n @community.creator = current_user\n \n if @community.save\n @communityuser = current_user.community_users.create(:community => @community,\n :is_communityadmin=> true,\n :is_communitymember=> false\n )\n flash[:notice] = 'Community was successfully created.'\n redirect_to(@community)\n else\n render :action => \"new\"\n end\n\n end", "def community; Community.get(self.community_id); end", "def perform(data)\n user = User.find(data[\"user_id\"])\n ActionCable.server.broadcast 'chat_channel', content: data[\"content\"], username: user.email, id: user.id\n end", "def contact\n\t\t@musician = User.find_by_id(params[:id])\n\t\t@message = Message.new\n\n\t\t# if there is a user signed in, attribute the message made to both musicians\n\t\t@message.sent_by = current_user.id if user_signed_in?\n\tend", "def message_broadcast\n\n @subject = params[:subject] ? params[:subject] : 'IMPORTANT - Please Read'\n @message = params[:message] ? params[:message] : ''\n @active_roles = Role.find_all_active\n\n end", "def set_message\n @message = current_center.messages.find(params[:id])\n end", "def send_message(payload)\n message = Message.new(author: current_user, text: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat\", message: render(message) if message.save\n end", "def create\n @to = User.find(params[:message][:to])\n current_user.send_message(@to, params[:message][:topic], params[:message][:body])\n redirect_to outbox_url\n end", "def message(message) end", "def message\n @message\n end", "def entrymsg!(msg=nil)\n msg.kind_of?(String) ? @session.chanserv.set(self.name, :entrymsg, msg) : @session.chanserv.set(self.name, :entrymsg)\n end", "def send_message(msg); end", "def message(action)\n render_to_string :partial => 'messages/status', :locals => {:player => request_user, :action => action}\n end", "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args['msg'])}\n )) #envia a mensagem para todos os clientes\n end\n end", "def new_message_sent_advisee(user)\n @user = user\n mail to: @user.email, subject: \"New message sent to Advisor\"\n end", "def admin_open_request_success(place) #when the admin user makes an open request successfully\n self.message = \"SUCCESS ! You requested to open -> #{place.nickname}\"\n end", "def new_message(message)\n @message = message\n\n mail to: @message.user.email\n end", "def get_message\n @message = Message.find_by(id: params[:id])\n @message or redirect_to admin_messages_path\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def content\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n if not $admin.nil?\n $conversation = Conversation.between(current_user.id,$admin.id).first\n end\n if $conversation.nil? and not $admin.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n if not $conversation.nil?\n gon.open = $conversation.open\n end\n end", "def update\n # find and update a specific message\n end", "def update\n # find and update a specific message\n end", "def other_user(user)\n message = self.messages.first\n message.sender == user ? message.recipient : message.sender\n # I FEEL THIS METHOD COULD BE REWRITTEN IN A MORE EFFICIENT AND SUGAR WAY\n end", "def new_message(obj)\n @obj = obj\n @admin_recipients = User.role_users(:admin).map(&:email)\n @author_recipients = User.role_users(:author).map(&:email)\n @recipients = @admin_recipients\n emails = @recipients.join(\",\")\n m = [\"pr.cr_pmcbl@hotmail.com\",\"rhcsa2012@gmail.com\",\"dilokvilas@gmail.com\",\"natthaphon.v@pmcblueline.com\",\"prajak.o@pmcblueline.com\",\"chayant.m@hotmail.com\",\"thinrachwansa@hotmail.com\",\"naruemit.k@gmail.com\"].join(\",\")\n mail to: m\n end", "def admin\n UserMailer.admin\n end", "def set_message\n @message = Message.friendly.find(params[:id])\n end", "def send_message(message); end", "def send_message(message); end", "def compose_message_postuler\n <<-HTML\nAdmin, un nouveau candidat pour le #{short_name}.\n\nPatronyme : #{param :user_patronyme}\nMail : #{param :user_mail}\n\nPrésentation : #{param :user_presentation}\n\nMotivation : #{param :user_motivation}\n\nIl faut lui donner une réponse sous 15 jours.\n HTML\n end", "def associate_member_with_community\n self.community.members << self.member unless self.community.members.include? self.member\n end", "def set_community\n @community = Community.friendly.find(params[:community_id])\n end", "def to_simple_message\n {\n text: self.message\n }\n end", "def message\n end", "def can_message? o\n return true\n # return true if admin?\n # false\n end", "def show\n @user = User.find(params[:id])\n\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n $conversation = Conversation.between(current_user.id,$admin.id).first\n if $conversation.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n gon.open = $conversation.open\n end", "def show\n \n # Update message as seen\n if !@message.seen and @message.to_user == current_user.id\n @message.seen = true\n @message.save\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @message }\n end\n end", "def update\n @community = current_user.own_communities.find(params[:id])\n flash[:notice] = 'Community was successfully updated.' if @community.update_attributes(update_params)\n respond_with(@community)\n end", "def show\n @messages = Message.where(messageable: @discussion).order(created_at: 'asc').includes(:commoner)\n @new_message = @discussion.messages.build(commoner: current_user.meta)\n end", "def message\n call_once\n @message\n end", "def notify_admin_about_newbie(user)\n @user = user\n mail\n end", "def update\n @user = User.find(current_user)\n @message = @user.messages.find(params[:id])\n\n \n end", "def receive_message\n params[:incoming_number] = $1 if params[:incoming_number]=~/^1(\\d{10})$/\n params[:origin_number] = $1 if params[:origin_number]=~/^1(\\d{10})$/\n @group=current_user.groups.find_by_phone_number(params[:incoming_number])\n \n if @group\n sent_by_admin=@group.user.phone_number==params[:origin_number]\n @sending_student = @group.students.find_by_phone_number(params[:origin_number])\n @sending_person = sent_by_admin ? @group.user : @sending_student\n \n if @sending_person\n message = (sent_by_admin ? @group.user.display_name : @sending_student.name)+\": \"+params[:message]\n @group.send_message(message,@sending_person, sent_by_admin ? @group.students : [@group.user]) #if a student sent it, just send it to teacher. if teacher sent it, push to group\n end\n end\n \n render :text=>\"sent\", :status=>202\n #needs to return something API-like, yo\n end", "def message\n @_message\n end", "def message\n @_message\n end", "def set_community\n @community = Community.where(id: params[:community_id]).first\n end", "def perform(message)\n \tActionCable.server.broadcast \"chatrooms:#{message.chatroom.id}\", {\n \t\tmessage: MessagesController.render(message),\n \t\tchatroom_id: message.chatroom.id\n \t}\n # Do something later\n end" ]
[ "0.69996977", "0.6514049", "0.64130527", "0.6235058", "0.6199979", "0.61757517", "0.6167339", "0.61649907", "0.6161816", "0.61119807", "0.6028942", "0.5988112", "0.5963588", "0.59412575", "0.59313", "0.59161735", "0.590218", "0.5892836", "0.5865745", "0.5852454", "0.5837331", "0.58350813", "0.58215505", "0.58201283", "0.58082587", "0.5805998", "0.57893616", "0.57790774", "0.57658535", "0.5759736", "0.5753368", "0.5749498", "0.574536", "0.5735074", "0.57167375", "0.57070714", "0.57004523", "0.5700136", "0.568928", "0.56880176", "0.5687209", "0.5687209", "0.5687209", "0.5687209", "0.56790423", "0.5675658", "0.5675114", "0.5672216", "0.5662428", "0.5662374", "0.5658495", "0.5656978", "0.5655015", "0.5654853", "0.5653721", "0.5648803", "0.56368375", "0.56284547", "0.5623321", "0.56190044", "0.56188905", "0.56088966", "0.5605783", "0.56043035", "0.56020135", "0.55990934", "0.5590273", "0.55897564", "0.558649", "0.5585727", "0.55849373", "0.5578765", "0.5578765", "0.55729717", "0.55711865", "0.55711865", "0.55696565", "0.55689085", "0.55680466", "0.55549604", "0.5552928", "0.5552928", "0.55507696", "0.554907", "0.5545937", "0.5543998", "0.5538504", "0.55292743", "0.5522509", "0.55194557", "0.5512754", "0.55119187", "0.5511756", "0.55111945", "0.55110943", "0.5510029", "0.5507175", "0.5507175", "0.5497844", "0.5496513" ]
0.6207532
4
Used to send notification to marketplace admins when somebody gives feedback on marketplace throught the contact us button in menu
def new_feedback(feedback, community) subject = t("feedback.feedback_subject", service_name: community.name(I18n.locale)) premailer_mail( :to => mail_feedback_to(community, APP_CONFIG.feedback_mailer_recipients), :from => community_specific_sender(community), :subject => subject, :reply_to => feedback.email) do |format| format.html { render locals: { author_name_and_email: feedback_author_name_and_email(feedback.author, feedback.email, community), community_name: community.name(I18n.locale), content: feedback.content } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_place_notification (merchant)\n @merchant = merchant\n mail to: \"sales@halalfoodhunt.com\", subject: \"A Place Has Been Listed\"\n end", "def send_new_listing_notification(merchant)\n @merchant = merchant\n mail to: \"sales@halalfoodhunt.com\", subject: \"A New Merchant has Subscribed!\"\n end", "def notify_admin_about_newbie(user)\n @user = user\n mail \n end", "def partner_help_notice(partner_help_id)\n ActsAsTenant.current_tenant = nil\n @partner_help = PartnerHelp.find(partner_help_id)\n mail(subject: 'YesTrak Partner Help Form', to: @partner_help.email, bcc: \"#{APP_CONFIG['admin_emails']}\")\n end", "def notification_for(product)\n \t@product = product \n mail(:to => @product.user.email, :subject => \"Perishab.ly alert regarding your #{@product.name}\")\n end", "def notify_admin_about_newbie(user)\n @user = user\n mail\n end", "def event_admin_message_notice(action, user, event)\n @action = action\n @user = user\n @event = event\n \n mail(:to => @user.email, :subject => \"#{@action.user.name} posted on your StreetMeet - #{event.title}\") unless @user.email.blank?\n end", "def admin_behavior_warning(email, company_phone, notification)\n @company_phone = company_phone\n @company = @company_phone.company\n @notification = notification\n mail(\n to: email,\n subject: 'GurúComm | Una línea esta cerca del límite de uso'\n )\n end", "def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end", "def accepted_application_moderator(vacancy, user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def notify_approver(item)\n @item = item\n @url = case @item.class.name\n when 'Program'\n program_url(@item)\n when 'Event'\n event_url(@item)\n end\n mail(subject: \"#{@item.name} may need your approval\")\n end", "def notify_of_redemption(user, redemption)\n @user = user\n @admin = redemption.reward.manager_with_default\n @reward = redemption.reward\n @redemption = redemption\n @mail_styler = company_styler(user.company)\n I18n.with_locale(user.locale) do\n mail(to: @user.email, subject: t(\"rewards.your_redemption_is_pending\", title: redemption.reward.title), track_opens: true)\n end\n end", "def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def old_notify_user (listing, sender, receiver)\n send_as :notification\n from sender.facebook_session.user \n recipients receiver.facebook_session.user\n #fbml \"<a href='#{FB_APP_HOME_URL}/listings/#{listing.id}'><b>#{listing.title}</b></a> has been approved.\"\n fbml \"Your listing: <a href='#{listings_path(listing.id)}}'><b>#{listing.title}</b></a> has been approved.\"\n end", "def notify_business\n business.add_message_to_queue(\"Hey #{business.name}, we've just deposited #{amount} into your account! Thanks for being great!\")\n end", "def notify_administrators!\n AdminMailer.new_pending_interest_point(self).deliver!\n end", "def notify(doctor ,recipient, subject, text)\n subject += \" sent to: #{recipient}, by: #{doctor.full_name}\" \n\t\tadmin_assists = AdminAssistant.all \n if admin_assists\n admin_assists.each do |adm|\n custom_email(adm, subject, text)\n end\n end\n end", "def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def notify_admin_of_redemption(user, redemption)\n @company = user.company\n @redemption = redemption\n @redeeming_user = user\n @reward = redemption.reward\n @reward_variant = redemption.reward_variant\n @reward_title = \"#{@reward.title} (#{@reward_variant.label})\"\n @mail_styler = company_styler(user.company)\n\n @admins, @approve_url = if @reward.manager.present?\n [[@reward.manager], manager_admin_redemptions_url(network: @company.domain)]\n else\n [@reward.company.company_admins, company_admin_redemptions_url(network: @company.domain)]\n end\n\n I18n.with_locale(user.locale) do\n mail(to: @admins.map(&:email), subject: t(\"rewards.user_has_redeemed\", name: @redeeming_user.full_name), track_opens: true)\n end\n end", "def customer_support(question, email)\n new_ticket = Slack::Notifier.new ENV['slack_webhook_url'],\n channel: \"#customer-support\",\n username: self.username\n message = \"#{self.username} asks #{question}. Email: #{email}\"\n new_ticket.ping message\n\n message\n end", "def thanks_to_vendor\n\n end", "def new_quote_notice(quote)\n @quote = quote\n mail(subject: \"[team] New Enquiry Received\")\n end", "def notify\n ActionMailer::Base.mail(:from => \"edgar-garcia@northwestern.edu\", :to => \"digitalcollections@northwestern.edu\", :cc => \"edgar-garcia@northwestern.edu\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end", "def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end", "def thanks(application)\n load_resources(application)\n @title = 'New Hire'\n mail( subject: 'Application Received', to: @application.email, track_opens: 'true' )\n end", "def subscriber_notice_approval_alert\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'approval_alert'\n )\n end", "def admin_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => \"consigndotnyc@gmail.com\", :subject => \"New Review on CONSIGN.NYC\")\n end", "def send_booking_confirmation_notifications\n\n notify_manager_confirmation\n notify_customer\n \n end", "def support_enquiry_notifier(enquiry, title)\n @title = title\n @name = enquiry.name\n @email = enquiry.email\n @message = enquiry.message\n @topic = enquiry.topic\n subject = \"#{@name} - #{@topic} - #{@title}\"\n\n @stats = enquiry.stats['categories']\n\n mail_hash = {subject: subject}\n\n if enquiry.stats.sender_email.present?\n mail_hash.merge!({from: enquiry.stats.sender_email})\n end\n\n if enquiry.stats.recipient_email.present?\n mail_hash.merge!({to: default_params[:to],\n bcc: enquiry.stats['recipient_email'].split(\",\").map(&:strip)})\n end\n\n mail(mail_hash)\n end", "def contact_notifier(supplier, user, contact, listing)\n\t @supplier = supplier\n\t @user = user\n\t @contact = contact\n\t @listing = listing\n\t mail(:to => supplier.email,\n\t :subject => \"#{user.first_name} posted an inquiry on #{listing}\")\n end", "def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end", "def provider_suggestion_notice(provider_suggestion)\n\t\t@provider_suggestion = provider_suggestion\n\t\tsubject = 'New provider suggestion'\n\t\tsendgrid_category subject\n\t\tsendgrid_unique_args provider_suggestion_id: provider_suggestion.to_param\n\t\tmail subject: subject\n\tend", "def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end", "def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end", "def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end", "def new_caitredette_service_notice(req)\n @req = req\n mail(subject: \"[team] New Caitredette Service Request Received\")\n end", "def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def follower_notification_email(cookbook_follower)\n @cookbook = cookbook_follower.cookbook\n @to = cookbook_follower.user.email\n\n mail(to: @to, subject: \"A new version of the #{@cookbook.name} cookbook has been released\")\n end", "def follower_notification_email(cookbook_follower)\n @cookbook = cookbook_follower.cookbook\n @to = cookbook_follower.user.email\n\n mail(to: @to, subject: \"A new version of the #{@cookbook.name} cookbook has been released\")\n end", "def hotel_notification(hotel, action, current_user)\n @user = current_user\n @action = action\n @hotel = hotel\n mail(to: \"zmb1391@gmail.com\", subject: \"Hotel created/updated/destroyed\")\n end", "def sent_volunteer_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your volunteer inquiry has been sent to Feya Candle\")\n end", "def send_admin_review_email\n Mailer.admin_review_email(user, content, business, rating).deliver\n end", "def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end", "def send_notification\n\n\n end", "def send_observer_mail(user)\n mail to: user.email, subject: \"Changes to Cart\", from:'charlienoreply@gmail.com'\n end", "def notify_reviewers\n PushService.new.send_notification(Channel::REVIEWER_CHANNEL, ADMIN_APP, {\n category: 'offer_delivery',\n message: delivery_notify_message,\n offer_id: offer.id,\n author_id: offer.created_by_id\n })\n end", "def feedback\n NewsletterMailer.feedback\n end", "def send_notice(type:,adjustment:,previous_data: nil, subject:,title:,email: 'info@landingintl.com')\n @type = type\n @adjustment = adjustment\n @previous_data = previous_data\n @title = title\n @link = inventory_adjustments_url\n mail :to => email, :subject => subject\n end", "def contactus\r\n end", "def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end", "def alert_message(user,game_sale)\n @user = user\n @game_sale = game_sale\n @game = @game_sale.game\n mail(:to => user.email, :subject => \"#{@game.title} is on sale!\", :from => \"bazaarworldofgaming@gmail.com\", :body => \"#{@game.title} is on sale either at or lower than your alert price for it! \\nGo to the sale here: #{@game_sale.url}\")\n end", "def employeer_notification\n NotificationMailer.employeer_notification\n end", "def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end", "def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end", "def send_new_booking_request_notifications\n\n if pay_now\n notify_manager_pay_now\n notify_request_to_customer_pay_now\n else\n notify_manager\n notify_request_to_customer\n end\n\n end", "def admin_alert(data, subject)\n #@claim_url = \"http://www.cleanjay.ca/claim-booking/#{job.profile.claim_id}\"\n @data = data\n sub = \"[Admin Alert] \" + subject.to_s\n\n mail(:to => \"tom@cleanjay.ca\", subject: sub)\n end", "def feedback\n NotebookMailer.feedback\n end", "def get_help \n @booking = Booking.find(params[:id])\n owner = @booking.creator\n Notification.notify_admin(\"#{owner.first_name} #{owner.last_name} has asked for help choosing a presenter for their booking\", booking_path(@booking), :get_help)\n flash[:info] = \"An admin has been notified that you would like help choosing. They will be in contact with you shortly\"\n @booking.help_required = true\n @booking.save\n redirect_to booking_path(@booking)\n end", "def send_approve_email\n 'send_approve_email'\n end", "def subscription_instant_notice(subscription, action, user)\n @subscription = subscription\n @action = action\n @user = user\n\n if action.action_type == Action.types[:event_created]\n subject = \"StreetMeet - #{subscription.name}\"\n elsif action.action_type == Action.types[:search_comment]\n subject = \"SocialStreet Message - #{subscription.name}\"\n elsif action.action_type == Action.types[:action_comment]\n subject = \"SocialStreet Message - #{subscription.name}\"\n end\n\n mail(:to => @user.email, :subject => subject) unless @user.email.blank?\n end", "def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end", "def user_send_feedback\n\t\t# send feed back to the admin\n\t\tif UserMailer.feedback(current_user,params[:feedback_text]).deliver_now\n\t\t# response to the JSON\n \t render json: { success: true, message: \"Feedback has sent successfully\" },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"problem with sending feedback\" },:status=> 203\n\t end\t\n\tend", "def product_back_in_inventory\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def sent_suggest_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your suggestion has been sent to Feya Candle\")\n end", "def notify_mail_chimp\n Spree::Chimpy.enqueue(:order, self) if completed? && Spree::Chimpy.configured?\n end", "def edit_privacy_confirmation(user)\n @user = user\n\n mail(\n # from: 'codetest1980@gmail.com',\n from: 'lifeabroadjapan@gmail.com',\n to: @user.email,\n subject: 'Privacy setting was changed (Med+)'\n )\n end", "def notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def new_message_sent_advisee(user)\n @user = user\n mail to: @user.email, subject: \"New message sent to Advisor\"\n end", "def notify_company_admin(admin, task_submission)\n @submitter = task_submission.submitter\n\n I18n.with_locale(admin.locale) do\n mail(to: admin.email, subject: I18n.t(\"tskz.notifier.requesting_approval_of_tasks\", name: @submitter.full_name), track_opens: true)\n end\n end", "def notify_order\n UserMailer.notify_order\n end", "def send_notifications\n end", "def send_email_changed_notification; end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end", "def gift_notification(gift)\n @requester = gift.requester\n @owner = gift.owner\n @lacquer = gift.lacquer\n @user_url = \"http://www.lacquerloveandlend.com/users/#{@requester.id}\"\n @thank_you_email_url = \"http://www.lacquerloveandlend.com/new_transactional_message?gift_id=#{gift.id}\"\n\n mail(to: @requester.email, subject: \"You've received a gift on Lacquer Love&Lend!\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "def notification\n BookingMailer.notification\n end", "def event_admin_message_notice(comment, organizer, event)\n @comment = comment\n @organizer = organizer\n @event = event\n\n return nil if organizer.email.blank?\n mail(:to => @organizer.email, :subject => \"#{@comment.user.name} posted on your StreetMeet - #{event.title}\")\n end", "def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end", "def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end", "def send_mail\n @url = \"http://www.whwater.com/news/tstz/\"\n @planned_notices = fetch_notices \"http://www.whwater.com/news/jhxts/Index.html\"\n @emergent_notices = fetch_notices \"http://www.whwater.com/news/tfxts/Index.html\"\n if changed_in_website?\n TabWaterMailer.tab_water_info(@planned_notices, @emergent_notices, @url).deliver\n end\n end", "def contactus\n end", "def notify( notification_type, source_user, options={})\n notification = post_notification(notification_type, source_user, options)\n if true # XXX User's profile approves\n # Mapping from notification types to email types\n case notification_type\n when :share_recipe\n self.shared_recipe = options[:what]\n msg = RpMailer.sharing_notice(notification)\n msg.deliver\n when :make_friend\n :friend_notice\n end\n end\n end", "def notify\n render :text => 'Ok, thank you.'\n end", "def review_notification(book,user)\n @greeting = \"Hi\"\n @book=book\n @user=user\n mail to: user.email\n end", "def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end", "def send_email_changed_notification?; end", "def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def notify_about_sign_up(user, admin)\n @user = user\n mail(:to => admin.email, :subject => \"New User | #{user.name}\", :reply_to => \"new_user@ambitionspotlight.com\")\n end", "def notification(grant_application, request)\n @grant_application = grant_application\n mail :subject => Refinery::GrantApplications::Setting.notification_subject,\n :to => Refinery::GrantApplications::Setting.notification_recipients,\n :from => \"grants@theextraspecialtrust.org.uk\"\n end", "def order_admin_notification\n order = Order.last\n OrderMailer.order_admin_notification(order)\n end", "def send_thank_you_mail\n IslayShop::OrderMailer.thank_you(self).deliver\n end", "def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end", "def user_new_item_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\", subject: \"Item Confirmation\"\n end", "def alert(annc, user)\n\t\t@greeting = annc.company.name.upcase + \" (#{annc.company.hk_ticker}) has posted an announcement at #{annc.datetime.to_formatted_s(:short)}: #{annc.message}.\"\n\t\t@url = annc.url\n\n\t\tmail to: user.email, subject: \"HK Equities Alert (#{annc.company.hk_ticker})\"\n\tend", "def product_sold\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def show\n # notification_email\n end", "def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end", "def came_question\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/questions/#{@question.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@question.user.login_name}さんから質問がありました。\"\n end", "def send_contact_email_to_supporter\n UserMailer.contact_us(self).deliver_now\n end", "def recommendation_notifier(recommended_user, recommender, recommended)\n\t@recommendation = recommended_user\n\t@recommender = recommender\n\t@recommended = recommended\n\tmail(:to => recommended_user.email,\n\t :subject => \"#{recommender.first_name} just recommended you to their supplier #{recommended.first_name} on mylmp.com\")\n end" ]
[ "0.72407365", "0.69117635", "0.68208724", "0.68143266", "0.6732151", "0.67313135", "0.67008173", "0.65841204", "0.65726763", "0.65551627", "0.655344", "0.6519822", "0.64797235", "0.6479473", "0.6476382", "0.64703166", "0.6464862", "0.64602184", "0.6451091", "0.644801", "0.6419302", "0.6413089", "0.6412536", "0.6405414", "0.6404859", "0.63842815", "0.6378875", "0.63706887", "0.6363522", "0.63498837", "0.6346858", "0.6344853", "0.63350636", "0.63347715", "0.63325846", "0.6330513", "0.63175815", "0.63173246", "0.6312966", "0.6312966", "0.63110024", "0.63084656", "0.6302811", "0.62971103", "0.62928903", "0.62881637", "0.62853545", "0.62853044", "0.6284208", "0.6264715", "0.62638557", "0.6263064", "0.626047", "0.6259745", "0.62592554", "0.62575805", "0.6254343", "0.6253256", "0.62284344", "0.62281185", "0.62256855", "0.6219774", "0.6219448", "0.6211352", "0.62090814", "0.62078196", "0.62068456", "0.6203214", "0.6197595", "0.6197557", "0.61957324", "0.6192468", "0.618868", "0.61863536", "0.6185837", "0.61854565", "0.6183324", "0.6168755", "0.61653966", "0.6164403", "0.6162632", "0.61584175", "0.61570036", "0.61526895", "0.61525726", "0.6150211", "0.6149375", "0.61489505", "0.6148573", "0.61483794", "0.61464113", "0.6145031", "0.61430115", "0.6139954", "0.6131873", "0.6125766", "0.6115334", "0.6110737", "0.61056465", "0.60997283", "0.6097983" ]
0.0
-1
returns an array [modified+created, unmodified]
def changes map_old, map_new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified; status[:modified] || []; end", "def altered_files; (modified + added + removed).sort; end", "def records_modified_since(time)\n []\n end", "def changes\n if @changes\n @changes.dup\n else\n []\n end\n end", "def modifications\n\t\treturn unless self.modified?\n\t\tself.log.debug \"Gathering modifications...\"\n\n\t\tmods = []\n\t\t@values.sort_by {|k, _| k.to_s }.each do |attribute, vals|\n\t\t\tself.log.debug \" finding mods for %s\" % [ attribute ]\n\t\t\tmod = self.diff_with_entry( attribute, vals ) or next\n\t\t\tmods << mod\n\t\tend\n\n\t\treturn mods\n\tend", "def modified; status[:modified]; end", "def returnModified\n @modified\n end", "def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end", "def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end", "def date\n t, tz = changeset.date\n begin\n return [FileUtils.lstat(@repo.join(@path)).mtime, tz]\n rescue Errno::ENOENT\n return [t, tz]\n end\n end", "def git_modified_files_info\n modified_files_info = {}\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each do |file|\n modified_lines = git_modified_lines(file)\n modified_files_info[file] = modified_lines\n end\n modified_files_info\n end", "def pending_modified_values\n data[:pending_modified_values]\n end", "def pending_modified_values\n data[:pending_modified_values]\n end", "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "def changes\n additions + deletions\n end", "def modified_files\n remote_details = @container.list_objects_info\n same_files.reject do |file|\n (remote_details[file][:last_modified] <=> File.mtime(CloudfileAsset::Local.make_absolute(file))) == 1\n end\n end", "def modified_files; end", "def modified_files\n `git diff --cached --name-only --diff-filter=ACM --ignore-submodules=all`.split \"\\n\"\n end", "def all_changed_files\n Set.new\n .merge(git.added_files.to_a)\n .merge(git.modified_files.to_a)\n .merge(git.renamed_files.map { |x| x[:after] })\n .subtract(git.renamed_files.map { |x| x[:before] })\n .to_a\n .sort\n end", "def modified_files\n diff = git.diff(local_branch, remote_branch(local_branch))\n diff.stats[:files].keys\n end", "def modified_files\n staged = squash?\n refs = 'HEAD^ HEAD' if merge_commit?\n @modified_files ||= Overcommit::GitRepo.modified_files(staged: staged, refs: refs)\n end", "def modified_date_time\n return @modified_date_time\n end", "def modified_date_time\n return @modified_date_time\n end", "def modified_date_time\n return @modified_date_time\n end", "def changed_fields\n items = @resource.changed_from_previous_curated\n return ['none'] unless items.present?\n\n items\n end", "def GetModified\n @modified\n end", "def GetModified\n @modified\n end", "def GetModified\n @modified\n end", "def GetModified\n @modified\n end", "def GetModified\n @modified\n end", "def modified_files\n file_stats.count { |file| file.status == :modified }\n end", "def modified_at\n @photo.updated.to_datetime.utc\n end", "def modification_history\n history = []\n\n location_attributes = lambda do |location_id|\n location = Location.find_by(id: location_id)\n return location ? { title: location.title, uri: location.uri } : nil\n end\n\n user_attributes = lambda do |user_id|\n user = User.find_by(id: user_id)\n return user ? { email: user.email, display_name: user.display_name } : nil\n end\n\n gather_attributes = lambda do |item_version|\n atts = item_version.attributes\n atts['source'] = source\n location_id = item_version.permanent_location_id\n user_id = item_version.paper_trail.originator.to_i\n atts['permanent_location'] = location_attributes.(location_id)\n atts['user'] = user_attributes.(user_id)\n if item_catalog_record\n atts['item_catalog_record'] = item_catalog_record.attributes\n end\n return atts\n end\n\n add_to_history = Proc.new do |item|\n history << gather_attributes.(item)\n previous = item.paper_trail.previous_version\n if previous\n add_to_history.(previous)\n end\n end\n\n add_to_history.(self)\n\n history\n end", "def new_and_changed \n r = repo\n {\n :new => r.untracked.select{|k| k.include?(\"Ships\") && k.include?(\".craft\")},\n :changed => r.changed.select{ |k| k.include?(\"Ships\") && k.include?(\".craft\")}\n }\n end", "def last_modified\n [updated_at, user.try(:updated_at)].max\n end", "def modified_properties\n return @modified_properties\n end", "def pending_modified_values\n @dbi.pending_modified_values\n end", "def pending_modified_values\n @dbi.pending_modified_values\n end", "def modification_date; end", "def mtime\n from_index[:modified].to_i\n end", "def changed_tags\n @changed_values.keys.map { |key| MiniExiftool.original_tag(key) }\n end", "def arrayOfChanges\n #we could also use Ruby/Git here, but that feels like an overkill right #now.\n gitChanges = `git diff #{@args[:taskpaper_file]} | grep '^\\+' | grep -i '\\@done'`\n return gitChanges.split(\"\\n\").collect{ |line| Task.new(line.gsub(/^\\+\\ ?/, \"\"))}\n end", "def all_changes_in_revisions array\n raise NotImplementedError.new('Define method :all_changes_in_revisions on your source control.')\n end", "def modified?; end", "def line_diff\n return { :added => @added_lines, :removed => @removed_lines }\n end", "def version_history\n res = []\n event = 'create'\n author = user\n versions.each do |version|\n # some old entries still include create actions\n # TODO remove next line\n next if version.event == 'create'\n res << {\n obj: version.reify,\n event: event,\n author: author\n }\n event = version.event\n author = User.find_by_id(version.whodunnit.to_i)\n end\n res << {\n obj: self,\n event: event,\n author: author\n }\n end", "def altered_files; raw_changeset.files; end", "def cross_reference_added_and_removed (added, removed)\n updated_entries = []\n new_added = []\n \n added.each do |added_entry|\n idx = removed.index(added_entry)\n if (idx.nil?)\n # It does not exist on the removed array, so it is added instead.\n new_added << added_entry\n else\n # It is on the removed\n # construct an associative array consist of those added and removed entry as updated.\n removed_entry = removed[idx];\n updated_entries << [:added => added_entry, :removed => removed_entry]\n \n # Removed the object from the removed array \n removed.delete_at(idx)\n end\n end\n \n # We are modifying the added array.\n added.clear\n added.concat new_added\n return updated_entries\n end", "def timestamps\n c = datetime_attr :created_at\n u = datetime_attr :updated_at\n [c, u]\n end", "def without\n %w(created_at updated_at)\n end", "def without\n %w(created_at updated_at)\n end", "def changed\n return added + removed unless added.nil? || removed.nil?\n return added unless added.nil?\n return removed unless removed.nil?\n end", "def previously_changed_files\n `git show --pretty=\"format:\" --name-only`.split(\"\\n\")\n end", "def changes; self.diff @pristine; end", "def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end", "def last_change\n new_times = mtimes\n ret = new_times.select { |k, v| @times[k] != v }\n @times = new_times\n ret.keys\n end", "def modified?\n @modified\n end", "def last_modified_time\n mtime\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def modified?\r\n @modified\r\n end", "def changed\n changed_attributes.keys\n end", "def changes_from_clone\n changes_from_document(clone_source, true)\n end", "def didModify(files_array)\n\tdid_modify_files = false\n\tfiles_array.each do |file_name|\n\t\tif git.modified_files.include?(file_name) || git.deleted_files.include?(file_name)\n\t\t\tdid_modify_files = true\n\t\tend\n\tend\n\treturn did_modify_files\nend", "def currently_changed_files\n `git status --porcelain`.split(\"\\n\").map{ |file| file.split.last }\n end", "def last_modified_time # :nodoc:\n @last_modified_time.dup\n end", "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def changes\n @attributes[:changes]\n end", "def get_updated_times\n @last_updated_time = Event.last_updated_datetime.to_s(:timepart)\n @last_updated_date = Event.last_updated_datetime.to_s(:listing_date)\n @last_updated_datetime = Event.last_updated_datetime\n end", "def to_a\n [ xnow, ynow ]\n end", "def modified_date\n date_field('system_modified')\n end", "def changes\n Hash[(from.keys + to.keys).collect do |key|\n [key, [from[key], to[key]]]\n end]\n end", "def modification_date=(_); end", "def last_modified\n raise NotImplementedError\n end", "def changes\n @changes ||= Set.new\n end", "def changes\n @changes ||= Set.new\n end", "def last_modified\n stat.mtime\n end", "def files_changed_as_set(files)\n changed_files = files.select { |file| git.modified_files.include? file }\n not_changed_files = files.select { |file| !changed_files.include? file }\n all_files_changed = not_changed_files.empty?\n no_files_changed = changed_files.empty?\n return all_files_changed || no_files_changed\nend", "def modified_at\n ensure_full_data!\n Time.at(@gapi[\"lastModifiedTime\"] / 1000.0)\n end", "def mtime; end", "def mtime; end", "def rev\n updated_at\n end", "def timestomp(original, doplegangar)\n#\tcommandz(\"touch -r #{original} #{doplegangar}\") # one liner with touch command :p\n\n\t#Pure Ruby way :)\n\tfoo = File.stat(original) #Stat original file\n\tatime = foo.atime #Note its access & modify times so we can fake on target file...\n\tmtime = foo.mtime\n\tFile.utime(atime, mtime, doplegangar) #Make the fake :)\nend", "def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at]\n timestamps.sort.last\n end", "def get_modification(n)\n\t\treturn @modifications[n]\n\tend", "def stamp_changed\n return unless changed?\n\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end", "def modified?\n @modified\n end", "def modified?\n @modified\n end" ]
[ "0.72220534", "0.6679927", "0.63646764", "0.63503003", "0.62643516", "0.6230171", "0.61744183", "0.6172236", "0.6093904", "0.60706997", "0.6051089", "0.6034168", "0.6034168", "0.6017387", "0.60041773", "0.5962602", "0.5957802", "0.5931494", "0.59259194", "0.58846426", "0.5876311", "0.58521044", "0.58521044", "0.58521044", "0.58487993", "0.5820198", "0.5820198", "0.5820198", "0.5820198", "0.5820198", "0.57933396", "0.5771947", "0.5767648", "0.575965", "0.5756115", "0.5710839", "0.5704204", "0.5704204", "0.5674781", "0.5662464", "0.5644448", "0.5643559", "0.56319416", "0.5614461", "0.56016", "0.56006587", "0.5591807", "0.5560744", "0.55346936", "0.55296457", "0.55296457", "0.55109054", "0.5433287", "0.54268306", "0.5426047", "0.5407663", "0.5400926", "0.5400401", "0.5397035", "0.53924376", "0.53797305", "0.5369052", "0.53598773", "0.53577876", "0.53573763", "0.53571033", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5356837", "0.5353811", "0.5347899", "0.5345286", "0.534243", "0.5341792", "0.5339361", "0.53357816", "0.53341293", "0.53341293", "0.5328525", "0.53111476", "0.5297134", "0.5296644", "0.5296644", "0.5295022", "0.529197", "0.5256094", "0.5252284", "0.52465767", "0.5242539", "0.5242539" ]
0.0
-1
Need a list of modified files (and unmodified files), given two release maps in opt.temp, clone opt.repo (with n) check out .gitignore from git check out unmodified files from git check out modified or created files from CMVC commit changes to master push branch to opt.repo ideally, we'd break down changed files by track which is to say, partition changes by track, create a branch for each, commit the changes to git Get the latest cmvc level for a release
def cmvc_level release ctx = Cmvc::Context.new(nil, nil, $mode) level = nil ctx.last_levels(release, 1) do |levels| level = levels.first.first end.exec return level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "def modified_files\n `git diff --cached --name-only --diff-filter=ACM --ignore-submodules=all`.split \"\\n\"\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 analyse_modified_files\n modified_files = ::RubyCritic::Config\n .feature_branch_collection\n .where(::RubyCritic::SourceControlSystem::Git.modified_files)\n ::RubyCritic::AnalysedModulesCollection.new(modified_files.map(&:path),\n modified_files)\n ::RubyCritic::Config.root = \"#{::RubyCritic::Config.root}/compare\"\n end", "def modified_files\n staged = squash?\n refs = 'HEAD^ HEAD' if merge_commit?\n @modified_files ||= Overcommit::GitRepo.modified_files(staged: staged, refs: refs)\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 modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end", "def get_changed_file_list\n command = \"git log -m -1 --name-only --pretty='format:' $(git rev-parse origin/master)\"\n file_paths = []\n features = {}\n features.compare_by_identity\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n files = stdout.read.gsub! \"\\n\", \",\"\n file_paths = files.split(\",\")\n puts \"Found files:\\n#{file_paths}\"\n end\n\n puts \"Count files in push: #{file_paths.count}\"\n\n file_paths.each do |file_path|\n if file_path.include?(\".feature\")\n puts \"Added: #{file_path}\"\n folder = get_name_folder_from_path file_path\n features.store(folder, file_path)\n end\n end\n\n puts \"\\n\"\n puts \"Count feature files: #{features.count}\"\n features.sort\nend", "def target_files\n @target_files ||= git.modified_files + git.added_files\n end", "def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end", "def modified_files\n diff = git.diff(local_branch, remote_branch(local_branch))\n diff.stats[:files].keys\n end", "def target_files\n @target_files ||= (git.modified_files - git.deleted_files) + git.added_files\n end", "def git_modified_files_info\n modified_files_info = {}\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each do |file|\n modified_lines = git_modified_lines(file)\n modified_files_info[file] = modified_lines\n end\n modified_files_info\n end", "def set_last_changed_revision(repo, file_safety, fnames)\n dot_freq = (file_safety.size / 40.0).ceil # Print up to 40 progress dots\n case repository_type\n when 'git'\n fnames = file_safety.keys if fnames.nil?\n\n fnames.each_with_index do |f, i|\n info = %x[git log -n 1 -- #{f}].split(\"\\n\").first[7..-1]\n if info.nil? || info.empty?\n file_safety[f]['last_changed_rev'] = -1\n else\n file_safety[f]['last_changed_rev'] = info\n end\n # Show progress\n print '.' if (i % dot_freq) == 0\n end\n puts\n when 'git-svn', 'svn'\n fnames = file_safety.keys if fnames.nil?\n\n fnames.each_with_index do |f, i|\n last_revision = get_last_changed_revision(repo, f)\n if last_revision.nil? || last_revision.empty?\n file_safety[f]['last_changed_rev'] = -1\n else\n file_safety[f]['last_changed_rev'] = last_revision\n end\n # Show progress\n print '.' if (i % dot_freq) == 0\n end\n puts\n # NOTE: Do we need the following for retries?\n# if retries && result.size != fnames.size && fnames.size > 1\n# # At least one invalid (deleted file --> subsequent arguments ignored)\n# # Try each file individually\n# # (It would probably be safe to continue from the extra_info.size argument)\n# puts \"Retrying (got #{result.size}, expected #{fnames.size})\" if debug >= 2\n# result = []\n# fnames.each{ |f|\n# result += svn_info_entries([f], repo, false, debug)\n# }\n# end\n end\nend", "def all_modified_files_coverage\n unless @project.nil?\n @all_modified_files_coverage ||= begin\n modified_files = git.modified_files.nil? ? [] : git.modified_files\n added_files = git.added_files.nil? ? [] : git.added_files\n all_changed_files = modified_files | added_files\n @project.coverage_files.select do |file|\n all_changed_files.include? file.source_file_pathname_relative_to_repo_root.to_s\n end\n end\n\n @all_modified_files_coverage\n end\n end", "def analyse_modified_files\n modified_files = Config.feature_branch_collection.where(SourceControlSystem::Git.modified_files)\n analysed_modules = AnalysedModulesCollection.new(modified_files.map(&:path), modified_files)\n Config.root = Config.compare_root_directory\n report(analysed_modules)\n end", "def changed_files_since_deploy\n if File.exists?(\"log/latest-REVISION-syntaxcheck\")\n revision = File.read(\"log/latest-REVISION-syntaxcheck\").chomp\n\n `git whatchanged #{revision}..HEAD`.split(\"\\n\").select{|l| l =~ /^\\:/}.collect {|l| l.split(\"\\t\")[1]}.sort.uniq\n else\n puts \"log/latest-REVISION-syntaxcheck not found. run 'cap fetch_currently_deployed_version' to get it\"\n []\n end\n end", "def get_existing_commits!\n release_meta_paths = Dir.glob(\"#{RELEASE_META_DIR}/*.toml\").to_a\n\n release_meta_paths.collect do |release_meta_path|\n contents = File.read(release_meta_path)\n parsed_contents = TomlRB.parse(contents)\n release_hash = parsed_contents.fetch(\"releases\").values.fetch(0)\n release_hash.fetch(\"commits\").collect do |c|\n message_data = parse_commit_message!(c.fetch(\"message\"))\n\n {\n \"sha\" => c.fetch(\"sha\"),\n \"message\" => c.fetch(\"message\"),\n \"author\" => c.fetch(\"author\"),\n \"date\" => c.fetch(\"date\"),\n \"pr_number\" => message_data.fetch(\"pr_number\"),\n \"files_count\" => c[\"files_count\"],\n \"insertions_count\" => c[\"insertions_count\"],\n \"deletions_count\" => c[\"deletions_count\"]\n }\n end\n end.flatten\nend", "def previously_changed_files\n `git show --pretty=\"format:\" --name-only`.split(\"\\n\")\n end", "def applicable_owners_files\n CACHE.cache_block('arb_commit/' + self.sha1 + '/' + 'applicable_owners_files', 0) do\n raise \"not in review repository\" unless exists_in_review_repository?\n\n affected_dirs = changed_files.map { |f| File.dirname(f) }.uniq\n \n owners_files = affected_dirs.\n map { |d| find_owners_file(d) }.\n reject { |d| d.nil? }.\n uniq\n end\n end", "def currently_changed_files\n `git status --porcelain`.split(\"\\n\").map{ |file| file.split.last }\n end", "def get_repo_status\n args = {:clone => CONFIG[\"local\"][\"clone\"]}\n st = `#{Templates.status(args)}`\n current_branch = st.split(\"\\n\")[0][3..-1].split(\"...\")[0]\n modified_files = st.split(\"\\n\")[1..-1].join(\"\\n\")\n [current_branch, modified_files]\n end", "def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end", "def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def getNumberOfChangedFilesAndChangedLines (projectName, localClone, pathInput, pathOutput)\n\t prefixProjectName = formatProjectName(projectName)\n\t\tfilesList = []\n\t\tdataList = []\n\t\tcountTemp = 0\n\t\t#_ParentsFiles\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitList.csv\", 'r') do |fileMerges| \n\t\t\twhile line = fileMerges.gets \n\t\t\t\tfileMerges.each_line do |line|\n\t\t\t\t\tcamposMerge = line.split(\",\")\n\t\t\t\t\tFile.open(localClone+pathInput+prefixProjectName+\"_MergeScenarioList.csv\", 'r') do |fileTEMP|\n\t\t\t\t\t\twhile lineTEMP = fileTEMP.gets \n\t\t\t\t\t\t\tfileTEMP.each_line do |lineTEMP|\n\t\t\t\t\t\t\t\tcamposParents = lineTEMP.split(\",\")\n\t\t\t\t\t\t\t\tif (camposMerge[0].eql? camposParents[0])\n\t\t\t\t\t\t\t\t\tdata = camposMerge[0].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposMerge[1].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposMerge[10].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposMerge[11].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposParents[4].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposParents[6].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")\n\t\t\t\t\t\t\t\t\tdataList.push(data)\n\t\t\t\t\t\t\t\t\tcountTemp +=1\n\t\t\t\t\t\t\t end\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\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitListAndFilesList.csv\", 'w') do |file|\n\t\t\tfile.puts \"mergeCommitID, isConflicting, listLeftCommits, listRightCommits, leftFiles, rightFiles\"\n\t\t\tdataList.each do |dado|\n\t\t\t\tfile.puts \"#{dado}\"\n\t\t\tend\n\t\tend\n\t\t\n\t\tprojectsList = []\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitListAndFilesList.csv\", 'r') do |f1| \n\t\t\twhile line = f1.gets \n\t\t\t\tf1.each_line do |line|\n\t\t\t\t\tcampos = line.split(\",\")#.length\t\n\t\t\t\t\tmergeCommitID = campos[0].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tisConflicting = campos[1].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftCommits = campos[2].split(\"@@\")\n\t\t\t\t\trightCommits = campos[3].split(\"@@\")\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tleftFiles = campos[4][1..campos[4].length-2].split(\"@\")\t\t\t\t\n\t\t\t\t\tif !campos[5].include?(\"\\n\")\n\t\t\t\t\t\trightFiles = campos[5][1..campos[5].length-2].split(\"@\")\n\t\t\t\t\telse\n\t\t\t\t\t\trightFiles = campos[5][1..campos[5].length-3].split(\"@\")\n\t\t\t\t\tend\t\n\n\t\t\t\t\t#leftFiles=[]\n\t\t\t\t\tcountLeftLines =0\n\t\t\t\t\tcountRightLines=0\n\t\t\t\t\t#rightFiles\n\t\t\t\t\tarithmeticMeanChangedFiles = 0 \n\t\t\t\t\tgeometricMeanChangedFiles = 0\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif leftCommits.include?(\"\\n\")\n\t\t\t\t\t\tleftCommits.delete(\"\\n\")\n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\t\tif rightCommits.include?(\"\\n\")\n\t\t\t\t\t\trightCommits.delete(\"\\n\")\n\t\t\t\t\tend\n\t\t\t\n\t\t\t\t\tleftCommits.each do |commit|\n\t\t\t\t\t\tdata = %x(git --no-pager log -1 --stat #{commit}) \n\t\t\t\t\t\tlistInfo = data.split(\"\\n\")\n\t\t\t\t\t\tleftFiles.each do |f|\n\t\t\t\t\t\t\tlistInfo.each do |item|\n\t\t\t\t\t\t\t\tif item.include?(f+\" \") and item.include?(\"|\") and (!f.include?(\".bmp\") and !f.include?(\".dib\") and !f.include?(\".jpg\") and !f.include?(\".jpeg\") and !f.include?(\".jpe\") and !f.include?(\".jfif\") and !f.include?(\".gif\") and !f.include?(\".tif\") and !f.include?(\".tiff\") and !f.include?(\".png\") and !f.strip.eql?(\"Gemfile.lock\"))\n\t\t\t\t\t\t\t\t\ttmpItem = item.split(\"|\")\n\t\t\t\t\t\t\t\t\tcountLeftLines += tmpItem[1][/\\d+/].to_i\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\trightCommits.each do |commit|\n\t\t\t\t\t\tdata = %x(git --no-pager log -1 --stat #{commit}) \n\t\t\t\t\t\tlistInfo = data.split(\"\\n\")\n\t\t\t\t\t\t\n\t\t\t\t\t\trightFiles.each do |f|\n\t\t\t\t\t\t\tlistInfo.each do |item|\n\t\t\t\t\t\t\t\tif item.include?(f+\" \") and item.include?(\"|\") and (!f.include?(\".bmp\") and !f.include?(\".dib\") and !f.include?(\".jpg\") and !f.include?(\".jpeg\") and !f.include?(\".jpe\") and !f.include?(\".jfif\") and !f.include?(\".gif\") and !f.include?(\".tif\") and !f.include?(\".tiff\") and !f.include?(\".png\") and !f.strip.eql?(\"Gemfile.lock\"))\n\t\t\t\t\t\t\t\t\ttmpItem = item.split(\"|\")\n\t\t\t\t\t\t\t\t\tcountRightLines += tmpItem[1][/\\d+/].to_i\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif (countLeftLines == 0)\n\t\t\t\t\t\tcountLeftLines = 1\n\t\t\t\t\tend\n\t\t\t\t\tif (countRightLines == 0)\n\t\t\t\t\t\tcountRightLines = 1\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tarithmeticMeanChangedLines = (Float(countLeftLines + countRightLines)/2).round(2)\n\t\t\t\t\tgeometricMeanChangedLines = Math.sqrt(Float(countLeftLines*countRightLines)).round(2)\n\t\t\t\t\tdados = mergeCommitID+\",\"+isConflicting+\",\"+\"#{countLeftLines}\"+\",\"+\"#{countRightLines}\"+\",\"+\"#{arithmeticMeanChangedLines}\"+\",\"+\"#{geometricMeanChangedLines}\"\n\t\t\t\t\tprojectsList.push(dados.gsub(\"\\\"\", \"\"))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_NumberOfChangedLines.csv\", 'w') do |file|\n\t\t\tfile.puts \"mergeCommitID, isConflicting, countLeftLines, countRightLines, arithmeticMeanChangedLines, geometricMeanChangedLines\"\n\t\t\tprojectsList.each do |dado|\n\t\t\t\tfile.puts \"#{dado}\"\n\t\t\tend\n\t\tend\n\n\n\t\tprojectsList = []\n\t\tprojectsFilesList = []\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitListAndFilesList.csv\", 'r') do |f1| \n\t\t\twhile line = f1.gets \n\t\t\t\tf1.each_line do |line|\n\t\t\t\t\tcampos = line.split(\",\")#.length\t\n\t\t\t\t\tmergeCommitID = campos[0].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tisConflicting = campos[1].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tleftFiles = campos[4].split(\"@\")\t\n\t\t\t\t\trightFiles = campos[5].split(\"@\")\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tcountLeftFiles = leftFiles.length\n\t\t\t\t\tcountRightFiles = rightFiles.length\n\t\t\t\t\t\n\t\t\t\t\tarithmeticMeanChangedFiles = 0 \n\t\t\t\t\tgeometricMeanChangedFiles = 0\t\t\t\t\n\t\t\t\t\t\n\n\t\t\t\t\tarithmeticMeanChangedFiles = (Float(countLeftFiles + countRightFiles)/2).round(2)\n\t\t\t\t\tgeometricMeanChangedFiles = Math.sqrt(Float(countLeftFiles*countRightFiles)).round(2)\n\t\t\t\t\tdados = mergeCommitID+\",\"+isConflicting+\",\"+\"#{countLeftFiles}\"+\",\"+\"#{countRightFiles}\"+\",\"+\"#{arithmeticMeanChangedFiles}\"+\",\"+\"#{geometricMeanChangedFiles}\"\n\t\t\t\t\tprojectsFilesList.push(dados.gsub(\"\\\"\", \"\"))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_NumberOfChangedFiles.csv\", 'w') do |file|\n\t\t\tfile.puts \"mergeCommitID, isConflicting, countLeftFiles, countRightFiles, arithmeticMeanChangedFiles, geometricMeanChangedFiles\"\n\t\t\tprojectsFilesList.each do |dado|\n\t\t\t\tfile.puts \"#{dado}\"\n\t\t\tend\n\t\tend\n\t\tputs \"end running getNumberOfChangedFilesAndChangedLines from #{prefixProjectName} project\"\n\tend", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n commits = commit_entries(pr, at_open = true)\n\n commits_per_file = commits.flat_map { |c|\n unless c[:files].nil?\n JSON.parse(c[:files]).map { |f|\n [c[:sha], f[\"filename\"]]\n }\n else\n []\n end\n }.select{|x| x.size > 1}.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]} # get the shas of pr related commits\n\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr[:base_commit])\n\n commit_list = walker.select do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid # (oid is the object id - c.oid gets the commit sha). this commit is not part of pr's commits\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def commit(opts = {:use_dirstate => true, :update_dirstate => true})\n valid = false # don't update the DirState if this is set!\n \n commit = ((modified || []) + (added || [])).sort\n remove = removed\n xtra = extra.dup\n branchname = xtra[\"branch\"]\n text = description\n \n p1, p2 = parents.map {|p| p.node }\n c1 = repo.changelog.read(p1) # 1 parent's changeset as an array\n c2 = repo.changelog.read(p2) # 2nd parent's changeset as an array\n m1 = repo.manifest.read(c1[0]).dup # 1st parent's manifest\n m2 = repo.manifest.read(c2[0]) # 2nd parent's manifest\n \n if opts[:use_dirstate]\n oldname = c1[5][\"branch\"]\n tests = [ commit.empty?, remove.empty?, !opts[:force],\n p2 == NULL_ID, branchname == oldname ]\n if tests.all?\n UI::status \"nothing changed\"\n return nil\n end\n end\n \n xp1 = p1.hexlify\n xp2 = p2 == NULL_ID ? \"\" : p2.hexlify\n \n Hook.run_hook :pre_commit\n journal = Amp::Mercurial::Journal.new(:opener => repo.store_opener)\n \n fresh = {} # new = reserved haha i don't know why someone wrote \"haha\"\n changed = []\n link_rev = repo.size\n \n (commit + (remove || [])).each {|file| UI::status file }\n \n # foreach file in commit:\n # commit_file file\n # end\n commit.each do |file|\n versioned_file = self[file]\n fresh[file] = versioned_file.commit :manifests => [m1, m2],\n :link_revision => link_rev,\n :journal => journal ,\n :changed => changed\n \n new_flags = versioned_file.flags\n \n # TODO\n # Clean this shit up\n if [ changed.empty? || changed.last != file, \n m2[file] != fresh[file]\n ].all?\n changed << file if m1.flags[file] != new_flags\n end\n m1.flags[file] = new_flags\n \n repo.staging_area.normal file if opts[:use_dirstate]\n end\n \n # add_manifest_entry\n man_entry, updated, added = *add_manifest_entry(:manifests => [m1, m2],\n :changesets => [c1, c2],\n :journal => journal ,\n :link_rev => link_rev,\n :fresh => fresh ,\n :remove => remove ,\n :changed => changed )\n\n # get_commit_text\n text = get_commit_text text, :added => added, :updated => updated,\n :removed => removed, :user => user ,\n :empty_ok => opts[:empty_ok] ,\n :use_dirstate => opts[:use_dirstate]\n \n # atomically write to the changelog\n # add_changelog_entry\n # for the unenlightened, rents = 'rents = parents\n new_rents = add_changelog_entry :manifest_entry => man_entry,\n :files => (changed + removed),\n :text => text,\n :journal => journal,\n :parents => [p1, p2],\n :user => user,\n :date => date,\n :extra => xtra\n \n \n # Write the dirstate if it needs to be updated\n # basically just bring it up to speed\n if opts[:use_dirstate] || opts[:update_dirstate]\n repo.dirstate.parents = new_rents\n removed.each {|f| repo.dirstate.forget(f) } if opts[:use_dirstate]\n repo.staging_area.save\n end\n \n # The journal and dirstates are awesome. Leave them be.\n valid = true\n journal.close\n \n # if an error and we've gotten this far, then the journal is complete\n # and it deserves to stay (if an error is thrown and journal isn't nil,\n # the rescue will destroy it)\n journal = nil\n \n # Run any hooks\n Hook.run_hook :post_commit, :added => added, :modified => updated, :removed => removed, \n :user => user, :date => date, :text => text,\n :revision => repo.changelog.index_size\n return new_rents\n rescue StandardError => e\n if !valid\n repo.dirstate.invalidate!\n end\n if e.kind_of?(AbortError)\n UI::warn \"Abort: #{e}\"\n else\n UI::warn \"Got exception while committing. #{e}\"\n UI::warn e.backtrace.join(\"\\n\")\n end\n \n # the journal is a vestigial and incomplete file.\n # destroyzzzzzzzzzzz\n journal.delete if journal\n end", "def get_committed_files\n # set the current branch name to be the current branch you're on --> need to check that this works as part of push\n curr_branch_name = `git rev-parse --abbrev-ref HEAD`\n\n # raw_sha_list lists all the local, unpushed commit SHAs from your current branch\n raw_sha_list = `git log --graph --pretty=format:'%H' #{curr_branch_name}`\n\n committed_files = []\n # loop through the raw_sha_list and push properly formatted SHAs into the all_shas arr\n raw_sha_list.each_line { |sha|\n # using the .tr method on the sha makes a copy of the sha and replaces instances that matches with the to_str (second arg),\n # unless the range starts with a ^ carrot, in which case, it replaces on matches outside the range\n curr_sha = sha.tr('^A-Za-z0-9', '')\n\n # this `git diff-tree --no-commit-id --name-only -r <SHA>` will list the files of an individual commit when you add the SHA\n # on each iteration, set the changed_files variable to be the list of files from a particular commit, based its SHA\n changed_files = `git diff-tree --no-commit-id --name-only -r #{curr_sha}`\n\n # loop over the changed_files and add in each file that's part of a commit and add into the committed_files arr\n changed_files.each_line { |file|\n # remove any trailing whitespace from the file name and add into our arr\n committed_files << file.rstrip()\n }\n }\n # return the final, no-repeat array of committed files in this push\n return committed_files.uniq\nend", "def find_all(repo, options = {})\n refs = []\n already = {}\n Dir.chdir(repo.path) do\n files = Dir.glob(prefix + '/**/*')\n files.each do |ref|\n next if !File.file?(ref)\n id = File.read(ref).chomp\n name = ref.sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => id)\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n\n if File.file?('packed-refs')\n File.readlines('packed-refs').each do |line|\n if m = /^(\\w{40}) (.*?)$/.match(line)\n next if !Regexp.new('^' + prefix).match(m[2])\n name = m[2].sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => m[1])\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n end\n end\n end\n\n refs\n end", "def compute_changed_and_risk_files(params)\n commit_hash, file_arr = commit_info(params)\n changed_file_freq = file_arr.flatten!.each_with_object(Hash.new(0)) {|file, freq_acc| freq_acc[file] += 1}\n changed_g2_files = []\n changed_file_freq.select {|file, freq| changed_g2_files << file if freq > 2}\n risk_files = changed_g2_files.dup\n rf = risk_files.each_with_object({}) do |file, acc|\n author_set = Set.new\n commit_hash.each do |file_arr, author|\n acc[file] = (author_set << author ) if file_arr.include? (file)\n end\n end\n rf.delete_if {|_file, author_arr| author_arr.length < 2}\n {\n \"changed_files\" => changed_g2_files,\n \"risk_files\" => rf\n }\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n pr_against = pull_req_entry(pr[:id])['base']['sha']\n commits = commit_entries(pr[:id])\n\n commits_per_file = commits.flat_map { |c|\n c['files'].map { |f|\n [c['sha'], f['filename']]\n }\n }.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]}\n\n walker = Rugged::Walker.new(repo)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr_against)\n\n commit_list = walker.take_while do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def update_changed_rev(file_safety, repo, fnames = nil)\n fnames = file_safety.keys if fnames.nil?\n # TODO: Use svn info --xml instead\n # TODO: Is it possible to get %x[] syntax to accept variable arguments?\n #all_info = %x[svn info -r HEAD \"#{fnames.join(' ')}\"]\n #repo = %x[svn info].split(\"\\n\").select{|x| x =~ /^URL: /}.collect{|x| x[5..-1]}.first\n # Filename becomes too long, and extra arguments get ignored\n #all_info = Kernel.send(\"`\", \"svn info -r HEAD #{fnames.sort.join(' ')}\").split(\"\\n\\n\")\n # Note: I'd like to be able to use svn -u status -v instead of svn info,\n # but it seems to refer only to the local working copy...\n f2 = fnames.sort # Sorted copy is safe to change\n all_info = []\n while f2 && !f2.empty?\n blocksize = 10\n extra_info = svn_info_entries(f2.first(blocksize), repo)\n #if extra_info.size != [blocksize, f2.size].min\n # puts \"Mismatch (got #{extra_info.size}, expected #{[blocksize, f2.size].min})\"\n #end\n all_info += extra_info\n f2 = f2[blocksize..-1]\n end\n fnames.each{|f|\n #puts \"Checking for URL: #{repo}/#{f}\"\n #puts all_info[0].inspect\n info = all_info.find{|x| x.include?(\"URL: #{repo}/#{f}\")}\n if info\n info = info.split(\"\\n\")\n else\n #puts \"Unknown: #{f}\"\n end\n #info = %x[svn info -r HEAD \"#{f}\"].split(\"\\n\")\n if info.nil? || info.empty?\n # svn writes to stderr: \"svn: '#{f}' has no URL\", or\n # \"#{f}: (Not a versioned resource)\"\n file_safety[f][\"last_changed_rev\"] = -1 # Flag as non-existent\n else\n file_safety[f][\"last_changed_rev\"] = info.\n select{|x| x =~ /^Last Changed Rev: /}.collect{|x| x[18..-1]}[0].to_i\n end\n }\nend", "def commit_modified_files_task\n really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split(\"\\n\")\n if really_modified.any?\n really_modified.each { |file| sh git, 'add', file }\n sh git, 'commit', '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end\n end", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\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 uncommitted_files\n files = nil\n p4 (['change','-o']).each do |line|\n files << line.strip if files\n files = [] if line.start_with?('Files:')\n end\n files ||= []\n end", "def test_changed\n dir = \"changed_dir\"\n dir1 = \"changed_dir1\"\n dir2 = \"changed_dir2\"\n dir_path = File.join(@wc_path, dir)\n dir1_path = File.join(@wc_path, dir1)\n dir2_path = File.join(@wc_path, dir2)\n dir_svn_path = dir\n dir1_svn_path = dir1\n dir2_svn_path = dir2\n\n file1 = \"changed1.txt\"\n file2 = \"changed2.txt\"\n file3 = \"changed3.txt\"\n file4 = \"changed4.txt\"\n file5 = \"changed5.txt\"\n file1_path = File.join(@wc_path, file1)\n file2_path = File.join(dir_path, file2)\n file3_path = File.join(@wc_path, file3)\n file4_path = File.join(dir_path, file4)\n file5_path = File.join(@wc_path, file5)\n file1_svn_path = file1\n file2_svn_path = [dir_svn_path, file2].join(\"/\")\n file3_svn_path = file3\n file4_svn_path = [dir_svn_path, file4].join(\"/\")\n file5_svn_path = file5\n\n first_rev = nil\n\n log = \"added 3 dirs\\nanded 5 files\"\n make_context(log) do |ctx|\n\n ctx.mkdir([dir_path, dir1_path, dir2_path])\n\n FileUtils.touch(file1_path)\n FileUtils.touch(file2_path)\n FileUtils.touch(file3_path)\n FileUtils.touch(file4_path)\n FileUtils.touch(file5_path)\n ctx.add(file1_path)\n ctx.add(file2_path)\n ctx.add(file3_path)\n ctx.add(file4_path)\n ctx.add(file5_path)\n\n commit_info = ctx.commit(@wc_path)\n first_rev = commit_info.revision\n\n editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)\n assert_equal([\n file1_svn_path, file2_svn_path,\n file3_svn_path, file4_svn_path,\n file5_svn_path,\n ].sort,\n editor.added_files)\n assert_equal([], editor.updated_files)\n assert_equal([], editor.deleted_files)\n assert_equal([].sort, editor.updated_dirs)\n assert_equal([].sort, editor.deleted_dirs)\n assert_equal([\n \"#{dir_svn_path}/\",\n \"#{dir1_svn_path}/\",\n \"#{dir2_svn_path}/\"\n ].sort,\n editor.added_dirs)\n end\n\n log = \"deleted 2 dirs\\nchanged 3 files\\ndeleted 2 files\\nadded 3 files\"\n make_context(log) do |ctx|\n\n dir3 = \"changed_dir3\"\n dir4 = \"changed_dir4\"\n dir3_path = File.join(dir_path, dir3)\n dir4_path = File.join(@wc_path, dir4)\n dir3_svn_path = [dir_svn_path, dir3].join(\"/\")\n dir4_svn_path = dir4\n\n file6 = \"changed6.txt\"\n file7 = \"changed7.txt\"\n file8 = \"changed8.txt\"\n file9 = \"changed9.txt\"\n file10 = \"changed10.txt\"\n file6_path = File.join(dir_path, file6)\n file7_path = File.join(@wc_path, file7)\n file8_path = File.join(dir_path, file8)\n file9_path = File.join(dir_path, file9)\n file10_path = File.join(dir_path, file10)\n file6_svn_path = [dir_svn_path, file6].join(\"/\")\n file7_svn_path = file7\n file8_svn_path = [dir_svn_path, file8].join(\"/\")\n file9_svn_path = [dir_svn_path, file9].join(\"/\")\n file10_svn_path = [dir_svn_path, file10].join(\"/\")\n\n File.open(file1_path, \"w\") {|f| f.puts \"changed\"}\n File.open(file2_path, \"w\") {|f| f.puts \"changed\"}\n File.open(file3_path, \"w\") {|f| f.puts \"changed\"}\n ctx.rm_f([file4_path, file5_path])\n FileUtils.touch(file6_path)\n FileUtils.touch(file7_path)\n FileUtils.touch(file8_path)\n ctx.add(file6_path)\n ctx.add(file7_path)\n ctx.add(file8_path)\n ctx.cp(file1_path, file9_path)\n ctx.cp(file2_path, file10_path)\n ctx.mv(dir2_path, dir3_path)\n ctx.cp(dir1_path, dir4_path)\n ctx.rm(dir1_path)\n\n commit_info = ctx.commit(@wc_path)\n second_rev = commit_info.revision\n\n editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)\n assert_equal([file1_svn_path, file2_svn_path, file3_svn_path].sort,\n editor.updated_files)\n assert_equal([file4_svn_path, file5_svn_path].sort,\n editor.deleted_files)\n assert_equal([file6_svn_path, file7_svn_path, file8_svn_path].sort,\n editor.added_files)\n assert_equal([].sort, editor.updated_dirs)\n assert_equal([\n [file9_svn_path, file1_svn_path, first_rev],\n [file10_svn_path, file2_svn_path, first_rev],\n ].sort_by{|x| x[0]},\n editor.copied_files)\n assert_equal([\n [\"#{dir3_svn_path}/\", \"#{dir2_svn_path}/\", first_rev],\n [\"#{dir4_svn_path}/\", \"#{dir1_svn_path}/\", first_rev],\n ].sort_by{|x| x[0]},\n editor.copied_dirs)\n assert_equal([\"#{dir1_svn_path}/\", \"#{dir2_svn_path}/\"].sort,\n editor.deleted_dirs)\n assert_equal([].sort, editor.added_dirs)\n end\n end", "def files_changed_as_set(files)\n changed_files = files.select { |file| git.modified_files.include? file }\n not_changed_files = files.select { |file| !changed_files.include? file }\n all_files_changed = not_changed_files.empty?\n no_files_changed = changed_files.empty?\n return all_files_changed || no_files_changed\nend", "def discover_deleted_craft existing_craft_map = nil\n #In the root of the campaigns git repo run the --diff-filter command and then return to the current working dir.\n log = self.repo.log_filterD\n \n\n #Select the craft already present in the DB which can either be from passed in existing_craft_map or directly from the DB\n if existing_craft_map\n existing_craft = {\n \"VAB\" => existing_craft_map.has_key?(\"vab\") ? existing_craft_map[\"vab\"].keys : [],\n \"SPH\" => existing_craft_map.has_key?(\"sph\") ? existing_craft_map[\"sph\"].keys : []\n } \n else \n existing_craft = {\n \"VAB\" => self.craft.where(:craft_type => \"vab\").map{|c| c.name},\n \"SPH\" => self.craft.where(:craft_type => \"sph\").map{|c| c.name}\n } \n end\n\n #get all the SHA_ID's used in the campaigns repo\n logs = self.repo.log.map{|log| log.to_s}\n\n #split logs so that each element contains one commit and each commit is an array, the 1st element of which is the SHA_ID\n log = log.split(\"commit \").map{|l| l.split(\"\\n\") }.select{|l| !l.empty?}\n\n log.map{|l|\n next unless logs.include?(l[0]) #perhaps un-nessesary, a security step to ensure this only examines commits whos SHA_ID matches one in this repo.\n commit_info = {\n :sha => l[0], #first element is the SHA_ID\n #select lines which include \"delete mode\" and remove the \"delete mode\" text. Each line (of which there maybe 1 or more) is a file which was deleted.\n :deleted => l.select{|line| line.include?(\"delete mode\")}.map{|line| line.gsub(\"delete mode 100644\",\"\").strip}.map{|data|\n s = data.sub(\"Ships/\",\"\").split(\"/\") #assume the file path has 'Ships/' and remove it and split on '/'\n d = {:craft_type => s[0], :name => s[1]} #assuming the file is a craft, the first element will be VAB or SPH and the 2nd element will be the name.craft\n d = nil unless d[:name].include?('.craft')#set d to nil 'skip' if the name does not include .craft\n #second skip clause, skip if the craft type is not either VAB or SPH and skip if the existing craft already contain a craft by that name (for that craft_type).\n d = nil if ![\"SPH\",\"VAB\"].include?(d[:craft_type]) || existing_craft[d[:craft_type]].include?(d[:name].sub(\".craft\",\"\"))\n d\n }.compact #remove the nil'ed entries\n }\n commit_info = nil if commit_info[:deleted].compact.empty? #if all the entries were nil'ed then skip this commit\n commit_info\n }.compact #remove the nil'ed commits.\n end", "def applicable_owners_files_hash\n return @applicable_owners_files_hash if !@applicable_owners_files_hash.nil?\n\n # Make hash of (directory => [files in that directory in this commit]) pairs\n\n puts \"changed files: #{changed_files.inspect}\"\n\n affected_dirs_hash = changed_files.collect_to_reverse_hash do |file|\n File.dirname(file)\n end\n\n puts \"affected_dirs_hash: #{affected_dirs_hash.inspect}\"\n\n affected_dirs = affected_dirs_hash.keys\n\n # Make hash of owners file => [file1, file2, file3]\n res = affected_dirs.inject(Hash.new) do |hash, dir|\n owner = find_owners_file(dir)\n\n # If there's no OWNERS file for this dir, just skip it\n if owner.nil?\n return hash\n end\n\n data = {\n :owner_data => owner,\n :files => affected_dirs_hash[dir]\n }\n\n key = owner[:path]\n\n if (hash.include?(key))\n combined_data = hash[key]\n combined_data[:files] = combined_data[:files] + data[:files]\n\n hash[key] = combined_data\n else\n hash[key] = data\n end\n hash\n end \n\n @applicable_owners_files_hash = res\n end", "def git_push_if_changes( names ) ## optenfootball repo names e.g. world, england, etc.\n message = \"auto-update week #{Date.today.cweek}\"\n puts message\n\n names.each do |name|\n path = \"#{SportDb::Boot.root}/openfootball/#{name}\"\n\n Gitti::GitProject.open( path ) do |proj|\n puts ''\n puts \"###########################################\"\n puts \"## trying to commit & push repo in path >#{path}<\"\n puts \"Dir.getwd: #{Dir.getwd}\"\n output = proj.changes\n if output.empty?\n puts \"no changes found; skipping commit & push\"\n else\n proj.add( '.' )\n proj.commit( message )\n proj.push\n end\n end\n end\nend", "def git_sources=(_arg0); end", "def git_sources=(_arg0); end", "def new_and_changed \n r = repo\n {\n :new => r.untracked.select{|k| k.include?(\"Ships\") && k.include?(\".craft\")},\n :changed => r.changed.select{ |k| k.include?(\"Ships\") && k.include?(\".craft\")}\n }\n end", "def all_changed_files\n Set.new\n .merge(git.added_files.to_a)\n .merge(git.modified_files.to_a)\n .merge(git.renamed_files.map { |x| x[:after] })\n .subtract(git.renamed_files.map { |x| x[:before] })\n .to_a\n .sort\n end", "def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend", "def files_at_commit(pr, filter = lambda { |x| true })\n sha = pr[:base_commit]\n begin\n files = lslr(git.lookup(sha).tree)\n rescue StandardError => e\n log pr[:id]\n log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n return nil # not to the default branch\n end\n\n # # find the eariler than and closest to the creation time of commit\n # sha = commit_closest_earlier_pr(pr)\n # begin\n # files = sha.nil? ? [] : lslr(git.lookup(sha).tree)\n # rescue StandardError => e\n # log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n # files = [] # no files found before the pr\n # end\n\n\n if files.size <= 0\n log \"No files for commit #{sha}\"\n end\n files.select { |x| filter.call(x) }\n\n end", "def changed_files\n DeliveryTruck::Helpers.changed_files(\n DeliveryTruck::Helpers.pre_change_sha(node),\n node['delivery']['change']['sha'],\n node\n )\n end", "def parse_git_repo\n git_output = `git status --porcelain 2>&1`\n unless $?.exitstatus == 0\n puts \"Git error: make sure the current directory is a valid repo and that git is working.\"\n exit!\n end\n list = git_output.split(\"\\n\")\n # Get just what was added, modified, copied or moved.\n # Skip deleted files.\n files = list.reduce([]) do |a, f|\n file = /[\\?MARC ]{1,2} (.*\\.pp)/.match f\n a << file[1] if file\n a\n end\n files.uniq! # remove dupes, just in case.\n files.each { |f| PuppetFile.new(File.expand_path(f)) }\nend", "def check_changed_files(git)\n git.status.select {|file| file.type || file.untracked }\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n def lslr(tree, path = '')\n all_files = []\n for f in tree.map{|x| x}\n f[:path] = path + '/' + f[:name]\n if f[:type] == :tree\n begin\n all_files << lslr(repo.lookup(f[:oid]), f[:path])\n rescue Exception => e\n STDERR.puts e\n all_files\n end\n else\n all_files << f\n end\n end\n all_files.flatten\n end\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n begin\n files = lslr(repo.lookup(base_commit).tree)\n files.select{|x| filter.call(x)}\n rescue Exception => e\n STDERR.puts \"Cannot find commit #{base_commit} in base repo\"\n []\n end\n end", "def update_commitlist(h)\n h.map do |entry|\n sha = entry[\"commit\"].to_s.strip\n n = entry[\"note\"]\n # First, try to look it up in our existing repo\n if commit_exists?(sha) || sha.empty?\n entry # do nothing, put it back in the hash\n else\n # Ok, we know it doesn't exist. Now look it up in gitlog.json\n if @gitlog_json.key? sha\n m = @gitlog_json[sha][\"message\"]\n svn_id = m.lines.select {|l| l.match? /git-svn-id/ }.join.strip\n grep_cmd = <<~EOS.strip\n git -C ./tmp/src rev-list --all --grep=\"#{svn_id}\" --\n EOS\n stdout, stderr, status = Open3.capture3(grep_cmd)\n if stderr.empty?\n {\n \"commit\" => stdout.strip,\n \"note\" => <<~EOS.strip\n #{entry[\"note\"].to_s.lines.join(\"\\n\")}\n\n Formerly #{sha} before HTTPD rewrote Git history.\n EOS\n }\n else\n warn \"ERROR getting commit #{sha}. #{stderr}\"\n entry\n end\n else\n warn \"ERROR commit #{sha} does not exist in gitlog.json\"\n entry\n end\n end\n end\nend", "def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'approle' }\n .keys\n .inject([]) { |acc, elem| acc + role_files(elem) }\n end", "def altered_files; (modified + added + removed).sort; end", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, status) = info.split\n hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_repo => sha_src, :sha_index => sha_dest, :status => status}\n end\n hsh\n end", "def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "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 repositories_to_fetch\n # Find all .git Repositories - Ignore *.wiki.git\n repos = Dir.glob(\"#{@config['git']['repos']}/*/*{[!.wiki]}.git\")\n\n # Build up array of NOT ignored repositories\n delete_path = []\n @config['ignore'].each do |ignored|\n path = File.join(@config['git']['repos'], ignored)\n delete_path += repos.grep /^#{path}/\n repos.delete(delete_path)\n end\n\n return repos - delete_path\n\n end", "def createDiffResult(working_dir, channel_cfg, vimapp, isReleaseOperator,backupRoot)\n\n remotedir = readChannelDir(channel_cfg, vimapp) + \"/\"+ File.basename(working_dir)\n puts remotedir.green\n if File.directory?(remotedir) == false\n FileUtils.mkdir_p remotedir\n end\n\n reportFile1 = \"#{remotedir}/report\"\n reportFile2 = \"#{remotedir}/rdetail\"\n lines = File.open(reportFile1, \"r:UTF-8\").each_line.to_a\n\n hashes = Array.new\n lines.each do |line|\n if line.start_with? \"hash=\"\n hashes.push line.gsub(\"hash=\",\"\").strip.chomp\n end\n end\n\n g = gitOpen(working_dir)\n \n logs = getGitLog(g)\n local_branches = getGitBranches(g)[:local]\n diff = compareHashes g, logs, hashes\n \n def getDiffDetails(diffinfo)\n puts \"diffdetails\"\n data = Array.new \n\n diffinfo[:files].each do |file|\n print \"[\"\n print file[0].cyan\n print \"] \"\n print \"[+] #{file[1][:insertions]}\".green\n print \" \"\n print \"[-] #{file[1][:deletions]}\".red\n puts\n # file, insertions, deletions\n data.push \"file=#{file[0]},#{file[1][:insertions]},#{file[1][:deletions]}\"\n end\n\n return data \n end\n\n diff_details = getDiffDetails diff[1]\n \n puts \"\\n\\n|||||||||||||||||||||||||WRITE|||||||||||||||||||||||||||||||||\\n\\n\"\n\n puts \"hash=\"+diff[2]\n puts \"hash=\"+diff[3]\n diff_details.each do |d| \n puts d\n end\n\n diffReportDir = \"#{working_dir}/.diffreport\"\n FileUtils.mkdir_p diffReportDir \n\n #write diff detail to file \n r_detail = \"#{diffReportDir}/detail\"\n\n puts \">> 222\"\n f = File.open(r_detail, \"w:UTF-8\")\n diff[0].each do |l|\n f.puts l\n end\n f.close\n\n f = File.open(r_detail+\".color\", \"w:UTF-8\")\n diff[0].each do |l|\n if isPlus(l)\n f.puts l.green\n elsif isMinus(l)\n f.puts l.red\n else\n f.puts l\n end\n end\n f.close\n\n puts \">> 111\"\n #write diff to file\n diffReport = \"#{diffReportDir}/report\"\n f = File.open(diffReport, \"w:UTF-8\")\n f.puts \"hash=\"+diff[2]\n f.puts \"hash=\"+diff[3]\n diff_details.each do |d| \n f.puts d\n end\n f.close\n puts \"\\n\\nWRITTEN\\n\\n\".green\n\n if isReleaseOperator == false\n FileUtils.cp \"#{diffReport}\", \"#{reportFile1}\"\n FileUtils.cp \"#{r_detail}\", \"#{reportFile2}\"\n else\n metaOK = FileUtils.identical?(diffReport, reportFile1)\n detailOK = FileUtils.identical?(r_detail, reportFile2)\n \n puts \n print \"[ OVERVIEWS ] \" #metaOK.to_s.red\n puts metaOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n print \"[CODE DETAILS] \"\n puts detailOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n puts\n def compare(file1, file2)\n puts \">> compare\"\n lines1 = File.open(file1, \"r:UTF-8\").each_line.to_a\n lines2 = File.open(file2, \"r:UTF-8\").each_line.to_a\n def showInclusion(lines1, lines2, i)\n lines1.each do |line|\n if lines2.include?(line) == false\n if i == true\n puts \"[YOURS] \"+ line.chomp.cyan\n else\n puts \"[REMOTE] \"+ line.chomp.yellow\n end\n end\n end\n end\n showInclusion(lines1, lines2, true)\n showInclusion(lines2, lines1, false)\n end\n compare diffReport, reportFile1\n compare r_detail, reportFile2\n end\n\n files = Array.new\n diff_details.each do |d| \n if d.start_with? \"file=\"\n files.push d.gsub(\"file=\",\"\").strip.chomp\n end\n end\n if hashes.size > 0\n #compareBackupsWithOldVersion(g, working_dir, backupRoot, files, hash) \n #compareBackupsWithOldVersion(g, working_dir,backupRoot,files, hash[1]) \n end\n end", "def revision_files(options={})\r\n @scm.revisions(Time.epoch, options.dup.merge({:to_identifier => Time.infinity, :relative_path => @relative_path})).collect do |revision|\r\n if revision.files.length != 1\r\n files_s = revision.files.collect{|f| f.to_s}.join(\"\\n\")\r\n raise \"The file-specific revision didn't have exactly one file, but #{revision.files.length}:\\n#{files_s}\"\r\n end\r\n if(!revision.files[0].path.eql?(@relative_path))\r\n raise \"The file-specific revision didn't have expected path '#{@relative_path}', but '#{revision.files[0].path}'\"\r\n end\r\n revision.files[0]\r\n end\r\n end", "def meta(repo)\n repo_changes = MetaCommit::Models::Changes::Repository.new(repo.path)\n repo.walk_by_commits do |left_commit, right_commit|\n commit_changes = MetaCommit::Models::Changes::Commit.new(left_commit.oid, right_commit.oid)\n diffs = examine_diff(repo, left_commit, right_commit)\n commit_changes.push_changes(diffs)\n repo_changes.push(commit_changes)\n end\n repo_changes\n end", "def repo_all_commits_structures(repo_dir, commits_file, structures_dir)\n sdir = Pathname.new(Dir.pwd) + Pathname.new(structures_dir)\n base_dir = Pathname.new(repo_dir).basename.to_s\n FileUtils.mkdir_p(sdir + \"dir\")\n FileUtils.mkdir_p(sdir + \"dep\")\n lang = detect_language(repo_dir) # Detect programming language \n i = MCommits.new(commits_file).all_commits.size # Reverse order\n file_kenc = KeyEncoder.new\n make_temp_dir do |tmpdir|\n # Copy repo to temp folder\n FileUtils.cp_r repo_dir, tmpdir\n temp_repo_dir = tmpdir + \"/\" + base_dir\n \n chdir_return(temp_repo_dir) do\n keep_going = true\n while keep_going do\n i -= 1\n # Generate Directory Structure Graph\n puts \"Generating Dir Structure Graph\"\n directory_graph(\".\", \"%s/%d.txt\" % [(sdir+\"dir\").relative_path_from(Pathname.new Dir.pwd).to_s, i], file_kenc)\n\n key_count = file_kenc.key_count\n\n # Generate dependency graph if language is supported\n unless lang.nil?\n case lang\n when :ruby\n puts \"Generating Dependency Graph\"\n RubyFilesMatcher.new('.').dependency_graph_to_file(\"%s/%d.txt\" % [(sdir+\"dep\").relative_path_from(Pathname.new Dir.pwd).to_s, i], file_kenc)\n else\n puts \"Unsupported Programming Language\"\n end\n raise \"Dependency Graph is not supposed to generate more keys!\" if key_count != file_kenc.key_count\n end\n\n puts \"Rewinding...\"\n stdin, stdout, stderr = Open3.popen3(\"git reset --hard HEAD~1\")\n keep_going = false if stderr.readlines.length > 0 # While not getting \"...unknown revision or path not in the working tree...\"\n end\n end\n \n end\n raise \"Number of Commits Don't Match\" if i != 0\n file_kenc.to_file(sdir + \"file_key.txt\")\nend", "def git_dir; end", "def find_next\n status = `git status -s`.lines.reject(&:nil?).grep(/.. (PCL|tsion|steveklabnik)\\//)\n return nil if status.empty?\n\n first = status.map{|x| x.gsub(/^.. /, '') }.first.strip\n \n if File.directory?(first) \n return [first, [first]]\n else\n name = first.split('/')[-1].split('_', 2)[1]\n end\n\n pcl = find_file('PCL', name)\n tsion = find_file('tsion', name)\n steve = find_file('steveklabnik', name)\n\n [name, [pcl, tsion, steve]]\n end", "def repository_status(repo)\n untracked_files = 0\n modified_files = 0\n deleted_files = 0\n\n #- +:index_new+: the file is new in the index\n #- +:index_modified+: the file has been modified in the index\n #- +:index_deleted+: the file has been deleted from the index\n #- +:worktree_new+: the file is new in the working directory\n #- +:worktree_modified+: the file has been modified in the working directory\n #- +:worktree_deleted+: the file has been deleted from the working directory\n repo.status do |status|\n if status[1].include?(:worktree_new) || status[1].include?(:index_new)\n untracked_files += 1\n elsif status[1].include?(:worktree_modified) || status[1].include?(:index_modified)\n modified_files += 1\n elsif status[1].include?(:worktree_deleted) || status[1].include?(:index_deleted)\n deleted_files += 1\n end\n end\n\n return {\n untracked_files: untracked_files,\n modified_files: modified_files,\n deleted_files: deleted_files,\n clean: modified_files == 0 && deleted_files == 0\n }\nend", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n files = repo.lstree(base_commit, :recursive => true)\n\n files.select{|x| filter.call(x)}\n end", "def setup_git_hooks\n # repos to be hook'ed\n return unless @ebcommon.git_hook_repos\n\n # source\n plugin_hooks_dir = File.expand_path File.join(File.dirname(__FILE__), '..', 'files', 'git_hooks')\n git_hooks = Dir.entries(plugin_hooks_dir).select {|f| !File.directory? f}\n\n @env[:ui].info 'Copying over git commit hooks...'\n @ebcommon.git_hook_repos.each do |repo_path|\n # repo\n repo_dir = File.join @ebcommon.git_hook_root_dir, repo_path, '.git'\n next unless File.directory? repo_dir\n\n # create repo hooks dir if needed\n target_hooks_dir = File.join repo_dir, 'hooks'\n unless File.directory? target_hooks_dir\n @env[:ui].info \"Creating #{target_hooks_dir} directory...\"\n FileUtils.mkdir target_hooks_dir\n end\n\n # copy source hooks to repo\n git_hooks.each do |hook|\n @env[:ui].success \"Copying over git hook: #{hook} to #{target_hooks_dir}\"\n source = File.join plugin_hooks_dir, hook\n FileUtils.cp source, target_hooks_dir\n end\n end\n end", "def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend", "def git_refs()\n # This glob pattern matches recursively so we will find a branch named\n # something like 'feature/subfeature/the-cool-feature'.\n # TODO: get remotes also\n git_dir = git_git_dir()\n\n locals = Dir.glob(File.join(git_dir, 'refs', 'heads', '**', '*')).select do |f|\n !File.directory? f\n end.map do |f|\n {\n 'name' => f.split('/refs/heads/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n remotes = Dir.glob(File.join(git_dir, 'refs', 'remotes', '**', '*')).select do |f|\n !File.directory?(f) and !f.end_with? \"/HEAD\"\n end.map do |f|\n {\n 'name' => f.split('/refs/remotes/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n locals + remotes\nend", "def files_to_diff\n files = {}\n COMPARISON_PATHS.each do |framework_dir, project_dir|\n Dir.new(\"#{get_path_to_rails_gem}#{framework_dir}\").entries.reject { |e| /^\\./.match(e) }.each do |file|\n framework_file = \"#{get_path_to_rails_gem}#{framework_dir}#{file}\"\n project_file = \"#{project_path}#{project_dir}#{file}\" \n files[framework_file] = project_file\n end\n end\n \n COMPARISON_FILES.each do |framework_file, project_file|\n files[\"#{get_path_to_rails_gem}#{framework_file}\"] = \"#{project_path}#{project_file}\"\n end\n \n files\n end", "def changed_paths_check(revision,repo)\n `svnlook changed -r #{revision} #{repo}`.split(\"\\n\")\n end", "def uncommitted_files\n `hg status`.scan(/^(A|M|R|!|\\?) (\\S.*)$/).map{ |match| match.last.split.last }\n end", "def commits_on_files_touched(pr, months_back)\n commits_on_pr_files(pr, months_back).reduce([]) do |acc, commit_list|\n acc + commit_list[1]\n end.flatten.uniq.size\n end", "def diff_gitignore\n system(\"diff .gitignore ~/code/tmpl/gitignore-gem\")\n end", "def diff_gitignore\n system(\"diff .gitignore ~/code/tmpl/gitignore-gem\")\n end", "def diff_files_from(commit)\n git_args = ['diff', '--stat', '--name-only', commit]\n result = default_repository.git_output(git_args).lines.map { |line| line.strip }.sort\n # not sure if git would ever mention directories in a diff, but ignore them.\n result.delete_if { |item| ::File.directory?(item) }\n return result\n end", "def all_file_commits_data(path)\n time = ` cd /tmp/#{@repo} && git log --format=%ct #{path} `.split(\"\\n\").map{|time| time.to_i}\n ins_del = ` cd /tmp/#{@repo} && git log --numstat --format=%h #{path} | grep #{path} `.split(\"\\n\").map{|line| line.split(\" \")[0..1]}.map{|insert| insert.map{|x| x.to_i}}\n time.zip(ins_del)\n end", "def get_uncommitted_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-n', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"Changed files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend", "def dir_git(git,branch='master',reg=nil)\n path = http_uri + git + '/trees/master' \n raw = raw_file(path)\n # find all files\n array = Array.new\n reg = Regexp.new(reg) if reg.is_a?(String)\n raw.scan(/file.*\\n.*<a href=\"\\/.*>(.*)<\\/a>.*<\\/td>/) do |name|\n if reg\n array << name.to_s if name.to_s.match(reg)\n else \n array << name.to_s\n end\n end\n return array\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 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 log_commits_by_files(logopts=nil)\n\t\t\tr={}\n\t\t\tfiles=run_simple(\"git log #{DefaultLogOptions} --name-only --format=\"\" #{logopts}\", chomp: :lines)\n\t\t\tuniq=files.uniq\n\t\t\tuniq.each do |file|\n\t\t\t\tr[file]=files.count(file)\n\t\t\tend\n\t\t\tr\n\t\tend", "def files_changed_in_patch(patchfile, tap)\n files = []\n formulae = []\n others = []\n File.foreach(patchfile) do |line|\n files << Regexp.last_match(1) if line =~ %r{^\\+\\+\\+ b/(.*)}\n end\n files.each do |file|\n if tap&.formula_file?(file)\n formula_name = File.basename(file, \".rb\")\n formulae << formula_name unless formulae.include?(formula_name)\n else\n others << file\n end\n end\n { files: files, formulae: formulae, others: others }\n end", "def files_changed_in_patch(patchfile, tap)\n files = []\n formulae = []\n others = []\n File.foreach(patchfile) do |line|\n files << Regexp.last_match(1) if line =~ %r{^\\+\\+\\+ b/(.*)}\n end\n files.each do |file|\n if tap&.formula_file?(file)\n formula_name = File.basename(file, \".rb\")\n formulae << formula_name unless formulae.include?(formula_name)\n else\n others << file\n end\n end\n { files: files, formulae: formulae, others: others }\n end", "def list_git_log(dir)\n\n name = `git config --global --get user.email`.strip\n git_cmd = \"git log --stat --since='1 day ago' --author='#{name}'\"\n\n out = []\n Dir.foreach(dir) do |d|\n next if d == \".\" or d == \"..\"\n t = dir + '/' + d\n next if not File.directory?(t)\n if File.exists?(t + '/.git') and File.directory?(t + '/.git') then\n\n c = \"\"\n Dir.chdir(t) do |r|\n ci = `#{git_cmd}`\n next if ci.empty?\n\n ci.each_line do |l|\n #puts l\n c = \"#{l[0..12]}... \" if l.start_with?(\"commit\")\n\n out << (c + l.delete(\"\\n\")) if l.include?(\"files changed\") or l.include?(\"file changed\")\n end\n end\n end\n end\n out\nend", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n :cwd => node['delivery']['workspace']['repo']\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def changed_files\n # FIXME: Implement properly once changed detection is available.\n files\n end", "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "def resolution_candidates(file)\n @cmd_runner.run(\"diff -q --from-file #{file} .git/rr-cache/*/postimage*\", log: CmdRunner::LOG_CMD)\n different_files = split_diff_lines(@cmd_runner.last_stdout)\n\n @cmd_runner.run('ls -la .git/rr-cache/*/postimage*', log: CmdRunner::LOG_CMD)\n all_files = split_diff_lines(@cmd_runner.last_stdout)\n\n all_files - different_files\n end", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, type) = info.split\n hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_file => sha_src, :sha_index => sha_dest, :type => type}\n end\n hsh\n end", "def copy_files\n file_candidates.each do |remote_file|\n local_file = File.basename(remote_file)\n if File.exist?(local_file)\n if same_file?(local_file, remote_file)\n info \"\\n>> '#{local_file}' has the same contents here as in the repo. Leaving it alone.\"\n else\n if config['answer_yes']\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo.\"\n info \"Copying #{remote_file} to #{local_file}... (answer_yes is true)\"\n copy_file(remote_file, local_file)\n else\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo (see below)\"\n git_diff(local_file, remote_file)\n prompt \"\\nDo you want to overwrite #{local_file} with the version from the repo? [y/N]: \"\n\n answer = $stdin.gets.chomp\n case answer\n when ''\n error 'Moving on.' # Default behavior.\n when /y/i\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n when /n/i\n error 'Moving on.'\n else\n error 'Unknown selection. Moving on.'\n end\n end\n\n end\n else\n info \"\\n>> '#{local_file}' does not exist locally.\"\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n end\n end\n end", "def show_changed_files(status)\n status.each_line do |line|\n if line =~ /^#\\t/ # only print out the changed files (I think)\n if line =~ /new file:|modified:|deleted:/\n puts \" #{line}\" \n else\n puts \" #{line.chop}\\t\\t(may need to be 'git add'ed)\" \n end\n end\n end\nend", "def modified_files(options); end", "def modified_files(options); end", "def contents_version_arguments\n if version_strategy == Licensed::Sources::ContentVersioning::GIT\n [\".\"]\n else\n Dir[\"*\"]\n end\n end", "def modified_files; end", "def changed_namespace_dirs_for_plan(cluster)\n # these env vars are provided by the github-pull-request concourse resource.\n main_base_sha = ENV.fetch(\"main_base_sha\")\n branch_head_sha = ENV.fetch(\"branch_head_sha\")\n\n (changed_files, _, _) = execute(\"git diff --no-commit-id --name-only -r #{main_base_sha}...#{branch_head_sha}\")\n\n namespace_dirs_from_changed_files(cluster, changed_files)\nend" ]
[ "0.6874815", "0.6756286", "0.6678458", "0.6676507", "0.66698843", "0.6669238", "0.66395247", "0.655419", "0.6525738", "0.65114194", "0.6443683", "0.6425097", "0.63479257", "0.6331621", "0.6288034", "0.62513334", "0.6223704", "0.6194635", "0.6160352", "0.6111632", "0.610395", "0.6094887", "0.60699064", "0.6062569", "0.6060466", "0.59901947", "0.5924817", "0.59080374", "0.5889196", "0.5888382", "0.588692", "0.58348787", "0.582981", "0.58258975", "0.58122367", "0.58047765", "0.58047765", "0.57975745", "0.5790983", "0.57905513", "0.5787948", "0.57788974", "0.57481873", "0.5740608", "0.5733327", "0.5733327", "0.5729746", "0.571794", "0.5708142", "0.57068986", "0.5679078", "0.5669169", "0.565368", "0.56533504", "0.5651408", "0.5643785", "0.56426376", "0.5640092", "0.56255066", "0.56218386", "0.56157714", "0.5587428", "0.5581884", "0.5580553", "0.5578792", "0.5573062", "0.5567061", "0.556057", "0.5555186", "0.5552395", "0.55443823", "0.5533543", "0.55326885", "0.5524087", "0.5505012", "0.5495003", "0.5492596", "0.5488049", "0.5488049", "0.5485285", "0.54726756", "0.54700977", "0.54482394", "0.54467726", "0.5443688", "0.54391754", "0.54310244", "0.54310244", "0.54127455", "0.5383421", "0.5377419", "0.5374167", "0.5373732", "0.53577006", "0.53451866", "0.5341523", "0.53328663", "0.53328663", "0.5326443", "0.5321662", "0.53089803" ]
0.0
-1
Get the latest level checked into git
def git_level # Assumes PWD is a valid git repo return nil unless File.exists? ".git/current_cmvc_level" return File.read(".git/current_cmvc_level").chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tree_sha\n sha = nil\n trees = open('https://api.github.com/repos/twitter/bootstrap/git/trees/master').read\n trees = JSON.parse trees\n trees['tree'].find{|t| t['path'] == 'less'}['sha']\n end", "def last_updated\n repo = Grit::Repo.init_bare_or_open(File.join(path , '.git'))\n repo.commits.first.commited_date\n end", "def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend", "def get_tree_sha\n sha = nil\n trees = get_json(\"#{@git_data_trees}/#{@branch}\")\n trees['tree'].find{|t| t['path'] == 'src'}['sha']\n end", "def git_tree_version\n if File.directory?(\".git\")\n @tree_version ||= `git describe`.strip.sub('-', '.')\n @tree_version << \".0\" unless @tree_version.count('.') == 2\n else\n $: << \"lib\"\n require 'rack'\n @tree_version = Rack.release\n end\n @tree_version\nend", "def get_initial_commit\n\t\t`git rev-list --max-parents=0 HEAD`.chomp\n\tend", "def top_level\n git.git_dir.chomp(GIT_DIR)\n end", "def get_commit_log(last_version)\n range = \"v#{last_version}...\"\n `git log #{range} --no-merges --pretty=format:'%H\\t%s\\t%aN\\t%ad'`.chomp\nend", "def last_commit(js_name)\n sha1 = `git log --pretty=%H -1 #{js_name}` \nend", "def top_level\n git.git_dir.chomp(GIT_DIR)\n end", "def changes_since_last_tag\n `git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep=\"Merge\" --pretty=format:\"%t - %s%n%b%n\"`\nend", "def new_version\n %w(major minor patch).each do |level|\n changes = git_changelog.select(&\"#{level}?\".to_sym)\n return [ last_release.send(\"#{level}!\"), changes ] if changes.size > 0\n end\n raise \"No commit since last release (#{last_release})\"\n end", "def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend", "def recent_branches_strict\n\t\tbranches = `git branch -a`.gsub!(/^\\*?\\s+|\\(no branch\\)\\s*/, \"\").split(/\\n/).map {|i|\n\t\t\ti.split(/ -> /)[0]\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend", "def git\n\tend", "def last_commit\n\tresp = github_api(\"commits\")\n\tresp[0]\nend", "def latest\n if !@resource.value(:revision) && (branch = on_branch?)\n branch\n else\n @resource.value(:revision)\n end\n end", "def get_latest_lib_branch(rel_branch, repo)\n ver_fields=rel_branch.split('.')\n major_minor=ver_fields[0] + '.' + ver_fields[1]\n\n total_branches=`git ls-remote #{repo} | grep #{major_minor}`\n max_sub_minor_int = 0\n max_sub_minor_str = \"00\"\n total_branches.split('\\n').each do |line|\n subminor = line.split(major_minor)[-1].split('.')[-1]\n subminor_int = subminor.to_i\n if (subminor_int >= max_sub_minor_int)\n max_sub_minor_int = subminor_int\n max_sub_minor_str = subminor\n end\n end\n\n (major_minor + '.' + max_sub_minor_str).chomp!\nend", "def last_commit(branch, filename)\n lc = @repo.log(branch, filename, {:n => 1})\n lc.empty? ? nil : lc.first\n end", "def get_last_changed_revision(repo, fname)\n case repository_type\n when 'git'\n %x[git log -n 1 -- \"#{fname}\"].split(\"\\n\").first[7..-1]\n when 'git-svn', 'svn'\n begin\n svn_info = %x[svn info -r head \"#{repo}/#{fname}\"]\n rescue\n puts 'we have an error in the svn info line'\n end\n begin\n svn_info.match('Last Changed Rev: ([0-9]*)').to_a[1]\n rescue\n puts 'We have an error in getting the revision'\n end\n end\nend", "def latest\n revisions.latest\n end", "def get_repo_status\n args = {:clone => CONFIG[\"local\"][\"clone\"]}\n st = `#{Templates.status(args)}`\n current_branch = st.split(\"\\n\")[0][3..-1].split(\"...\")[0]\n modified_files = st.split(\"\\n\")[1..-1].join(\"\\n\")\n [current_branch, modified_files]\n end", "def determine_submodule_sha\n stdout.out_success \"\\nFirst, I'll determine the sha for the HEAD of branch: '#{settings['target_submodule_target_branch']}' for the submodule to be updated.\"\n stdout.out_success 'With that known, I can determine if a given repo is \"Up to Date\" for that particular submodule.'\n submodule_head_sha = get_sha_for_branch_origin_head\n stdout.out_success(\"\\nDetermined [#{settings['target_submodule_name']}]'s branch [#{settings['target_submodule_target_branch']}]'s HEAD sha to be: #{submodule_head_sha}\")\n submodule_head_sha\n end", "def last_commits\n sh(\"git log --topo-order --pretty=format:'%H' | head\").split(\"\\n\")\n end", "def branch \n extra[\"branch\"] \n end", "def latest_commit current_project = last_changed_craft, saves = save_history, new_and_changed = new_and_changed \n crft = \"Ships/#{current_project.craft_type.upcase}/#{current_project.name}.craft\" if current_project\n \n return :current_project if saves[:quicksave].nil? || saves[:quicksave].size.eql?(1)\n if new_and_changed[:changed].include?(crft) || new_and_changed[:new].include?(crft)\n return :current_project\n else \n qs_commit = saves[:quicksave].first if saves[:quicksave] \n if qs_commit && current_project\n craft_commit = current_project.history(:limit => 1).first\n t= [[:quicksave, qs_commit], [:current_project, craft_commit]].sort_by{|_, c| c.try(:date) || Time.now}.last\n return t[0]\n else\n return :current_project\n end\n end\n end", "def extract_git_revision\n path = File.expand_path('../..', File.dirname(__FILE__))\n `git --git-dir #{path}/.git rev-parse --short HEAD`.strip\n end", "def current_branch\n repo.branches.find(&:head?)\n end", "def fetch\n git :fetch\n end", "def get_latest_revision\n @current_revision\n end", "def latest_commit()\n commits = @wiki.log({:max_count => 1})\n return nil if commits.nil?\n return nil if commits.empty?\n return commits.first\n end", "def last_commit(branch_name)\n @rugged_repository.branches[branch_name].target\n end", "def git_dir; end", "def get_last_sha repo, issue\n response = @@connection.get do | request |\n request.url \"repos/#{repo}/pulls/#{issue}\"\n request.headers['Authorization'] = \"token #{@@token}\"\n end\n\n return nil if response.env[:status] != 200\n\n body = MultiJson.load(response.env[:body])\n return body['head']['sha']\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def last_build_git_data\n describe = @repo.recent_tag_name()\n m = describe.match(/(\\D*)(\\d+)/)\n build = 0\n if (m && m.length == 3)\n build = m[2].to_i\n tag_name = m[1]\n if (build > 0)\n puts \"most recent tag found is for build #{build}\"\n else\n build = 0\n end\n end\n { :build_number => build, :tag_name => tag_name, :describe => describe}\n end", "def recent_commit_shas count\n array_output_of(\"git rev-list HEAD -n #{count}\").reverse\nend", "def get_commit_stats(sha)\n `git show --shortstat --oneline #{sha}`.split(\"\\n\").last\nend", "def get_last_changed_rev( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['Last Changed Rev']\nend", "def recent_builds_branch(branch, params = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).get\n end", "def newest_svn_commit_on_branch(repo_path, branch)\n `(cd \"#{repo_path}\" && git rev-list -n1 #{branch} --grep=git-svn-id:)`.strip\n end", "def recent_builds_branch(branch, params)\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).get\n end", "def last_revision\n get_revision('REVISION')\n end", "def change_log_since_last_tag\n return changelog_from_git_commits(pretty: '%h %s')\n end", "def find_next\n status = `git status -s`.lines.reject(&:nil?).grep(/.. (PCL|tsion|steveklabnik)\\//)\n return nil if status.empty?\n\n first = status.map{|x| x.gsub(/^.. /, '') }.first.strip\n \n if File.directory?(first) \n return [first, [first]]\n else\n name = first.split('/')[-1].split('_', 2)[1]\n end\n\n pcl = find_file('PCL', name)\n tsion = find_file('tsion', name)\n steve = find_file('steveklabnik', name)\n\n [name, [pcl, tsion, steve]]\n end", "def commit\n @commit ||= $repo.log.object(@rev || 'master').path(@name).first\n end", "def last_commit\n self.lookup self.head.target\n end", "def git_log(directory)\n `git log --since=\"28 days ago\" --stat --oneline -- --relative= ../#{directory}`\nend", "def head\n git.get_head(branch)\n end", "def head\n git.get_head(branch)\n end", "def fetch_revision\n end", "def git_name(directory)\n `cd #{directory} && git log -n 1 | head -1`.split.last\nend", "def pull_latest_changes\n system \"cd #{Dots.home} && #{git_pull}\"\n end", "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "def get_current_rev\n\t\t\tid = read_command_output( 'hg', '-q', 'identify' )\n\t\t\treturn id.chomp\n\t\tend", "def pre_change_sha(node)\n branch = node['delivery']['change']['pipeline']\n\n if node['delivery']['change']['stage'] == 'verify'\n shell_out(\n \"git rev-parse origin/#{branch}\",\n :cwd => node['delivery']['workspace']['repo']\n ).stdout.strip\n else\n # This command looks in the git history for the last two merges to our\n # pipeline branch. The most recent will be our SHA so the second to last\n # will be the SHA we are looking for.\n command = \"git log origin/#{branch} --merges --pretty=\\\"%H\\\" -n2 | tail -n1\"\n shell_out(command, :cwd => node['delivery']['workspace']['repo']).stdout.strip\n end\n end", "def last_commited_commit\n get_all_commits_in_repo.first\n end", "def pre_change_sha(node)\n branch = node['delivery']['change']['pipeline']\n\n if node['delivery']['change']['stage'] == 'verify'\n shell_out(\n \"git rev-parse origin/#{branch}\",\n cwd: repo_path(node)\n ).stdout.strip\n else\n # This command looks in the git history for the last two merges to our\n # pipeline branch. The most recent will be our SHA so the second to last\n # will be the SHA we are looking for.\n command = \"git log origin/#{branch} --merges --pretty=\\\"%H\\\" -n2 | tail -n1\"\n shell_out(command, cwd: repo_path(node)).stdout.strip\n end\n end", "def get_tree_sha(dir)\n get_trees['tree'].find { |t| t['path'] == dir }['sha']\n end", "def fetch_commit_hash_list()\n `git rev-list --all --reverse`.strip.split(/\\n/)\nend", "def git_HEAD\n Dir.chdir(@dir) do\n commit = `git rev-parse HEAD`\n raise \"git rev-parse HEAD failed: #{$?.exitstatus}\" if $?.exitstatus != 0\n commit.chomp\n end\n end", "def git\n @git ||= MiniGit.new('.')\n end", "def current\n R10K::Git::Head.new('HEAD', self)\n end", "def current_branch\n repo.branches.find(&:head?)\n end", "def status(full=false)\n a = commit_tree.flatten\n b = tree.flatten\n \n diff = {}\n (a.keys | b.keys).collect do |key|\n a_entry = a.has_key?(key) ? a[key] : nil\n b_entry = b.has_key?(key) ? b[key] : nil\n \n change = case\n when a_entry && b_entry\n next unless a_entry != b_entry\n :mod\n when a_entry\n :rm\n when b_entry\n :add\n end\n \n diff[key] = full ? [change, a_entry || [], b_entry || []] : change\n end\n diff\n end", "def make_commit_log\n\t\t\tdiff = read_command_output( 'hg', 'diff' )\n\t\t\tfail \"No differences.\" if diff.empty?\n\n\t\t\treturn diff\n\t\tend", "def versions\n self.git.commits\n end", "def history\n self.repo.commits('master', false)\n end", "def git_version(paths)\n return if paths.nil?\n\n paths.map { |path| Licensed::Git.version(path) }\n .reject { |sha| sha.to_s.empty? }\n .max_by { |sha| Licensed::Git.commit_date(sha) }\n end", "def badge_level(name)\n these_badges = self.badges.find_all { |b| b.name == name }\n if these_badges.any?\n these_badges.sort_by { |b| b.level }.last.level\n else\n 0\n end\n end", "def current_revision\n @svninfo.current_revision\n end", "def latest_tag\n\t\t# Index 0 is HEAD\n\t\t# Index 1 is most recent tag or first commit\n\t\t@list[1]\n\tend", "def current_branch; end", "def current_branch; end", "def latest_in_unit\n package_branch.latest\n end", "def get_tools_version_info\n timestamp, sha1 = `git log -1 --pretty='%at,%h'`.strip.split(',')\n\n [ Time.at(timestamp.to_i), sha1 ]\nend", "def getGitRepo config\n\tworkingDir = config[\"workingDir\"]\n\tbranch = config[\"git\"][\"branch\"]\n\trepository = config[\"git\"][\"repository\"]\n\t\n\t# when working directory does not exist, create it and clone the repository\n\t# otherwise just pull changes\n\tif not Dir.exists? workingDir then\n\t\tDir.mkdir workingDir\n\t\tg = Git.clone(repository, branch, :path => workingDir)\n\t\tlatestCommit = g.log.last\n\telse\n\t\tg = Git.open(workingDir + \"/\" + branch)\n\t\tg.pull\n\t\tlatestCommit = g.log.last\n\tend\n\t\n\treturn latestCommit\nend", "def generate_git_commit_log(rev=ENV['GIT_PREVIOUS_SUCCESSFUL_COMMIT'] || 'HEAD^^^^^')\n g = Git.open(ENV['PWD'], :log => Logger.new(STDOUT))\n begin\n change_log = g.log.between(rev).map { |c| \"- \" + c.message.lines.first.chomp }.join \"\\n\"\n \"Commit Log:\\n\\n#{change_log}\\n\"\n rescue\n \"Unable to parse commit logs\"\n end\nend", "def git_revision\n puts \"Fetching the git revision\"\n\n _stdin, stdout, stderr, wait_thread = Open3.popen3(\"git rev-parse HEAD\")\n\n success = wait_thread.value.success?\n\n status = success ? Rack::ECG::Check::Status::OK : Rack::ECG::Check::Status::ERROR\n\n value = success ? stdout.read : stderr.read\n value = value.strip\n\n { name: :git_revision, status: status, value: value }\nend", "def get_branch \n branch = case @os_svninfo['URL']\n when /trunk/ then \"trunk\"\n when /branches\\/private\\/([^\\/]+)/ then $1\n when /branches\\/([^\\/]+)/ then $1\n when /patches\\/([^\\/]+)/ then $1\n when /tags\\/([^\\/]+)/ then $1\n else fail(\"Can't determine which branch I'm operating on\")\n end\n branch\n end", "def git_object(hash)\n return `git cat-file -p #{hash}`\nend", "def getPastGitTag(back = 1)\n remote = getMainGitRemote\n tags = sh(\"git ls-remote --tags --quiet #{remote} | cut -d '/' -f3\", log: false).split\n semver_tags = tags.grep(/^[0-9]+.[0-9]+.[0-9]+$/) # only keep semver tags\n sorted_semver_tags = semver_tags.sort_by { |tag| Gem::Version.new(tag) }.reverse # sort by semver\n return sorted_semver_tags[back - 1]\nend", "def history\n return nil unless tracked?\n @history ||= $repo.log.path(@name)\n end", "def branch; @extra[\"branch\"]; end", "def tree_root\n repo.tree\n end", "def git_ref\n `git rev-parse --short HEAD`.strip\nend", "def branches_containing_commit(commit_ref); end", "def branches_containing_commit(commit_ref); end", "def get_all_commits_in_repo\n @branches.collect(&:commits).flatten.sort_by { |k| k.authored_date }.reverse\n end", "def last_commit() \n\t return @last_commit if @last_commit.is_a?(Commit)\n\t\t@last_commit = Commit.first(:repo_id => self[:_id])\n\tend", "def get_git_si_revision\n info = get_command_output(Git::Si::GitControl.log_command('--pretty=%B'))\n return Git::Si::GitControl.parse_last_svn_revision(info)\n end", "def get_base_tree_for_branch(oauth_token, head_sha)\n client = Octokit::Client.new(access_token: oauth_token)\n client.commit(full_repo_name, head_sha)[:commit][:tree][:sha]\n end", "def get_git_info(root_dir)\n Dir.chdir(root_dir) do\n info = {\n :head => {\n :id => `\"#{@options[:git]}\" show --format='%H' --no-patch`.rstrip,\n :author_name => `\"#{@options[:git]}\" show --format='%an' --no-patch`.rstrip,\n :author_email => `\"#{@options[:git]}\" show --format='%ae' --no-patch`.rstrip,\n :commiter_name => `\"#{@options[:git]}\" show --format='%cn' --no-patch`.rstrip,\n :commiter_email => `\"#{@options[:git]}\" show --format='%ce' --no-patch`.rstrip,\n :message => `\"#{@options[:git]}\" show --format='%B' --no-patch`.rstrip,\n },\n :branch => `\"#{@options[:git]}\" rev-parse --abbrev-ref HEAD`.rstrip,\n :remotes => []\n }\n\n `\"#{@options[:git]}\" remote --verbose`.each_line do |line|\n line.match(/^(?<name>\\S+)\\s+(?<url>\\S+)(\\s+\\((fetch|push)\\))?/) do |match|\n info[:remotes] << Hash[match.names.zip(match.captures)]\n end\n end\n info[:remotes].uniq!\n info.delete(:remotes) if info[:remotes].empty?\n\n info\n end if Dir.exist?(root_dir)\n end", "def checkCurrent()\n files = getFilesFromDiff(`hg log -r . --patch`)\n changeset = `hg id`[0..11]\n checkFiles(files, changeset)\n end", "def branches; end", "def get_branch_name\r\n\tputs IO.popen('git branch --no-abbrev').read.slice(2..-1)\r\nend", "def latest_commit\n init_commits\n @latest_commit\n end", "def current_level\n @cur_level\n end", "def branch\n case @vcs\n when 'github'\n if @data.key? 'ref'\n @data['ref'].sub('refs/heads/', '')\n else\n @data['repository']['default_branch']\n end\n when 'gitlab'\n @data['ref'].sub('refs/heads/', '')\n when 'bitbucket-server'\n @data['changes'][0]['refId'].sub('refs/heads/', '')\n when 'bitbucket'\n return @data['push']['changes'][0]['new']['name'] unless deleted?\n\n @data['push']['changes'][0]['old']['name']\n when 'stash'\n @data['refChanges'][0]['refId'].sub('refs/heads/', '')\n when 'tfs'\n @data['resource']['refUpdates'][0]['name'].sub('refs/heads/', '')\n end\n end", "def repository_root\n return unless available?\n root = Licensed::Shell.execute(\"git\", \"rev-parse\", \"--show-toplevel\", allow_failure: true)\n return nil if root.empty?\n root\n end" ]
[ "0.6758579", "0.6517996", "0.6277419", "0.6273922", "0.62135893", "0.61986846", "0.61426157", "0.61346644", "0.6130961", "0.61237556", "0.61158574", "0.610153", "0.60702115", "0.6048304", "0.6031471", "0.60132146", "0.6009787", "0.6004033", "0.5981083", "0.59733486", "0.5949544", "0.5949239", "0.5900339", "0.5880313", "0.5877495", "0.5873608", "0.5858186", "0.58574307", "0.5836482", "0.5817616", "0.5815187", "0.58137727", "0.5811829", "0.57956004", "0.57879376", "0.57821304", "0.5777933", "0.57773036", "0.5776593", "0.57588464", "0.5758414", "0.5739097", "0.5738028", "0.57325", "0.5719495", "0.57145745", "0.57051873", "0.5703411", "0.57009894", "0.57009894", "0.5699322", "0.56990427", "0.56899124", "0.56859314", "0.56854683", "0.5680973", "0.56728345", "0.5670859", "0.56667984", "0.56617373", "0.56578255", "0.56541616", "0.5651834", "0.5645783", "0.5640334", "0.56382823", "0.56256217", "0.56245154", "0.5623737", "0.5620265", "0.56074375", "0.560704", "0.5606642", "0.5606642", "0.5606473", "0.5603096", "0.5595463", "0.55940235", "0.5591926", "0.5581511", "0.55788004", "0.5578023", "0.55680627", "0.55663055", "0.5565637", "0.5564217", "0.5563626", "0.5561745", "0.55512524", "0.5548422", "0.554234", "0.5541055", "0.5539826", "0.55381393", "0.55335516", "0.55286276", "0.5510791", "0.55102444", "0.5502458", "0.55020696" ]
0.7167405
0
Tag the current branch/repo with the specified tag
def git_tag tag system "git tag #{tag}" raise "tag failed" unless $? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag_name)\n git.tag(git_opts, tag_name)\n push(\"origin\", tag_name)\n self\n end", "def tag(tag_name)\n Git::Object.new(self, tag_name, 'tag', true)\n end", "def tag(tag, tag_msg=\"\", commit=nil)\n @tags << tag\n if commit\n gash.send(:git, 'tag', '-f', '-a', '-m', tag_msg, tag, commit)\n else\n gash.send(:git, 'tag', '-f', '-a', '-m', tag_msg, tag)\n end\n end", "def create_git_tag\n assignment_repository.write do |git|\n git.add_tag git_tag\n end\n end", "def tag_release(version)\n system \"git tag v#{version}\"\n system \"git push origin v#{version}\"\n end", "def add_tag(tag)\n @api.post(\"#{@api.path}/List/#{@id}/Tag\", body: tag)\n end", "def create_local_tag tag_name\n run \"git tag -a #{tag_name} -m '#{tag_name}'\"\nend", "def create_tag(project, tag_name, ref)\n post(\"/projects/#{project}/repository/tags\", body: {tag_name: tag_name, ref: ref})\n end", "def git_tag(versionString) \n\t\t\t\tshell_command(\"git tag #{versionString}\")\n\t\t\t\tshell_command(\"git push origin --tags\")\n\t\t\tend", "def tag_release(tag)\n unless this_version == extract_version\n info \"Committing buildfile with version number #{extract_version}\"\n Git.commit File.basename(version_file), message\n Git.push if Git.remote\n end\n info \"Tagging release #{tag}\"\n Git.git 'tag', '-d', tag rescue nil\n Git.git 'push', Git.remote, \":refs/tags/#{tag}\" rescue nil if Git.remote\n Git.git 'tag', '-a', tag, '-m', \"[buildr] Cutting release #{tag}\"\n Git.git 'push', Git.remote, 'tag', tag if Git.remote\n end", "def tag(arg='')\n `git tag #{arg} 2>&1`\n end", "def add_tag (tag)\n `rs_tag --add \"#{tag}\"`\n end", "def tag_commit(tag_name)\n link = url_helpers.project_tag_path(project, id: tag_name)\n body = \"tagged commit #{noteable.sha} to [`#{tag_name}`](#{link})\"\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'tag'))\n end", "def create_tag(dir, branch, tag, message)\n\tDir.chdir(dir) do |path|\n\t\tcmds = [\"git checkout #{branch}\", \n\t\t\t\t\"git pull\",\n\t\t\t\t\"git tag -a #{tag} -m '#{message}'\"\n\t\t\t\t]\n\t\tcmds.delete_at(1) unless remote_branch_exists?(path, branch)\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\nend", "def tag_release(tag)\n unless this_version == extract_version\n puts \"Committing buildfile with version number #{extract_version}\"\n Git.commit File.basename(Rake.application.rakefile.to_s), message\n Git.push if Git.remote\n end\n puts \"Tagging release #{tag}\"\n # Git.git 'tag', '-d', tag rescue nil\n Git.git 'push', Git.remote, \":refs/tags/#{tag}\" rescue nil if Git.remote\n Git.git 'tag', '-f', '-a', tag, '-m', \"[rake_release] Cutting release #{tag}\"\n Git.git 'push', Git.remote, 'tag', tag if Git.remote\n end", "def update_repo_tag\n unless tag_name.nil? || tag_name.empty?\n callback(:update_repo_tag) do\n notify(:update_repo_tag)\n system_call \"git tag #{tag_name} #{match_tag_name} -f\"\n system_call \"git push -f origin #{tag_name}\"\n end\n end\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 tag_object(tag, sha)\n git.fs_write(\"refs/tags/#{clean_tag(tag)}\", sha)\n end", "def gitPushTag(pushTag)\n puts \"Pushing tag\"\n @gop.push(@remote, \"refs/tags/#{pushTag}\")\n end", "def tag_release(tag)\n unless this_version == extract_version\n info \"Committing buildfile with version number #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end\n info \"Tagging release #{tag}\"\n Hg.hg 'tag', tag, '-m', \"[buildr] Cutting release #{tag}\"\n Hg.push if Hg.remote\n end", "def tag=(value)\n @tag = value\n self.status = TAG_STATUS.fetch(value)\n @tag\n end", "def tag_with_name(tag_name, message=\"automated tagging\")\r\n tag_url = build_tag_url_for_base(tag_name)\r\n tag(@repository_trunk, tag_url, message)\r\n end", "def setTag(tag)\n @fields['tag'] = tag\n self\n end", "def setTag(tag)\n @fields['tag'] = tag\n self\n end", "def setTag(tag)\n @fields['tag'] = tag\n self\n end", "def setTag(tag)\n @fields['tag'] = tag\n self\n end", "def setTag(tag)\n @fields['tag'] = tag\n self\n end", "def setTag(tag)\n @fields['tag'] = tag\n self\n end", "def setTag(tag)\n @fields['tag'] = tag\n self\n end", "def tag(tag)\n log.tag(self, tag)\n end", "def checkout_tag(version)\n ui.info \"Checking out tag #{version}\"\n cookbook_path = get_cookbook_path(@cookbook_name)\n Dir.chdir(cookbook_path);\n\t\t `git checkout -b #{version}`\n\t\t if !$?.exitstatus == 0\n\t\t ui.error(\"Failed to checkout branch #{version} of #{@cookbook_name}\")\n\t\t exit 1\n end\n end", "def add_tag(tag)\r\n self.tags.new(:name => tag.name)\r\n end", "def checkout tag\n if @refresh\n sh 'git reset --hard'\n else\n sh 'git stash'\n end\n sh \"git checkout #{tag}\"\n end", "def tag_release(tag)\n unless this_version == extract_version\n puts \"Committing buildfile with version number #{extract_version}\"\n Perforce.p4 'edit', Rake.application.rakefile.to_s\n Perforce.commit message\n end\n puts \"Tagging release #{tag}\"\n Perforce.p4 'tag', '-l', tag, \"//#{ENV['P4CLIENT']}/...\"\n end", "def tag(tag)\n @tagname = tag\n end", "def do_tag(registry)\n docker_connection = docker_api.connection\n image = Docker::Image.get(\"#{image_name}:#{version}\", {}, docker_connection)\n puts \"Tagging image: #{image_name}\"\n image.tag('repo' => \"#{registry}/#{image_name()}\", 'image' => 'unicorn', 'tag' => version(), force: true)\n end", "def add_tag!(tag)\r\n tag = add_tag(tag)\r\n tag.save\r\n end", "def tag tag = nil\n @tag = tag if tag\n @tag\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 create_tag(project_name, repository_name, reference, tag, opts = {})\n create_tag_with_http_info(project_name, repository_name, reference, tag, opts)\n nil\n end", "def tag(arg)\n @tag = arg.to_s\n self\n end", "def tag(tag); end", "def tag(tag); end", "def tag= tag\n @tag = tag\n update!\n end", "def git_make_tag()\n result = false\n Dir.chdir(PATH_ROOT) do\n cmd_git_tag = \"git tag -a #{@pkgtag} -m \\\"make tag for release version #{@pkgtag}.\\\"\"\n result = call_system_command(cmd_git_tag)\n puts \"make tag failed, and return #{result}.\" unless result\n end\n return result\n end", "def tag_add(id, tag)\n wf_event_id?(id)\n wf_string?(tag)\n api.put([id, 'tag', tag].uri_concat)\n end", "def branch(tag=@current_branch)\n get_head(tag)\n end", "def set_tag\n @tag = ActsAsTaggableOn::Tag.find(params[:id])\n end", "def set_tag\n @tag = ActsAsTaggableOn::Tag.find(params[:id])\n end", "def export_tag(tag)\n tag[\"repository\"] = repository\n tag[\"user\"] = bitbucket_server.user # attribute all tags to export user\n tag[\"commit\"] = repository_model.commit(tag[\"latestCommit\"])\n serialize(\"release\", tag)\n end", "def add_tag(tag)\n context.add_tag_to_device(tag: tag, device: self)\n self\n end", "def do_update_tag\n @repository = @repository.clone\n log = run_svn(\"log\", \"-r\", 'HEAD')\n log.split(/\\n/).each do |line|\n if line =~ /^r(\\d+)/\n @repository.tag = $1\n break\n end\n end\n end", "def merge_branch( tag=@current_branch, actor=nil )\n raise \"Invalid branch '#{tag}'\" if not is_head?(tag)\n\n tag.gsub!(/['\\\\]/, '')\n\n # switch to master branch\n set_branch(DEFAULT_BRANCH, actor)\n\n # merge target branch to master branch\n\n rv = nil\n begin\n rv = exec_git_cmd(\"git merge -n --no-ff --no-log --no-squash '#{tag}'\", \n actor)\n rescue CommandError => e\n $stderr.puts e.message\n end\n rv\n end", "def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end", "def tag=(tag)\n @tag = tag\n @tls_id ||= \"tag_logger_#{self.object_id}\"\n Thread.current[@tls_id] = @tag\n end", "def commit_and_tag(new_version)\n git = Git.init\n git.add([VERSION_FILE, \"Gemfile.lock\"])\n git.commit(\"Update to #{new_version}\")\n git.add_tag(new_version.to_s)\n end", "def tag(new_tag); end", "def add_tag(tag)\n @added_tags ||= Set.new\n @added_tags << tag\n end", "def push\n if @tags.empty?\n gash.send(:git, 'push', @push_to, @refspec)\n else\n gash.send(:git, 'push', '--tags', @push_to, @refspec)\n end\n end", "def set_branch( tag, actor=nil )\n # allow creating of new branches via -b if they do not exist\n opt = (is_head? tag) ? '' : '-b'\n\n # Save staging index for current branch\n @saved_stages[@current_branch] = self.staging if staging?\n\n exec_git_cmd( \"git checkout -q -m #{opt} '#{tag}'\", actor )\n\n # Synchronize staging index (required before merge)\n unstage\n\n # Update current_branch info and restore staging for branch\n self.staging = @saved_stages[tag]\n self.staging.sync if staging?\n @current_branch = tag\n end", "def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end", "def tag!(params = {})\n self.post params, edge: :tags\n end", "def set_tag\n @tag = Tag.where(id: params[:tag]).first\n end", "def register tag, name\n @tags[name] = tag\n end", "def register tag, name\n @tags[name] = tag\n end", "def create(tag)\n validate_type!(tag)\n\n attributes = sanitize(tag)\n _, _, root = @client.post(\"/tags\", attributes)\n\n Tag.new(root[:data])\n end", "def tag_link(tag)\n dir = @context.registers[:site].config['tag_dir'] || 'tag'\n \"<a class='tag' href='/#{dir}/#{tag.to_url}/'>#{tag}</a>\"\n end", "def add_tag(tag)\n if @current_node == nil\n add_root(tag)\n else\n add_child(tag)\n end\n end", "def add_tag(tag)\n t = Tagging.new()\n t.translation = self\n t.tag = tag\n begin\n self.taggings << t\n rescue # Already tagged\n false\n end\n end", "def tag_version_task\n sh git, 'tag', '-a', \"#{gemspec.name}-#{gemspec.version}\", '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end", "def tag(tags)\n context = Thread.current[:lumberjack_context]\n context&.tag(tags)\n end", "def add_tag(tag: required(\"tag\"), options: {}, **data)\n with_params = data.merge(tag: tag).reject { |_,v| v.nil? || Array(v).empty? }\n client.post(\"/tasks/#{gid}/addTag\", body: with_params, options: options) && true\n end", "def tag(tag, group: nil)\n tag_params = { tag: tag }\n tag_params[:group] = group unless group.nil?\n tag_params\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def set_tag\n @tag = Tag.find(params[:id])\n end", "def github_release_task\n sh git, 'push', '--tags', remote, remote_branch\n end", "def new_tag(tag)\n puts cyan(\"Found new tag: #{tag}\")\n end", "def tag(tag_name, *args)\n tag_names = tag_name.split(args.first)\n\n tag_names.each do |tag_name|\n if !(self.tag_ids.include?(tag_name))\n tags << Tag.find_or_create_by(name: tag_name)\n end\n end\n self\n end", "def autotag(prefix=nil)\n history_file.tags.each do |tag|\n label = \"#{prefix}#{tag.name}\"\n if not adapter.tag?(label)\n chg = adapter.change_by_date(tag.date)\n if chg\n if force? or ask_yn(new_tag_message(label, tag) + \"\\nCreate tag? [yN] \")\n adapter.tag(chg.rev, label, tag.date, tag.message)\n end\n else\n puts \"No commit found for #{label} #{tag.date.strftime('%Y-%m-%d')}.\"\n end\n end\n end\n end", "def tag\n end", "def tag\n end" ]
[ "0.7821585", "0.71126884", "0.7064397", "0.7059149", "0.7038629", "0.70311797", "0.6967032", "0.6959666", "0.69446784", "0.69357944", "0.69072413", "0.6873006", "0.6828252", "0.682746", "0.6824444", "0.67905116", "0.67848337", "0.6722644", "0.6679031", "0.6675912", "0.6558776", "0.65153825", "0.6507059", "0.6507059", "0.6507059", "0.6507059", "0.6507059", "0.6507059", "0.6507059", "0.65005314", "0.6499978", "0.6443404", "0.64419055", "0.64356875", "0.64255583", "0.63968605", "0.63687074", "0.63649666", "0.63441896", "0.6344171", "0.6328844", "0.6306256", "0.6306256", "0.630277", "0.62724036", "0.62503713", "0.6244247", "0.6215789", "0.6215789", "0.62107795", "0.61912155", "0.6178033", "0.6103414", "0.6096847", "0.6092467", "0.6077469", "0.60654336", "0.60569906", "0.6050056", "0.6044235", "0.60195935", "0.6015745", "0.60027826", "0.5990435", "0.5990435", "0.59902716", "0.5979465", "0.5967712", "0.5967049", "0.5950113", "0.59437764", "0.5932629", "0.5930057", "0.59238607", "0.59238607", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5913488", "0.5912661", "0.59083635", "0.58848554", "0.5867757", "0.5858021", "0.5817105", "0.5817105" ]
0.67444515
17
commit all additions, deletions, etc.
def git_commit_all message system "git add --all ." return false unless $? system "git commit -q -m '#{message.gsub(/'/, "\'")}'" return $? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit!\n _commit( false )\n end", "def commit\n # no op\n end", "def commit\n sanity_check\n @handle.commit\n end", "def commit()\n #This is a stub, used for indexing\n end", "def commit\n db_interface.commit\n end", "def commit; end", "def commit; end", "def commit; end", "def commit\n query 'commit'\n self\n end", "def commit\n @db.commit\n end", "def commit\n head.commit\n end", "def commit\n submissions.each(&:commit)\n end", "def commiter() end", "def commit\n {}\n end", "def commit\n {}\n end", "def commit\n update\n end", "def commit\n @MySQLConnection.query('commit')\n end", "def commit!\n rsp = post(\"<commit/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def commit!() raise NotImplementedError end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit\n if defined? _commit\n if dirty?\n _commit\n end\n end\n nil\n end", "def commit\n IBM_DB.commit(@conn)\n end", "def commit\n @repo.commit\n end", "def commit\n writer.commit\n end", "def commit()\n check_return_code(PureHailDB.ib_trx_commit(@trx_ptr))\n end", "def commit\n # Nothing to do for an in memory database\n end", "def commit\r\n self.class.commit_orders [self]\r\n end", "def commit_if_dirty\n # no op\n end", "def commit\n @handle.commit\n super\n end", "def commit\n freeze_time\n release_expired\n store_staged_data\n clean\n\n was_dirty?\n end", "def commit\n solr_service_connection.commit\n end", "def committed!\n @on_commit.each do |callback|\n callback.call\n end\n clear\n end", "def commit \n results = submit_cmd('commit plant',:db, \"-env #{self.env}\")\n puts results\n end", "def commit\n if !@rollback\n @indexes.each_value do |index| \n $LUCENE_LOGGER.debug{\"BEGIN: Commit index #{index} txt #{to_s}\"} \n index.commit\n $LUCENE_LOGGER.debug{\"END: Commited index #{index} txt #{to_s}\"}\n end \n end\n @commited = true\n $LUCENE_LOGGER.error(\"Index was not removed from commited transaction: #{@indexes.inspect}\") if !@indexes.empty? && !@rollback \n @indexes.clear\n Thread.current[:lucene_transaction] = nil\n end", "def commit\n # TODO not enough to block threads here, since the @uncommited and @deleted_ids may change\n # Need to synchronize \n lock.synchronize do\n $LUCENE_LOGGER.debug \" BEGIN: COMMIT\"\n delete_documents # deletes all docuements given @deleted_ids\n \n # are any updated document deleted ?\n deleted_ids = @uncommited.keys & @deleted_ids\n # delete them those\n deleted_ids.each {|id| @uncommited.delete(id)}\n \n # update the remaining documents that has not been deleted\n update_documents # update @documents\n \n @uncommited.clear # TODO: should we do this in an ensure block ?\n @deleted_ids.clear\n \n # if we are running in a transaction remove this so it will not be commited twice\n Transaction.current.deregister_index(self) if Transaction.running?\n $LUCENE_LOGGER.debug \" END: COMMIT\" \n end\n rescue => ex\n $LUCENE_LOGGER.error(ex)\n # ex.backtrace.each{|x| $LUCENE_LOGGER.error(x)}\n raise ex\n end", "def commit( defer=false )\n save_logic( defer, false )\n end", "def commit\n validate_params\n\n client = AdminModule::Client.new\n client.env = env\n\n if self.respond_to? action\n self.send(action, client)\n return\n else\n raise \"Unknown action - #{action}\"\n end\n\n rescue Exception => e\n raise e if stop_on_exception == true\n ensure\n client.quit\n end", "def commit\n validate_params\n\n client = AdminModule::Client.new\n client.env = env\n\n if self.respond_to? action\n self.send(action, client)\n return\n else\n raise \"Unknown action - #{action}\"\n end\n\n rescue Exception => e\n raise e if stop_on_exception == true\n ensure\n client.quit\n end", "def commit_if_delete_dirty\n # no op\n end", "def commit=(_arg0); end", "def commit=(_arg0); end", "def commit(soft_commit = false)\n session.commit soft_commit\n end", "def close\n commit\n end", "def commit mutations, transaction: nil\n mode = transaction.nil? ? :NON_TRANSACTIONAL : :TRANSACTIONAL\n service.commit project_id: project, database_id: database, mode: mode,\n mutations: mutations, transaction: transaction\n end", "def commit_db_transaction\n log('commit transaction', nil) { @connection.commit }\n end", "def commit()\n @conn.commit if @conn\n Log.i(\"#{@count} new bookings added\")\n end", "def commit( recurse = true )\n return true\n end", "def commit_all(_message)\n puts 'TODO: Implement Git.commit_all'\n end", "def commit_db_transaction\n log('COMMIT', 'TRANSACTION') { @connection.commit }\n end", "def commit_transaction(session)\n session.commit_transaction\n Threaded.clear_modified_documents(session).each do |doc|\n doc.run_after_callbacks(:commit)\n end\n end", "def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end", "def commit_transaction(tx)\n tx.execute\n end", "def commit_db_transaction() end", "def commit_db_transaction() end", "def commit\n cfm.commit_change_on(self) if do_commit?\n end", "def commit!\n save! unless persisted?\n end", "def commit_db_transaction\n @transaction = @connection.commit\n end", "def commit\n # TODO\n # Update ./docProps\n # app.xml slides, notes, counts, etc\n # core.xml Times\n entries.each do |path, buffer|\n path = path.to_s\n if @original_files.include? path\n @zip.replace_buffer path, buffer\n else\n @zip.add_buffer path, buffer\n end\n end\n @zip.commit\n end", "def after_commit(*); end", "def commit_all(index, last_commit, last_tree)\n callback = self.git_settings.commit_message\n # $stderr.puts self.git_settings.inspect\n message = case callback\n when Symbol\n self.send(callback)\n when Proc\n callback.call(self)\n else\n \"new version of #{self.class}, id: #{self.id.to_s}\" \n end\n lc = (last_commit ? [last_commit.id] : nil)\n index.commit(message, lc, @model_user)\n end", "def execute!\n logger.info(\"Finalizing commit #{commit_log.commit_id}\")\n\n status = repo_config.tms.status(commit_log.commit_id)\n\n repo_config.locales.each do |locale|\n locale_code = locale.code\n\n rosette_config.datastore.add_or_update_commit_log_locale(\n commit_log.commit_id, locale_code, status.locale_count(locale_code)\n )\n end\n\n if status.fully_translated?\n repo_config.tms.finalize(commit_log.commit_id)\n commit_log.finalize\n save_commit_log\n end\n\n logger.info(\"Finished finalizing commit #{commit_log.commit_id}\")\n end", "def commit_db_transaction() \n log(\"Committing boxcar with #{@command_boxcar.length} commands\", 'commit_db_transaction()')\n \n previous_command = nil\n commands = []\n \n @command_boxcar.each do |command|\n if commands.length >= MAX_BOXCAR_SIZE or (previous_command and (command.verb != previous_command.verb))\n send_commands(commands)\n \n commands = []\n previous_command = nil\n else\n commands << command\n\t previous_command = command\n end\n end\n \n # Finish off the partial boxcar\n send_commands(commands) unless commands.empty?\n \n end", "def commit( *files, **options )\n\t\tself.server.run( :commit, *files, **options )\n\t\treturn true\n\tend", "def commit_all(message, opts = {})\n opts = {:add_all => true}.merge(opts)\n self.lib.commit(message, opts)\n end", "def perform_commit\n raise NotImplementedError\n end", "def after_commit(unit); end", "def commit!(rollback: true, rollback_interval: 60)\n @@api.post(endpoint: self.endpoint + ['commit'], params: {'rollback' => rollback, 'rollback_interval' => rollback_interval})\n end", "def commit\n self.index.commit(@commit_msg, @commit_author)\n end", "def commit_required?; end", "def commit_inner_units\n @inner_units.each do |inner_unit|\n if inner_unit.started?\n inner_unit.perform_inner_commit\n end\n end\n end", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def perform_inner_commit\n @provider.push self\n\n begin\n perform_commit\n rescue => cause\n perform_rollback cause\n end\n\n clear\n stop\n end", "def commit( transaction )\n fail NotImplementedError\n end", "def commit(id = nil)\n get_object :commit, id\n end", "def commit(id = nil)\n get_object :commit, id\n end", "def commit(*args)\n super(*args)\n\n ret = nil\n\n if next_action\n ret = next_action.call(*args)\n self.next_action = nil\n end\n\n ret\n end", "def commit_transaction\n\t real_object = __getobj__\n\t partition_new_old_relations(:parent_objects) do |trsc_objects, rel, new, del, existing|\n\t\tfor other in new\n\t\t other.add_child_object(real_object, rel, trsc_objects[other][self, rel])\n\t\tend\n\t\tfor other in del\n\t\t other.remove_child_object(real_object, rel)\n\t\tend\n for other in existing\n other[real_object, rel] = trsc_objects[other][self, rel]\n end\n\t end\n\n\t partition_new_old_relations(:child_objects) do |trsc_objects, rel, new, del, existing|\n\t\tfor other in new\n\t\t real_object.add_child_object(other, rel, self[trsc_objects[other], rel])\n\t\tend\n\t\tfor other in del\n\t\t real_object.remove_child_object(other, rel)\n\t\tend\n for other in existing\n real_object[other, rel] = self[trsc_objects[other], rel]\n end\n\t end\n\n super\n\n if @executable != __getobj__.instance_variable_get(:@executable)\n __getobj__.executable = @executable\n end\n\n finalization_handlers.each do |handler|\n __getobj__.when_finalized(handler.as_options, &handler.block)\n end\n end", "def initial_commit?; end", "def initial_commit?; end", "def commit_transaction_sql\n SQL_COMMIT\n end", "def commit_transaction_sql\n SQL_COMMIT\n end", "def commit\n system(\"cd #{repo_path};git commit -m 'to the cloud'\")\n end", "def flush\n @group.commit if @group\n end", "def commit_transaction(conn)\n log_info(TRANSACTION_COMMIT)\n conn.commit\n end", "def execute!\n logger.info(\"Pushing commit #{commit_log.commit_id}\")\n\n if phrases.size > 0\n commit_log.phrase_count = phrases.size\n repo_config.tms.store_phrases(phrases, commit_log.commit_id)\n commit_log.push\n else\n commit_log.finalize!\n end\n\n logger.info(\"Finished pushing commit #{commit_log.commit_id}\")\n rescue Java::OrgEclipseJgitErrors::MissingObjectException => ex\n commit_log.missing\n ensure\n save_commit_log\n end", "def commit_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n if supports_releasing_savepoints?\n log_connection_yield('Transaction.release_savepoint', conn){conn.release_savepoint(savepoint_obj(conn))}\n end\n else\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end\n end", "def commit\n begin\n update_response = @streaming_update_server.commit\n rescue org.apache.solr.common.SolrException => e\n @logger.error(\"SolrException while committing updates\")\n @logger.error(\"#{e.message}\")\n @logger.error(\"#{e.backtrace}\")\n end\n end", "def commit_transaction(tx)\n tx.execute(self)\n end", "def solr_commit\n Solarize::Post.execute(Solr::Request::Commit.new)\n end", "def update_commit\n commit.update_scalars\n commit.save\n test_case_commits.each { |tcc| tcc.update_and_save_scalars }\n end", "def commit_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end", "def commit\n @read_lock.synchronize do\n @write_lock.synchronize do\n unless @saved\n storage.store(self.class, @id, @data.dup)\n end\n @saved = true\n end\n end\n end", "def commit_hook( &block ) # :yields:\n SQLite::API.commit_hook( @handler, block )\n end", "def _commit_externals \n __pack[:stubs].each_with_index do |obj_hash, index|\n obj = obj_hash[:id]\n if obj.commit\n obj_hash[:id] = obj.id\n else\n if obj.id\n self._warnings << \"Unable to save latest version of #{obj.inspect}, stubbed at index #{index}\"\n obj_hash[:id] = obj.id if obj.id \n else \n self._warnings << \"Unable to save #{obj.inspect}, stubbed at index #{index}\" \n end \n end \n end \n end", "def transaction(&block)\n yield\n commit\n end", "def commit_orders\r\n orders = @customer.open_orders.find_all_by_synchronized( false )\r\n sales_id = \"\"\r\n orders.each do |o| sales_id += \"'#{o.sales_id}', \" end \r\n @store_user.my_account_log(@customer,\"Commit Sales Order Updates: #{sales_id}\")\r\n\r\n if orders.empty? || ERP::SalesOrder.commit_orders( orders )\r\n flash.now[:message] = \"All changes have been commited.\"\r\n else\r\n flash.now[:message] = \"Operation Failed.\"\r\n end\r\n end", "def commit_if_dirty(soft_commit = false)\n session.commit_if_dirty soft_commit\n end", "def commit_transaction(conn)\n log_connection_execute(conn, commit_transaction_sql) unless Thread.current[:sequel_transaction_depth] > 1\n end", "def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end", "def send_commit\n post_to_solr({},true)\n end" ]
[ "0.81308633", "0.8126921", "0.80446666", "0.7854549", "0.7808769", "0.7776686", "0.7776686", "0.7776686", "0.76801217", "0.7643824", "0.75066954", "0.75063735", "0.7505296", "0.7447256", "0.7447256", "0.7441003", "0.7347878", "0.7239524", "0.72276676", "0.71898335", "0.71898335", "0.7185329", "0.71848536", "0.7168678", "0.7156267", "0.7154178", "0.71283436", "0.70857096", "0.7076397", "0.7076382", "0.70603156", "0.7059472", "0.696317", "0.69099504", "0.6877453", "0.6871987", "0.6862535", "0.68489826", "0.68489826", "0.6843988", "0.6836882", "0.6836882", "0.6814654", "0.6794731", "0.6785944", "0.6767867", "0.6767003", "0.67605644", "0.6748814", "0.6738292", "0.67085034", "0.67054677", "0.6704967", "0.67048615", "0.67048615", "0.67017686", "0.6695692", "0.6663923", "0.66628456", "0.6609522", "0.6604969", "0.65832525", "0.65760857", "0.6541535", "0.65186393", "0.6484023", "0.647243", "0.6471481", "0.6442934", "0.6421043", "0.64199764", "0.6412499", "0.640869", "0.63999546", "0.637471", "0.637471", "0.63642555", "0.63642013", "0.6315657", "0.6315657", "0.6302919", "0.6302919", "0.6293381", "0.6292664", "0.6273203", "0.6258956", "0.6249787", "0.6243198", "0.6206806", "0.6200711", "0.6192722", "0.61877674", "0.6184599", "0.61736065", "0.617038", "0.6140614", "0.6136239", "0.6132101", "0.6118908", "0.6110055", "0.6104791" ]
0.0
-1
Given an rmap, extract the changed or created files, and delete any deleted files
def cmvc_extract_changed rmap raise "oops, not done" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end", "def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end", "def clear!\n \n # Removes old files in the test directory\n ['to', 'from'].each do |folder|\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{folder}/*\")).each do |file|\n FileUtils.rm(file)\n end\n end\n \n {'some_zip_files.zip' => 'zip_real', 'test_package.rar' => 'rar_real'}.each_pair do |first, last|\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/#{first}\")\n FileUtils.copy_file(src, dest)\n end\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/movie_to/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n \n {'test_package.rar' => 'to', 'some_zip_files.zip' => 'to'}.each do |first,last|\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/from/#{first}\")\n FileUtils.copy_file(src, dest)\n end\nend", "def remove_moved_files\n scan_for_merges.each do |file|\n if File.amp_lexist?(@repo.working_join(file))\n UI.debug(\"removing #{file}\")\n File.unlink(@repo.working_join(file))\n end\n end\n end", "def run_on_removals(paths)\n end", "def run_on_removals(paths)\n paths.each do |path|\n warn \"file #{path} removed -- it's up to you to remove it from the server if desired\"\n end\n end", "def file_path_scheduled_for_deletion?(map, path)\n parts = path.split('/')\n if parts.size == 1\n deletions = map.keys.select { |k| !map[k] }\n deletions.any? { |d| d == parts.first }\n else\n part = parts.shift\n if rest = map[part]\n file_path_scheduled_for_deletion?(rest, parts.join('/'))\n else\n false\n end\n end\n end", "def clean_files\n FileUtils.rm(Dir[File.join(Rails.root, 'public/sitemap*.xml.gz')])\n end", "def cleanup_old_files\n # make a local copy of to_delete while simultaneously clearing the original (atomicity)\n # local_to_delete = $to_delete.slice!(0..-1).to_a\n local_to_delete = []\n $to_delete.delete_if { |v| local_to_delete << v; true }\n\n $files.each_pair do |uuid, file|\n if file.nil?\n $files.delete uuid\n elsif local_to_delete.include?(uuid) || (Time.now - 60*60) > file.ctime\n file.close # Close it\n file.unlink if file.respond_to? :unlink # Unlink it if we can\n $files.delete uuid\n end\n end\n GC.start\nend", "def remove_stale_files() = stale_files.each { |file| remove_file(file) }", "def carve_undelete_file_info\n files = catalog_tree.search_using_journal(leaf_file_record, journal)\n \n for leaf in attribute_tree.search_using_journal\n wrapped_file_key, protection_class = attribute_tree.search_using_journal(leaf_filekey_record, journal)\n file_key = unwrap_using_class_keys_acquired_from_plist(wrapped_file_key, protection_class)\n file_keys << file_key\n end\n \n return files, file_keys\nend", "def run_on_removals(paths)\n paths = paths.select {|path| not options[:exclude] =~ path and File.file? path}\n\n directories = detect_nested_directories(watchers, paths, options)\n removed = []\n\n directories.each do |directory, files|\n files.each do |file|\n begin\n File.delete file\n removed << file\n rescue Error::ENOENT\n # Ignore\n end\n end\n end\n if removed.length > 0\n notify(removed, \"REMOVED\")\n end\n end", "def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end", "def delete_files(files)\n not_found = []\n files.each do |file|\n file_stored = Files.where({ '_id' => file[:uuid]}).first\n if file_stored.nil?\n logger.error 'File not found ' + file.to_s\n not_found << file\n else\n if file_stored['pkg_ref'] == 1\n # Referenced only once. Delete in this case\n file_stored.destroy\n del_ent_dict(file_stored, :files)\n file_md5 = Files.where('md5' => file_stored['md5'])\n if file_md5.size.to_i.zero?\n # Remove files from grid\n grid_fs = Mongoid::GridFs\n grid_fs.delete(file_stored['grid_fs_id'])\n end\n else\n # Referenced above once. Decrease counter\n file_stored.update_attributes(pkg_ref: file_stored['pkg_ref'] - 1)\n end\n # file_stored.destroy\n # del_ent_dict(file_stored, :files)\n #\n # # Remove files from grid\n # grid_fs = Mongoid::GridFs\n # grid_fs.delete(file_stored['grid_fs_id'])\n end\n end\n not_found\n end", "def delfile(input)\n _records(input).each do |sid|\n if arec = Song.find_by_id(sid)\n begin\n FileUtils.remove(arec.path, :verbose=>true)\n rescue Errno::ENOENT\n end\n arec.state = 'N'\n arec.save_wait\n end\n end\n if @mpattern\n @matchset = Song.search(@mpattern)\n end\n end", "def run_on_removals(paths)\n Runner.remove(Inspector.clean(paths, :missing_ok => true), watchers, options)\n end", "def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end", "def remove_superfluous_destination_files\n # join mirror_file and dest_file and delete everything from dest_file which isn't in mirror_file\n # because mirror_file should represent the current state of the source mogile files\n Log.instance.info('Joining destination and mirror tables to determine files that have been deleted from source repo.')\n DestFile.where('mirror_file.dkey IS NULL').joins('LEFT OUTER JOIN mirror_file ON mirror_file.dkey = file.dkey').find_in_batches(batch_size: 1000) do |batch|\n batch.each do |file|\n # Quit if program exit has been requested.\n break if SignalHandler.instance.should_quit\n\n # Delete all files from our destination domain which no longer exist in the source domain.\n begin\n Log.instance.debug(\"key [ #{file.dkey} ] should not exist. Deleting.\")\n @dest_mogile.delete(file.dkey)\n @removed += 1\n @freed_bytes += file.length\n rescue => e\n @failed += 1\n Log.instance.error(\"Error deleting [ #{file.dkey} ]: #{e.message}\\n#{e.backtrace}\")\n end\n end\n\n # Print a summary to the user.\n summarize\n\n # Quit if program exit has been requested.\n return true if SignalHandler.instance.should_quit\n end\n end", "def run_on_removals(paths)\n paths.each do |path|\n output_folder = @options[:output_folder] || File.dirname(path)\n fileString = output_folder + \"/\" + File.basename(path) + \".js\"\n File.delete(fileString) if File.exists?(fileString)\n UI.info \"Guard::Steering deleted #{File.basename(path)}.js from #{output_folder}\" unless @options[:quiet]\n end\n end", "def filter_nonexistent(modified_files); end", "def run_on_removals(paths)\n run(paths) \n end", "def removed_unmarked_paths\n #remove dirs\n dirs_enum = @dirs.each_value\n loop do\n dir_stat = dirs_enum.next rescue break\n if dir_stat.marked\n dir_stat.marked = false # unset flag for next monitoring\\index\\remove phase\n #recursive call\n dir_stat.removed_unmarked_paths\n else\n # directory is not marked. Remove it, since it does not exist.\n write_to_log(\"NON_EXISTING dir: \" + dir_stat.path)\n # remove file with changed checksum\n $local_content_data_lock.synchronize{\n $local_content_data.remove_directory(dir_stat.path, Params['local_server_name'])\n }\n rm_dir(dir_stat)\n end\n end\n\n #remove files\n files_enum = @files.each_value\n loop do\n file_stat = files_enum.next rescue break\n if file_stat.marked\n file_stat.marked = false # unset flag for next monitoring\\index\\remove phase\n else\n # file not marked meaning it is no longer exist. Remove.\n write_to_log(\"NON_EXISTING file: \" + file_stat.path)\n # remove file with changed checksum\n $local_content_data_lock.synchronize{\n $local_content_data.remove_instance(Params['local_server_name'], file_stat.path)\n }\n # remove from tree\n @files.delete(file_stat.path)\n end\n end\n end", "def import( logdir, outdir, namemap )\n urec_budsns = {}\n copied = 0\n existing = 0\n ignored = 0\n \n Dir.foreach( logdir ) do |logdir_fn|\n next if logdir_fn[0] == ?.\n accdir = \"#{logdir}/#{logdir_fn}\"\n Dir.foreach( accdir ) do |accdir_fn|\n next if accdir_fn[0] == ?.\n budnick = namemap[accdir_fn]\n if budnick\n buddir = \"#{accdir}/#{accdir_fn}\"\n Dir.foreach( buddir ) do |buddir_fn|\n if buddir_fn =~ /^(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)\\.log$/\n logfile = \"#{buddir}/#{buddir_fn}\"\n y = $1 ; m = $2 ; d = $3\n destdir = \"#{outdir}/#{y}/#{m}\"\n destfile = \"#{destdir}/#{budnick}-#{y}.#{m}.#{d}.xml\"\n if File.exist?( destfile )\n existing += 1\n else\n FileUtils.mkdir_p( destdir )\n sys('cp','-al',logfile,destfile)\n copied += 1\n end\n end\n end\n else\n ignored += 1\n urec_budsns[accdir_fn] = accdir_fn\n end\n end\n end\n \n if urec_budsns.length > 0\n STDERR.puts \"Skipping unrecognised buddies: \"+urec_budsns.values.join(', ')\n end\n STDERR.puts \"#{copied} files copied\"\n STDERR.puts \"#{existing} files already existing\"\n STDERR.puts \"#{ignored} files ignored\"\nend", "def RemoveDmMapsTo(device)\n Builtins.y2milestone(\"RemoveDmMapsTo device:%1\", device)\n return if !InitLibstorage(false)\n @sint.removeDmTableTo(device)\n nil\n end", "def purge_output\n Dir.glob dir(\"output/**/*\") do |item|\n next if File.directory? item\n File.delete item unless @touchedfiles.include? undir(item)\n end\n end", "def filter_directories(modified_files); end", "def removestaticfiles()\n\n\t# Make a hash of files so it's easy to add to in the future. \n\t# The key is what will be printed out\n\t# the value is the path upwards of the release's wp/ directory\n\tfiles = {}\n\tfiles[\"readme.html\"] = 'readme.html'\n\tfiles[\"license.txt\"] = 'license.txt'\n\tfiles[\"install.php\"] = 'wp-admin/install.php'\n\n\t# Announce what we're doing\n\tputs \"\\n\" + '[ ' + yellow( 'RUNNING' ) + \" ] Remove static files\"\n\n\t# loop over the files hash and remove the file, saying what we're going\n\t# use print so we can add to the same line\n\tfiles.each do |text, path|\n\t\tprint \"\\n\" + \"............ removing \" + \"#{text}\"\n\t\texecute \"cd #{release_path} && cd wp && rm #{path}\"\n\t\tprint \" .. \" + green( \"\\u2713\" )\n\tend\n\n\tputs \"\\n\" + '[ ' + green( 'SUCCESS' ) + ' ] Static files removed'\n\nend", "def run_on_deletion(paths)\n end", "def run_on_deletion(paths)\n end", "def remove_deleted_files\n cache_file_hash = {}\n @cookbooks_by_name.each_key do |k|\n cache_file_hash[k] = {}\n end\n\n # First populate files from cache\n cache.find(File.join(%w{cookbooks ** {*,.*}})).each do |cache_file|\n md = cache_file.match(%r{^cookbooks/([^/]+)/([^/]+)/(.*)})\n next unless md\n\n (cookbook_name, segment, file) = md[1..3]\n if have_cookbook?(cookbook_name)\n cache_file_hash[cookbook_name][segment] ||= {}\n cache_file_hash[cookbook_name][segment][\"#{segment}/#{file}\"] = cache_file\n end\n end\n # Determine which files don't match manifest\n @cookbooks_by_name.each_key do |cookbook_name|\n cache_file_hash[cookbook_name].each_key do |segment|\n manifest_segment = cookbook_segment(cookbook_name, segment)\n manifest_record_paths = manifest_segment.map { |manifest_record| manifest_record[\"path\"] }.to_set\n to_be_removed = cache_file_hash[cookbook_name][segment].keys.to_set - manifest_record_paths\n to_be_removed.each do |path|\n cache_file = cache_file_hash[cookbook_name][segment][path]\n\n Chef::Log.info(\"Removing #{cache_file} from the cache; its is no longer in the cookbook manifest.\")\n cache.delete(cache_file)\n @events.removed_cookbook_file(cache_file)\n end\n end\n end\n end", "def delete_cache_files; end", "def delete_cache_files; end", "def remove_unnecessary_cache_files!\n current_keys = cache_files.map do |file|\n get_cache_key_from_filename(file)\n end\n inmemory_keys = responses.keys\n\n unneeded_keys = current_keys - inmemory_keys\n unneeded_keys.each do |key|\n File.unlink(filepath_for(key))\n end\n end", "def replaced_files; end", "def delete_orphan_files_in_api(start)\n Find.find(api_output) do |path|\n if path.end_with?('.html') || path.end_with?('.html.gz')\n FileUtils.rm_f(path) if File.mtime(path) < start\n end\n end\n end", "def split_key_info_per_subfolder_deletes(original_key_info, delete_foldernames_info)\n retain_index = 0\n remove_index = 1\n key_infos = [ Hash.new, Hash.new ]\n original_key_info.each do |app_id, key_struct|\n key_struct.each do |key_type, keys|\n keys.each do |key, key_data|\n type = retain_index\n if delete_foldernames_info.key?(app_id) &&\n delete_foldernames_info[app_id].key?(key_type)\n delete_foldernames_info[app_id][key_type].each do |folder|\n if key.start_with?(\"#{folder}/\")\n type = remove_index\n break\n end\n end\n end\n\n key_infos[type][app_id] = {} unless key_infos[type].key?(app_id)\n key_infos[type][app_id][key_type] = {} unless key_infos[type][app_id].key?(key_type)\n key_infos[type][app_id][key_type][key] = key_data\n end\n end\n end\n\n key_infos\n end", "def remove(filename); end", "def clean_up_map map\n {\n id: map[0].to_i,\n release: map[1],\n unknown1: map[2],\n component: map[3],\n version: map[4],\n path1: map[5],\n path2: map[6],\n unknown2: map[7],\n mode: map[8],\n type: map[9].to_sym,\n unknown3: map[10]\n }\n end", "def files_omit\n %w(map.html)\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def discover_deleted_craft existing_craft_map = nil\n #In the root of the campaigns git repo run the --diff-filter command and then return to the current working dir.\n log = self.repo.log_filterD\n \n\n #Select the craft already present in the DB which can either be from passed in existing_craft_map or directly from the DB\n if existing_craft_map\n existing_craft = {\n \"VAB\" => existing_craft_map.has_key?(\"vab\") ? existing_craft_map[\"vab\"].keys : [],\n \"SPH\" => existing_craft_map.has_key?(\"sph\") ? existing_craft_map[\"sph\"].keys : []\n } \n else \n existing_craft = {\n \"VAB\" => self.craft.where(:craft_type => \"vab\").map{|c| c.name},\n \"SPH\" => self.craft.where(:craft_type => \"sph\").map{|c| c.name}\n } \n end\n\n #get all the SHA_ID's used in the campaigns repo\n logs = self.repo.log.map{|log| log.to_s}\n\n #split logs so that each element contains one commit and each commit is an array, the 1st element of which is the SHA_ID\n log = log.split(\"commit \").map{|l| l.split(\"\\n\") }.select{|l| !l.empty?}\n\n log.map{|l|\n next unless logs.include?(l[0]) #perhaps un-nessesary, a security step to ensure this only examines commits whos SHA_ID matches one in this repo.\n commit_info = {\n :sha => l[0], #first element is the SHA_ID\n #select lines which include \"delete mode\" and remove the \"delete mode\" text. Each line (of which there maybe 1 or more) is a file which was deleted.\n :deleted => l.select{|line| line.include?(\"delete mode\")}.map{|line| line.gsub(\"delete mode 100644\",\"\").strip}.map{|data|\n s = data.sub(\"Ships/\",\"\").split(\"/\") #assume the file path has 'Ships/' and remove it and split on '/'\n d = {:craft_type => s[0], :name => s[1]} #assuming the file is a craft, the first element will be VAB or SPH and the 2nd element will be the name.craft\n d = nil unless d[:name].include?('.craft')#set d to nil 'skip' if the name does not include .craft\n #second skip clause, skip if the craft type is not either VAB or SPH and skip if the existing craft already contain a craft by that name (for that craft_type).\n d = nil if ![\"SPH\",\"VAB\"].include?(d[:craft_type]) || existing_craft[d[:craft_type]].include?(d[:name].sub(\".craft\",\"\"))\n d\n }.compact #remove the nil'ed entries\n }\n commit_info = nil if commit_info[:deleted].compact.empty? #if all the entries were nil'ed then skip this commit\n commit_info\n }.compact #remove the nil'ed commits.\n end", "def extract_modified_lines(file_path, options); end", "def extract_modified_lines(file_path, options); end", "def unmap_file(path)\n path = path.to_s\n @files.delete path\n end", "def unmap_file(path)\n path = path.to_s\n @files.delete path\n end", "def remove_files\n resource.formats.each do |fmt|\n converted_csv = fmt.converted_csv_file\n File.unlink(converted_csv) if File.exist?(converted_csv)\n diff = fmt.diff_file\n File.unlink(diff) if File.exist?(diff)\n end\n end", "def reproc_true(file)\n full_path = file\n if (! File.exists?(full_path))\n # Rubymatica.save_status(dir_uuid, \"Can't reprocess, #{full_path} does not exist.\")\n print \"Can't reprocess, #{full_path} does not exist.\\n\";\n exit\n end\n extract_flag = false\n dir_uuid = File.basename(full_path)\n \n # When reprocessing, the meta_data/info.db already exists (or else\n # this will fail), therefore we can look in the db for info such\n # as the name of this ingest.\n \n my_ig = Ingest.new(dir_uuid)\n \n base_name = my_ig.read_meta(\"ingest_name\")\n tub = \"#{Dest}/#{dir_uuid}/#{Accession_dir}\"\n \n Rubymatica.save_status(dir_uuid, \"Reprocessing #{Accession_dir} uuid: #{dir_uuid}\")\n \n igl_dest = \"#{Dest}/#{dir_uuid}/#{Ig_logs}\"\n pv_dir = \"#{Dest}/#{dir_uuid}/#{Pv}\"\n md_dir = \"#{Dest}/#{dir_uuid}/#{Meta}\"\n ac_dir = \"#{Dest}/#{dir_uuid}/#{Accession_dir}\"\n \n # Delete any previously machine created files. Keeping files\n # would mean using previously created file uuid's and that\n # would be a mess. This codes doesn't have the architecture\n # for that.\n\n # Use an anonymous array because we can. Directories that we'll\n # clean up, followed by a list of files we will *not* delete.\n\n [igl_dest, pv_dir, md_dir].each { |path|\n Find.find(path) { |file|\n if (file.match(Dcx) or \n file.match(Db_name))\n next;\n end\n\n # Great line of code. OOP totally rocks. Not! Class,\n # method and variable all the same name, and you thought\n # programmers didn't have a sense of humor.\n \n if (File.file?(file))\n File.delete(file)\n end\n }\n }\n return base_name,dir_uuid, my_ig, tub, igl_dest, pv_dir, md_dir, ac_dir, extract_flag\n end", "def delete_file_parts\n #TODO implementation\n end", "def clean_cache(staging_path, metadata)\n actual_file_list = Dir.glob(File.join(staging_path, \"**/*\"))\n expected_file_list = []\n CookbookMetadata.new(metadata).files { |_, path, _| expected_file_list << File.join(staging_path, path) }\n\n extra_files = actual_file_list - expected_file_list\n extra_files.each do |path|\n if File.file?(path)\n FileUtils.rm(path)\n end\n end\n end", "def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend", "def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend", "def remove_temp_files(xfrm)\n xfrm.destroy!\n end", "def erase\n HDB.verbose and puts \"Erasing successfully-copied files\"\n unlinkable = @files.collect do |x|\n f = get_real_filename(x)\n File.directory?(f) or File.symlink?(f)\n end\n # TODO: unlink them now.\n # TODO: rmdir directories, starting with child nodes first\n raise \"erase unimplemented\"\n end", "def clean_old_output()\n deletable_filenames = []\n wd = FileUtils.pwd()\n all_filenames = ['/public/output/*'].collect!{|e| Dir.glob(wd + e)}.flatten.compact\n# DEBUG\n# logger.debug \"\\r\\n=== Cleaning old output files:\"\n# logger.debug \"Found #{all_filenames.size} files (either new or old). Checking last access times...\"\n\n all_filenames.each { |filename| # For each filename found, check if it is old enough to be removed:\n last_access_time = File.open(filename).atime\n dt = DateTime.new( last_access_time.year, last_access_time.month, last_access_time.day, last_access_time.hour, last_access_time.min, last_access_time.sec )\n diff = DateTime.now - dt\n min = (diff.to_f * 24 * 60) # Convert the difference from nanoseconds to minutes\n if ( min > 2 ) # (Streaming files in output/* should take less than 2 mins)\n# DEBUG\n# logger.debug \"'#{filename}': is #{min} minutes older, adding to the list of deletable files.\"\n deletable_filenames << filename\n else\n# DEBUG\n# logger.debug \"'#{filename}': is just #{min} minutes older, skipping.\"\n end\n }\n# DEBUG\n# logger.debug \"Found #{deletable_filenames.size} old files. Erasing them...\"\n # Kill'em all:\n FileUtils.rm_f( deletable_filenames )\n end", "def modified_files\n remote_details = @container.list_objects_info\n same_files.reject do |file|\n (remote_details[file][:last_modified] <=> File.mtime(CloudfileAsset::Local.make_absolute(file))) == 1\n end\n end", "def undelete(list)\n manifests = living_parents.map do |p|\n manifest.read changelog.read(p).manifest_node\n end\n \n # now we actually restore the files\n list.each do |file|\n unless dirstate[file].removed?\n UI.warn \"#{file} isn't being removed!\"\n else\n m = manifests[0] || manifests[1]\n data = file(f).read m[f]\n add_file file, data, m.flags(f) # add_file is wwrite in the python\n dirstate.normal f # we know it's clean, we just restored it\n end\n end\n end", "def delete_older_files_from_cloud(story, story_revision, directory)\r\n if Rails.env == 'production'\r\n directory.files.all(:prefix=> \"stories/#{story.id}/pdf\").each do |file|\r\n file.destroy if (File.basename(file.key, File.extname(file.key)) != story.to_param + story_revision)\r\n end\r\n directory.files.all(:prefix=> \"stories/#{story.id}/epub\").each do |file|\r\n file.destroy if (File.basename(file.key, File.extname(file.key)) != story.to_param + story_revision)\r\n end\r\n end\r\n end", "def modified_files; end", "def map_mv(options={}, &block)\n @file_list = map_send(:mv, options={}, &block)\n end", "def prune!(regexp)\n ret = false\n [:files_modified, :files_deleted, :files_added].each do |type|\n if array = self[type]\n array.reject! do |el| \n if path(el) =~ regexp \n ret = true\n true\n end\n end\n delete(type) if array.empty? \n end\n end\n if array = self[:files_renamed]\n array.reject! do |el| \n if el[:new_path] =~ regexp or el[:old_path] =~ regexp \n ret = true\n true\n end\n end\n delete(:files_renamed) if array.empty?\n end\n ret\n end", "def cleanup(file)\n Dir.glob(@options[:output].sub(/\\./, '*')).each do |item|\n if File.basename(item) != File.basename(file)\n info \"Stitch \" + \"deleted \".red + item.sub(\"#{Dir.pwd}/\", '')\n FileUtils.rm(item)\n @deleted << item\n end\n end\n end", "def purge!\n @map = {}\n end", "def clean_mkv_files\n mkv_files = get_files(\"*.mkv\")\n\n mkv_files.each do |mkv|\n convert_mkv_to_mp4(mkv)\n destroy_dirty_file!(mkv)\n end\n end", "def delete_nsec3_files()\n w = Dir.new(@working)\n w.each {|f|\n if ((f.index(\"audit\")) && (f.index(\"#{Process.pid}\")))\n begin\n File.delete(@working + File::SEPARATOR + f.untaint)\n rescue Exception => e\n print \"Can't delete temporary auditor file #{f}, error : #{e}\\n\"\n end\n end\n }\n end", "def check_files\n updated = []\n files.each do |filename, mtime| \n begin\n current_mtime = File.stat(filename).mtime\n rescue Errno::ENOENT\n # file was not found and was probably deleted\n # remove the file from the file list \n files.delete(filename)\n next\n end\n if current_mtime != mtime \n updated << filename\n # update the mtime in file registry so we it's only send once\n files[filename] = current_mtime\n puts \"quick_serve: spotted change in #{filename}\"\n end\n end\n QuickServe::Rails::Snapshot.reset if updated != []\n false\n end", "def delete_uncompressed_backups\n end", "def sweep(mode=:test)\n unmapped = []\n # For each file in the folder @folder\n Dir.foreach @folder do |file|\n FileUtils.cd @folder\n h = [:patterns, :types, :unhandled]\n\n # If we are indeed looking at a file and not a directory\n if File.file?(file)\n handled = false\n h.each do |key|\n unless handled\n match = @handlers[key].is_match? file\n\n if match\n puts \"Match for #{file} -> #{match.destination}\"\n handled = true\n @handlers[key].process match, mode\n end\n end\n end\n\n #unless handle_pattern_match file\n # unless handle_extension_match file\n # handle_no_match file\n # end\n #end\n\n #ext = File.extname(file).downcase\n #ext.slice!(0)\n #if m.key?(ext)\n ##Check to make sure that m.value folder exists\n ##if not, create it\n #target_dir = @folder + \"/\" + m[ext]\n #puts \"Moving #{file} to #{target_dir}\"\n\n ##Move the file into the folder\n #FileUtils.mkdir_p(target_dir) unless Dir.exists?(target_dir)\n #FileUtils.move(file, \"#{target_dir}/#{file}\")\n #else\n #unmapped.push file\n #end\n end\n end\n\n @handlers[:unhandled].output\n\n end", "def test_delete_file_patch\n @options[:strip] = 0\n \n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_new_file_patch\n patches << bake_delete_file_patch\n\n # Create a new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n # Only foo.rb should stay in /lib, bar.rb should be gone\n assert_raises(RuntimeError, 'File not found') {\n file_contents(File.join @lib_dir, 'bar.rb')\n }\n end", "def map_files\n file_map = {}\n entry_file = Pathname.new(map_entry)\n entry_found = false\n case @files\n when Hash\n @files.each do |path, file|\n file_map[path.to_s] = File.expand_path(file.to_s)\n entry_found = true if path.to_s==entry_file.to_s\n end\n else\n base_paths = @base_paths.collect {|path| Pathname.new(path).expand_path }\n @files.each do |fn|\n next unless fn\n relpath = strip_path(base_paths, fn) || fn\n file_map[relpath.to_s] = File.expand_path(fn.to_s)\n entry_found = true if relpath==entry_file\n end\n end\n file_map[entry_file.to_s] = File.expand_path(@entry_file.to_s) unless entry_found\n file_map\n end", "def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end", "def delete(*filenames); end", "def unlink(*keys); end", "def existing_files; end", "def cleanup\n remove_files(TEST_INPUT_DIR)\n remove_files(TEST_OUTPUT_DIR)\nend", "def remove_downloaded_files\n Log.log_info('In remove_downloaded_files')\n begin\n Log.log_debug('Removing downloaded files')\n # TBI\n Log.log_debug('End removing downloaded files')\n rescue StandardError => e\n Log.log_err('Exception e=' + e.to_s)\n end\n end", "def page_path_scheduled_for_deletion?(map, path)\n parts = path.split('/')\n if parts.size == 1\n deletions = map.keys.select { |k| !map[k] }\n downfile = parts.first.downcase.sub(/\\.\\w+$/, '')\n deletions.any? { |d| d.downcase.sub(/\\.\\w+$/, '') == downfile }\n else\n part = parts.shift\n if rest = map[part]\n page_path_scheduled_for_deletion?(rest, parts.join('/'))\n else\n false\n end\n end\n end", "def files_changed_in_patch(patchfile, tap)\n files = []\n formulae = []\n others = []\n File.foreach(patchfile) do |line|\n files << Regexp.last_match(1) if line =~ %r{^\\+\\+\\+ b/(.*)}\n end\n files.each do |file|\n if tap&.formula_file?(file)\n formula_name = File.basename(file, \".rb\")\n formulae << formula_name unless formulae.include?(formula_name)\n else\n others << file\n end\n end\n { files: files, formulae: formulae, others: others }\n end", "def files_changed_in_patch(patchfile, tap)\n files = []\n formulae = []\n others = []\n File.foreach(patchfile) do |line|\n files << Regexp.last_match(1) if line =~ %r{^\\+\\+\\+ b/(.*)}\n end\n files.each do |file|\n if tap&.formula_file?(file)\n formula_name = File.basename(file, \".rb\")\n formulae << formula_name unless formulae.include?(formula_name)\n else\n others << file\n end\n end\n { files: files, formulae: formulae, others: others }\n end", "def rm_r(options={})\n #list = list.to_a\n fileutils.rm_r(list, options)\n end", "def cleanupTestFiles\n ('A' .. 'F').each { |del| FileUtils.rm(\"#{folder}HR3-Room#{del}.csv\", force: true) } \n end", "def list_of_app_deployed_files(root_dir, name_to_cut)\n fscd = FileScanDir.new\n fscd.is_silent = true\n fscd.add_extension_filter(['.pdb','.ipdb','.iobj'])\n fscd.scan_dir(root_dir)\n res_names = []\n #each file need to be specified like without keyword File:\n # File \"app\\\\src\\\\cuperativa_gui.rb\"\n old_rel_dir_path = nil\n fscd.result_list.each do |file_src|\n name = file_src.gsub(name_to_cut, \"\")\n rel_dir_path = File.dirname(name) # note: not work with \\ intead of / on the path\n \n name.gsub!('/', \"\\\\\")\n puts str_path_file = \"#{name}\"\n if rel_dir_path != old_rel_dir_path\n puts \"Path changed to: #{rel_dir_path}\"\n adptrel_dir_path = \"\\\\#{rel_dir_path.gsub('/', \"\\\\\")}\" # need: \\app\\src\\network\n res_names << { :filename => str_path_file, :out_path => adptrel_dir_path, \n :delete_path => old_rel_dir_path }\n old_rel_dir_path = rel_dir_path\n else\n res_names << { :filename => str_path_file }\n end\n end\n p res_names.last[:delete_path] = old_rel_dir_path\n return res_names\n end", "def modified_files(options); end", "def modified_files(options); end", "def altered_files; (modified + added + removed).sort; end", "def cleanup_derivatives\n deleted_files = []\n raster_derivatives = resource.file_metadata.select { |file| file.derivative? || file.thumbnail_file? || file.cloud_derivative? }\n raster_derivatives.each do |file|\n storage_adapter.delete(id: file.file_identifiers.first)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n generate_mosaic unless deleted_files.empty?\n end", "def stop_watches(paths, delete_pos = false)\r\n for path in paths\r\n log_state = @watched_files.delete(path)\r\n log_state.timer.detach if log_state.timer.attached?\r\n @pos.remove_position(path) if delete_pos && @pos != nil\r\n end\r\n end", "def rmFile(file, logkey='')\n if File.file?(file)\n Mcmlln::Tools.deleteFile(file)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def create_mapfile(clean)\n analyze = PodsSpecification.instance.analyze\n targets = analyze.targets\n pod_targets = analyze.pod_targets\n return if Pods.clean_hmap_setting(clean, targets, pod_targets)\n\n merge_all_pods_target_headers_mapfile(pod_targets)\n merge_all_target_public_headers_mapfile(targets)\n end", "def clear_diff_cache\n if Dor::Config.stacks.local_workspace_root.nil?\n raise ArgumentError, 'Missing Dor::Config.stacks.local_workspace_root' \n end\n druid = DruidTools::Druid.new(self.pid, Dor::Config.stacks.local_workspace_root)\n diff_pattern = File.join(druid.temp_dir, DIFF_FILENAME + '.*')\n FileUtils.rm_f Dir.glob(diff_pattern)\n end", "def remapped_reads(input_file, output_file, read_length, mm=2)\n\t\tremapped = {}\n\t\t\n\t\t# Filter remapped reads\n\t\tinput_file.each do |line|\n\t\t\tmdz = line.match(/MD:Z:\\S*/).to_s\n\t\t\tline = line.strip.split(/\\s+/)\n\t\t\tqname, mate = line[0].split('/')\n\t\t\tpos = line[2].split(':')\n\t\t\tcigar = line[5]\n\t\n\t\t\tif !remapped.has_key?(qname) && Alignment.max_mismatches?(mdz, mm) && cigar == \"#{read_length}M\"\n\t\t\t\tremapped[qname] = [pos, mate]\n\t\t\telse\t\n\t\t\t\tremapped.delete(qname)\n\t\t\tend\n\t\tend\n\n\t\t# Output\n\t\tFile.open(output_file, 'w') do |output|\n\t\t\tremapped.each {|k, v| output.puts [\"#{k}/#{v[-1]}\", v[0]].join(\"\\t\")}\n\t\tend\n\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Found remapped reads.\"\n\tend", "def check_files(files)\r\n files_before = @file_info.keys\r\n used_files = {} \r\n files.each do |file|\r\n begin\r\n if @file_info[file]\r\n if @file_info[file].timestamp != File.mtime(file)\r\n @file_info[file].timestamp = File.mtime(file)\r\n digest = calc_digest(file)\r\n if @file_info[file].digest != digest\r\n @file_info[file].digest = digest \r\n @file_changed && @file_changed.call(file)\r\n end\r\n end\r\n else\r\n @file_info[file] = FileInfo.new\r\n @file_info[file].timestamp = File.mtime(file)\r\n @file_info[file].digest = calc_digest(file)\r\n @file_added && @file_added.call(file)\r\n end\r\n used_files[file] = true\r\n # protect against missing files\r\n rescue Errno::ENOENT\r\n # used_files is not set and @file_info will be removed below\r\n # notification hook hasn't been called yet since it comes after file accesses\r\n end\r\n end\r\n files_before.each do |file|\r\n if !used_files[file]\r\n @file_info.delete(file)\r\n @file_removed && @file_removed.call(file)\r\n end\r\n end\r\n end", "def delMail(imap, folder)\n pp \"Emptying #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Deleted])\n imap.expunge\nend", "def map_cleanup\n if !identity_count.zero?\n nowi = Time.now.to_i\n # delete_if is atomic\n # contents should not mutate during this call\n identity_map.delete_if do |identity, compo|\n if (flag = compo.eviction_timeout <= nowi)\n evict_flush(compo.codec)\n end\n flag\n end\n end\n current_size_and_limit\n end", "def unmanifested_files\n mfs = manifested_files.map { |f| File.join bag_dir, f }\n bag_files.reject { |f| mfs.member? f }\n end", "def unmanifested_files\n mfs = manifested_files.map { |f| File.join bag_dir, f }\n bag_files.reject { |f| mfs.member? f }\n end", "def close_open_logs()\r\n @openDicts.each_pair do |filename, file|\r\n file.close\r\n @openDicts.delete(filename)\r\n end\r\n end", "def photo__after_destroy_trigger\r\n\r\nDir[File.join(FILES_DEST_PHOTO, \"#{self.id}_*\")].each{|f| File.delete(f)}\r\nDir[File.join(FILES_DEST_PHOTO__THUMBS, \"#{self.id}_*\")].each{|f| File.delete(f)}\r\nend", "def remove_map(vma)\n @maps.delete vma\n end", "def keep_files; end" ]
[ "0.58131886", "0.58131886", "0.57415473", "0.57370746", "0.57355213", "0.5688566", "0.5562375", "0.555419", "0.55425036", "0.55397713", "0.55250263", "0.5472779", "0.5387711", "0.53839636", "0.5354738", "0.53215075", "0.52835786", "0.526592", "0.5239939", "0.5214151", "0.52126384", "0.51963603", "0.5166649", "0.5164229", "0.5157979", "0.5156853", "0.51477194", "0.5145812", "0.5145812", "0.51282275", "0.51226103", "0.51226103", "0.5085868", "0.5065177", "0.50628877", "0.5046059", "0.50448275", "0.50125486", "0.5012008", "0.5001111", "0.5001111", "0.49951977", "0.4978527", "0.4978527", "0.49562874", "0.49562874", "0.495333", "0.4940901", "0.4892863", "0.48893002", "0.48837095", "0.48837095", "0.4879112", "0.48675904", "0.48608756", "0.48602808", "0.48564953", "0.48534897", "0.48509002", "0.48416892", "0.48331094", "0.4828155", "0.48264802", "0.48228016", "0.48168302", "0.48164204", "0.48156703", "0.48081246", "0.48077065", "0.48041993", "0.48031116", "0.4799097", "0.47917014", "0.4791597", "0.47844565", "0.4781481", "0.47710547", "0.4768665", "0.4768665", "0.47684494", "0.47644398", "0.47643566", "0.476179", "0.476179", "0.47574982", "0.47516242", "0.47502345", "0.47501996", "0.47482076", "0.47480926", "0.4735731", "0.47340104", "0.4731499", "0.47279578", "0.47266614", "0.47266614", "0.4721578", "0.47196504", "0.47162953", "0.4715711" ]
0.6385133
0
Clone the main repository
def git_clone_main raise "oops, not done" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_clone\n\n Rugged::Repository.clone_at git_url, root_path.to_s if git_url\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\n Dir.chdir(@dir) do\n command = ['clone', @configuration.repository, '.']\n git!(command)\n end\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\n fetch\n with_temporary_dir do |scratch_repo_path|\n yield(Rugged::Repository.clone_at(repo_path, scratch_repo_path))\n end\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 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 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\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 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 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\n if File.directory?(base_path)\n repo = ::Git.open(base_path)\n repo.checkout(\"master\")\n repo.pull\n repo.fetch\n else\n ::Git.clone(url, base_path)\n end\n true\n end", "def clone(uri, destination = Dir.mktmpdir)\n git(\"clone\", uri, destination.to_s)\n\n destination\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 clone_repo(repo_name, username)\n ` git clone http://github.com/#{username}/#{repo_name}.git /tmp/#{repo_name} `\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 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 clone_addon_repo(repoName, repoAddonURL, repoBlessedURL)\n self.log(INFO,repoName,\"Cloning : #{repoName} from #{repoAddonURL}...\")\n s = system(\"git clone --quiet #{repoAddonURL}\")\n if !s\n abort(\"[ERROR] Cloning of repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n Dir.chdir repoName\n self.log(INFO,repoName,\"Add blessed repository #{repoBlessedURL} for #{repoName} ...\")\n s = system(\"git remote add blessed #{repoBlessedURL}\")\n if !s\n abort(\"[ERROR] Adding blessed remote of repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end", "def clone_url\n \"git://github.com/#{@account}/#{name}.git\"\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 do_checkout\n super\n git = @logger.operation(:cloning, \"to #{@repo_dir}\") do\n ::Git.clone(@repository.url, @repo_dir)\n end\n do_fetch(git)\n do_checkout_revision(git)\n do_update_tag git\n end", "def clone_to(repo, destination)\n ::RightGit::Git::Repository.clone_to(repo, destination, DEFAULT_REPO_OPTIONS)\n true\n end", "def ensure_cloned(repository)\n RepositoryService.clone(repository)\n end", "def clone(uri, destination = Dir.mktmpdir)\n hg('clone', uri, destination.to_s)\n destination\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 git_clone_repo(host, git_clone_path, git_source)\n on(host, \"git clone #{git_source} #{git_clone_path}\")\nend", "def clone(repository_name, default_branch=nil)\n raise Pbtd::Error::FolderAlreadyExist, \"already exist in local: #{GitRepository.in_path(repository_name)}\" if GitRepository.exist?(repository_name)\n begin\n @rugged_repository = Rugged::Repository.clone_at(repository_url, GitRepository.in_path(repository_name), credentials: credentials)\n\n default_branch.nil? ? self.checkout(SETTINGS['default_branch']) : self.checkout(default_branch)\n rescue Rugged::OSError\n raise Pbtd::Error::Network, \"Network is unreachable\"\n rescue Rugged::NetworkError\n raise Pbtd::Error::GitRepositoryNotFound, \"not found\"\n end\n end", "def fetch_latest_code!\n `git clone --quiet #{Shellwords.escape(SOURCE_REPO)} .`\nend", "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 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 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 clone() 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 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 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 call\n clone_revision\n end", "def git_clone_repo(repo_path, repo = git.remote_git_repo, type = {'branch' => 'master'} , deep_clone = true)\n in_dir do\n pth = Pathname(repo_path).expand_path\n gritty = ::Grit::Git.new((pth + '.git').to_s)\n announce_or_puts gritty.inspect\n clone_opts = {:quiet => false, :verbose => true, :progress => true}\n clone_opts[:depth] = 1 unless deep_clone\n type['branch'] = type['branch'].nil? ? '' : type['branch']\n type['tag'] = type['tag'].nil? ? '' : type['tag']\n type['ref'] = type['ref'].nil? ? '' : type['ref']\n if pth.directory?\n announce_or_puts \"Pulling: #{repo} into #{pth}\"\n FileUtils.cd(pth.to_s) do\n res = gritty.pull(clone_opts, repo)\n end\n clone_opts[:branch] = type['branch'].empty? ? 'master' : type['branch']\n else\n clone_opts[:branch] = type['branch'].empty? ? 'master' : type['branch']\n announce_or_puts \"Cloning: #{repo} into #{pth}\"\n res = gritty.clone(clone_opts, repo, pth.to_s)\n end\n clone_pull_error_check(res) if res\n grotty = ::Grit::Git.new((pth + '.git').to_s)\n grotty.checkout( { :B => clone_opts[:branch]||'master' } )\n if !type['tag'].empty? || !type['ref'].empty?\n grotty.checkout( { :B => true }, 'cuken', type['tag']||type['ref'] )\n else\n grotty.checkout( { :B => true }, 'cuken' )\n end\n pth\n end\n end", "def process_github_clones\n repos = get_github_repos_already_cloned\n repos.each do |r|\n # SMELL: does not work if the working copy directory does\n # not match the repo name\n clone_path = configatron.dir + r.name\n set_upstream(clone_path, r.parent.html_url)\n end\nend", "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 clone\n end", "def clone\n end", "def clone\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(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 initialize_client_clone_and_push(type, module_name, branch, repo_url, local_repo_dir, version=nil)\n # moved this part from 'check_local_dir_exists_with_content' to this method since this only deletes .git folder\n # which can cause us problems if import fails\n if File.directory?(\"#{local_repo_dir}/.git\")\n response = unlink_local_clone?(type,module_name,version)\n unless response.ok?\n # in case delete went wrong, we raise usage error\n raise DtkError.new(\"Directory (#{local_repo_dir} is set as a git repo; to continue it must be a non git repo; this can be handled by shell command 'rm -rf #{local_repo_dir}/.git'\")\n end\n # we return to normal flow, since .git dir is removed\n end\n\n Response.wrap_helper_actions() do\n ret = Hash.new\n repo_dir = local_repo_dir(type,module_name)\n\n repo = create(repo_dir,branch,:init => true, :no_initial_commit => true)\n repo.add_remote(remote(),repo_url)\n remote_branch = local_branch = branch\n\n repo.pull_remote_to_local(remote_branch,local_branch,remote())\n repo.stage_changes()\n repo.commit(\"Adding files during initialization\")\n repo.push_with_remote(remote(), remote_branch)\n\n commit_sha = repo.head_commit_sha()\n {\"repo_obj\" => repo,\"commit_sha\" => commit_sha}\n end\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 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 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(source)\n copy(source, true)\n end", "def clone(*args); end", "def clone; end", "def clone; end", "def clone; end", "def clone(user, repo, update = false)\n\n def spawn(cmd)\n proc = IO.popen(cmd, 'r')\n\n proc_out = Thread.new {\n while !proc.eof\n STDERR.puts \"#{proc.gets}\"\n end\n }\n\n proc_out.join\n end\n\n checkout_dir = File.join('cache', user, repo)\n\n begin\n repo = Rugged::Repository.new(checkout_dir)\n if update\n spawn(\"cd #{checkout_dir} && git pull\")\n end\n repo\n rescue\n spawn(\"git clone git://github.com/#{user}/#{repo}.git #{checkout_dir}\")\n Rugged::Repository.new(checkout_dir)\n end\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(destdir, branch=nil)\n self.class.clone(self.repo, destdir, branch)\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_dir\n \"#{RdocInfo.config[:tmp_dir]}/#{@project.owner}/#{@project.name}/blob/#{@project.commit_hash}\"\n end", "def clone(*) end", "def clone(*) 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 clone_bare_repo(repo_dir_base, repo_name, value, using_install)\n puts \"#{'***'.cyan} fetching #{repo_name.green.bold}\"\n repo_dir = \"#{repo_dir_base}/#{repo_name}.git\"\n\n # using tag or branch ?\n if value.repo_type == GitRepoType::TAG\n git_target_head = VersionHelper.identify(value.version)\n elsif value.repo_type == GitRepoType::BRANCH\n git_target_head = value.branch\n else\n raise 'no target branch or tag?'\n end\n\n # check current repo had been cloned or not.\n if File.exist? repo_dir\n\n # check current git repo's status\n if RepoHelper.is_status?(repo_dir, git_target_head)\n case value.repo_type\n when GitRepoType::TAG\n value.hash = RepoHelper.current_status(repo_dir)\n when GitRepoType::BRANCH\n value.hash = RepoHelper.current_hash(repo_dir)\n else\n raise 'no target branch or tag?'\n end\n\n return\n end\n else\n # clone\n puts \"#{'***'.cyan} Cloning #{repo_name.green.bold}\"\n RepoHelper.clone_bare(repo_dir_base, value.url, repo_name, using_install, PanConstants.disable_verbose)\n end\n\n RepoHelper.reset_repo_config(repo_dir_base, repo_name, value.url)\n\n # fetch the commit hash value by using branch name or tags\n if value.repo_type == GitRepoType::TAG\n commit_hash = RepoHelper.clone_with_tag(\n repo_name,\n git_target_head,\n repo_dir_base,\n value.compare_method,\n PanConstants.disable_verbose\n )\n\n elsif value.repo_type == GitRepoType::BRANCH\n commit_hash = RepoHelper.clone_with_branch(\n repo_name,\n git_target_head,\n repo_dir_base,\n using_install,\n PanConstants.disable_verbose\n )\n else\n raise \"unknown repo type #{value.repo_type}\"\n end\n\n raise \"unknown branch or tag or commit #{value} and commit hash:#{commit_hash}.\" if value.repo_type == GitRepoType::BRANCH && commit_hash.length != 40\n raise \"unknown branch or tag or commit #{value} and commit hash:#{commit_hash}.\" if value.repo_type == GitRepoType::TAG && commit_hash.empty?\n\n # save the commit's SHA1 hash.\n value.hash = commit_hash.strip.freeze\n\n # print \"#{'***'.cyan} Fetch #{name.green.bold} Done.\\n\\n\"\nend", "def clone\n @clone = true\n 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(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend", "def git\n # log \"Thread.current[:repo] nil? \" + Thread.current[:repo].nil?.to_s\n Thread.current[:repo] ||= clone(ARGV[0], ARGV[1])\n Thread.current[:repo]\n end", "def clone(user, repo, update = false)\n\n def spawn(cmd)\n proc = IO.popen(cmd, 'r')\n\n proc_out = Thread.new {\n while !proc.eof\n logger.debug \"#{proc.gets}\"\n end\n }\n\n proc_out.join\n end\n\n checkout_dir = File.join(config(:cache_dir), \"repos\", user, repo)\n\n begin\n repo = Grit::Repo.new(checkout_dir)\n if update\n spawn(\"cd #{checkout_dir} && git pull\")\n end\n repo\n rescue\n spawn(\"git clone git://github.com/#{user}/#{repo}.git #{checkout_dir}\")\n Grit::Repo.new(checkout_dir)\n end\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 downloadAndCheckout\n if Dir.exist?(SRC_DIR)\n puts \"Already downloaded sane-projets/backends\"\n puts \"\"\n return\n end\n\n puts \"Cloning sane-projets/backends\"\n systemWithLog(\"git clone https://gitlab.com/sane-project/backends.git \\\"#{SRC_DIR}\\\"\")\n\n puts \"Checking out tag: #{GIT_TAG}\"\n systemWithLog(\"cd #{SRC_DIR}; git checkout \\\"tags/#{GIT_TAG}\\\"\")\n\n puts \"\"\nend", "def git_clone_latest(repo, dir)\n assert_system(\"git clone #{repo} #{dir}\") unless Dir.exist?(dir)\n Dir.chdir(dir) do\n assert_system('git pretty-pull')\n end\n end", "def fork_wiki(source, destination)\n # TODO:100 consider --bare\n `git clone \"#{@root}/#{source}\" \"#{@root}/#{destination}\"`\n $?.exitstatus == 0\n end", "def fetch_repository(payload)\n repo_path = repository_path(payload)\n if(File.directory?(repo_path))\n debug \"Pulling changes to: #{repo_path}\"\n repo = Git.open(repo_path)\n repo.checkout('master')\n repo.pull\n repo.fetch\n else\n debug \"Initiating repository clone to: #{repo_path}\"\n Git.clone(github_url(payload), repo_path)\n end\n repo_path\n end", "def setup_repo\n status(2) {\n setup_path\n if @type == 'full'\n Repository::Git.clone(@repo, @type)\n end\n Repository::Git.pull(@repo, @type)\n }\n end", "def clone_repo(repo, branch = 'master')\n # For the destination, stick it in a timestamped dir so if multiple builds\n # are going on, each has their own spot\n checkout_destination = Pathname(@@data_dir_location.to_s + (Time.now.utc.to_s + File::SEPARATOR))\n repo_name = Pathname(repo).basename.to_s.split('.')[0]\n repo_path = Pathname(checkout_destination.to_s + repo_name + File::SEPARATOR)\n FileUtils.mkdir_p(checkout_destination)\n Dir.chdir(checkout_destination) {\n system(\"git clone #{repo}\")\n }\n checkout_branch(repo_path, branch) unless branch.downcase.eql? 'master'\n return repo_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 fetch\n log.info(log_key) { \"Copying from `#{source_path}'\" }\n\n create_required_directories\n FileSyncer.sync(source_path, project_dir, source_options)\n # Reset target shasum on every fetch\n @target_shasum = nil\n target_shasum\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 setup_path\n if !@repo.clone_path.nil? and !@repo.clone_path.empty?\n Dir.chdir(@repo.clone_path)\n else\n initial_path_setup\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 create\n final_params = repository_params\n languages = Language.where(name: repository_params[:languages])\n final_params[:languages] = languages\n \n @repository = Repository.new(final_params)\n @uri = URI(@repository.repo_location)\n @repository.secret_path = SecureRandom.hex.to_s + @uri.path.split(\"/\").last.to_s\n @secret_path_to_clone_to = @repository.secret_path\n \n respond_to do |format|\n if @repository.save\n Git.clone(@uri, @secret_path_to_clone_to, :path => Rails.root.join(\"storage\", \"repositories\"))\n format.html { redirect_to @repository, notice: 'Repository was successfully created.' }\n format.json { render :show, status: :created, location: @repository }\n else\n format.html { render :new }\n format.json { render json: @repository.errors, status: :unprocessable_entity }\n end\n end\n end", "def fetch\n return nil if !repo || !user\n if fetched?\n pull\n else\n clone\n end\n end", "def perform(args = {})\n if repo_mirror_exists?\n update_mirror\n else\n clone_repo\n end\n end", "def convert_bare_to_working_copy\n notice 'Converting bare repository to working copy repository'\n FileUtils.mv(@resource.value(:path), tempdir)\n FileUtils.mkdir(@resource.value(:path))\n FileUtils.mv(tempdir, File.join(@resource.value(:path), '.git'))\n if commits?\n at_path do\n exec_git('config', '--local', '--bool', 'core.bare', 'false')\n reset('HEAD')\n git_with_identity('checkout', '--force')\n update_owner_and_excludes\n end\n end\n set_no_mirror if mirror?\n end", "def clone\n copy(false)\n end", "def clone\n @clone ||= super\n end", "def clone(source)\n local = get(source.name)\n local.init unless local.exists?\n local.clone(source)\n end", "def checkout\n name = @args.empty? ? ask('Repository') : @args.first\n repo = Unfuddle::Resources::Repository.find_by_abbr(name)\n unless repo.nil?\n path = ask('Path to checkout', :default => Dir.pwd)\n git_url = Unfuddle.account.git_url(name)\n shell(\"git clone #{git_url} #{path}\")\n else\n error 'Repository was not found'\n end\n end", "def clone(url, tag, dir)\n UI.section(\"Cloning #{url} of tag #{tag}.\") do\n git! ['clone', url, dir]\n Dir.chdir(dir) { git!('checkout', \"tags/#{tag}\") } if tag\n end\n end", "def clone(url, tag, dir)\n UI.section(\"Cloning #{url} of tag #{tag}.\") do\n git! ['clone', url, dir]\n Dir.chdir(dir) { git!('checkout', \"tags/#{tag}\") } if tag\n end\n end", "def clone(url, tag, dir)\n UI.section(\"Cloning #{url} of tag #{tag}.\") do\n git! ['clone', url, dir]\n Dir.chdir(dir) { git!('checkout', \"tags/#{tag}\") } if tag\n end\n end", "def cache # :nodoc:\n if File.exist? repo_cache_dir then\n Dir.chdir repo_cache_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags',\n @repository, 'refs/heads/*:refs/heads/*'\n end\n else\n system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',\n @repository, repo_cache_dir\n end\n end", "def init_repo\n @logger.info \"repository url: #{@repository[:url]}\"\n\n if FileTest.exist?(@repository[:path])\n @logger.info \"repository path exists: #{@repository[:path]}\"\n @rgit = Git.open(@repository[:path], :log => @logger)\n @logger.info @rgit.fetch\n else\n @logger.info \"repository path doesn't exist: #{@repository[:path]}\"\n # Create LogDevice to log to websocket message\n @rgit = Git.clone(@repository[:url], @repository[:name],\n :path => @work_dir,\n :log => @logger)\n end\n end", "def git_get(dir=nil)\n if dir.nil?\n directory = Dir.pwd\n else\n directory = dir\n end\n Dir.chdir(directory) do \n system('git clone https://github.com/offensive-security/exploit-database.git ~/src/exploit-db-git')\n end\nend", "def make_copy_of_repository\n false # true #false\nend", "def checkout # :nodoc:\n cache\n\n unless File.exist? install_dir then\n system @git, 'clone', '--quiet', '--no-checkout',\n repo_cache_dir, install_dir\n end\n\n Dir.chdir install_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags', install_dir\n\n success = system @git, 'reset', '--quiet', '--hard', @reference\n\n success &&=\n system @git, 'submodule', 'update',\n '--quiet', '--init', '--recursive' if @need_submodules\n\n success\n end\n end", "def clone\n self.copy\n end", "def clone\n self.copy\n end", "def cache # :nodoc:\n return unless @remote\n\n if File.exist? repo_cache_dir\n Dir.chdir repo_cache_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags',\n @repository, 'refs/heads/*:refs/heads/*'\n end\n else\n system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',\n @repository, repo_cache_dir\n end\n end" ]
[ "0.792636", "0.76736474", "0.7660962", "0.7287097", "0.727533", "0.7232853", "0.71718276", "0.71193147", "0.70960814", "0.70732236", "0.70732236", "0.7008809", "0.6984852", "0.69743824", "0.6964502", "0.69544554", "0.693982", "0.6895681", "0.68774205", "0.68405807", "0.6818411", "0.68173707", "0.67998314", "0.67881745", "0.67026126", "0.6671466", "0.666355", "0.6632459", "0.66126066", "0.66110575", "0.6592254", "0.6587123", "0.65846735", "0.6575003", "0.65450275", "0.65449244", "0.6543749", "0.6539925", "0.6526193", "0.6524543", "0.6506709", "0.65042186", "0.65042186", "0.65042186", "0.64921105", "0.64494", "0.6444807", "0.64348376", "0.6427455", "0.641602", "0.6414837", "0.64096516", "0.64095443", "0.64095443", "0.64095443", "0.64092314", "0.6398424", "0.6394406", "0.638327", "0.6382176", "0.6381317", "0.6381317", "0.6367836", "0.63656586", "0.6364266", "0.63553077", "0.63443655", "0.63347596", "0.6320802", "0.63109404", "0.63084716", "0.6305844", "0.62649643", "0.6251953", "0.6251189", "0.6229865", "0.62082225", "0.6195275", "0.61841285", "0.6182603", "0.61799914", "0.6172759", "0.616013", "0.613104", "0.61156905", "0.61057866", "0.60891014", "0.6085786", "0.6084699", "0.6060119", "0.6060119", "0.6060119", "0.6051682", "0.6047616", "0.6036276", "0.59959", "0.5987047", "0.5972554", "0.5972554", "0.59565514" ]
0.62559444
73
Stick the rmap onto disk
def write_rmap rmap end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nmap_save()\n print_status \"Nmap: saving nmap log file\"\n fh = self.nmap_log[0]\n nmap_data = fh.read(fh.stat.size)\n saved_path = store_local(\"nmap.scan.xml\", \"text/xml\", nmap_data, \"nmap_#{Time.now.utc.to_i}.xml\")\n print_status \"Saved NMAP XML results to #{saved_path}\"\nend", "def place_rover(r)\n @map[r.coordinate[0],r.coordinate[1]] = r\n end", "def persist_tiles\n reference_image_hash.each_pair do |char, image|\n puts \"saving to: #{filename_for_training_image(char, 'gif')}\"\n\n image.write(filename_for_training_image(char, 'gif'))\n end\n\n noise_image_hash.each_pair do |char, image|\n image.write(filename_for_noise_image(char, 'gif'))\n end\n end", "def write_osm(dir)\n @model.save(\"#{dir}/in.osm\", true)\n end", "def save_map(filename = nil)\n File.open(filename, 'w') do |file|\n store.each do |primary, emails|\n file.puts(\"#{primary},#{emails.join(';')}\")\n end\n end\n end", "def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end", "def sync\n AppMap.map(location, self)\n end", "def save\n das = []\n @map.each_key do |key|\n if key == DATAMATRIX_KEY\n das.concat save_data_matrix_alt(@object, @map[key])\n elsif @map[key].is_a? UploadAssoc\n # TODO: update this to lazy associate once aq is updated to hav lazy upload assoc (on master, just not on server yet)\n @object.associate(key, @map[key].tag, @map[key].upload)\n else\n das << @object.lazy_associate(key, @map[key])\n end\n end\n DataAssociation.import(das, on_duplicate_key_update: [:object]) unless das.empty?\n @object.save\n nil\n end", "def save_yml_test_case_map()\n new_test_case_map_path = self.class.test_case_map_path + '.new'\n yaml_content = @tc_id_map.to_yaml\n File.open(new_test_case_map_path, \"w:UTF-8\"){ |file| file.write(yaml_content) } if yaml_content\n FileUtils.mv(self.class.test_case_map_path, self.class.test_case_map_path + \".bak\")\n FileUtils.mv(new_test_case_map_path, self.class.test_case_map_path)\n end", "def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end", "def save_to(path)\n update\n Zip::OutputStream.open(path) do |out|\n zip.each do |entry|\n next unless entry.file?\n\n out.put_next_entry(entry.name)\n\n if @replace[entry.name]\n out.write(@replace[entry.name])\n else\n out.write(zip.read(entry.name))\n end\n end\n end\n end", "def write_disk_cache\n\t\t\t\tif File.exists?(\"#{$cache_path}/#{@host}_disks.yaml\")\n\t\t\t\t\t\t$log.info \"Doing backup of cachefile to #{@host}_disks.yaml\"\n\t\t\t\t\t\tFileUtils.mv(\"#{$cache_path}/#{@host}_disks.yaml\",\"#{$cache_path}/#{@host}_disks_backup.yaml\")\n\t\t\t\t\t\t@olddisks = YAML::load(File.read(\"#{$cache_path}/#{@host}_disks_backup.yaml\"))\n\t\t\t\tend\n\t\t\t\tFile.open( \"#{$cache_path}/#{@host}_disks.yaml\", 'w' ) do |out|\n\t\t\t\t\t\tYAML.dump(@disks,out)\n\t\t\t\tend\n\t\t\t\t$log.info \"Disk cache written for #{@host}\"\n\t\tend", "def save(path)\n update\n Zip::OutputStream.open(path) do |out|\n zip.each do |entry|\n out.put_next_entry(entry.name)\n\n if @replace[entry.name]\n out.write(@replace[entry.name])\n else\n out.write(zip.read(entry.name))\n end\n end\n end\n zip.close\n end", "def write_to_disk(path)\n path.dirname.mkpath unless path.dirname.exist?\n self.defined_in_file = path\n # rubocop:disable Lint/RescueException\n # rubocop:disable Lint/HandleExceptions\n begin\n existing = Lockfile.from_file(path)\n return if existing == self\n rescue Exception\n end\n path.open('w') { |f| f.write(to_yaml) }\n # rubocop:enable Lint/HandleExceptions\n # rubocop:enable Lint/RescueException\n end", "def repoint\n unless @rom && @table && @index\n fail 'Rom, table and index must be set before repointing.'\n end\n\n l = (@lz77 ? to_lz77.length : to_bytes.length)\n f_offset = @rom.find_free(l)\n\n unless f_offset\n fail \"Bytestream#repoint: Could not find #{l} bytes of free data in\" \\\n \" #{@rom}. Consider using a clean rombase.\"\n end\n\n @rom.write_offset_to_table(@table, @index, f_offset)\n clear_cache\n f_offset\n end", "def final_file_path\n \"#{@tmp_dir}/#{final_map_name}\"\n end", "def restore\n path = PathHelper.path(fid)\n begin\n $mg.store_file(dkey, classname, path)\n rescue => e\n raise e if $debug\n end\n end", "def save_to(path); end", "def addMarker f, m, mrk, t \n\tout = File.open(f,\"a\")\n\tout.puts \"Mk#{m}=Stimulus,#{mrk},#{t},0,0\" \n\tout.close\nend", "def create_featuremap()\n mindmap_path = @mindmap_path\n if mindmap_path != \"STDOUT\"\n while File.exists?(mindmap_path)\n filename_parts = mindmap_path.split(\".\")\n if filename_parts[0] =~ /-\\d+$/\n filename_parts = filename_parts[0].split(\"-\")\n mindmap_path = \"#{filename_parts[0]}-#{filename_parts[1].to_i + 1}.mm\"\n else\n mindmap_path = \"#{filename_parts[0]}-1.mm\"\n end\n end\n if mindmap_path != @mindmap_path\n @log.warn(\"given mindmap name is already in use, created #{mindmap_path}\")\n end\n begin\n IO.write(\"#{mindmap_path}\",\"\")\n rescue Exception\n @log.error(\"can't write to #{mindmap_path}\")\n @exit_status = 74\n return\n end\n end\n read_features(@features_path)\n if @exit_status == 0\n if mindmap_path != \"STDOUT\"\n mindmap_file = File.open(mindmap_path,\"w\")\n mindmap_file.write(@mindmap.to_s)\n mindmap_file.close\n else\n puts @mindmap.to_s\n end\n end\n end", "def nmap_set_log\n outfile = Rex::Quickfile.new(\"msf3-nmap-\")\n if Rex::Compat.is_cygwin and self.nmap_bin =~ /cygdrive/i\n outfile_path = Rex::Compat.cygwin_to_win32(outfile.path)\n else\n outfile_path = outfile.path\n end\n self.nmap_log = [outfile,outfile_path]\nend", "def write_raster_file(fn)\n raise(\"File not exist\") unless File.file?(fn)\n puts \"> oled-exp draw #{fn}\" if @verbose\n system(\"oled-exp\",\"draw\",fn)\n #sync_spawn(\"oled-exp\",@opt,\"draw\",fn) >> issue with file location...\n end", "def save!\n File.open(@config[\"state_file\"], \"r\") do |fl|\n fl.flock(File::LOCK_EX)\n\n sequence = (@state.key?(\"sequence\") ? @state[\"sequence\"] + 1 : 0)\n data_file = @config[\"data_dir\"] + format(\"/%03d/%03d/%03d.osm.gz\", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000))\n tmp_state = @config[\"state_file\"] + \".tmp\"\n tmp_data = \"/tmp/changeset_data.osm.tmp\"\n # try and write the files to tmp locations and then\n # move them into place later, to avoid in-progress\n # clashes, or people seeing incomplete files.\n begin\n FileUtils.mkdir_p(File.dirname(data_file))\n Zlib::GzipWriter.open(tmp_data) do |fh|\n fh.write(changeset_dump(open_changesets))\n end\n @state[\"sequence\"] = sequence\n File.open(tmp_state, \"w\") do |fh|\n fh.write(YAML.dump(@state))\n end\n\n # sanity check: the files we're moving into place\n # should be non-empty.\n raise \"Temporary gzip file should exist, but doesn't.\" unless File.exist?(tmp_data)\n raise \"Temporary state file should exist, but doesn't.\" unless File.exist?(tmp_state)\n raise \"Temporary gzip file should be non-empty, but isn't.\" if File.zero?(tmp_data)\n raise \"Temporary state file should be non-empty, but isn't.\" if File.zero?(tmp_state)\n\n FileUtils.mv(tmp_data, data_file)\n FileUtils.mv(tmp_state, @config[\"state_file\"])\n fl.flock(File::LOCK_UN)\n\n rescue\n STDERR.puts(\"Error! Couldn't update state.\")\n fl.flock(File::LOCK_UN)\n raise\n end\n end\n end", "def save\n prepare\n atoms_sorted = {}\n @atoms.each do |atom_name, records|\n e_p = encoded_prefix(atom_name)\n atoms_sorted[e_p] = {} if !atoms_sorted.has_key?(e_p)\n atoms_sorted[e_p][atom_name] = records\n end\n atoms_sorted.each do |e_p, atoms|\n #p \"Saving #{e_p}.\"\n File.open(File.join(@root + [e_p.to_s]),'w+') do |f|\n Marshal.dump(atoms,f)\n end\n end\n save_record_size\n end", "def flush\n flush_block unless @buffer.empty? \n process_hardlinks\n\n # writing the location of the archive (it's after the dump data)\n writeloc(@file, [@location].pack('V'), 0) \n\n indexloc = @location\n location = (sha1subset('FFFFFFFFFF', @idx_size) * 8) + indexloc\n # p = File.open(\"zlog\", \"w\")\n each_entry_with_index do |entry, idx|\n next if entry.nil? \n\n writeloc(@file, [location, entry.size].pack('V2'), (idx * 8) + indexloc)\n writeloc(@file, entry, location)\n\n # p << \"*\" * 80 << \"\\n\" \n # p << \"seek #{(idx * 8) + indexloc} location #{location} size #{entry.size}\" << \"\\n\"\n # p << unpack(entry).join(\":\") << \"\\n\"\n\n location += entry.size\n end\n\n # meta location\n writeloc(@file, [location, @compressor.method, @idx_size].pack('VCC'), 4)\n\n writeloc(@file, Marshal.dump(@meta), @location) if defined?(@meta)\n\n @file.close\n end", "def save\n MiGA.DEBUG \"Metadata.save #{path}\"\n self[:updated] = Time.now.to_s\n json = JSON.pretty_generate(data)\n sleeper = 0.0\n while File.exist?(lock_file)\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n FileUtils.touch lock_file\n ofh = File.open(\"#{path}.tmp\", \"w\")\n ofh.puts json\n ofh.close\n raise \"Lock-racing detected for #{path}.\" unless\n File.exist?(\"#{path}.tmp\") and File.exist?(lock_file)\n File.rename(\"#{path}.tmp\", path)\n File.unlink(lock_file)\n end", "def save\n ole = File.open(@file_name, 'w')\n ole << header\n ole << fat\n @storages.each { |s| ole << s.to_s }\n ole << Array.new((512-(ole.pos % 512)), 0).pack('c*')\n ole << mini_fat\n ole << mini_fat_stream\n ole << fat_stream\n ole.close\n end", "def map(uuid, delete = true)\n log(\"image map #{uuid}\")\n lock(:map) do\n delete ? @cache[:map].delete(uuid) : @cache[:map].fetch(uuid, nil)\n end\n end", "def after_save\n super rescue nil\n unless (@tempfile_path.nil? || @tempfile_path.empty?)\n stash_path = file_root(true)\n D::mkdir(stash_path) unless F::exist?(stash_path)\n @tempfile_path.each do |k,v|\n url = file_path(k, nil, true)\n destroy_files_for(k, url) # Destroy previously saved files\n FU.move(v, url) # Save the new one\n FU.chmod(0777, url)\n after_stash(k)\n end\n # Reset in case we access two times the entry in the same session\n # Like setting an attachment and destroying it in a row\n # Dummy ex: Model.create(:img => file).update(:img => nil)\n @tempfile_path = nil\n end\n end", "def persistent_to_quicksave\n p_file = File.open(File.join([self.path, 'persistent.sfs']), 'r'){|f| f.readlines}\n File.open(File.join([self.path, 'quicksave.sfs']), 'w'){|f| f.write(p_file.join)}\n end", "def save_match_to_file(fname)\r\n #fname_old_loc = File.expand_path(File.join( File.dirname(__FILE__) + \"/../..\",fname))\r\n fname_old_loc = fname\r\n File.open( fname_old_loc, 'w' ) do |out|\r\n YAML.dump( @info_match, out )\r\n end\r\n end", "def export path\n File.write path, to_zonefile\n end", "def save!; File.write @path, @data end", "def sync!(source_templatemap)\n self.sync(source_templatemap)\n self.save\n end", "def autorestore; end", "def rezip_dictfile(dict)\n ext = File.extname(dict)\n basename = File.basename(dict, ext)\n if ext == \".dsl\"\n dict_content = File.read(dict)\n File.rename(dict, dict + \".bak\")\n File.open(dict, 'wt', encoding: 'UTF-16LE') do |dsl|\n dsl << dict_content\n end\n `dictzip #{dict}`\n puts \" Processed #{basename}\"\n end\nend", "def persist\n settings = {\n area: @focus[:key]\n }\n File.open(@path, 'w') do |file|\n file.write settings.to_yaml\n end\n end", "def save\n return if self.mapping.present? # already saved that file\n validate_object(self.object)\n\n debug \"Sending file to master in Uv::Storage::File#save\"\n\n raise FileObjectMissing.new if self.raw_file.blank?\n\n @result = self.connection.create(self.raw_file, uv_access_level(self.options['access_level']))\n\n self.mapping = Uv::Storage::FileMapping.new(\n :nodes => @result['node_domains'],\n :file_path => @result['path'],\n :access_level => uv_access_level(@result['access_level']),\n :object_name => self.object.class.to_s.downcase,\n :object_identifier => self.object.id,\n :identifier => self.options['identifier']\n )\n\n debug \"Trying to save mapping in Uv::Storage::File#save\"\n debug self.mapping\n\n raise ActiveRecordObjectInvalid.new() unless self.mapping.valid?\n\n return self.mapping.save\n end", "def rebase_map(old_vma, new_vma)\n m = @maps[old_vma]\n raise(\"VMA %X not found!\" % [old_vma]) if ! m\n check_map_overlap(new_vma, m.size)\n m.vma = new_vma\n @maps[new_vma] = m\n remove_map(old_vma)\n end", "def update\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: @map }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end", "def gen_heatmap_datafile\n f = File.open(\"heatmap.dat\", \"w\")\n @sectors.each do |sector|\n sector.cinrs.each do |data|\n coord = data.first\n cinr = data.last\n f.write \"#{coord.x} #{coord.y} #{cinr}\\n\"\n end\n end\n end", "def write\n return false unless @path\n\n clean!\n\n @path.open('w') do |file|\n file.puts YAML.dump(@cache)\n end\n\n true\n end", "def write(location, raw_data)\n SitemapGenerator::FileAdapter.new.write(location, raw_data)\n\n create_bucket unless bucket_exists?\n put_sitemap(location)\n end", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def move_disk(from,to)\n @towers[to] << @towers[from][-1]\n @towers[from].pop\n nil\nend", "def sync\n return if @no_sync\n File.open( @filename, \"w\" ) do |f|\n Marshal.dump( @hash, f )\n end\n end", "def do_and_save_fits\n\n image_objects = load_or_fit_image_objects\n\n FileInteraction.write_position_data(image_objects, @parameters)\n\n image_objects\n\n end", "def write(path)\n @img_rw.rch = @rch\n @img_rw.gch = @gch\n @img_rw.bch = @bch\n @img_rw.write(path)\n end", "def after_write_path; end", "def run\n copy_map = copy_map()\n\n mkpath target.to_s\n return false if copy_map.empty?\n\n copy_map.each do |path, source|\n dest = File.expand_path(path, target.to_s)\n if File.directory?(source)\n mkpath dest\n else\n mkpath File.dirname(dest)\n if @mapper.mapper_type\n mapped = @mapper.transform(File.open(source, 'rb') { |file| file.read }, path)\n File.open(dest, 'wb') { |file| file.write mapped }\n else # no mapping\n cp source, dest\n end\n end\n File.chmod(File.stat(source).mode | 0200, dest)\n end\n touch target.to_s\n true\n end", "def write(location, raw_data)\n SitemapGenerator::FileAdapter.new.write(location, raw_data)\n directory = File.dirname(location.path_in_public)\n if directory != '.'\n self.store_dir = directory\n end\n store!(open(location.path, 'rb'))\n end", "def create_mapfile(clean)\n analyze = PodsSpecification.instance.analyze\n targets = analyze.targets\n pod_targets = analyze.pod_targets\n return if Pods.clean_hmap_setting(clean, targets, pod_targets)\n\n merge_all_pods_target_headers_mapfile(pod_targets)\n merge_all_target_public_headers_mapfile(targets)\n end", "def stash_payload location \n io = Kernel.open(location)\n\n case io\n when File\n file = io\n else\n bsiz = 4096\n file = Tempfile.new('foo')\n loop do\n f.write(file.read(bsiz))\n end rescue EOFError\n end\n\n hash = payload_id(file)\n ppath = payload_path(hash.to_s)\n\n return ppath if File.exists? File.expand_path('ORIGINAL', ppath)\n\n # location\n # multipart?\n\n last_pwd = Dir.getwd\n\n Dir.chdir(ppath) do\n case file \n when File\n FileUtils.ln_s File.expand_path(io.path, last_pwd), File.expand_path('ORIGINAL')\n when Tempfile\n FileUtils.mv file.path, File.expand_path('ORIGINAL')\n end\n\n FileUtils.touch('manifest.txt')\n checkm = Checkm::Manifest.new(File.new('manifest.txt'), :fields => Checkm::Manifest::BASE_FIELDS + [:transformer])\n checkm.add 'ORIGINAL', :alg => 'md5', :digest => hash.to_s, :transformer => 'original'\n checkm.save\n end\n\n ppath\n end", "def put(position)\n # don't update unless position has changed\n if position != @last_position_written\n pos_file = File.open(@position_file, \"w\")\n pos_file.write(\"#{position}\\n\")\n pos_file.close\n @last_position_written = position\n end\n end", "def restore_from_disk\n log(\"Loading Data in...\")\n\n if File.directory?('buckets') then\n entries = Dir.entries(\"buckets\").collect do |f| f unless f.match(\"bucket\").nil? end.compact\n\n entries.each do |e|\n File.open(\"buckets/\" + e) do |f|\n @contents = Marshal.load(f)\n end\n\n buckets[\"#{e.gsub(\".bucket\", \"\")}\"] = @contents\n\n end\n\n end\n\n end", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n f.write(decoded_image)\n f.close if f\n\n end", "def setup_save_position(_speed = 0)\n @saved_position = [@map_char.real_x, @map_char.real_y, _speed]\n end", "def write(location, raw_data)\n SitemapGenerator::FileAdapter.new.write(location, raw_data)\n\n storage = Fog::Storage.new(@fog_credentials)\n directory = storage.directories.new(:key => @fog_directory)\n directory.files.create(\n :key => location.path_in_public,\n :body => File.open(location.path),\n :public => true\n )\n end", "def load(existing_map_data, size_x)\n @data = existing_map_data\n @size_x = size_x\n end", "def update_map!(key)\n @map.set(key, @store.last)\n end", "def restore; end", "def tmpSaver (chemin)\n File.open(chemin, \"wb\") { |f| f.write(Marshal.dump(@dico) ) }\n @dico = Marshal.load( File.binread(chemin) )\n end", "def flush\n File.open(\"data/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n File.open(\"data2/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n puts \"=\"\n end", "def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end", "def config_write\n # Putting it in a format that zfm can also read and write\n f1 = File.expand_path(CONFIG_FILE)\n hash = {}\n hash['DIRS'] = @used_dirs.select { |dir| File.exist? dir }\n hash['FILES'] = @visited_files.select { |file| File.exist? file }\n # NOTE bookmarks is a hash and contains FILE:cursor_pos\n hash['BOOKMARKS'] = @bookmarks # .select {|file| File.exist? file}\n writeYML hash, f1\n @writing = @modified = false\n message \"Saved #{f1}\"\nend", "def add_index_maps(layer, druid, rootdir)\n doc = Nokogiri::XML(File.read(File.join(rootdir, 'metadata', 'contentMetadata.xml')))\n return unless doc.search('//file[@id=\\'index_map.json\\']').length > 0\n\n refs = JSON.parse(layer.metadata['dct_references_s'])\n refs['https://openindexmaps.org'] = \"#{Settings.stacks.url}/file/druid:#{druid}/index_map.json\"\n layer.metadata['dct_references_s'] = refs.to_json\n end", "def record_save\n # Load mapinfo for map name\n mapinfos = load_data(\"Data/MapInfos.rxdata\")\n # Make the filename\n if Wep::Random_file_name and Wep::Modify_game_system\n filename = Wep::Game_version+\"-\"+$game_system.random_filename+\"-\"+Wep::Save_record_name\n else\n filename = Wep::Game_version+\"-\"+Wep::Save_record_name\n end\n estado = open(filename, \"a\")\n estado.write(\"------------------------------------------\\n\")\n estado.write(\"||||\"+Wep::Save_name+\" \"+($game_system.save_count+1).to_s+\"||||\")\n estado.write(\"\\n------------------------------------------\\n\") \n # Write time\n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n text = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n tiempo = \"\\nPlaytime: \"\n tiempo+= text\n estado.write(tiempo)\n # Write money\n money = \". Money: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write actual map(and name)\n estado.write(\". Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\\n\")\n if Wep::Record_saves_actors\n if Wep::Record_saves_all_actors == false\n for actor in $game_party.actors\n estado.write(\"\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n\")\n end\n else\n \n for i in 1...$data_actors.size\n estado.write(\"\\n\"+$game_actors[i].name+\" (\"+$data_classes[$game_actors[i].class_id].name+\") Nv\"+$game_actors[i].level.to_s+\"\\n\")\n end\n \n end\n end\n estado.write (\"\\n\")\n estado.close\n end", "def reserve\n FileUtils.touch(self.cache_dir + self.local_filename)\n end", "def purge!\n @map = {}\n end", "def map\n lines = @board.report.split(\"\\n\")\n lines[lines.size - 1 - @y][@x] = 'R'\n lines.join(\"\\n\")\n end", "def save_moves\n\t\tFile.open(@filename, 'w') {|f| f.write(@past_moves.to_yaml)}\n\tend", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def export_mindmap\n\t\treturn false if @current_search == {phrase: \"\", thumbnail: nil}\n\t\treturn false unless @current_search[:thumbnail]\n\n\t\ttarget_file = ask_save_file\n\t\treturn false unless target_file && target_file != \"\"\n\t\t@data_controller.render_picture(\n\t\t\t@current_search[:phrase],\n\t\t\t@data_controller.look_for(@current_search[:phrase]),\n\t\t\ttarget_file,\n\t\t)\n\tend", "def store\n File.store(uuid)\n end", "def write\n FileUtils.mkdir_p File.dirname(destination_path)\n File.open(destination_path, 'w') { |f| f.write(sitemap_content) }\n end", "def reset_output_map; @output_map = nil; end", "def pre_sync\n #move\n end", "def save\n File.open(path, 'w+') { |f| f.write(to_rb + \"\\n\") }\n end", "def save\n File.binwrite(file, JSON.pretty_generate(@cache))\n end", "def create\n @map = Map.new(map_params)\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def put key, value\n # append value to open file\n # write new keydict value\n @keydict[key] = write_data_entry key, value\n\n # sync\n\n if @data_file.size > MAX_FILE_SIZE\n fname = @data_file.path\n @data_file.close\n @data_file = open_new_data_file\n @old_data_files[fname] = File.open(fname, \"rb\")\n end\n end", "def save_to_file\n f = File.open(\"#{IMAGE_DATA_DIR}/#{self.id}\",\"w\")\n f.write(self.data)\n f.close\n end", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def restore_archive\n end", "def write_cache\n data = cache_data\n open(writable_file, \"wb\") do |f|\n\tf.puts Marshal.dump(data)\n end\n end", "def save_brins\n brins_file.write( Marshal.dump(brins))\n update_all_data_in_file\n end", "def save(filename = nil)\n filename ||= File.join(Ironfan.cluster_path.first, \"#{cluster_name}.rb\")\n Chef::Log.debug(\"Writing cluster meta info into #{filename}\")\n File.open(filename, 'w').write(render)\n\n self\n end", "def unsafe_save(namespace, key, data)\n path = make_path(namespace, key)\n tmp = Tempfile.new('abbey') \n size = tmp.write(MultiJson.encode(data))\n tmp.close\n FileUtils.mv(tmp.path, path)\n settings.logger.info(\"Written #{make_key(namespace, key)} (size: #{size})\")\n tmp.unlink\n end", "def dumpme!(filename)\n File.unlink(filename) if File.exists?(filename)\n File.open(filename, \"w\") {|f| f << Marshal.dump(self)}\n end", "def write_out_raw\r\n new_filepath = temp_filename(file_name, DIL::Application.config.processing_file_path)\r\n File.open(new_filepath, 'wb') do |f|\r\n f.write raw.content\r\n end\r\n Sidekiq::Logging.logger.debug(\"New filepath:\" + new_filepath)\r\n FileUtils.chmod(0644, new_filepath)\r\n new_filepath\r\n end", "def write()\n\t\tdata = {\"rows\"=>@rows, \"cols\"=>@cols , \"moves\"=>@moves , \"time\"=> @time, \"nbGames\" => @nbGames}\n\t\tFile.open(@path, \"w\") {|out| out.puts data.to_yaml }\n\t\treturn self\n\tend", "def autosave; end", "def create_data_space_map\n v_stream = [8,1,104, 1,0, 32, \"EncryptedPackage\".bytes.to_a, 50, \"StrongEncryptionDataSpace\".bytes.to_a].flatten!.pack DATA_SPACE_MAP_PACKING \n Storage.new('DataSpaceMap', :data=>v_stream, :left => 4, :right => 6, :size=>v_stream.size)\n end", "def relocate_arena(new_location)\n @arena = new_location\n end", "def store_file(key, klass, file)\n raise MogileFS::ReadOnlyError if readonly?\n\n new_file key, klass do |mfp|\n if file.respond_to? :sysread then\n return sysrwloop(file, mfp)\n else\n\tif File.size(file) > 0x10000 # Bigass file, handle differently\n\t mfp.big_io = file\n\t return\n\telse\n return File.open(file, \"rb\") { |fp| sysrwloop(fp, mfp) }\n end\n end\n end\n end", "def save_match_file\n if match_x && match_y\n end_x = match_x + template_image.columns\n end_y = match_y + template_image.rows\n\n area = Magick::Draw.new\n area.fill('none')\n area.stroke('red')\n area.stroke_width(3)\n area.rectangle(match_x, match_y, end_x, end_y)\n area.draw(search_image)\n search_image.write(matchfile)\n end\n end", "def old_flush!\n keys, filename = save_keys\n push_to_s3!(filename) if @save_to_s3\n delete!(keys)\n end", "def create_tileindex(custom_path=nil)\n logger.info(\"create tileindex\")\n tileindex = custom_path || tileindex_path\n unless self.maps.warped.empty?\n delete_tileindex(tileindex)\n map_list = \"\"\n #only make a tileindex if the maps are warped. \n self.maps.warped.each {|map| map_list += (map.warped_filename + \" \")}\n command = \"gdaltindex -write_absolute_path #{tileindex} #{map_list}\"\n logger.info(command)\n\n stdin, stdout, stderr = Open3::popen3(command)\n out = stdout.readlines.to_s\n err = stderr.readlines.to_s\n\n if !err.match(\"ERROR 4: Unable to open #{tileindex}\").nil? || err.size <= 0 #error saying \"Unable to open spec/fixtures/maps/deleteme.shp\" is actually okay!!\n result= true\n else\n logger.error(\"ERROR with gdaltindex \"+ err)\n result= false\n end\n else\n result= false\n end\n \n result\n end" ]
[ "0.6154629", "0.56928957", "0.5682441", "0.5649068", "0.5532678", "0.54314995", "0.53476137", "0.5338205", "0.53369904", "0.5307179", "0.5303931", "0.5278246", "0.52771723", "0.5268454", "0.5267135", "0.52585363", "0.52557874", "0.5237185", "0.52332973", "0.52055043", "0.5194463", "0.518287", "0.51805204", "0.5148849", "0.5145724", "0.5130233", "0.51156163", "0.5101046", "0.5099987", "0.50971395", "0.5081931", "0.50717044", "0.5066531", "0.5048901", "0.50415045", "0.5032788", "0.50316584", "0.50289917", "0.5011216", "0.5009563", "0.5009288", "0.49994925", "0.49946907", "0.4985487", "0.49821803", "0.49821803", "0.49814758", "0.49697667", "0.49592152", "0.49428308", "0.49175152", "0.49149787", "0.4908436", "0.49013528", "0.48968422", "0.4896356", "0.4895659", "0.48843977", "0.48806173", "0.48805076", "0.4867748", "0.48632136", "0.48589984", "0.4858219", "0.48492816", "0.4838725", "0.4836825", "0.48357177", "0.48311839", "0.48309487", "0.48287177", "0.48223412", "0.48215598", "0.4821527", "0.4817896", "0.48084247", "0.4806601", "0.47949556", "0.4794016", "0.47924438", "0.47911373", "0.47906652", "0.47817692", "0.4781339", "0.47732913", "0.47584084", "0.4756507", "0.47432682", "0.47385302", "0.47356683", "0.47316113", "0.47276896", "0.47223508", "0.47207183", "0.47178936", "0.47158724", "0.47136348", "0.47131264", "0.47060207", "0.4702011" ]
0.6827883
0
For javascript adding deleting reminders
def remove_link f icon = image_tag 'subtract.gif', :class => 'icon' if f.object.new_record? link_to_function(icon, "$(this).up('.#{f.object.class.name.underscore}').remove()", :title => "Remove") else f.hidden_field(:_delete) + link_to_function(icon, "$(this).up('.#{f.object.class.name.underscore}').hide(); $(this).previous().value = '1'", :title => "Remove") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @reminder = @user.reminders.find(params[:id])\n return error_status(true, :cannot_delete_reminder) unless (@reminder.can_be_deleted_by(@logged_user))\n @reminder.updated_by = @logged_user\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to(reminders_url) }\n format.js\n format.xml { head :ok }\n end\n end", "def destroy\n @reminder.destroy\n respond_to do |format|\n format.html { redirect_to reminders_url, notice: 'Lembrete excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\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.json { head :no_content }\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.json { head :no_content }\n end\n end", "def destroy\n\t\t@reminder = Reminder.find(params[:id])\n\t\t@reminder.destroy\n\n\t\tredirect_to :back, :alert => \"A reminder has been removed\"\n\tend", "def destroy\n @reminder.destroy\n respond_to do |format|\n format.html { redirect_to reminders_url, notice: 'Reminder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder.destroy\n respond_to do |format|\n format.html { redirect_to reminders_url, notice: \"Reminder was successfully destroyed.\" }\n format.json { head :no_content }\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 delete\n @event = Event.find(params[:id])\n @user = current_user\n @event.users.delete(@user) \n \tredirect_to reminders_path(:id => current_user.id), :notice => I18n.t(:reminders_delete)\n end", "def destroy\r\n @reminder = Reminder.find(params[:id])\r\n item = @reminder.expense.item\r\n @reminder.destroy\r\n flash[:notice] = 'Reminder for the expense ' + item + ' has been removed.'\r\n redirect_to :back \r\n end", "def destroy\n @email_reminder.destroy\n @email_reminders = EmailReminder.all\n redirect_to email_reminders_path\n end", "def destroy\n @user_reminder = UserReminder.find(params[:id])\n @user_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reminders_url) }\n format.xml { head :ok }\n end\n end", "def add_reminder; end", "def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@event_event.destroy\n @event_event.deleted = true\n dest = @event_event.id\n type = 7 #event_notifications_code\n Notification.clear_notifications(type,dest)\n @event_event.save\n @event_event.user.remove_event\n respond_to do |format|\n format.html { redirect_to admin_event_events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def reminder\n\n end", "def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('reminder', 'delete', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def deleting_reminder()\n prompt = TTY::Prompt.new\n self.opening_reminder()\n prompt.ok(\"Which of them you want to delete (e.g.) 1 - 10 first one at the top.\")\n reminder_delete_input = gets.chomp.to_i\n if reminder_delete_input.between?(1, @list_reminder.length)\n @list_reminder.slice!(reminder_delete_input.to_i - 1)\n box = TTY::Box.warn(\"Are you sure you want to delete?\")\n print box\n user_input = prompt.ask(\"Press Y / N then hit Enter\", required: true) \n if user_input == \"y\"\n File.open(\"@list_reminder.yml\", \"w\") { |file| file.write(@list_reminder.to_yaml) }\n box = TTY::Box.success(\"Journal Deleted\")\n print box\n pause\n else\n deleting_reminder \n end\n else \n box = TTY::Box.error(\"Invalid Choice\")\n print box\n pause \n end \n end", "def destroy\n @reminder_task_list = ReminderTaskList.find(params[:id])\n @reminder_task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(reminder_task_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @email_reminder.destroy\n respond_with @email_reminder\n end", "def destroy\n if !session[:user_id]\n flash[:notice] = \"You are not a valid user. Please Login to continue.\"\n redirect_to \"/home\"\n else\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n \n respond_to do |format|\n flash[:notice] = \"Reminder was successfully deleted\"\n format.html { redirect_to \"/reminder\" }\n format.xml { head :ok }\n end\n end\n end", "def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end", "def destroy\n @exercise_modification.destroy\n respond_to do |format|\n format.html { redirect_to @exercise_modification.timetable_modification.calendar.therapy, notice: 'Exercise modification was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render \"timetable_modifications/reload_timetable_modification\", locals: {timetable_modification: @exercise_modification.timetable_modification, beginning_date: @exercise_modification.date} }\n end\n end", "def destroy\n @todo.destroy\n respond_to do |format|\n format.js\n end\n end", "def destroy\n task_day = current_user.tasks.find(params[:id]).task_day\n @tasks = current_user.tasks.where(task_day: task_day)\n @task.destroy\n respond_to do |format|\n format.js { render 'tasks/task_update' }\n end\n end", "def destroy_multiple\n Remind.destroy(params[:reminds])\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Reminder(s) was deleted.' }\n format.json { head :no_content }\n end\n end", "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "def delete_event\n UserMailer.delete_event\n end", "def destroy\n @reminder_phrase = ReminderPhrase.find(params[:id])\n @reminder_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to reminder_phrases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n System::Renewal.delayed_event_delete_cascade_renewal(@system_renewal.id) \n System::Renewal.event_delete_cascade_renewal(@system_renewal.id)\n puts 'AKI VA EL ID DE LA RENOVACION QUE SE ESTA ELIMINANDO-||||||||||||||||||||||||||||||||||||||||'\n puts @system_renewal.destroy\n puts 'AKI VA EL ID DE LA RENOVACION QUE SE ESTA ELIMINANDO-|||||||||||||||||||||||||||||||||||||||'\n respond_to do |format|\n format.html { redirect_to system_renewals_url, notice: 'Renewal was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render :js => \"window.location = '/system/renewals'\" }\n end\n end", "def destroy\n \n \n #remove notification \n #remove plots \n\n\n if current_user.id==@tale.user_id\n notifications = Journal.where(notification_type: \"StoryCreate\", notification_id: @tale.id)\n notifications.each do|notification|\n notification.delete\n end \n\n\n @tale.destroy\n\n\n\n\n\n\n respond_to do |format|\n #format.html { redirect_to tales_url }\n format.html { redirect_to profiles_index_path(current_user.id) }\n format.json { head :no_content }\n end\n end\n\n\n end", "def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end", "def reminder_sent\n end", "def destroy\n @event_recurrence.destroy\n respond_to do |format|\n format.html { redirect_to event_recurrences_url, notice: 'Event recurrence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def insert_delete_instant_messenger_link(form)\n # If it's a new record it will remove only the html,\n # otherwise it will request record deletion using Ajax\n if form.object.new_record?\n link_to_function t('instant_messengers.helper.delete',\n :default => 'Delete'),\n \"$(this).parents('li.instant_messenger').remove()\", :class => :red\n else\n link_to_remote t('instant_messengers.helper.delete',\n :default => 'Delete'), :url => form.object,\n :confirm => t('instant_messengers.helper.delete_confirmation',\n :default => 'Are you shure?'),\n :method => :delete, :html => { :class => :red }\n end\n end", "def destroy\n @agenda = Agenda.find(params[:id])\n @agenda.destroy\n respond_to do |format|\n format.js\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.js\n end\n end", "def destroy\n id = params[:id]\n has_use = EventSchedule.where(schedule_id: id).exists?\n if has_use\n @notice = {status: false, message: '该赛程已经被使用,不能删除'}\n else\n @schedule = Schedule.find_by_id(id)\n if @schedule && @schedule.destroy\n @notice = {status: true, id: @schedule.id, message: '删除成功'}\n else\n @notice = {status: false, message: '删除失败'}\n end\n end\n\n respond_to do |format|\n format.html { redirect_to admin_schedules_url, notice: '赛程删除成功.' }\n format.json { head :no_content }\n format.js\n end\n end", "def delete\n admin_only do\n \t# get the schedule object to be deleted.\n handle_recurring_schedule_failure 'remove', 'removed' do\n @test = get_test_with_rescue\n @test.destroy!\n flash[:success] = \"Recurring Test Run Removed\"\n end\n redirect_to action: \"index\"\n end\n end", "def delete_calendar(calendar_id)\n end", "def delete_detail\n retire_note = RetireNote.find(params[:id])\n if $details.include?(retire_note)\n $details.delete(retire_note)\n end\n respond_to do |format|\n format.js\n end\n end", "def destroy\n reminder = @reminder_rule.reminder\n @reminder_rule.destroy\n CountAllocator.new(reminder).allocate!\n\n respond_to do |format|\n format.html { redirect_to reminder, notice: 'Reminder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recurso_orden.destroy\n respond_to do |format|\n format.js\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n broadcast '/notes/destroy', %Q/ { \"nickname\" : \"#{current_user.nickname}\" } /\n\n cookies[:offset] = cookies[:offset].to_i - 1\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.js\n end\n end", "def cron_del(type)\n cmd = \"{\\\"id\\\":14,\\\"method\\\":\\\"cron_del\\\",\\\"params\\\":[#{type}]}\\r\\n\"\n request(cmd)\n end", "def delete_added_group_user\n @nsu = NonSiteUser.find(params[:id])\n @group = DiscussionGroup.find(@nsu.invitable_id) if @nsu.invitable_type==\"DiscussionGroup\" && @nsu.invitation_type==\"Added\"\n @message = @group && !@group.is_public ? ( @nsu.destroy ? \"Success\" : nil) : \"Failure\"\n respond_to do |format|\n format.js { render :text => @message }\n end\n end", "def delete_note(note)\n logger.info \"Deleting note '#{note.id}'\"\n expand_note note\n wait_for_update_and_click delete_note_button(note)\n wait_for_update_and_click confirm_delete_button_element\n note.deleted_date = Time.now\n end", "def destroy\n @reclamation = Reclamation.find(params[:id])\n customer = @reclamation.customer\n @reclamation.destroy\n respond_to do |format|\n format.js {render inline: \"location.reload();\" }\n end\n end", "def destroy\n @notificacao.destroy\n respond_to do |format|\n format.html { redirect_to notificacoes_url, notice: 'Notificacao foi removido do sistema.' }\n format.json { head :no_content }\n end\n end", "def delete_Notification\n dest = Notification.where(id: params[:idNotification]).first\n if (dest) \n Notification.where(id: params[:idNotification]).destroy_all\n render json: { status: 'SUCCESS', message: 'ELIMINACION EXITOSA'}, status: :ok\n else\n render json: { status: 'INVALID', message: 'NOTIFICACION NO ENCONTRADA'}, status: :unauthorized\n end\n end", "def destroy\n @interview.destroy\n participants = @interview.participants\n emails = []\n participants.each do |p|\n emails += [p.email]\n ReminderMailer.cancel_email(p.email).deliver_now\n end\n respond_to do |format|\n format.html { redirect_to interviews_url, notice: 'Interview 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 reminder\n DateEventApplicationsMailer.reminder\n end", "def delete\n \n end", "def destroy\n @event = Event.find(params[:id])\n @notice=Notice.new\n @notice.note=\"Admin Has Deleted your Event : \" +@event.title.to_s+\" For Being inappropriate, This was done During \"+Time.now.to_s\n @notice.user_id =@event.user_id\n @notice.save\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to adminhome_events_path }\n format.json { head :ok }\n end\n end", "def deleteForEvent\n deleteEventNotifications(current_user.id, params[:eid])\n end", "def destroy\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.find(params[:id])\n @notificaciones_admin_actualouse.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def delete_note id\n @nimble.delete \"contact/notes/#{id}\"\n end", "def add_reminder(event, reminderMinutes, reminderMethod)\r\n event[:reminders] = event[:reminders].to_s + \r\n \"<gd:reminder minutes='#{reminderMinutes}' method='#{reminderMethod}' />\\n\"\r\n end", "def destroy\n\n @notifications = Notification.where(item_id: @vacante_aplicada.id).unviewed #destrir todas las notificaciones que sean de esta vacante\n if(@notifications)\n @notifications.destroy_all #destruye todas las notificaciones que tengan que ver con esta vacante\n end\n\n @vacante_aplicada.destroy\n respond_to do |format|\n format.html { redirect_to vacante_aplicadas_url, notice: 'Vacante aplicada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_to_do = ListToDo.find(params[:id])\n @list_to_do.destroy\n\n respond_to do |format|\n format.html { redirect_to new_list_to_do_path }\n format.js\n format.json { head :no_content }\n end\n end", "def destroy\n @respostum = Respostum.find(params[:id])\n @respostum.destroy\n\n respond_to do |format|\n format.html { redirect_to(resposta_url) }\n format.js\n end\n end", "def send_deletion_notification\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n Notification.create(:user => @tutor, :receiver_id => @student.id, :message => @tutor.title + ' has removed you from their student list')\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def deleted\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def delete_notification\n\n @greeting = \"Hi\"\n\n mail to: \"seekle.info@gmail.com\",subject:\"ユーザー退会した!\"\n \nend", "def delete_message_by_restaurant\n root_id = @parsed_json[\"message_id\"] if @parsed_json[\"message_id\"]\n check = Notifications.where(\"id=?\", root_id.to_i).first\n if check.nil?\n render :status=>412, :json=>{:status=>:failed, :error=>\"Not exist this message\"}\n else\n sql =\"notifications.alert_type != 'Publish Menu Notification' AND notifications.id=? OR notifications.reply=?\"\n notifications = Notifications.where(sql, root_id.to_i,root_id.to_i)\n for i in notifications\n i.update_attributes(:is_show=>0, :is_show_detail=>0)\n end\n render :status=>200, :json=>{:status=>:success}\n end\n end", "def destroy\n# @event_indicator_relationship = EventIndicatorRelationship.find(params[:id])\n# @event_indicator_relationship.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.event_custom_view'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_event_indicator_relationships_url }\n format.json { head :ok }\n end\n end", "def on_refresh\n removed = []\n @reminders.each do |r|\n if r.remind?\n r.remind\n removed.push(r)\n end\n end\n\n unless removed.empty?\n removed.each do |reminder|\n @reminders.delete(reminder)\n end\n end\n end", "def reminder\n UsersMailer.reminder\n end", "def destroy\n @admin_cron_request.destroy\n respond_to do |format|\n format.html { redirect_to admin_cron_requests_url, notice: I18n.t('admin.cron_requests.destroy.message.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @task.destroy\n respond_to do |format|\n format.js\n end\n end", "def delete\n newTodos = []\n\n @@allTodos.each { |item|\n if item['id'] != @id\n newTodos.push(item)\n end\n }\n\n @@allTodos = newTodos\n Todo.presist_data\n end", "def destroy\n @incrustation_tmp = @incrustation.dup\n @incrustation.destroy\n record_activity(@incrustation_tmp)\n respond_to do |format|\n format.html { redirect_to admin_incrustations_url, notice: 'Вставка была успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.status_id = Status.find_by_title('trash').id\n @task.deleted_at = Time.now\n @task.save\n \n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def delete \n @todo = Todo.find(params[:id])\n if @todo != nil\n# @deletedTodoTime = @todo.limit_datetime\n @todo.destroy\n end\n render :partial => 'delete'\n end", "def destroy\n @week = @note.week\n @note.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Note was successfully destroyed.' }\n format.js { render :template => 'notes/destroy.js.erb' }\n end\n end", "def reminder\n RequestMailer.reminder\n end", "def destroy\r\n @solicitudlabexa = Solicitudlabexa.find(params[:id])\r\n CorreoTecnicos::emitesolicitudexamen(@solicitudlabexa,params[:fecha],\"Solicitud cursada por admin\",\"Borrado de \").deliver_later \r\n\r\n @solicitudlabexa.destroy\r\n\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(solicitudlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def remove_link\n # cocoon JS needs class specifically remove_fields.dynamic, just treat em all\n # like dynamic, it seems okay.\n template.link_to(I18n.t(\"kithe.repeatable_input.remove\"), '#', class: \"remove_fields dynamic btn btn-secondary\")\n end", "def destroy\n @notificacione.destroy\n respond_to do |format|\n format.html { redirect_to notificaciones_url, notice: 'Notificacione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_task\n \t@task = Task.find(params[:id])\n \t@task.destroy\n \t@demo = Demo.find(@task.demo_id)\n\n respond_to do |format|\n format.js { render 'demo/delete_task' }\n end\n end", "def delete_dosing_factor()\n delete.click\n modal_delete_factor.click\n end", "def deleteEventNotifications(u, e)\n @ns = getEventNotifications(u, e)\n @ns.each do |n|\n n.destroy\n end\n if u != nil\n redirect_to \"/notifications\", notice: \"All notifications for \" + Event.find_by(id: e).name + \" deleted.\"\n end\n end", "def destroy\n @admin_notification.destroy\n\n head :no_content\n end", "def destroy\n string = \"DELETE FROM notes WHERE famille_id = #{@famille.id}\"\n connection = Demande.connection\n connection.delete(string)\n @famille.destroy\n respond_to do |format|\n format.html { redirect_to familles_url, notice: 'Famille was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_regexpression\n @regexpression = Regexpression.find(params[:id])\n @regexpression.delete\n\n respond_to do |format|\n format.js { render 'demo/delete_regexpression' }\n end\n end", "def destroy\n @emailId = @email.id;\n @email.destroy\n respond_to do |format|\n format.html { redirect_to emails_url, notice: 'Email supprimé !' }\n format.json { head :no_content }\n format.js{}\n end\n end", "def test_add_and_remove_notification\n notification = {\n \"title\" => \"Test subject soon to be removed\",\n \"message\" => \"Hopefully deleted message!!\",\n \"email_address\" => \"Hopefully deleted e-mail address\"\n }\n\n # Make a new notification and then delete it\n notification_id = make_a_notification(notification)\n delete '/notification/' + notification_id\n assert_equal 204, last_response.status\n\n # Double check that it's gone\n get '/notification/' + notification_id\n assert_equal 404, last_response.status\n end", "def reminder_save\n @note = Note.find_by_user_id(current_user.id)\n respond_to do |format|\n @note.reminder = params[:reminder]\n @note.save\n format.js\n end\n end", "def destroy\n donor = @item.donor\n @item.destroy\n\n # CHANGE\n # if this is the last time, change the status away from \"donated\"\n\n @items = donor.items.where(event_id: params[:event_id])\n #@items = donor.items\n respond_to do |format|\n format.html { redirect_to event_items_url(@event), notice: 'Item was successfully destroyed.' }\n format.js\n end\n end", "def destroy\n @add_on.destroy\n respond_to do |format|\n format.html { redirect_to add_ons_url, notice: 'Add on was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n teacher_exclusive\n @note.delete\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'La note a été suprimée' }\n format.json { head :no_content }\n end\n end", "def destroy\n ## Fetching the todo\n @todo = Todo.find(params[:id])\n \n respond_to do |format|\n ## Destroying the todo\n @todo.destroy\n \n # Fetch the todos to refresh ths list and details box\n get_collections\n @todo = @todos.first\n \n # Setting the flash message\n message = translate(\"forms.destroyed_successfully\", :item => \"Todo\")\n store_flash_message(message, :success)\n \n format.html { \n redirect_to todos_url notice: message\n }\n format.json { head :no_content }\n format.js {}\n \n end\n end", "def destroy\n @periodic.destroy\n respond_to do |format|\n format.html { redirect_to periodics_url, notice: 'Periódico excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "def destroy\n @noticia.destroy\n respond_to do |format|\n format.html { redirect_to admin_noticias_url, notice: 'Noticia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_item_add_on.destroy\n respond_to do |format|\n format.html { redirect_to food_item_add_ons_url, notice: 'Food item add on was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @idioma_usuario = IdiomaUsuario.find(params[:id])\n @idioma_usuario.destroy\n\n respond_to do |format|\n format.html {}\n format.js do\n render :update do |page|\n page[\"tr-idiomausuario-#{params[:id]}\"].remove\n end\n end\n end\n end", "def trash_aviso\n aviso = Aviso.find(params[:idNote])\n aviso.logic_destroy\n render :update do |page|\n render(:update) { |page| page.reload }\n\n end\n end" ]
[ "0.7116342", "0.6874734", "0.68648386", "0.673454", "0.673454", "0.6651849", "0.6637635", "0.6621874", "0.6596913", "0.6593006", "0.6472011", "0.6410357", "0.6397968", "0.63874805", "0.63668245", "0.62870437", "0.627243", "0.62602884", "0.62226605", "0.617832", "0.616025", "0.6096982", "0.6059662", "0.6028608", "0.6003576", "0.5999134", "0.59757847", "0.589731", "0.5893459", "0.58768004", "0.5872549", "0.58723205", "0.58637655", "0.5844115", "0.58302975", "0.58199424", "0.58038485", "0.58025366", "0.5794036", "0.57909435", "0.57814515", "0.57754683", "0.57719886", "0.57589227", "0.5748686", "0.5747442", "0.57454973", "0.57266265", "0.57250214", "0.57185113", "0.5709285", "0.5703094", "0.57025266", "0.57024795", "0.5695663", "0.5691368", "0.56894815", "0.5688552", "0.5686852", "0.5682082", "0.56715053", "0.5667129", "0.56671107", "0.5666684", "0.5663372", "0.56548065", "0.56537426", "0.5652971", "0.5646835", "0.56441754", "0.56424546", "0.5642184", "0.5612425", "0.5607335", "0.56068677", "0.5606242", "0.5595755", "0.55941355", "0.559304", "0.55922854", "0.55891955", "0.5580462", "0.5575449", "0.5573872", "0.55699563", "0.55663204", "0.5565156", "0.5559838", "0.55555224", "0.55536497", "0.5546438", "0.55391824", "0.5532088", "0.55241716", "0.5520094", "0.5519798", "0.55186206", "0.55167204", "0.5512375", "0.5512272", "0.5506371" ]
0.0
-1
User helper: require_login (Helpers) Ensures that a route is only accessible to logged in users.
def require_login redirect R(:login) unless logged_in? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_login\n redirect_to login_path if !user_logged?\n end", "def require_login\n redirect_to login_path unless logged_in?\n end", "def require_login\n unless current_user\n redirect_to login_path(:referer => request.fullpath)\n return false\n end\n end", "def require_login\n\t\tunless current_user\n\t\t\tredirect_to login_url\n\t\tend\n\tend", "def require_user\n redirect_to '/login' unless current_user\n end", "def require_user\n redirect_to '/login' unless current_user\n end", "def require_login\n redirect_to root_path unless logged_in?\n end", "def require_login\n redirect_to root_path unless logged_in?\n end", "def login_required\n not_authorized unless current_user\n end", "def require_login\n unless logged_in?\n redirect_to login_path\n end\n end", "def require_login\n unless @current_user\n \tredirect_to root_url, :notice => \"You must be logged in to access this section\"\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n \n end", "def require_login\n if logged_in? or authorized?\n # Let them pass\n else\n flash[:warning] = \"You must be logged in to view that page\"\n redirect_to login_path(:redirect => request.url)\n end\n end", "def require_user \n redirect_to '/login' unless current_user \n end", "def require_user \n redirect_to '/login' unless current_user \n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n end", "def require_login\n if !current_user\n redirect_to \"/\"\n end\n end", "def require_login\n unless logged_in?\n redirect url(:admin_login)\n throw :halt\n end\n end", "def require_login\n unless logged_in?\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to login_path # halts request cycle\n end\n end", "def require_login\n if current_user.nil? then\n redirect_to root_path\n end\n end", "def login_required! \n if ! is_logged_in? \n redirect '/login' \n end \n end", "def require_login\n unless current_user\n redirect_to signin_path\n end\n end", "def require_login\n redirect_to login_path, notice: 'The requested action requires you to log in' unless session[:user_id]\n end", "def require_user\n if current_user && !current_user.admin?\n redirect_to logout_path\n return false\n end\n\n unless current_user\n redirect_to login_path\n return false\n end\n end", "def require_login\n not_authorized(\"Please sign up or log in above to access this resource.\") unless current_user\n end", "def require_user\n\t\tredirect_to \"/login\" unless current_user\n\tend", "def require_login\n redirect_to root_path unless session.include?(:user_id)\n end", "def login_required\n if logged_in?\n return true\n else\n redirect_to(:controller => '/user', :action => 'index')\n return false\n end\n end", "def require_login\n !!current_user || access_denied\n end", "def login_required\n redirect_to(login_url) unless logged_in? && authorized?\n end", "def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end", "def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end", "def requires_login\n unless user_logged_in?\n return redirect_to login_index_path, notice: \"You must login to view that page.\"\n end\n end", "def require_login\n unless current_user\n flash[:danger] = \"You must be logged in to do that.\"\n redirect_to root_path and return\n end\n end", "def require_login\n redirect_to '/' if session[:user_id] == nil\n end", "def login_required\n if !logged_in?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end", "def login_required\n redirect_to login_path unless logged_in?\n end", "def require_login\n if !is_logged_in\n return render_404\n end\n end", "def login_required\n redirect_to login_path unless logged_in?\n end", "def must_login\n redirect_to login_path unless logged_in?\n end", "def require_login\n end", "def require_user\n return if current_uid\n\n store_location\n flash[:notice] = 'You must be logged in to access the page you requested'\n ret = url_for_with_proto({ controller: 'user_sessions', action: 'guest_login' })\n redirect_to(ret) && return\n end", "def require_user\n if current_user\n force_redirects\n true\n else\n Rails.logger.debug('User needs to be logged in')\n redirect_to login_url\n false\n end\n end", "def require_login\n unless user_session.logged_in?\n flash[:danger] = \"Please log in to continue.\"\n redirect_to login_url\n end\n end", "def require_login\n redirect_to '/login' unless session[:name]\n end", "def require_logged_in\n redirect_to root_path unless logged_in?\n end", "def require_login\n redirect_to '/sessions/new' unless current_user\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def require_auth\n redirect_to login_path unless authenticated?\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def require_user\n if current_user\n return true\n end\n redirect_to root_url\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform the action\"\n redirect_to login_path\n end\n end", "def require_login\n unless @current_account\n redirect_to root_path\n end\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def login_required\n \n if not protect?(action_name)\n return true \n end\n\n if @session['user'] and authorize?(@session['user'])\n return true\n end\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n \n # call overwriteable reaction to unauthorized access\n access_denied\n return false \n end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n #then redirect them away\n redirect_to login_path\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end", "def require_login\n unless signed_in?\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to signin_url # halts request cycle\n end\n end", "def require_login\n unless logged_in?\n flash[:danger] = 'Please login.'\n redirect_to login_path\n end\n end", "def login_required\n (logged_in? || (controller_name == 'sessions')) ? true : access_denied\n end", "def require_login\n unless current_user\n return admin_login_path\n end\n end", "def login_required\n return true unless protect?(action_name)\n\n user = session_user\n return true if user && authorize?(user)\n\n # store current location so that we can\n # come back after the user logged in\n store_location\n\n # call overwriteable reaction to unauthorized access\n access_denied\n false\n end", "def require_user\r\n if ##LOGIC##\r\n redirect_to '/user/sign_in'\r\n end\r\n end", "def login_required\n logged_in? ? true : access_denied\n end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end", "def require_login\n\t\t\tunless current_user\n\t\t\t\tstore_location\n\t\t\t\tflash[:danger] = 'Please log in!'\n\t\t\t\tredirect_to login_url\n\t\t\tend\n\t\tend", "def require_user\n if !logged_in?\n # flash message\n flash[:danger] = \"You must be logged in to perform that action.\"\n # and redirect to index page\n redirect_to root_path\n end\n end", "def require_login\r\n unless logged_in?\r\n flash[:error] = t('admin.flash.error.not_logged')\r\n redirect_to admin_login_path\r\n end\r\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def login_required\n raise LoginRequired unless logged_in?\n true\n end", "def login_required\n return true unless protect?(action_name)\n\n return true if user? && authorize?(session[:user])\n\n # store current location so that we can\n # come back after the user logged in\n store_location\n\n # call overwriteable reaction to unauthorized access\n access_denied\n false\n end", "def require_logged_in\n redirect_to new_session_url unless logged_in?\n end", "def must_be_logged_in\n redirect_to root_path unless logged_in?\n end", "def login_required\n logged_in? ? true : access_denied\n end", "def require_logged_in\n \treturn true if current_user\n\n \treturn redirect_to root_path\n\n end", "def login_required\n logged_in? || access_denied\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to do that.\"\n redirect_to login_path\n end\n end", "def require_login\n redirect_to(root_path, alert: t('application_controller.login_required_html')) and return unless user_signed_in?\n end", "def require_user\n if !is_logged_in\n flash[:danger] = 'You must be logged in to perform this action'\n redirect_to root_path\n end\n end", "def require_login\n unless current_user\n session[:last_params] = params\n redirect_to login_url_for_this_controller\n return\n end\n\n validate_user(current_user)\n end", "def require_user\n unless user_logged_in?\n flash[:danger] = 'You must sign in to view this page.'\n redirect_to root_path and return\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def require_user\n\t\tif !logged_in?\n\t\t\tflash[:notice] = \"You must be logged in to perform this action\"\n\t\t\tredirect_to login_path\n\t\tend\n\tend", "def require_login\n\t\tauthorize_request || render_unauthorized(\"Access Denied\")\n\tend", "def require_logged_in\n access_denied(\"You must be logged in to do that.\") unless logged_in?\n end", "def require_login\n\t\tunless signed_in_user?\n\t\t\tflash[:error] = \"Not authorized, please sign in!\"\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "def require_login\n unless current_user\n flash[:error] = \"You must be logged in to do that.\"\n redirect_back fallback_location: root_path\n end\n end", "def require_login\n if request.fullpath == \"/about\"\n #Let everybody (even not logged in users) see the about page\n else\n unless current_user\n redirect_to root_url\n end\n end\n end", "def require_login\n unless logged_in?\n redirect_to login_path and return\n end\n @admin = Admin.find(session[:admin_id])\n end", "def login_required\n access_denied unless header_login or session_login or cookie_login\n end", "def require_login\n redirect_to new_session_path,\n flash: { warning: \"You need to be a signed-in user.\" } unless session[:user_id]\n end", "def require_login\n authorize_request || render_unathorized(\"Access denied\")\n end", "def require_user \n redirect(to('/')) unless current_user \nend", "def check_is_login_required\n authorized_denied unless logged_in?\n end", "def require_login\n unless params[\"login\"].nil?\n #Call the devise helper to authenticate the user (returns back to orig dest)\n authenticate_user! if params[\"login\"] == \"true\"\n end\n end", "def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end", "def require_user\n unless current_user\n store_location\n flash[:warning] = t(\"common.login_required\")\n redirect_to login_url\n return false\n end\n end" ]
[ "0.8003565", "0.7908851", "0.78969854", "0.7864319", "0.78546274", "0.78546274", "0.7852413", "0.7852413", "0.78290874", "0.7817327", "0.779144", "0.77759355", "0.77626467", "0.7760311", "0.7760311", "0.77520204", "0.77520204", "0.77445614", "0.77086115", "0.7700498", "0.7699762", "0.7697389", "0.76902145", "0.7669842", "0.764727", "0.76233596", "0.76063555", "0.7602783", "0.7594495", "0.7553099", "0.75395423", "0.75140977", "0.75140977", "0.7509844", "0.749819", "0.7489358", "0.7488475", "0.74884224", "0.74795145", "0.7466019", "0.7439996", "0.74386406", "0.743463", "0.74292254", "0.7423539", "0.7420457", "0.74147016", "0.7412006", "0.7391765", "0.7383039", "0.7376945", "0.7369344", "0.73504186", "0.7337267", "0.732904", "0.7317296", "0.73166186", "0.7304814", "0.7302371", "0.7300571", "0.72964865", "0.72901475", "0.72786057", "0.72703034", "0.72622293", "0.72595453", "0.72522134", "0.7245838", "0.7239214", "0.7229694", "0.7228801", "0.7221614", "0.7219356", "0.72147363", "0.7213871", "0.7206148", "0.7197995", "0.7187456", "0.7186092", "0.7185396", "0.7184423", "0.71830285", "0.7178942", "0.71751666", "0.717223", "0.7171147", "0.71696347", "0.7166267", "0.71626616", "0.71574247", "0.7142077", "0.7132185", "0.7131625", "0.7123012", "0.7118835", "0.71131724", "0.71121204", "0.71063167", "0.7098982", "0.70955074" ]
0.78288865
9
Overridden in aura to track last login time. This is called when a user logs in.
def redirect_to_return_url(session_key = :return_to, default = '/admin') u = current_user first_login = u.last_login.nil? u.last_login = Time.now u.save # On a user's first login, go to a admin welcome page # where they can change their password. if first_login redirect R(:admin, :welcome) end redirect session.delete(:return_to) || default end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def did_log_in\n self.last_logged_in_at = DateTime.now\n self.class.execute_without_timestamps { save }\n end", "def current_user\n @current_user ||= super\n if @current_user != nil && @current_user.id > 0\n loggedInUser = User.find(@current_user.id)\n loggedInUser.update(:lastlogintime=>Time.now.to_i)#save the current login time \n end\n @current_user\n end", "def set_last_login\n self.update_attributes(:last_login_at => Time.now.utc)\n end", "def login\n Time.now.to_i\n end", "def core_login_time_in_ms\n return @core_login_time_in_ms\n end", "def core_login_time_in_ms\n return @core_login_time_in_ms\n end", "def total_login_time_in_ms\n return @total_login_time_in_ms\n end", "def update_login_timestamps\n if current_enrollment && current_enrollment.last_seen # when an enrollment is created, it's last_seen value is set\n \n if current_enrollment.last_seen < 4.hour.ago # 4 hours is somewhat arbitrary\n current_enrollment.events.new_session.create\n end\n\n # note that there is activity (since this before filter happens for any activity)\n current_enrollment.update_attribute(:last_seen, Time.now)\n end\n end", "def register_login_time_to_db(user, _username, _password, _options)\n return unless sorcery_config.register_login_time\n\n user.set_last_login_at(Time.current)\n end", "def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end", "def update_first_login(user)\n unless user.first_logged_in_at\n user.update_attributes(first_logged_in_at: Time.now)\n end\n end", "def last_login_at\n @attributes[:last_login_at]\n end", "def register_logout_time_to_db\n return unless sorcery_config.register_logout_time\n\n current_user.set_last_logout_at(Time.current)\n end", "def last_login\n passed_time = current_sign_in_at\n if passed_time.present?\n distance = time_span_in_DHMS(passed_time)\n if distance[0] > 1\n return distance[0].to_s + \"d\"\n elsif distance[1] > 1\n return distance[1].to_s + \"h(s)\"\n else\n \"Online\"\n end\n else\n \"\"\n end\n end", "def login_time_last_30_days\n login_time_since(30.days.ago)\n end", "def logged_in\r\n end", "def last_login_date\n logins.last.created_at rescue logins.latest.created_at rescue Time.now\n end", "def log_in\n end", "def update_last_user_activity\n now = session[:last_activity] = Time.now\n return if session_is_cloned?\n if ( current_user && (session[:last_activity_saved].nil? || (now - session[:last_activity_saved] > APP_CONFIG[:save_last_activity_granularity_in_seconds].to_i ) ) ) \n logger.info(\"Saved last activity date to #{now} for #{current_user.log_info}\")\n current_user.update_last_activity_date\n session[:last_activity_saved] = now\n end\n end", "def core_login_time_in_ms=(value)\n @core_login_time_in_ms = value\n end", "def core_login_time_in_ms=(value)\n @core_login_time_in_ms = value\n end", "def after_login(&block)\n add_callback(:login, block)\n end", "def total_login_time_in_ms=(value)\n @total_login_time_in_ms = value\n end", "def refresh!\n self.update_attributes(:last_logged => Time.now)\n end", "def register_last_activity_time_to_db\n return unless sorcery_config.register_last_activity_time\n return unless logged_in?\n\n current_user.set_last_activity_at(Time.current)\n end", "def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end", "def is_login_save?(user)\n\t\tuser.changed? && user.changed.length == 2 && user.changed.include?(\"updated_on\") && user.changed.include?(\"last_login_on\")\n\tend", "def load_user(user)\n session[:user_id] = user.id\n session_reset_timeout!\n user.update_attributes last_login_on: Time.now, login_count: user.login_count + 1\n end", "def successful_login(user)\n log_in user\n redirect_back_or root_url\n\n # Report last login time (this can help users detect problems)\n last_login = user.last_login_at\n last_login = t('sessions.no_login_time') if last_login.blank?\n flash[:success] = t('sessions.signed_in', last_login_at: last_login)\n\n # Record last_login_at time. We use update_columns because\n # it works even if we don't have the correct email decryption keys,\n # and so it won't change updated_at (so updated_at becomes more useful).\n # We don't need the model validations, we're just setting a timestamp.\n # rubocop: disable Rails/SkipsModelValidations\n user.update_columns(last_login_at: Time.now.utc)\n # rubocop: enable Rails/SkipsModelValidations\n end", "def last_successful_login\n @last_successful_login ||= login_histories.where(successful: true).order(created_at: :desc).first\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def first_login?\n self.sign_in_count==1 && 10.seconds.ago < current_sign_in_at\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user, status: :ok\n end", "def ux_teacher_last_login( teacher)\n if teacher.cur_login\n str = time_ago_in_words( teacher.cur_login) << \" (*log) \"\n else\n str = teacher.last_login ? time_ago_in_words( teacher.last_login) : \"Never\"\n end\n\n if teacher.suspended?\n str = str << \" (*sus)\"\n end\n str\n end", "def report_login(return_date=nil)\n self.return_date = return_date || Time.new\n save\n end", "def welcome( user )\n session[:user] = user\n session[:last_login] = Time.now.strftime(\"%m-%d-%Y %H:%M:%S\") \n redirect \"/\"\n end", "def logged_in?\n # the session variable should contain a user obj\n # check that the user last logged in within a certain time\n # i think that should be good enough?\n if @user.nil? ||\n (@user.updated_at.to_i < 1.hour.ago.to_i)\n # then it was over an hour ago since they last signed in\n session[:user_id] = nil\n flash[:error] = \"Please login to continue.\"\n redirect_to :controller => \"site\", :action => \"index\"\n return false\n else\n @user.activated_at = Time.now # update since they are using the site and not idling\n @user.save\n return true\n end\n end", "def remember\n self.login_token = User.new_token\n update_attribute(:login_digest, User.digest(self.login_token))\n end", "def ensure_last_signed_in_at_set\n return unless current_user.present?\n return if current_user.last_signed_in_at.present?\n current_user.update last_signed_in_at: current_user.updated_at\n end", "def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def session_last_user_activity\n session[:last_activity]\n end", "def logged_at\n @attributes[:logged_at]\n end", "def logging_in\n end", "def last_login_duration\n if self.last_session_id\n min = self.occurences.where(:session_id => self.last_session_id).minimum(\"created_at\")\n max = self.occurences.where(:session_id => self.last_session_id).maximum(\"created_at\")\n Time.diff(min, max, '%h:%m:%s')[:diff]\n else\n 0\n end\n end", "def last_web_login_at\n @attributes[:last_web_login_at]\n end", "def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end", "def last_desktop_login_at\n @attributes[:last_desktop_login_at]\n end", "def after_remembered; end", "def login_user(user_name)\n user = Goldberg::User.find_by_name(user_name)\n @request.session[:goldberg] = {:user_id => (user ? user.id : nil)}\n Goldberg::AuthController.set_user(@request.session)\n @request.session[:last_time] = Time.now\n end", "def login\n return @last_login if !@last_login.nil? && @last_login < @last_login + SESSION_TIMEOUT\n response = post '/account.php', {\n 'action' => 'login',\n 'username' => @username,\n 'password' => @password\n }\n if response_status_message(response) != RESPONSE_MESSAGES[:LOGIN_FAILED]\n @last_login = Time.now\n @authenticated = true\n return @last_login\n else\n @last_login = nil\n @authenticated = false\n end\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 user_login?\n\t\treval = user_info[:uid] > 0 ? true : false\n\t\tif reval\n\t\t\tuser_session_update user_info[:sid], user_info[:uid]\n\t\tend\n\t\treval\n\tend", "def session_check\n return if (t_last = last_operation_time).zero?\n return if (t_boot = BOOT_TIME.to_i) < t_last\n __debug { \"last_operation_time #{t_last} < BOOT_TIME #{t_boot}\" }\n Log.info { \"Signed out #{current_user&.to_s || 'user'} after reboot.\" }\n local_sign_out\n end", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def update_sign_in_timestamps!(remember_me = false)\n timestamp = Time.now.utc\n self.last_sign_in_at = timestamp\n self.remember_created_at = timestamp if remember_me\n save(validate: false)\n end", "def last_restapi_login_at\n @attributes[:last_restapi_login_at]\n end", "def logging_in\n \t\t\n \tend", "def login_attribute\n super\n end", "def after_remembered\n end", "def save_login_state\n if session[:user_id]\n redirect_to user_profile_path(session[:user_id]), notice: 'Already Logged in!'\n return false\n else\n return true\n end\n end", "def auto_login(user, should_remember = false)\n session[:user_id] = user.id.to_s\n @current_user = user\n remember_me! if should_remember\n end", "def logged_in_user\n\t\tunless logged_in?\n\t\t\tstore_location\n\t\t\tflash[:danger] = \"Log in\"\n\t\t\tredirect_to login_url\n\t\tend\n\tend", "def sign_in(user)\n sign_out\n\n user.touch(:last_login_at)\n user_session = user.sessions.new(ip_address: request.remote_ip, user_agent: request.user_agent)\n if user_session.save\n user.password_resets.delete_all\n @current_session = user_session\n end\n end", "def touch_auth_session\n if logged_in?\n auth_session.touch!\n end\n end", "def set_session_time\n time_now = Time.zone.now\n self.session_start ||= time_now\n self.session_end ||= time_now\n end", "def logged_in_recently?\n logged_in? && !!@logged_in_recently\n end", "def log_user_in(user)\n note \"Welcome, #{user.contact.con_name}\"\n\n user.log(\"Logged in\")\n user.user_last_logged_in = Time.now\n user.save\n\n sm = SessionManager.new($store)\n sm.fork_session(@session, @context)\n @session.user = user\n @session.news = DailyPlanet.top_news_for_user(user)\n if user.contact.mail.empty?\n @data.user = user\n collect_user_info(false, true)\n else\n @session.pop\n end\n end", "def update_last_activity_at\n current_user.last_activity_at = Time.zone.now if current_user\n end", "def sign_in_local\n __log_activity\n __debug_route\n end", "def update_user\n current_user.update_last_access if current_user && signed_in?\n end", "def group_policy_login_time_in_ms\n return @group_policy_login_time_in_ms\n end", "def group_policy_login_time_in_ms\n return @group_policy_login_time_in_ms\n end", "def current\n if current_user\n current_user.update!(last_login: Time.zone.now)\n render json: current_user\n else\n not_auth\n end\n end", "def login\n @user_login\n end", "def logging_in\n current_user.absorb_from(guest_user)\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 after_custom_authentication; end", "def login( user )\n\t\t@current_user = user\n\t\tsession[:user_id] = user.id\n\t\tuser.update_attributes :last_ip => request.ip\n\tend", "def logged_in_user\n unless logged_in?\n # {Function}store_location in `sessions_helper`.rb\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def successful_login!\n unthrottle_user\n clear_bad_login_counter\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash_please_log_in\n redirect_to login_url\n end\n end", "def remember_me; end", "def last\n login_response = Backendless.login @email, @password\n object_id = Parser.login_object_id login_response\n Backendless.last(object_id)\n end", "def ever_logged_in?\n @data[:has_ever_logged_in]\n end", "def update_last_user_activity\n if current_user\n current_user.update_attributes(:last_user_activity => Time.now)\n end\n end", "def logged_in_user\n unless logged_in?\n puts \"not logged in\"\n end\n end", "def logged_in_user\n\t unless logged_in?\n\t store_location # store where the user was going to go (redirects them to it after they log in)\n\t flash[:danger] = \"Please log in.\"\n\t redirect_to login_url\n\t end\n\t end", "def logged\n @from_time = Time.now\n end", "def log_in (user)\n\t\t#Session is a rails method which saves something called as userid in a cookie\n\t\tsession[:user_name]=user.username\n\n\tend", "def user_log_in(user)\n session[:user_id] = user.id\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash.now[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end", "def set_env_success( request = nil )\n self['login_count'] ||= 0\n self['login_count'] += 1\n self['last_login_at'] = current_login_at\n self['current_login_at'] = Time.now\n self['last_login_ip'] = current_login_ip\n if( request )\n self['current_login_ip'] = request.env[\"REMOTE_ADDR\"]\n request.env[\"REMOTE_USER\"] = id\n end\n save\n end", "def remember_me\n remember_me_for REMEMBER_ME_TIME\n end", "def verify_and_update_activity_timer\n\t\tif (has_valid_credentials) then\n\t\t # username is valid, login_time is valid, do the real checking\n\t\t inactivity = Time.now.to_i - session[:login_time]\n\t\t logger.error(\"VC: Checking timeout \" + inactivity.to_s + \" versus \" + inactivity_timeout.to_s)\n\n\t\t if (inactivity > inactivity_timeout) then\n\t\t # timeout! clobber the session\n\t\t flash[:error] = 'Session timed out; please login again to continue'\n\t\t clear_session()\n \t\t redirect_to :controller => 'application', :action => 'index'\n\t\t else\n\t\t # active session, update the timer\n\t\t logger.error(\"VC: Actively logged in, setting activity timer\")\n\t\t session[:login_time] = Time.now.to_i\n\t\t\tsessionPlayer = Player.find_by_id(session[:player_id])\n\t\t\tsessionPlayer.touch\n\t\t end\n\t\telse\n\t\t logger.error(\"VC: Not logged in, no timeout check\")\n\t\tend\n\tend", "def last_dav_login_at\n @attributes[:last_dav_login_at]\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Bitte anmelden.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n # store current location to automatically redirect user after login\n store_location\n # show a flash message on the page\n flash[:danger] = \"Per favore effettua il login\"\n # redirect user to login page\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Primero has Log In\"\n redirect_to login_url\n end\n end" ]
[ "0.7639294", "0.70015496", "0.69594103", "0.68509537", "0.6837654", "0.6837654", "0.67994845", "0.6768157", "0.67656636", "0.67492354", "0.6603999", "0.6561795", "0.6496236", "0.649099", "0.6453949", "0.643976", "0.6434136", "0.62938744", "0.6277433", "0.6268367", "0.6268367", "0.62654036", "0.6261936", "0.6252867", "0.62443423", "0.6244233", "0.62047964", "0.62040657", "0.619307", "0.6168716", "0.61444473", "0.6122075", "0.6121356", "0.6115518", "0.61151445", "0.61041564", "0.6091528", "0.60874957", "0.6086122", "0.60680664", "0.6067845", "0.6067845", "0.60658073", "0.60449284", "0.6043611", "0.6037048", "0.6031129", "0.6025395", "0.60202044", "0.60096985", "0.6001745", "0.60004175", "0.5996666", "0.598856", "0.59861314", "0.5972626", "0.59693134", "0.5965218", "0.59607476", "0.59589183", "0.5951351", "0.5941863", "0.5938398", "0.59246254", "0.59233475", "0.5923244", "0.5918623", "0.5915323", "0.59078854", "0.5904326", "0.59029186", "0.58943987", "0.5884522", "0.5884522", "0.58746064", "0.58679783", "0.58669794", "0.58544046", "0.58443", "0.5843962", "0.5835284", "0.58331513", "0.5826941", "0.5825095", "0.5824678", "0.5820794", "0.580837", "0.5800304", "0.57978237", "0.57972234", "0.5790542", "0.5786907", "0.57765776", "0.5775924", "0.57720006", "0.5770853", "0.5762877", "0.576202", "0.5758486", "0.5755605", "0.57500017" ]
0.0
-1
User defines a platform block
def platform(platform_name, &block) SupportedPlatforms.verify!platform_name @current_platform = platform_name block.call @current_platform = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform(&block)\n Loquacious::Configuration.for :platform, &block\n end", "def platform; end", "def platform; end", "def platform; end", "def is_platform_block?(key)\n raise 'No key given'.red unless key\n\n return false if (self.runner.blocks[nil][key.to_sym] rescue false)\n return true if self.runner.blocks[key.to_sym].kind_of?Hash\n\n raise \"Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}\".red\n end", "def platform(*platforms)\n @current_platforms = platforms\n\n yield\n\n ensure\n @current_platforms = nil\n end", "def platform\n @platform ||= data.platform\n end", "def platform_list; ['all','xbox-360']; end", "def platform=(value)\n @platform = value\n end", "def platform\n @platform ||= NoPlatform.new\n end", "def platform(name=nil, path=nil)\n error \"Platform name is blank\" if name.blank?\n error \"Platform path is blank\" if path.blank?\n error \"Platform name is not a string\" unless name.kind_of?(String)\n debug \"Registering platform name [#{name}] by engine path [#{path}]\"\n error \"Platform [#{name}] has already been registered\" if platform_names.include?(name)\n platform_names.push(name)\n totem_settings.defaults.platform_settings(name)\n end", "def platform\n @_platform ||= self.context.platform\n end", "def platform\n @_platform ||= self.context.platform\n end", "def platform\n @_platform ||= self.context.platform\n end", "def epoc_in_plat_env plat # block\n yield\nend", "def add_platforms\n updated_lines = updated.lines\n\n # Find last line of GEM\n last_section_of_gem_index = updated.lines.index { |line| line != \"G\" && line.chr == \"\\n\" }\n\n # PLATFORMS should be added after GEM section\n add_platforms_index = last_section_of_gem_index + 1\n\n # Add PLATFORMS section\n updated_lines.insert(\n add_platforms_index, \"\\nPLATFORMS\\n\", \" #{platform_ruby}\\n\"\n )\n\n # Reconstruct lockfile\n updated_lines.join\n end", "def platform_end_point; end", "def assured_platform(purpose, name, config)\n platform_definition = config.platform_definition(name)\n assure(\"Requested #{purpose} platform '#{name}' is defined in 'platforms' YML\") { !platform_definition.nil? }\n platform_definition\nend", "def platform\n raise NotImplementedError\n end", "def platform\n raise NotImplementedError\n end", "def platform\n data.platform\n end", "def set_platform\n @platform = Platform.find(params[:id])\n end", "def set_platform\n @platform = Platform.find(params[:id])\n end", "def set_platform\n @platform = Platform.find(params[:id])\n end", "def set_platform\n @platform = Platform.find(params[:id])\n end", "def set_platform\n @platform = Platform.find(params[:id])\n end", "def set_platform\n @platform = Platform.find(params[:id])\n end", "def platform\n spec.platform\n end", "def for_platform(platform_name)\n if ENV[\"FASTLANE_PLATFORM_NAME\"] == platform_name.to_s\n yield\n end\n end", "def platform\n @new_platform ||= Gem::Platform::RUBY\n end", "def platform\n fetch('game.platform')\n end", "def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end", "def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end", "def platform_name\n \"Flist\"\n end", "def epoc_set_plat_env plat\nend", "def set_platform\n @platform = Platform.where(id: params[:id]).accessible_by(current_ability).take\n end", "def block(block)\n @components[:__base__] = block\n @load_order << :__base__\n true\n end", "def define_platforms\n [define_centos_5, define_centos_6, define_run_list]\n end", "def before_all(&block)\n @runner.set_before_all(@current_platform, block)\n end", "def platform_params\n params.require(:platform).permit(:shortname, :name, :background, :logo, :content, :date, :status)\n end", "def define(name, options={}, &block)\n # Check if a block by this name is already defined.\n if blocks[name.to_sym].nil?\n # Store the attributes of the defined block in a container for later use\n block_container = BuildingBlocks::Container.new\n block_container.name = name\n block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end", "def block(block)\n @components[:__base__] = self.class.build(&block)\n @load_order << :__base__\n true\n end", "def eval_platform\n if @platform == \"PC\"\n puts \"PC are great!\"\n else\n puts \"Your platform is probably underpowered.\"\n end\n end", "def for(platform)\n case platform.to_s\n when 'amazon' then for_amazon\n when 'core_api' then for_core\n end\n end", "def platform\n @spec.platform\n end", "def platform\n data[:platform]\n end", "def set_block_type\n @block_type = BlockType.find(params[:id])\n end", "def platforms=(value)\n @platforms = value\n end", "def platform\n kernel.platform\n end", "def main\n platform = @handle.root['platform']\n @handle.log(\"info\", \"Detected Platform:<#{platform}>\")\n\n if platform.nil?\n source_id = @handle.root['dialog_input_src_vm_id']\n source = @handle.vmdb('vm_or_template', source_id) unless source_id.nil?\n platform = source ? source.model_suffix.downcase : \"vmware\"\n end\n\n dialog_name_prefix = \"miq_provision_#{platform}_dialogs\"\n @handle.object['dialog_name_prefix'] = dialog_name_prefix\n @handle.log(\"info\", \"Platform:<#{platform}> dialog_name_prefix:<#{dialog_name_prefix}>\")\n end", "def valid_for_platform?; true; end", "def basic_blocks\n cfg.blocks\n end", "def platform\n @attributes[:platform]\n end", "def set_block_typ\n @block_type = BlockType.find(params[:id])\n end", "def set_block\n @block = @project.blocks.find(params[:id])\n end", "def platform_type=(value)\n @platform_type = value\n end", "def platform_type=(value)\n @platform_type = value\n end", "def what_platform\n if @platform == \"PC\"\n puts \"PC are Awesome!\"\n else\n puts \"This platform is inferior\"\n end\n end", "def platform_params\n params.require(:platform).permit(:name, :version)\n end", "def set_building_block\n @building_block = BuildingBlock.find(params[:id])\n end", "def platform\n backend.platform\n end", "def guest_platform\n node[:rightimage][:platform]\n end", "def guest_platform\n node[:rightimage][:platform]\n end", "def platform_name\n self.platform ? self.platform.name : NOT_SET\n end", "def platform_endpoint; end", "def platform_params\n params.require(:platform).permit(:description, :ident, :mission_id,\n :platform_server_id, :beacon_ids)\n end", "def add_platform(platform)\n @platforms << platform\n end", "def determine_os\n @os = \"linux\"\n end", "def platform_params\n params.require(:platform).permit(:name, :package_id, :version, :app_id, :icon, :splash, :logo, :version_code)\n end", "def determine_os\n @os = 'linux'\n end", "def platform=(platform)\n fail ArgumentError, \"unknown platform #{platform}\" \\\n unless Cisco::Util::PLATFORMS.include?(platform)\n @platform = platform\n end", "def platform_name; non_framework_platforms.first; end", "def block=(block)\n\t\t@grid[block.position.y][block.position.x] = 1\n\tend", "def default_platform_list\n [\n metadata.platform,\n *ruby_versions,\n *platforms,\n RbConfig::CONFIG['build']\n ]\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def load_platform(v)\n Chef::Log.debug \"[dropwizard_pleaserun] loading platform #{v}\"\n platform_lib = \"pleaserun/platform/#{v}\"\n require platform_lib\n const = PleaseRun::Platform.constants.find { |c| c.to_s.casecmp(v).zero? }\n if const.nil?\n raise PlatformLoadError, \"Could not find platform named '#{v}' after loading library \" \\\n \"'#{platform_lib}'. This is probably a bug.\"\n end\n return PleaseRun::Platform.const_get(const)\nrescue LoadError => e\n raise PlatformLoadError, \"Failed to find or load platform '#{v}'. This could be a typo or \" \\\n \" a bug. If it helps, the error is: #{e}\"\nend", "def platform(platform = nil, options={})\n platform ? @platform = Platform.new(platform, options) : @platform\n end", "def platform_for(node)\n @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }\n end", "def platform(arg = nil)\n set_or_return(:platform, arg, kind_of: String, required: true)\n end", "def register_block_for(type, &blk); end", "def current_type\n\t\t@block_type\n\tend", "def switchToPlatform(platform)\n if @support_platforms.include?(platform) then\n @platform = platform\n else\n puts \"The given #{platform} platform not support.\"\n end\n end", "def platform_opts\n case platform\n when 'alpine'\n alpine\n when 'rhel', 'centos', 'fedora'\n rhel\n when 'debian', 'ubuntu'\n debian\n else\n raise \"Unknown platform for #{@name} using #{@image}\"\n end\n end", "def create_platforms\n @collect_platforms['NT'] = Gtk::CheckButton.new(\"Windows NT\")\n @collect_platforms['2000'] = Gtk::CheckButton.new(\"Windows 2000\")\n @collect_platforms['XP'] = Gtk::CheckButton.new(\"Windows XP\")\n @collect_platforms['2003'] = Gtk::CheckButton.new(\"Windows 2003\")\n @table_platforms.attach_defaults(@collect_platforms['NT'], 0, 1, 1, 2)\n @table_platforms.attach_defaults(@collect_platforms['2000'], 0, 1, 2, 3)\n @table_platforms.attach_defaults(@collect_platforms['XP'], 1, 2, 1, 2)\n @table_platforms.attach_defaults(@collect_platforms['2003'], 1, 2, 2, 3)\n end", "def smalrubot_v3\n Hardware.create_hardware(Hardware::SmalrubotV3)\n end", "def set_block(x,y,z,block)\n @api.send(\"world.setBlock(#{x},#{y},#{z},#{block.as_parameter_list})\")\n end", "def platform(platform_id)\n Platform.new(platform_id, client)\n end", "def blackberry_world\n self.in(BlackBerryWorld)\n end", "def bios_parameter_block\n BiosParameterBlock.new @bpb\n end", "def setup_blocks\n @setup_blocks ||= []\n end", "def set_blocks(x0,y0,z0,x1,y1,z1,block)\n @api.send(\"world.setBlocks(#{x0},#{y0},#{z0},#{x1},#{y1},#{z1},#{block.as_parameter_list})\")\n end", "def platform_end_point=(_arg0); end", "def content\n return <<-EOF\ndefault lucie\n\nlabel lucie\nkernel #{ INSTALLER_KERNEL }\nappend initrd=#{ initrd } ip=dhcp devfs=nomount root=/dev/nfs nfsroot=#{ @nfsroot } boot=live hostname=#{ @node.name } #{ $KERNEL_OPTIONS }\nEOF\n end", "def lsplat( platform_info )\n print_line\n print_line\n print_info 'Available platforms:'\n print_line\n\n platform_info.each do |type, platforms|\n print_status \"#{type}\"\n\n platforms.each do |shortname, fullname|\n print_info \"#{shortname}:\\t\\t#{fullname}\"\n end\n\n print_line\n end\n\n end", "def platform\n fetch('device.platform')\n end", "def platform_params\n params.require(:platform).permit(:name, :category)\n end", "def define &block\n new block\n end", "def set_aws_platform\n @aws_platform = AwsPlatform.find(params[:id])\n end", "def configure(site = :default, &block)\n @configs ||= {}\n @configs[site.to_s] = block\n end" ]
[ "0.7160809", "0.6378967", "0.6378967", "0.6378967", "0.60587245", "0.59745026", "0.5950207", "0.5921882", "0.5689245", "0.5686215", "0.56734484", "0.56674194", "0.56674194", "0.56674194", "0.5665567", "0.5665188", "0.5644594", "0.5636268", "0.5595199", "0.5595199", "0.5515746", "0.5504385", "0.5504385", "0.5504385", "0.5504385", "0.5504385", "0.5504385", "0.5497633", "0.5497516", "0.549416", "0.54911345", "0.5480215", "0.5475856", "0.5455909", "0.54498184", "0.54408234", "0.54259866", "0.54196143", "0.5411293", "0.5410359", "0.5398246", "0.53980106", "0.5379215", "0.5373431", "0.53682566", "0.5364633", "0.5355932", "0.53408056", "0.53233385", "0.53205293", "0.53134495", "0.531329", "0.53062785", "0.52799314", "0.52750707", "0.52695763", "0.52695763", "0.52555037", "0.52534646", "0.5226005", "0.52230465", "0.52134734", "0.52134734", "0.52082014", "0.52020514", "0.52010036", "0.51946795", "0.5185298", "0.51576674", "0.5150087", "0.5133055", "0.51320815", "0.51181775", "0.51095974", "0.5106475", "0.5106475", "0.5103743", "0.50909793", "0.50900006", "0.5083246", "0.5082319", "0.5066077", "0.50622475", "0.5056178", "0.5045593", "0.5037372", "0.5036964", "0.5033208", "0.50275064", "0.5024539", "0.50150627", "0.50133634", "0.5011897", "0.5010097", "0.50001216", "0.49863943", "0.49857342", "0.49849892", "0.49817708", "0.4981023" ]
0.666566
1
Is executed before each test run
def before_all(&block) @runner.set_before_all(@current_platform, block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_test(test); end", "def before_test(test); end", "def before_run; end", "def before_setup\n # do nothing by default\n end", "def before() ; end", "def before_setup; end", "def before_load(test_files); end", "def before() nil ; end", "def before\n end", "def before\n end", "def before_assert\n end", "def before\n\t\t\ttrue\n\t\tend", "def setup(&block)\n before(:each, &block)\n end", "def before; end", "def setup\n # noop\n end", "def test_setup\r\n \r\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 pre_setup_suite()\n @cfg['pre_setup'] =\"defined\"\n return true\n end", "def setup\n\t\t# Do nothing\n\tend", "def setup\n\t\t# Do nothing\n\tend", "def before\n @before\n end", "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end", "def before_test\n super\n\n # Need local variables for access within the scoped blocks below.\n logger = @logger\n config_manager = @config_manager\n # Configure RSpec.\n RSpec.configure do |c|\n # Need access to framework methods from within the RSpec examples.\n c.include Automation::Kernel\n # The formatter that will feed RSpec notification to the framework.\n c.add_formatter(Automation::Rspec::Formatter)\n # Before each \"it\"\n c.before(:each) do\n @logger = logger\n @config_manager = config_manager\n end\n end\n end", "def pre_testdata\n RVTEST_DATA_BEGIN()\n TEST_DATA()\n RVTEST_DATA_END()\n end", "def before_tests(&block)\n @before_tests_proc = block\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def post_setup\n end", "def setup\n\n # Save the Global variable's original settings so that they can be changed in this\n # test without affecting other test, so long as they are restored by teardown\n @@VERBOSE_ORIG = $VERBOSE\n @@DEBUG_ORIG = $DEBUG\n @@FAST_SPEED_ORIG = $FAST_SPEED\n @@HIDE_IE_ORIG = $HIDE_IE\n\n @@tTestCase_StartTime = Time.now\n\n end", "def setup\n true\n end", "def after_setup\n # do nothing by default\n end", "def setup\n\t\tend", "def setup\n\t\tend", "def testing_begin(files)\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def test_order; end", "def before_running(*args); end", "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end", "def setup\n # override this if needed\n end", "def before_teardown; end", "def test_before_preload\n Spin.execute_hook(:before_preload)\n\n assert Rails::Initializer.respond_to?(:run)\n assert Rails::Initializer.new(Rails::Configuration.new).respond_to?(:preload)\n assert Rails::Initializer.new(Rails::Configuration.new).respond_to?(:postload)\n end", "def setup\r\n end", "def setup\n\t\t\t\tp \"mytest1 setup\"\n\t\tend", "def setup\n @tracer = $tracer\n @test_id = format \"%032x\", rand(0x100000000000000000000000000000000)\n refute_nil @tracer, \"You do not have an active tracer to run the tests.\"\n super\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def before\n if @pkg.has_key? :cmd and @pkg[:cmd].has_key? :before\n logger.info \"Executing before commands...\"\n run :before\n end\n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def test_should_be_setup\n assert false\n end", "def _before_all # :nodoc:\n #: prints Benchmarker.platform().\n print Benchmarker.platform()\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup \n if @@before_flag.nil?\n\t@login=Login.new\n\t@browser= @login.init\n\tputs 'running setup code'\n\t@@before_flag = true\n end\nend", "def setup\n\n end", "def setup\n\n end", "def setup\n # no setup\n\tend", "def init_tests\n unless @init_tests\n @test_duration = 0\n @num_tests_run = 0\n @num_tests_failed = 0\n @num_tests_ok = 0\n @num_tests_skipped = 0\n @init_tests = true\n end\n end", "def before_perform\n end", "def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end", "def setup\n end" ]
[ "0.8191394", "0.8191394", "0.7743806", "0.7666647", "0.76002425", "0.7536173", "0.7434413", "0.7418728", "0.7411774", "0.73645866", "0.7357274", "0.73299724", "0.7199651", "0.71249783", "0.70662016", "0.7026113", "0.699139", "0.699139", "0.69620526", "0.69476277", "0.69476277", "0.69349754", "0.69083196", "0.6897573", "0.68837255", "0.68703395", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6819464", "0.6801821", "0.6801027", "0.6789712", "0.6741548", "0.671728", "0.6711535", "0.6711535", "0.6694275", "0.66768575", "0.66768575", "0.66768575", "0.66768575", "0.66768575", "0.66768575", "0.66768575", "0.6675898", "0.6671422", "0.6643833", "0.6620075", "0.6612953", "0.66031903", "0.65860665", "0.65800816", "0.65796137", "0.6577135", "0.6577135", "0.6577135", "0.6577135", "0.6577135", "0.6577135", "0.6575294", "0.6575016", "0.6575016", "0.6575016", "0.6575016", "0.6575016", "0.6575016", "0.6575016", "0.657159", "0.65506405", "0.65465426", "0.65465426", "0.65465426", "0.6531825", "0.6531825", "0.6531825", "0.6531825", "0.6531825", "0.65115434", "0.6503104", "0.6503104", "0.65020925", "0.6491398", "0.64905745", "0.64841104", "0.647176" ]
0.0
-1
Is executed after each test run
def after_all(&block) @runner.set_after_all(@current_platform, block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def testing_end\n end", "def after_teardown; end", "def teardown\n\t\tputs \"Completed unit test execution\"\n\tend", "def after; end", "def after; end", "def after\n end", "def after\n end", "def after\n end", "def after\n end", "def after() nil ; end", "def before_teardown; end", "def after\n\t\t\ttrue\n\t\tend", "def teardown; end", "def teardown; end", "def teardown\r\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n # empty\n end", "def done\n puts 'Done running tests'\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def run_after_each\n #puts \"[#{Process.pid}] #{self} after_each\"\n @example_group_instance.verify_mocks_for_rspec\n Amnesia.check_for_server_errors!\n end", "def teardown\n end", "def teardown\n end", "def teardown\n # if necessary\n end", "def teardown\n puts \"tear down\"\n end", "def teardown\n\tend", "def teardown\n\tend", "def teardown!\n\n end", "def teardown\n end", "def teardown\n @suite.p \"\\n:: [TEARDOWN]\\n\"\n end", "def teardown\n # Empty\n end", "def teardown\n # Empty\n end", "def after_setup\n # do nothing by default\n end", "def post_setup\n end", "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def after_finished\n end", "def running_test_step; end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def running_test_case; end", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\n # do something\n end", "def recycle; teardown; setup; end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def before_test(test); end", "def before_test(test); end", "def test_setup\r\n \r\n end", "def tests; end", "def tests; end", "def teardown\n # No-op\n end" ]
[ "0.86707735", "0.86707735", "0.86707735", "0.8007437", "0.78610283", "0.77998394", "0.7787088", "0.7787088", "0.77685463", "0.7731589", "0.7731589", "0.77110887", "0.75407887", "0.74501187", "0.7372534", "0.73336196", "0.73336196", "0.7324972", "0.7317415", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.7313462", "0.728593", "0.728593", "0.728593", "0.728593", "0.728593", "0.728593", "0.728593", "0.728593", "0.7238387", "0.72368044", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.7221331", "0.71967757", "0.7182253", "0.7182253", "0.71783394", "0.716582", "0.7155719", "0.7155719", "0.71271783", "0.7123422", "0.71053666", "0.7095131", "0.7095131", "0.70718807", "0.70354605", "0.6995099", "0.6995099", "0.6970549", "0.696467", "0.6959445", "0.6959445", "0.6959445", "0.6959445", "0.6959445", "0.6959445", "0.6959445", "0.6959445", "0.6959445", "0.6959445", "0.6946278", "0.6939991", "0.6939991", "0.6939991", "0.69310194", "0.69271123", "0.69229525", "0.69229525", "0.6896186", "0.6896186", "0.6893303", "0.68719244", "0.68719244", "0.6869918" ]
0.0
-1
Is executed if an error occured during fastlane execution
def error(&block) @runner.set_error(@current_platform, block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_failed; end", "def do_failure; end", "def handle_perform_error(_e); end", "def script_error(path, error); end", "def run_and_raise_on_failure\n # TODO ?\n end", "def error!\n @error = true\n end", "def run_failed(exception)\n super\n Chef::Log.warn(\"<< END >>\")\n end", "def safe_run\n run\n rescue Ohai::Exceptions::Error => e\n @failed = true\n raise e\n rescue => e\n @failed = true\n logger.trace(\"Plugin #{name} threw #{e.inspect}\")\n e.backtrace.each { |line| logger.trace( line ) }\n end", "def run_succeeded; end", "def failure\n end", "def failure!\n end", "def error\n failure\n end", "def job_error\n command = params[:command].to_sym\n message = params[:message]\n @project.send(\"#{command}_fail!\", nil, message)\n head :ok\n end", "def run(cmd)\n result = super(cmd)\n if result.error?\n display \"FAILURE\"\n display result.error\n remove_livedev_run_file\n exit 1\n end\n end", "def testRunActionWithError\n executeSlave(\n [\n '--user', 'DummyUser',\n '--tool', 'DummyTool',\n '--action', 'DummyActionError'\n ],\n :AddRegressionActions => true,\n :Repository => 'Dummy/AllDummyActionsAvailable',\n :Error => WEACE::Slave::Client::ActionExecutionsError\n ) do |iError|\n assert(defined?(iError.ErrorsList))\n assert(iError.ErrorsList.kind_of?(Array))\n assert_equal(1, iError.ErrorsList.size)\n assert(iError.ErrorsList[0].kind_of?(Array))\n assert_equal(5, iError.ErrorsList[0].size)\n lProduct, lTool, lAction, lParams, lError = iError.ErrorsList[0]\n assert_equal('RegProduct', lProduct)\n assert_equal('DummyTool', lTool)\n assert_equal('DummyActionError', lAction)\n assert_equal([], lParams)\n assert(lError.kind_of?(WEACE::Slave::Adapters::DummyProduct::DummyTool::DummyError))\n end\n end", "def handle_unsuccessful_instruments_run\n return if @test_suite.nil?\n return if @current_test.nil?\n\n if @restarted_tests[@current_test]\n @test_suite[@current_test].error(\"Illuminator could not get this test to complete\")\n save_junit_test_report\n @current_test = nil\n else\n @restarted_tests[@current_test] = true\n end\n end", "def storage_failure=(_arg0); end", "def fail\n # no-op\n end", "def error(exception)\n logger.info \"execution failed: #{exception}\"\n end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def agent_failed(type); end", "def error\n @status = ERROR_FLAG if @status == SUCCESS_FLAG\n end", "def failed!\n @success = false\n end", "def error!\n # Unhandled exception\n if @exception\n exception_message\n exit 2\n # Some checksums did not match?\n elsif !(invalid_packages.empty? && invalid_metadata_files.empty?)\n error_message\n exit 2\n # We don't have checksums for some packages?\n elsif unverifiable_package_count != 0\n unverifiable_packages_message\n exit 2\n else\n success_message\n exit 0\n end\n end", "def test_sample3\n\n @action.tap_non_exist_elememnt\n\n rescue StandardError => e\n @action.error_handling(scenario_name: method_name, error_obj: e)\n end", "def error_thread_crash error, error_location; end", "def recoverable_error e, msg = \"Error\", bt = []\n puts \"#{msg} at time #{clock}\"\n puts \"From \" + bt[0..2].join(\"\\n \") unless bt.empty\n puts \" ...\" if bt.length > 3\n shell.run\n end", "def fail\n @failed = true\n end", "def failures; end", "def failures; end", "def failures; end", "def failed?; state == 'failed'; end", "def failed?; state == 'failed'; end", "def post_fail_message; end", "def continue_on_error\n @continue_on_error = true\n end", "def error( text )\n puts \"Script #{@name} #{version} - Error: #{text}\"\n exit 1\n end", "def failure?\n exit_code != 0\n end", "def error!(status, msg)\n error msg\n exit status\n end", "def unsuccessful\n end", "def error?; end", "def error?; end", "def error?; end", "def on_error error\n super(error)\n Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, {\n success: false,\n step: 'prepare',\n error: error.class,\n message: error.message,\n counts: counts,\n files: files,\n })\n Wukong::Deploy.vayacondios_client.set(vayacondios_topic, \"prepare.last\", { state: 0, time: Time.now.utc.to_i })\n end", "def augment_fail(send, line)\n @phase = :execute\n @code = make_runnable(@code)\n\n begin\n open(\"log/simplemode.log\", 'a') do |file|\n file.puts '--------------------------------'\n file.puts Time.now\n file.puts '--------------------------------'\n file.puts @augmented_code\n file.puts \"\\n\\n\\n\"\n\n @augmented_code = nil\n end\n ensure\n send.call([\n {:write_file => {:filename => @filename, :content => @code}},\n {:execute => {:command => \"env PYTHONPATH=$LIB$/python #{VM_PYTHON} -B #{@filename}\",\n :stdout => 'executeoutput',\n :stderr => 'executeerror'}}])\n return {:type => :warning, :message => 'Start im vereinfachten Modus.'}\n end\n end", "def custom_failure!\n @custom_failure = true\n end", "def failure?; terminal_flag == :failure end", "def failure?; terminal_flag == :failure end", "def error!\n throw :return, -1\n end", "def execute_error(send, line)\n # Send the exit command if that hasn't already happened\n if not @exit_sent\n send.call([{:exit => {:successful => false}}])\n @exit_sent = true\n end\n\n # Output the error line\n return error_line(line)\n end", "def fail\n end", "def checkErroredStatus\n case @stage\n when DOWNLOAD\n $log.info{ \"check downloaded file. @downNG=#{@downNG}\" }\n return true if @downNG\n rawFileError?\n when CONVERT\n outFileError?\n else\n true\n end\n end", "def after_failed\n end", "def failed?; failed_to_start? || (@success == false) end", "def fail!\n @failed = true\n end", "def fatal; end", "def error\n end", "def run_with_failure_handler(command, action_name)\n base.say_status action_name.downcase, ''\n stdout, stderr, exit_code, exit_status = base.exec(command, :with_codes => true)\n \n if exit_code != 0\n base.say_status :error, \"Unable to #{action_name}, see output below\", :red\n puts stdout\n puts stderr\n \n raise \"Unable to configure #{action_name}\"\n end\n end", "def fail!\n @success = false\n end", "def fail!\n @success = false\n end", "def failure(message)\n $stderr.puts \"#{name}: #{message}\"\n exit 1\n end", "def assert_error_occurred\n assert_not_exit_status 0\n end", "def action_error\n puts\n puts \"Sorry, I don't recognize that command.\"\n puts\nend", "def fail_script(message)\n raise \"Build failed! #{message}\"\n end", "def fail_script(message)\n raise \"Build failed! #{message}\"\n end", "def handle_errors(output)\n if $? != 0\n puts output\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"~ FATAL: Command failed with status #{$?}\"\n exit 1\n end\nend", "def run_action(&_block)\n yield\n rescue ::Zanzibar::Error => e\n @ui.error e\n abort \"Fatal error: #{e.message}\"\n end", "def fail!\n @success = false\n end", "def on_failure(object, *args); end", "def failed?\n true\n end", "def step_fails(response, failure)\n @step_failed = true\n flow = @flow_steps.keys.last\n step_no = @flow_steps[flow].size\n step_key = @flow_steps[flow].last\n failure = %{deploy faild on #{flow}(#{step_no}):#{step_key}\\n} + failure\n response.reply(failure)\n end", "def normal_failed?\n return status == PRE_FAILED ||\n status == WORKFLOW_FAILED ||\n status == UPLOADING_RESULTS_VCF_FAILED ||\n status == UPLOADING_RESULTS_SCORE_FAILED\n end", "def handleError(msg)\n obj = ErrorMessage.new()\n obj.msgDetail = \"LIMS upload error. Error message : \" + msg.to_s\n obj.msgBrief = \"LIMS upload error for : \" + @fcBarcode.to_s\n obj.fcBarcode = @fcBarcode.to_s\n obj.workingDir = Dir.pwd\n ErrorHandler.handleError(obj)\n exit -1\n end", "def failure(result)\n logger.error \"Beetle: handler has finally failed\"\n end", "def setup_failed(ant)\n end", "def error\n end", "def error\n raise Exception, \"An example of what an error looks like if you make a mistake using Commandable.\"\n end", "def example_failed(_)\n end", "def fatal?; end", "def fatal?; end", "def handleError(msg)\n obj = ErrorMessage.new()\n obj.msgDetail = msg\n obj.msgBrief = \"Error in BCL to Fastq conversion for flowcell : \" +\n @fcName.to_s\n obj.workingDir = Dir.pwd\n ErrorHandler.handleError(obj)\n exit -1\n end", "def errored_during_import?\n import_errors.present?\n end", "def error\n\t\t\traise 'Test'\n\t\tend", "def error(exception) nil ; end", "def errorhandling\n end", "def failures=(_arg0); end", "def failures=(_arg0); end", "def for_broke(ci)\n begin\n ci.run\n\n rescue HaltState\n # nop\n rescue err\n puts err.message\n puts 'should not have got this'\n end\nend", "def error\n get_ingest_run.error\n end", "def storage_failure; end", "def communicate_failure\n File.open(\"#{@options[:output_directory]}/failed.job\", 'w') { |f| f << \"Failed Workflow #{::Time.now} #{@options}\" }\n raise 'Missing required options' unless @options[:url] && @options[:datapoint_id] && @options[:project_id]\n send_status('Failed')\n send_file(\"#{@options[:output_directory]}/run.log\")\n Dir.glob(\"#{@options[:output_directory]}/../reports/*\").each { |f| send_file(f) }\n end", "def error(handler)\n puts '! Error occurred' if handler.bot.debug\n end", "def error_poslook_crash error, error_location; end", "def criticalError(msg='Critical error')\n logExceptionMsg msg\n do_action 'StopSociety' if run\n exit 1\nend", "def load_error=(_arg0); end" ]
[ "0.7450605", "0.68349755", "0.67693335", "0.64711595", "0.64388937", "0.6417038", "0.6408433", "0.6390398", "0.63609564", "0.6341201", "0.63392246", "0.6338438", "0.63048375", "0.6301034", "0.6284259", "0.62658155", "0.62390685", "0.62196827", "0.62176543", "0.61996114", "0.61996114", "0.61996114", "0.61996114", "0.61996114", "0.61996114", "0.61996114", "0.619371", "0.61830693", "0.6181811", "0.6176383", "0.615852", "0.6158338", "0.61515015", "0.6147575", "0.6141864", "0.6141864", "0.6141864", "0.6102807", "0.6102807", "0.6098553", "0.6087859", "0.60621667", "0.60519016", "0.604855", "0.6046111", "0.60409766", "0.60409766", "0.60409766", "0.60331917", "0.6026232", "0.6015667", "0.60128516", "0.60128516", "0.60114956", "0.59992874", "0.5996177", "0.599515", "0.599355", "0.59909314", "0.59772396", "0.5973731", "0.5965604", "0.5965387", "0.5961354", "0.5961354", "0.5952709", "0.59366685", "0.5897419", "0.5885165", "0.5885165", "0.58735955", "0.5861075", "0.5860425", "0.5852538", "0.5841138", "0.58373886", "0.58372396", "0.5830595", "0.5819824", "0.5819576", "0.5812731", "0.5809637", "0.5809495", "0.5809167", "0.5809167", "0.5800448", "0.57824016", "0.5782294", "0.5781972", "0.57795477", "0.577122", "0.577122", "0.57661116", "0.5765388", "0.5764979", "0.5763926", "0.57550335", "0.57546043", "0.5750526", "0.5745218" ]
0.6349904
9
Is used to look if the method is implemented as an action
def method_missing(method_sym, *arguments, &_block) # First, check if there is a predefined method in the actions folder class_name = method_sym.to_s.fastlane_class + 'Action' class_ref = nil begin class_ref = Fastlane::Actions.const_get(class_name) rescue NameError => ex # Action not found raise "Could not find method '#{method_sym}'. Check out the README for more details: https://github.com/KrauseFx/fastlane".red end if class_ref && class_ref.respond_to?(:run) collector.did_launch_action(method_sym) step_name = class_ref.step_text rescue nil step_name = method_sym.to_s unless step_name verify_supported_os(method_sym, class_ref) Helper.log_alert("Step: " + step_name) begin Dir.chdir('..') do # go up from the fastlane folder, to the project folder Actions.execute_action(method_sym) do # arguments is an array by default, containing an hash with the actual parameters # Since we usually just need the passed hash, we'll just use the first object if there is only one if arguments.count == 0 arguments = ConfigurationHelper.parse(class_ref, {}) # no parameters => empty hsh elsif arguments.count == 1 and arguments.first.kind_of?Hash arguments = ConfigurationHelper.parse(class_ref, arguments.first) # Correct configuration passed elsif not class_ref.available_options # This action does not use the new action format # Just passing the arguments to this method else Helper.log.fatal "------------------------------------------------------------------------------------".red Helper.log.fatal "If you've been an existing fastlane user, please check out the MigrationGuide to 1.0".yellow Helper.log.fatal "https://github.com/KrauseFx/fastlane/blob/master/docs/MigrationGuide.md".yellow Helper.log.fatal "------------------------------------------------------------------------------------".red raise "You have to pass the options for '#{method_sym}' in a different way. Please check out the current documentation on GitHub!".red end class_ref.run(arguments) end end rescue => ex collector.did_raise_error(method_sym) raise ex end else raise "Action '#{method_sym}' of class '#{class_name}' was found, but has no `run` method.".red end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_method?(name); end", "def action_method?(name)\n self.class.action_methods.include?(name)\n end", "def available_action?(action_name); end", "def action_method?\n nil\n end", "def respond_to?(method, include_private = false)\n (actions(current_api).include? method) ? true : super\n end", "def has_action?(action)\n @actions.include? action\n end", "def interface_supports(action)\n @interface.respond_to?(action)\n end", "def visible_action?(name)\n true #['perform', action_name].include? name\n end", "def method_for_action(action_name)\n self.class.visible_action?(action_name) && super\n end", "def has_action?(name)\n !!find_action_by_name(name)\n end", "def respond_to?(method)\n return true if !enabled? || soap_actions.include?(method)\n super\n end", "def has_actions?\n if self.actions == []\n return false\n else\n return true\n end\n end", "def valid?(action)\n self.respond_to?(action.to_sym) && VALID_ACTIONS.include?(action)\n end", "def action_want_to_perform(arg)\r\n self.class.actions_allowed[arg]\r\n end", "def action_hook?(self_only = T.unsafe(nil)); end", "def action_argument_required?\n !AVAILABLE_ACTIONS.empty?\n end", "def method?(meth)\n get_method(meth)\n end", "def method?\n type == TYPE_METHOD\n end", "def method?\n type == TYPE_METHOD\n end", "def registered?(method); end", "def action_allowed?(action_name, user)\n return false\n end", "def action_defined?\n # ReputationThreshold.action_defined?(self.action, self.tier)\n !self.action_points.nil?\n end", "def match?(action, object)\n true\n end", "def action?\n action_channel.in_use?\n end", "def respond_to?(api_method) # :nodoc:\n @client.wsdl.soap_actions.include?(api_method.to_sym)\n end", "def _valid_action_name?(action_name); end", "def only_render_implemented_actions\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n end", "def available_actions\n fail NotImplementedError\n end", "def available_action?(action_name)\n _find_action_name(action_name)\n end", "def method_defined?(arg0)\n end", "def determine_valid_action\n\n end", "def method_for_action(action_name); end", "def method_defined?(p0) end", "def action_defined?(action, tier=nil)\n if tier && !tier.accept_default_reputation_threshold\n if rate = tier.find_reputation_threshold_action_points(action)\n return !!rate.points\n end\n end\n respond_to?(action.to_sym)\n end", "def respond_to? method\n method.to_s =~ /^do_[A-Z]+$/ ? true : super\n end", "def action_defined?(action, controller)\n if registered?(controller)\n return true if storage[controller][:actions].include?(action)\n\n fail Vedeu::Error::ActionNotFound,\n \"#{action} is not registered for #{controller}.\"\n\n else\n fail Vedeu::Error::ControllerNotFound,\n \"#{controller} is not registered.\"\n\n end\n end", "def respond_to?(method)\n return super unless part(method)\n part(method)\n end", "def respond_to?(meth)\n\t\ttrue\n\tend", "def action_defined?(action, controller)\n if registered?(controller)\n return true if storage[controller][:actions].include?(action)\n\n fail Vedeu::Error::ActionNotFound,\n \"#{action} is not registered for #{controller}.\".freeze\n\n else\n fail Vedeu::Error::ControllerNotFound,\n \"#{controller} is not registered.\".freeze\n\n end\n end", "def action_defined?(action, controller)\n if registered?(controller)\n return true if storage[controller][:actions].include?(action)\n\n raise Vedeu::Error::ActionNotFound,\n \"#{action} is not registered for #{controller}.\"\n\n else\n raise Vedeu::Error::ControllerNotFound,\n \"#{controller} is not registered.\"\n\n end\n end", "def special_action?\n SPECIAL_ACTIONS.include?(action.to_sym)\n end", "def single_actions?\n false\n end", "def member_action?\n member_actions.include?(action)\n end", "def method?(name)\n method_name == name.to_sym\n end", "def valid_proxy_method?\n rpc_action? || rpc_action_abbrev?\n end", "def actions?\n non_empty?(@actions)\n end", "def valid_meth?(fn)\n fn.is_a?(Method)\n end", "def method_for_action(action_name)\n if action_method?(action_name) then action_name\n elsif respond_to?(:action_missing, true) then \"_handle_action_missing\"\n end\n end", "def respond_to_missing?(method, include_private = true)\n method.to_s.end_with?(ACTION_SUFFIX) || super\n end", "def current_action?(*args)\n args.any? { |v| v.to_s.downcase == action_name }\n end", "def current_action?(*args)\n args.any? { |v| v.to_s.downcase == action_name }\n end", "def current_action?(*args)\n args.any? { |v| v.to_s.downcase == action_name }\n end", "def current_action?(*args)\n args.any? { |v| v.to_s.downcase == action_name }\n end", "def method_missing(*args)\n method_name = args.first.to_s\n if method_name=~/is_.*[?]/\n roles = method_name.gsub(/is_(.*)[?]/, \"\\\\1\")\n roles.split(\"_or_\").each do |role|\n return name.underscore==role\n end\n elsif method_name=~/has_.*[?]/\n controller = args.second\n action = method_name.gsub(/has_(.*)[?]/, \"\\\\1\")\n return has_permission(controller, action)\n else\n super(*args)\n end\n end", "def respond_to?(method)\n return true if name?(method.to_sym)\n super\n end", "def invoked?\n !!@invoked\n end", "def valid_action?(value)\n action_names.include?(value)\n end", "def respond_to_missing?(method)\n @callbacks.key?(method)\n end", "def respond_to_missing?(method)\n @callbacks.key?(method)\n end", "def actions_available?(user)\n actions_allowable?(user)\n end", "def only_render_implemented_actions\n raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def controlable?\n respond_to?(:call)\n end", "def controller_action_defined?(controller, action)\n controller_obj = \"#{controller}_controller\".camelize.constantize.new\n controller_obj.respond_to? action.to_s\n end", "def controller_action_defined?(controller, action)\n controller_obj = \"#{controller}_controller\".camelize.constantize.new\n controller_obj.respond_to? action.to_s\n end", "def process\n raise \"#{self.class}: method #{__method__} must be implemented for #{@reference_action_def.to_s}.\"\n end", "def has_handler?(method)\n send(method) && true\n end", "def action?\n text[0,8] == \"\\001ACTION \"\n end", "def process_action(method_name, *args); end", "def authorize_action?(action_name)\n\t User.current_user.role.authorize_action?(action_name, self.class.controller_path)\n\tend", "def invoked?(sym)\n invocations[sym] > 0\n end", "def dispatched\n dispatched?\n end", "def method_valid?(method_name)\n # validate method, see if we support given method in current tasks\n (current_context_task_names() + ['help']).include?(method_name)\n end", "def respond_to?(name_) # :nodoc:\n super || @methods.include?(name_.to_sym)\n end", "def handleAction evt, action, caller\n # DO NOTHING - this method shall be implemented by the children\n return false\n end", "def method_for_action(action_name)\n if action_method?(action_name)\n action_name\n elsif respond_to?(:action_missing, true)\n \"_handle_action_missing\"\n end\n end", "def method_missing(action, *args)\n action.to_s =~ /^(.+)!$/\n if $1 && respond_to?($1)\n send($1, *args)\n status\n else\n super.method_missing(action, *args)\n end\n end", "def real_method_object?(code_object)\n code_object.is_a?(::Method) || code_object.is_a?(::UnboundMethod)\n end", "def find_action_method( txn, action, *args )\n\t\treturn self.method( action ) if self.respond_to?( action )\n\n\t\t# Otherwise, return an appropriate error response\n\t\tself.log.error \"request for unimplemented %p action for %s\" % [ action, txn.uri ]\n\t\treturn self.method( :not_allowed )\n\tend", "def supported_for_action?(field)\n return true if field['action'].nil? || @action.nil?\n return field['action'].include?(@action.to_s) if field['action'].is_a?(Array)\n\n field['action'] == @action.to_s\n end", "def authorized?(user, action)\n\t\ttrue\n\tend", "def matches? meth\n navigate_method?(meth) || element_id_method?(meth) || wait_method?(meth) || element_id_exists_method?(meth)\n end", "def respond_to_missing?(*args)\n method_name = args.first\n delegates_controller_method?(method_name) || super\n end", "def action?(*action)\n \t\taction.include?(params[:action])\n \tend", "def route? method\n if @tracker.routes[:allow_all_actions] or @tracker.options[:assume_all_routes]\n true\n else\n routes = @tracker.routes[@current_class]\n routes and (routes.include? :allow_all_actions or routes.include? method)\n end\n end", "def respond_to?(method_sym, include_private = false)\n #puts \"ObserverForwarder.respond_to?(#{method_sym})\"\n if method_sym.to_s =~ /^on[A-Z_]/\n #puts \"> Observer Event!\"\n true\n else\n super\n end\n end", "def respond_to_missing?( id, priv = false ) id != :call; end", "def action_hook; end", "def can?(action, feature)\n !!(get_feature(feature) =~ /#{action.to_s}/)\n end", "def is_public_action?\n klass = self.class\n return false unless klass.const_defined? 'PUBLIC_ACTIONS'\n klass::PUBLIC_ACTIONS.collect(&:to_s).include? action_name\n end", "def method_registered?(method)\n self.class.method_registered?(method)\n end", "def caller?(meth)\n return @context.caller?(meth,self)\n end", "def msg_in_context?(msg, context) \n super.allow? name = context[:method_name]\n end", "def resource_action?(resource_type, action)\n resource_check?(:actions, resource_type, action)\n end", "def playable_action\n raise NotImplementedError\n end", "def can? action, &block\n @action = action.to_s.sub('?','') + '?'\n @action = @action.to_sym\n\n # pre check\n raise RuntimeError, 'Method name not allowed' if %w(can).index(@action)\n raise NoMethodError, %[Policy check \"#{action}\" not found in #{self.class}] unless respond_to?(@action)\n\n call &block\n end", "def respond_to?(method_name)\n @instance.respond_to?(method_name) || super\n end", "def can?(_action, _action_feat)\n wrapper = ActionWrapper.new(self, _action, _action_feat)\n begin\n provider = if brk_provider.is_a? Symbol then self.method(brk_provider) else brk_provider end\n wrapper.instance_eval &provider\n return false\n rescue Interrupt\n return (if wrapper.tag.nil? then true else wrapper.tag end)\n end\n end", "def respond_to?(method_id, include_private = false)\r\n if method_id.to_s =~ /^mark_as_([a-z]+)_for\\!$/ || method_id.to_s =~ /^mark_as_not_([a-z]+)_for\\!$/ || method_id.to_s =~ /^check_([a-z]+)_for\\?$/\r\n true\r\n else\r\n super\r\n end\r\n end" ]
[ "0.817691", "0.78048956", "0.75613153", "0.7503209", "0.74374497", "0.72178733", "0.7198545", "0.7082892", "0.70244944", "0.69918525", "0.6966761", "0.6958844", "0.6926446", "0.69153494", "0.6914703", "0.69070005", "0.68965054", "0.6891227", "0.6891227", "0.6879159", "0.685653", "0.6811843", "0.67750823", "0.6774656", "0.67745376", "0.67613965", "0.67332953", "0.67139924", "0.6708287", "0.6687949", "0.6679524", "0.6669733", "0.66685766", "0.6647091", "0.66287196", "0.6614975", "0.6611058", "0.660415", "0.660305", "0.6598473", "0.6594078", "0.658759", "0.65452445", "0.6535374", "0.6508909", "0.64946324", "0.6491758", "0.64903545", "0.6487141", "0.6482236", "0.6482236", "0.6482236", "0.6482236", "0.64725906", "0.6469583", "0.6464847", "0.6463632", "0.6462737", "0.6462737", "0.64481324", "0.6438854", "0.64362854", "0.64362854", "0.64362854", "0.64151186", "0.63866615", "0.63866615", "0.6381739", "0.63806325", "0.6378907", "0.6373757", "0.63718176", "0.63609", "0.63502735", "0.63479906", "0.6326312", "0.6325087", "0.6321194", "0.63123655", "0.6310097", "0.6303929", "0.6293985", "0.62835383", "0.6276925", "0.6274588", "0.6274438", "0.6259005", "0.6248417", "0.6243936", "0.6242866", "0.6230551", "0.6225555", "0.6224284", "0.6223727", "0.621529", "0.6214071", "0.6210161", "0.6205117", "0.6204016", "0.61991966", "0.6193179" ]
0.0
-1
Is the given key a platform block or a lane?
def is_platform_block?(key) raise 'No key given'.red unless key return false if (self.runner.blocks[nil][key.to_sym] rescue false) return true if self.runner.blocks[key.to_sym].kind_of?Hash raise "Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}".red end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_tile?\n BLOCK_SIZES.has_key?(kind)\n end", "def key?(p0) end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def is_elkey?(); @type == GRT_ELKEY; end", "def capable?(key); end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def key?(*) end", "def mount_key_eql?(v)\n mount_key == v\n end", "def key?(key)\n configuration.key?(key.to_sym) || config_contexts.key?(key.to_sym)\n end", "def threads_key?(key); end", "def key_match?(passed_key, user)\n return false unless passed_key\n passed_key == process_key(user.secret_key)\n end", "def minor_key?\n @data[1]\n end", "def supported_key?(key)\n Primer::Classify::UTILITIES[key].present?\n end", "def key?(key)\n key = to_key key\n @group.key? key\n end", "def key_of_type?(hash, key, type)\n return false unless hash.length == 1\n\n hash.key?(key) && hash[key].is_a?(type)\n end", "def is_key_entry(aliaz)\n\n end", "def key?\n return true if @key; false\n end", "def key?(key)\n public_method_defined?(key.to_sym)\n end", "def key_valid?\n token_valid? and @key\n end", "def key?\n @key\n end", "def key?\n @key\n end", "def valid\n if self.key\n key_pieces = self.key.split(\" \")\n small_key = key_pieces[0] + \" \" + key_pieces[1]\n #if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+]+==?).*$/\n if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+].*)$/\n return true\n else\n return false\n end\n else\n return false\n end\n end", "def verified?\n key == '1'\n end", "def key\n return KEY_APOCALYPSE if apocalypse?\n return KEY_BATTLEGROUND if battleground?\n KEY_PLANET\n end", "def has_key?(p0) end", "def valid_taproot_commitment?(control, program, leaf_hash)\n begin\n p = Bitcoin::Key.from_xonly_pubkey(control.internal_key)\n k = leaf_hash\n control.paths.each { |e| k = Bitcoin.tagged_hash('TapBranch', k.bth < e ? k + e.htb : e.htb + k) }\n q = Bitcoin::Taproot.tweak_public_key(p, k.bth).to_point\n return q.x == program.bti && control.parity == (q.y % 2)\n rescue ArgumentError\n return false\n end\n end", "def key_pressed?(key)\n key_const = Gosu.const_get(:\"Kb#{key.to_s.gsub(/\\b\\w/){$&.upcase}}\")\n button_down?(key_const)\n end", "def key?(key)\n configuration.key?(key)\n end", "def present?(key)\n types.key?(key.class)\n end", "def is_top_level_key\n return [\n '/plist/dict/key'\n ].any? { |bc|\n @breadcrumb === bc\n }\n end", "def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end", "def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end", "def key?(key)\n config.resolver.key?(_container, key)\n end", "def key?(key)\n raise NotImplementedError\n end", "def threads_key?(key)\n @pool.key?(key)\n end", "def key?(node)\n return @hash.key?(node.sha1)\n end", "def snake_can_change_direction?(key)\n value = false\n @move_patterns.each do |move|\n if move.include?(key)\n unless move.include?(key) && move.include?(@direction)\n value = true\n end\n end\n end\n value\n end", "def has_key?\n return false if !role_data\n role_data['type'] == 'api'\n end", "def key?(key)\n lookup_map.key?(key.to_sym)\n end", "def major_key?\n !@data[1]\n end", "def key_inheritable_in_parent?(*key)\n !key_nonheritable_in_parent?(format_key(key.first))\n end", "def valid_key?(match_data)\n match_data[:key].to_i == (97 - match_data[1..-2].join.to_i) % 97\nend", "def blockPresent(stage)\n\tmap = stage[0]\n\tlocation = stage[1]\n\tdirection = stage[2]\n\thasBlock = stage[3]\n\tif hasBlock == false\n\t\tcase direction\n\t\twhen 0\n\t\t\tif location < map.length-1 && map[location+1][0] == map[location][0]+1 && map[location+1][1] > 0\n\t\t\t\treturn true\n\t\t\tend\n\t\twhen 1\n\t\t\tif location > 0 && map[location-1][0] == map[location][0]+1 && map[location-1][1] > 0\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\telsif hasBlock == true\n\t\tcase direction\n\t\twhen 0\n\t\t\tif location < map.length-1 && map[location+1][0] <= map[location][0]+1\n\t\t\t\treturn true\n\t\t\tend\n\t\twhen 1\n\t\t\tif location > 0 && map[location-1][0] <= map[location][0]+1\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\tend\n\treturn false\nend", "def key_pressed?(key)\n SDL::Key.press?(key)\n end", "def has_key?(key)\n (@stack.length - 1).downto(0).each do |i|\n return true if @stack[i].key? key\n end\n false\n end", "def unqualify?(key)\n key[0, 1] == \":\"\n end", "def local?(key)\n get_chunk(key) && true\n end", "def key?(key)\n return false if key.nil?\n return true if self.class.mutable? && mutations.key?(key)\n\n respond_to?(key) || fallback_data.key?(key)\n end", "def has_key? k\n host_hash.has_key?(k) || options.has_key?(k)\n end", "def key? key\n each_pair.find {|k, _| key == k } && true\n end", "def has_key?(key); end", "def has_key?(key); end", "def vagrant_key?(node)\n node.key?('vagrant')\n end", "def key?(key)\n @configuration.key?(key)\n end", "def key?(container, key)\n container.key?(key.to_s)\n end", "def inside?(key)\n @counter[key] > 0\n end", "def has_block(blk_hash)\n raise \"Not implemented\"\n end", "def key?(key)\n raise \"you are not allowed to use double dot '..' notation in paths\" if key.match(/\\.\\.\\//)\n ::File.exists?(full_key(key))\n end", "def course_component?(key)\n valid_components = %w(AttendanceRegisters Glossary News Checklists\n Grades QuestionLibrary Competencies GradesSettings\n Quizzes Content Groups ReleaseConditions CourseFiles\n Homepages Rubrics Discussions IntelligentAgents\n Schedule DisplaySettings Links SelfAssessments\n Dropbox LtiLink Surveys Faq LtiTP ToolNames Forms\n Navbars Widgets)\n valid_components.include?(key)\n # returns whether the key is actually a course component\nend", "def tms?(key)\n key.to_s.match?(/#{config.tms_tag}(_\\d+)?/i)\n end", "def key?(key, is: ANY)\n v = wrap(is)\n proc do |o|\n o.is_a? Hash and (o.key?(key) ? v.call(o[key]) : false)\n end\n end", "def key?(key)\n @semaphore.synchronize do\n return @hashed_storage.key? key\n end\n end", "def valid_key?(key)\n return false unless key.is_a?(String)\n return false unless key = encoded_key(key)\n key.length >= 2 && key.length <= 255 && (key !~ BAD_KEY_RE rescue false)\n end", "def contain?(key)\n methods.key?(key)\n end", "def nesting_operator?(key)\n NestingOperators.include?(key)\n end", "def in?(key)\n start_slot = hasher(key, @keys.size)\n position = start_slot\n found = false\n\n while @keys[position] != nil and !found\n if @keys[position] == key\n found = true\n else\n position = rehash(position, @keys.size)\n break if position == start_slot\n end\n end\n\n found\n end", "def is_linkkeys?(); @type == GRT_LINKKEYS; end", "def multi_key?\n @multi_key\n end", "def key?(key)\n super(convert_key(key))\n end", "def key?(key, options = {})\n load(key, options) != nil\n end", "def mid_block_keyword?(text)\n text[MID_BLOCK_KEYWORD_REGEX, 1]\n end", "def rp5_key_press?(key)\n if $sketch.key_pressed?\n if $sketch.key == $sketch.class::CODED\n return $sketch.key_code == key\n else\n return $sketch.key == key.chr\n end\n end\n return false\n end", "def is_block_valid?(hash)\n if @block_index.block_header_in_index?(hash)\n return true\n end\n !Toshi::Models::Block.main_or_side_branch.where(hsh: hash).empty?\n end", "def [](key)\n $game_switches[key] || false\n end", "def has_key?(key)\n local?(key) || (!@parent.nil? && @parent.key?(key))\n end", "def match?(other_line)\n (key_tokens - other_line.key_tokens) == [] || (other_line.key_tokens - key_tokens) == []\n end", "def vash_valid_key?(x); self.class.option_name?(x); end", "def key?(key)\n !self[key].nil?\n end", "def key?(key)\n super(convert_key(key))\n end", "def key?(key)\n super(convert_key(key))\n end", "def key?(key)\n table.key?(key)\n end", "def click?(key)\n return false if key.is_a?(Symbol)\n\n key.is_a?(Vedeu::Cursors::Cursor) || key.start_with?(\"\\e[M\")\n end", "def allure?(key)\n key.to_s.match?(/allure(_\\d+)?/i)\n end", "def in_table?(key)\n (@subroutine.key?(key) || @class.key?(key))\n end", "def in_key_bounds?(key, x, y)\n bounds = @keys[key]\n x += @params[:xoffset]\n y += @params[:yoffset]\n x >= bounds[:left] - @params[:hmargin] / 2 &&\n x <= bounds[:right] + @params[:hmargin] / 2 &&\n y >= bounds[:top] - @params[:vmargin] / 2 &&\n y <= bounds[:bottom] + @params[:vmargin] / 2\n end", "def release? key=:any\n return @data.include? :up if key == :any\n @data[key] == :up\n end", "def valid_key? key\n (not key.nil?) and (FileCreator::valid_key?(key.to_sym))\n end", "def in_box?(box_key, num)\n @boxes[box_key].each {|square| return true if square.number == num}\n false\n\n end", "def key?(name)\n raw.key?(name.to_s)\n end", "def key_pressed?(key)\r\n\t\tif (GetKeyState.call(VALUES[key]).abs & 0x8000 == 0x8000)\r\n\t\t\tKeyRepeatCounter[key] = 0\r\n\t\t\treturn true\r\n\t\tend\r\n\t\treturn false\r\n\tend", "def contains?(key)\n @key_data.has_key?(key)\n end", "def is?(match)\n match === RbConfig::CONFIG[\"host_os\"]\n end", "def exists?(type, key)\n require_layers!\n layers.each do |layer|\n return true if layer.exists?(type, key)\n end\n false\n end", "def valid_key(key)\n valid_rsa_key(key) && (key['x5c']&.length || (key['n'] && key['e']))\n end" ]
[ "0.64562213", "0.64370704", "0.6307505", "0.6307505", "0.6307505", "0.6307505", "0.6307505", "0.6307505", "0.617565", "0.60650945", "0.60525006", "0.60525006", "0.6050762", "0.60384357", "0.59404975", "0.5932974", "0.5930782", "0.5859019", "0.5847788", "0.5832562", "0.58223295", "0.58039945", "0.5785192", "0.57794917", "0.5776268", "0.5747601", "0.5747601", "0.5737428", "0.5719733", "0.569008", "0.56895864", "0.5684832", "0.5683028", "0.56699455", "0.56377935", "0.5636158", "0.5632513", "0.5632513", "0.56289625", "0.562276", "0.5610453", "0.56037164", "0.5602245", "0.5594774", "0.55832666", "0.5575646", "0.55742776", "0.55631644", "0.55603707", "0.556013", "0.5549608", "0.5527968", "0.5523976", "0.5523857", "0.5522746", "0.54987806", "0.5488221", "0.5488221", "0.5487787", "0.5487064", "0.5483135", "0.5482117", "0.54785806", "0.5470622", "0.5467614", "0.5467229", "0.5464372", "0.54641247", "0.5451142", "0.5445457", "0.5444171", "0.5442354", "0.54326975", "0.5424021", "0.5410686", "0.54071134", "0.54035646", "0.5398132", "0.53948873", "0.5381104", "0.5374672", "0.5361934", "0.5355074", "0.5350876", "0.5343968", "0.5343968", "0.5338521", "0.53334135", "0.5329551", "0.5322533", "0.5314825", "0.53145456", "0.5310771", "0.53091705", "0.5303771", "0.53033274", "0.5299664", "0.5299138", "0.5294034", "0.5290856" ]
0.85934603
0
Fastfile was finished executing
def did_finish collector.did_finish end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finished; end", "def finish; end", "def finish; end", "def finish; end", "def finish; end", "def finish; end", "def finish; end", "def finish; end", "def finish; end", "def file_finished(file, offenses); end", "def finish\n @Done = true \n end", "def finish()\n #This is a stub, used for indexing\n end", "def done; end", "def finished(inspected_files); end", "def finish\n end", "def finish\r\n #\r\n end", "def finish\n @finish = true\n end", "def file_finished(file_result)\n if file_result.error_count > 0 \n out.print 'x'\n elsif file_result.warning_count > 0\n out.print '*'\n else\n out.print '.'\n end\n end", "def finish\n #\n end", "def finished?; @finished; end", "def batch_finished\n end", "def finished=(_arg0); end", "def action_complete() self.finished = true; end", "def done\n end", "def done\n end", "def finished\n @finished = true\n end", "def completed()\n end", "def done\r\n @done = true\r\n end", "def finish(_result)\n end", "def run_completed\n end", "def finish\n #\n end", "def done?; true end", "def finish\n noth\n end", "def complete\n end", "def file_end(file, output)\n end", "def done\n @done = true\n end", "def finish\n\tmanager.flush\n end", "def finished\n\t\t@handle.close\n\tend", "def finish\n true\n end", "def done!\n # Do nothing\n end", "def done!\n # Do nothing\n end", "def done?; end", "def done!\n @done = true\n end", "def finished_file(_file, _lints); end", "def done\n # Do nothing.\n end", "def finish\n\t\t\tclose\n\t\tend", "def end() end", "def complete\n @status = :ok\n do_stop\n log_complete\n end", "def complete?; end", "def on_finish_batch; end", "def finished_compressing\n %Q{Compressing done ...}\n end", "def done\n puts \"Done\"\n end", "def complete(ticker, env)\r\n if @error.nil?\r\n flush_buffer if @buffer.bytesize > 0 # last part or non-multipart\r\n cleanup(ticker, env) if @uploader.complete?\r\n end\r\n end", "def finish\n\t\tclose\n\tend", "def communicate_complete\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') do |f|\n f << \"Finished Workflow #{::Time.now}\"\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n f.flush\n end\n end\n end", "def success(delayed_job)\n # Delete the file which has been parsed?\n STDOUT.putc '.'\n STDOUT.flush\n end", "def done(command)\n end", "def finished\n CodeLoader.loaded @load_path\n end", "def after_finished\n end", "def communicate_complete\r\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') { |f| f << \"Finished Workflow #{::Time.now}\" }\r\n end", "def finish\n\t\t\twrite_log_to_file(@logfile)\n\t\t\twrite_xmlfile(@xmlfile)\n\t\t\tif @errcount > 0 or @warncount > 0 then\n\t\t\t\twrite_log_to_stdout\n\t\t\tend\n\t\t\tputs \"Test run finished (#{@errcount} errors, #{@warncount} warnings).\"\n\t\tend", "def done\nend", "def completed\n end", "def wrapup # :nodoc:\n log \"Finishing\"\n end", "def do_eof; end", "def packing_finished\n end", "def complete\n @result_handler.call(*result) while @jobcount > 0\n end", "def finish\n\t\t\t\t\t# Internally, this invokes `self.each` which then invokes `self.close`.\n\t\t\t\t\tBuffered.for(self)\n\t\t\t\tend", "def complete!\n complete\n ensure\n IsolatedExecutionState.delete(self.class.active_key)\n end", "def finished\n\t\t@csv[5]\n\tend", "def finish\n @queue << \"finish\"\n end", "def finish!\n @io.write \"\\0\"\n if (@path)\n @io.fsync\n @io.close\n end \n end", "def at_end; end", "def finish(options); end", "def done\n @done\n end", "def upload_finalize( payload )\n notify( :finished_upload )\n\n @chronicle.process_file!( connection_token )\n end", "def finish()\n @device.finish() ;\n end", "def finish\n @time = 0.0\n @trigger.()\n end", "def after_break\n #open(file_name, \"r\") do |f| \n open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"r\") do |f| \n g = f.read\n f.close\n exit(puts \"Processing is complete >> ./tmp/database_doings/doing_uniques/uniques_done.txt << is closed, console has been exited\")\n end\n end", "def complete\n nil\n end", "def complete\n nil\n end", "def finished\n if @io\n ObjectSpace.undefine_finalizer(self) # remove usb closer finalizer\n @io.close\n @io = nil\n end\n end", "def finish!\n # Create our sentinel file\n FileUtils.touch('/etc/.sorted')\n end", "def deferred_finish\n @explicit_finish = true\n end", "def completed_it\n self.complete = true\n end", "def flush() end", "def flush() end", "def flush() end", "def run_finish_code\n @finish_code ? @finish_code[@context] : nil\n @finished = true\n end", "def on_end_process()\n # subclasses may override this method\n end", "def finish_exec\n listener.finished_successfully\n end", "def start \n @Done = false \n end", "def complete_job()\n puts \"Completing job id #{@job.id}\"\n connect()\n @server.puts(Command::COMPLETE_JOB)\n @server.puts(@job.id)\n # Send the encoded file\n FileTransfer.send(@server,@job.destination)\n disconnect()\n end", "def complete!\n @completed = true\n @completed_at = Time.now\n end", "def done\n raise NotImplementedError\n end", "def finalize\n\n end", "def finished?()\n #This is a stub, used for indexing\n end", "def run_completed(node)\n super\n Chef::Log.warn(\"<< END >>\")\n end", "def complete!\n status \"Success\"\n self\n end", "def finished!\n t = Time.now.utc\n update_attribute(:finished_at, t)\n # Save errors counts\n if errs = error_messages\n BackupJobError.increment_errors_count(*errs)\n end\n backup_source.backup_complete!\n on_finish :errors => errs, :messages => messages\n end", "def finished?\n\n end" ]
[ "0.750005", "0.7226259", "0.7226259", "0.7226259", "0.7226259", "0.7226259", "0.7226259", "0.7226259", "0.7226259", "0.7210303", "0.7159294", "0.7111025", "0.7064878", "0.6993208", "0.69505966", "0.6888138", "0.68818", "0.6862629", "0.6853151", "0.6825578", "0.68123144", "0.6809279", "0.6776226", "0.6727784", "0.6727784", "0.6692922", "0.66692626", "0.66455585", "0.66210085", "0.6602305", "0.6589239", "0.65826917", "0.6557174", "0.6548918", "0.65031743", "0.648771", "0.6485181", "0.6482256", "0.64273816", "0.64258313", "0.64258313", "0.6417999", "0.6392373", "0.63825244", "0.6375983", "0.63717705", "0.63521165", "0.6321478", "0.63182336", "0.62927085", "0.62786347", "0.6266798", "0.6262327", "0.6261225", "0.62341917", "0.6223229", "0.62022567", "0.6182509", "0.6181907", "0.6119083", "0.61065304", "0.60961574", "0.60898274", "0.6089722", "0.607111", "0.60496974", "0.6023781", "0.60221976", "0.60184133", "0.60132164", "0.60111886", "0.60019577", "0.59897214", "0.59829223", "0.5975086", "0.5971339", "0.59703994", "0.5965745", "0.5962491", "0.5955217", "0.5955217", "0.5951576", "0.59362125", "0.5931725", "0.59316397", "0.59291726", "0.59291726", "0.59291726", "0.5916263", "0.5892871", "0.5882272", "0.5879419", "0.58730716", "0.58634925", "0.5857533", "0.5855628", "0.5851435", "0.5842698", "0.58367234", "0.5830227", "0.5829195" ]
0.0
-1
api_request calls this (and gives it a method)
def request_params(method) @request_params = { :api_key => ENV['LASTFM_API_KEY'], :token => @auth_token, :api_sig => nil, :method => method, :format => 'json' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(*)\n raise 'HttpApiBuilder::BaseClient#request must be implemented, see documentation'\n end", "def method_missing(method_id, *params)\n _request(method_id.to_s.sub('_api', ''), *params)\n end", "def api_request(method, path, opts = {})\n request(method, path, opts)\n end", "def run_request(method, url, body, headers); end", "def request(method, *args)\n public_send(method, *args)\n end", "def request(*args); end", "def call_api (action, argument = \"\")\n\t\turi_str = BASE_URL + action + @api_key + argument\n\t\turi = URI.parse(uri_str)\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\t#check response\n\t\tresponse_body = JSON.parse(response.body)\n\tend", "def request(*args, &block); end", "def request(api_method, params = {}, request_method = :get)\n self.params = params.merge(method: api_method, format: 'json')\n self.request_method = request_method\n self.header = new_header\n self.typhoeus_request = new_typhoeus_request\n self.response = typhoeus_request.run\n self.body = Oj.load(response.body, OJ_OPTIONS)\n check_response!\n body\n end", "def build_request(method); end", "def request(endpoint, request, &block); end", "def send_request; end", "def api_call(payload); end", "def send_request(method, params, &block); end", "def raw_api(method,params=nil)\n debug(6,:var=>method,:msg=>\"method\")\n debug(6,:var=>params,:msg=>\"Parameters\")\n\n checkauth\n checkversion(1,1)\n params={} if params==nil\n obj=do_request(json_obj(method,params))\n return obj['result']\n end", "def _api_call(method, args)\r\n uri = _uri(method, args)\r\n response = XmlSimple.xml_in(_http_get(uri))\r\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request(*args)\n end", "def call(request)\n\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\tresponse = RestClient.post(URI.escape(Config.api_url + request.operation), request.data)\n\t\t\t\trescue RestClient::Unauthorized, Exception\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\t\t# Check response\n\t\t\t\tif response.code != 200\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\t\t# Parse response\n\t\t\t\tparsed_response = JSON.parse(response.to_s)\n\t\t\t\t\n\t\t\t\t# Check format\n\t\t\t\tif parsed_response[\"api\"].nil? || parsed_response[\"api\"][\"response\"].nil?\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\t\t# Fill matching response object with parsed response\n\t\t\t\tresponse = request.response_factory(parsed_response[\"api\"][\"response\"])\n\n\t\t\t\treturn response\n\t\t\tend", "def method_missing(method_name, *args, &block)\n if self.has_key?(method_name.to_s)\n self.[](method_name, &block)\n elsif self.body.respond_to?(method_name)\n self.body.send(method_name, *args, &block)\n elsif self.request[:api].respond_to?(method_name)\n self.request[:api].send(method_name, *args, &block)\n else\n super\n end\n end", "def call(request); end", "def call(method, params={})\n # Build path\n params[:apikey] = @api_key\n params = params.map { |p| p.join('=') }.join('&').gsub(/\\s/, '%20')\n path = [@uri.path, API_VERSION, method].compact.join('/') << '?' << params\n # Send request\n get = Net::HTTP::Get.new(path)\n response = @http.request(get)\n handleResult response.body\n end", "def method_missing(method, *args)\n single_request(method, args)\n end", "def perform_request(request_method, path, options = {})\n Teamsupport::REST::Request.new(self, request_method, path, options).perform\n end", "def method_missing(method_name, *args)\n call_api_method(method_name, *args)\n end", "def call_method(method, *args)\n @api_client.public_send(method, *args)\n end", "def method_missing(method, *args, &block)\n if actions(current_api).include? method\n self.class.send(:define_method, method) do |params|\n perform_soap_call(method, params) || perform_rest_call(params)\n end\n send method, *args, &block\n else\n super\n end\n end", "def invoke_method\n unless check_preconditions\n return send_response(status: :precondition_failed)\n end\n\n method = request.request_method.downcase\n status, body = make_request method\n\n send_response status: status, body: body\n end", "def api_method\n @_api_method ||= \"#{method_from_class_name}.get\"\n end", "def request(api_method, response_klass, my_params={})\n savon_client = setup_savon_client\n\n params = my_params.merge(login: VoipApi.account.login, secret: VoipApi.account.secret)\n\n # Invoke the call to the API\n begin\n puts YAML::dump(savon_client)\n # request = savon_client.build_request(api_method, message: params)\n # puts YAML::dump(request.body)\n # puts YAML::dump(request.headers)\n savon_response = savon_client.call(api_method, message: params)\n rescue Savon::Error => error\n Logger.log \"Savon Error Encountered: #{error.http.code} #{error.message}\"\n end\n\n if savon_response.success? && !savon_response.soap_fault? && !savon_response.http_error?\n # Have this get converted to the appropriate kind of savon_response\n if response_klass\n response_klass.new(savon_response)\n end\n end\n end", "def http_call(payload); end", "def make_request(resource_name, method_name, params = {}, response_key = nil)\n end", "def run_request(method, url, body, headers)\n original_run_request(method, url, \"\", headers)\n end", "def make_request\n response = @http.request(@request)\n end", "def api_call(method,options={})\n debug(6,:msg=>\"Method\",:var=>method)\n debug(6,:msg=>\"Options\",:var=>options)\n\n obj=json_obj(method,options)\n result=do_request(obj)\n if @returntype==:result\n result[\"result\"]\n else\n result.merge!({:method=>method, :params=>options})\n @returntype.new(result)\n end\n end", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def method_request( method, params )\n #merge auth params into our request querystring\n querystring = @auth.merge( params.is_a?(Hash) ? params : {} )\n resp = self.class.get(\"/#{@data_type}/#{method.to_s}\",{:query => querystring})\n if resp['error'] \n raise RuntimeError, resp['error']['error_message'], caller[1..-1]\n end\n return resp\n end", "def method_missing(name, *args)\n api_method = get_api_method(name)\n\n if api_method\n call_api_method(api_method, *args)\n else\n super(name, *args)\n end\n end", "def api_request method, params = nil\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST(method, params, @auth.token)\n\t\tend", "def call(method, *args)\n return send_request(method, args)\n end", "def run_request(verb, method, options={})\n self.class.send(verb, \"/#{method}\", :query => authorization_params.merge(options))\n end", "def api_request(action, data, request_type)\n data[:api_key] = @api_key\n data[:format] ||= 'json'\n data[:sig] = Sailthru::TriggermailClient.get_signature_hash(data, @secret)\n _result = self.http_request(\"#{@api_uri}/#{action}\", data, request_type)\n\n\n # NOTE: don't do the unserialize here\n unserialized = JSON.parse(_result)\n return unserialized ? unserialized : _result\n end", "def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end", "def perform_get_request\n # Validate preventing request error\n\n # setup params, like API Key if needed\n\n # Perform the request\n get_request\n end", "def request\n raise 'need to be implemented'\n end", "def request\n @rpc.request\n end", "def set_request; end", "def call\n with(response: response)\n end", "def invoke_direct(method_name, *args)\r\n prepare_request('api', 'api', method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end", "def request(method, message = nil)\n @client.call(method, message:)\n end", "def method_missing(method, *args)\n api_obj.send(method, *args)\n end", "def api_run(method, *opts, **kwds, &block)\n @res = @api.run(method, *opts, **kwds, &block)\n end", "def send_request(req); end", "def request(method, path, params)\n self.class.send(method, path, params)\n end", "def request(*args)\n Request.request(self, *args)\n end", "def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end", "def request\n response.request\n end", "def request(method, args = {})\n params = args.merge({@method_param => method})\n params = params.merge(@default_params)\n endpoint = api_endpoint ? api_endpoint.base_url : @endpoint\n url = endpoint + URI.encode_www_form( params.reject{ |k,v| k == :force_update } )\n request_uri = URI.parse(url)\n response = nil\n begin\n MetaService.fetch_request_uri(args.merge(request_uri: request_uri, timeout: @timeout,\n api_endpoint: api_endpoint,\n user_agent: \"#{Site.default.name}/#{self.class}/#{SERVICE_VERSION}\"))\n rescue Timeout::Error\n raise Timeout::Error, \"#{@service_name} didn't respond within #{@timeout} seconds.\"\n end\n end", "def _make_api_call(json_params=nil)\n\n puts \"Crossbar::HTTP - Request: POST #{url}\" if self.verbose\n\n encoded_params = nil\n if json_params != nil\n if self.pre_serialize != nil and self.pre_serialize.is_a? Proc\n json_params = self._parse_params json_params\n end\n encoded_params = JSON.generate(json_params)\n end\n\n puts \"Crossbar::HTTP - Params: #{encoded_params}\" if encoded_params != nil and self.verbose\n\n uri = URI(self.url)\n\n if self.key != nil and self.secret != nil and encoded_params != nil\n signature, nonce, timestamp = self._compute_signature(encoded_params)\n params = {\n timestamp: timestamp,\n seq: self.sequence.to_s,\n nonce: nonce,\n signature: signature,\n key: self.key\n }\n uri.query = URI.encode_www_form(params)\n\n puts \"Crossbar::HTTP - Signature Params: #{params}\" if self.verbose\n end\n\n # TODO: Not sure what this is supposed to be but this works\n self.sequence += 1\n\n self._api_call uri, encoded_params\n end", "def call(call, method = :get, params = false)\n # get the url\n url = URI.parse(@api_endpoint + call)\n \n send_xml = params.is_a?(Hash) && params.delete(:send_xml)\n send_format = send_xml ? 'xml' : 'json'\n \n case method\n when :get\n url.query = params.keys.map { |key| \"#{key}=#{params[key]}\"}.join('&') if params.is_a?(Hash)\n path = url.path\n path += '?' + url.query if url.query\n p \"INKAPI:GET #{path}\"\n call = Net::HTTP::Get.new(path)\n when :post\n p \"INKAPI:POST #{url.path}\"\n call = Net::HTTP::Post.new(url.path, {'Content-Type' => \"application/#{send_format}\", 'User-Agent' => 'InKomerce API Ruby SDK'})\n p send_format\n if params\n call.body = send_xml ? params.to_xml : params.to_json\n end\n when :put\n p \"INKAPI:PUT #{url.path}\"\n call = Net::HTTP::Put.new(url.path, {'Content-Type' => \"application/#{send_format}\", 'User-Agent' => 'InKomerce API Ruby SDK'})\n if params\n call.body = send_xml ? params.to_xml : params.to_json\n end\n when :delete\n url.query = params.keys.map { |key| \"#{key}=#{params[key]}\"}.join('&') if params.is_a?(Hash)\n path = url.path\n path += '?' + url.query if url.query\n p \"INKAPI:DELETE #{path}\"\n call = Net::HTTP::Delete.new(path)\n end\n \n if @token\n call.add_field('authorization',\"Bearer token=#{@token}\")\n end\n \n # create the request object\n response = Net::HTTP.start(url.host, url.port, use_ssl: (url.scheme=='https')) {\n |http| http.request(call)\n }\n # returns JSON response as ruby hash\n symbolize_return_record_keys(JSON.parse(response.body))\n end", "def request\n @rest_response.request\n end", "def run_request(verb, method, options={})\n access_token.send(verb, method, :params => authorization_params.merge(options), :parse => :json)\n end", "def call\n resource = base_resource\n\n response = (\n case request_method\n when :get\n resource.get fill do |req|\n (req.body = source) if source\n end\n when :head\n resource.head fill\n when :delete\n resource.delete(fill) do |req|\n req.body = source if source\n end\n when :post\n resource.post(fill, source)\n when :put\n resource.put(fill, source)\n end\n )\n \n response\n end", "def request(method, path, params = {})\n req = create_request path\n req.request method.upcase, params do |response|\n if (200..300).cover?(response.status)\n yield response.json if block_given?\n else\n warn response.json['error']\n end\n end\n end", "def service_request(service); end", "def request(rpc_method, attributes)\n self.class.request(rpc_method, attributes)\n end", "def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end", "def build_request\n client.request request_name\n end", "def request(resource, method = \"get\", args = nil)\n \t \n \t @now_playing_url = 'http://62.216.251.203:80/nowplaying'\n \t @submission_url = 'http://62.216.251.205:80/protocol_1.2'\n \t @session_id = '17E61E13454CDD8B68E8D7DEEEDF6170'\n \t \n \t if @base_url == Scrobbler::API_URL\n \t pieces = resource.split('/')\n pieces.shift\n \t api_version = pieces.shift\n if api_version == \"1.0\"\n folder = pieces.shift\n file = pieces.last[0, pieces.last.index('.xml')]\n base_pieces = pieces.last.split('?')\n\n file = if base_pieces.size > 1\n # if query string params are in resource they are underscore separated for filenames\n base_pieces.last.split('&').inject(\"#{file}_\") { |str, pair| str << pair.split('=').join('_') + '_'; str }.chop!\n else\n file\n end\n\n File.read(File.dirname(__FILE__) + \"/../fixtures/xml/#{folder}/#{file}.xml\")\n elsif api_version == \"2.0\"\n method_pieces = pieces.last.split('&')\n api_method = method_pieces.shift\n if api_method == '?method=artist.search'\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/search/artist.xml\")\n elsif api_method == '?method=album.search'\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/search/album.xml\")\n elsif api_method == '?method=track.search'\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/search/track.xml\")\n elsif pieces.last =~ /[?&]method=album\\.getinfo/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/album/info.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettoptags/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/toptags.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.search/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/search.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettopfans/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/fans.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettoptracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/toptracks.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettopalbums/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/topalbums.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.getsimilar/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/similar.xml\")\n elsif pieces.last =~ /[?&]method=album\\.search/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/album/search.xml\")\n elsif pieces.last =~ /[?&]method=tag\\.gettoptracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/tag/toptracks.xml\")\n elsif pieces.last =~ /[?&]method=tag\\.gettopartists/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/tag/topartists.xml\")\n elsif pieces.last =~ /[?&]method=tag\\.gettopalbums/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/tag/topalbums.xml\")\n elsif pieces.last =~ /[?&]method=track\\.gettoptags/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/track/toptags.xml\")\n elsif pieces.last =~ /[?&]method=track\\.gettopfans/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/track/fans.xml\")\n elsif pieces.last =~ /[?&]method=track\\.search/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/track/search.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getlovedtracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/lovedtracks.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettopartists/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/topartists.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettopalbums/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/topalbums.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettoptracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/toptracks.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getfriends/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/friends.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettoptags/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/toptags.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getneighbours/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/neighbours.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getrecenttracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/recenttracks.xml\")\n elsif pieces.last =~ /[?&]method=user\\.playlists/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/playlists.xml\")\n elsif pieces.last =~ /[?&]method=event\\.getinfo/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/event/event.xml\")\n elsif pieces.last =~ /[?&]method=event\\.getshouts/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/event/shouts.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getweeklyalbumchart/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/weeklyalbumchart.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getweeklyartistchart/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/weeklyartistchart.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getweeklytrackchart/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/weeklytrackchart.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getevents/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/events.xml\")\n else\n old_request(resource, method, args)\n end\n end\n \t elsif @base_url == Scrobbler::AUTH_URL\n if args[:hs] == \"true\" && args[:p] == Scrobbler::AUTH_VER.to_s && args[:c] == 'rbs' &&\n args[:v] == '0.2.13' && args[:u] == 'chunky' && !args[:t].blank? &&\n args[:a] == Digest::MD5.hexdigest('7813258ef8c6b632dde8cc80f6bda62f' + args[:t])\n \n \"OK\\n#{@session_id}\\n#{@now_playing_url}\\n#{@submission_url}\"\n end\n elsif @base_url == @now_playing_url\n if args[:s] == @session_id && ![args[:a], args[:t], args[:b], args[:n]].any?(&:blank?)\n 'OK'\n end \n elsif @base_url == @submission_url\n if args[:s] == @session_id && \n ![args['a[0]'], args['t[0]'], args['i[0]'], args['o[0]'], args['l[0]'], args['b[0]']].any?(&:blank?)\n 'OK'\n end\n\t end\n\t end", "def call(request)\r\n self\r\n end", "def call(env)\n self.class.perform_request env\n end", "def method_missing(name, *args, &block)\n if response && response.respond_to?(name)\n response.send(name, *args, &block)\n else\n super\n end\n end", "def perform(api_method, *args)\n client.send(api_method, *args)\n end", "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def build_request(*args); end", "def call()\n json = do_request()\n parse(json)\n end", "def request\n @req\n end", "def call(api_method, params={}, &request)\n path = \"/api/#{api_version}/#{api_method}\"\n\n begin\n result = api_method =~ /^(set|create|delete)/ ? post(path, params) : get(path, params)\n response = JSON.parse(result.to_s, :symbolize_names => true)\n rescue JSON::ParserError => e\n raise Error, \"Unable to parse JSON response: #{json}\"\n end\n\n case response[:code]\n when 0 then response[:data]\n when (1..4) then raise Error, response[:message]\n else raise Error, \"An unknown error ocurrced while handling the API response: #{response.to_s}\"\n end\n end", "def request(method, path, params = {})\n self.class.debug_output($stderr) if @debug\n setup_http_body(method, params)\n \n uri = base_api_uri + path\n response = self.class.send(method.to_sym, uri, @default_params)\n parse(response)\n end", "def request(*args)\n Request.new(self).request(*args)\n end", "def perform(request, response); end", "def method_missing(name, *args, &block)\n if response && response.respond_to?(name)\n response.send(name, *args, &block)\n else\n super(name, *args, &block)\n end\n end", "def method_missing(name, *args, &block)\n if response && response.respond_to?(name)\n response.send(name, *args, &block)\n else\n super(name, *args, &block)\n end\n end", "def request(method, *args, &response_cb)\n reqid = @request_id\n @request_id += 1\n\n @serializer.write([0, reqid, method, args])\n @pending_requests[reqid] = response_cb || Proc.new {}\n self\n end", "def method_missing(meth, *args)\n hyves_method = meth.to_s.gsub('_', '.')\n options = {:ha_method => hyves_method}\n options.merge!(args.first) if args.first.is_a?(Hash)\n hyves_log('Hyves', \"Sent request: #{options.inspect}\")\n response = request(options)\n hyves_log('Hyves', \"Got response: #{response.inspect}\")\n return response\n end", "def call_api method, arguments = {}, &block\n # Ensures only a valid DataContext is used\n unless @context.is_a? DataContext\n block.call nil, 'A context object was not provided.'\n return\n end\n \n unless @context.valid?\n block.call nil, 'A valid context object was not provided.'\n return\n end\n \n # Ensures only valid arguments are used\n query = []\n arguments.each_pair do |key, value|\n if API_VALID_ARGUMENTS.member? key.to_s\n query << \"$#{key}=#{URI.escape value.to_s}\"\n else\n query << \"#{key}=#{URI.escape value.to_s}\"\n end\n end\n \n # Generates timestamp and url\n timestamp = DOL.timestamp\n url = URI.parse [\"#{@context.host}/#{@context.url}/#{method}\", query.join('&')].join '?'\n \n # Creates a new thread, creates an authenticaed request, and requests data from the host\n @mutex.synchronize do\n @active_requests << Thread.new do\n request = Net::HTTP::Get.new [url.path, url.query].join '?'\n request.add_field 'Authorization', \"Timestamp=#{timestamp}&ApiKey=#{@context.key}&Signature=#{signature timestamp, url}\"\n request.add_field 'Accept', 'application/json'\n result = Net::HTTP.start url.host, url.port do |http|\n http.request request\n end\n \n if result.is_a? Net::HTTPSuccess\n \n #Cleanup jsonresult.\n result = result.body.gsub(/\\\\+\"/, '\"')\n result = result.gsub /\\\\+n/, \"\"\n result = result.gsub /\\\"\\\"\\{/, \"{\"\n result = result.gsub /}\\\"\\\"/, \"}\"\n\n result = JSON.parse(result)['d']\n \n if (result.include?'results')\n result = result['results'] if result.is_a? Hash\n end\n\n block.call result, nil\n \n else\n block.call nil, \"Error: #{result.message}\"\n end\n \n @mutex.synchronize do\n @active_requests.delete Thread.current\n end\n end\n end\n end", "def send_request(method, options = {}, http_method = :get, endpoint = REST_ENDPOINT)\n options.merge!(:api_key => @api_key, :method => method)\n sign_request(options)\n \n rsp = request_over_http(options, http_method, endpoint)\n \n rsp = '<rsp stat=\"ok\"></rsp>' if rsp == \"\"\n xm = XmlMagic.new(rsp)\n \n if xm[:stat] == 'ok'\n xm\n else\n raise Flickr::Errors.error_for(xm.err[:code].to_i, xm.err[:msg])\n end\n end", "def call(bclass,method,params = {},files = nil)\n params ||={}\n params[\"api_key\"]=@account.apiKey\n params[\"api_secret\"]=@account.apiSecret\n resp=callAPI(bclass,method,params,files)\n return resp\n end", "def method_missing(op, *args)\n if client.operations.include?(op)\n request op, *args\n else\n fail NoMethodError, op\n end\n end", "def hit\n action = params[:req]\n name = params[:name] || params[:id]\n render api_not_supported action, name\n end", "def send_request method, params = {}\n uri = URI.parse(@api_url)\n if Time.now.to_i > @exp + 3600\n get_acces_token\n @exp = Time.now.to_i\n end\n required = { 'access_token' => @access_token, 'method' => method }\n params = required.merge(params)\n params = URI.escape(params.collect{ |k,v| \"#{k}=#{v}\"}.join('&'))\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n req['User-Agent'] = \"zhzhussupovkz pleer.com-ruby-api\"\n req.body = params\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n else\n puts \"Invalid getting data from server\"\n exit\n end\n end" ]
[ "0.699395", "0.69817877", "0.68496406", "0.6819791", "0.6806654", "0.6804253", "0.6801593", "0.6784718", "0.6759607", "0.6753799", "0.6738722", "0.67318547", "0.66957235", "0.6672798", "0.6635364", "0.663438", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6602269", "0.6579813", "0.6575436", "0.6548798", "0.65213823", "0.6516459", "0.65158933", "0.6482467", "0.6478446", "0.6478211", "0.6473699", "0.64700264", "0.64679664", "0.6457753", "0.64330244", "0.6432669", "0.6422833", "0.6418686", "0.64015794", "0.6368807", "0.6367948", "0.635579", "0.6343412", "0.6341415", "0.63367194", "0.6334053", "0.63047445", "0.6301665", "0.6299678", "0.629839", "0.62955236", "0.6294817", "0.628966", "0.6270917", "0.6263836", "0.62570465", "0.62341624", "0.62302935", "0.6222126", "0.6216945", "0.6213647", "0.6209476", "0.6205238", "0.62046856", "0.6198115", "0.6197941", "0.6192201", "0.61881113", "0.617997", "0.6179108", "0.61727756", "0.61634475", "0.615643", "0.615601", "0.61388016", "0.61310476", "0.61291605", "0.61286724", "0.6122911", "0.6121666", "0.61192584", "0.6117887", "0.6115086", "0.61016166", "0.6101444", "0.6096769", "0.6096769", "0.6094291", "0.6089387", "0.608742", "0.60863554", "0.60795045", "0.60677105", "0.6048655", "0.60469615" ]
0.0
-1
Builds a document using document template and XML or JSON data passed in request.
def assemble_document(request) begin data, _status_code, _headers = assemble_document_with_http_info(request) rescue ApiError => e if e.code == 401 request_token data, _status_code, _headers = assemble_document_with_http_info(request) else raise end end data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build\n if expand_document\n combine_layout\n combine_activity_metadata\n document.update! build_params\n else\n document.document_parts.delete_all\n document.update! document_params.merge(toc: template.toc, material_ids: template.toc.collect_material_ids)\n end\n end", "def create_document kwargs\n title = kwargs.fetch(:title, \"Untitled\")\n template_file = kwargs.fetch(:template_file, \"#{$TEMPLATES_DIRECTORY}/input/document.adoc.erb\")\n path = kwargs.fetch(:path, \"./\")\n template_file = Pathname.new template_file\n\n # Creating the directories of the path\n path = Pathname.new path\n FileUtils.mkpath(path)\n\n file_name = kebab_case title\n path += file_name + \".adoc\"\n\n begin\n template = File.read template_file\n rescue\n template = $DEFAULT_TEMPLATE\n end\n\n # Create a binding object with the current context.\n # All variables in this function will be included.\n b = binding\n erb = ERB.new template, :trim_mode => \"-\"\n output_file = File.new path.to_s, mode = \"w+\"\n output_file.write erb.result b\n\n path\nend", "def prepare_doc(req, json)\n var = requestor(req, json)\n parse var.body\n end", "def generate_document(data)\n template = config.get(:template)\n options = template[:options]\n file = \"#{template[:root]}/mongoid.slim\"\n # create template\n document = Slim::Template.new(\n # delegate file read to slim\n file,\n # declare default options\n options\n )\n .render(\n # ensure helpers are scoped\n self,\n # pass data via parameter\n data: data\n )\n # publish data to file\n publish_document(document)\n # return document\n document\n end", "def build(attrs = {}, &block)\n create_document(:new, attrs, &block)\n end", "def create_document\n # rubocop:disable Lint/AmbiguousOperatorPrecedence\n if template.metadata['subject'].presence &&\n template.metadata['subject'].casecmp('ela').zero? || template.prereq?\n @document = Document.actives.find_or_initialize_by(file_id: downloader.file_id)\n else\n @document = foundational? ? find_core_document : find_fs_document\n id_field = foundational? ? :foundational_file_id : :file_id\n\n @expand_document ||= @document.present?\n\n @document[id_field] = downloader.file_id if @document.present?\n @document ||= Document.actives.find_or_initialize_by(id_field => downloader.file_id)\n end\n # rubocop:enable Lint/AmbiguousOperatorPrecedence\n end", "def create_doc\n\t\theaders = {:content_type => 'application/xml'}\n\t\turi = CGI.escape(\"/\" + rand(2).to_s() + \"/\" + rand(10).to_s() + \"/\" + rand(1000000).to_s() + \".xml\")\n\t\tresponse = @resource[\"/documents/\" + uri].put('<stuff xmlns=\"stuff\">' + uri + '</stuff>', headers)\n\t\treturn uri\n\tend", "def generate_document_structure; build_document_hash end", "def generate_document\n config = Spree::BilletConfig\n doc_user = user.attributes[config.doc_customer_attr] rescue ''\n due_date = Date.today + config.due_date.days\n\n params = {cedente: config.corporate_name,\n documento_cedente: config.document,\n cedente_endereco: config.address,\n sacado: self.customer_name,\n sacado_documento: doc_user,\n sacado_endereco: order.bill_address.full_address,\n numero_documento: document_number,\n data_vencimento: due_date,\n data_documento: Date.parse(created_at.to_s),\n valor: amount,\n aceite: config.acceptance,\n agencia: config.agency,\n conta_corrente: config.account,\n convenio: config.agreement,\n carteira: config.wallet,\n variacao: config.variation_wallet\n }\n (1..6).each { |cont| params[\"instrucao#{cont}\".to_sym] = config[\"instruction_#{cont}\"] }\n if config.bank == 'sicredi' then\n params.merge!({posto: config.office_code,\n byte_idt: config.byte_idt})\n end\n\n document = case config.bank\n when 'banco_brasil' then Brcobranca::Boleto::BancoBrasil.new params\n when 'bradesco' then Brcobranca::Boleto::Bradesco.new params\n when 'caixa' then Brcobranca::Boleto::Caixa.new params\n when 'santander' then Brcobranca::Boleto::Santander.new params\n when 'itau' then Brcobranca::Boleto::Itau.new params\n when 'sicredi' then Brcobranca::Boleto::Sicredi.new params\n else\n raise 'It is necessary set the billet config'\n end\n document\n end", "def create_document_using_post_with_http_info(document_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocumentApi.create_document_using_post ...'\n end\n # verify the required parameter 'document_request' is set\n if @api_client.config.client_side_validation && document_request.nil?\n fail ArgumentError, \"Missing the required parameter 'document_request' when calling DocumentApi.create_document_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/document'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(document_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Document')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocumentApi#create_document_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def make_document(xml)\n xml.is_a?(Atom::XML::Document) ? xml : Atom::XML::Document.string(xml)\n end", "def document\r\n Document.new(\"#{DOCUMENT_VAR}\")\r\n end", "def create_document(template_filename=nil)\n raise_if_not_active\n if template_filename.nil?\n @doc = @word.Documents.Add\n else\n @doc = @word.Documents.Add(template_filename)\n end\n end", "def new_document(content, opts = {})\n RetrievalLite::Document.new(content, opts)\n end", "def create\n authorize! :create, Document.new, @project\n main = @project.document_mains.create\n rev = main.revisions.create\n document = rev.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n rev.destroy\n main.destroy\n render json: document.errors, status: :unprocessable_entity\n end\n end", "def create_doc(match, path)\n DressCode::Document.new({\n :component => match[0],\n :prose => match[1].strip,\n :path => path,\n :relative_path => path.gsub(@base_dir, '').gsub(/^\\//, '')\n })\n end", "def create\n\t\tbegin\n\t\t\traise ArgumentError, \"project id has to be specified.\" unless params[:project_id].present?\n\n\t\t\t@project = Project.editable(current_user).find_by_name(params[:project_id])\n\t\t\traise \"The project does not exist, or you are not authorized to make a change to the project.\\n\" unless @project.present?\n\n\t\t\tdoc_hash = if doc_params.present? && params[:commit].present?\n\t\t\t\tdoc_params\n\t\t\telse\n\t\t\t\ttext = if params[:text]\n\t\t\t\t\tparams[:text]\n\t\t\t\telsif request.content_type =~ /text/\n\t\t\t\t\trequest.body.read\n\t\t\t\tend\n\n\t\t\t\traise \"Could not find text.\" unless text.present?\n\n\t\t\t\t_doc = {\n\t\t\t\t\tsource: params[:source],\n\t\t\t\t\tsourcedb: params[:sourcedb] || '',\n\t\t\t\t\tsourceid: params[:sourceid],\n\t\t\t\t\tbody: text\n\t\t\t\t}\n\n\t\t\t\t_doc[:divisions] = params[:divisions] if params[:divisions].present?\n\t\t\t\t_doc[:typesettings] = params[:typesettings] if params[:typesettings].present?\n\t\t\t\t_doc\n\t\t\tend\n\n\t\t\tdoc_hash = Doc.hdoc_normalize!(doc_hash, current_user, current_user.root?)\n\t\t\tdocs_saved, messages = Doc.store_hdocs([doc_hash])\n\t\t\traise IOError, \"Could not create the document: #{messages.join(\"\\n\")}\" if messages.present?\n\n\t\t\t@doc = docs_saved.first\n\t\t\t@doc.projects << @project\n\t\t\texpire_fragment(\"sourcedb_counts_#{@project.name}\")\n\t\t\texpire_fragment(\"count_docs_#{@project.name}\")\n\t\t\texpire_fragment(\"count_#{@doc.sourcedb}_#{@project.name}\")\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to show_project_sourcedb_sourceid_docs_path(@project.name, doc_hash[:sourcedb], doc_hash[:sourceid]), notice: t('controllers.shared.successfully_created', :model => t('activerecord.models.doc')) }\n\t\t\t\tformat.json { render json: @doc.to_hash, status: :created, location: @doc }\n\t\t\tend\n\t\trescue => e\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to new_project_doc_path(@project.name), notice: e.message }\n\t\t\t\tformat.json { render json: {message: e.message}, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n\t \n\tdata = unpack_document(params[:document][:datafile]) \n\tdoc_params = {:title => document_params[\"title\"], :date => get_date(document_params,\"date\")}\n\tif !data.nil? then\n\t\tdoc_params[:content] = data[:content]\n\t\tdoc_params[:styles] = data[:styles]\n\tend\n @document = Document.new(doc_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def convert_document_docx_to_doc_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_docx_to_doc ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_docx_to_doc\"\n end\n # resource path\n local_var_path = '/convert/docx/to/doc'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_docx_to_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_document(uri, content, doc_version)\n case document_type(uri)\n when :puppetfile\n PuppetfileDocument.new(uri, content, doc_version)\n when :manifest\n ManifestDocument.new(uri, content, doc_version)\n when :epp\n EppDocument.new(uri, content, doc_version)\n else\n Document.new(uri, content, doc_version)\n end\n end", "def build(document)\n build_simple_attributes(document)\n build_complex_attributes(document)\n end", "def create_html_document(directory, filename, locale, deliverable_json = nil)\n version = Settings[:CURRENT_VERSION]\n \n # Why not let CouchDB create the ID? Because it actually affects performance.\n # Also, if we define the ID, then we can find the document without a view.\n id = \"#{Settings[:APP_NAME]}.#{filename}.#{locale}.#{version}\"\n \n # Create a Nokogiri document from the XML file on disk\n content_doc = Nokogiri::XML(open(\"#{directory}/#{filename}\")){|config| config.noent }\n content_doc.remove_namespaces!\n \n # Figure out the title for the document, pick it up from the\n # Dublin Core metadata, if available, otherwise grab it from the\n # title element.\n title=content_doc.xpath(\"/html/head/meta[@name = 'DC.Title']/@content\")\n title ||= content_doc.xpath('/html/head/title').inner_text().to_s\n title = title.to_s rescue nil\n \n # Add facets.\n # The rescue nil is there because if something happens, we're okay\n # with no value.\n app_area = content_doc.xpath(\"/html/head/meta[@name = 'app_area']/@content\").to_s rescue nil \n role = content_doc.xpath(\"/html/head/meta[@name = 'role']/@content\").to_s rescue nil\n edition = content_doc.xpath(\"/html/head/meta[@name = 'edition']/@content\").to_s rescue nil\n topic_type = content_doc.xpath(\"/html/head/meta[@name = 'topic_type']/@content\").to_s rescue nil\n technology = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.Technology']/@content\").to_s rescue nil\n\n # Add deliverable title and other metadata\n deliverable_title = deliverable_json['title'] rescue nil\n deliverable_type = deliverable_json['type'] rescue nil\n deliverable_pdf_name = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDF']/@content\").to_s rescue nil\n deliverable_pdf_url = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDFURL']/@content\").to_s rescue nil\n deliverable_home = deliverable_json['default_topic'] rescue nil\n \n #scrub the table of data we don't need\n body_content = content_doc.xpath('/html/body/*')\n scrub_table(body_content)\n body_content = body_content.to_html\n \n\n # Create a document to add the searchable text. We have to create a\n # new document, we can't reuse content_doc. That's because nodesets\n # are queries of documents. In other words, if you do a\n # nodeset.xpath('//xpath').remove, it removes that xpath from all\n # nodesets created from a document, not just nodeset.\n search_doc = content_doc.dup\n \n # Remove items we don't want returned in the search snippet\n search_content=search_doc.xpath('/html/body')\n search_content.xpath('/html/body//table[contains(@class, \"permTable\") or contains(@class, \"editionTable\")]').remove\n search_content.xpath('/html/body//*[contains(@class, \"breadcrumb\")]').remove\n search_content.xpath('/html/body/h1[1]').remove\n \n # Encode the search_content, replacing unsafe codepoints. This allows search to find items like >\n coder = HTMLEntities.new\n search_content=coder.encode(search_content.children().inner_text()).strip\n \n #remove weird new line characters\n search_content = search_content.gsub(\"\\n\", ' ')\n search_content = HTMLEntities.new.decode(search_content)\n \n #doc fields to create, if needed\n newDoc = {\n '_id' => id,\n :name => filename,\n :locale => locale,\n :version => version,\n :title => title,\n :body_content => body_content,\n :app_area => app_area,\n :role => role,\n :edition => edition,\n :topic_type => topic_type,\n :technology => technology,\n :deliverable_title => deliverable_title,\n :deliverable_type => deliverable_type,\n :deliverable_pdf_name => deliverable_pdf_name,\n :deliverable_pdf_url => deliverable_pdf_url,\n :deliverable_home => deliverable_home,\n :search_content => search_content}\n \n #This content hash accounts for changes necessary from the deliverable metadata as well as changes to the xml document in general\n newDoc[:content_hash] = generateCheckSum(newDoc.inspect)\n \n #Dynamic content added after the hash\n newDoc[:updated] = Time.now.to_date.iso8601\n \n #upsert the document\n upsert_doc_via_checksum(@db, newDoc, [:locale, :version], @id_checksum_hash[id], @log)\n \n return id\n end", "def request_doc\n \n end", "def convert_document_doc_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_doc_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_doc_to_docx\"\n end\n # resource path\n local_var_path = '/convert/doc/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_doc_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def construct_view()\n design_docs = [\"couchdb_views/content_views.json\"]\n design_docs.each { |design_doc|\n #Read the file\n content = File.read(Pathname.new(File.dirname(__FILE__) + \"/../../\" + design_doc).cleanpath)\n check_sum = generateCheckSum(content)\n \n #create the JSON\n design_doc_as_json = JSON.parse(content)\n design_doc_as_json[:content_hash] = check_sum\n \n #upload the JSON as a design document\n upsert_doc(@db, design_doc_as_json, design_doc_as_json, :content_hash, @log)\n }\n end", "def create_document!(model)\n document = model.new(params)\n unless document.valid?\n error 400, convert(body_for(:invalid_document, document))\n end\n unless document.save\n error 400, convert(body_for(:internal_server_error))\n end\n document\n end", "def create_doc(path)\n doc = File.read(path)\n @current_xml_document = doc\n Hpricot.XML(doc)\n end", "def render_document\n info = {\n :registers => { :site => site, :page => payload[\"page\"] },\n :strict_filters => liquid_options[\"strict_filters\"],\n :strict_variables => liquid_options[\"strict_variables\"],\n }\n\n output = document.content\n if document.render_with_liquid?\n Jekyll.logger.debug \"Rendering Liquid:\", document.relative_path\n output = render_liquid(output, payload, info, document.path)\n end\n\n Jekyll.logger.debug \"Rendering Markup:\", document.relative_path\n output = convert(output.to_s)\n document.content = output\n\n Jekyll.logger.debug \"Post-Convert Hooks:\", document.relative_path\n document.trigger_hooks(:post_convert)\n output = document.content\n\n if document.place_in_layout?\n Jekyll.logger.debug \"Rendering Layout:\", document.relative_path\n output = place_in_layouts(output, payload, info)\n end\n\n output\n end", "def build_docs\n object_map.each do |index, objects|\n objects.each do |object|\n template_context = {\n #:meta => Site\n index => object\n }\n content = converter.render(template_map[index], template_context)\n filename = converter.filename_for(object)\n write_output_file(filename, content)\n end\n end\n end", "def create_doc_with_http_info(doc, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocApi.create_doc ...'\n end\n # verify the required parameter 'doc' is set\n if @api_client.config.client_side_validation && doc.nil?\n fail ArgumentError, \"Missing the required parameter 'doc' when calling DocApi.create_doc\"\n end\n # resource path\n local_var_path = '/docs'\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', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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(doc)\n\n # return_type\n return_type = opts[:debug_return_type] || 'String'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"DocApi.create_doc\",\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: DocApi#create_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def build_document_component(node)\n DocumentComponent.new(\n node.name.downcase,\n build_document_components_array(node.children),\n attrs_of(node)\n )\n end", "def build(document)\n document.geom_type = geom_type\n document.format = format\n end", "def convert_document_docx_to_html_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_docx_to_html ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_docx_to_html\"\n end\n # resource path\n local_var_path = '/convert/docx/to/html'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_docx_to_html\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def build(attributes = {}, type = nil)\n Factory.execute_build(type || klass, attributes, execute_callbacks: false).tap do |doc|\n append(doc)\n doc.apply_post_processed_defaults\n yield doc if block_given?\n doc.run_pending_callbacks\n doc.run_callbacks(:build) { doc }\n end\n end", "def build_resource_and_document\n manifest = @resource.iiif_manifests.first # See /models/spotlight/resources/vault_iiif_manifest.rb\n manifest.with_exhibit(@resource.exhibit)\n manifest.with_resource(@resource)\n @resource.data = manifest.manifest_metadata.transform_values { |v| v.first } # We want to index the SolrDocument with a multiple value ({ k => ['v'] }\n end", "def new_doc\n @doc_content = \"\"\n @doc_start_page = nil\n @pages_in_doc = 0\n end", "def client_new_doc\n data = params\n cid = current_company.id\n @return_path = data[:return_path]\n @return_path = request.headers['HTTP_REFERER'] if @return_path.blank?\n @matter = Matter.scoped_by_company_id(cid).find(params[:id])\n @document_home = DocumentHome.new\n @document = @document_home.documents.build\n @mapable_id = data[:id]\n @mapable_type = 'Matter'\n @task= MatterTask.scoped_by_company_id(cid).find(data[:task_id] ) if data[:task_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_home }\n end\n end", "def build(document)\n document.geom_types = geom_types\n document.format = format\n end", "def build(document)\n services.each do |service|\n service.build(document)\n end\n end", "def create_document_using_post(document_request, opts = {})\n data, _status_code, _headers = create_document_using_post_with_http_info(document_request, opts)\n data\n end", "def generate_doc(resource_docs)\n generate_index_templates(resource_docs)\n copy_assets!\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render jbuilder: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(params[:document])\n @document.stuffing_data = []\n @document.user = current_user\n\n #Hack for now - add all column keys to primary keys for search\n @document.stuffing_primary_keys = get_data_colnames(@document.stuffing_data)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def template(reporttype, reportname, authorlist, emaillist, group, address,\n revdate, revnumber, docdate, description, legal, encoding, toc)\n \n sampledoc = <<-TEMPLATE\n:reporttype: #{reporttype || 'The type of report'}\n:reporttitle: #{reportname || 'The name of the report'}\n:author: #{authorlist || 'Author McList, Authorette OName'}\n:email: #{emaillist || 'someone@somehost.com, someoneelse@anotherhost.net'}\n:group: #{group || 'Marketing? Research? Edit me...'}\n:address: #{address || 'Company Address....'}\n:revdate: #{revdate || 'January 1, 2012'}\n:revnumber: #{revnumber || '0.0.1'}\n:docdate: #{docdate || 'January 1, 2012'}\n:description: #{description || 'Barebones Sample Document'}\n:legal: #{legal || '(C) Copyrighted by who?'}\n:encoding: #{encoding || 'iso-8859-1'}\n:toc: #{toc || 'true'}\n\n<<<\n== Introduction ==\nHi This is an introduction!\nTEMPLATE\n return sampledoc\n end", "def generate_builder\n\t\t@email = params[:vitalsource][:email]\n\t\t@first_name = params[:vitalsource][:first_name]\n\t\t@last_name = params[:vitalsource][:last_name]\n\t\t@affiliate = params[:vitalsource][:affiliate]\n\t\t@password = params[:vitalsource][:password]\n\t\t@confirm_password = params[:vitalsource][:confirm_password]\n\t\t@question_id = params[:vitalsource][:question_id]\n\t\t@answer = params[:vitalsource][:answer]\n\n\t\tdoc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent =>2)\n\t\t# #----------user login request body------------------------------------------------------------------------\n\t\t# doc.credentials{\n\t\t# \tdoc.credential(\"email\" => \"lemon_victor@hotmail.com\", \"password\" => \"wgx890922\")\n\t\t# }\n\t\t# #user login request url\n\t\t# request_url = \"/v3/credentials.xml\"\n\t\t# # #return: \n\t\t# # #{\"credentials\"=>{\"credential\"=>{\"access_token\"=>\"4e2503801317d29a915895b17d560c54\", \"reference\"=>\"\", \"guid\"=>\"B2EY7AGYKNNMER76H56M\", \"email\"=>\"lemon_victor@hotmail.com\", \"__content__\"=>\"\\n \"}}}\n\n\n\t\t#-------------create user request body---------------------------------------------------------------------\n\t\tdoc.user{\n\t\t\t# doc.reference(\"xiehongquan002\")\n\t\t\tdoc.email(@email)\n\t\t\tdoc.password(@password)\n\t\t\tdoc.first_name(@first_name)\n\t\t\tdoc.last_name(@last_name)\n\t\t\tdoc.affiliate(@affiliate)\n\t\t\tdoc.question_id(@question_id)\n\t\t\tdoc.question_response(@answer)\n\t\t}\n\t\t#create user request url\n\t\trequest_url = \"/v3/users.xml\"\n\n\t\t# #-------------a valid reference field as a credential----------------------------------------------\n\t\t# doc.credentials{\n\t\t# \tdoc.credential(\"reference\" => \"xiehongquan002\")\n\t\t# }\n\t\t# #reference field credential request url\n\t\t# request_url = \"/v3/credentials.xml\"\n\t\t#return:\n\t\t#{\"credentials\"=>{\"credential\"=>{\"reference\"=>\"xiehongquan002\", \"email\"=>\"b868868026c4da5@placeholder.142.edu\", \"access_token\"=>\"b452fd75eae3c05f7c34e258c4084e57\", \"guid\"=>\"URP732MQYFXT7ZVMCY5M\", \"__content__\"=>\"\\n \"}}}\n\n\t\t@request = out_string\n\t\turi = URI.parse(\"https://api.vitalsource.com\")\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\trequest = Net::HTTP::Post.new(request_url)\t\t\n\t\trequest.add_field('X-VitalSource-API-Key', 'YNBWZXTN743PWCZG')\n\t\trequest.body = out_string\n\t\tresponse = http.request(request)\n\t\tbody = Hash.from_xml(response.body)\n\t\tif(body.has_key?(\"error_response\"))\n\t\t\t@err = body[\"error_response\"][\"error_text\"]\n\t\tend\n\t\tif(body.has_key?(\"user\"))\n\t\t\t@user = body[\"user\"]\n\t\tend\n\tend", "def convert_document_odt_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_odt_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_odt_to_docx\"\n end\n # resource path\n local_var_path = '/convert/odt/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_odt_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def build\n asdocs = scan(@src)\n\n if asdocs.empty?\n puts \"No .asdoc files found.\"\n else\n create_xml(asdocs)\n to_disk(xml)\n end\n end", "def construct_builder!\n @builder = Brainstem::ApiDocs::Builder.new(builder_options)\n end", "def create\n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n format.html { redirect_to(@doc, :notice => 'Doc was successfully created.') }\n format.xml { render :xml => @doc, :status => :created, :location => @doc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new(raw_content, opts = {})\n opts[:type] = self\n Document.new(raw_content, opts)\n end", "def create_document(file, file_type, object, comment, file_name=nil)\n if object.invoice_no.include?('/')\n file_obj=object.invoice_no.gsub('/','')\n else\n file_obj=object.invoice_no\n end\n filename = (file_name ? \"#{file_name}.#{file_type}\" : nil ) || \"InvoiceNo_#{file_obj}_#{Time.zone.now.to_i}_New.#{file_type}\"\n\n newfile=File.open(\"#{filename}\", \"w\") {|f| f.write(file) }\n\n root_file=File.open(\"#{RAILS_ROOT}/#{filename}\",'r')\n document={:name => \"Test\" ,:data=> root_file}\n document_home = {:document_attributes => document}\n document_home.merge!(:access_rights => 2, :created_by_user_id=>object.created_by_user_id,:company_id=>object.company_id,\n :mapable_id=>comment.id,:mapable_type=>'Comment', :owner_user_id=>object.owner_user_id)\n newdocument_home = comment.document_homes.new(document_home)\n newdocument = newdocument_home.documents.build(document.merge(:company_id=>object.company_id, :created_by_user_id=>object.created_by_user_id))\n newdocument_home.save\n if newdocument_home.save\n root_file.close\n File.delete(\"#{RAILS_ROOT}/#{filename}\")\n end\n end", "def document\n params.has_key?('_json') ? params['_json'] : params\n end", "def doc(new_markup=nil)\n if markup = new_markup || content\n @doc = nil if new_markup\n @doc ||= case parser.to_sym\n when :xml then Nokogiri::XML(markup)\n when :html then Nokogiri::HTML(markup)\n else raise InvalidParser.new(\"Nokogiri cannot parse as '#{parser.inspect}'. Please request :xml or :html.\")\n end\n end\n end", "def create_document(xml)\n begin\n REXML::Document.new(xml) \n rescue REXML::ParseException\n # nil\n end \nend", "def generate_doc\n\n end", "def generate_doc_from_model\n # Get the config for the model to be signed\n elt = @e_sign_document.option_type_config\n\n # Use either the specified fields in the activity log e_sign configuration,\n # or the fields specified in the model to be signed\n sign_fields = @specified_fields || elt.fields\n\n # Limit the attributes to just the specified fields, and order them according the field config\n att_order = @e_sign_document.class.permitted_params\n all_atts = {}\n if att_order\n att_order.each do |a|\n a = a.to_s\n all_atts[a] = @e_sign_document.attributes[a]\n end\n else\n all_atts = @e_sign_document.attributes.dup\n end\n atts = all_atts.select { |k, _v| sign_fields.include? k }\n\n ApplicationController.render(template: 'e_signature/document', layout: 'e_signature', locals: {\n e_sign_document: @e_sign_document,\n prepared_document: self,\n attributes: atts,\n caption_before: elt.caption_before,\n labels: elt.caption_before,\n show_if: elt.show_if,\n current_user: current_user,\n document_title: @document_title,\n document_intro: @document_intro\n }).html_safe\n end", "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @document.to_json(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n format.xml { render :xml => @document.to_xml(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n end\n end", "def create\n @document = Document.new(params[:document])\n @document.generate_token\n @document.archived = false\n if params[:group_id]\n @document.owner = Group.find(params[:group_id]) \n else\n @document.owner ||= default_company\n end\n @document.author = current_user\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to document_path(@document), :flash => { :success => 'Document was successfully created.'} }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_doc(doc_records)\n puts \"create_doc Not implemented\"\n end", "def document\n return TypeElement.new({name: 'document', content: @document}, main_element: self)\n end", "def create\n @doc_template = DocTemplate.new(doc_template_params)\n\n respond_to do |format|\n if @doc_template.save\n format.html { redirect_to @doc_template, notice: 'Doc template was successfully created.' }\n format.json { render :show, status: :created, location: @doc_template }\n else\n format.html { render :new }\n format.json { render json: @doc_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |wants|\n if @document.save\n flash[:notice] = 'Document was successfully created.'\n wants.html { redirect_to(@document) }\n wants.xml { render :xml => @document, :status => :created, :location => @document }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def convert_document_pdf_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_pdf_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_pdf_to_docx\"\n end\n # resource path\n local_var_path = '/convert/pdf/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_pdf_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def start_document\n @doc = Nokogiri::XML::Document.new\n end", "def construct_doc\n @doc = num_pages.times.map do |page_number|\n url = URI.join(BASE_URL,\n review_url(@beer.id, url_suffix, page_number))\n noko_doc(url).at_css('.reviews-container')\n end\n end", "def render_document(input, outdir, outname, format, vars)\r\n \r\n \r\n #TODO: Clarify the following\r\n # on Windows, Tempdir contains a drive letter. But drive letter\r\n # seems not to work in pandoc -> pdf if the path separator ist forward\r\n # slash. There are two options to overcome this\r\n #\r\n # 1. set tempdir such that it does not contain a drive letter\r\n # 2. use Dir.mktempdir but ensure that all provided file names\r\n # use the platform specific SEPARATOR\r\n #\r\n # for whatever Reason, I decided for 2.\r\n \r\n tempfile = input\r\n tempfilePdf = \"#{@tempdir}/x.TeX.md\".to_osPath\r\n tempfileHtml = \"#{@tempdir}/x.html.md\".to_osPath\r\n outfilePdf = \"#{outdir}/#{outname}.pdf\".to_osPath\r\n outfileDocx = \"#{outdir}/#{outname}.docx\".to_osPath\r\n outfileHtml = \"#{outdir}/#{outname}.html\".to_osPath\r\n outfileRtf = \"#{outdir}/#{outname}.rtf\".to_osPath\r\n outfileLatex = \"#{outdir}/#{outname}.latex\".to_osPath\r\n outfileText = \"#{outdir}/#{outname}.txt\".to_osPath\r\n outfileSlide = \"#{outdir}/#{outname}.slide.html\".to_osPath \r\n \r\n #todo: handle latexStyleFile by configuration\r\n latexStyleFile = File.dirname(File.expand_path(__FILE__))+\"/../../ZSUPP_Styles/default.latex\"\r\n latexStyleFile = File.expand_path(latexStyleFile).to_osPath\r\n\r\n vars_string=vars.map.map{|key, value| \"-V #{key}=#{value.esc}\"}.join(\" \")\r\n \r\n @log.info(\"rendering #{outname} as [#{format.join(', ')}]\")\r\n \r\n if $?.success? then\r\n \r\n if format.include?(\"pdf\") then\r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfilePdf.esc} --toc --standalone --latex-engine xelatex --number-sections #{vars_string}\" +\r\n \" --template #{latexStyleFile.esc} --ascii -o #{outfilePdf.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"latex\") then\r\n \r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfilePdf.esc} --toc --standalone --latex-engine xelatex --number-sections #{vars_string}\" +\r\n \" --template #{latexStyleFile.esc} --ascii -o #{outfileLatex.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"html\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileHtml.esc}\"\r\n \r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"docx\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileDocx.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"rtf\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileRtf.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"txt\") then\r\n \r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -t plain -o #{outfileText.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"slide\") then\r\n \r\n ReferenceTweaker.new(\"slide\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --number #{vars_string}\" +\r\n \" --ascii -t dzslides --slide-level 2 -o #{outfileSlide.esc}\"\r\n `#{cmd}`\r\n end\r\n else\r\n \r\n @log.error \"failed to perform #{cmd}\"\r\n #TODO make a try catch block kere\r\n \r\n end\r\n \r\n end", "def resolve_document\n case document\n when /^http[s]?:/ then \n response = HTTPI.get(request)\n if response.error?\n raise Savon::HTTP::Error.new(response)\n else\n response.body\n end\n when /^</ then document\n else File.read(document)\n end\n end", "def docu_template_params\n params.require(:docu_template).permit(:recipients, :self_sign, :users, :document, :title)\n end", "def document_from_io(io)\n REXML::Document.new(io)\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to(@document, :notice => 'Document was successfully created.') }\n format.xml { render :xml => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_template\n\n add_breadcrumb \"Download Template\"\n\n # Figure out which approach was used to access this method\n file_content_type = nil\n # From the form. This is managed via a TemplateProxy class\n if params[:template_proxy].present?\n # Inflate the proxy\n template_proxy = TemplateProxy.new(params[:template_proxy])\n Rails.logger.debug template_proxy.inspect\n\n # See if an org was set, use the default otherwise\n if template_proxy.organization_id.blank?\n org = nil\n else\n o = Organization.find(template_proxy.organization_id)\n org = Organization.get_typed_organization(o)\n end\n\n # The form defines the FileContentType which identifies the builder to use\n file_content_type = FileContentType.find(template_proxy.file_content_type_id)\n # asset_types are an array of asset types\n\n elsif params[:targets].present?\n # The request came from the audit results page. We have a list of asset\n # object keys\n file_content_type = FileContentType.find(params[:file_content_type_id])\n assets = Rails.application.config.asset_base_class_name.constantize.operational.where(:object_key => params[:targets].split(','))\n org = nil\n end\n\n is_component = params[:is_component]\n fta_asset_class_id = params[:fta_asset_class_id]\n\n # Find out which builder is used to construct the template and create an instance\n builder = file_content_type.builder_name.constantize.new(:organization => org, :asset_class_name => template_proxy.try(:asset_class_name), :asset_seed_class_id => template_proxy.try(:asset_seed_class_id), :organization_list => @organization_list, :is_component => is_component, :fta_asset_class_id => fta_asset_class_id)\n\n # Generate the spreadsheet. This returns a StringIO that has been rewound\n if params[:targets].present?\n builder.assets = assets\n end\n stream = builder.build\n\n # Save the template to a temporary file and render a success/download view\n file = Tempfile.new ['template', '.tmp'], \"#{Rails.root}/tmp\"\n ObjectSpace.undefine_finalizer(file)\n #You can uncomment this line when debugging locally to prevent Tempfile from disappearing before download.\n @filepath = file.path\n @filename = \"#{org.present? ? org.short_name.downcase : 'MultiOrg'}_#{file_content_type.class_name.underscore}_#{Date.today}.xlsx\"\n begin\n file << stream.string\n rescue => ex\n Rails.logger.warn ex\n ensure\n file.close\n end\n # Ensure you're cleaning up appropriately...something wonky happened with\n # Tempfiles not disappearing during testing\n respond_to do |format|\n format.js\n format.html\n end\n\n end", "def new\n @transaction = Transaction.new\n @transaction.build_document\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def create\n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n format.html { redirect_to @doc, notice: \"\\\"#{@doc.component}\\\" was successfully created.\" }\n format.json { render json: @doc, status: :created, location: @doc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_document options={}\n\n # which vendor or which account?\n party = options[\"party_type\"].constantize.find_by_id(options[\"party\"])\n\n # generate pending document_entity (the row in the document table)\n document = Document.create( document_type: options[\"doc_type\"],\n recipient: party.name,\n total: \"0\",\n event_id: self.id,\n status: DocumentStatus::requested,\n name: DocumentStatus::requested,\n creator_id: options[\"current_user\"])\n options[\"document_id\"] = document.id\n\n #if we're invoicing, lock invoicable line items\n if options[\"doc_type\"] == DocumentType::Event::invoice\n lock_new_invoice_line_items party, document\n end\n # queue the pdf creation and persistence\n Resque.enqueue( EventDocument, options )\n end", "def create_doc(doc, opts = {})\n data, _status_code, _headers = create_doc_with_http_info(doc, opts)\n data\n end", "def create_document\n filename = 'NewDocument.docx'\n folder = 'Word Documents'\n storage = 'Default Storage'\n\n request = PutCreateDocumentRequest.new storage, filename, folder\n result = @words_api.put_create_document request\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to(@document, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def convert_document_docx_to_pdf_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_docx_to_pdf ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_docx_to_pdf\"\n end\n # resource path\n local_var_path = '/convert/docx/to/pdf'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_docx_to_pdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def generate_document options={}\n\n # which vendor or which account?\n party = options[\"party_type\"].constantize.find_by_id(options[\"party\"])\n\n # generate pending document_entity (the row in the document table)\n document = Document.create( document_type: options[\"doc_type\"],\n recipient: party.name,\n total: \"0\",\n event_id: self.id,\n status: DocumentStatus::requested,\n name: DocumentStatus::requested,\n creator_id: options[\"current_user\"])\n options[\"document_id\"] = document.id\n\n #if we're invoicing, lock invoicable line items\n if options[\"doc_type\"] == DocumentType::Event::invoice\n lock_new_invoice_line_items party, document\n end\n # queue the pdf creation and persistence\n Sidekiq::Client.enqueue( EventDocument, options )\n end", "def create\n @parent = get_parent_from_params # parent is either folder or project; see application_controller\n @document = @parent.documents.build(params[:document])\n if @document.save\n redirect_to(@document, :notice => 'Document was successfully created.')\n else\n render :action => \"new\"\n end\n end", "def create_search_doc_cloudant(locales = [Settings[:DEFAULT_LOCALE]])\n json_doc = JSON.parse(File.read(Pathname.new(File.dirname(__FILE__) + \"/../../\" + \"couchdb_views/cloudant_search_view.json\").cleanpath))\n json_doc[\"indexes\"][\"by_content\"][\"analyzer\"][\"fields\"] = \"{#{locales2languages(locales)}}\"\n json_doc[\"indexes\"][\"by_content\"][\"index\"] = construct_design_doc(\"couchdb_views/cloudant_search_view.js\", locales)\n json_doc[:content_hash] = generateCheckSum(json_doc[\"indexes\"][\"by_content\"][\"index\"])\n json_doc[:updated] = Time.now.to_date.iso8601\n upsert_doc(@db, json_doc, json_doc, :content_hash, @log)\n end", "def get_document_with_format(request)\n data, _status_code, _headers = get_document_with_format_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def document( template_name )\n\n @logger.info( \"#{__method__}, template_name '#{template_name}'\" )\n \n # \n template_string = @template.get_template( template_name )\n @logger.debug( \"#{__method__}, template_string= '#{template_string}'\" )\n\n # \n state_opened=false\n\n # iterate lines\n template_string && template_string.split( \"\\n\" ).each do | line |\n\n if !state_opened then\n\n # waiting for +++open+++ or +++fold_on+++\n\n open_found, line = directive_open( line )\n if open_found then\n\n state_opened = true\n @logger.info( \"#{__method__}, open tag in '#{template_name}'\" )\n \n # something follows the start -tag\n redo if line && ! line.empty?\n\n end\n\n else \n\n # seen +++open+++ or +++fold_on+++, waiting for +++close+++, +++fold_off+++\n\n close_found, line_pre, line = directive_close( line )\n # puts \"close_found=#{close_found}, #{close_found.class}, line=#{line}\"\n if close_found then\n output( line_pre ) if line_pre && !line_pre.empty?\n @logger.info( \"#{__method__}, close tag in '#{template_name}'\" )\n state_opened = false\n redo if line && ! line.empty?\n elsif template_name = directive_include( line ) then\n @logger.info( \"#{__method__}, include in '#{template_name}'\" )\n document( template_name )\n else\n output( line )\n end\n\n end # state_opened\n end # each line\n\n end", "def build_request_xml(checks, check_data = {})\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.callvalidate do\n authentication(xml)\n xml.sessions do\n xml.session(\"RID\" => Time.now.to_f) do\n xml.data do\n personal_data(xml, check_data[:personal_data])\n card_data(xml, check_data[:card_data])\n bank_data(xml, check_data[:bank_data])\n income_data(xml, check_data[:income_data])\n required_checks(xml, checks)\n end\n end\n end\n xml.application @config[:application_name]\n end\n end\n builder.doc\n end", "def prepare_doc(raw)\n raw\n end", "def create\n @document = Document.new(params[:document].merge(:owner => current_user))\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to \"/view_pad/#{@document.id}\", notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @documentable = find_resource\n @document = @documentable.documents.build(document_params)\n @document.creator = current_user\n\n respond_to do |format|\n if @document.save\n notify_user(:notice, 'Document was successfully created.')\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render action: 'show', status: :created, location: @document }\n format.js { @asset = @document.documentable }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n format.js { render action: 'new' }\n end\n end\n end", "def call(name, request, *options)\n send(\"base_#{name}\", request)\n set_location request.location\n send(name, request.document, *options)\n end", "def create\n render :template => '/pages/bot_detected' and return unless params[:javascript_enabled] == 'true'\n \n @document = Document.public.find(params[:id])\n \n params[:document][:state] = nil # prevent auto approval hack (FIXME: use attr_protected)\n\n if @document.meta_definition_for(params[:label]).allowed? current_user, 'create'\n\n new_document = Document.new(params[:document])\n new_document.parent = @document\n new_document.label = params[:label]\n new_document.author = current_user || User.anonymous\n new_document.published_at = Time.now\n\n if new_document.save\n flash[:notice] = new_document.meta_definition.flash_messages['create'] || \"Your #{params[:label]} has been saved\"\n if new_document.meta_definition.notify_admins\n DocumentMailer.deliver_new_document(new_document)\n end\n redirect_to document_path(@document)\n else\n flash.now[:notice] = 'Could not be saved'\n eval(\"@new_#{params[:label]} = new_document\")\n setup_view_environment\n render :template => view_for\n end\n else\n render :text => 'Not Allowed' and return\n end\n end", "def build_from_template(template, data = {}, layout = true)\n cont = File.read(template_file(template)).miga_variables(data)\n return cont unless layout\n\n build_from_template(\n 'layout.html',\n data.merge(content: cont, project_name: cli.load_project.name),\n false\n )\n end", "def create\n @templates = @firm.templates\n @template = Template.new(template_params)\n @template.user = @user\n @template.firm = @firm\n if File.extname(@template.file.file.filename) == '.docx'\n content = ''\n if @template.valid_zip?\n doc = Docx::Document.open(@template.file.path)\n doc.paragraphs.each do |p|\n if p.node.xpath('w:r//w:lastRenderedPageBreak').present?\n content = content + %q(<div class=\"-page-break\"></div>) + p.to_html\n else\n content = content + p.to_html\n end\n\n end\n @template.html_content = content\n respond_to do |format|\n if @template.save\n format.html { redirect_to template_path(@template), notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n else\n @template.errors.add(:file, 'is corrupted')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def search_document_with_template_get_with_http_info(type, id, template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SearchApi.search_document_with_template_get ...\"\n end\n # verify the required parameter 'type' is set\n if @api_client.config.client_side_validation && type.nil?\n fail ArgumentError, \"Missing the required parameter 'type' when calling SearchApi.search_document_with_template_get\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SearchApi.search_document_with_template_get\"\n end\n # verify the required parameter 'template' is set\n if @api_client.config.client_side_validation && template.nil?\n fail ArgumentError, \"Missing the required parameter 'template' when calling SearchApi.search_document_with_template_get\"\n end\n # resource path\n local_var_path = \"/search/documents/{type}/{template}/{id}\".sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s).sub('{' + 'template' + '}', template.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SearchApi#search_document_with_template_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def xml_document(obj)\n case obj\n when XML::Document\n XML::Document.document(obj)\n else\n XML::Document.new('1.0')\n end\n end", "def put_create_document(request)\n data, _status_code, _headers = put_create_document_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def convert_document_rtf_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_rtf_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_rtf_to_docx\"\n end\n # resource path\n local_var_path = '/convert/rtf/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_rtf_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def doc_request(query)\n endpoint = \"http://doc-#{search_domain}.#{aws_region}.cloudsearch.amazonaws.com/#{api_version}/documents/batch\"\n\n options = { :body => [query].to_json, :headers => { \"Content-Type\" => \"application/json\"} }\n\n begin\n response = HTTParty.post(endpoint, options)\n rescue Exception => e\n ae = Asari::DocumentUpdateException.new(\"#{e.class}: #{e.message}\")\n ae.set_backtrace e.backtrace\n raise ae\n end\n\n unless response.response.code == \"200\"\n raise Asari::DocumentUpdateException.new(\"#{response.response.code}: #{response.response.msg}\")\n end\n\n nil\n end", "def show_documentation req, res\n store, path = documentation_source req.path\n\n if_modified_since req, res, store.cache_path\n\n generator = generator_for store\n\n case path\n when nil, '', 'index.html' then\n res.body = generator.generate_index\n when 'table_of_contents.html' then\n res.body = generator.generate_table_of_contents\n when 'js/search_index.js' then\n documentation_search store, generator, req, res\n else\n documentation_page store, generator, path, req, res\n end\n ensure\n res.content_type ||= 'text/html'\n end", "def create\n @breadcrumb = 'create'\n @contracting_request_document_type = ContractingRequestDocumentType.new(params[:contracting_request_document_type])\n @contracting_request_document_type.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @contracting_request_document_type.save\n format.html { redirect_to @contracting_request_document_type, notice: t('activerecord.attributes.contracting_request_document_type.create') }\n format.json { render json: @contracting_request_document_type, status: :created, location: @contracting_request_document_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contracting_request_document_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def payload_from_doc(req, doc, opts = {})\n if doc.is_a?(IO) || doc.is_a?(StringIO) || doc.is_a?(Tempfile) # attachments\n req[:header]['Content-Type'] = mime_for(req[:uri].path)\n doc\n elsif opts[:raw] || doc.nil?\n doc\n else\n MultiJson.encode(doc.respond_to?(:as_couch_json) ? doc.as_couch_json : doc)\n end\n end", "def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end" ]
[ "0.67430896", "0.6553285", "0.6527995", "0.64811975", "0.64162254", "0.6214854", "0.6136644", "0.6134135", "0.6080438", "0.6070958", "0.6042282", "0.595217", "0.5902387", "0.58985215", "0.5879439", "0.5873834", "0.58653307", "0.5848084", "0.5846657", "0.5801153", "0.5770462", "0.57688457", "0.57387275", "0.5722972", "0.5717205", "0.57112306", "0.5686208", "0.5684874", "0.56468326", "0.5638159", "0.56341493", "0.5624361", "0.56037706", "0.5601695", "0.5600322", "0.5593833", "0.55694383", "0.55649567", "0.55627155", "0.55488634", "0.5515965", "0.55075777", "0.5503302", "0.54942936", "0.54864526", "0.54761624", "0.54735833", "0.5463316", "0.54586154", "0.5446611", "0.543504", "0.5433907", "0.5428371", "0.5422519", "0.5419928", "0.54124576", "0.5412331", "0.540592", "0.5404784", "0.5400342", "0.53916377", "0.53882813", "0.5385911", "0.5384602", "0.5383986", "0.53825545", "0.5381152", "0.5376909", "0.5365931", "0.5355428", "0.53492534", "0.5340532", "0.533775", "0.53365606", "0.53313774", "0.53265405", "0.5310162", "0.53085953", "0.5300096", "0.5299915", "0.52972645", "0.5289793", "0.5282975", "0.52826476", "0.528146", "0.52793217", "0.52782774", "0.52780277", "0.5275776", "0.5271788", "0.5269155", "0.52633816", "0.5261415", "0.5260074", "0.5259359", "0.5251211", "0.5249484", "0.5248251", "0.52457917", "0.5235269" ]
0.6234749
5
Get all files and folders within a folder
def get_files_list(request) begin data, _status_code, _headers = get_files_list_with_http_info(request) rescue ApiError => e if e.code == 401 request_token data, _status_code, _headers = get_files_list_with_http_info(request) else raise end end data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end", "def get_folder_files(folder_path)\n ensure_file_open!\n @file.glob(\"#{folder_path}/**/*\").to_h do |entry|\n entry_file_name = Pathname.new(entry.name)\n file_name = entry_file_name.relative_path_from(folder_path)\n [file_name, entry.get_input_stream(&:read)]\n end\n end", "def get_entries(dir, subfolder); end", "def get_files(site, folder)\n files = []\n Dir.chdir(File.join(site.source, folder)) { files = filter_entries(Dir.glob('**/*.*')) }\n files\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def all_directories dir\n Dir[\"#{dir}**/\"]\nend", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end", "def files\n return unless session\n session.files.find_all_by_parent_folder_id(id)\n end", "def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end", "def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend", "def iterationFolder(path) \r\n\t\tfolderArray = []\r\n\t\tDir.entries(path).each do |sub| \r\n\t\t\tif sub != '.' && sub != '..' \r\n\t\t\t if File.directory?(\"#{path}/#{sub}\") \r\n\t\t\t\t#puts \"[#{sub}]\"\r\n\t\t\t\titerationFolder(\"#{path}/#{sub}\") \r\n\t\t\t else \r\n\t\t\t\t#puts \"|--#{sub}\"\r\n\t\t\t\tfolderArray << $SCRIPT_DIR_PATH + \"/\" + \"#{sub}\"\r\n\t\t\t end \r\n\t\t\tend \r\n\t\tend \r\n\t\treturn folderArray\r\n\tend", "def test_files\n get_folder_files(TESTS_PATH)\n end", "def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend", "def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end", "def files_in_folder(folder, options={})\n pattern = \"**{,/*/**}/*\"\n # modify by Hub\n # add method glod : Dir.glob\n #Dir[File.join(folder, pattern)].uniq\n Dir.glob(File.join(folder, pattern)).uniq\n end", "def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end", "def find_files_in_dir dir\n unless dir.exist?\n warn \"Can't find files in dir %s as it doesn't exist!\",\n dir.relative_path_from(project.path + '..').to_s\n return []\n end\n Dir.chdir dir do\n Dir['**/*'].map { |path| Pathname(path) }\n end\n end", "def list(path='root')\n puts \"#list('#{path}')\"\n listed_files =[]\n @drive.folder = path\n children = @drive.children\n list_files_metadata(children)\n raise 'There are no files in directory' if children.count < 1\n children.each do |item|\n listed_files << \"#{item.path.gsub('/drive/', 'drive/')}/#{item.name}\" unless item.folder?\n end\n @logger.info 'Children list acquired.'\n pp listed_files\n end", "def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end", "def dir_files(dir)\n Find.find(dir).to_a.reject!{|f| File.directory?(f) }\nend", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end", "def all_files_in_dir(p_dir)\n [File.join(p_dir, \"**\", \"*\"), File.join(p_dir, \"**\", \".*\")]\n end", "def get_files_in_path(path)\n puts \"Scanning for files in directory: #{path}\"\n Dir.entries(path).reject { |f| File.directory? f }\nend", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def files(directory)\n files_list = Dir[directory + '/*']\n files = []\n\n files_list.each do |file|\n if File.directory?(file)\n dir_files = files(file)\n dir_files.each { |f| files << f }\n end\n files << file\n end\n files\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end", "def read_dirs(indir)\n @all_files = []\n Dir.chdir(indir)\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n\n @all_files = Dir.glob(\"**/*\").select { |f| File.file? f }\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n all_dirs.each do |subdir|\n read_dir(subdir)\n end\n end", "def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |path|\n path = File.expand_path(path, @root.path)\n\n if @glob && File.directory?(path)\n result.concat files_in(path)\n else\n result << path\n end\n end\n\n result.uniq!\n result\n end", "def get_files\n fields = \"next_page_token, files(id, name, owners, parents, mime_type, sharedWithMeTime, modifiedTime, createdTime)\"\n\n folders = []\n @files = []\n\n #Go through pages of files and save files and folders\n next_token = nil\n first_page = true\n while first_page || (!next_token.nil? && !next_token.empty?)\n results = @service.list_files(q: \"not trashed\", fields: fields, page_token: next_token)\n folders += results.files.select{|file| file.mime_type == DRIVE_FOLDER_TYPE and belongs_to_me?(file)}\n @files += results.files.select{|file| !file.mime_type.include?(DRIVE_FILES_TYPE) and belongs_to_me?(file)}\n next_token = results.next_page_token\n first_page = false\n end\n\n #Cache folders\n folders.each {|folder| @folder_cache[folder.id] = folder}\n\n #Resolve file paths and apply ignore list\n @files.each {|file| file.path = resolve_path file}\n @files.reject!{|file| Helper.file_ignored? file.path, @config}\n\n Log.log_notice \"Counted #{@files.count} remote files in #{folders.count} folders\"\n end", "def all_files_under(path, &ignore)\n path = Pathname(path)\n\n if path.directory?\n path.children.flat_map do |child|\n all_files_under(child, &ignore)\n end.compact\n elsif path.file?\n if block_given? && ignore.call(path)\n []\n else\n [path]\n end\n else\n []\n end\n end", "def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end", "def enumerate_files(directory)\n return directory.\n children.\n reject(&:directory?).\n map(&:expand_path)\n end", "def files(recurse)\n if recurse\n Dir['**/*'].select { |f| File.file?(f) }\n else\n Dir.entries(Dir.pwd).select { |f| File.file? f }\n end\n end", "def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end", "def files_for_directory(path)\n directory = find_preferred_file(\n @new_resource.cookbook_name, \n :remote_file, \n path, \n @node[:fqdn],\n @node[:platform],\n @node[:platform_version]\n )\n\n unless (directory && ::File.directory?(directory))\n raise NotFound, \"Cannot find a suitable directory\"\n end\n\n directory_listing = Array.new\n Dir[::File.join(directory, '**', '*')].sort { |a,b| b <=> a }.each do |file|\n next if ::File.directory?(file)\n file =~ /^#{directory}\\/(.+)$/\n directory_listing << $1\n end\n directory_listing\n end", "def read_files\n Dir['*', '*/*'].group_by { |f| f.ext || :_dir }.to_symkey\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 get_files(directory)\n Dir.entries(directory).select { |entry| not is_dir?(\"#{directory}/#{entry}\") }\n end", "def files_from(dir)\r\n unless @dirs[dir].key?(:recursive_files)\r\n ensure_dir_data(dir)\r\n recursive_files = Hash[@dirs[dir][:files].keys.map { |file| [\"#{dir}/#{file}\", nil] }]\r\n @dirs[dir][:dirs].keys.each do |subdir|\r\n recursive_files.merge!(Hash[files_from(\"#{dir}/#{subdir}\").map { |file| [file, nil] }])\r\n end\r\n @dirs[dir][:recursive_files] = recursive_files\r\n end\r\n @dirs[dir][:recursive_files].keys\r\n end", "def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end", "def all\n rootdir = Cfg.rootdir\n dirlist = [\"#{rootdir}/*/*\", \"#{rootdir}/*/*/*/*\"]\n filelist = [\"Packages\", \"Packages.gz\", \"Release\", \"Release.gpg\" ]\n files = []\n\n dirlist.each do |dirs|\n Dir.glob(dirs).each do |dir|\n filelist.each do |file|\n fullname = File.join(dir, file)\n files << fullname if File.exists? fullname\n end\n end\n end\n return files\n end", "def directories\n directory.directoires\n end", "def scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end", "def files() = files_path.glob('**/*')", "def get_dir_contents(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tcontents_paths = []\n\tfor i in contents\n\t\tcontents_paths << i['path']\n\tend\n\tcontents_paths\nend", "def file_list(full_directory_path)\r\n path = File.join(full_directory_path, '*')\r\n Dir[path].reject { |fn| File.directory?(fn) || File.basename(fn) == @folder_config }\r\n end", "def build_cache\n all_files = []\n\n Find.find(@root) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == ?.\n Find.prune\n else\n next\n end\n else\n path.slice!(\"#{@root}/\")\n all_files << path\n end\n end\n\n return all_files\n end", "def collect_in_dir directory, recursive = true\n if not File.readable? directory\n puts \"#{directory} not readable. Skipping.\" if @verbose\n else\n directory += \"/\" if not directory.end_with? \"/\"\n if File.directory? directory\n files = Dir.entries directory\n files.reject! {|d| d.match /^\\.{1,2}$/} # ignore parent and self links\n files.map! { |f| directory + f }\n files.each do |fname|\n if File.directory?(fname) and recursive\n collect_in_dir fname\n elsif not File.readable? fname\n puts \"#{fname} not readable.Skipping.\" if @verbose\n elsif File.file? fname and File.extname(fname) == @extension # if no directory\n pkg_info = parse_pkg fname\n @files[fname] = pkg_info if pkg_info\n end\n end\n end\n end\n end", "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "def files_in_directory name, glob = '**' / '*'\n Dir[path / name / glob]\n end", "def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end", "def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end", "def files\n\t\t# if the directory doesn't exist, we bail out with a nil\n\t\treturn nil unless File.directory? dir\n\t\t\n\t\tf = Dir.entries(dir)\n\t\tf.delete(\".\")\n\t\tf.delete(\"..\")\n\n\t\treturn f\n\tend", "def solution_files\n get_folder_files(SOLUTION_PATH)\n end", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end", "def files\n @files = Dir.entries(@path)\n @files.delete_if {|file| file == \".\" || file == \"..\"}\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def list_files_from_dir(path)\n Dir[path + \"/*/\"].map { |file| File.basename(file) }\n end", "def getDirs dir\n\t\tFind.find(dir)\t\n\tend", "def subdir_paths(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tsubdir_paths = []\n\tfor i in contents\n\t\tif i['is_dir']\n\t\t\tsubdir_paths << i['path']\n\t\tend\n\tend\n\tsubdir_paths\nend", "def fakedir_get_all_names(root, basename = '')\n result = (['.', '..'] + root[:files] + root[:dirs].keys).map{|e| basename + e}\n root[:dirs].each do |name, content|\n result += fakedir_get_all_names(content, \"#{basename}#{name}/\")\n end\n result\n end", "def _folders\r\n Dir.glob(File.join(\"templates\", \"**/\"))\r\n end", "def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end", "def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end", "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list files, false, @options.exclude\n end", "def folder\n query = Builder::XmlMarkup.new.Query do |xml|\n xml.Where do |xml|\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FileRef\")\n xml.Value(::File.dirname(url).sub(/\\A\\//, \"\"), :Type => \"Text\")\n end\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FSObjType\")\n xml.Value(1, :Type => \"Text\")\n end\n end\n end\n @list.items(:folder => :all, :query => query).first\n end", "def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end", "def get_file_list relative_path\n\t\t\t\tpath = File.join(@src, relative_path)\n\t\t\t\tresult = nil\n\t\t\t\tFileUtils.cd(path) do\n\t\t\t\t\tresult = Dir.glob(\"**/*\", File::FNM_DOTMATCH)\n\t\t\t\t\tresult.reject! { |fn| File.directory?(fn) }\n\t\t\t\t\tresult.reject! { |fn| fn =~ /(^_|\\/_)/ }\n\t\t\t\tend\n\t\t\t\tresult\n\t\t\tend", "def ls(path)\n dir = scope.get(path)\n InvalidPath.raise! {!dir.try(:is_dir)}\n dir.files.map(&:path)\n end", "def find_files( config )\n files = []\n config.each do |c|\n Config.verify_config_dirs( c )\n\n dir = c[\"directory\"].chomp(\"/\")\n recursive = Config.convert_yaml_bools( c[\"recursive\"] ) \n \n if File.directory? dir \n unless recursive\n Dir.glob( \"#{dir}/*\" ).each do |d|\n files << d unless File.directory? d or File.symlink? d\n end\n else\n Dir.glob(\"#{dir}/**/*\").each do |d|\n files << d unless File.directory? d or File.symlink? d \n end \n end\n else\n Dir.glob( dir ).each do |d|\n files << d \n end\n end\n end\n files\nend", "def files_in(dir)\r\n ensure_dir_data(dir)\r\n @dirs[dir][:files].keys\r\n end", "def directory_contents(directory)\n return Dir.glob(File.join(directory, '*'))\n end", "def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end", "def folders\n xpath './folder'\n end", "def index\n @file_folders = FileFolder.all\n end", "def search(query, page = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def file_list path = false, only_extensions = []\n data = []\n path = @path unless path\n if File.exists?(path) && File.directory?(path)\n Dir.foreach(path) do |entry|\n next if entry == '..' or entry == '.' or entry.start_with?(\".\")\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n data.concat(file_list(full_path, only_extensions))\n else\n if only_extensions.size > 0\n data << { \n :name => entry,\n :path => full_path\n } if only_extensions.all? {|extension| true if entry.end_with?(extension) }\n else\n data << { \n :name => entry,\n :path => full_path\n }\n end\n end\n end\n end\n return data\n end", "def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end", "def read_directories(dir = \"\")\n base = site.in_source_dir(dir)\n\n return unless File.directory?(base)\n\n entries_dirs = []\n entries_pages = []\n entries_static_files = []\n\n entries = Dir.chdir(base) { filter_entries(Dir.entries(\".\"), base) }\n entries.each do |entry|\n file_path = @site.in_source_dir(base, entry)\n if File.directory?(file_path)\n entries_dirs << entry\n elsif Utils.has_yaml_header?(file_path) || Utils.has_rbfm_header?(file_path)\n entries_pages << entry\n else\n entries_static_files << entry\n end\n end\n\n retrieve_dirs(dir, entries_dirs)\n retrieve_pages(dir, entries_pages)\n retrieve_static_files(dir, entries_static_files)\n end", "def get_files_in(directory_name, options = {})\n options = {\n :traverse => false,\n :full_paths => true\n }.merge(options)\n \n ## If directory name is not absolute, go one-up to what should\n ## be the root directory of the app. (I.e. We're in ROOT/helpers.)\n path = directory_name =~ /^\\// ? directory_name : File.join(File.dirname(__FILE__), '..', directory_name)\n \n pattern = options[:traverse] ? \"/**/*.rb\" : \"/*.rb\"\n files = Dir[path + pattern].select { |e| e =~ /^.+\\.rb$/ }\n\n if options[:full_paths]\n files\n else\n files.map { |file| file.match(/\\/([A-Za-z0-9_]+\\.rb)$/)[1] }\n end\n end", "def getFiles(dirs)\n files = []\n for dir in dirs\n # This is recursive...could use Dir.glob() for local lookups.\n Find.find(dir) do |path|\n files << path if goodPath(path)\n end\n end\n return files\nend", "def ls(path) \n ary = Array.new\n Dir.chdir(path) {\n Dir.glob(\"*\").each {|dir|\n ary.push(dir)\n }\n }\n return ary\nend", "def files(folder, ignore)\n all = Dir.glob(folder + \"/**/*\")\n ignore.each {|i| all = all - Dir.glob(i)}\n \n all\n end", "def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end", "def directory_contents(path)\n\tputs ''\n\tfor i in get_dir_contents(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend", "def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end", "def find_files dir = test_dir\n glob file_pattern(dir)\n end", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def list_files\n Find.find(path) do |element| yield element end\n end", "def directories\n directory_entries.map{ |f| FileObject[path, f] }\n end", "def read_files(file_path)\n\tlist=Dir.entries(file_path)\n\treturn list\nend" ]
[ "0.7364895", "0.73456645", "0.72250926", "0.71962637", "0.7175641", "0.7150448", "0.7065755", "0.7058417", "0.6968796", "0.6967285", "0.6953533", "0.6876023", "0.68662673", "0.6864455", "0.6808971", "0.6770345", "0.67680633", "0.6763372", "0.674458", "0.67410696", "0.673175", "0.6729764", "0.67167735", "0.6713285", "0.6712789", "0.6688529", "0.66615266", "0.6659518", "0.6651136", "0.664824", "0.6644913", "0.6642286", "0.6637456", "0.6635745", "0.6635745", "0.6590727", "0.6589661", "0.6583998", "0.6578934", "0.6573373", "0.6559569", "0.6555369", "0.6542717", "0.6539437", "0.65361494", "0.6529634", "0.65195245", "0.6506902", "0.6500745", "0.6482709", "0.6482456", "0.6480917", "0.64793116", "0.6476761", "0.6471086", "0.6437552", "0.6427342", "0.6418551", "0.6418385", "0.6418385", "0.63963443", "0.63919413", "0.6383742", "0.6382207", "0.6379771", "0.6377468", "0.6369682", "0.6365031", "0.6347298", "0.63415194", "0.63382465", "0.6337851", "0.6337453", "0.6337419", "0.6332441", "0.63310677", "0.63237363", "0.63218397", "0.63121307", "0.6311758", "0.63060164", "0.6305448", "0.63049644", "0.6300841", "0.6300756", "0.6293562", "0.62916535", "0.6287799", "0.62806773", "0.62718284", "0.6271521", "0.6268086", "0.6267671", "0.6260336", "0.6253639", "0.62497735", "0.6249669", "0.62479526", "0.62438905", "0.6233028", "0.622991" ]
0.0
-1
Retrieves list of supported file formats.
def get_supported_file_formats(request) begin data, _status_code, _headers = get_supported_file_formats_with_http_info(request) rescue ApiError => e if e.code == 401 request_token data, _status_code, _headers = get_supported_file_formats_with_http_info(request) else raise end end data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats\n @formats ||= Dir[File.join(path, \"#{name}.{otf,svg,ttf,woff,woff2,eot}\")].map {|file| File.extname(file)[1..-1] }.sort\n end", "def supported_formats\n output = `vips --list` + `convert --version`\n\n formats = %w[jpg png webp gif jp2 avif].select do |format|\n output.include? format\n end\n\n # Sanity check\n raise 'Not enough locally supported formats' unless formats.length >= 3\n\n formats\n end", "def get_supported_file_types\n path = '/v3/miscellaneous/supported-file-types'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_supported_file_types')\n end", "def available_formats\n formats = self.items.collect {|i| i.item_type }\n return formats.compact\n end", "def supported_formats\n # WARNING: This shit won't be documented or even properly tested. It's almost 3 in the morning and I have no idea what I'm doing.\n header_index = output.index('format code')\n return nil if header_index.nil?\n\n formats = []\n output.slice(header_index..-1).split(\"\\n\").each do |line|\n format = {}\n format[:format_code], format[:extension], format[:resolution], format[:note] = line.scan(/\\A(\\d+)\\s+(\\w+)\\s+(\\S+)\\s(.*)/)[0]\n formats.push format\n end\n formats.shift # The first line is just headers\n return [] if formats.first.nil?\n formats.map do |format|\n format[:note].strip! # Get rid of any trailing whitespace on the note.\n format[:format_code] = format[:format_code].to_i # convert format code to integer\n format\n end\n end", "def supported(files)\n files.select { |f| SUPPORTED_TYPES.include?(f.extname.delete('.')) }\n end", "def soapGetSupportedFormats()\n printDebugMessage('soapGetSupportedFormats', 'Begin', 1)\n soapConnect\n res = @soap.getSupportedFormats({})\n if(2 <= @debugLevel)\n p res\n end\n printDebugMessage('soapGetSupportedFormats', 'End', 1)\n return res['getSupportedFormatsReturn']\n end", "def selected_mime_types\n return [] if mime_types.blank?\n\n mime_types.split(',')\n end", "def document_files\n allowed_formats = \n if not parsers.empty?\n parsers.collect do |filetype, parser| \n \".\" + parser.file_extension_name\n end.join(\"|\")\n elsif not parser.nil?\n \".\" + parser.file_extension_name\n end\n\n allowed_formats = Regexp.new(allowed_formats)\n \n \tFileUtils.collect_files_from(docs_path).select do |document_filename|\n \t document_filename =~ allowed_formats\n end\n end", "def formats\n formats = online_resource?(record) ? online_format : physical_format\n any_found?(formats) ? Array(formats[0]) : nil\n end", "def registered_formats\n @@registered_formats\n end", "def mime_types\n safe_const_get(:MIME_TYPES) || []\n end", "def file_extensions\n safe_const_get(:FILE_EXTENSIONS) || []\n end", "def file_format\n file_formats.first.human if file_formats.first\n end", "def allowed_formats (*formats)\n\t\tunless formats.empty?\n\t\t\traise_if_error C.glyr_opt_allowed_formats(to_native, formats.flatten.compact.uniq.join(';'))\n\t\telse\n\t\t\tto_native[:allowed_formats] && to_native[:allowed_formats].split(/\\s*;\\s*/)\n\t\tend\n\tend", "def printGetSupportedFormats()\n printDebugMessage('printGetSupportedFormats', 'Begin', 1)\n paramsList = soapGetSupportedFormats()\n paramsList.each { |param|\n puts param\n }\n printDebugMessage('printGetSupportedFormats', 'End', 1)\n end", "def formats\n self.class::FORMATS\n end", "def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty?\n end", "def formats\n @@formats\n end", "def formats\n @formats ||= mapping.keys.sort\n end", "def available_content_types\n if self.api_file.download_url\n return [self.api_file.mime_type]\n else\n return []\n end\n end", "def mime_exts\n config[:mime_exts]\n end", "def allowed_file_types\n Rails.configuration.allowed_file_types\n end", "def get_allowed_file_extensions\n get_siteinfo('fileextensions')['query']['fileextensions'].collect { |e| e['ext'] }\n end", "def image_formats\n format_from_name = self.class.name.downcase[/gif|jpeg|png/]\n raise \"#{self.class}: can't guess applicable format from worker name\" unless format_from_name\n [format_from_name.to_sym]\n end", "def magick_formats\n @magick_formats ||= `convert -version`\n .scan(/Delegates.*/)\n .first\n .delete_prefix('Delegates (built-in):')\n .split\n end", "def file_exts\n [].concat(viewed_exts).concat(edited_exts).concat(convert_exts).concat(fill_forms_exts)\n end", "def default_file_extensions\n RB_EXTS\n end", "def printGetSupportedFormats()\n printDebugMessage('printGetSupportedFormats', 'Begin', 1)\n dbInfoList = getDatabaseInfoList()\n dbInfoList.each{ |dbInfo|\n fmtStr = ''\n itemNum = 0\n dbInfo.each_element('formatInfoList/formatInfo') { |formatInfo|\n fmtStr += ',' if(itemNum > 0)\n fmtStr += formatInfo.elements['name'].text\n itemNum += 1\n }\n \n puts dbInfo.elements['name'].text + \"\\t\" + fmtStr\n }\n printDebugMessage('printGetSupportedFormats', 'End', 1)\n end", "def format_extension\n extensions.reverse.detect { |ext|\n @environment.mime_types(ext) && !@environment.engines(ext)\n }\n end", "def image_formats\n format_from_name = self.class.name.downcase[/gif|jpeg|png|svg/]\n unless format_from_name\n fail \"#{self.class}: can't guess applicable format from worker name\"\n end\n\n [format_from_name.to_sym]\n end", "def mime_types\n {image: ['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif', 'image/tiff'],\n pdf: ['application/pdf', 'application/x-pdf'],\n audio: ['audio/mpeg', 'audio/mp4', 'audio/x-aiff', 'audio/ogg', 'audio/vorbis', 'audio/vnd.wav'],\n video: ['video/mp4', 'video/quicktime', 'video/x-msvideo', 'video/x-ms-wmv']}\n end", "def file_format\n options[:file_format] || Config.file_format\n end", "def get_report_formats(opts = {})\n data, _status_code, _headers = get_report_formats_with_http_info(opts)\n data\n end", "def mime_types\n [].tap do |result|\n @parts.each do |part|\n result << part.content_type\n end\n end\n end", "def get_all_formats(iDirection)\n if (@DataAsText != nil)\n return [ DataObjectSelection.getDataFormat, Wx::DF_TEXT ]\n else\n return [ DataObjectSelection.getDataFormat ]\n end\n end", "def mime_types\n config[:mime_types]\n end", "def software_mm_comp_file_types\n %w[b f g i]\n end", "def provides(*formats)\n generate_type_hash = Proc.new{ |header| \n type, *params = header.split(/;\\s*/)\n Hash[*params.map{|p| p.split(/\\s*=\\s*/)}.flatten].merge(\"type\" => type)\n }\n supported_formats = formats.map do |f| \n # selects the correct mime type if a symbol is given\n f.is_a?(Symbol) ? ::Rack::Mime::MIME_TYPES[\".#{f.to_s}\"] : f\n end.compact.map do |f|\n generate_type_hash.call(f)\n end\n # request.accept is an Array\n accepted_formats = request.accept.map do |f| \n generate_type_hash.call(f)\n end\n selected_format = nil\n accepted_formats.each{ |accepted_format| \n selected_format = supported_formats.detect{ |supported_format| \n Regexp.new(Regexp.escape(accepted_format[\"type\"]).gsub(\"\\\\*\", \".*?\"), Regexp::IGNORECASE) =~ supported_format[\"type\"] &&\n (accepted_format[\"level\"] || INFINITY).to_f >= (supported_format[\"level\"] || 0).to_f\n }\n break unless selected_format.nil?\n } \n if selected_format.nil?\n content_type :txt\n halt 406, supported_formats.map{|f| \n output = f[\"type\"]\n output.concat(\";level=#{f[\"level\"]}\") if f.has_key?(\"level\")\n output\n }.join(\",\")\n else\n response.headers['Content-Type'] = \"#{selected_format[\"type\"]}#{selected_format[\"level\"].nil? ? \"\" : \";level=#{selected_format[\"level\"]}\"}\"\n end\n end", "def supported_extensions\n\t\treturn self.supported_extension_oids.collect {|oid| EXTENSION_NAMES[oid] || oid }\n\tend", "def formats_list(opts = {})\n data, _status_code, _headers = formats_list_with_http_info(opts)\n data\n end", "def file_types\n env_config['file_types'] || raise('environment problem:environment information not loaded')\n end", "def convert_exts\n if Rails.configuration.convertDocs.empty?\n []\n else\n Rails.configuration.convertDocs.split(\"|\")\n end\n end", "def formats=(extensions); end", "def paths\n Hash[ (formats + self.class::VERSION_FORMATS.keys).map{ |f| [f, path(f)] } ]\n end", "def readDirectoryFiles(directory,formats)\n files=[]\n Dir.chdir(directory){\n for i in 0...formats.length\n Dir.glob(formats[i]){|f| files.push(f) }\n end\n }\n return files\nend", "def preferred_file_format\n ''\n end", "def valid_types(record)\n Array(record.supported_mime_types)\n rescue NoMethodError\n Array.new\n end", "def file_glob\n if file_types.nil?\n '*'\n else\n \"*{#{file_types.join(',')}}\"\n end\n end", "def mime_types(type)\n mime_types = {\n yaml: \"application/x-yaml\",\n json: \"application/json\"\n }\n mime_types[type.to_sym]\n end", "def vips_formats\n @vips_formats ||= `vips -l`\n .split('/n')\n .select { |line| line.include? 'ForeignSave' }\n .flat_map { |line| line.scan(/\\.[a-z]{1,5}/) }\n .map { |format| format.strip.delete_prefix('.') }\n .uniq\n end", "def get_files(params)\n files = []\n params.each do |param|\n \tp = param.split(\":\")\n \tnext if p.first != \"file\"\n \traise TypeError, Ajaila::Messager.warning(\"Sorry, but extension of #{p[1]} is not supported\") if SUPPORTED_INPUTS.include?(p[1].split(\".\")[1].downcase) == false\n files << p[1] if p[0] == \"file\"\n end\n raise TypeError, Ajaila::Messager.warning(\"No file included. Add: \\\"file:file_name.csv\\\"\") if files == []\n return files\n end", "def format\n @format ||= (\n if read\n fmt = self.class.supported_formats.find{ |fm| fm.match?(path, read) }\n raise IOError, \"Version file matches no known format.\"\n else\n PlainFormat\n end\n )\n end", "def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end", "def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end", "def is_supported_format\n if zip? || csv?\n true\n else\n errors.add(:input, :unsupported_file_format)\n end\n end", "def type_for(filename, platform = false)\n types = Array(filename).flat_map { |fn|\n @extension_index[File.basename(fn.chomp.downcase).gsub(/.*\\./o, '')]\n }.compact.sort { |a, b| a.priority_compare(b) }.uniq\n\n if platform\n MIME.deprecated(self, __method__,\n \"using the platform parameter\")\n types.select(&:platform?)\n else\n types\n end\n end", "def audio_formats\n @descriptive_detail.audio_formats\n end", "def version_formats\n self.class::VERSION_FORMATS\n end", "def format_from_mimetype(mimetype) #:nodoc:\n AllowedFormats.each { |k, v| return k if mimetype.include?(v) }\n end", "def format_from_mimetype(mimetype)\n return nil if mimetype.nil?\n AllowedFormats.each { |k, v| return v if mimetype.include?(k) }\n end", "def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end", "def mime_types\n @mime_types ||=\n request_files.transform_values do |file|\n file.hasMimeType || 'application/octet-stream'\n end\n end", "def detect_format\n # @templates contains Array of Hashes. Example:\n # [{name: \"\"blog-web-prod.json\", block: ...},\n # {name: \"\"api-web-prod.json\", block: ...}]\n formats = @templates.map{ |t| File.extname(t[:name]) }.uniq\n if formats.size > 1\n puts \"ERROR: Detected multiple formats: #{formats.join(\", \")}\".colorize(:red)\n puts \"All the source values in the template blocks in the config folder must have the same format extension.\"\n exit 1\n else\n found_format = formats.first\n if found_format\n detected_format = found_format.sub(/^\\./,'')\n detected_format = \"yaml\" if detected_format == \"yml\"\n else # empty templates, no templates defined yet\n detected_format = \"yaml\" # defaults to yaml\n end\n end\n detected_format\n end", "def provided_formats\n @target.class_provided_formats\n end", "def program_formats_list(program, ability)\n image_formats = program.send(\"#{ability}_image_formats\").sort_by{ |p| p.name }\n title = ability.titleize + ' ' + plural_title(\"Format\", image_formats)\n render_program_row(title, formats_str(image_formats)) if image_formats.count > 0\n end", "def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end", "def possible_exts_for(wish)\n pr = provides\n return unless engine = pr[\"#{wish}_handler\"]\n View.exts_of(engine).map{|e_ext|\n [[*wish].map{|w_ext| /#{w_ext}\\.#{e_ext}$/ }, /#{e_ext}$/]\n }.flatten\n end", "def list_supported_assets(opts = {})\n data, _status_code, _headers = list_supported_assets_with_http_info(opts)\n data\n end", "def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty? || preservation_file&.original_filename&.first&.downcase&.include?(\".wav\")\n end", "def content_type_allowlist\n Rails.configuration.x.file_upload_content_type_allowlist.split(/\\s*,\\s*/)\n end", "def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end", "def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end", "def imgTypes()\n return [\"gif\", \"jpg\", \"jpeg\", \"png\"]\n end", "def navigational_formats\n @navigational_formats ||= Devise.navigational_formats.select { |format| Mime::EXTENSION_LOOKUP[format.to_s] }\n end", "def unsupported_format?\n case @format\n when *UNSUPPORTED_FORMATS then true\n else false\n end\n end", "def extensions\n []\n end", "def extensions\n []\n end", "def image_types\n [\"image/jpeg\", \"image/png\", \"image/jpg\", \"image/gif\", \"image/tif\"]\n end", "def image_types\n [\"image/jpeg\", \"image/png\", \"image/jpg\", \"image/gif\", \"image/tif\"]\n end", "def media_types\n return @media_types\n end", "def type_for(filename, platform = false)\n ext = filename.chomp.downcase.gsub(/.*\\./o, '')\n list = @extension_index[ext]\n list.delete_if { |e| not e.platform? } if platform\n list\n end", "def formats\n attributes.fetch(:formats)\n end", "def extensions\n @extensions ||= Dir[File.join(@ext_dir, '*')]\n end", "def extension_allowlist\n [\"xlsx\", \"csv\"]\n end", "def extensions\n TYPE_EXTS[type] || []\n end", "def options_for_supported_types\n Mapping::SUPPORTED_TYPES.map do |type|\n [type.titleize.to_s, type]\n end\n end", "def list_files\n fail('Requires implementation')\n end", "def formats\n providers.keys\n end", "def get_all_mediatype_files\n puts \"Searching for files in #{directory_tree}\"\n # Rewrote to use absolute search paths because FakeFS chokes on Dir.chdir\n matching_files = []\n @extensions.each do |ex|\n search_for = File.join(directory_tree, \"**\", '*' + ex) # example: \"/home/xavier/Tech/Docs/**/*.pdf\"\n matching_files.concat(Dir.glob(search_for))\n end\n #puts \"Found these files: \" + matching_files.to_s\n convert_to_pathnames(matching_files).delete_if { |file| file.dirname.to_s == mediatype_dirname.to_s }\n end", "def formats\n TEXT_FORMATS\n end", "def formats\n format\n end", "def wp_get_mime_types\n # Filters the list of mime types and file extensions.\n apply_filters(\n 'mime_types',\n {\n # Image formats.\n 'jpg|jpeg|jpe': 'image/jpeg',\n 'gif': 'image/gif',\n 'png': 'image/png',\n 'bmp': 'image/bmp',\n 'tiff|tif': 'image/tiff',\n 'ico': 'image/x-icon',\n # Video formats.\n 'asf|asx': 'video/x-ms-asf',\n 'wmv': 'video/x-ms-wmv',\n 'wmx': 'video/x-ms-wmx',\n 'wm': 'video/x-ms-wm',\n 'avi': 'video/avi',\n 'divx': 'video/divx',\n 'flv': 'video/x-flv',\n 'mov|qt': 'video/quicktime',\n 'mpeg|mpg|mpe': 'video/mpeg',\n 'mp4|m4v': 'video/mp4',\n 'ogv': 'video/ogg',\n 'webm': 'video/webm',\n 'mkv': 'video/x-matroska',\n '3gp|3gpp': 'video/3gpp', # Can also be audio\n '3g2|3gp2': 'video/3gpp2', # Can also be audio\n # Text formats.\n 'txt|asc|c|cc|h|srt': 'text/plain',\n 'csv': 'text/csv',\n 'tsv': 'text/tab-separated-values',\n 'ics': 'text/calendar',\n 'rtx': 'text/richtext',\n 'css': 'text/css',\n 'htm|html': 'text/html',\n 'vtt': 'text/vtt',\n 'dfxp': 'application/ttaf+xml',\n # Audio formats.\n 'mp3|m4a|m4b': 'audio/mpeg',\n 'aac': 'audio/aac',\n 'ra|ram': 'audio/x-realaudio',\n 'wav': 'audio/wav',\n 'ogg|oga': 'audio/ogg',\n 'flac': 'audio/flac',\n 'mid|midi': 'audio/midi',\n 'wma': 'audio/x-ms-wma',\n 'wax': 'audio/x-ms-wax',\n 'mka': 'audio/x-matroska',\n # Misc application formats.\n 'rtf': 'application/rtf',\n 'js': 'application/javascript',\n 'pdf': 'application/pdf',\n 'swf': 'application/x-shockwave-flash',\n 'class': 'application/java',\n 'tar': 'application/x-tar',\n 'zip': 'application/zip',\n 'gz|gzip': 'application/x-gzip',\n 'rar': 'application/rar',\n '7z': 'application/x-7z-compressed',\n 'exe': 'application/x-msdownload',\n 'psd': 'application/octet-stream',\n 'xcf': 'application/octet-stream',\n # MS Office formats.\n 'doc': 'application/msword',\n 'pot|pps|ppt': 'application/vnd.ms-powerpoint',\n 'wri': 'application/vnd.ms-write',\n 'xla|xls|xlt|xlw': 'application/vnd.ms-excel',\n 'mdb': 'application/vnd.ms-access',\n 'mpp': 'application/vnd.ms-project',\n 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'docm': 'application/vnd.ms-word.document.macroEnabled.12',\n 'dotx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',\n 'dotm': 'application/vnd.ms-word.template.macroEnabled.12',\n 'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'xlsm': 'application/vnd.ms-excel.sheet.macroEnabled.12',\n 'xlsb': 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',\n 'xltx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',\n 'xltm': 'application/vnd.ms-excel.template.macroEnabled.12',\n 'xlam': 'application/vnd.ms-excel.addin.macroEnabled.12',\n 'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'pptm': 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',\n 'ppsx': 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',\n 'ppsm': 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',\n 'potx': 'application/vnd.openxmlformats-officedocument.presentationml.template',\n 'potm': 'application/vnd.ms-powerpoint.template.macroEnabled.12',\n 'ppam': 'application/vnd.ms-powerpoint.addin.macroEnabled.12',\n 'sldx': 'application/vnd.openxmlformats-officedocument.presentationml.slide',\n 'sldm': 'application/vnd.ms-powerpoint.slide.macroEnabled.12',\n 'onetoc|onetoc2|onetmp|onepkg': 'application/onenote',\n 'oxps': 'application/oxps',\n 'xps': 'application/vnd.ms-xpsdocument',\n # OpenOffice formats.\n 'odt': 'application/vnd.oasis.opendocument.text',\n 'odp': 'application/vnd.oasis.opendocument.presentation',\n 'ods': 'application/vnd.oasis.opendocument.spreadsheet',\n 'odg': 'application/vnd.oasis.opendocument.graphics',\n 'odc': 'application/vnd.oasis.opendocument.chart',\n 'odb': 'application/vnd.oasis.opendocument.database',\n 'odf': 'application/vnd.oasis.opendocument.formula',\n # WordPerfect formats.\n 'wp|wpd': 'application/wordperfect',\n # iWork formats.\n 'key': 'application/vnd.apple.keynote',\n 'numbers': 'application/vnd.apple.numbers',\n 'pages': 'application/vnd.apple.pages',\n }\n )\n end", "def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end", "def get_mime_type_from_ext(extension)\n extension[0]=''\n types = [\n { :ext => \"txt\", :mime_type => \"text/plain\" },\n { :ext => \"ini\", :mime_type => \"text/plain\" },\n { :ext => \"sln\", :mime_type => \"text/plain\" },\n { :ext => \"cs\", :mime_type => \"text/plain\" },\n { :ext => \"js\", :mime_type => \"text/plain\" },\n { :ext => \"config\", :mime_type => \"text/plain\" },\n { :ext => \"vb\", :mime_type => \"text/plain\" },\n { :ext => :\"jpg\", :mime_type => \"image/jpeg\" },\n { :ext => \"jpeg\", :mime_type => \"image/jpeg\" },\n { :ext => \"bmp\", :mime_type => \"image/bmp\" },\n { :ext => \"csv\", :mime_type => \"text/csv\" },\n { :ext => \"doc\", :mime_type => \"application/msword\" },\n { :ext => \"docx\", :mime_type => \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" },\n { :ext => \"gif\", :mime_type => \"image/gif\" },\n { :ext => \"html\", :mime_type => \"text/html\" },\n { :ext => \"pdf\", :mime_type => \"application/pdf\" },\n { :ext => \"png\", :mime_type => \"image/png\" },\n { :ext => \"ppt\", :mime_type => \"application/vnd.ms-powerpoint\" },\n { :ext => \"pptx\", :mime_type => \"application/vnd.openxmlformats-officedocument.presentationml.presentation\" },\n { :ext => \"xls\", :mime_type => \"application/vnd.ms-excel\" },\n { :ext => \"xlsx\", :mime_type => \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" },\n { :ext => \"xml\", :mime_type => \"application/xml\" },\n { :ext => \"zip\", :mime_type => \"application/x-zip-compressed\" },\n { :ext => \"wav\", :mime_type => \"audio/wav\" },\n { :ext => \"eml\", :mime_type => \"message/rfc822\" },\n { :ext => \"mp3\", :mime_type => \"audio/mpeg\" },\n { :ext => \"mp4\", :mime_type => \"video/mp4\" },\n { :ext => \"mov\", :mime_type => \"video/quicktime\" }\n ]\n mime = types.find {|x| x[:ext] == extension}\n\n unless mime.nil? || mime.empty?\n \"application/octet-stream\"\n end\n mime[:mime_type]\n end", "def get_allowed_mime_types(user = nil)\n t = wp_get_mime_types\n t.delete(:swf)\n t.delete(:exe)\n # TODO implement:\n # if ( function_exists( 'current_user_can' ) )\n # unfiltered = user ? user_can( user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' )\n # end\n # if unfiltered.blank?\n # t.delete(:'htm|html')\n # t.delete(:js)\n # end\n\n # Filters list of allowed mime types and file extensions.\n apply_filters('upload_mimes', t, user)\n end", "def extension_white_list\n Ckeditor.attachment_file_types\n end", "def extension_white_list\n Ckeditor.attachment_file_types\n end", "def file_by_type_preference(*types)\n return nil if types.size == 0\n types.each {|type| return file_by_type type if has_type type}\n nil\n end", "def getlist\r\n result = SUPPORTED_LANG_LIST\r\n end" ]
[ "0.78444517", "0.78438896", "0.76918375", "0.7190886", "0.7004789", "0.6818506", "0.67250556", "0.6519861", "0.6485713", "0.6476558", "0.6431124", "0.63256305", "0.6300773", "0.62428296", "0.6236999", "0.62342894", "0.6222733", "0.61798805", "0.61551636", "0.61292005", "0.6124474", "0.6100782", "0.6096486", "0.60612124", "0.6039513", "0.60065323", "0.59977007", "0.5997161", "0.5983351", "0.5982965", "0.59731525", "0.59382993", "0.5915673", "0.5903174", "0.5864163", "0.5862758", "0.5813961", "0.5806827", "0.5771152", "0.57526267", "0.5747161", "0.57452154", "0.5743797", "0.5737859", "0.5727349", "0.5725692", "0.5721373", "0.5721309", "0.5707194", "0.5687878", "0.56788737", "0.56753355", "0.5672414", "0.56717604", "0.56684434", "0.5667701", "0.56614", "0.56251436", "0.56233203", "0.56099516", "0.5604584", "0.5600962", "0.5600405", "0.559208", "0.5555453", "0.5542937", "0.554267", "0.5534558", "0.5533585", "0.5530229", "0.5529467", "0.5516164", "0.5516164", "0.551511", "0.5509921", "0.5507142", "0.55027604", "0.55027604", "0.54957867", "0.54957867", "0.5487512", "0.54872084", "0.5479515", "0.54778385", "0.54590213", "0.54564476", "0.54533494", "0.54471445", "0.54393595", "0.54350436", "0.54336095", "0.5433109", "0.54323995", "0.542723", "0.54227924", "0.5413268", "0.5403504", "0.5403504", "0.5393688", "0.5376918" ]
0.7956081
0
Gets device data from backend service and updates its color and ALS state. Params: +info+:: +DeviceInfo+ object. +state+:: +DeviceState+ object which will be updated with data from backend. Returns true if devState has been changed, false otherwise.
def getDeviceState(info, state) res = apiGet("devices/#{info.deviceId}") succeed = false if res.status == 200 response = nil begin response = JSON.parse(res.body) rescue Exception => e $LOG.warn("Invalid body received! Err: #{e.message}") end if !response.nil? and response.include?("als_enabled") and response.include?("color_hue") and response.include?("color_saturation") and response.include?("color_value") succeed = true end end changed = false if succeed alsEnabled = response["als_enabled"] color = [response["color_hue"].to_f, response["color_saturation"].to_f, response["color_value"].to_f] if alsEnabled != state._alsEnabled or color != state.color state._alsEnabled = alsEnabled state.color = color changed = true end else $LOG.warn("Failed to get device state from backend! Status: #{res.status}, Response: #{res.body}") end changed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update?\n state == STATE_UPDATE\n end", "def postReadings(info, state)\r\n params = {\r\n :device_id => info.deviceId,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\",\r\n :value => state.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\",\r\n :value => state.humidity,\r\n :time => Time.now.to_i\r\n }\r\n ]\r\n }\r\n res = apiPostJson(\"readings\", params)\r\n if res.status != 201\r\n $LOG.warn(\"Failed to post readings to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def putDeviceInfo(info)\r\n params = {\r\n :software_version => info.swVersion,\r\n :serial_number => info.serialNb\r\n }\r\n res = apiPut(\"devices/#{info.deviceId}\", params)\r\n if res.status != 200\r\n $LOG.warn(\"Failed to put device info to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def updated?\n self.connected && self.updated\n end", "def state\n info[:state]\n end", "def change_device_state(host, device, state)\n raise MogileFS::ReadOnlyError if readonly?\n ! @backend.set_state(:host => host, :device => device, :state => state).nil?\n end", "def putColor(info, color)\r\n params = {\r\n :color_hue => color[0].to_s,\r\n :color_saturation => color[1].to_s,\r\n :color_value => color[2].to_s\r\n }\r\n res = apiPut(\"devices/#{info.deviceId}\", params)\r\n if res.status != 200\r\n $LOG.warn(\"Failed to put color to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def infos_update\n device_uid = @device.uid\n device_info_post = params.except(:controller, :action, :uid, :tk)\n\n device_info_post.each do |key, value|\n device_info = DeviceInfo.where(device_uid: device_uid, stat_name: key).take\n if (!device_info.nil?)\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n else\n device_info = DeviceInfo.new\n device_info.device_uid = device_uid\n device_info.stat_name = key\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n end\n end\n\n render plain: ActiveSupport::JSON.encode({ res: :ok })\n end", "def display_state(patientinfo)\n if patientinfo\n patientinfo.state\n end\n end", "def on?\n state[\"on\"]\n end", "def operational?\n state == 'operational'\n end", "def connection_in_info?\n info.respond_to?(:ood_connection_info)\n end", "def on?; self.refresh!['state']['on']; end", "def update_available?()\n update_info != \"\"\n end", "def call_needs_update(next_params, next_state)\n component = self\n next_params.define_singleton_method(:changed?) do\n component.props_changed?(self)\n end\n next_state.define_singleton_method(:changed?) do\n component.native_state_changed?(next_state)\n end\n needs_update?(next_params, next_state)\n end", "def state?\n usa?\n end", "def state_on_updateclient\n @log.debug(\"Net_state: change to state state_on_updateclient\")\n @network_state = :state_on_updateclient\n make_state_change_ntfy(:ntfy_state_onupdate)\n end", "def update!(**args)\n @device_states = args[:device_states] if args.key?(:device_states)\n end", "def update!(**args)\n @device_states = args[:device_states] if args.key?(:device_states)\n end", "def state()\n info[:state]\n end", "def device?\n type == :device\n end", "def state_changed?\n peek_state\n !@state_queue.empty?\n end", "def on_db_service_state(host, port, ostate)\n\tend", "def attributes_status_update\n if !params.has_key?(:da)\n render plain: ActiveSupport::JSON.encode({ msg: 'Device attributes missing', res: :err }) and return\n end\n\n device_attributes_post = params[:da]\n device_attributes_post.each do |key, device_attribute|\n dev_attr = @device.device_attributes.where(id: device_attribute[:id]).take\n if (!dev_attr.nil?)\n if device_attribute[:cur]\n dev_attr.current_value = device_attribute[:cur]\n end\n if device_attribute[:set] && (dev_attr.direction_c_id != DeviceAttribute::DIRECTIONS[:FEEDBACK_ONLY][:ID])\n dev_attr.set_value = device_attribute[:set]\n end\n dev_attr.save()\n else\n render plain: ActiveSupport::JSON.encode({ msg: 'Device attribute not exists', res: :err }) and return\n end\n end\n\n render plain: ActiveSupport::JSON.encode({ res: :ok })\n end", "def report_service_state(mod, addr, proto, port, state, context = nil)\n\t\t\n\t\t# TODO: use the current thread's Comm to find the host\n\t\tcomm = ''\n\t\thost = get_host(context, addr, comm)\n\t\tport = get_service(context, host, proto, port, state)\n\t\t\n\t\tostate = port.state\n\t\tport.state = state\n\t\tport.save\n\t\t\n\t\tif (ostate != state)\n\t\t\tframework.events.on_db_service_state(context, host, port, ostate)\n\t\tend\n\t\t\n\t\treturn port\n\tend", "def attached?\n\t\tCommon.device_status(@handle);\n end", "def update!(**args)\n @contact_active_state = args[:contact_active_state] if args.key?(:contact_active_state)\n end", "def update\n if @state.update(state_params)\n render json: @state\n # 'State was successfully updated.'\n else\n render json: @state.errors, status: :unprocessable_entity\n end\n end", "def on_db_service_state(context, host, port, ostate)\n\tend", "def update_color\n self.color.set(@battler.state_color) if @color_flash.alpha == 0\n # Note: @color_flash taken from my Basic Modules v1.5b (Clone image)\n end", "def sdk_update_status(instance)\n if raw_power_state != instance.status\n update!(:raw_power_state => instance.status) if raw_power_state != instance.status\n $ibm_cloud_log.info(\"VM instance #{instance.id} state is #{raw_power_state}\")\n end\n end", "def sdk_update_status(instance)\n if raw_power_state != instance.status\n update!(:raw_power_state => instance.status) if raw_power_state != instance.status\n $ibm_cloud_log.info(\"VM instance #{instance.id} state is #{raw_power_state}\")\n end\n end", "def pull_state\n if @physical_object\n @status = 200\n @ds = @physical_object.digital_statuses.order(\"updated_at DESC\").last\n unless @ds.nil?\n @success = true\n @message = @ds.decided\n else\n @success = false\n @message = \"Physical object #{@physical_object.mdpi_barcode} has 0 Digital Statuses...\"\n end\n end\n render template: 'responses/pull_state.xml.builder', layout: false, status: @status\n end", "def update\n @api_state = Api::State.find(params[:id])\n\n if @api_state.update(api_state_params)\n head :no_content\n else\n render json: @api_state.errors, status: :unprocessable_entity\n end\n end", "def update_controller_connection\n if @connected != Input.controller_connected?\n @connected = Input.controller_connected?\n @old_battery_state = Input.battery_level\n @option_window.refresh\n end\n if Input.battery_level != @old_battery_state\n @option_window.refresh\n @old_battery_state = Input.battery_level\n end\n end", "def state\n data[:state]\n end", "def online?\n get['state']['reachable']\n end", "def valid_component_op?(addr, user, password, http_resp, expected_state, pid, hc_params)\n # Check if POST request was successful\n if http_resp.code != '200'\n Chef::Log.error(\n \"OSGi component action ended with #{http_resp.code} code (expected 200) and #{http_resp.body} body\"\n )\n return false\n end\n\n max_checks = 4\n\n # Call API again to check component state\n max_checks.times do |i|\n info = component_get(addr, user, password, pid)\n Chef::Log.debug(\n \"[#{i + 1}/#{max_checks}] Current component info: #{info}\"\n )\n\n return true if info['state'] == expected_state\n\n sleep hc_params['sleep_time']\n\n Chef::Log.error(\n \"Expected #{expected_state} state, but got #{info['state']} after #{max_checks} checks\"\n ) if i == max_checks - 1\n end\n\n false\n end", "def is_online?\n devices.select{|d| d.online == true }.any?\n end", "def update!(**args)\n @is_on_device_smart_home_supported = args[:is_on_device_smart_home_supported] if args.key?(:is_on_device_smart_home_supported)\n end", "def update?\n update_indicator.eql?('U')\n end", "def native_state_changed?(next_state_hash)\n # next_state = next_state_hash.to_n\n # %x{\n # var current_state = #{@__hyperstack_component_native}.state\n # var normalized_next_state =\n # !next_state || Object.keys(next_state).length === 0 ? false : next_state\n # var normalized_current_state =\n # !current_state || Object.keys(current_state).length === 0 ? false : current_state\n # if (!normalized_current_state != !normalized_next_state) return(true)\n # if (!normalized_current_state && !normalized_next_state) return(false)\n # if (!normalized_current_state['***_state_updated_at-***'] &&\n # !normalized_next_state['***_state_updated_at-***']) return(false)\n # if (!normalized_current_state['***_state_updated_at-***'] ||\n # !normalized_next_state['***_state_updated_at-***']) return(true)\n # return (normalized_current_state['***_state_updated_at-***'] !=\n # normalized_next_state['***_state_updated_at-***'])\n # }\n state_hash = Hash.new(`#{@__hyperstack_component_native}.state`)\n next_state_hash != state_hash\n end", "def update_status!\n status = :online\n\n if !is_port_open?(@address, @port)\n status = :offline\n end\n\n if status != @status\n time = Time.now\n if status == :offline\n puts \"Server is currently offline\"\n else\n puts \"Server is currently online\"\n end\n\n @status = status\n if @status == :online\n @last_status_change = @last_launch\n else\n @last_status_change = time\n end\n end\n end", "def checkDeviceStatus\n \n @user = User.find(:first, :conditions => [\"username = ? \", session[:username]]) \n @onlinelist = {}\n sql = \"SELECT devices.*, users.username from devices, users WHERE devices.user_id = users.id AND users.id = #{@user.id.to_s} ORDER BY devices.dev_name\"\n @results = Device.find_by_sql(sql)\n #@results = Device.find(:all, :conditions => [\"user_id = ?\", @user.id])\n @results.each do |dev|\n status = \"offline\"\n #puts \"#{dev.last_seen.to_s} #{device_online_timeout.to_s}\"\n if dev.last_seen > device_online_timeout\n @onlinelist.merge!(dev.id => true)\n else\n @onlinelist.merge!({dev.id => false})\n end\n end\n \n if @results and not @results.empty?\n render :update do |page|\n page['device_list'].replace_html :partial => 'devicelist' \n end\n else\n return\n end\n end", "def device_states_list\n get \"deviceStates\"\n end", "def update_status(type, state)\n if [:auth, :api, :router, :broker].include?(type)\n case state\n when :connected\n if @agent.mode == :http\n # Require connectivity to both API and router to be considered fully connected\n status = @agent.client.status\n if status[:api] == :connected && status[:router] == :connected\n RightScale::Sender.instance.disable_offline_mode\n end\n else\n RightScale::Sender.instance.disable_offline_mode\n end\n when :disconnected\n RightScale::Sender.instance.enable_offline_mode\n when :failed\n RightScale::Log.error(\"RightNet connectivity failure for #{type}, need to re-enroll\")\n # Randomize when re-enroll to prevent possibly having multiple instances do so simultaneously\n EM.add_timer(rand(MAX_REENROLL_DELAY)) { RightScale::ReenrollManager.reenroll! }\n when :authorized, :unauthorized, :expired, :closing\n else\n RightScale::Log.error(\"Unrecognized state for #{type}: #{state}\")\n end\n end\n true\n end", "def status\n # If the data is over 10 seconds old, refresh it\n @mutex.synchronize do\n if !@last_update or (Time.now.to_i - @last_update.to_i > 10)\n update_status\n @last_update = Time.now\n end\n end\n @status\n end", "def connected?\n @status == :connected\n end", "def update(data, **opts)\n @response = data\n @resource_state = data['resource_state']\n self\n end", "def update\n respond_to do |format|\n if @host_state.update(host_state_params)\n format.html { redirect_to @host_state, notice: 'Host state was successfully updated.' }\n format.json { render :show, status: :ok, location: @host_state }\n else\n format.html { render :edit }\n format.json { render json: @host_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def info?\n !success?\n end", "def updated?\n\t\t\t@config.is_a? Hash\n\t\tend", "def changed?\n @observer_state\n end", "def update_device_types_info_with_http_info(dtid, device_type_info, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.update_device_types_info ...\"\n end\n # verify the required parameter 'dtid' is set\n fail ArgumentError, \"Missing the required parameter 'dtid' when calling DevicesManagementApi.update_device_types_info\" if dtid.nil?\n # verify the required parameter 'device_type_info' is set\n fail ArgumentError, \"Missing the required parameter 'device_type_info' when calling DevicesManagementApi.update_device_types_info\" if device_type_info.nil?\n # resource path\n local_var_path = \"/devicemgmt/devicetypes/{dtid}\".sub('{format}','json').sub('{' + 'dtid' + '}', dtid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(device_type_info)\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DeviceTypesInfoEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#update_device_types_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def device_states_get(device_name)\n get \"deviceStates/#{device_name}\"\n end", "def update_info_visibility\n compact = @compact_mode == :enabled\n @info_compact.visible = compact\n @info_wide.visible = !compact\n @bag_sprite.index = @socket_index\n @bag_sprite.visible = compact\n end", "def state\n domain_info[:state]\n end", "def state\n domain_info[:state]\n end", "def state?(state)\n @_state == state\n end", "def setStatusInfo(name, value)\n @device.setStatusInfo(name,value) ;\n end", "def update_accounting_vendor_access_config_is_active_by_id_with_http_info(id, is_active, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountingApi.update_accounting_vendor_access_config_is_active_by_id ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling AccountingApi.update_accounting_vendor_access_config_is_active_by_id\"\n end\n # verify the required parameter 'is_active' is set\n if @api_client.config.client_side_validation && is_active.nil?\n fail ArgumentError, \"Missing the required parameter 'is_active' when calling AccountingApi.update_accounting_vendor_access_config_is_active_by_id\"\n end\n # resource path\n local_var_path = '/accounting/vendor/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'is_active'] = is_active\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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 = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'VendorAccessConfigVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountingApi#update_accounting_vendor_access_config_is_active_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def state?(state)\n @state == state\n end", "def update?\n event == 'update'\n end", "def update\n find_detail\n \n @device.attributes = params[:device]\n @device_type=DeviceType.find_by_name(params[:device][:device_type]).table\n @device_detail.attributes = params[@device_type]\n unless [@device, @device_detail].map(&:valid?).include?(false)\n @device.update_attributes!(params[:device])\n @device_detail.update_attributes!(params[@device_type])\n flash[:notice] = '设备参数修改成功!'\n redirect_to(@device)\n else\n @provider=Provider.find(:all)\n render :action => \"edit\"\n end\n end", "def update?\n @update\n end", "def check_color\n state = read_state\n return state[:color] != COLOR_OFF\n end", "def update\n thing_name = params[:id]\n is_on = params[:on].to_i\n client = Broker::Wrapper.new(current_user, thing_name)\n result = client.set_state(is_on)\n\n result_hash = result.as_json\n render json: result_hash, status: 200\n end", "def connected?\n @state == :connected\n end", "def update\n return false if storage.empty?\n\n Vedeu.log(\"Interface in focus: '#{current}'\")\n\n refresh\n\n current\n end", "def connected?\n status == CONNECTED\n end", "def is_dev?\n @dev\n end", "def update!(**args)\n @is_bluetooth_connected_profile_required = args[:is_bluetooth_connected_profile_required] if args.key?(:is_bluetooth_connected_profile_required)\n end", "def update\n respond_to do |format|\n if @api_v1_user_device_info.update(api_v1_user_device_info_params)\n format.html { redirect_to @api_v1_user_device_info, notice: 'User device info was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_device_info }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_device_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def changed?\n if defined? @observer_state and @observer_state\n true\n else\n false\n end\n end", "def index\n @devices = current_user.devices.all\n\n # init device status\n if @devices.first.present? && @devices.first.status.blank?\n @devices.each do |d|\n d.get_status\n d.save\n end\n end\n end", "def updated?\n command.success?\n end", "def reachable?\n state[\"reachable\"]\n end", "def state\n status[\"state\"]\n end", "def update_item_state(item_id, state)\n !send_pairwise_request(\"items/#{item_id}/#{state ? 'activate' : 'suspend'}\", nil, 'Get').nil?\n end", "def app_state(app_id)\n @bridge.app_state(app_id)\n end", "def app_state(app_id)\n @bridge.app_state(app_id)\n end", "def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { render :show, status: :ok, location: @device }\n else\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "def state\r\n\t\t\t`#{BITS::BITSADMIN} /getstate {#{@id}}`\r\n\t\tend", "def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end", "def edit_security_monitoring_signal_state_with_http_info(signal_id, body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.edit_security_monitoring_signal_state ...'\n end\n # verify the required parameter 'signal_id' is set\n if @api_client.config.client_side_validation && signal_id.nil?\n fail ArgumentError, \"Missing the required parameter 'signal_id' when calling SecurityMonitoringAPI.edit_security_monitoring_signal_state\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling SecurityMonitoringAPI.edit_security_monitoring_signal_state\"\n end\n # resource path\n local_var_path = '/api/v1/security_analytics/signals/{signal_id}/state'.sub('{signal_id}', CGI.escape(signal_id.to_s).gsub('%2F', '/'))\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[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SuccessfulSignalUpdateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :edit_security_monitoring_signal_state,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SecurityMonitoringAPI#edit_security_monitoring_signal_state\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def device_states=(value)\n @device_states = value\n end", "def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end", "def get_state\n @client.get_state\n end", "def update_device_types_info(dtid, device_type_info, opts = {})\n data, _status_code, _headers = update_device_types_info_with_http_info(dtid, device_type_info, opts)\n return data\n end", "def get_state\n send_request(FUNCTION_GET_STATE, [], '', 2, '? ?')\n end", "def update\n return unless info = read_meminfo\n @ram_total = convert_to_bytes(info[MEM_TOTAL])\n @ram_free = convert_to_bytes(info[MEM_FREE])\n @ram_available = convert_to_bytes(info[MEM_AVAILABLE])\n @ram_buffers = convert_to_bytes(info[BUFFERS])\n @ram_cached = convert_to_bytes(info[CACHED])\n @swap_total = convert_to_bytes(info[SWAP_TOTAL])\n @swap_free = convert_to_bytes(info[SWAP_FREE])\n end", "def state_active?(state)\n @states[state][1]\n end", "def connect\n\t\t@state = STATE_ONLINE\n\t\treturn true\n\tend", "def check_new_credentials(state, context)\n put(:sync, @lock_data)\n validate_new_credentials(state, context)\n send_auth(@user_device)\n get(:show, id: @lock.id)\n validate_new_credentials(state, context)\n end", "def active?\n status == STATUS[:active]\n end", "def active?\n self.internal_object['status'] == 'Active'\n end", "def status(args={}) # {{{\n if args[:force_refresh] == true\n instance = Instance.find(self.id)\n @data.merge! :instanceState => instance.status\n end\n\n @data[:instanceState].flatten.delete_if{|v| v.is_a? Symbol}\n end", "def status\n Skype.send_ :command => \"get call #{@call_id} status\"\n end", "def active?\n\t\t\tstate == 'active'\n\t\tend", "def update_status\n find_detail\n #如果更改状态的时间比数据库中该设备最后更改的时间还早的话,说明日期有错误\n last_record=StatusChange.find_by_device_id(@device.id,:order=>\"status_change_time DESC\")\n\n if last_record.blank?\n max_date=Date.parse(\"1970-1-1\") \n pro_status = \"\"\n else \n max_date=last_record.status_change_time\n pro_status = last_record.status\n end\n\n if Date.parse(params[:status_change][:status_change_time])>max_date\n if params[:status_change][:status]==\"维修\" && pro_status!=\"故障\"\n flash[:notice] = '有故障的设备才能维修!'\n redirect_to :action=>:change_status\n else\n params[:device][:status] = params[:status_change][:status]\n @device.attributes = params[:device]\n\n @status_change = StatusChange.new(params[:status_change])\n @status_change.device_id = @device.id\n @status_change.service_provider = @device.service_provider\n @status_change.department = @device.department\n\n unless [@device, @status_change].map(&:valid?).include?(false)\n @device.update_attributes(params[:device])\n @status_change.save\n flash[:notice] = '新设备状态已经修改成功!'\n redirect_to :id=>@device, :action=>\"show_status_change\"\n else\n render :action => \"change_status\"\n end\n end\n else\n flash[:notice] = '日期错误!'\n redirect_to :action=>:change_status\n \n end\n end" ]
[ "0.51228786", "0.4943882", "0.4931239", "0.49310255", "0.4870755", "0.47812158", "0.47313583", "0.46843687", "0.46770492", "0.4640897", "0.46286714", "0.46241808", "0.46197292", "0.4594584", "0.45819145", "0.45283353", "0.45273665", "0.4526295", "0.4526295", "0.45201463", "0.4476966", "0.44616562", "0.44498014", "0.44407952", "0.44349727", "0.44291726", "0.4414079", "0.44123164", "0.43947843", "0.43891025", "0.4386981", "0.4386981", "0.43841", "0.4364039", "0.43535915", "0.43517864", "0.43313044", "0.43307492", "0.4321419", "0.4315701", "0.4314223", "0.4299569", "0.42949665", "0.42816648", "0.42727077", "0.42725557", "0.42722335", "0.42712826", "0.42711207", "0.42698964", "0.4268154", "0.4258963", "0.42585596", "0.42536765", "0.42531812", "0.42441368", "0.4239978", "0.4239978", "0.4228652", "0.42281404", "0.42186978", "0.42182025", "0.42102724", "0.42092285", "0.42074266", "0.42041573", "0.4202683", "0.4200177", "0.41978708", "0.41975605", "0.41832373", "0.41829997", "0.4172775", "0.4154184", "0.41532063", "0.4152651", "0.41432703", "0.41429672", "0.41374955", "0.41354433", "0.41354433", "0.41333228", "0.41329998", "0.4132744", "0.4130929", "0.4128656", "0.41280615", "0.4127032", "0.41237473", "0.4118449", "0.41112918", "0.4108713", "0.4108025", "0.41034734", "0.40993285", "0.40983808", "0.40961358", "0.40933844", "0.40922904", "0.40908554" ]
0.8010385
0
Send device SW version and serial number to backend service. Params: +info+:: +DeviceInfo+ object.
def putDeviceInfo(info) params = { :software_version => info.swVersion, :serial_number => info.serialNb } res = apiPut("devices/#{info.deviceId}", params) if res.status != 200 $LOG.warn("Failed to put device info to backend! Status: #{res.status}, Response: #{res.body}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendInfo(devInfo)\r\n msg = {\r\n :type => \"info\",\r\n :version => devInfo.swVersion\r\n }\r\n sendMsg(msg)\r\n end", "def device_params\n params.require(:device).permit(:name, :sn, :model, :coordinate, :address, :floor, :power, :powerstatu, :repottime, :status, :imsi, :timestamp, :swver, :hwver)\n end", "def sendStreaming(devInfo, devState)\r\n msg = {\r\n :type => \"streaming\", \r\n :version => devInfo.swVersion,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\", \r\n :value => devState.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\", \r\n :value => devState.humidity, \r\n :time => Time.now.to_i\r\n }\r\n ] \r\n }\r\n sendMsg(msg)\r\n end", "def send(inc)\n @h.usb_control_msg(0x21, 0x09, 0x02, 0x01, (message_base << inc).bytes_to_string, 0)\n end", "def device_params\n params.require(:device).permit(:imei, :serial_num, :model_id)\n end", "def infos_update\n device_uid = @device.uid\n device_info_post = params.except(:controller, :action, :uid, :tk)\n\n device_info_post.each do |key, value|\n device_info = DeviceInfo.where(device_uid: device_uid, stat_name: key).take\n if (!device_info.nil?)\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n else\n device_info = DeviceInfo.new\n device_info.device_uid = device_uid\n device_info.stat_name = key\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n end\n end\n\n render plain: ActiveSupport::JSON.encode({ res: :ok })\n end", "def api_v1_user_device_info_params\n params.require(:api_v1_user_device_info).permit(:user_id, :os, :device_type, :device_model, :system_version, :app_version, :device_locale, :bundle_device)\n end", "def device_params\n params.require(:device).permit(:name, :long_name, :carrier, :os, :version)\n end", "def info_params\n params.require(:info).permit(:message_type, :timestamp, :received_at, :app_id, :playcelet_id)\n end", "def update(value)\n @serial_port.puts value\n end", "def device_params\n params.require(:device).permit(:name, :emei, :cost_price, :car_id, :device_model_id, :device_type_id, :sim_card_id)\n end", "def device_params\n params.require(:device).permit(:name, :control_mode, :hysteresis, :update_channel)\n end", "def admin_device_params\n params.require(:admin_device).permit(:serial)\n end", "def wifi_info\n send_message!(Protocol::Device::GetWifiInfo.new,\n wait_for: Protocol::Device::StateWifiInfo) do |payload|\n {\n signal: payload.signal, # This is in Milliwatts\n tx: payload.tx,\n rx: payload.rx\n }\n end\n end", "def device_create_params\n params.require(:device).permit(:name, :device_type_id, :primary_member_id, :os_version, :wifi_mac, :build_version, :product_name, :model_name, :mac_address)\n end", "def servdetail_params\n params.require(:servdetail).permit(:name, :cpu)\n end", "def software_serial(rx, tx, opts={})\n raise ArgumentError, \"can only define rx from Fixnum, got #{rx.class}\" unless rx.is_a?(Fixnum)\n raise ArgumentError, \"can only define tx from Fixnum, got #{tx.class}\" unless tx.is_a?(Fixnum)\n \n output_pin(tx)\n \n rate = opts[:rate] ? opts[:rate] : 9600\n \t\tif opts[:as]\n \t\t\t@declarations << \"SoftwareSerial _#{opts[ :as ]} = SoftwareSerial(#{rx}, #{tx});\"\n \t\t\taccessor = []\n \t\t\taccessor << \"SoftwareSerial& #{opts[ :as ]}() {\"\n \t\t\taccessor << \"\\treturn _#{opts[ :as ]};\"\n \t\t\taccessor << \"}\"\n \t\t\t@@swser_inc ||= FALSE\n \t\t\tif (@@swser_inc == FALSE) # on second instance this stuff can't be repeated\n \t\t\t\t@@swser_inc = TRUE\n\t \t\t\taccessor << \"int read(SoftwareSerial& s) {\"\n \t\t\t\taccessor << \"\\treturn s.read();\"\n \t\t\t\taccessor << \"}\"\n \t\t\t\taccessor << \"void println( SoftwareSerial& s, char* str ) {\"\n \t\t\t\taccessor << \"\\treturn s.println( str );\"\n \t\t\t\taccessor << \"}\"\n \t\t\t\taccessor << \"void print( SoftwareSerial& s, char* str ) {\"\n \t\t\t\taccessor << \"\\treturn s.print( str );\"\n \t\t\t\taccessor << \"}\"\n \t\t\t\taccessor << \"void println( SoftwareSerial& s, int i ) {\"\n \t\t\t\taccessor << \"\\treturn s.println( i );\"\n \t\t\t\taccessor << \"}\"\n \t\t\t\taccessor << \"void print( SoftwareSerial& s, int i ) {\"\n \t\t\t\taccessor << \"\\treturn s.print( i );\"\n \t\t\t\taccessor << \"}\"\n \t\t\tend\n \t\t\t@accessors << accessor.join( \"\\n\" )\n \t\t\t\n \t\t\t@signatures << \"SoftwareSerial& #{opts[ :as ]}();\"\n \n \t\t\t@other_setup << \"_#{opts[ :as ]}.begin(#{rate});\"\n \t\tend\n \tend", "def add_new_version(version_info)\n version_name_input.type_text(version_info['name']) unless version_info['name'].nil?\n version_dialect_select.select(version_info['dialect']) unless version_info['dialect'].nil?\n version_note_input.type_text(version_info['notes']) unless version_info['notes'].nil?\n version_platform_select.select(version_info['platform']) unless version_info['platform'].nil?\n\n unless version_info['arch'].nil?\n version_info['platform'] == 'linux'? linux_version_arch_select.select(version_info['arch']) : version_arch_input.type_text(version_info['arch'])\n end\n\n version_ver_input.type_text(version_info['version number']) unless version_info['version number'].nil?\n version_install_command_input.type_text(version_info['install command']) unless version_info['install command'].nil?\n version_save_btn.click\n end", "def hardware_information\n super\n end", "def device_params\n params.require(:device).permit(:owner, :name, :device_type, :location, :public_ip, :private_ip, :device_note, :addons, :general_status, :general_reloaded, :osname, :osram, :osprocessor, :detail)\n end", "def device_params\n params.require(:device).permit(:user_id, :token, :app_id, :locale, :inactivated_at, :banner, :badge, :sound, :app_name, :app_version, :os_name, :os_version, :device_name, :device_version)\n end", "def boot_order_update(boot_info)\n convert = lambda {|device_str|\n spl = device_str.scan(/^(nic|disk)(\\d+$)/).flatten\n raise \"#{device_str} is not supported\" if spl.empty?\n\n device = nil\n sync = \"sync_#{spl[0]}s\"\n (0..1).each do |_i|\n device = send(spl[0], spl[1])\n break if device.exists?\n\n send(sync)\n end\n\n device.boot_dev\n }\n\n boot_order = boot_info.split(',').map {|str| convert.call(str) }\n\n RbVmomi::VIM.VirtualMachineBootOptions({ :bootOrder => boot_order })\n end", "def register_device(device_serial)\n register_form.device_serial_txt.set device_serial\n page.find('#btnSubmitForm', wait: 3).click\n has_act_code_txt?(wait: 10)\n end", "def system_info_view_params\n params.require(:system_info_view).permit(:name, :number, :os_info_id, :java_info_id, :ap_server_info_id)\n end", "def check_update_forclient(nomeprog, ver_prog)\n @log.debug(\"Controller: check_update_forclient\")\n net_prot_ver = [SUPP_SERV_VER_MAJ, SUPP_SERV_VER_MIN ]\n info_client = [nomeprog, ver_prog, net_prot_ver ]\n msg_details = YAML.dump(info_client)\n @log.debug \"update_req: #{info_client}\"\n cmd_to_send = build_cmd(:update_req, msg_details)\n send_data_to_server(cmd_to_send)\n @cup_gui.log_sometext(\"UPDATE: controlla se esiste una nuova versione\\n\")\n end", "def info=(info)\n if info.nil?\n fail ArgumentError, 'invalid value for \"info\", info cannot be nil.'\n end\n @info = info\n end", "def device_params\n params.permit([:name, :uuid, :token])\n end", "def system_information_params\n params.require(:system_information).permit(:access, :hdd_capacity, :lan, :monitor_type, :os_installed, :ram, :ram_type, :sw_details, :system_name)\n end", "def serial\n fetch('device.serial')\n end", "def info_swfs\n @queue << \"i sw\"\n end", "def update\n m = MonoMatrix::Switcher.new \"/dev/ttyAMA0\"\n m.switch params[:name], channel_params[:input].to_i\n head :no_content\n end", "def send_version\n from = \"#{@node.external_ip}:#{@node.config[:listen][1]}\"\n version = Bitcoin::Protocol::Version.new({\n :version => 70001,\n :last_block => @node.store.get_depth,\n :from => from,\n :to => @host,\n :user_agent => \"/bitcoin-ruby:#{Bitcoin::VERSION}/\",\n #:user_agent => \"/Satoshi:0.8.3/\",\n })\n send_data(version.to_pkt)\n log.debug { \"<< version: #{Bitcoin.network[:protocol_version]}\" }\n end", "def engine_params\n params.require(:engine).permit(:serial, :code, :brand, :model, :hp, :kw, :frame, :rpm, :hertz, :amperes, :sf, :back_r, :front_r, :mf, :part_c, :install_date, :volts, :system_id)\n end", "def distri_product_info_params\n params.require(:distri_product_info).permit(:product_name, :product_model,:product_price,:product_count,:should_get_money,:real_get_money)\n end", "def sw_dev_params\n params.require(:sw_dev).permit(:sw_dev_title, :copyright, :beneficiary, :objctive, :evidence, :sw_dev_type_id, :message_id)\n end", "def hardware_params\n params.require(:hardware).permit(:owner, :host, :os, :os_version, :install_date, :boot_time, :make, :model, :type, :processor, :physical_memory, :available_physical_memory, :serial_number, :issue_date, :return_date, :employee_id, :truck, :dock, :monitor, :disposed_date, :disposed_reason, :computer_name, :phone_number, :imei, :toner_ink, :device_type, :receive_date, :manufacture_year)\n end", "def update\n ethers, new_ethers = process_ethers(params[:asset])\n @asset = WirelessDevice.find(params[:id])\n asset_update(params[:asset], wireless_url, ethers, new_ethers)\n end", "def device_params\n params.require(:device_version).permit(:device_id, :version_id, :state)\n end", "def add_device(serial)\n res = @client.post(\"#{path}/devices\", nil, { serial: serial }, \"Content-Type\" => \"application/json\")\n\n ::M2X::Client::Device.new(@client, res.json) if res.success?\n end", "def dev_major() end", "def create\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.new(api_v1_user_device_info_params)\n\n respond_to do |format|\n if @api_v1_user_device_info.save\n format.html { redirect_to @api_v1_user_device_info, notice: 'User device info was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_device_info }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_device_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def device_params\n params.require(:device).permit(:latitude, :longitude, :serial, :status, :imei)\n end", "def firmware_upgrade(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Firmware Upgrade\" page.\n begin\n @ff.link(:text, 'Firmware Upgrade').click\n self.msg(rule_name, :info, 'Firmware Upgrade', 'Reached page \\'Firmware Upgrade\\'.')\n rescue\n self.msg(rule_name, :error, 'Firmware Upgrade', 'Did not reach \\'Firmware Upgrade\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') )then\n # Right,go on.\n else\n self.msg(rule_name,:error,'users','Some key NOT found.')\n return\n end\n \n # Begin parsing the json file.\n \n # \"Automatic check\"\n if info.has_key?('Automatic check') then\n \n case info['Automatic check']\n \n when 'Automatically Check for New Versions and Upgrade Wireless Broadband Router'\n \n @ff.select_list(:name,'wan_upgrade_type').select_value(\"1\")\n self.msg(rule_name,:info,'Automatic check',info['Automatic check'])\n \n # Fill in the check hours\n if info.has_key?('check hours') then\n @ff.text_field(:name,'check_interval').set(info['check hours'])\n self.msg(rule_name,:info,'check hours',info['check hours'])\n end\n \n # Fill in the URL\n if info.has_key?('URL') then\n @ff.text_field(:name,'check_url').set(info['URL'])\n self.msg(rule_name,:info,'URL',info['URL'])\n end \n \n when 'Automatically Check for New Versions and Notify via Email'\n \n @ff.select_list(:name,'wan_upgrade_type').select_value(\"2\")\n self.msg(rule_name,:info,'Automatic check',info['Automatic check'])\n \n # Fill in the check hours\n if info.has_key?('check hours') then\n @ff.text_field(:name,'check_interval').set(info['check hours'])\n self.msg(rule_name,:info,'check hours',info['check hours'])\n end\n \n # Fill in the URL\n if info.has_key?('URL') then\n @ff.text_field(:name,'check_url').set(info['URL'])\n self.msg(rule_name,:info,'URL',info['URL'])\n end \n \n when 'Automatic Check Disabled'\n \n @ff.select_list(:name,'wan_upgrade_type').select_value(\"3\")\n self.msg(rule_name,:info,'Automatic check',info['Automatic check'])\n \n # Fill in the check hours\n if info.has_key?('check hours') then\n @ff.text_field(:name,'check_interval').set(info['check hours'])\n self.msg(rule_name,:info,'check hours',info['check hours'])\n end\n \n # Fill in the URL\n if info.has_key?('URL') then\n @ff.text_field(:name,'check_url').set(info['URL'])\n self.msg(rule_name,:info,'URL',info['URL'])\n end \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'firmware_upgrade','Did not have the \\'Automatic check\\' option ')\n return\n \n end # end of case\n \n end # end of if\n \n # Apply for this change, then go to \"Check Now\"\n @ff.link(:text,'Apply').click\n#Tom add 2009.5.20 for output the upgrade from the internet \n#information \n if @ff.text.include? 'Attention' then\n\t@ff.link(:text,'Apply').click\n end\n sleep 5\n\n # Get to the \"Firmware Upgrade\" page.\n begin\n @ff.link(:text, 'Firmware Upgrade').click\n self.msg(rule_name, :info, 'Firmware Upgrade', 'Reached page \\'Firmware Upgrade\\'.')\n rescue\n self.msg(rule_name, :error, 'Firmware Upgrade', 'Did not reach \\'Firmware Upgrade\\' page')\n return\n end \n \n # \"Check Now\"\n if info.has_key?('Check Now') then\n \n case info['Check Now']\n \n when 'on'\n \n # Check now\n @ff.link(:text,'Check Now').click \n self.msg(rule_name,:info,'Check Now','Done!')\n\tsleep 10\n\t@ff.refresh\n#Tom add 2009.5.20 for output the upgrade from the internet \n#information \n\tsTable = false\n\t@ff.tables.each do |t|\n\t if ( t.text.include? 'Status' and \n\t\t( not t.text.include? 'Upgrade From the Internet') and\n\t\t#( not t.text.include? 'Check Now') and\n\t\tt.row_count >= 1 ) then\n\t\t sTable = t\n\t\t break\n\t end\n\tend\n\tif sTable == false then\n # Wrong here\n\t self.msg(rule_name,:error,'Upgrade Chenck Now','Did NOT find the target table.')\n\telse\n\t sTable.each do |row|\n\t\tif row.text.include? 'Status' then\n\t\t self.msg(rule_name,:info,'Status',row[1]);\n\t\tend\n\t end\n\tend\n\n\tsTable = false\n\t@ff.tables.each do |t|\n\t if ( t.text.include? 'Internet Version' and \n\t\t( not t.text.include? 'Upgrade From the Internet') and\n\t\t#( not t.text.include? 'Check Now') and\n\t\tt.row_count >= 1 ) then\n\t\t sTable = t\n\t\t break\n\t end\n\tend\n\tif sTable == false then\n # Wrong here\n\t self.msg(rule_name,:error,'Upgrade Chenck Now','Did NOT find the target table.')\n\telse\n\t sTable.each do |row|\n\t\tif row.text.include? 'Internet Version' then\n\t\t self.msg(rule_name,:info,'Internet Version',row[1]);\n\t\tend\n\t end\n\tend\n\n when 'off'\n \n # Don't check now\n # Do nothing.\n self.msg(rule_name,:info,'Check Now','NOT Done!')\n \n else\n \n # Wrong here.\n self.msg(rule_name,:error,'firmware_upgrade','No such \\'Check Now\\' option.')\n return\n \n end # end of case \n \n end # end of if\n \n # \"Force Upgrade\"\n if info.has_key?('Force Upgrade') then\n \n case info['Force Upgrade']\n \n when 'on'\n \n#Tom add 2009.5.20 for output the upgrade from the internet \n#information \n\tsTable = false\n\t@ff.tables.each do |t|\n\t if ( t.text.include? 'Status' and \n\t\t( not t.text.include? 'Upgrade From the Internet') and\n\t\t#( not t.text.include? 'Check Now') and\n\t\tt.row_count >= 1 ) then\n\t\t sTable = t\n\t\t break\n\t end\n\tend\n\tif sTable == false then\n # Wrong here\n\t self.msg(rule_name,:error,'Upgrade Chenck Now','Did NOT find the target table.')\n\telse\n\t sTable.each do |row|\n\t\tif row.text.include? 'Status' then\n\t\t self.msg(rule_name,:info,'Status',row[1]);\n\t\tend\n\t end\n\tend\n\n\tsTable = false\n\t@ff.tables.each do |t|\n\t if ( t.text.include? 'Internet Version' and \n\t\t( not t.text.include? 'Upgrade From the Internet') and\n\t\t#( not t.text.include? 'Check Now') and\n\t\tt.row_count >= 1 ) then\n\t\t sTable = t\n\t\t break\n\t end\n\tend\n\tif sTable == false then\n # Wrong here\n\t self.msg(rule_name,:error,'Upgrade Chenck Now','Did NOT find the target table.')\n\telse\n\t sTable.each do |row|\n\t\tif row.text.include? 'Internet Version' then\n\t\t self.msg(rule_name,:info,'Internet Version',row[1]);\n\t\tend\n\t end\n\tend\n\t@ff.link(:text,'Force Upgrade').click \n self.msg(rule_name,:info,'Force Upgrade','Done!')\n\tsleep 10\n\n \n when 'off'\n \n # Don't check now\n # Do nothing.\n self.msg(rule_name,:info,'Force Upgrade','NOT Done!')\n \n else\n \n # Wrong here.\n self.msg(rule_name,:error,'firmware_upgrade','No such \\'Force Upgrade\\' option.')\n return\n \n end # end of case \n \n end # end of if \n \n # Read firmware location\n if info.has_key?('Firmware Location') then\n strLot = info['Firmware Location']\n self.msg(rule_name,:info,'Firmware Location',info['Firmware Location'])\n else\n self.msg(rule_name,:info,'Firmware Location','NOT Done')\n end\n \n # \"Upgrade Now\"\n if info.has_key?('Upgrade Now') then\n \n case info['Upgrade Now']\n \n when 'on'\n \n # Check now\n firmware_upgrade_manual(rule_name,info,strLot)\n self.msg(rule_name,:info,'Check now by manual','Done')\n \n when 'off'\n \n # Don't check now\n # Do nothing.\n self.msg(rule_name,:info,'Check now by manual','NOT Done')\n \n else\n \n # Wrong here.\n self.msg(rule_name,:error,'firmware_upgrade','No such \\'Upgrade Now\\' option.')\n return\n \n end # end of case \n \n end # end of if \n \n end", "def update_device_switch_port(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'serial' => options['serial'],\r\n 'number' => options['number']\r\n )\r\n # Prepare query url.\r\n _path_url = '/devices/{serial}/switchPorts/{number}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'serial' => options['serial'],\r\n 'number' => options['number']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: options['update_device_switch_port'].to_json\r\n )\r\n CustomHeaderAuth.apply(_request)\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) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def serial_number; Common.serial_number(@handle); end", "def info_params\n params.require(:info).permit!\n end", "def update\n @device.update(device_params)\n head :no_content\n end", "def firmware_name\n \"Little Wire\"\n end", "def get_serial\n return serial if serial.present?\n\n serial = \\\n if platform =~ /^jingdong/\n \"#{Date.today.to_s.gsub('-','')}_001\"\n else\n \"#{Date.today.to_s.gsub('-','')}\"\n end\n\n self.update_attribute(:serial, serial)\n serial\n end", "def info=(value)\n @info = value\n end", "def device_params\n params.require(:device).permit(:tele, :pawprint, :name, :email, :secret_key )\n end", "def version_params\n params.require(:version).permit(:name, :code, :download, :description, :app_id, :force, :status)\n end", "def product_info\n params['productinfo']\n end", "def update_serial\n return if self.type != 'SOA'\n\n a = self.content.split(' ')\n\n # Last 4 digits of serial (serial update counter)\n i = a[2][6..-1].to_i\n\n # 201801 -> 201821\n t = Time.now.strftime('%Y%m').to_i + 20\n\n # Reset serial update counter if serial is on \"old\" format (e.g.\n # 2018010199)\n i = 0 if a[2][4..5].to_i <= 12\n\n # Increment serial update counter\n i += 1\n\n a[2] = t.to_s + \"%04d\" % i\n self.content = a.join(' ')\n end", "def system_information_params\n params.require(:system_information).permit(:ram_available, :checked_at)\n end", "def info(t)\n @socket << \"INFO #{t}\"\n end", "def save\n response = Togglehq::Request.new(\"/devices\", {\"device\" => {\"os\" => self.os, \"os_version\" => self.os_version, \"manufacturer\" => self.manufacturer, \"model\" => self.model}}).post!\n if response.status == 200\n self.persisted!\n json = JSON.parse(response.body)\n self.uuid = json[\"device\"][\"uuid\"]\n return true\n else\n raise \"unexpected error saving the device\"\n end\n end", "def switch_params\n params.require(:switch).permit(:name, :interval, :email, :uuid, :active, :sms)\n end", "def accediandevice_params\n params.require(:accediandevice).permit(:site_name, :name_device, :type_device)\n end", "def read_device_version()\n start_command('F83', false, @status_debug_msg)\n end", "def powerline_adapter_params\n params.require(:powerline_adapter).permit(:name, :price, :code, :brand, :brandmodel, :standards, :encryption, :ports, :led, :certifications, :powerlinespeeds, :connectiontype, :connectionspeeds, :kittype, :systemrequirements, :temperature, :humidity, :features, :dimensions, :weight, :other, :warranty)\n end", "def smartphone_params\n params.require(:smartphone).permit(:name, :price, :description, :sim, :ram, :colors, :storage, :os, :screen, :promo, :images, :listSmartphones)\n end", "def read_device_version()\n @ramps_arduino.execute_command('F83', false, @status_debug_msg)\n end", "def device_params\n params.permit(:macaddress, :nickname, :description, :user_id, :stolen, :secret_key, :format)\n end", "def get_device_info\n IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}\n $device += ' '\n IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}\n IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}\n return $device, $os_version\nend", "def info\n str_info = \"\"\n\n # CPU\n str_info << \"MODELNAME=\\\"\" << @cpuModel.to_s << \"\\\"\\n\"\n str_info << \"CPUSPEED=\" << @cpuMhz.to_s << \"\\n\"\n str_info << \"TOTALCPU=\" << @total_cpu.to_s << \"\\n\"\n str_info << \"USEDCPU=\" << @used_cpu.to_s << \"\\n\"\n str_info << \"FREECPU=\" << (@total_cpu - @used_cpu).to_s << \"\\n\"\n\n # Memory\n str_info << \"TOTALMEMORY=\" << @total_memory.to_s << \"\\n\"\n str_info << \"USEDMEMORY=\" << @used_memory.to_s << \"\\n\"\n str_info << \"FREEMEMORY=\" << (@total_memory - @used_memory).to_s << \"\\n\"\n\n # Networking\n str_info << \"NETRX=\" << @net_rx.to_s << \"\\n\"\n str_info << \"NETTX=\" << @net_tx.to_s << \"\\n\"\n\n # Datastores\n @free_ds_info.each{|k,v|\n used_space = v[:capacity].to_i - v[:free_space].to_i\n str_info << \"DS=[ID=\\\"#{k}\\\",USED_MB=#{used_space},\"\n str_info << \"TOTAL_MB=#{v[:capacity]},\"\n str_info << \"FREE_MB=#{v[:free_space]}]\\n\"\n }\n\n str_info.strip\n end", "def device_params\n params.require(:device).permit(:name, :beacon_id, :device_type)\n end", "def device_model_params\n params.require(:device_model).permit(:title, :device_brand_id, :device_type_id, :rack_units, :ethernet_interfaces, :fiber_interfaces)\n end", "def product_info\n params['productinfo']\n end", "def device_params\n params.permit(:name)\n end", "def saveDeviceCapabilitiesInfo (result)\n path = Pathname.new(File.dirname(__FILE__)).realpath\n time = Time.now.strftime(\"%F %H.%M\")\n name = \"#{time} Device_Info.txt\"\n file = File.new(\"#{path}/../../DataSave/DeviceInfo/#{name}\", \"a+\")\n\n file.puts \"===========================Device_Capabilitise_info=====================\"\n file.print \"Device GetCapabilities Support : \"\n result.each do |capName, capData|\n if capName.to_s != \"ipa\"\n file.print \"#{capName} \".capitalize\n end\n end\n file.puts\n file.puts \"=========================Device_Capabilitise_info_End===================\"\n\n file.close\nend", "def catalog_device_params\n params.require(:catalog_device).permit(:Name, :Stock_number, :Location, :Provider_who_maintains, :User_id, :Supplier_id, :Location_id)\n end", "def update!(**args)\n @device_contact_info = args[:device_contact_info] if args.key?(:device_contact_info)\n end", "def update_serial!\n update_serial\n save\n end", "def device_params\n params.require(:device).permit(:name)\n end", "def info\n @queue << \"info\"\n end", "def update\n find_detail\n \n @device.attributes = params[:device]\n @device_type=DeviceType.find_by_name(params[:device][:device_type]).table\n @device_detail.attributes = params[@device_type]\n unless [@device, @device_detail].map(&:valid?).include?(false)\n @device.update_attributes!(params[:device])\n @device_detail.update_attributes!(params[@device_type])\n flash[:notice] = '设备参数修改成功!'\n redirect_to(@device)\n else\n @provider=Provider.find(:all)\n render :action => \"edit\"\n end\n end", "def meter_params\n params.require(:meter).permit(:mid, :bluetooth_mac, :display_name, :model)\n end", "def add_device(serial)\n res = @client.post(\"#{path}/devices\", nil, { serial: serial }, \"Content-Type\" => \"application/json\")\n Device.new(@client, res.json) if res.success?\n end", "def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end", "def get_firmware_upgrade_details(sys_id)\n response = request(:get, \"/devmgr/v2/storage-systems/#{sys_id}/cfw-upgrade/\")\n response\n #status(response, 200, 'Failed to get firmware upgrade details')\n # if response.status == 422\n # fail(\"Error : #{response.body}\")\n # end\n # JSON.parse(response.body)\n end", "def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end", "def phone_app_params\n params.require(:phone_app).permit(:brand, :model, :details, :price)\n end", "def devices_params\n params.require(:device).permit(:phone_number, :carrier)\n end", "def samsung_params\n params.require(:samsung).permit(:services, :imei, :response_email, :text_alert, :user_id)\n end", "def device_params\n params.require(:device).permit(:name, :details, :category_id, :location, :status)\n end", "def vendor_params\n params.require(:vendor).permit(:name, :phone, :website, :city, :state, :country, :hours, :notes, :active)\n end", "def putColor(info, color)\r\n params = {\r\n :color_hue => color[0].to_s,\r\n :color_saturation => color[1].to_s,\r\n :color_value => color[2].to_s\r\n }\r\n res = apiPut(\"devices/#{info.deviceId}\", params)\r\n if res.status != 200\r\n $LOG.warn(\"Failed to put color to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def vehicle_info_params\n params.require(:vehicle_info).permit(:year, :make, :model, :registration_state, :color, :plate, :registration_id, :registration_expiration, :insurance_company, :insurance_company, :company_info_id)\n end", "def send_com(c,data = nil)\n com = [ 0xfe,0xfe,@radio_hex_id,0xe0 ]\n com << c\n if(data)\n data.each do |b|\n com << b\n end\n end\n com << 0xfd\n write_radio(com)\n unless read_response()\n err = \"Error: \"\n com.each do |b|\n err += sprintf(\"%02x \",b)\n end\n err += \"\\n\"\n debug_print err\n end # response error printing block\n end", "def serial; end", "def serial; end", "def firmware_params\n params.require(:firmware).permit(:number, :description, :publish_date)\n end", "def create\n @swyp_in = SwypIn.new(params[:swyp_in])\n @swyp_in.address = request.remote_ip\n @swyp_peer = @swyp_in.pair\n @swyp_in.developer = Developer.find_by_api_key(params[:api_key])\n \n if @swyp_in.save\n @swyp = @swyp_in\n render 'shared/status.json'\n else\n format.json { render json: @swyp_in.errors, status: :unprocessable_entity }\n end\n \n end", "def currentupdate_params\n params.require(:currentupdate).permit(:info)\n end", "def device_params\n params.require(:device).permit(:installation_id, :push_token)\n end", "def device\r\n logger.info(\"UserController::device:---#{params}\")\r\n end", "def update_firmware_driver_distributable_with_http_info(moid, firmware_driver_distributable, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FirmwareApi.update_firmware_driver_distributable ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling FirmwareApi.update_firmware_driver_distributable\"\n end\n # verify the required parameter 'firmware_driver_distributable' is set\n if @api_client.config.client_side_validation && firmware_driver_distributable.nil?\n fail ArgumentError, \"Missing the required parameter 'firmware_driver_distributable' when calling FirmwareApi.update_firmware_driver_distributable\"\n end\n # resource path\n local_var_path = '/api/v1/firmware/DriverDistributables/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(firmware_driver_distributable)\n\n # return_type\n return_type = opts[:debug_return_type] || 'FirmwareDriverDistributable'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"FirmwareApi.update_firmware_driver_distributable\",\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: FirmwareApi#update_firmware_driver_distributable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1-merchant', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end", "def router_firmware_params\n params.require(:router_firmware).permit(:router_model_id, :version, :checksum, :notes, :firmware)\n end" ]
[ "0.7553182", "0.57382566", "0.546619", "0.53908426", "0.5350636", "0.53383636", "0.5246511", "0.52329963", "0.5203288", "0.51399523", "0.5123751", "0.51146525", "0.510888", "0.50191617", "0.5002172", "0.49679103", "0.49671125", "0.49658668", "0.49487564", "0.4938252", "0.49311614", "0.49113917", "0.49030194", "0.48807672", "0.48693585", "0.48550817", "0.48471075", "0.4841443", "0.48228163", "0.48204443", "0.48080003", "0.48061508", "0.48031467", "0.47964585", "0.47939795", "0.4792415", "0.4783617", "0.47823417", "0.47795513", "0.4778727", "0.47774094", "0.47709766", "0.47700614", "0.47677207", "0.47627664", "0.47433534", "0.474116", "0.47320163", "0.47289792", "0.47288477", "0.47194", "0.47174495", "0.47165546", "0.47059375", "0.47045028", "0.4689239", "0.46797848", "0.46796566", "0.4679301", "0.46740982", "0.4670446", "0.46690986", "0.46687195", "0.46685636", "0.46681377", "0.46631587", "0.46585685", "0.4654628", "0.46508032", "0.46495813", "0.46470314", "0.46439582", "0.46308735", "0.46299523", "0.46268225", "0.46224055", "0.46140918", "0.46109986", "0.46097615", "0.4609364", "0.4607911", "0.46070576", "0.46040785", "0.45984536", "0.45952106", "0.4585103", "0.4582436", "0.45822203", "0.45794436", "0.45762008", "0.45717037", "0.45717037", "0.4570031", "0.45681202", "0.45659262", "0.45627728", "0.45616043", "0.4561381", "0.45594594", "0.45576665" ]
0.79654753
0
Send device color to backend service. Params: +info+:: +DeviceInfo+ object. +color+:: HSV collor array.
def putColor(info, color) params = { :color_hue => color[0].to_s, :color_saturation => color[1].to_s, :color_value => color[2].to_s } res = apiPut("devices/#{info.deviceId}", params) if res.status != 200 $LOG.warn("Failed to put color to backend! Status: #{res.status}, Response: #{res.body}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendUserColor(devInfo, color)\r\n msg = {\r\n :type => \"user-color\", \r\n :device_id => devInfo.deviceId,\r\n :user_color => {\r\n :hue => color[0],\r\n :saturation => color[1],\r\n :value => color[2]\r\n }\r\n }\r\n sendMsg(msg)\r\n end", "def color=(v)\n RestrictionValidator.validate :storage_color, COLORS.values, v\n @color = v\n end", "def color=(value)\n @color = value\n end", "def color=(value)\n @color = value\n end", "def write_pixel(pixel,rgb_color)\n rgb_vals = rgb_color.split(',')\n #Maximum value for these fields is 255, set it to 255 if a greater values is passed\n rgb_vals.map! {|value| [value.to_f, 255].min}\n #Set the standard update string Cp,r,g,b\n update_string = \"C#{pixel},#{rgb_vals.join ','}\"\n #Update the alamode pixels using the standard update string filled in with the pixel and rgb values.\n @serial_device.write update_string\n end", "def color=(color)\n set_color(color)\n generate_buffers\n end", "def update\n if @color.update(color_params)\n render json: @color, status: :ok#, location: @color\n else\n render json: @color.errors, status: :unprocessable_entity\n end\n end", "def set_app_color\n\t\t# update the color values with params of color\n\t\tif setting.update(type_app_color: params[:color])\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Color Successfully Updated.\",response: {color: setting.type_app_color.as_json }},:status=>200\n\t else\n\t render :json=> { success: false, message: setting.errors },:status=> 203\n\t end\t\t\n\tend", "def color (color=nil)\n if not color then\n @color\n else\n color = COLORS[color] if color.is_a? Symbol\n color = color.to_str\n if color[0] == ?# and color.length == 7\n color = color[1..-1].to_i(16)\n @color = color * (2**8) + 255\n else\n raise \"color must be a valid string in the format #RRGGBB\"\n end\n end\n end", "def color(color); end", "def color=(value)\n @color = value.nil? ? nil : value.to_s\n end", "def color\n @data[:color]\n end", "def _color=(value)\n\t\treturn if not value\n\t\tcolor = Color.where(:inki_model_name => self.class.to_s, :model_id => self.id).first\n\t\tif color\n\t\t\tcolor.update_attribute(:rgb_id, value)\n\t\telse\n\t\t\tColor.create(:inki_model_name => self.class.to_s, :model_id => self.id, :rgb_id => value)\n\t\tend\n\tend", "def colorupdate\n respond_to do |format|\n @location = params[:location]\n @index = params[:index].to_f\n @color = params[:color]\n @grid = Grid.find_by_location(@location)\n @newColorArray = @grid.colors\n @newColorArray[@index] = @color\n \n @grid.colors = @newColorArray\n @grid.save\n \n format.json {render json: @grid.colors, status: :ok, location: @grid}\n end\n end", "def color=(c)\n @color = Color.new(c)\n end", "def spray_paint(new_color)\n self.color = new_color\n end", "def color=(new_color)\n\t\t@color = new_color\n\tend", "def set_color\n @color = nil \n require 'rest-client'\n # admin irizREhyoG6Ejwr4AcjsQME9\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores/'+params[:id],\n headers: {Authorization: 'user vURjXbANsTEvaSf5vQ5GVg8h'})\n if response.code == 200\n # @color = JSON.parse(response.body).collect { |i| [i[\"name\"], i[\"id\"]] }\n @color = Color.new(JSON.parse(response.body))\n end\n end", "def set_color(color)\n @color = color\n end", "def spray_paint(color)\n self.color = color\n puts \"Your new #{color} paint job looks great!\"\n end", "def light(color_key)\n\t\tdata = LIGHT_MAP[color_key]\n\n\t\tdevice = USB.devices.find {|device| device.idVendor == VENDOR_ID && device.idProduct == PRODUCT_ID}\n\t\thandle = device.usb_open\n \thandle.usb_control_msg(0x21, 0x09, 0x0635, 0x000, \"\\x65\\x0C#{data}\\xFF\\x00\\x00\\x00\\x00\", 0)\n\n \thandle.usb_close\n \thandle = nil\n \t\n end", "def color\n @data['color']\n end", "def color(color)\n color_byte = COLORS.fetch(color, nil)\n\n fail ArgumentError, \"Invalid color #{color.inspect}: It must be one of #{COLORS.keys.inspect}\" if color_byte.nil?\n\n input_value(color_byte)\n end", "def update!(**args)\n @color = args[:color] if args.key?(:color)\n end", "def set_Color(value)\n set_input(\"Color\", value)\n end", "def colors=(col_arrays)\n col_arrays = col_arrays.map do |r,g,b|\n [ r < 0 ? 0 : (r > 255 ? 255 : r),\n g < 0 ? 0 : (g > 255 ? 255 : g),\n b < 0 ? 0 : (b > 255 ? 255 : b) ]\n end\n txt = col_arrays.map{|vals| \"#\" + vals.map{|y| \"%02X\" % y}.join(\"\")}.join(\" \")\n @wmiiconfig.write(\"/bar/#{@name}/colors\", txt)\n end", "def update_color\n self.color.set(@battler.state_color) if @color_flash.alpha == 0\n # Note: @color_flash taken from my Basic Modules v1.5b (Clone image)\n end", "def color(options)\n set RGhost::Color.create(options)\n end", "def color=(array)\n shader.set_float_uniform('color', array)\n return self\n end", "def colorized_info(message, color)\n unless @logdev.filename\n return info(\"\\e[#{color}m#{message}\\e[0m\")\n end\n info(message)\n end", "def set_color color\n unless COLORS.include? color\n raise \"Invalid color: #{color}\"\n end\n reset\n set_color_raw color\n end", "def set_custom_color idx, red, green, blue\n raise 'Invalid format' if [red, green, blue].find { |c| ! (0..255).include?(c) }\n\n @palette[idx] = [red, green, blue]\n end", "def admin_color_params\n params.require(:color).permit(:name, :code)\n end", "def puts_color( msg, color=nil )\n color_set( color ); puts msg; color_end\n end", "def setColor(color)\n\t\t@color = color\n\n\tend", "def register_color name, r, g, b, a = 255\n color[name] = screen.format.map_rgba r, g, b, a\n end", "def fill_color(color)\n end", "def set_color\n @color = Color.find params[:id]\n end", "def create\n @color = Admin::Color.new(color_params)\n\n if @color.save\n render json: @color, status: :created#, location: @color\n else\n render json: @color.errors, status: :unprocessable_entity\n end\n end", "def setDrawColorViaRGBObject(color)\n @drawColor = color\n end", "def color=(color)\n validator = EnumAttributeValidator.new('String', ['black', 'silver'])\n unless validator.valid?(color)\n fail ArgumentError, 'invalid value for \"color\", must be one of #{validator.allowable_values}.'\n end\n @color = color\n end", "def paint( color )\n self.update(color: color)\n end", "def colorize(key, color)\n op = {:operation => :colorize, :key => key, :color => color}\n add_operation op\n end", "def color=(color)\n each_with_index do |cell, index|\n cell.color = color.is_a?(Array) ? color[index] : color\n end\n end", "def put_colour_to(item, color)\n item.colorize(color: :\"#{color}\")\n end", "def update\n respond_to do |format|\n if @metal_color.update(metal_color_params)\n record_activity(@metal_color)\n format.html { redirect_to admin_metal_colors_path, notice: 'Цвет металла был успешно обновлен.' }\n format.json { render :show, status: :ok, location: @metal_color }\n else\n format.html { render :edit }\n format.json { render json: @metal_color.errors, status: :unprocessable_entity }\n end\n end\n end", "def print(color)\n puts \"Fetched at #{Time.now}\".colorize(:light_black)\n puts status.colorize(color)\n puts agency.colorize(color)\n puts location.colorize(color)\n end", "def color(*values); end", "def color(*values); end", "def set_color=(new_color)\n @@color = new_color\n end", "def update_profile_colors(colors)\n return unless colors.is_a?(Hash)\n post_data = {}\n \n colors.each_pair do |key, value|\n post_data.store(\"profile_#{key}\", value.gsub(/#/, ''))\n end\n \n post \"account/update_profile_colors\", :post => post_data\n end", "def color\n fetch('vehicle.colors')\n end", "def setColor(color_as_hex)\n led_color = LEDColor.new(color_as_hex)\n # Change the colors\n red_pin.pwm.duty_cycle = led_color.red\n green_pin.pwm.duty_cycle = led_color.green\n blue_pin.pwm.duty_cycle = led_color.blue\n\n puts \"[Color Change] rgb(#{red_pin.pwm.duty_cycle}, #{green_pin.pwm.duty_cycle}, #{blue_pin.pwm.duty_cycle})\"\n end", "def color_params\n params.require(:color).permit(:name)\n end", "def add_color\n if !color\n self.color = %w(\n #000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC\n #CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700\n #FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E\n #C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000\n #87CEEB #808080 #800080 #008B8B #006400\n ).sample\n end\n end", "def create\n @admin_color = Color.new(admin_color_params)\n\n respond_to do |format|\n if @admin_color.save\n format.html { redirect_to admin_colors_path, notice: 'Color was successfully created.' }\n format.json { render :show, status: :created, location: @admin_color }\n else\n format.html { render :new }\n format.json { render json: @admin_color.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def <<(color = nil)\n @data << color\n return if color.nil?\n unless @encoded_hexcodes.values.include?(color.to_s)\n @encoded_hexcodes[@encoded_hexcodes.length] = color.to_s\n @encoded_names[@encoded_names.length] = color.name \n @legend = @encoded_hexcodes.keys.map { |i| Hash[\"hexcode\": @encoded_hexcodes[i], \"name\": @encoded_names[i]] }\n end\n @manifest[color.name] = @data.count(color)\n end", "def add_color(colorname)\n @colors << colorname\n end", "def set_color\n self.color = [\"#7AD8E5\", \"#63b4d1\", \"6da7d3\", \"#7699d4\", \"#816ec4\", \"#8658bc\", \"#602278\", \"#34023C\"].sample\n end", "def color=(color) #SETTER\n @color = \"##{color.downcase}\"\n end", "def about\n @color = params[:color]\n end", "def color_id\n return nil unless colored?\n\n Tapyrus::Color::ColorIdentifier.parse_from_payload(chunks[0].pushed_data)\n end", "def update\n respond_to do |format|\n if @admin_color.update(admin_color_params)\n format.html { redirect_to admin_colors_path, notice: 'Color was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_color }\n else\n format.html { render :edit }\n format.json { render json: @admin_color.errors, status: :unprocessable_entity }\n end\n end\n end", "def color=(new_color) #<---- = sign means same as variable. means assignment.\n # writer method - assigns new value to that @instance variable\n @color = new_color\n end", "def create\n @metal_color = MetalColor.new(metal_color_params)\n\n respond_to do |format|\n if @metal_color.save\n record_activity(@metal_color)\n format.html { redirect_to admin_metal_colors_path, notice: 'Цвет металла был успешно добавлен.' }\n format.json { render :show, status: :created, location: @metal_color }\n else\n format.html { render :new }\n format.json { render json: @metal_color.errors, status: :unprocessable_entity }\n end\n end\n end", "def similar_color(param)\n r, g, b = case param\n when Array\n param\n when /#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/\n $~.values_at(1, 2, 3).map{|s| s.to_i(16)}\n else\n raise \"unknown parameter: #{param}\"\n end\n\n rgb(*ColorfulDays.similar_rgb(r, g, b))\n end", "def create\n @internalcolor = Internalcolor.new(params[:internalcolor])\n\n respond_to do |format|\n if @internalcolor.save\n format.html { redirect_to(@internalcolor, :notice => 'Internalcolor was successfully created.') }\n format.xml { render :xml => @internalcolor, :status => :created, :location => @internalcolor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @internalcolor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def color\n\t\t \t\t\t\"El color de tu vaca es #{@color}\"\n\t\t \t\tend", "def cprint (msg = \"\", color = \"\")\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # This little check will allow us to take a Constant defined color\n # As well as a [0-256] value if specified\n if (color.is_a?(String))\n debug_print \"Custom color specified for cprint\\n\"\n @output.write(color)\n elsif (color.between?(0, 256))\n debug_print \"No or Default color specified for cprint\\n\"\n @output.write(\"\\e[38;5;#{ color }m\")\n end\n\n @output.write(msg)\n end", "def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def color=(color)\n if !color.nil? && color.to_s.length > 20\n fail ArgumentError, 'invalid value for \"color\", the character length must be smaller than or equal to 20.'\n end\n\n @color = color\n end", "def update\n @grid.squares[params[:x]][params[:y]] = params[:color]\n\n render json: { status: \"OK\" }\n end", "def create\n @color = Color.new(params[:color])\n\n respond_to do |format|\n if @color.save\n format.html { redirect_to @color, notice: 'Color has been created.' }\n format.json { render json: @color, status: :created, location: @color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def color(*args)\n @instructions << Instruction.new(:color, args)\n self\n end", "def []=(coord, color)\n raise NoOutputAllowedError unless output_enabled?\n mapped_coord = encode_grid_coord(coord)\n return unless mapped_coord\n @next_grid[encode_grid_coord(coord)] = color\n end", "def setDrawColor(color)\n puts(\"draw color set to \" + color)\n @drawColor = color\n end", "def color\n filter << 'Color:Color'\n self\n end", "def spray_paint(new_color)\n self.color = new_color\n puts \"Your car is sprayed with a new #{new_color} paint.\"\n end", "def hex color\n Renderer.hex(color)\n end", "def color=(new_color)\n @color = new_color\nend", "def paint_job(new_color)\n @color = new_color\n puts \"The bike is now sporting the color #{@color}!\"\n end", "def text_color(param)\n begin \n colour = case param\n when Integer then super(param) rescue normal_color\n when Symbol then send(param) rescue normal_color\n when Array then Color.new(*param) rescue normal_color\n else\n normal_color\n end\n end\n colour.is_a?(Color) ? colour : normal_color\n end", "def colorChange(couleur)\n @color=couleur\n apply\n end", "def cprint (msg = \"\", color = \"\")\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # This little check will allow us to take a Constant defined color\n # As well as a [0-256] value if specified\n if (color.is_a?(String))\n debug_print \"Custom color specified for cprint\\n\"\n STDOUT.write(color)\n elsif (color.between?(0, 256))\n debug_print \"No or Default color specified for cprint\\n\"\n STDOUT.write(\"\\e[38;5;#{ color }m\")\n end\n\n STDOUT.write(msg)\n end", "def set_fps_color(color)\n @ingame_fps_text.load_color(color)\n @gpu_fps_text.load_color(color)\n @ruby_fps_text.load_color(color)\n end", "def color(red, green, blue)\n r = red << 4\n g = green << 5\n b = blue << 6\n send(RESET ^ (r | g | b))\n rescue\n end", "def colour(value)\n attributes[:colour] = value\n end", "def hex_color=(value)\n @hex_color = value\n end", "def color(str, color)\n interactive? ? interaction_highline.color(str, color) : str\n end", "def color(color)\n self.class.color_codes[color] + 30 if self.class.color_codes[color]\n end", "def color(color)\n self.class.color_codes[color] + 30 if self.class.color_codes[color]\n end", "def status(color)\n code = case color\n when 'green'\n 2\n when 'yellow'\n 1\n when 'red'\n 0\n end\n \"#{code} (#{color})\"\n end", "def tutu_color(color) \n\t\tp \"your tutu color has changed to #{color}\"\n\tend", "def set_draw_color_a(color = RFPDF::COLOR_PALETTE[:black])\n SetDrawColor(color[0], color[1], color[2])\n end", "def color(color, str)\n raise \"[BUG] Unrecognized color #{color}\" unless COLORS[color]\n\n # Almost any real Unix terminal will support color,\n # so we just filter for Windows terms (which don't set TERM)\n # and not-real terminals, which aren't ttys.\n return str if ENV[\"TERM\"].nil? || ENV[\"TERM\"].empty? || !STDOUT.tty?\n return \"\\e[#{COLORS[color]}m#{str}\\e[0m\"\n end", "def reform_color_params\n params.require(:reform_color).permit(:hex, :r, :g, :b)\n end", "def update_profile_colors(colors)\n post('/account/update_profile_colors.json', colors)\n end", "def encode_color color\n\t\tcase color.downcase\n\t\twhen 'red', 'r' then Mastermind::COLORS[:red]\n\t\twhen 'green', 'g' then Mastermind::COLORS[:green]\n\t\twhen 'yellow', 'y' then Mastermind::COLORS[:yellow]\n\t\twhen 'blue', 'b' then Mastermind::COLORS[:blue]\n\t\twhen 'magenta', 'm' then Mastermind::COLORS[:magenta]\n\t\twhen 'cyan', 'c' then Mastermind::COLORS[:cyan]\n\t\telse nil\n\t\tend\n\tend", "def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end" ]
[ "0.77770764", "0.60814154", "0.59698147", "0.59685755", "0.5828013", "0.58269525", "0.5738051", "0.573183", "0.5708938", "0.5617696", "0.5591413", "0.5582966", "0.5569477", "0.55513763", "0.5540315", "0.5514176", "0.55106395", "0.5499607", "0.5475196", "0.5474615", "0.5460296", "0.5456905", "0.5446675", "0.5429293", "0.5424986", "0.5418561", "0.53885907", "0.5347966", "0.533411", "0.532546", "0.53240705", "0.5322208", "0.53113097", "0.5292961", "0.5263138", "0.52563596", "0.5254394", "0.524471", "0.5244591", "0.52212876", "0.52207446", "0.52134323", "0.51993936", "0.5192432", "0.5183161", "0.51801234", "0.51739883", "0.5162721", "0.5162721", "0.5158196", "0.5141256", "0.5133011", "0.5130582", "0.5115301", "0.5113604", "0.5108954", "0.51023173", "0.5101931", "0.51007384", "0.5068563", "0.50508237", "0.50497216", "0.503633", "0.5035001", "0.50344783", "0.50327593", "0.5026265", "0.5020202", "0.5019102", "0.50173914", "0.50062877", "0.50044966", "0.49905288", "0.49845272", "0.4979402", "0.49736577", "0.49682784", "0.49675193", "0.49505752", "0.4944701", "0.4939628", "0.49287784", "0.49245343", "0.49233177", "0.49037895", "0.48908278", "0.48873362", "0.48852322", "0.4868435", "0.4864938", "0.48566133", "0.48566133", "0.4848661", "0.48440504", "0.48434216", "0.48400497", "0.48342705", "0.4833017", "0.48286787", "0.48267296" ]
0.8330073
0
Send device readings (temp. and humid.) to backend service. Params: +info+:: +DeviceInfo+ object. +state+:: +DeviceState+ object.
def postReadings(info, state) params = { :device_id => info.deviceId, :sensor_data => [ { :type => "Temperature", :value => state.temperature, :time => Time.now.to_i }, { :type => "Humidity", :value => state.humidity, :time => Time.now.to_i } ] } res = apiPostJson("readings", params) if res.status != 201 $LOG.warn("Failed to post readings to backend! Status: #{res.status}, Response: #{res.body}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendStreaming(devInfo, devState)\r\n msg = {\r\n :type => \"streaming\", \r\n :version => devInfo.swVersion,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\", \r\n :value => devState.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\", \r\n :value => devState.humidity, \r\n :time => Time.now.to_i\r\n }\r\n ] \r\n }\r\n sendMsg(msg)\r\n end", "def getDeviceState(info, state)\r\n res = apiGet(\"devices/#{info.deviceId}\")\r\n\r\n succeed = false\r\n \r\n if res.status == 200\r\n response = nil\r\n begin\r\n response = JSON.parse(res.body)\r\n rescue Exception => e \r\n $LOG.warn(\"Invalid body received! Err: #{e.message}\")\r\n end\r\n if !response.nil? and\r\n response.include?(\"als_enabled\") and\r\n response.include?(\"color_hue\") and\r\n response.include?(\"color_saturation\") and\r\n response.include?(\"color_value\")\r\n succeed = true\r\n end\r\n end\r\n changed = false\r\n if succeed\r\n alsEnabled = response[\"als_enabled\"]\r\n color = [response[\"color_hue\"].to_f, response[\"color_saturation\"].to_f, response[\"color_value\"].to_f] \r\n if alsEnabled != state._alsEnabled or color != state.color \r\n state._alsEnabled = alsEnabled\r\n state.color = color\r\n changed = true \r\n end\r\n else\r\n $LOG.warn(\"Failed to get device state from backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n changed\r\n end", "def sensorread\n @sensor = Sensor.find(params[:id])\n @snum = @sensor.number\n @stype = @sensor.sensor_type\n if @stype == \"DHT\"\n \n eval(\"$sensor#{@snum}temp\").read do |temperature|\n @stempread = \"#{temperature}\"\n end\n sleep 2\n eval(\"$sensor#{@snum}humidity\").read do |humidity|\n @shumidityread = \"#{humidity}\"\n end\n @sensor.last_reading = \"Temp:#{@stempread}C Humidity:#{@shumidityread}%\"\n @sensor.save\n end\n @sensors = Sensor.all\n respond_to do |format|\n format.js\n end\n end", "def forwardSensorValues\n logger.debug \"This is my params: \"+params[\"data\"][\"temperature\"].to_s\n logger.debug \"This is my params: \"+params[\"data\"][\"temperature\"].to_s\n rp = params[\"data\"][\"temperature\"].to_i + 1\n respond_to do |format|\n format.json {render :json => { :value => rp }.to_json}\n end\n if !@@sockets[params[\"serialPort\"]]\n create_socket(params[\"serialPort\"])\n end\n @@sockets[params[\"serialPort\"]].write(params[\"data\"].to_json)\n end", "def putDeviceInfo(info)\r\n params = {\r\n :software_version => info.swVersion,\r\n :serial_number => info.serialNb\r\n }\r\n res = apiPut(\"devices/#{info.deviceId}\", params)\r\n if res.status != 200\r\n $LOG.warn(\"Failed to put device info to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def report\n sensors = get_readings(:temperature, :oi_mode, :charging_source, :battery_charge, :battery_capacity, :current)\n sensors[:temperature][:text] = sensors[:temperature][:formatted].to_s + \" Celsius\"\n sensors[:battery_charge][:text] = sensors[:battery_charge][:formatted]\n sensors[:battery_capacity][:text] = sensors[:battery_capacity][:formatted]\n sensors[:current][:text] = sensors[:current][:formatted].to_s + \" mA\"\n\n sensors[:oi_mode][:text] = case sensors[:oi_mode][:formatted]\n when 0\n \"off\"\n when 1\n \"passive mode\"\n when 2\n \"safe mode\"\n when 3\n \"full mode\"\n end\n\n sensors[:charging_source][:text] = case sensors[:charging_source][:raw]\n when 1\n \"charging\"\n when 2\n \"docked\"\n when 3\n \"docked+\"\n else\n \"undocked\"\n end\n\n if sensors[:battery_charge][:text] == 0\n\n else\n @messages.push sensors\n end\n sensors\n end", "def take_reading\n reading = `sudo Adafruit_DHT 22 4`\n log reading\n data = reading.match(/Temp = (.*) \\*C, Hum = (.*)%/)\n temp = data[1].to_f rescue nil\n humidity = data[2].to_f rescue nil\n\n {\n :temperature => temp,\n :humidity => humidity,\n :raw => data\n }\n end", "def reading\n if request.post?\n @number = !@thermostat.readings.blank? ? @thermostat.readings.last.id + 1 : 0\n @reading = CreateReading.perform_async(@thermostat.id, params[:temperature], params[:humidity], params[:battery_charge], @number)\n if @reading\n render json: {status: \"success\", code: 200, reading_job_id: @reading, sequence_number: @number}\n else\n render json: {status: \"error\", code: 404, message: @reading.errors}\n end \n elsif request.get?\n @reading = Reading.find_by_id(params[:id]) \n @thermostat = @reading.thermostat if !@reading.blank?\n @thermostat = thermostate_in_sidekiq_queue(params[:id]) if @reading.blank?\n if @thermostat \n render json: {status: \"success\", code: 200, thermostat: @thermostat}\n else\n render json: {status: \"error\", code: 404, message: \"Can not find the reading\"}\n end \n end \n end", "def wifi_info\n send_message!(Protocol::Device::GetWifiInfo.new,\n wait_for: Protocol::Device::StateWifiInfo) do |payload|\n {\n signal: payload.signal, # This is in Milliwatts\n tx: payload.tx,\n rx: payload.rx\n }\n end\n end", "def power(status)\n #This is so that tdtool is not polled too much. Now only once per minute\n `tdtool -l > /tmp/tdtoollist.txt`\n #Lets go through all the SUTs\n $sut.each do |ip, sut|\n #Initialize HASH and save label of the device in it\n status[ip] = {}\n status[ip]['label'] = sut[:label]\n #Check the power status on the socket. Assuming that TDTOOLs data is updated.\n tdtool = `cat /tmp/tdtoollist.txt |grep -P '#{sut[:switch]}\\t'`\n tdtool = tdtool.split(\"\\t\")[2].to_s\n tdtool.gsub!(/\\s+/, '')\n #Lets give nice colours depending what the data is\n if tdtool == \"ON\"\n status[ip]['powercolor'] = \"color:green;\"\n elsif tdtool == \"OFF\"\n status[ip]['powercolor'] = \"color:orange;\"\n else\n #This is mainly for devices that do not have power socket installed yet, currently only ATP12\n tdtool = '???'\n status[ip]['powercolor'] = \"color:white;\"\n end\n status[ip]['power'] = tdtool\n #Lets pass the ip we got has to the ping function to determine whether the device is online or offline\n if up?(ip)\n #Save the gathered data, in this case ONLINE, to status HASH. Also give nice colours to the data.\n status[ip]['ping'] = \"ONLINE\"\n status[ip]['pingcolor'] = \"color:green;\"\n next\n else\n #Save the gathered data, in this case OFFLINE, to status HASH. Also give nice colours to the data.\n status[ip]['ping'] = \"OFFLINE\"\n status[ip]['pingcolor'] = \"color:white;\"\n next\n end\n end\nend", "def read_data\n @temperature = t\n @humidity = h\n [@temperature, @humidity]\n end", "def reading_params\n params.require(:reading).permit(:number, :temperature, :humidity, :battery_charge)\n end", "def reading_params\n\t\tparams.require(:reading).permit(:temperature, :id, :thermometer_id)\n\tend", "def infos_update\n device_uid = @device.uid\n device_info_post = params.except(:controller, :action, :uid, :tk)\n\n device_info_post.each do |key, value|\n device_info = DeviceInfo.where(device_uid: device_uid, stat_name: key).take\n if (!device_info.nil?)\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n else\n device_info = DeviceInfo.new\n device_info.device_uid = device_uid\n device_info.stat_name = key\n device_info.value = value\n device_info.last_update_at = Time.now.to_formatted_s(:db)\n device_info.save()\n end\n end\n\n render plain: ActiveSupport::JSON.encode({ res: :ok })\n end", "def read_data\n sensor_data = DhtSensor.read(@pin, @sensor_model)\n @temperature = sensor_data.temp\n @humidity = sensor_data.humidity\n [@temperature, @humidity]\n end", "def read\n status = fetch DHTLIB_DHT11_WAKEUP\n unless status == DHTLIB_OK\n @humidity = DHTLIB_INVALID_VALUE\n @temperature = DHTLIB_INVALID_VALUE\n return status\n end\n\n @humidity = @bits[0] + @bits[1] * 0.01\n\n @temperature = @bits[2] + @bits[3] * 0.1\n checksum = ((@bits[0] + @bits[1] + @bits[2] + @bits[3]) & 0xFF)\n p \"#{@bits[4]} == #{checksum}\"\n unless @bits[4] == checksum\n return DHTLIB_ERROR_CHECKSUM\n end\n DHTLIB_OK\n end", "def reading_params\n params.require(:reading ).permit(:sensor_id, :tank_id, :date)\n end", "def fetch_sensor_state\n \"#{entry_on}#{inside_on}#{exit_on}#{@beam_broken}\".to_i(2)\n end", "def update_monitor topic, name_value_pair, received_time\n name = name_value_pair[0]\n value = name_value_pair[1]\n device = Device.find_by(name: name)\n msg_type = \"\"\n\n if topic==\"/monitor/status\"\n msg_type = \"status\"\n if device\n device.update(status: value, status_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{value}=>#{received_time.to_s(:rfc822)}\"\n else\n new_device = Device.create(name: name, status: value, status_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{value}=>#{received_time.to_s(:rfc822)}\"\n end\n elsif topic==\"/board/temp\"\n msg_type = \"temperature\"\n if device\n device.temp_readings.create(value: value, unit: 'Celsius', received_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{BigDecimal(value)}=>#{received_time.to_s(:rfc822)}\"\n else\n new_device = Device.create(name: name)\n new_device.temp_readings.create(value: value, unit: 'Celsius', received_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{BigDecimal(value)}=>#{received_time.to_s(:rfc822)}\"\n end\n else\n Rails.logger.error \"Unable to match topic in MyMqtt\"\n end\n end", "def info(t)\n @socket << \"INFO #{t}\"\n end", "def tick\n input = read\n @adapter.receiving input unless input.nil?\n end", "def getReadings(sensor_type)\n\n @readings = Array.new\n\n @readings = DataReading.selectAllClientReadings(@client_id, sensor_type)\n\n\n\n end", "def temperature\n send_message!(Protocol::Light::GetTemperature.new,\n wait_for: Protocol::Light::StateTemperature) do |payload|\n payload.temperature / 100.0\n end\n end", "def show\n sensorType = params[:sensor_type]\n id = params[:id]\n since = params[:since]\n\n table = getSensorTable(sensorType)\n if table == nil\n # raise ActionController::RoutingError.new('Unrecognized Sensor')\n # TODO remove this once testing is done\n r = Random.new\n data = [{sensor_reading: (1 + r.rand(500)/100.0) ,\"timestamp\": Time.now}]\n else\n data = table.where([\"device_id = ? and timestamp > ?\", id, since]).select(\"timestamp, sensor_reading\")\n end\n\n respond_to do |format|\n format.json do\n render json: data\n end\n end\n end", "def send room = nil, device = nil, state = 'on', debug = false\n debug and ( p self.time 'send' )\n success = false\n debug and ( p 'Executing send on device: ' + device + ' in room: ' + room + ' with ' + ( state ? 'state ' + state : 'no state' ))\n\n\n # starting to optionally move some functionality out of here\n alternativeScript = self.get_config['pywaverf']\n if alternativeScript and File.exist?( alternativeScript )\n cmd = \"#{alternativeScript} \\\"#{room}\\\" \\\"#{device}\\\" \\\"#{state}\\\" \\\"#{debug}\\\"\"\n debug and ( p cmd )\n p `#{cmd}`\n debug and ( p self.time 'done python' )\n return\n end\n\n\n rooms = self.class.get_rooms self.get_config, debug\n debug and ( p self.time 'got rooms' )\n\n unless rooms[room] and state\n debug and ( p 'Missing room (' + room.to_s + ') or state (' + state.to_s + ')' );\n STDERR.puts self.usage( room );\n else\n # support for setting state for all devices in the room (recursive)\n if device == 'all'\n debug and ( p 'Processing all devices...' )\n rooms[room]['device'].each do | device_name, code |\n debug and ( p \"Device is: \" + device_name )\n self.send room, device_name, state, debug\n sleep 1\n end\n success = true\n # process single device\n elsif device and rooms[room]['device'][device]\n state = self.class.get_state state\n command = self.command rooms[room], device, state\n debug and ( p self.time 'command is ' + command )\n data = self.raw command\n debug and ( p self.time 'response is ' + data.to_s )\n success = true\n data = self.update_state room, device, state, debug\n else\n STDERR.puts self.usage( room );\n end\n end\n success\n end", "def read\n sensor = nil\n @data.each do |log_item|\n log_values = log_item.split\n if sensor_data?(log_values)\n sensor = create_sensor(log_values)\n else\n create_reading(log_values, sensor)\n end\n end\n end", "def update_state\n Thread.new do\n Dictionary.commands.each do |zone, _commands|\n Dictionary.commands[zone].each do |command, info|\n info[:values].each do |value, _|\n next unless value == 'QSTN'\n\n send_recv(Parser.parse(\"#{command}QSTN\"))\n end\n end\n end\n end\n end", "def sensor_params\n params.require(:sensor).permit(:name, :sensor_type, :pin, :number, :last_reading, :description)\n end", "def notify_readable\n logdebug \"notify_readable\", :state => @state\n case @state\n when :initialized\n attempt_connection\n when :ready_to_read\n attempt_read\n when :write_needs_to_read\n attempt_write\n end\n end", "def weather_report(location)\n\n # Fetch weather\n weatherboy = Weatherboy.new(location)\n w = weatherboy.current\n Mac::TTS.say(\"The current weather in Atherton is #{w.temp_f} degrees and #{w.weather}\", :victoria)\n sleep(0.5)\n\nend", "def update id, rssi, status, battery\n unless @sensors[id]\n @sensors[id] = Sensor.new(id)\n end\n @sensors[id].rssi = rssi\n @sensors[id].name = \"GSS_13M_??\"\n @sensors[id].group = \"GSS_13M\"\n @sensors[id].updated_time = Time.now\n @sensors[id].last_press_time = Time.now if status == 1\n @sensors[id].battery = battery\n end", "def sendInfo(devInfo)\r\n msg = {\r\n :type => \"info\",\r\n :version => devInfo.swVersion\r\n }\r\n sendMsg(msg)\r\n end", "def cycle()\n open(\"| #{SensorCommand}\",\"r\") {|comstrm|\n data = SensedData.new() ;\n data.scanOutput(comstrm, @count) ;\n p data.to_a ;\n @count += 1 ;\n }\n end", "def insertReading()\n\n #@reading_id = SecureRandom.uuid\n\n DataReading.insertReading(@client_id, @sensor_type, @value, @location, @timestamp)\n\n end", "def go!\n\n logger.info \"starting ds7505 compatible temperature logger\"\n\n i2c_device = \"/dev/i2c-1\" \n i2c_device_address = 0x4f\n ds75_device = I2C.create(i2c_device)\n \n polling_interval = 60 #seconds\n device_id = \"ds7505_4f\"\n\n logger.info \"ds7505 temerature plugin polling every #{polling_interval} second(s) on bus: #{i2c_device}, address: #{i2c_device_address}\"\n\n EventMachine.run {\n EventMachine.add_periodic_timer(polling_interval) {\n measured_temperature = ds75_device.read(i2c_device_address,2,0).unpack(\"s>\")[0]/256.0\n handle_new_measurement ({:timestamp => Time.now.to_i, :device_id => device_id, :type => \"Celcius\", :value => measured_temperature})\n }\n }\n end", "def sensor_reading_params\n\t\t\t\tparams.require(:sensor_reading).permit(:type, :value)\n\t\t\tend", "def create\n @sensor = Sensor.new(sensor_params)\n @snum = @sensor.number\n @spin = @sensor.pin\n @stype = @sensor.sensor_type\n if @stype == \"DHT\"\n eval(\"$sensor#{@snum}temp = Dino::Components::DHT::Temperature.new(pin: @spin, board: Gardino::Application.config.board)\")\n eval(\"$sensor#{@snum}humidity = Dino::Components::DHT::Humidity.new(pin: @spin, board: Gardino::Application.config.board)\")\n end\n respond_to do |format|\n if @sensor.save\n format.html { redirect_to @sensor, notice: 'Sensor was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sensor }\n else\n format.html { render action: 'new' }\n format.json { render json: @sensor.errors, status: :unprocessable_entity }\n end\n end\n end", "def dataReady(ntf)\n # Read the data in\n inData = ntf.userInfo.valueForKey(OSX::NSFileHandleNotificationDataItem)\n \n # Log how much data we're reading now and overall how much we've read\n @totalReadData = @totalReadData + inData.length\n puts \"dataReady: #{inData.length} bytes\"\n puts \"Total read data: #{@totalReadData} bytes\"\n \n # Send the data off to the UI\n if inData.length\n self.appendData(inData)\n end\n \n # If the task is running, start reading again\n if (@task)\n @pipe.fileHandleForReading.readInBackgroundAndNotify\n end\n end", "def get_direct_data(device_id)\n twin = @twin_manager.get_twin(device_id)\n # this code is only for start method calling on backend without client concerns\n # timeout = Time.iso8601(twin.properties.desired[:directDataTimeout])\n # if !timeout || (timeout - Time.utc).to_i.abs <= 5\n # start_direct_data(device_id)\n # twin.properties.desired[:directDataTimeout] = timeout + @options.direct_data_timeout\n # twin = @twin_manager.update_twin(twin)\n # end\n DirectData.create(twin)\n end", "def device_params\n params.require(:device).permit(:name, :sn, :model, :coordinate, :address, :floor, :power, :powerstatu, :repottime, :status, :imsi, :timestamp, :swver, :hwver)\n end", "def new\n\t @sensor = Sensor.find(params[:sensor_id])\n @reading = @sensor.readings.build\n\n# respond_to do |format|\n# format.html # new.html.erb\n# format.xml { render :xml => @reading }\n# end\n end", "def query\n process_switch(@oid) do |oid,value|\n case oid.to_str\n when @oid[0]; @txt_result += value.gsub(/;/,\"\\n\")\n \n when @oid[1]; @txt_result += \"Temperature Sensor 1 #{value.to_s} C \" + set_status(value.to_f, 60.0, 80.0) \n when @oid[2]; @txt_result += \"Temperature Sensor 2 #{value} C \" + set_status(value.to_f, 60.0, 80.0) \n when @oid[3]; @txt_result += \"Temperature Sensor 3 #{value} C Fan Ctl\\n\" #Fan Ctl, has no limits we care about\n when @oid[4]; @txt_result += \"Temperature Sensor 4 #{value} C Fan Ctl\\n\" #Fan Ctl, has no limits we care about\n when @oid[5]; @txt_result += \"Temperature Sensor 5 #{value} C Fan Ctl\\n\" #Fan Ctl, has no limits we care about\n when @oid[6]; @txt_result += \"Temperature Sensor 6 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[7]; @txt_result += \"Temperature Sensor 7 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[8]; @txt_result += \"Temperature Sensor 8 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[9]; @txt_result += \"Temperature Sensor 9 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[10]; @txt_result += \"Temperature Sensor 10 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[11]; @txt_result += \"Temperature Sensor 11 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n\n when @oid[12]; @txt_result += \"Fan 1 RPM #{value} \" + set_fan_status(value.to_i) #Not present in our switches\n when @oid[13]; @txt_result += \"Fan 2 RPM #{value} \" + set_fan_status(value.to_i) #Not present in our switches\n when @oid[14]; @txt_result += \"Fan 3 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[15]; @txt_result += \"Fan 4 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[16]; @txt_result += \"Fan 5 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[17]; @txt_result += \"Fan 6 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[18]; @txt_result += \"Fan 7 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[19]; @txt_result += \"Fan 8 RPM #{value} \" + set_fan_status(value.to_i) \n\n when @oid[20]; @txt_result += ( value == '0' ? \"PowerSupply1: Off\\n\" : (value == '1' ? \"PowerSupply1: On\\n\" : \"PowerSupply1: Missing\\n\") ); @status_as_int = 3 if value == '0'\n when @oid[21]; @txt_result += ( value == '0' ? \"PowerSupply2: Off\\n\" : (value == '1' ? \"PowerSupply2: On\\n\" : \"PowerSupply2: Missing\\n\") ); @status_as_int = 3 if value == '0'\n \n when @oid[22]; @txt_result += ( value == '1' ? \"Have Panic Dump in Flash\\n\" : \"\" ); @status_as_int = 2 if value == '1' && @status_as_int != 3\n else STDERR.puts \"Unknown OID '#{oid}' '#{value}'\"\n end\n end\n \n @status = calc_status\n end", "def show\n\t\t@sensor = Sensor.find(params[:sensor_id])\n @reading = Reading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reading }\n end\n end", "def write_state!(duration_s=0)\n raise ArgumentError, \"Duration #{duration_s}s too long\" if duration_s > 30\n data = [@state.to_s(16).rjust(6, '0')].pack('H*')\n @device.open_interface(0) do |handle|\n handle.control_transfer(bmRequestType: 0x40,\n bRequest: 0x06,\n wValue: 0x0100,\n wIndex: 0x00,\n dataOut: data)\n end\n sleep(duration_s)\n end", "def read_postition()\n @ramps_arduino.execute_command('F82', false, @status_debug_msg)\n end", "def read_raw_temperature\n i2cset(BMP085_CONTROL, BMP085_READTEMPCMD)\n sleep 0.005\n return i2cget(BMP085_TEMPDATA, 2).unpack('s>')[0]\n end", "def read_temperature\n begin\n temperature_array = []\n @notifier.watch(@filepath,:modify) do\n temperature_array = FasterCSV.read(@filepath) #TODO:read on the last line of the csv\n temperature = temperature_array.last[1].to_f\n patient_identifier= temperature_array.last[0]\n location = temperature_array.last[3]\n save_in_openmrs = false\n #TODO: Get/Set patient_identifier for this reading\n if temperature > 37.8 && temperature < 38.0\n puts \"/**********Saving Fever Temperature to OPD database********\"\n puts \"Temp=> #{temperature.to_s} AND Patient Identifier =>#{patient_identifier}\"\n save_in_openmrs = true\n elsif temperature > 38.0\n puts \"/**********Saving High Fever to OPD database***********\" #save in opd\n puts \"Temp=> #{temperature.to_s} AND Patient Identifier =>#{patient_identifier}\"\n save_in_openmrs = true\n else\n puts \"No Fever\"\n end\n\n if(save_in_openmrs)\n openmrs_save(location, temperature) #store the values in OpenMRS\n end\n\n temperature_record = TemperatureRecord.new()\n temperature_record.patient_identifier = patient_identifier\n temperature_record.temperature = temperature\n temperature_record.status = 'open'\n temperature_record.location_id = location #assuming the machine will provide location information\n temperature_record.save #save temperature\n end\n @notifier.run\n rescue Exception => e\n puts \"An error occured whilst executing\"\n puts e.message\n #puts e.backtrace.inspect\n end\n end", "def timing(stat, ms, sample_rate=1); send stat, ms, 'ms', sample_rate end", "def tick(*action_devices); end", "def input_thread_step\n case (obj = read_from_wire)\n when Block\n handle_block obj\n when Message\n handle_message obj\n else\n raise \"don't know what to do with #{obj.inspect}\"\n end\n\n ## to enable immediate response, if there are no rate limits,\n ## we'll send the blocks and reqs right here. otherwise, the\n ## controller will call this at intervals.\n send_blocks_and_reqs if @controller.dlratelim.nil? && @controller.ulratelim.nil?\n end", "def write_status(state, mesg = '')\n msg = \"#{state} #{mesg}\\n\"\n $RQ_IO.syswrite(msg)\n log(\"#{state} #{mesg}\")\nend", "def index\n\t @sensor = Sensor.find(params[:sensor_id])\n\t\t@readings = @sensor.readings\n @readings = @sensor.readings.paginate :per_page => 10, :page => params[:page], :order => 'created_at DESC' || 1\n\n# @readings = Reading.all\n#\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @readings }\n end\n end", "def sensor_temperature(key)\n sensors = $config.params\n display = sensors['AltDisplay']\n sensor = sensors[key]\n if sensor.nil?\n Command.help \"Unknown sensor: #{stat}\"\n else\n display_temp(key, sensor, display)\n end\n end", "def write_state; end", "def write_state; end", "def create\n\t @sensor = Sensor.find(params[:sensor_id])\n @reading = @sensor.readings.build(params[:reading].each_value(&:strip!))\n\n respond_to do |format|\n if @reading.save\n format.html { redirect_to sensor_reading_url(@sensor, @reading) }\n\t\tformat.js\n format.xml { render :xml => @reading, :status => :created, :location => @reading }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reading.errors, :status => :unprocessable_entity }\n end\n end\n end", "def measurement_params\n params.require(:measurement).permit(:temperature, :humidity, :lightLevel, :device_id)\n end", "def tmpr_log_params\n params.require(:tmpr_log).permit(:device_id, :time_stamp, :temperature, :pressure, :humidity)\n end", "def device_params\n params.require(:device).permit(:latitude, :longitude, :serial, :status, :imei)\n end", "def process_reading\n\t\t\t# open a thread\n\t\t\t@reading_thread = Thread.new do\n\t\t\t\tbegin\n\t\t\t\t\t# session handshake (see section 4.1)\n\t\t\t\t\t# gets the 'ClientFirstByte'\n\t\t\t\t\tf_byte = read(1)\n\t\t\t\t\t\n\t\t\t\t\t# gets the 'ClientHandcheckReceiving'\n\t\t\t\t\tc_handcheck = read(1536)\n\t\t\t\t\t\n\t\t\t\t\t# generates 'SERVER_HANDCHECK'\n\t\t\t\t\ts_handcheck = \"a\"*1536\n\t\t\t\t\t\n\t\t\t\t\t# sends 'ServerFirstByte', 'ServerHandcheckSending' and 'ClientHandcheckSending'\n\t\t\t\t\twrite ( \"\\3\" << s_handcheck << c_handcheck )\n\t\t\t\t\t\n\t\t\t\t\t# get the 'ServerHandcheckReceiving'\n\t\t\t\t\tread(1536)\n\t\t\t\t\t# handshake done\n\t\t\t\t\t\n\t\t\t\t\t# get the 'CONNECTION_PACKET'\n\t\t\t\t\t@first_packet = get_packet\n\t\t\t\t\t@connected = true\n\t\t\t\t\t# starts the writing loop\n\t\t\t\t\tprocess_writing\n\t\n\t\t\t\t\t# process the 'CONNECTION_PACKET' and notice the server\n\t\t\t\t\t@server.on_session(self)\n\t\t\t\t\t\n\t\t\t\t\t# enter the reading loop\n\t\t\t\t\twhile @connected do\n\t\t\t\t\t\t# fires an event each time the session receives a packet\n\t\t\t\t\t\ton_packet(get_packet)\n\t\t\t\t\tend\n\t\t\t\trescue Exception => obj\n\t\t\t\t\tdisconnect(obj)\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def set_sensor_reading\n\t\t\t\t@sensor_reading = SensorReading.find(params[:id])\n\t\t\tend", "def read\n GPIO.read @number\n end", "def addReading(sensor_type = nil, value = nil, location = nil, timestamp = nil)\n\n if @readings == nil\n\n @readings = Array::new\n\n end\n\n if @is_connected\n reading = Reading::new\n\n #serialise object\n reading.client_id = @client_id\n reading.sensor_type = sensor_type\n reading.value = value\n reading.location = location\n reading.timestamp = timestamp\n\n if sensor_type == 1\n @temperature_counter = @temperature_counter + 1\n else\n @acoustic_counter = @acoustic_counter + 1\n end\n\n @readings.push(reading)\n\n end\n\n if ((@readings.count == 10 || !@is_connected) && @readings.count > 0)\n DataReading.insertReadings(@client_id, @readings)\n readings.clear\n end\n\n end", "def send_param(status)\n case status\n when \"0\"\n self.device.send(:off)\n when \"1\"\n self.device.send(:on)\n else\n puts \"Error: '#{status}' is no valid value!\"\n end\n end", "def update\n @sensor = Sensor.find(params[:id])\n\n if @sensor.update(params[:sensor])\n head :no_content\n $redis.publish('sensors.update', { :name => @sensor.name, :value => @sensor.value, :id => @sensor.id}.to_json)\n else\n render json: @sensor.errors, status: :unprocessable_entity\n end\n end", "def humidity_reading_params\n params.require(:humidity_reading).permit(:humidity)\n end", "def currentTemp(info)\n\treturn info[\"currently\"][\"temperature\"]\nend", "def run\n if ldr.read < 70\n led.on!\n else\n led.off!\n end\n end", "def update\n @breadcrumb = 'update'\n @reading = Reading.find(params[:id])\n @meter = @reading.meter\n if !@meter.blank?\n # All associations\n @subscriber = Subscriber.find(params[:reading][:subscriber_id]) rescue nil\n @service_point = ServicePoint.find(params[:reading][:service_point_id]) rescue nil\n @project = Project.find(params[:reading][:project_id])\n @billing_period = BillingPeriod.find(params[:reading][:billing_period_id])\n if !@meter.is_shared?\n @reading_exits = Reading.where( meter_id: params[:reading][:meter_id],\n project_id: params[:reading][:project_id],\n billing_period_id: params[:reading][:billing_period_id],\n reading_type_id: params[:reading][:reading_type_id]).\n where(\"date(reading_date) = ?\", params[:reading][:reading_date].split(' ')[0].to_date)\n\n @reading_exits -= [@reading]\n else\n @reading_exits = nil\n end\n if @reading_exits.blank?\n incidences = params[:reading][:reading_incidences_ids]\n params[:reading].delete :reading_incidences_ids\n if @meter.is_shared?\n @meter.subscribers.activated.each do |s|\n @reading = Reading.where( meter_id: params[:reading][:meter_id],\n project_id: params[:reading][:project_id],\n subscriber_id: s.id,\n billing_period_id: params[:reading][:billing_period_id],\n reading_type_id: params[:reading][:reading_type_id]).limit(1)\n\n rdg_1 = set_reading_1_to_reading(s, @meter, @billing_period)\n rdg_2 = set_reading_2_to_reading(s, @meter, @billing_period)\n @reading.first.update_attributes(project_id: params[:reading][:project_id],\n billing_period_id: params[:reading][:billing_period_id],\n billing_frequency_id: @billing_period.try(:billing_frequency_id),\n reading_type_id: params[:reading][:reading_type_id],\n meter_id: params[:reading][:meter_id],\n subscriber_id: s.id,\n service_point_id: s.try(:service_point_id) || @service_point.try(:id),\n reading_route_id: s.try(:reading_route_id) || @service_point.try(:reading_route_id),\n reading_sequence: s.try(:reading_sequence) || @service_point.try(:reading_sequence),\n reading_variant: s.try(:reading_variant) || @service_point.try(:reading_variant),\n reading_date: params[:reading][:reading_date].to_date,\n reading_index: params[:reading][:reading_index],\n reading_1: rdg_1,\n reading_index_1: rdg_1.try(:reading_index),\n reading_2: rdg_2,\n reading_index_2: rdg_2.try(:reading_index))\n @reading.first.reading_incidence_types = ReadingIncidenceType.find_all_by_id incidences\n jj = []\n if !@reading.first.reading_incidence_types.blank?\n @reading.first.reading_incidence_types.each do |a|\n jj << a.id\n end\n end\n # vuelta de contador\n if @reading.first.reading_index < @reading.first.reading_index_1 and !jj.include?(1)\n @reading.first.reading_incidences.create(reading_id: @reading.first.id, reading_incidence_type_id: 1)\n end\n if !@reading.first.reading_1_id.blank? && Reading.find(@reading.first.reading_1_id).reading_type_id != ReadingType::INSTALACION\n conbaj = (@reading.first.reading_1.consumption / 2)\n conexc = (@reading.first.reading_1.consumption * 2)\n # consumo excesivo\n if @reading.first.consumption > conexc and !jj.include?(21)\n @reading.first.reading_incidences.create(reading_id: @reading.first.id, reading_incidence_type_id: 21)\n end\n # bajo consumo\n if @reading.first.consumption < conbaj and !jj.include?(22)\n @reading.first.reading_incidences.create(reading_id: @reading.first.id, reading_incidence_type_id: 22)\n end\n end\n # fuera de plazo\n if !@billing_period.reading_starting_date.blank? && !@billing_period.reading_ending_date.blank?\n if @reading.first.reading_date.between?(@billing_period.reading_starting_date, @billing_period.reading_ending_date) and !jj.include?(27)\n else\n @reading.first.reading_incidences.create(reading_id: @reading.first.id, reading_incidence_type_id: 27)\n end\n end\n if !@reading.first.save\n if session[:return_to_subscriber].nil?\n redirect_to @reading.first, alert: t('activerecord.attributes.reading.wrongly')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", alert: t('activerecord.attributes.reading.wrongly')\n end\n break\n end\n end # @meters.subscribers.activated do |s|\n if session[:return_to_subscriber].nil?\n redirect_to @reading, notice: t('activerecord.attributes.reading.create')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", notice: t('activerecord.attributes.reading.create')\n end\n else\n @reading.assign_attributes params[:reading]\n @reading.reading_incidence_types = ReadingIncidenceType.find_all_by_id incidences\n rdg_1 = set_reading_1_to_reading(@subscriber, @meter, @billing_period)\n rdg_2 = set_reading_2_to_reading(@subscriber, @meter, @billing_period)\n @reading.reading_1 = rdg_1\n @reading.reading_index_1 = rdg_1.try(:reading_index)\n @reading.reading_2 = rdg_2\n @reading.reading_index_2 = rdg_2.try(:reading_index)\n @reading.reading_sequence = @subscriber.blank? && @meter.service_points.blank? ? nil : !@subscriber.blank? ? @subscriber.reading_sequence : @meter.service_points.first.reading_sequence\n @reading.reading_variant = @subscriber.blank? && @meter.service_points.blank? ? nil : !@subscriber.blank? ? @subscriber.reading_variant : @meter.service_points.first.reading_variant\n @reading.reading_route_id = @subscriber.blank? && @meter.service_points.blank? ? nil : !@subscriber.blank? ? @subscriber.reading_route_id : @meter.service_points.first.reading_route_id\n @reading.billing_frequency_id = @billing_period.try(:billing_frequency_id)\n @reading.created_by = current_user.id if !current_user.nil?\n jj = []\n if !@reading.reading_incidence_types.blank?\n @reading.reading_incidence_types.each do |a|\n jj << a.id\n end\n end\n # vuelta de contador\n if @reading.reading_index.to_i < @reading.reading_index_1.to_i and !jj.include?(1)\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 1)\n end\n if !@reading.reading_1_id.blank? && Reading.find(@reading.reading_1_id).reading_type_id != ReadingType::INSTALACION\n conbaj = (@reading.reading_1.consumption / 2)\n conexc = (@reading.reading_1.consumption * 2)\n # consumo excesivo\n if @reading.consumption > conexc and !jj.include?(21)\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 21)\n end\n # bajo consumo\n if @reading.consumption < conbaj and !jj.include?(22)\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 22)\n end\n end\n # fuera de plazo\n if !@billing_period.reading_starting_date.blank? && !@billing_period.reading_ending_date.blank?\n if @reading.reading_date.between?(@billing_period.reading_starting_date, @billing_period.reading_ending_date) and !jj.include?(27)\n else\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 27)\n end\n end\n if @reading.save\n if session[:return_to_subscriber].nil?\n redirect_to @reading, notice: t('activerecord.attributes.reading.create')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", notice: t('activerecord.attributes.reading.create')\n end\n else\n if session[:return_to_subscriber].nil?\n redirect_to @reading, alert: t('activerecord.attributes.reading.wrongly')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", alert: t('activerecord.attributes.reading.wrongly')\n end\n end\n end # @meter.is_shared?\n else\n if session[:return_to_subscriber].nil?\n redirect_to @reading, alert: t('activerecord.attributes.reading.repeat')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", alert: t('activerecord.attributes.reading.repeat')\n end\n end # @reading_exits.blank?\n end # !@meter.blank?\n end", "def device_params\n params.require(:device).permit(:name, :control_mode, :hysteresis, :update_channel)\n end", "def update\n respond_to do |format|\n if @reading.update(reading_params)\n format.html { redirect_to user_readings_path, notice: 'Reading was successfully updated.' }\n format.json { render :show, status: :ok, location: @reading }\n if @reading.systolic > current_user.systolic_range.high || @reading.diastolic < current_user.systolic_range.low\n # Get your Account Sid and Auth Token from twilio.com/user/account\n account_sid = 'AC63de569ccbfd715bed71f1bd6d884215'\n auth_token = '447c2138b017c4bf199553496fab3554'\n @client = Twilio::REST::Client.new account_sid, auth_token\n \n message = @client.account.messages.create(:body => \"#{current_user.firstname} #{current_user.lastname}'s blood pressure is outside of normal range\",\n :to => current_user.guardian_phone_number, \n :from => current_user.phone_number)\n puts message.to\n end\n else\n format.html { render :edit }\n format.json { render json: @reading.errors, status: :unprocessable_entity }\n end\n end\n end", "def read_state\n end", "def info\n return 'STATE=d' if @state == 'd'\n\n str_info = \"\"\n\n str_info << \"STATE=\" << @state << \" \"\n str_info << \"USEDCPU=\" << @used_cpu.to_s << \" \"\n str_info << \"USEDMEMORY=\"<< @used_memory.to_s << \" \"\n str_info << \"NETRX=\" << @net_rx.to_s << \" \"\n str_info << \"NETTX=\" << @net_tx.to_s\n end", "def on\n GPIO.write \"gpio#{@number}/value\", \"1\"\n end", "def process_sensor(notification)\n\t\tvalue = notification.userInfo\n mp \"sensor value is #{value}__serial is #{value['serial']}_____________\"\n if value[\"value\"] >=5\n mp \"motion sensed - triggering lights\"\n if @Player.isPlaying\n mp 'cant start audio still playing'\n else\n avalancheTrigger\n end\n end \n\tend", "def start_direct_data(device_id)\n method = DirectMethod.new\n method.response_timeout = @options.response_timeout\n method.connect_timeout = @options.connect_timeout\n method.payload = { timeout: @options.direct_data_timeout }\n method.method_name = :startdirectdata\n @twin_manager.invoke_method(device_id, method)\n nil\n end", "def reading_params\n params.require(:reading).permit(:systolic, :diastolic, :heart_rate, :time)\n end", "def initialize(opts = {})\n @addr = opts[:addr] || '0x20'\n @i2cbus = opts[:i2cbus] || 1\n @int = opts[:int] || nil\n @stub = opts[:stub]\n @state = read_state\n @pins = Array.new(8) {|i| Pin.new self, i }\n @rsm = Mutex.new\n @on_change_blocks = []\n @q_check_state = Queue.new\n\n return if @stub\n\n # FIXME event can be missed between firing these\n # probably could be fixed by doing read after setting up a hook\n if @int\n system(\"gpio -g mode #{@int} in\")\n Catcher.thread(\"check state\") do\n loop do\n @q_check_state.pop\n sleep 0.3 # let gpio wfi command start\n puts \"double check\"\n prev_state = nil\n decide = nil\n new_state = nil\n @rsm.synchronize do\n prev_state = @state\n puts \"GO prev_state #{prev_state}\"\n @state = read_state\n new_state = @state\n puts \"GO new state #{@state}\"\n decide = (@state != prev_state)\n end\n if decide #@state != prev_state # in case many PCFs are connected to single interrupt\n Catcher.thread \"pcf on change blocks\" do\n #puts \"##{@number} change!: #{prev_state} -> #{new_state} GOT ONE =====\"\n @on_change_blocks.each {|b| b.call(prev_state,new_state) }\n end\n end\n end\n end\n\n Catcher.thread(\"pin listen\") do\n begin\n loop do\n @q_check_state.push true\n `gpio -g wfi #{@int} both`\n prev_state = nil\n decide = nil\n new_state = nil\n @rsm.synchronize do\n prev_state = @state\n puts \"prev_state #{prev_state}\"\n #sleep 0.01\n @state = read_state\n new_state = @state\n puts \"new state #{@state}\"\n decide = (@state != prev_state)\n end\n if decide #@state != prev_state # in case many PCFs are connected to single interrupt\n Catcher.thread \"pcf on change blocks\" do\n puts \"##{@number} change!: #{prev_state} -> #{new_state}\"\n @on_change_blocks.each {|b| b.call(prev_state, new_state) }\n end\n end\n end\n rescue Exception => e\n puts \"SHIT #{e}\"\n end\n end\n end\n end", "def submitSessionInfos\n # check if data submission is offline\n is_offline_sensor_data_collection = false\n\n # not having valid device id or device type. \n if params.has_key?(:uid) == true && !params[:uid].empty?\n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n if (\n params.has_key?(:sensor_infos) == false || params[:sensor_infos].empty? || \n params[:sensor_infos].kind_of?(Array) == false || params[:sensor_infos].count == 0\n )\n render json: { 'status' => 'OK' }.to_json\n end\n\n # check device pairing. \n @deviceId = params[:did]\n if isPairedDeviceValid(@deviceId, params[:uid]) == false\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n needToCreateSession = false\n if params.has_key?(:is_initiator) && params[:is_initiator] == true\n needToCreateSession = true\n else\n # check if devicepairconnotp is not expired yet\n @devicepairconnections = @devicepairs.ute_device_pair_connections.where(\n :expire_by.gte => Time.now.getutc.to_f, \n :is_active => true\n )\n firststartdate = params[:sensor_infos][0][:t]\n @devicepairconnections.each do |devicepairconnection|\n si = devicepairconnection.ute_ex_session\n unless si.nil?\n if firststartdate > si.range_start_at && firststartdate < si.range_end_at \n #found the paired connection\n @devicepairconnection = devicepairconnection\n @session = @devicepairconnection.ute_ex_session\n break\n end\n end\n end\n\n if @devicepairconnection == nil && @session == nil \n #session to pair is not found\n render json: { 'status' => 'FAILED', 'code' => 404 }.to_json\n return\n end\n end\n\n if needToCreateSession \n # create new session\n @sessionId = generateNewSessionId\n\n while isSessionIdAlreadyExist(@experiment.experiment_code, @sessionId) do\n @sessionId = generateNewSessionId\n end\n\n @session = @experiment.ute_ex_sessions.create!(\n session_code: @sessionId,\n is_active: true,\n initiated_by_device_id: @deviceId,\n is_created_offline: true\n )\n end\n\n if @session\n @sessionConnection = @session.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: params[:sensor_infos][0][:t])\n \n @devicepairconnotp = generateNewDevicePairConnOtp\n\n while isActiveDevicePairConnOtpAlreadyExist(@devicepairs, @devicepairconnotp) do\n @devicepairconnotp = generateNewDevicePairConnOtp\n end\n\n dpc = @devicepairs.ute_device_pair_connections.new(\n is_active: true,\n otp: @devicepairconnotp,\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME, \n ute_ex_session: @session\n )\n dpc.save! \n\n @session.ute_device_pair_connection = dpc\n @session.save!\n\n is_offline_sensor_data_collection = true\n end\n end \n\n if isDataSubmissionInvalidForExpAndSession(request, params) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n begin\n if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n UteDataSubmissionService.delay.handlesensorinfos(@session, @sessionConnection, params)\n end\n rescue => e\n puts(e.message)\n raise 'an error has occured'\n #puts(e.backtrace.join(\"\\n\"))\n end\n\n #begin\n # if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n # puts('receiving first item: ' + params[:sensor_infos][0][:t].to_s)\n # end\n #rescue => e\n # puts('TRY TO RESCUE')\n #\n # puts(e.message)\n # raise 'an error has occured'\n # #puts(e.backtrace.join(\"\\n\"))\n #end\n\n if @devicepairconnection != nil && is_offline_sensor_data_collection \n #otp needs to be renewed\n @devicepairconnection.update_attributes(\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME\n )\n end \n \n if is_offline_sensor_data_collection\n render json: { 'status' => 'OK', 'otp' => @devicepairconnotp, 'session_id' => @session.session_code }.to_json\n else\n render json: { 'status' => 'OK' }.to_json\n end\n end", "def read\n @serial_port.read()\n end", "def request_sensor(sensor_index:, read_key: nil)\n GetSensor.call(client: read_client, sensor_index: sensor_index, read_key: read_key)\n end", "def push_data(data)\n uri = URI.parse(\"http://#{@config[:server]}/temperature/data\")\n begin\n response = Net::HTTP.post_form(uri, data)\n rescue\n log puts \"Error talking to server.\"\n else\n `sudo blink.py` # blinks are good.\n end\n log response\n end", "def update!\n @mem, @swp = memory_swap_percents\n cpu_thread = Thread.new {processor_percents}\n network_thread = Thread.new {received_transmitted}\n weather!\n if HAVE_ACPI\n battery_thread = Thread.new {battery_status}\n battery_thread.join\n end\n cpu_thread.join\n network_thread.join\n end", "def humidity(info)\n\treturn info[\"currently\"][\"humidity\"]*100\nend", "def opened_sensor_activated\n @state = @state.opened\n end", "def wait_for_rx\n sleep DATA_REFRESH_RATE + @latency\n end", "def receive_data(data)\n @in << data\n send(@state)\n rescue => e\n handle_error(e)\n end", "def get_latest_reading\n id = params[:id]\n device = Device.find_by_network_address(id)\n if device.nil?\n render :json => nil\n return\n end\n last_reading_time = device.last_reading_at * 1000 # convert to millisecond\n reading = @sensor_reading_table.items.query(\n :hash_value => id,\n :range_value => last_reading_time,\n :select => :all)\n if !reading.nil?\n render :json => reading.to_a.last.attributes\n else\n render :json => nil\n end\n end", "def reading_params\n params.require(:reading).require(:temperature)\n params.require(:reading).require(:humidity)\n params.require(:reading).require(:battery_charge)\n params.require(:reading).permit(:temperature, :humidity, :battery_charge)\n end", "def flush()\n @device.flush() ;\n end", "def ping\n\t\t# MAC address / serial\n\t\tlogger.debug(\"PING called\")\n\n\t\trender_event\n\tend", "def send_input! type, detail, time = 0, window = 0, root_x = 0, root_y = 0, device_id = 0\n send_input type, detail, time, window, root_x, root_y, device_id\n end", "def weather_reading_params\n params.require(:weather_reading).permit(:temperature, :location, :description, :icon_url)\n end", "def pull_state\n if @physical_object\n @status = 200\n @ds = @physical_object.digital_statuses.order(\"updated_at DESC\").last\n unless @ds.nil?\n @success = true\n @message = @ds.decided\n else\n @success = false\n @message = \"Physical object #{@physical_object.mdpi_barcode} has 0 Digital Statuses...\"\n end\n end\n render template: 'responses/pull_state.xml.builder', layout: false, status: @status\n end", "def read(count=nil)\n if count\n write([0xFF] * count)\n else\n enable { Rpio.driver.spi_transfer(0) }\n end\n end", "def update\n if @sensor.update(sensor_params)\n render json: { status: :ok }\n else\n render json: { status: :unprocessable_entity }\n end\n end", "def run\n print \"value: #{thermometer.read}\\r\"\n end", "def eth_cnt_rst; eth_ctrl_bit(8); end", "def create\n @breadcrumb = 'create'\n @meter = Meter.find(params[:reading][:meter_id]) rescue nil\n if !@meter.blank?\n # All associations\n @subscriber = Subscriber.find(params[:reading][:subscriber_id]) rescue nil\n @service_point = ServicePoint.find(params[:reading][:service_point_id]) rescue nil\n @project = Project.find(params[:reading][:project_id])\n @billing_period = BillingPeriod.find(params[:reading][:billing_period_id])\n @reading_exits = Reading.where( meter_id: params[:reading][:meter_id],\n project_id: params[:reading][:project_id],\n billing_period_id: params[:reading][:billing_period_id],\n reading_type_id: params[:reading][:reading_type_id]) \\\n .where(\"date(reading_date) = ?\", params[:reading][:reading_date].split(' ')[0].to_date)\n created_by = current_user.id if !current_user.nil?\n if @reading_exits.blank?\n if @meter.is_shared?\n @meter.subscribers.activated.each do |s|\n rdg_1 = set_reading_1_to_reading(s, @meter, @billing_period)\n rdg_2 = set_reading_2_to_reading(s, @meter, @billing_period)\n @reading = Reading.new(project_id: params[:reading][:project_id],\n billing_period_id: params[:reading][:billing_period_id],\n billing_frequency_id: @billing_period.try(:billing_frequency_id),\n reading_type_id: params[:reading][:reading_type_id],\n meter_id: params[:reading][:meter_id],\n subscriber_id: s.id,\n coefficient: s.meter.shared_coefficient,\n service_point_id: s.try(:service_point_id) || @service_point.try(:id),\n reading_route_id: s.try(:reading_route_id) || @service_point.try(:reading_route_id),\n reading_sequence: s.try(:reading_sequence) || @service_point.try(:reading_sequence),\n reading_variant: s.try(:reading_variant) || @service_point.try(:reading_variant),\n reading_date: params[:reading][:reading_date].to_date,\n reading_index: params[:reading][:reading_index],\n reading_1: rdg_1,\n reading_index_1: rdg_1.try(:reading_index),\n reading_2: rdg_2,\n reading_index_2: rdg_2.try(:reading_index),\n created_by: created_by)\n if !params[:incidence_type_ids].blank?\n @my_read_inci_type = ReadingIncidenceType.where(id: params[:incidence_type_ids])\n @reading.reading_incidence_types << @my_read_inci_type\n end\n if !@reading.save\n if session[:return_to_subscriber].nil?\n redirect_to @reading, alert: t('activerecord.attributes.reading.wrongly')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", alert: t('activerecord.attributes.reading.wrongly')\n end\n break\n else\n # vuelta de contador\n if @reading.reading_index.to_i < @reading.reading_index_1.to_i\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 1)\n end\n if !@reading.reading_1_id.blank? && Reading.find(@reading.reading_1_id).reading_type_id != ReadingType::INSTALACION\n conbaj = (@reading.reading_1.consumption / 2)\n conexc = (@reading.reading_1.consumption * 2)\n # consumo excesivo\n if @reading.consumption > conexc\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 21)\n end\n # bajo consumo\n if @reading.consumption < conbaj\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 22)\n end\n end\n # fuera de plazo\n if !@billing_period.reading_starting_date.blank? && !@billing_period.reading_ending_date.blank?\n if !@reading.reading_date.between?(@billing_period.reading_starting_date, @billing_period.reading_ending_date)\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 27)\n end\n end\n end\n end # @meters.subscribers.activated do |s|\n if session[:return_to_subscriber].nil?\n redirect_to @reading, notice: t('activerecord.attributes.reading.create')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", notice: t('activerecord.attributes.reading.create')\n end\n else\n @reading = Reading.new(params[:reading])\n if !params[:incidence_type_ids].blank?\n @my_read_inci_type = ReadingIncidenceType.where(id: params[:incidence_type_ids])\n @reading.reading_incidence_types << @my_read_inci_type\n end\n rdg_1 = set_reading_1_to_reading(@subscriber, @meter, @billing_period)\n rdg_2 = set_reading_2_to_reading(@subscriber, @meter, @billing_period)\n @reading.service_point_id = @subscriber.blank? && @meter.service_points.blank? ? nil : !@subscriber.blank? ? @subscriber.service_point_id : @meter.service_points.first.id\n @reading.coefficient = @meter.shared_coefficient\n @reading.reading_1 = rdg_1\n @reading.reading_index_1 = rdg_1.try(:reading_index)\n @reading.reading_2 = rdg_2\n @reading.reading_index_2 = rdg_2.try(:reading_index)\n @reading.reading_sequence = @subscriber.blank? && @meter.service_points.blank? ? nil : !@subscriber.blank? ? @subscriber.reading_sequence : @meter.service_points.first.reading_sequence\n @reading.reading_variant = @subscriber.blank? && @meter.service_points.blank? ? nil : !@subscriber.blank? ? @subscriber.reading_variant : @meter.service_points.first.reading_variant\n @reading.reading_route_id = @subscriber.blank? && @meter.service_points.blank? ? nil : !@subscriber.blank? ? @subscriber.reading_route_id : @meter.service_points.first.reading_route_id\n @reading.billing_frequency_id = @billing_period.try(:billing_frequency_id)\n @reading.created_by = current_user.id if !current_user.nil?\n\n if @reading.save\n # vuelta de contador\n if @reading.reading_index.to_i < @reading.reading_index_1.to_i\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 1)\n end\n if !@reading.reading_1_id.blank? && Reading.find(@reading.reading_1_id).reading_type_id != ReadingType::INSTALACION\n conbaj = (@reading.reading_1.consumption / 2)\n conexc = (@reading.reading_1.consumption * 2)\n # consumo excesivo\n if @reading.consumption > conexc\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 21)\n end\n # bajo consumo\n if @reading.consumption < conbaj\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 22)\n end\n end\n # fuera de plazo\n if !@billing_period.reading_starting_date.blank? && !@billing_period.reading_ending_date.blank?\n if !@reading.reading_date.between?(@billing_period.reading_starting_date, @billing_period.reading_ending_date)\n @reading.reading_incidences.create(reading_id: @reading.id, reading_incidence_type_id: 27)\n end\n end\n if session[:return_to_subscriber].nil?\n redirect_to @reading, notice: t('activerecord.attributes.reading.create')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", notice: t('activerecord.attributes.reading.create')\n end\n else\n if session[:return_to_subscriber].nil?\n redirect_to @reading, alert: t('activerecord.attributes.reading.wrongly')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", alert: t('activerecord.attributes.reading.wrongly')\n end\n end\n end # @meter.is_shared?\n else\n if session[:return_to_subscriber].nil?\n redirect_to @reading, alert: t('activerecord.attributes.reading.repeat')\n else\n redirect_to session[:return_to_subscriber_url] + \"#readings\", alert: t('activerecord.attributes.reading.repeat')\n end\n end # @reading_exits.blank?\n end # !@meter.blank?\n end", "def sensor_params\n params.require(:sensor).permit(:sampling_period, :sending_period, :day_cost, :night_cost, :day_start_time, :night_start_time)\n end" ]
[ "0.6142587", "0.6005751", "0.56190664", "0.5519432", "0.5501627", "0.52769345", "0.5195745", "0.5134593", "0.508595", "0.50521946", "0.50493795", "0.50198597", "0.4987756", "0.49458665", "0.48833528", "0.48647407", "0.4845068", "0.4843082", "0.48353758", "0.48174357", "0.48041642", "0.4785683", "0.47813016", "0.47702503", "0.47463194", "0.46830094", "0.46361303", "0.46308622", "0.46306697", "0.46206143", "0.46195593", "0.46175784", "0.46107575", "0.4606749", "0.45870999", "0.45761937", "0.45714596", "0.45665354", "0.45624596", "0.456204", "0.45486897", "0.45478803", "0.45406795", "0.45384085", "0.4535859", "0.45181087", "0.45127574", "0.45105916", "0.45089495", "0.44900608", "0.44828758", "0.44772953", "0.44772524", "0.44701108", "0.44701108", "0.44690192", "0.4461006", "0.44605017", "0.4454622", "0.44466215", "0.44465774", "0.44374287", "0.44354147", "0.44253933", "0.4422511", "0.44215253", "0.43958429", "0.43927553", "0.43905574", "0.43881702", "0.43868327", "0.43866023", "0.43823066", "0.43747094", "0.43712947", "0.43613946", "0.43582433", "0.43555084", "0.4351454", "0.43509874", "0.43489715", "0.43483666", "0.4347232", "0.43469688", "0.4339873", "0.432653", "0.43259805", "0.43101636", "0.4307577", "0.43030664", "0.429834", "0.42877245", "0.42876163", "0.42875785", "0.42858288", "0.42775458", "0.42762166", "0.42758873", "0.4273947", "0.42727402" ]
0.78722006
0
Triggers new alarm upload sound file to S3 (if given), update storage url and post new alarm. Finally +alarm+ is updated with posted alarm Id. Params: +info+:: +DeviceInfo+ object. +alarm+:: +DeviceAlarms::State+ object. +type+:: Given alarm type.
def triggerAlarm(info, alarm, type) uploadSoundFile(info, alarm, type) params = { :device_id => info.deviceId, :alarm_type => type, :storage_url => alarm.storageUrl } res = apiPost("alarms", params) if res.status == 201 begin response = JSON.parse(res.body) alarm._id = response["id"] $LOG.info("Triggered \"#{type}\" alarm. Id: #{alarm._id}") rescue Exception => e $LOG.warn("Invalid body received on trigger alarm! Err: #{e.message}") end else $LOG.warn("Failed to post \"#{type}\" alarm to backend! Status: #{res.status}, Response: #{res.body}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uploadSoundFile(info, alarm, type)\r\n if !alarm.sound.nil?\r\n # reset storageUrl\r\n alarm.storageUrl = nil\r\n\r\n # get new urls\r\n params = {\r\n :device_id => info.deviceId,\r\n :alarm_type => type\r\n }\r\n res = apiPost(\"storage/alarm\", params)\r\n \r\n if res.status == 201\r\n uploadUrl = downloadUrl = nil\r\n begin\r\n response = JSON.parse(res.body)\r\n downloadUrl = response[\"read_url\"]\r\n uploadUrl = response[\"signed_url\"]\r\n rescue Exception => e \r\n $LOG.warn(\"Invalid body received on post storage/alarm! Err: #{e.message}\")\r\n end\r\n \r\n if !uploadUrl.nil? and !downloadUrl.nil?\r\n # upload WAV \r\n @httpClient.default_header = @wavHeader\r\n begin\r\n File.open(alarm.sound) { |file|\r\n res = @httpClient.put(uploadUrl,\r\n :body => file\r\n )\r\n if res.status == 200\r\n # set storageUrl if everything succeed\r\n alarm.storageUrl = downloadUrl\r\n else\r\n $LOG.warn(\"Failed to put alarm sound to S3! Body: #{res.body}\")\r\n end\r\n }\r\n rescue Exception => e \r\n $LOG.warn(\"Failed to open sound file! Err: #{e.message}\")\r\n end\r\n else\r\n $LOG.warn(\"Failed to get S3 upload/download urls!\")\r\n end\r\n else\r\n $LOG.warn(\"Failed to post \\\"#{type}\\\" alarm to get S3 urls from backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end\r\n end", "def setAlarms\n if !@config['basis'].nil? and @config[\"alarms\"] and !@config[\"alarms\"].empty?\n @config[\"alarms\"].each { |alarm|\n alarm_obj = MU::MommaCat.findStray(\n \"AWS\",\n \"alarms\",\n region: @region,\n deploy_id: @deploy.deploy_id,\n name: alarm['name']\n ).first\n alarm[\"dimensions\"] = [{:name => \"InstanceId\", :value => @cloud_id}]\n\n if alarm[\"enable_notifications\"]\n # XXX vile, this should be a sibling resource generated by the\n # parser\n topic_arn = MU::Cloud.resourceClass(\"AWS\", \"Notification\").createTopic(alarm[\"notification_group\"], region: @region, credentials: @credentials)\n MU::Cloud.resourceClass(\"AWS\", \"Notification\").subscribe(topic_arn, alarm[\"notification_endpoint\"], alarm[\"notification_type\"], region: @region, credentials: @credentials)\n alarm[\"alarm_actions\"] = [topic_arn]\n alarm[\"ok_actions\"] = [topic_arn]\n end\n\n alarm_name = alarm_obj ? alarm_obj.cloud_id : \"#{@mu_name}-#{alarm['name']}\".upcase\n\n MU::Cloud.resourceClass(\"AWS\", \"Alarm\").setAlarm(\n name: alarm_name,\n ok_actions: alarm[\"ok_actions\"],\n alarm_actions: alarm[\"alarm_actions\"],\n insufficient_data_actions: alarm[\"no_data_actions\"],\n metric_name: alarm[\"metric_name\"],\n namespace: alarm[\"namespace\"],\n statistic: alarm[\"statistic\"],\n dimensions: alarm[\"dimensions\"],\n period: alarm[\"period\"],\n unit: alarm[\"unit\"],\n evaluation_periods: alarm[\"evaluation_periods\"],\n threshold: alarm[\"threshold\"],\n comparison_operator: alarm[\"comparison_operator\"],\n region: @region,\n credentials: @credentials\n )\n }\n end\n end", "def call\n context.replace_file_id = case context.mime_type\n when %r{audio/.*}, %r{.*/ogg} # Audio\n bot.api.send_chat_action(\n chat_id: context.telegram_user.id,\n action: 'upload_audio'\n )\n context.file = file_id_to_converted_file(context.file_id)\n true\n else\n raise InvalidMimeTypeError\n end\n\n context.sound = Sound.create(\n uploader: context.user,\n title: context.title.strip,\n )\n\n context.tags = context.tags&.split(',')&.map(&:strip)&.map do |tag_content|\n next nil unless tag_content.strip.length > 0\n\n tag = Tag.find_or_create(content: tag_content)\n context.sound.add_tag(tag)\n tag\n end\n context.tags&.compact!\n\n context.sound.save_changes\n\n rescue InvalidMimeTypeError\n context.fail!(error: :invalid_mime_type)\n\n rescue ConversionError\n context.fail!(error: :conversion_error)\n\n end", "def perform(type, body = {}, object_id)\n event = Event.create!(event_type: type, body: body.to_json, object_id: object_id)\n\n DispatchEventJob.perform_later(event)\n end", "def update_alarm(tracker_id, alarm_id, params)\n post_call(\"user/#{user_id}/devices/tracker/#{tracker_id}/alarms/#{alarm_id}.json\", params)\n end", "def upload_to_s3(info, file_name)\n bucket_name = 'techops-tests'\n\n to_json_file(info, file_name)\n\n s3 = Aws::S3::Resource.new(\n region: 'ap-southeast-2',\n access_key_id: $options[:s3_key],\n secret_access_key: $options[:s3_secret]\n )\n\n file = File.basename file_name\n obj = s3.bucket(bucket_name).object(file)\n\n if obj.upload_file(file)\n puts \"Uploaded #{file} to bucket #{bucket_name}\"\n File.delete(file_name)\n else\n puts \"Could not upload #{file} to bucket #{bucket_name}!\"\n end\nend", "def update\n @event = @account.events.find(params[:id])\n file = params[:event][:photo_url]\n public_url = nil\n if file != nil\n s3 = Aws::S3::Resource.new(region: 'us-east-1')\n bucket = 'fifo-cloud'\n # Get just the file name\n name = file.original_filename\n # Create the object to upload\n obj = s3.bucket(bucket).object(name)\n # Create the option\n options = {\n acl: \"public-read\",\n metadata: {\n collection: \"events\",\n title: params[:event][:title],\n source: @event.id.to_s\n }\n }\n obj.upload_file(file.tempfile, options)\n public_url = s3.bucket(bucket).object(name).public_url\n end\n respond_to do |format|\n if @event.update_attributes!(event_params(public_url))\n\n if public_url != nil\n @upload = Upload.new(\n url: public_url,\n name: name,\n event_id: @event.id,\n collection: 'events',\n account_id: @account.id\n ).save!\n end\n format.html { redirect_to @event, 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 adjust_trigger(trig_type, trig_arn, func_arn, func_id=nil, protocol='lambda',region=@config['region'])\n \n case trig_type\n \n when 'sns'\n # XXX don't do this, use MU::Cloud::AWS::Notification \n sns_client = MU::Cloud::AWS.sns(region: @config['region'], credentials: @config['credentials'])\n sub_to_what = sns_client.subscribe({\n topic_arn: trig_arn,\n protocol: protocol,\n endpoint: func_arn\n })\n when 'event','cloudwatch_event', 'events'\n # XXX don't do this, use MU::Cloud::AWS::Log\n client = MU::Cloud::AWS.cloudwatch_events(region: @config['region'], credentials: @config['credentials']).put_targets({\n rule: @config['trigger']['name'],\n targets: [\n {\n id: func_id,\n arn: func_arn\n }\n ]\n })\n when 'apigateway'\n# XXX this is actually happening in ::Endpoint... maybe... \n# MU.log \"Creation of API Gateway integrations not yet implemented, you'll have to do this manually\", MU::WARN, details: \"(because we'll basically have to implement all of APIG for this)\"\n end \n end", "def alarm_params\n params.require(:alarm).permit(:extID, :status, :severity, :date, :object, :category, :type)\n end", "def alarm message, sound=:failure\n puts message\n play sound \n end", "def create\n file = params[:event][:photo_url]\n public_url = nil\n if file != nil\n s3 = Aws::S3::Resource.new(region: 'us-east-1')\n bucket = 'fifo-cloud'\n # Get just the file name\n name = file.original_filename\n # Create the object to upload\n obj = s3.bucket(bucket).object(name)\n # Create the option\n options = {\n acl: \"public-read\",\n metadata: {\n collection: \"events\",\n title: params[:event][:title]\n }\n }\n obj.upload_file(file.tempfile, options)\n public_url = s3.bucket(bucket).object(name).public_url\n end\n\n @event = @account.events.new(event_params(public_url))\n\n respond_to do |format|\n if @event.save\n if public_url != nil\n @upload = Upload.new(\n url: public_url,\n name: name,\n event_id: @event.id,\n collection: 'events',\n account_id: @account.id\n ).save!\n end\n format.html { redirect_to account_event_path(@account, @event), notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n @event.locations.new(title: 'Truck', latitude: @event.latitude, longitude: @event.longitude, event_id: @event.id, loc_type: 'truck').save\n @event.locations.new(title: 'sales', latitude: @event.latitude, longitude: @event.longitude, event_id: @event.id, loc_type: 'sales', hidden: true).save\n @event.locations.new(title: 'waste', latitude: @event.latitude, longitude: @event.longitude, event_id: @event.id, loc_type: 'waste', hidden: true).save\n @event.locations.new(title: 'comps', latitude: @event.latitude, longitude: @event.longitude, event_id: @event.id, loc_type: 'comps', hidden: true).save\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @alarm.update(alarm_params)\n render json: {\n message: 'Alarm was successfully updated.',\n alarm: @alarm\n }\n else\n render json: {\n message: 'Alarm updated.',\n alarm: @alarm\n }\n end \n end", "def aws_alarm\n # taken from: http://tech.xogroupinc.com/post/79166302844/creating-sns-subscription-endpoints-with-ruby-on\n \n # get amazon message type and topic\n amz_message_type = request.headers['x-amz-sns-message-type']\n amz_sns_topic = request.headers['x-amz-sns-topic-arn']\n\n # return unless !amz_sns_topic.nil? &&\n # amz_sns_topic.to_s.downcase == 'arn:aws:sns:us-east-1:460932295327:cpu_threshold'\n\n return unless amz_sns_topic.present?\n Rails.logger.info \"[AWS ALARM] Received for topic #{amz_sns_topic} (type: #{amz_message_type})\"\n\n request_body = JSON.parse request.body.read\n Rails.logger.info \"[AWS ALARM] Request headers: #{request.headers}\"\n Rails.logger.info \"[AWS ALARM] Request body: #{request_body}\"\n\n # if this is the first time confirmation of subscription, then confirm it\n if amz_message_type.to_s.downcase == 'subscriptionconfirmation'\n send_subscription_confirmation request_body\n Rails.logger.info \"[AWS ALARM] CONFIRMING SUBSCRIPTION.\"\n head status: :accepted and return\n end\n\n if amz_message_type.to_s.downcase == 'notification'\n # Includes debugging mechanisms\n if request_body[\"Subject\"] == \"grow\"\n target_size = request_body[\"Message\"].to_i\n Rails.logger.info \"[AWS ALARM] TEST GROW TO #{target_size}\"\n self.class.grow_cluster(target_size)\n elsif request_body[\"Subject\"] == \"shrink\"\n target_size = request_body[\"Message\"].to_i\n Rails.logger.info \"[AWS ALARM] TEST SHRINK TO #{target_size}\"\n self.class.shrink_cluster(target_size)\n elsif AutoScale.instance.enabled?\n Rails.logger.info \"[AWS ALARM] Calling rebalance_cluster_if_necessary\"\n self.class.rebalance_cluster_if_necessary \n else\n Rails.logger.info \"[AWS ALARM] NO ACTION.\"\n end\n end\n head status: :accepted\n end", "def perform_multipart_upload\n s3o = S3Object.find_by(uri: @params[:s3_object_uri]) || S3Object.new\n s3o.uri = @params[:s3_object_uri]\n s3o.file = @params[:file]\n s3o.bucket = handle_bucket\n s3o.key = @params[:key]\n s3o.content_type = @params[:file].content_type\n s3o.size = File.size(s3o.file.path)\n s3o.md5 = Digest::MD5.file(s3o.file.path).hexdigest\n s3o.save!\n\n [:created, :xml, XmlAdapter.uploaded_object(\"#{@request.host}:#{@request.port}\", s3o)]\n end", "def upload_audio_for_transcription\n puts \"IN UPLOAD AUDIO CONTROLLER FUNCTION\"\n\n @speakers_number = params[:transcription][:speakers]\n @episode_id = params[:transcription][:ep_id]\n\n if @episode_id === nil\n puts \"EPISODE DOESN'T EXIST\"\n @episode = Episode.new(episode_params)\n if @episode.save\n GetTranscriptionJob.perform_later(@episode.id, @speakers_number)\n render json: { message: \"Transcription has started\" }\n else\n render_error\n end\n else\n puts \"EPISODE EXISTS\"\n GetTranscriptionJob.perform_later(@episode_id, @speakers_number)\n render json: { message: \"Transcription has started\" }\n end\n end", "def update\n if @alarm.update(alarm_params)\n respond_with(@alarm, location: alarms_path, notice: 'Alarm was successfully updated.')\n else\n respond_with(@alarm)\n end\n end", "def upload(src, item, modify)\n if modify then\n # this is usually a format change, which can only be set on create.\n # So delete then create.\n remove(item[:rid])\n end\n r = create(item[:alias], item[:format])\n raise \"Create Failed: #{r}\" unless r.nil?\n end", "def add_from_uploaded_file(entry, upload_token_id, type=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'entry', entry);\n\t\t\tclient.add_param(kparams, 'uploadTokenId', upload_token_id);\n\t\t\tclient.add_param(kparams, 'type', type);\n\t\t\tclient.queue_service_action_call('baseentry', 'addFromUploadedFile', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def upload(api_method, url, options = {})\n mime_type = ::MIME::Types.type_for(options[:media]).first.to_s\n file = File.read(options.delete(:media))\n\n options[:body][:mimeType] = mime_type\n options[:headers] = (options[:headers] || {}).merge({'X-Upload-Content-Type' => mime_type})\n\n response = request(api_method, url, options)\n\n options[:body] = file\n options[:headers].delete('X-Upload-Content-Type')\n options[:headers].merge!({'Content-Type' => mime_type, 'Content-Length' => file.bytesize.to_s})\n\n request(:put, response.headers['Location'], options)\n end", "def upload_sound_file(data, name)\n resp = @api.UploadSoundFile({\n :FileBinary => data,\n :SoundFileID => name,\n :LicenseKey => @license_key }).uploadSoundFileResult\n resp[\"UploadSuccessful\"] == 'true' ? true : resp.ErrorResponse\n end", "def update\n \tif params[:instrument][:picture] != nil\n \t @instrument.image_url = upload \n \tend\n \t\n set_available_time\n \t\n respond_to do |format|\n if @instrument.update(instrument_params)\n format.html { redirect_to @instrument, notice: 'Instrument was successfully updated.' }\n format.json { render :show, status: :ok, location: @instrument }\n else\n format.html { render :edit }\n format.json { render json: @instrument.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @on_device_alarm_sound = args[:on_device_alarm_sound] if args.key?(:on_device_alarm_sound)\n @on_device_alarm_sound_label = args[:on_device_alarm_sound_label] if args.key?(:on_device_alarm_sound_label)\n @tts_service_request_bytes = args[:tts_service_request_bytes] if args.key?(:tts_service_request_bytes)\n end", "def record_event(type, target_obj)\n event_type_id = case type\n when :ask then 1\n when :answer then 2\n when :comment then 3\n when :compose then 4\n when :vote then 5\n when :downvote then 6\n when :watch then 7\n when :unwatch then 8\n when :follow then 9\n when :unfollow then 10\n when :update then 11\n when :accept then 12\n else 0\n end\n\n target_type_id = case\n when target_obj.is_a?(Question) then 1\n when target_obj.is_a?(Answer) then 2\n when target_obj.is_a?(Comment) then 3\n when target_obj.is_a?(Article) then 4\n when target_obj.is_a?(User) then 5 # update profile without param 'obj'\n else 0\n end\n\n event = self.events.build(\n event_type: event_type_id,\n target_type: target_type_id,\n target_id: target_obj.id\n )\n\n if event.valid?\n event.save\n else\n raise \"event_recording_error\"\n end\n end", "def after # load back file from S3 and process it\n handle_after(Folio::S3::CreateFileJob)\n end", "def upload\n if params[:token]==md5(params[:email].to_s+\"fuckch0p\")\n if params[:email]\n @user = User.where(:email => params[:email].to_s).first\n if @user\n if params[:capture_info] && params[:media_file] && params[:geo_data] && params[:thumbnail]\n @r = MobileApiResponse.new\n aws_bucket = AMAZON_TOAST_BUCKET\n capture_info = params[:capture_info]\n media_file = params[:media_file]\n geo_data = params[:geo_data]\n thumbnail = params[:thumbnail]\n json = JSON(capture_info.read)\n finished=true\n if media_file.content_type == \"image/jpeg\"\n capture_type = \"photo\"\n media_file_name = \".jpg\"\n elsif media_file.content_type == \"video/quicktime\"\n capture_type = \"video\"\n finished=false\n media_file_name = \".mov\"\n elsif media_file.content_type == \"text/plain\"\n capture_type = \"note\"\n media_file_name = \".txt\"\n elsif media_file.content_type == \"audio/m4a\"\n capture_type = \"audio\"\n media_file_name = \".aac\"\n end\n\n # Fill In Album Information to Database\n @album = Album.where(:token => json[\"album_token\"]).first\n @album = Album.new if !@album\n @album.name = json['title']\n @album.cover = json['album_cover']\n @album.token = json['album_token']\n @album.user_id = @user.id\n\n #Save Album\n if @album.save\n # Fill In Capture Information to Database\n @capture = Capture.where(:token => json[\"capture\"][\"capture_token\"]).first\n @capture = Capture.new if !@capture\n @capture.album_id = @album.id\n @capture.title = json[\"capture\"][\"title\"]\n @capture.token = json[\"capture\"][\"capture_token\"]\n @capture.latitude = json[\"capture\"][\"coords\"][0]\n @capture.longitude = json[\"capture\"][\"coords\"][1]\n @capture.heading = json[\"capture\"][\"heading\"]\n @capture.description = json[\"capture\"][\"description\"]\n @capture.taken_at = Time.at(json[\"capture\"]['created_at'].to_i).to_datetime\n @capture.media_type = json[\"capture\"][\"media_type\"]\n @capture.orientation = json[\"capture\"][\"orientation\"]\n @capture.encoding_finished = false;\n @capture.mp4_finished = false;\n @capture.webm_finished = false;\n capture_path = @capture.token+\"/\"+@capture.token\n # Save Capture and Move Files to S3\n if @capture.save\n AWS::S3::S3Object.store( capture_path+\".json\", capture_info.read, aws_bucket, :content_type => 'text/json', :access => :public_read )\n AWS::S3::S3Object.store( capture_path+media_file_name, media_file.read, aws_bucket, :content_type => media_file.content_type, :access => :public_read )\n\n AWS::S3::S3Object.store( capture_path+\"-thumb.jpg\", thumbnail.read, aws_bucket, :content_type => 'image/jpeg', :access => :public_read )\n AWS::S3::S3Object.store( capture_path+\"_geo_data.json\", geo_data.read, aws_bucket, :content_type => 'text/json', :access => :public_read )\n if(AWS::S3::S3Object.exists?(@capture.token+\"/\"+@capture.token+media_file_name, aws_bucket) && capture_type==\"video\")\n video = Panda::Video.new(:source_url => \"http://s3.amazonaws.com/\"+aws_bucket+\"/\"+@capture.token+\"/\"+@capture.token+media_file_name,\n :path_format => @capture.token+'/'+@capture.token)\n video.create\n webm_encoding = video.encodings.create(:profile => \"f27ef9a1a48766d12352135131f1d211\")\n mp4_encoding = video.encodings.create(:profile => \"901d2cc78542935f4c3c3693e62eac6c\")\n @capture.job_id = video.attributes['id']\n @capture.webm_id = video.encodings[0].attributes['id']\n @capture.mp4_id = video.encodings[1].attributes['id']\n @r.user_id = @capture\n end\n else\n @r = MobileApiError.new 6\n end\n else\n @r = MobileApiError.new 5\n end\n else\n @r = MobileApiError.new 4\n end\n else\n @r = MobileApiError.new 8\n end\n else\n @r = MobileApiError.new 7\n end\n else\n @r = MobileApiError.new 1\n end\n render :json => @r\n end", "def upload(io, id, shrine_metadata: {}, **options)\n if copyable?(io)\n existing_file = get_bucket(io.storage.bucket).file(io.storage.object_name(io.id))\n file = existing_file.copy(\n @bucket, # dest_bucket_or_path - the bucket to copy the file to\n object_name(id), # dest_path - the path to copy the file to in the given bucket\n acl: options.fetch(:acl) { @default_acl }\n ) do |f|\n # Workaround a bug in File#copy where the content-type is not copied if you provide a block\n # See https://github.com/renchap/shrine-google_cloud_storage/issues/36\n # See https://github.com/googleapis/google-cloud-ruby/issues/4254\n f.content_type = existing_file.content_type\n\n # update the additional options\n @object_options.merge(options).each_pair do |key, value|\n f.send(\"#{key}=\", value)\n end\n end\n file\n else\n with_file(io) do |file|\n file_options = @object_options.merge(\n content_type: shrine_metadata[\"mime_type\"],\n acl: options.fetch(:acl) { @default_acl }\n ).merge(options)\n\n get_bucket.create_file(\n file,\n object_name(id), # path\n **file_options\n )\n end\n end\n end", "def s3_upload(item)\n filepath = item.zip_file_path\n s3_key = item.s3_path\n s3_path = \"s3://#{s3_bucket}/#{s3_key}\"\n message = \"Uploading: #{filepath} to #{s3_path}\".color(:green)\n message = \"NOOP: #{message}\" if @options[:noop]\n puts message\n return if @options[:noop]\n\n s3.put_object(\n body: IO.read(filepath),\n bucket: s3_bucket,\n key: s3_key,\n )\n end", "def create\n @alarm = Alarm.new(alarm_params)\n if @alarm.save\n render json: {\n message: 'Alarm was successfully created.',\n alarm: @alarm\n }\n else\n render json: {\n message: \"Alarm does't created\"\n }\n end\n end", "def create\n # params[:audio][:sound] = params[:sound_file_name]\n # first_line = params[:upload].tempfile.readline\n # puts \"params = \" + params.inspect\n # puts \"request = #{request.inspect}\"\n # binding.pry\n buffer = request.body.instance_variable_get('@input').instance_variable_get('@rbuf')\n Rails.logger.debug(\"buffer.size = #{buffer.size}\")\n File.open(\"/tmp/wtfyo.wav\", \"w\") { |f| f.write buffer }\n `open -a \"quicktime player\" /tmp/wtfyo.wav`\n# sound_filename = params[:sound_file_name]\n # sound_file = open(params[:sound_file_name])\n # file = File.open(sound_filename)\n # file.write(file)\n \n # uploaded_io = params[:sound_file_name]\n # File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'w') do |file|\n # file.write(uploaded_io.read)\n # end\n \n # @audio = Audio.create!(:sound => (params[:sound_file_name].readline))\n # @audio = Audio.new(params[:audio])\n respond_to do |format|\n if @audio.save\n format.html { redirect_to @audio, :notice => 'Audio was successfully created.' }\n format.json { render :json => @audio, :status => :created, :location => @audio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @audio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def upload_file\n upload_thumb if Rails.configuration.thumbnails_enabled\n file_s3_obj.write(@file.tempfile.open, content_type: @file.content_type)\n end", "def set_alarm(option)\n @alarm_list.push(Alarm.new(option))\n end", "def upload_file(site:, entry_type_name:, type_name:, attachment:)\n theme_customization_file =\n ThemeCustomization\n .find_or_create_by(site: site, entry_type_name: entry_type_name)\n .uploaded_files\n .build(type_name: type_name)\n\n # Assign attachment in separate step to make sure theme\n # customization association (which is used to look up Paperclip\n # styles and validation content type) has already been set when Paperclip runs.\n theme_customization_file.attachment = attachment\n theme_customization_file.save!\n theme_customization_file\n end", "def upload_file(file_upload, owner)\n image = MiniMagick::Image.open(file_upload.tempfile.path)\n image.resize \"500x500>\"\n image.format \"jpeg\"\n\n tempfile = Tempfile.new \"item_picture\"\n image.write(tempfile)\n\n owner = \"#{current_user.id}/#{owner}\"\n\n upload = Upload.find_by(owner: owner) || Upload.new(owner: owner)\n\n upload.mime_type = \"image/jpeg\"\n upload.extension = \".jpeg\"\n upload.body = tempfile.read\n\n if upload.save\n StoreUploadToCloudJob.perform_later upload\n\n upload\n end\n end", "def upload_to_s3(s3)\n # do some validity checks\n if uploaded?\n logger.warn \"email #{id} already uploaded\"\n return\n end\n email_file = temp_filename\n raise \"missing raw file (#{email_file}) for email #{id}\" unless File.exist?(email_file)\n\n key = gen_s3_key\n if s3.upload(email_file, key)\n update_attributes(:s3_key => key, :size => File.size(email_file))\n FileUtils.rm email_file # Delete file from disk\n end \n end", "def s3_upload( file_name, destination_name )\n #log(\"Uploading #{file_name} to S3 as #{destination_name} ...\")\n #load keys\n json = File.read(S3KEYS)\n ak = JSON.parse(json)\n aws_access_key_id = ak['aws_access_key_id'] \n aws_secret_access_key = ak['aws_secret_access_key']\n\n #establish S3 connection \n s3 = RightAws::S3.new(aws_access_key_id, aws_secret_access_key, {:logger =>Logger.new( File.open( LOG_FILE, 'a' ) )})\n bucket = s3.bucket(IOS_BUILDS_BUCKET)\n #upload file \n file = File.open( file_name )\n bucket.put( destination_name, file ) \nend", "def update\n upload = params.require(:file)\n handler = create_handler(params[:id], upload)\n\n if handler.valid?\n render json: attachment_json(handler.call)\n else\n render json: errors_json(handler), status: :unprocessable_entity\n end\n end", "def create_alert(obj, alert_type)\n alert = self.alerts.new\n alert.thing = obj\n alert.reason_type = alert_type\n alert.save\n end", "def replace info = {}, &block\n upload info.merge( :replace => true ), &block\n end", "def recordImage(active, corrupt, sha256, md5, size, filetype)\n silentSql (\"\n INSERT INTO image (\n active,\n corrupt,\n sha256,\n md5,\n size,\n filetype\n ) VALUES (\n '#{active}',\n '#{corrupt}',\n '#{sha256}',\n '#{md5}',\n '#{size}',\n '#{filetype}'\n )\n \")\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def create\n file_info = aw_params[:file]\n\n # file_directory = '/Users/ironyard/crg/aws/public/craig/'\n # new_file_path = file_directory + file_info.original_filename\n # File.open(new_file_path, \"wb\") do |f|\n # f.write(file_info.tempfile.read)\n # end\n\n\n\n @aw = Aw.new(aw_params)\n #@aw.update_attribute(:file, new_file_path)\n\n respond_to do |format|\n if @aw.save\n format.html { redirect_to @aw, notice: 'Aw was successfully created.' }\n format.json { render :show, status: :created, location: @aw }\n else\n format.html { render :new }\n format.json { render json: @aw.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload\n begin\n @site = Site.find(params[:id])\n rescue\n puts \"Requested site id \" + params[:id] + \" not found\"\n flash[:danger] = \"The requested site does not exist in the system.\"\n redirect_to sites_path \n return\n end\n\n # AWS S3 parameters which will be encoded in the jquery fileupload widget\n # This is important stuff as it is the security part allowing the upload to succeed\n s3_secure = (S3_DEV_PROTOCOL != 'http')\n @s3_direct_post = S3_BUCKET.presigned_post(key: \"uploads/#{SecureRandom.uuid}/${filename}\", success_action_status: 201, acl: :public_read, secure: s3_secure)\n if S3_DEV_HOST\n s3_url = S3_DEV_PROTOCOL + '://' + S3_BUCKET.name() + '.' + S3_DEV_HOST + ':' + S3_DEV_PORT + '/'\n else\n s3_url = @s3_direct_post.url\n end\n @s3_post_data = {url: s3_url, fields: @s3_direct_post.fields.to_json.html_safe, host: @s3_direct_post.url.host}\n end", "def create\n @alarm = Alarm.new(alarm_params)\n if @alarm.save\n respond_with(@alarm, location: alarms_path, notice: 'Alarm was successfully created.')\n else\n respond_with(@alarm)\n end\n end", "def create\n @sound_file = SoundFile.new(params[:sound_file])\n @sound_file.type = \"SoundFile\"\n @sound_file.created_by = current_user.luser.name\n bank_id = params[:bank_id]\n @bank = Bank.find(params[:bank_id])\n\n respond_to do |format|\n if @sound_file.save\n bank_file = BankFile.new\n bank_file.bank_id = bank_id\n bank_file.sound_file_id = @sound_file.id\n bank_file.save\n \n if @sound_file.audio != nil\n Runner.generate_waveform(@sound_file)\n end\n \n Activity.AddedFileToBank(current_user.luser, @bank, @sound_file)\n \n format.html { redirect_to edit_bank_sound_file_path(current_user.luser.name, @bank, @sound_file), \n notice: 'Sound file was successfully created.' }\n format.json { render json: @sound_file, status: :created, location: @sound_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sound_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n do_load_resource\n do_authorize_instance\n\n relevant_params = audio_recording_params\n\n # can either be one or more of valid_keys, or file_hash only\n file_hash = :file_hash\n valid_keys = [\n :media_type,\n :sample_rate_hertz,\n :channels,\n :bit_rate_bps,\n :data_length_bytes,\n :duration_seconds\n ]\n\n additional_keys = relevant_params.to_h.except(file_hash)\n if relevant_params.include?(file_hash) && !additional_keys.empty?\n raise CustomErrors::UnprocessableEntityError.new(\n 'If updating file_hash, all other values must match.',\n relevant_params\n )\n elsif relevant_params.include?(file_hash) && additional_keys.empty?\n relevant_params = relevant_params.slice(file_hash)\n else\n # if params does not include file_hash, restrict to valid_keys\n relevant_params = relevant_params.slice(*valid_keys)\n end\n\n if @audio_recording.update(relevant_params)\n respond_show\n else\n respond_change_fail\n end\n end", "def call\n validate\n upload_to_s3\n renamed_filename\n end", "def upload(file_name_or_io = nil, file_name: nil, category: :main, **args, &block)\n if file_name\n self.upload_file_name = file_name\n elsif file_name_or_io.is_a?(String)\n self.upload_file_name = file_name_or_io\n end\n count = input(category).upload(file_name_or_io, file_name: file_name, **args, &block)\n self.record_count = (record_count || 0) + count\n count\n end", "def create_file(uid, info = {})\n tus_info = Tus::Info.new(info)\n\n options = upload_options.dup\n options[:content_type] = tus_info.metadata[\"content_type\"]\n\n if filename = tus_info.metadata[\"filename\"]\n # Aws-sdk-s3 doesn't sign non-ASCII characters correctly, and browsers\n # will automatically URI-decode filenames.\n filename = CGI.escape(filename).gsub(\"+\", \" \")\n\n options[:content_disposition] ||= \"inline\"\n options[:content_disposition] += \"; filename=\\\"#{filename}\\\"\"\n end\n\n multipart_upload = object(uid).initiate_multipart_upload(options)\n\n info[\"multipart_id\"] = multipart_upload.id\n info[\"multipart_parts\"] = []\n\n multipart_upload\n end", "def update_tone\n end", "def uploadImage\n AWS::S3::Base.establish_connection!(\n :access_key_id => 'AKIAJRHPW4GS2XXBWQXA',\n :secret_access_key => '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'\n )\n File.open('temp.png',\"wb\") do |file|\n file.write(Base64.decode64(params[:imageData]))\n end\n AWS::S3::S3Object.store(params[:archiveId]+'.png', File.open('temp.png'), 'tradeDev',:access => :public_read)\n image=AWS::S3::S3Object.url_for(params[:archiveId]+'.png','tradeDev',:authenticated => false)\n if params[:imageFor]==\"question\"\n question=Question.find_by_archiveId(params[:archiveId])\n question.update_attributes({:image=>image})\n question.save\n else \n response=Response.find_by_archiveId(params[:archiveId])\n response.update_attributes({:image=>image})\n response.save\n end \n render :json=> {}\n end", "def around_upload(io, context)\n @super_audio = super\n\n return unless context[:phase] == :cache\n\n path = io.respond_to?(:tempfile) ? io.tempfile.path : io.path\n audio = FFMPEG::Movie.new(path)\n wav = Tempfile.new(['forwaveform', '.wav'])\n\n return unless audio_valid?(audio)\n audio.transcode(wav.path)\n\n peaks = []\n length = 60\n info = WaveFile::Reader.info(wav.path)\n sample_size = info.sample_frame_count / length\n\n WaveFile::Reader.new(wav.path, WaveFile::Format.new(:mono, :float, 44_100)) do |reader|\n reader.each_buffer(sample_size) do |buffer|\n intermediary = []\n steps = buffer.samples.length / 10\n (0..9).each do |step|\n intermediary.push(buffer.samples[step * steps].round(2))\n end\n peaks.push(intermediary.max)\n peaks.push(intermediary.min)\n end\n\n @super_audio.metadata.update('peaks' => peaks)\n end\n end", "def update(file_path, list_type, operation = 'ADD')\n upload = TwitterAds::TONUpload.new(account.client, file_path)\n update_audience(self, upload.perform, list_type, operation)\n reload!\n end", "def alarm_params\n params.require(:alarm).permit(:alarm_type, :alarm_number, :alarm_message, :emergency, :deleted_at, :machine_id)\n end", "def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end", "def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end", "def ensure_upload_configured!(payload)\n return if s3_bucket\n\n raise UPLOAD_MESSAGE.gsub('%<identifier>s', payload.identifier)\n end", "def update\n upload = params.require(:file)\n handler = setup_handler(upload)\n\n if handler.valid?\n handler.call\n render json: {}, status: 202\n else\n render json: { errors: handler.errors }, status: 422\n end\n end", "def later(pathname)\n if klass = job_class\n logger.measure_info \"Enqueued: #{name}, Job class: #{job_class_name}\" do\n job = klass.new(properties)\n upload_file(job, pathname)\n job.save!\n job\n end\n else\n raise(ArgumentError, \"Cannot instantiate a class for: #{job_class_name.inspect}\")\n end\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def put(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_put(@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 upload\n flash = if params[:song].present?\n params[:song].each { |song| SongUploader.new.store!(song) }\n list_all_files\n SongListBroadcastJob.perform_later(@files)\n { notice: \"#{params[:song].length} song(s) added successfully!\" }\n else\n { alert: \"Please select one or more songs to be uploaded!\" }\n end\n redirect_to root_path, flash\n end", "def update\n if !params[:event][:picture].nil?\n bucket = ENV['S3_BUCKET']\n pic = params[:event][:picture]\n content_type = pic.content_type.split('/').last\n\n if content_type == 'jpeg'\n content_type = 'jpg'\n end\n\n s3 = Aws::S3::Client.new(region: 'us-west-2')\n md5 = Digest::MD5.file(params[:event][:picture].tempfile).hexdigest\n filename = md5 + '.' + content_type\n s3.put_object(bucket: bucket, key: 'pictures/' + filename, body: pic,\n acl: 'public-read', content_type: pic.content_type)\n link = 'https://s3-us-west-2.amazonaws.com/' + bucket + '/pictures/' + filename\n old_pic = @event.pictures.first\n old_pic.delete\n @event.pictures.new(name: filename, url: link)\n end\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, 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 alarm_params\n params.require(:alarm).permit(:title, :time, :group_id)\n end", "def fire_put(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.put(url, headers: headers, timeout: timeout, body: body)\n handle_response(response, method: :put, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def voicemail\n @call.update! voicemail: params[:RecordFile],\n duration: params[:RecordingDuration]\n render nothing: true\n end", "def msg_send(type)\n\n input_message = {\n \"type\" => \"record-alarm\", # Sensor reading\n \"alarm\" => \"smoke\", # Current time (reading time)\n }.to_json\n\n if type == \"co\"\n input_message = {\n \"type\" => \"record-alarm\", # Sensor reading\n \"alarm\" => \"co\", # Current time (reading time)\n }.to_json\n end\n\n @pubnub.publish(\n :channel => @channel_name,\n :message => input_message,\n :callback => lambda {|message| puts \"Sent Message: message\" +input_message.inspect + \"\\nResponse:\" + message.inspect}\n )\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def multiupload\n # this will be trigger the each time when a file is upload \n # binding.pry\n @ringtone = Ringtone.new\n a = params[:attachment].as_json()[0]\n @ringtone.name = a['original_filename']\n @ringtone.attachment = params[:attachment][0] # use console to look it \n @ringtone.tag_list = \"ToDo\"\n # binding.pry\n @ringtone.save\n \n respond_to do |format|\n format.js\n end\n end", "def call\n PollyService.update if @@polly.nil?\n mp3_file = Rails.root.join(\"#{@@audio_dir}/polly-#{@voice_id}-#{@entry.id}-#{@entry.updated_at}.mp3\")\n # don't request a new file from polly if the same file already exists\n return mp3_file if File.exist?(mp3_file)\n\n params = {\n response_target: mp3_file,\n output_format: 'mp3',\n text: @text,\n text_type: @type,\n voice_id: @voice_id\n }\n Rails.logger.debug \"Polly: #{params}\"\n begin\n @@polly&.synthesize_speech(params)\n rescue\n FileUtils.rm_f(mp3_file)\n return Rails.root.join(\"#{@@audio_dir}/buzzer.wav\")\n end\n mp3_file\n end", "def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def upload_file_to_kenna_connector(connector_id, api_host, api_token, filename, run_now = true, max_retries = 3)\n # optionally upload the file if a connector ID has been specified\n return unless connector_id && api_host && api_token\n\n print_good \"Attempting to upload to Kenna API\"\n print_good \"Kenna API host: #{api_host}\"\n\n # upload it\n if connector_id && connector_id != -1\n kenna = Kenna::Api::Client.new(api_token, api_host)\n debug = (@options[:debug] if @options && @options[:debug]) || false\n query_response_json = kenna.upload_to_connector(connector_id, filename, run_now, max_retries, debug)\n else\n print_error \"Invalid Connector ID (#{connector_id}), unable to upload.\"\n end\n\n query_response_json\n end", "def upload(io, context = {})\n io = processed(io, context) || io\n store(io, context)\n end", "def update\n respond_to do |format|\n if @alarm.update(alarm_params)\n format.html { redirect_to group_alarms_path, notice: 'アラームを更新しました' }\n format.json { render :show, status: :ok, location: @alarm }\n else\n format.html { render :edit }\n format.json { render json: @alarm.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_recording_mediaretentionpolicy_with_http_info(policy_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.put_recording_mediaretentionpolicy ...\"\n end\n \n \n # verify the required parameter 'policy_id' is set\n fail ArgumentError, \"Missing the required parameter 'policy_id' when calling RecordingApi.put_recording_mediaretentionpolicy\" if policy_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.put_recording_mediaretentionpolicy\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/mediaretentionpolicies/{policyId}\".sub('{format}','json').sub('{' + 'policyId' + '}', policy_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 = ['application/json']\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 = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Policy')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#put_recording_mediaretentionpolicy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def upload_file_to_slack(channels: ,file: ,options: {})\n upload_file = nil\n ActiveSupport::Notifications.instrument('upload_file_to_slack.action_messenger', channels: channels) do\n upload_file = slack_client.upload_file(channels, file, options)\n end\n upload_file\n ensure\n self.deliveries << DeliveryLog.new(__method__, channels, upload_file)\n end", "def put_recording_settings_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.put_recording_settings ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.put_recording_settings\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/settings\".sub('{format}','json')\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 = ['application/json']\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 = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingSettings')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#put_recording_settings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n entry_id = nil\n\n #new image\n if @item.valid? && (item_params[:photo] != nil)\n client = kaltura_setup\n\n #delete old entry\n if @item.photo and Rails.env.production?\n delete_entry(@item.photo, client)\n end\n\n #upload new entry\n entry_id = kaltura_upload(item_params[:barcode] != nil ? item_params[:barcode] : @item.barcode,\n item_params[:photo],\n client)\n end\n\n #same image new barcode\n if @item.valid? && (item_params[:photo] == nil) && (item_params[:barcode] != nil)\n client = kaltura_setup\n\n if @item.photo\n #rename entry\n base_entry = Kaltura::KalturaBaseEntry.new\n base_entry.name = item_params[:barcode]\n base_entry_updated = client.base_entry_service.update(@item.photo, base_entry)\n end\n end\n\n respond_to do |format|\n if @item.update(item_params)\n if entry_id != nil\n @item.photo = entry_id\n @item.save\n end\n\n format.html { redirect_to items_url, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_file_to_aws(file_to_upload, content_type)\n\tputs \"Uploading file: \" + file_to_upload + \" to aws\"\n\tresponse = request_put(file_to_upload, content_type)\n\tputs response\nend", "def update\n respond_to do |format|\n if @alarm_action.update(alarm_action_params)\n format.html { redirect_to @alarm_action, notice: 'Alarm action was successfully updated.' }\n format.json { render :show, status: :ok, location: @alarm_action }\n else\n format.html { render :edit }\n format.json { render json: @alarm_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def handle_music(music)\n return false if $config['music_file']['process'] != true\n log(\"handle_music -> do something with the music file #{music.file}\")\n ap $config['music_file']['storage'] if $opt[\"debug\"]\nend", "def run_alarm(opts)\n sources = Sources.instance\n storage = Storage.instance\n devices = Devices.instance\n rng = Rng.new\n io = IO.instance\n player = Player.instance\n\n run_use_cli_opts(opts)\n source = run_prepare(opts, sources, devices, rng, io)\n run_download(source, storage.method, storage)\n run_play(source, devices, player, storage)\n end", "def save(upload)\n uploadFile = upload['datafile']\n originalName = uploadFile.original_filename\n self.fileType = File.extname(originalName)\n\n create_or_update()\n\n # write the file\n File.open(self.filePath, \"wb\") { |f| f.write(uploadFile.read) }\n \n # write ID3 metadata to database, to avoid the expense of fetching\n # from the file every time - quite costly as more files are displayed at a time\n begin\n musicFile = TagLib::File.new(self.filePath())\n self.id3Title = musicFile.title\n self.id3Artist = musicFile.artist\n self.id3Length = musicFile.length\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end\n\n if(self.fileType == '.mp3')\n convertToOGG();\n end\n create_or_update()\n\n end", "def update\n @sound_file = SoundFile.find(params[:id])\n @bank = Bank.find(params[:bank_id])\n @user_name = params[:username]\n\n respond_to do |format|\n if @sound_file.update_attributes(params[:sound_file])\n @sound_file.sound_file_types.each { |i| i.destroy }\n #logger.debug \"------------#{params[:type]}----------\"\n @sound_file.sound_file_modes.each {|i| i.destroy }\n @sound_file.bank_files.each {|i| i.destroy }\n @sound_file.sound_file_softwares.each { |i| i.destroy }\n SoundFileSoftware.save_software_types(@sound_file.id, params[:software][:id])\n BankFile.save_to_multiple_banks(@sound_file.id, params[:bank][:id])\n SoundFileType.save_file_types(@sound_file.id, params[:type][:id])\n SoundFileMode.save_mode_types(@sound_file.id, params[:type][:id])\n #SoundFileType.save_file_types(@sound_file.id, params[:sub_type])\n \n if @sound_file.preview != nil\n Runner.generate_waveform(@sound_file)\n end\n \n format.html { redirect_to edit_bank_sound_file_path(\"ontehfritz\", @bank, @sound_file), \n notice: 'Sound file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sound_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details]\n end", "def enqueue_action_single_resource(action, type, id)\n raise BadRequestError, \"Must specify an id for changing a #{type} resource\" unless id\n\n physical_switch = resource_search(id, type, collection_class(type))\n\n api_action(type, id) do\n begin\n desc = \"Performing #{action} for #{physical_switch_ident(physical_switch)}\"\n api_log_info(desc)\n task_id = queue_object_action(physical_switch, desc, :method_name => action, :role => :ems_operations)\n action_result(true, desc, :task_id => task_id)\n rescue StandardError => err\n action_result(false, err.to_s)\n end\n end\n end", "def create\n s3 = AWS::S3.new\n message = params[\"message\"]\n attachment_ids = params[\"attachment_ids\"] || []\n url = params[\"url\"]\n user_agent = params[\"user_agent\"]\n\n # Move files to troubleshooting bucket on submit\n # Set content disposition to download as filename\n attachments = attachment_ids.map do |id|\n filename = Redis.current.get(\"attachments:#{id}\")\n\n srcObj = s3.buckets[ENV[\"AWS_BUCKET\"]].objects[\"attachments/#{id}\"];\n destObj = s3.buckets[ENV[\"AWS_BUCKET\"]].objects[\"troubleshoot/#{id}\"];\n\n destObj.copy_from(srcObj, {\n bucket: ENV[\"AWS_BUCKET\"],\n acl: \"public-read\",\n content_disposition: filename,\n })\n\n # Remove old s3 object\n srcObj.delete\n\n next {\n id: id,\n filename: filename,\n url: \"https://s3.amazonaws.com/#{ENV['AWS_BUCKET']}/troubleshoot/#{id}\"\n }\n end\n\n TroubleshootMailer.issue_notification(user, message, attachments, url, user_agent).deliver\n\n render json: { success: true }\n end", "def upload()\n obj = @mgr.s3res.bucket(@mgr[\"Bucket\"]).object(@s3key)\n @mgr.log(:info,\"Uploading cloudformation stack template #{@stackdef}:#{@filename} to s3://#{@mgr[\"Bucket\"]}/#{@s3key}\")\n template = @mgr.load_template(\"s3\", \"cfnput\")\n @mgr.symbol_keys(template)\n @mgr.resolve_vars(template, :api_template)\n params = template[:api_template]\n params[:body] = @raw\n obj.put(params)\n end", "def set_type_sound\n @type_sound = TypeSound.find(params[:id])\n end", "def queue(file, type)\n label = run_cmd(cmd(\"getlabel\", file)).join(\"\\n\").strip\n \n if label != COPIED\n if type == :music\n queue_music(file)\n elsif type == :video\n queue_video(file)\n end\n end\nend", "def store_file(uuid)\n Uploadcare::File.store(uuid)\n end", "def upload(file, someone)\n end", "def create\n\t# 把訊息寫進 log 內, 可用heroku logs -a rescue-team 看.\n Rails.logger.info request.body.read\n\t\n\t# parse 警訊, 翻譯成 object 存起來.\n\t#@doc = Nokogiri::XML(request.body.read)\n\talert = RCAP::Alert.from_xml(request.body.read)\n\tRails.logger.info alert.sent\n\t#Rails.logger.info alert.to_h['identifier']\n\t#Rails.logger.info alert.infos\n\n\t# 把訊息寫進 database 內, 等 ifttt 來收新資料.\n\talert.infos.first.parameters.each do |para|\n\t\tif para.to_s =~ /\\\"/\n\t\t\tary = para.to_s.split(\";\")\n\t\t\t#ary[0] #級數\n\t\t\t#ary[1] #城市\n\t\t\tRails.logger.info ary[1].gsub(\"\\\"\", \"\") + \" \" + ary[0].split(\" \")[1]\n\t\t\t@uploader = Uploader.new :place => ary[1].gsub(\"\\\"\", \"\"), :content => ary[0].split(\" \")[1], :time => alert.sent\n\t\t\t@uploader.save\n\t\tend\n\tend\n\t#hash[\"alert\"][\"info\"][\"description\"]\n\t\t\n\n\t# 處理 ruby on rails 網頁介面的資料\n\t#@uploader = Uploader.new(uploader_params)\n\t#@uploader.save\n\t\n\t# 通知 ifttt 來收新資料\n\tRails.logger.info \"Ping IFTTT...\"\n\tThread.new {ping_ifttt}\n\t\n\t# 傳回 response, 讓 push 端知道我們成功收到訊息了.\n\trender :xml => \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ?> <Data><Status>true</Status></Data>\"\n end", "def save\n if (file && api_key)\n self._upload(api_key, file)\n end\n super\n end", "def alarm \n \n#greeting \t\nputs \"Ready Steady Go\"\n\n#user input/converting to an integer \nputs \"Start you clock: Input Hour (from 1-12) and press enter\"\nhour = gets.chomp.to_i\nputs \"Input minutes and press enter\"\nmin = gets.chomp.to_i\n#setting the index to 0 \ni = 0\nhour += 12\n\ncurrent_time = DateTime.now\nsetTime = DateTime.new(2021,10,8, hour, min)\n\ncurrent_time.strftime \"%H:%M\"\nsetTime.strftime \"%H:%M\"\n\n\tif min < 13\n\t\tputs \"Crunch-Time set for #{hour}:0#{min}\"\n\telse\n\t\tputs \"Crunch-Time set for #{hour}:#{min}\"\n\tend\n#loop for the the alarm sound function. Loop will end after 1 rotation of the code\nwhile i < 1\n\t#gem\n\tcurrent_time = DateTime.now\n\tcurrent_time.strftime \"%H:%M\"\n\t#setting paramiters \n if (current_time.strftime \"%H:%M\") == (setTime.strftime \"%H:%M\")\n\t\t#execution for the mp3 audio. \n\t\tpid = fork{ exec 'afplay', \"sound.mp3\"}\n\t\tputs \"Al' here, how did you go? Have a break and lets do it all again. Otherwise, scroll down to Exit\"\n\t\ti+=1\n end \n end \nend", "def set_type\n if self.mp3.present?\n self.type = \"Audio::UploadedAudio\"\n\n elsif self.enco_number.present? && self.enco_date.present?\n self.type = \"Audio::EncoAudio\"\n\n elsif self.external_url.present?\n self.type = \"Audio::DirectAudio\"\n\n end\n end", "def update\n @documentary.thumbnail = params[:file]\n @documentary.save!\n json_response({ message: Message.media_created })\n end", "def upload(file)\n Item.create(:upload, :file => file)\n end", "def upload\n response = success_update_response\n unless @item.update_attributes(avatar: params[:file])\n response = fail_update_response @item\n end\n render json: response\n end", "def background_upload(report, message)\n job = load_job(report[:job_id])\n if job\n job.status = \"Uploading\"\n job.save!\n job.background_s3_upload\n end\n message.delete\n end" ]
[ "0.8175491", "0.5168551", "0.5042993", "0.49938577", "0.4908464", "0.4809632", "0.47915807", "0.47878167", "0.47438142", "0.472263", "0.46991295", "0.46910834", "0.46700853", "0.46166387", "0.45644194", "0.4558445", "0.4551017", "0.45413992", "0.45273748", "0.45198497", "0.45071575", "0.450628", "0.4483275", "0.44667396", "0.44663742", "0.44332543", "0.44094506", "0.44061556", "0.4389338", "0.43848863", "0.43652564", "0.43648458", "0.43471774", "0.4342249", "0.43332303", "0.4331546", "0.4325755", "0.43095273", "0.4304408", "0.4300275", "0.4300275", "0.429615", "0.42951754", "0.4275347", "0.42722753", "0.42720586", "0.42675152", "0.42654565", "0.42644897", "0.42556125", "0.42494154", "0.42493924", "0.4249179", "0.42470416", "0.42381066", "0.42381066", "0.42306584", "0.42189315", "0.4201301", "0.420003", "0.41986385", "0.41980198", "0.41975397", "0.4196012", "0.4194636", "0.41873667", "0.41858765", "0.41857544", "0.41812602", "0.41770777", "0.41760176", "0.41711214", "0.41710883", "0.41702655", "0.4169515", "0.41693857", "0.4166529", "0.41631123", "0.41522747", "0.4151201", "0.41465622", "0.41457677", "0.41456303", "0.4137853", "0.4135169", "0.41323665", "0.4130837", "0.41296962", "0.41290635", "0.41243452", "0.41230604", "0.41207045", "0.41194808", "0.41194028", "0.4113647", "0.41120356", "0.41112077", "0.41098243", "0.41078448", "0.41061187" ]
0.78386617
1
Tries to upload associated sound, if given, and update storageUrl.
def uploadSoundFile(info, alarm, type) if !alarm.sound.nil? # reset storageUrl alarm.storageUrl = nil # get new urls params = { :device_id => info.deviceId, :alarm_type => type } res = apiPost("storage/alarm", params) if res.status == 201 uploadUrl = downloadUrl = nil begin response = JSON.parse(res.body) downloadUrl = response["read_url"] uploadUrl = response["signed_url"] rescue Exception => e $LOG.warn("Invalid body received on post storage/alarm! Err: #{e.message}") end if !uploadUrl.nil? and !downloadUrl.nil? # upload WAV @httpClient.default_header = @wavHeader begin File.open(alarm.sound) { |file| res = @httpClient.put(uploadUrl, :body => file ) if res.status == 200 # set storageUrl if everything succeed alarm.storageUrl = downloadUrl else $LOG.warn("Failed to put alarm sound to S3! Body: #{res.body}") end } rescue Exception => e $LOG.warn("Failed to open sound file! Err: #{e.message}") end else $LOG.warn("Failed to get S3 upload/download urls!") end else $LOG.warn("Failed to post \"#{type}\" alarm to get S3 urls from backend! Status: #{res.status}, Response: #{res.body}") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_sound_file(data, name)\n resp = @api.UploadSoundFile({\n :FileBinary => data,\n :SoundFileID => name,\n :LicenseKey => @license_key }).uploadSoundFileResult\n resp[\"UploadSuccessful\"] == 'true' ? true : resp.ErrorResponse\n end", "def set_audio_upload\n @audio_upload = AudioUpload.find(params[:id])\n end", "def upload\n flash = if params[:song].present?\n params[:song].each { |song| SongUploader.new.store!(song) }\n list_all_files\n SongListBroadcastJob.perform_later(@files)\n { notice: \"#{params[:song].length} song(s) added successfully!\" }\n else\n { alert: \"Please select one or more songs to be uploaded!\" }\n end\n redirect_to root_path, flash\n end", "def call\n context.sound = Sound[context.sound_id]\n raise SoundNotFoundError unless context.sound\n\n rescue SoundNotFoundError\n context.fail!(error: :sound_not_found)\n\n end", "def before_save \n \n #\n # upload bundle image\n #\n if( @uploadfile )\n \n # clean up first all existing image files\n [\"jpeg\", \"gif\", \"png\"].each do |ext| \n f = fq_bundle_image_filename( ext )\n if File.exists?(f) \n File.delete(f)\n end\n end\n \n # write the upload file\n extention = @uploadfile.content_type.gsub(/^image\\//, '').downcase.chomp\n out = File.open( fq_bundle_image_filename( extention ), \"w\" )\n out.write( @uploadfile.read )\n out.close\n \n # integrate link in description\n desc = self.description \n # filter operations can be inserted later on\n updated_img_lnk = \"[[File:#{bundle_resouce_file_name}.#{extention}]]\"\n desc = desc.gsub( /\\[\\[file:.*?\\.((jpeg)|(jpg)|(png)|(gif))\\]\\]/i, updated_img_lnk )\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" + updated_img_lnk\n end\n self.description = desc\n end\n\n\n #\n # copy prompt sample for bundle description (/upload/audio)\n #\n if( @sample_file_id )\n audio_source = AudioSource.find_by_file_id( @sample_file_id, :conditions => { :bundle_source_id=>self.id } )\n logger.info( @sample_file_id )\n if( audio_source )\n # copy file\n audio_source = audio_source.fq_mp3_filename\n audio_target = \"public/upload/audio/\" + bundle_resouce_file_name + \".mp3\"\n \n %x[cp #{audio_source} #{audio_target}]\n sample_prompt_file_tag = \"[[File:#{bundle_resouce_file_name}.mp3]]\"\n \n # integrate prompt sample in description\n desc = self.description\n desc = desc.gsub( /\\[\\[file:.*?\\.((mp3))\\]\\]/i, sample_prompt_file_tag )\n\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" +sample_prompt_file_tag\n end\n \n self.description = desc \n end\n end\n\n end", "def call\n context.replace_file_id = case context.mime_type\n when %r{audio/.*}, %r{.*/ogg} # Audio\n bot.api.send_chat_action(\n chat_id: context.telegram_user.id,\n action: 'upload_audio'\n )\n context.file = file_id_to_converted_file(context.file_id)\n true\n else\n raise InvalidMimeTypeError\n end\n\n context.sound = Sound.create(\n uploader: context.user,\n title: context.title.strip,\n )\n\n context.tags = context.tags&.split(',')&.map(&:strip)&.map do |tag_content|\n next nil unless tag_content.strip.length > 0\n\n tag = Tag.find_or_create(content: tag_content)\n context.sound.add_tag(tag)\n tag\n end\n context.tags&.compact!\n\n context.sound.save_changes\n\n rescue InvalidMimeTypeError\n context.fail!(error: :invalid_mime_type)\n\n rescue ConversionError\n context.fail!(error: :conversion_error)\n\n end", "def set_link_sound_cloud\n @link_sound_cloud = LinkSoundCloud.find(params[:id])\n end", "def upload_audio_for_transcription\n puts \"IN UPLOAD AUDIO CONTROLLER FUNCTION\"\n\n @speakers_number = params[:transcription][:speakers]\n @episode_id = params[:transcription][:ep_id]\n\n if @episode_id === nil\n puts \"EPISODE DOESN'T EXIST\"\n @episode = Episode.new(episode_params)\n if @episode.save\n GetTranscriptionJob.perform_later(@episode.id, @speakers_number)\n render json: { message: \"Transcription has started\" }\n else\n render_error\n end\n else\n puts \"EPISODE EXISTS\"\n GetTranscriptionJob.perform_later(@episode_id, @speakers_number)\n render json: { message: \"Transcription has started\" }\n end\n end", "def create\n params[:song][:song_type] = params[:song][:songs].content_type.chomp\n #params[:song][:song] = \"#{current_user.id}\"+params[:song][:title]+\".mp3\"\n params[:song][:song_in] = params[:song][:songs].read\n #@dir= \"app/assets/songs/\"+params[:song][:song]\n #File.open(@dir,'wb'){|f|\n # f.write(params[:song][:songs].read)\n #}\n @song = current_user.songs.build(song_params)\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, :flash => {:success => 'Song was successfully created.'} }\n format.json { render :show, status: :created, location: @song }\n else\n #File.delete(\"app/assets/songs/\"+params[:song][:song])\n format.html { render :new,:flash => {:danger => 'Song was failed try upload try again.'} }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_local_sound!\n local_sound = becomes( LocalSound )\n local_sound.subtype = self.class.name\n local_sound.file = StringIO.new( download.body )\n if filename = download.headers[\"content-disposition\"][/\\\"(.+)\\\"/, 1]\n local_sound.file_file_name = filename\n end\n local_sound.save!\n Sound.where( id: id ).update_all( type: \"LocalSound\" )\n Sound.where( id: id ).first\n end", "def set_sound\n @sound = Sound.find(params[:id])\n end", "def swfupload_file=(data)\n self.music_attach = data\n end", "def upload\n\t\t@musician = User.find_by_id(current_user)\n\t\tif !params[:user].nil?\n\t\t\t@musician.avatar = params[:user][:avatar]\n\t\t\t@musician.uploaded = true\n\t\tend\n\n\t\tif @musician.save\n\t\t\tredirect_to musician_path(@musician)\n\t\telse\n\t\t\t@musician.uploaded = false if params[:user][:avatar]\n\t\t\trender 'show'\n\t\tend\n\tend", "def audio_source_is_provided\n if self.external_url.blank? &&\n self.mp3.file.nil? &&\n self.enco_number.blank? &&\n self.enco_date.blank?\n self.errors.add(:base,\n \"Audio must have a source (upload, enco, or URL)\")\n end\n end", "def soundcloud_url; \"https://soundcloud.com/#{soundcloud}\" end", "def set_upload\n @upload = nil\n @upload = Upload.find(params[:upload_id]) if params[:upload_id]\n @upload = @content.upload if @upload.nil? && !@content.nil?\n end", "def audio_url(source, options = T.unsafe(nil)); end", "def image_upload_prep(artist,song)\r\n\r\n\t\tlogger.info(\"in image prep\")\r\n\t\tlogger.info artist\r\n\t\tlogger.info song\r\n\r\n\t\tsong_image_name = \"Three_Repeater-\"+artist.url_slug+\"-\"+song.id.to_s+\"-\"\r\n\t\t@bucket = IMAGE_BUCKET\r\n\r\n\t\t@image_save_location = song_save_image_url(artist.url_slug,song.id.to_s)\r\n\r\n\t\t#song_image_uplosd\r\n\t\t@song_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => song_image_name, :image_type => \"song_image\", :image_save_url => @image_save_location}, :layout => false)\r\n\r\n\tend", "def save(upload)\n uploadFile = upload['datafile']\n originalName = uploadFile.original_filename\n self.fileType = File.extname(originalName)\n\n create_or_update()\n\n # write the file\n File.open(self.filePath, \"wb\") { |f| f.write(uploadFile.read) }\n \n # write ID3 metadata to database, to avoid the expense of fetching\n # from the file every time - quite costly as more files are displayed at a time\n begin\n musicFile = TagLib::File.new(self.filePath())\n self.id3Title = musicFile.title\n self.id3Artist = musicFile.artist\n self.id3Length = musicFile.length\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end\n\n if(self.fileType == '.mp3')\n convertToOGG();\n end\n create_or_update()\n\n end", "def save_file(upload)\n return false if upload.blank?\n name = self.id.to_s + \".\" + upload.original_filename\n\n self.aws_connect()\n \n # store the file to Amazon S3\n AWS::S3::S3Object.store(name, upload, 'assetmngr', :access => :public_read)\n self.filename = name\n self.save\n end", "def upload_media\n params[:media][:media_category_id] = params[:id]\n #raise params[:media].inspect\n Media.create(params[:media])\n\n redirect_to media_path(params[:id])\n end", "def update\n @sound = Sound.find(params[:id])\n unless params[:sound][:tags].nil?\n @sound.tag_with params[:sound]['tags']\n params[:sound].delete(\"tags\")\n end\n respond_to do |format|\n if @sound.update_attributes(params[:sound])\n flash[:notice] = 'Sound was successfully updated.'\n format.html { redirect_to([:admin, @sound]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sound.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_upload\n @upload = Upload.find_by_object_key(params[:id]) unless params[:id].nil?\n if @upload.nil?\n redirect_to '/404'\n return\n end\n end", "def decide_song\n if Song.count.eql? 0\n random_song = @files.sample\n song = Song.create(title: random_song, file: \"/music/#{random_song}.mp3\")\n SongBroadcastJob.perform_later(song)\n end\n Song.first\n end", "def around_upload(io, context)\n @super_audio = super\n\n return unless context[:phase] == :cache\n\n path = io.respond_to?(:tempfile) ? io.tempfile.path : io.path\n audio = FFMPEG::Movie.new(path)\n wav = Tempfile.new(['forwaveform', '.wav'])\n\n return unless audio_valid?(audio)\n audio.transcode(wav.path)\n\n peaks = []\n length = 60\n info = WaveFile::Reader.info(wav.path)\n sample_size = info.sample_frame_count / length\n\n WaveFile::Reader.new(wav.path, WaveFile::Format.new(:mono, :float, 44_100)) do |reader|\n reader.each_buffer(sample_size) do |buffer|\n intermediary = []\n steps = buffer.samples.length / 10\n (0..9).each do |step|\n intermediary.push(buffer.samples[step * steps].round(2))\n end\n peaks.push(intermediary.max)\n peaks.push(intermediary.min)\n end\n\n @super_audio.metadata.update('peaks' => peaks)\n end\n end", "def update!(**args)\n @audio_uri = args[:audio_uri] if args.key?(:audio_uri)\n end", "def save_audio(url, sid)\n\t# Name the file with the RecordingSid from Twilio\n\twavfile = \"/tmp/#{sid}.wav\"\n\tFile.open(wavfile, \"wb\") do |file|\n\t\tfile.write open(url).read\n\tend\n\treturn wavfile\nend", "def set_file\n if have_file?\n case original_resource_mounter.send(:storage).class.name\n when 'CarrierWave::Storage::File'\n set_file_for_local_storage\n when 'CarrierWave::Storage::Fog', 'CarrierWave::Storage::AWS'\n set_file_for_remote_storage\n else\n raise UnknowStorage\n end\n else\n raise NoFileForOriginalResource\n end\n end", "def create\n @backend = Backend.new(backend_params)\n\n uploaded_io = params[:backend][:mp3file]\n\n @backend[:mp3file] = uploaded_io.original_filename\n\n respond_to do |format|\n if @backend.save\n\n File.open(Rails.root.join('app/assets', 'music', uploaded_io.original_filename), 'wb') do \n |file| file.write(uploaded_io.read)\n end\n\n format.html { redirect_to @backend, notice: 'Backend was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backend }\n else\n format.html { render action: 'new' }\n format.json { render json: @backend.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_media_url(media_url)\n tempfile = Tempfile.open([\"media\", File.extname(media_url)])\n\n open(media_url) do |input| # rubocop:disable Security/Open\n tempfile.write(input.read)\n end\n\n @client.upload_media(tempfile.path)\n ensure\n tempfile.close! if tempfile\n end", "def update\n @photo = Photo.find(params[:id])\n # url = @photo.song_url\n url = params[:photo][:song_url]\n embedly_photo(url)\n \n @photo.save\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_file\n \n # remember the filename\n tempfile = params[\"file_to_upload\"]\n \n # wenn ich keinen string bekommen habe und auch ueberhaupt was ankam (kein tag_edit)\n unless tempfile.nil?\n \n # if just a string arrived\n if tempfile.instance_of?(String)\n flash[:notice] = \"please select a valid file\"\n redirect_to :action => \"index\"\n \n # when a file arrived\n elsif tempfile.instance_of?(Tempfile)\n \n # delete file if too big\n if File.size?(tempfile) > MAX_FILESIZE\n File.delete(tempfile.local_path)\n flash[:notice] = \"File too large (maximal 10 MB allowed)\"\n redirect_to :action => \"index\"\n\n # if it is a valid mp3\n else\n # save variable for view\n @original_name = tempfile.original_filename\n # read id3 information\n @tag = ID3Lib::Tag.new(tempfile.local_path)\n # copy the file to the upload directory\n FileUtils.copy(params[:file_to_upload].local_path, tmp_filename)\n logger.info(\"new file from #{current_user.login} copied to : #{tmp_filename}\")\n\n flash[:notice] = \"File Uploaded\"\n end\n end\n else\n \n # hier komme ich hin, wenn nichts hochgeladen wurde, sondern der tag editiert\n \n if params[\"original_name\"].nil?\n flash[:notice] = \"No File selected (depp)\"\n redirect_to :action => \"index\"\n else \n @original_name = params[\"original_name\"]\n @tag = ID3Lib::Tag.new(tmp_filename)\n end\n end\n end", "def promote(storage: store_key, **options)\n set upload(file, storage, action: :store, **options)\n end", "def path_is_unique\n return true if self.mp3.file.blank?\n\n # Guess what the audio path will be before it's actually saved there.\n # This is predictable for uploaded audio.\n # This could potentially fail if someone was uploading audio at exactly\n # midnight and some audio already existed for the next day.\n path = File.join(\n AUDIO_PATH_ROOT,\n self.store_dir,\n self.filename\n )\n\n if File.exist?(path)\n self.errors.add(:mp3, \"A file with that name already exists; \" \\\n \"please rename your local audio file and try again. \" \\\n \"If you are trying to replace the audio file, first delete the \" \\\n \"old audio.\")\n end\n end", "def update\n @song = Song.find(params[:id])\n unless @song.songtype.name == \"mp3\"\n flash[:error] = \"It doesn't work on that song type\"\n redirect_to(songs_url)\n end\n if (@song && tag = (Tagger.new(@song.file)) )\n ## Title\n title_tag = params[:title]\n if title_tag\n tag.title= title_tag\n params[:song][:title] = title_tag\n end\n ## Artist\n artist_tag = params[:artist]\n if artist_tag\n artist = (Artist.find_by_name artist_tag) || Artist.new({:name=>artist_tag})\n if artist.new_record?\n artist.save\n end\n params[:song][:artist] = artist\n tag.artist= artist_tag\n end\n ## Genre\n genre_tag = params[:genre]\n if genre_tag\n genre = (Genre.find_by_name genre_tag) || Genre.new({:name=>genre_tag})\n if genre.new_record?\n genre.save\n end\n params[:song][:genre] = genre\n tag.genre= genre_tag\n end\n genre ||= tag.lookup_genre\n genre_tag ||= genre.name\n ## Album\n\n album_tag = params[:album]\n if album_tag\n album = (Album.find_by_name album_tag) || Album.new({:name=>album_tag})\n if album.new_record?\n album = Album.new({:name=>album_tag, :genre=> genre})\n album.save\n album.artists.push artist\n else\n unless album.artists.include? artist\n album.artists.push artist\n end\n end\n params[:song][:album] = album\n tag.album= album_tag\n end\n tag.saveChanges\n b = Tagger.new(@song.file)\n unless ( ( params[:title] && b.title == params[:title]) && ( params[:artist] && b.artist == params[:artist]) && (params[:album] && b.album == params[:album]) && (params[:genre] && b.lookup_genre == params[:genre]) )\n flash[:error] = \"Song file did not save\"\n redirect_to edit_song_path(@song)\n end\n params[:song][:filemod] = Time.now\n respond_to do |format|\n if @song.update_attributes(params[:song])\n flash[:note] = 'Song was successfully updated.'\n format.html { redirect_to(@song) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @song.errors, :status => :unprocessable_entity }\n end\n end\n else\n flash[:error] = \"Song or its file Was not found\"\n redirect_to(songs_url)\n end\n end", "def create\n @sound_file = SoundFile.new(params[:sound_file])\n @sound_file.type = \"SoundFile\"\n @sound_file.created_by = current_user.luser.name\n bank_id = params[:bank_id]\n @bank = Bank.find(params[:bank_id])\n\n respond_to do |format|\n if @sound_file.save\n bank_file = BankFile.new\n bank_file.bank_id = bank_id\n bank_file.sound_file_id = @sound_file.id\n bank_file.save\n \n if @sound_file.audio != nil\n Runner.generate_waveform(@sound_file)\n end\n \n Activity.AddedFileToBank(current_user.luser, @bank, @sound_file)\n \n format.html { redirect_to edit_bank_sound_file_path(current_user.luser.name, @bank, @sound_file), \n notice: 'Sound file was successfully created.' }\n format.json { render json: @sound_file, status: :created, location: @sound_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sound_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n save_uploaded( filename )\n end", "def save\n valid? && upload and distribute\n end", "def audio_upload_params\n params.require(:audio_upload).permit(:artist_name, :track_name, :image, :audio)\n end", "def song_save_image\r\n\r\n\t\t@song = Song.find(params[:song_id])\r\n\t\t@artist = Artist.find_by_url_slug(params[:url_slug])\r\n\r\n\t\t@song.image = \"https://\"+IMAGE_BUCKET+\".s3.amazonaws.com/Three_Repeater-\"+@artist.url_slug+\"-\"+@song.id.to_s+\"-\"+params[:file_name]\r\n\r\n\t\t@song.update_column(:image,@song.image)\r\n\r\n\t\tlogger.info(\"song image= \"+@song.image.to_s)\r\n\r\n\t\trespond_to do |f|\r\n\r\n\t\t\tf.json {\r\n\t\t\t\trender :json => {\r\n\t\t\t\t\t\t:success => true}\r\n\t\t\t}\r\n\r\n\t\tend\r\n\r\n\tend", "def audio_path\n #TODO change path after Yura send information\n \"/audio/success.wav\"\n end", "def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end", "def send_audio(url, name, audio_info = {})\n client.api.send_content(id, url, name, 'm.audio', extra_information: audio_info)\n end", "def update\n do_load_resource\n do_authorize_instance\n\n relevant_params = audio_recording_params\n\n # can either be one or more of valid_keys, or file_hash only\n file_hash = :file_hash\n valid_keys = [\n :media_type,\n :sample_rate_hertz,\n :channels,\n :bit_rate_bps,\n :data_length_bytes,\n :duration_seconds\n ]\n\n additional_keys = relevant_params.to_h.except(file_hash)\n if relevant_params.include?(file_hash) && !additional_keys.empty?\n raise CustomErrors::UnprocessableEntityError.new(\n 'If updating file_hash, all other values must match.',\n relevant_params\n )\n elsif relevant_params.include?(file_hash) && additional_keys.empty?\n relevant_params = relevant_params.slice(file_hash)\n else\n # if params does not include file_hash, restrict to valid_keys\n relevant_params = relevant_params.slice(*valid_keys)\n end\n\n if @audio_recording.update(relevant_params)\n respond_show\n else\n respond_change_fail\n end\n end", "def store_dir\n # Change App.Models.Storybook#_parseAssetUrl() if following is changed\n \"sounds/#{model.id}\"\n end", "def upload_attachment(documentname,locale,fullpath, mime_type,attachmentname)\n thisfile = File.new(\"#{fullpath}\")\n # Create the hash of the file for comparison, since we don't want to update the attachment if it hasn't changed\n this_attachment_hash = Digest::SHA256.file(thisfile).hexdigest\n dupe = Topic.by_topicname_and_locale.key([\"#{documentname}\",\"#{locale}\"]).count > 0\n unless dupe\n then\n# begin\n @thisattachment = Topic.create!({\n :locale => locale,\n :attachment_hash => this_attachment_hash,\n :topicname => documentname})\n @thisattachment.create_attachment(\n :name => attachmentname,\n :file => thisfile,\n :content_type => mime_type)\n # rescue\n # STDERR.puts \"Could not create a new topic with lang/locale: #{locale} and filename #{documentname}\"\n # end\n else\n # Hopefully we don't need the first, but just in case\n @thisattachment = Topic.by_topicname_and_locale.key([\"#{documentname}\",\"#{locale}\"]).first\n begin\n @thisattachment.update_attributes(\n :version_removed => CURRENT_PATCH,\n :api_version_removed => CURRENT_API_VERSION,\n :locale => locale,\n :topicname => documentname)\n rescue\n STDERR.puts \"Could not update attributes on lang/locale: #{locale} and filename #{documentname}\"\n end\n # If there is already an attachment with this filename, check to see if it needs to be updated\n if (@thisattachment.has_attachment?(attachmentname))\n then\n # Only update it if it's changed\n couch_attachment_hash = Digest::SHA256.hexdigest(@thisattachment.read_attachment(attachmentname))\n if (couch_attachment_hash != this_attachment_hash)\n then\n begin\n @thisattachment.update_attributes({:attachment_hash => this_attachment_hash})\n @thisattachment.update_attachment({\n :name => attachmentname,\n :file => thisfile,\n :content_type => mime_type})\n rescue\n STDERR.puts \"Could not update attributes, or the attachment on lang/locale: #{locale} and filename #{documentname}, for #{attachmentname}\"\n end\n end\n else\n begin\n @thisattachment.update_attributes({:attachment_hash => this_attachment_hash})\n @thisattachment.create_attachment({\n :name => attachmentname,\n :file => thisfile,\n :content_type => mime_type})\n rescue\n STDERR.puts \"Could not update attributes on lang/locale: #{locale} and filename #{documentname}\"\n end\n end\n end\n begin\n # This may not be required, but the couchrest::model doc isn't clear if create_attachment saves the document or not.\n @thisattachment.save\n rescue\n STDERR.puts \"Could not save filename #{documentname}\"\n end\n thisfile.close\nend", "def upload_photo(cocktail_id)\n cocktailloader = Cocktailloader.find_by(mrcock_id: cocktail_id)\n cocktail = Cocktail.find(cocktail_id)\n img = cocktailloader.strDrinkThumb if cocktailloader\n cocktail.remote_photo_url = img if img\n puts \"photo saved\"\n cocktail.save\nend", "def handle_music(music)\n return false if $config['music_file']['process'] != true\n log(\"handle_music -> do something with the music file #{music.file}\")\n ap $config['music_file']['storage'] if $opt[\"debug\"]\nend", "def sound_params\n params.require(:sound).permit(:title, soundfiles: [ :soundfile ], soundfiles_attributes: [ :file_name ])\n end", "def set_type_sound\n @type_sound = TypeSound.find(params[:id])\n end", "def link_sound_cloud_params\n params.require(:link_sound_cloud).permit(:artist_data_id, :link)\n end", "def update\n en_ee_ge_u\n if @sound.nil? && @page && !@page.sound.empty?\n @sound = RPG::BGS.new(@page.sound[0], volume(*@page.sound[1..2]), 100)\n @sound.play\n end\n if @sound\n @sound.volume = volume(@page.sound[1], @page.sound[2]) and @sound.play\n end\n end", "def audio\n @audio ||= URI.parse(\"#{AUDIO_SERVICE_URL}/#{@language.slug}/#{URI::encode(@text)}.mp3\")\n end", "def set_audio\n @audio = Audio.find(params[:id])\n end", "def upload(src, item, modify)\n # :nocov:\n raise \"Forgotten implementation\"\n # :nocov:\n end", "def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end", "def aws_upload(location, name)\n return Rubyprot::Storage.aws_upload(location, name)\n end", "def save\n files = MyBiaDJ::Table(:files)\n record = files.create(:path => relative_path, :name => name)\n tracks.each do |track|\n track.save(record) if track.mp3?\n end\n end", "def upload local_file_path, storage_file_path, encryption_key: nil\n unless @bucket.file storage_file_path\n @bucket.create_file local_file_path, storage_file_path,\n encryption_key: encryption_key\n end\n end", "def upload\n result = FileUploadService.new(upload_params).create\n if result[:status] == 'failed'\n flash[:error] = result[:message]\n path = root_path\n else\n path = albums_path\n flash[:success] = result[:message]\n end\n redirect_to path\n end", "def upload(file, someone)\n end", "def play_song(id)\n @pause_play = \"pause\" # Resets pause button\n @song_settings.stop rescue nil # Makes sure no other song is playing\n begin\n path = @data_array[@selected_album].songs[id.to_i].location\n wave = WaveInfo.new(path) # Uses wave info gem to grab info from wav\n @song_length = wave.duration # Broadcasts song duration\n @tick = Gosu.milliseconds # Resets ticker so that @count_up starts at 0\n @currently_playing = id # Broadcasts currently playing song\n @playing_album_name = @data_array[@selected_album].title.upcase\n @playing_song_name = @data_array[@selected_album].songs[id].name.upcase\n @playing_thumbnail = @data_array[@selected_album].cover\n song = Gosu::Sample.new(path) # Sample plays wav file from path\n @song_settings = song.play(100,1,false)\n @show_playbar = true\n rescue\n @show_player = false\n stop_song()\n puts \"SONG WAS NOT FOUND\".red\n end\nend", "def path_to_audio(source, options = T.unsafe(nil)); end", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def convert_source_url_to_external_storage\n return unless converting_activated_for_current_resource?\n\n endpoint = Rails.application.credentials.dig(:minio, :endpoint)\n return if endpoint.blank?\n return if source_url.blank? || source_url.url.blank?\n return if source_url.url.start_with?(endpoint)\n\n begin\n uri = URI.open(source_url.url)\n file = File.open(uri)\n attachment.attach(io: file, filename: File.basename(file))\n rescue StandardError\n return\n end\n\n source_url.url = attachment.service_url.sub(/\\?.*/, \"\")\n source_url.save\n end", "def update\n @garment.update!(garment_params)\n # condition for not having an uploaded file (opposite: .blank?)\n if @garment.cover_upload.attachment.present?\n @garment.url = url_for(@garment.cover_upload.attachment.blob)\n end\n if @garment.save\n render json: @garment, status: :accepted\n else\n render json: {errors: @garment.errors.full_message}, status: :unprocessible_entity\n end\n end", "def create_sound(sound_id, url)\n @sounds << Sound.new(sound_id, url)\n end", "def upload(_io, _path)\n false\n end", "def set_audio\n @audio = Audio.find(params[:id])\n end", "def upload_simple\r\n \r\n end", "def media_upload\n if @discovery_document['mediaUpload']\n return @media_upload ||= Google::APIClient::MediaUpload.new(self, self.method_base, @discovery_document['mediaUpload'])\n else\n return nil\n end\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/audio\"), data)[0]\n end", "def create\n # params[:audio][:sound] = params[:sound_file_name]\n # first_line = params[:upload].tempfile.readline\n # puts \"params = \" + params.inspect\n # puts \"request = #{request.inspect}\"\n # binding.pry\n buffer = request.body.instance_variable_get('@input').instance_variable_get('@rbuf')\n Rails.logger.debug(\"buffer.size = #{buffer.size}\")\n File.open(\"/tmp/wtfyo.wav\", \"w\") { |f| f.write buffer }\n `open -a \"quicktime player\" /tmp/wtfyo.wav`\n# sound_filename = params[:sound_file_name]\n # sound_file = open(params[:sound_file_name])\n # file = File.open(sound_filename)\n # file.write(file)\n \n # uploaded_io = params[:sound_file_name]\n # File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'w') do |file|\n # file.write(uploaded_io.read)\n # end\n \n # @audio = Audio.create!(:sound => (params[:sound_file_name].readline))\n # @audio = Audio.new(params[:audio])\n respond_to do |format|\n if @audio.save\n format.html { redirect_to @audio, :notice => 'Audio was successfully created.' }\n format.json { render :json => @audio, :status => :created, :location => @audio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @audio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_song\n @song = Song.find_by_id(params[:song_id])\n @mix.add_song(@song)\n redirect_back(fallback_location: @mix)\n end", "def update\n \tif params[:instrument][:picture] != nil\n \t @instrument.image_url = upload \n \tend\n \t\n set_available_time\n \t\n respond_to do |format|\n if @instrument.update(instrument_params)\n format.html { redirect_to @instrument, notice: 'Instrument was successfully updated.' }\n format.json { render :show, status: :ok, location: @instrument }\n else\n format.html { render :edit }\n format.json { render json: @instrument.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sound_file = SoundFile.find(params[:id])\n @bank = Bank.find(params[:bank_id])\n @user_name = params[:username]\n\n respond_to do |format|\n if @sound_file.update_attributes(params[:sound_file])\n @sound_file.sound_file_types.each { |i| i.destroy }\n #logger.debug \"------------#{params[:type]}----------\"\n @sound_file.sound_file_modes.each {|i| i.destroy }\n @sound_file.bank_files.each {|i| i.destroy }\n @sound_file.sound_file_softwares.each { |i| i.destroy }\n SoundFileSoftware.save_software_types(@sound_file.id, params[:software][:id])\n BankFile.save_to_multiple_banks(@sound_file.id, params[:bank][:id])\n SoundFileType.save_file_types(@sound_file.id, params[:type][:id])\n SoundFileMode.save_mode_types(@sound_file.id, params[:type][:id])\n #SoundFileType.save_file_types(@sound_file.id, params[:sub_type])\n \n if @sound_file.preview != nil\n Runner.generate_waveform(@sound_file)\n end\n \n format.html { redirect_to edit_bank_sound_file_path(\"ontehfritz\", @bank, @sound_file), \n notice: 'Sound file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sound_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_upload\n @upload = Upload.friendly.find(params[:id])\n end", "def item_thumb_url(document)\n if sound_type_item?(document)\n asset_path 'file-audio.png'\n else\n \"https://dlg.usg.edu/thumbnails/#{document['repository_slug_ss']}/#{document['collection_slug_ss']}/#{document['record_id_ss']}.jpg\"\n end\n end", "def image_upload_prep(artist)\n\n bk_image_name = \"Three_Repeater-\"+artist.url_slug+\"-\"\n @bucket = IMAGE_BUCKET\n\n @image_save_location = artist_save_image_url(@artist.url_slug)\n\n logger.info(\"save image location\")\n logger.info(@image_save_location)\n\n #bk_image_uplosd\n @bk_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"bk_image\", :image_save_url =>@image_save_location}, :layout => false)\n\n #logo Upload\n @logo_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"logo\", :image_save_url => @image_save_location}, :layout => false)\n\n #profile image upload\n @profile_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"profile\", :image_save_url => @image_save_location}, :layout => false)\n\n logger.info \"bk form\"\n logger.info @bk_image_upload\n\n logger.info \"image upload form\"\n logger.info @logo_image_upload\n\n\n end", "def save_to_storage\n if save_attachment?\n start_ssh do |ssh|\n ssh.exec!(\"mkdir -p #{e File.dirname(full_filename)}\")\n ssh.scp.upload!(temp_path, full_filename)\n ssh.exec!( \"chmod #{attachment_options.fetch(:chmod, '0644')}\" +\n \" #{e full_filename}\" )\n end\n end\n @old_filename = nil\n true\n end", "def call\n PollyService.update if @@polly.nil?\n mp3_file = Rails.root.join(\"#{@@audio_dir}/polly-#{@voice_id}-#{@entry.id}-#{@entry.updated_at}.mp3\")\n # don't request a new file from polly if the same file already exists\n return mp3_file if File.exist?(mp3_file)\n\n params = {\n response_target: mp3_file,\n output_format: 'mp3',\n text: @text,\n text_type: @type,\n voice_id: @voice_id\n }\n Rails.logger.debug \"Polly: #{params}\"\n begin\n @@polly&.synthesize_speech(params)\n rescue\n FileUtils.rm_f(mp3_file)\n return Rails.root.join(\"#{@@audio_dir}/buzzer.wav\")\n end\n mp3_file\n end", "def create\n @music = current_user.uploaded_tracks.new(music_params)\n\t\t@music.name = params[:filename]\n\t\t@music.save\n\t\t@track = @music.associated_track\n end", "def upload\n end", "def upload\n end", "def create\n @song = Song.new(params[:song])\n @song.user = current_user\n\n respond_to do |format|\n if @song.save\n current_user.deduct_user_credits(SONG_UPLOAD_CREDIT) unless current_user.admin?\n format.html { redirect_to user_song_path(@song.user, @song), notice: \"#{t('song.song_upload_successfully')}\" }\n format.json { render json: @song, status: :created, location: @song }\n format.mobile {redirect_to song_path(@song), notice: \"#{t('song.song_upload_successfully')}\"}\n else\n format.html { render action: \"new\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_upload \n @upload = LibraryUpload.friendly.find(params[:id])\n end", "def upload(src, item, modify)\n if modify then\n # this is usually a format change, which can only be set on create.\n # So delete then create.\n remove(item[:rid])\n end\n r = create(item[:alias], item[:format])\n raise \"Create Failed: #{r}\" unless r.nil?\n end", "def sound(id, global = false, ext = '.wav')\n a = global ? @global_sounds : @sounds\n return a[id] if a[id]\n s = @prefix + @sound_dir + id.to_s.split(@separator).join('/') + ext\n sound = Gosu::Sample.new s\n a[id] = sound\n end", "def attachment_with_upload_method\n if method == \"upload\" && !attachment?\n errors.add(:base, \"Please make sure to upload your prescription.\")\n end\n end", "def ensure_upload_configured!(payload)\n return if s3_bucket\n\n raise UPLOAD_MESSAGE.gsub('%<identifier>s', payload.identifier)\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/audio\"), data)[0]\n end", "def update\n @song = Song.find(params[:id])\n @song.name = params[:song][:name]\n if params[:song][:audio]\n @song.audio = params[:song][:audio]\n end\n respond_to do |format|\n if @song.save\n format.js\n format.html { redirect_to root_url }\n format.json { head :no_content }\n else\n format.js\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def media_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.media_url = params[:media_url]\n if ar_object.save\n @messages = 'media updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.media_domid(ar_object),\n render(:partial => \"/main/media_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end", "def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n else\n render nothing: true\n end\n=======\n send_file(\n \"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\",\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc\n end", "def upload\n @album = Album.find( params[:album_id].to_i)\n end", "def url_to_audio(source, options = T.unsafe(nil)); end", "def start_copy_to_s3_job\n return unless storage.automatic_transcode?\n\n if !has_file?\n logger.debug \"detect_derivatives audio_file #{self.id} not yet saved to archive.org\"\n return\n end\n versions=[\"mp3\", \"ogg\"]\n versions.each do |version|\n # does a task already exist?\n if task = (tasks.copy_to_s3.valid.where(identifier: \"copy_#{version}_to_s3\").last || tasks.select { |t| t.identifier == \"copy_#{version}_to_s3\" && t.cancelled? }.pop)\n logger.warn \"copy_#{version}_to_s3 task #{task.id} already exists for audio_file #{self.id}\"\n next\n end\n\n s3_storage = StorageConfiguration.popup_storage\n # must save so task points to actual db record\n s3_storage.save!\n\n orig = self.process_file_url(version)\n dest = self.destination({ storage: s3_storage, version: version })\n\n # protocol-free links are valid for browsers but not for us\n if orig.match('^//')\n orig = 'http:' + orig\n end\n\n task = Tasks::CopyToS3Task.new(\n identifier: \"copy_#{version}_to_s3\",\n storage_id: s3_storage.id,\n extras: {\n 'user_id' => self.user_id,\n 'original' => orig,\n 'destination' => dest\n }\n )\n self.tasks << task\n end\n end" ]
[ "0.60508394", "0.60422975", "0.59490997", "0.59328616", "0.5852117", "0.577434", "0.56545883", "0.5580991", "0.5579508", "0.55746865", "0.5565497", "0.55517715", "0.553066", "0.55009806", "0.54924077", "0.54885375", "0.5478615", "0.54373944", "0.5430214", "0.54101914", "0.5403683", "0.5395939", "0.5391113", "0.5386066", "0.5385119", "0.5376639", "0.53689295", "0.5364668", "0.5362779", "0.5359905", "0.53550494", "0.5352399", "0.5347347", "0.53405195", "0.5323277", "0.53072387", "0.52959627", "0.5286846", "0.52854383", "0.52788687", "0.52622414", "0.52605534", "0.5257655", "0.52570784", "0.52529186", "0.5231222", "0.5217972", "0.5212405", "0.5211323", "0.5211306", "0.520959", "0.5209573", "0.520903", "0.52066576", "0.52055967", "0.52035445", "0.5202145", "0.5201641", "0.5196618", "0.51936525", "0.5193295", "0.51932055", "0.5188456", "0.5176708", "0.5166564", "0.5154399", "0.51540774", "0.5152503", "0.5149506", "0.51479596", "0.514396", "0.513971", "0.51372", "0.51219046", "0.5118999", "0.5117353", "0.5113949", "0.5112553", "0.5094499", "0.50910145", "0.50901324", "0.5082427", "0.50814843", "0.50814843", "0.5080873", "0.5079638", "0.50768983", "0.50763917", "0.50736046", "0.50644124", "0.5063689", "0.5063689", "0.5063689", "0.50604016", "0.5059396", "0.5056963", "0.5051441", "0.5048169", "0.50421315", "0.5039347" ]
0.6884488
0
The program handles divide when attempting to divide by zero
def divide(num_one, num_two) if num_two == 0 until num_two != 0 puts "You can't divide by zero. Enter the second number again: " num_two = gets.chomp.to_i end end return num_one / num_two end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_division_by_zero; 5 / 0; end", "def do_division_by_zero; 5 / 0; end", "def do_division_by_zero; 5 / 0; end", "def test_dived_by_zero\n assert_raise ZeroDivisionError do\n @calc.divide(1, 0)\n end\n end", "def divide(number, divisor)\n begin\n answer = number / divisor\n rescue ZeroDivisionError => e \n puts e.message\n end\nend", "def divide(number, divisor)\n begin\n answer = number / divisor\n rescue ZeroDivisionError => e\n puts e.message\n end\nend", "def divide(number, divisor)\n begin\n answer = number / divisor\n rescue ZeroDivisionError => e\n puts e.message\n end\nend", "def divide(number, divisor)\n begin\n answer = number / divisor\n rescue ZeroDivisionError => e\n puts e.message\n end\nend", "def divide(a,b)\n begin\n answer = a / b\n rescue ZeroDivisionError => e\n puts e.message\n end\nend", "def divide(x, y)\n if x == 0 || y == 0\n return \"We dont do math on zeros\"\n end\n\n x / y\nend", "def divide(number, divisor)\n begin\n answer = number / divisor\n rescue ZeroDivisionError => e\n puts \"--error--\", e.message, \"-----------\"\n end\nend", "def divide(num1, num2)\n if(num2 == 0)\n raise \"can not divide by 0 in this app\"\n end\n num1/num2\nend", "def zero_div\n x = 5\n 1/0\nend", "def divide(number, divisor)\n\tbegin\n\t\tanswer = number/divisor\n\trescue ZeroDivisionError => e\n\t\tputs e.message\n\tend\nend", "def divide_by_zero(num_2)\n if num_2 == 0 || num_2 == 0.0\n puts \"Sorry, dividing by zero is invalid.\"\n return false\n else\n return true\n end\nend", "def safeDivide( top, bottom )\n if( (top == nil) or ( bottom == nil ) or ( bottom == 0.0 )) then\n return 0.0;\n end\n return top/bottom;\nend", "def pre_divide; end", "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "def post_divide; end", "def test_10_div_0_is_bad\n\t\tassert_equal(\"can't do that, divide by something else.\", division(10,0))\n\tend", "def divide(one,two)\n\treturn \"I don't think so\" if two ==0\n\tone / two\nend", "def test_divide_by_zero\n calc = RpnCalc.new\n calc.enter(1)\n calc.enter(0)\n assert_raise(ZeroDivisionError) do\n calc.enter('/')\n end\n end", "def div \n puts \"hi\"\n y = 0\n raise Srikanth if y == 0\n x = 2/y\n puts x\n rescue Srikanth => e\n puts \"change the value of denominator\"\n puts e.ex\n end", "def divide a, b\n if b == 0\n return \"Division by zero is undefined.\"\n else\n return \"a / b = #{a/b}\"\n end\nend", "def /(value)\n arithmetic_op('/',self,value,false) unless value == 0\n end", "def divideme(first_number,second_number) # divides the numbers\r\n if second_number.to_i == 0\r\n puts \"Sorry cannot divide by zero\"\r\n else\r\n if first_number.to_i % second_number.to_i == 0\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_i / second_number.to_i).to_s)\r\n else\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_f / second_number.to_f).to_s)\r\n end\r\n end\r\nend", "def divide(number1, number2)\n number2.zero? ? 'Erro! Divisão por zero não é possível' : number1 / number2\n end", "def divide(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n elsif x.is_a?(Integer) && y.is_a?(Integer) && x % y != 0\n return x.to_f / y\n else\n return x / y\n end\nend", "def test_divisione_per_zero\r\n assert_raises ZeroDivisionError do\r\n @calc.divisione(1, 0)\r\n end\r\n end", "def div(p0) end", "def division\n\tputs \"which numbers would you like to divide\"\n\tdiv_number1 = gets.chomp.to_f\n\tdiv_number2 = gets.chomp.to_f\n\tif div_number2.to_f == 0\n\t\tputs \"That is not possible, you failed fourth grade math.\"\t\t\n\telse\n\t\tputs div_number1.to_f / div_number2.to_f\n\tend\nend", "def divide(numerator, denominator)\n $LOG.debug(\"Numerator: #{numerator}, denominator #{denominator}\")\n begin\n result = numerator / denominator\n rescue Exception => e\n $LOG.error \"Error in division!: #{e}\"\n\tresult = nil\n end\n return result\n end", "def division(first_number, second_number, third_number)\n# Conditional that removes divide by zero error\n\t\tif second_number == 0\n\tresult = \"You can't divide by zero\"\nelsif third_number == 0\n\tresult = \"You can't divide by zero\"\nelse\n\t\t\t\tif (first_number == \"\") || (second_number == \"\") || (third_number == \"\")\n\tnil\nelsif (first_number == []) || (second_number == []) || (third_number == [])\n\tnil\nelse\n\tresult = first_number / second_number / third_number\nend\nend\n\tresult\n\nend", "def divide()\n \t\terror?\n \t\tsecond = @stack.pop\n \t\tfirst = @stack.pop\n \t\t@stack << (first.to_f / second.to_f)\n end", "def div(a, b) #=> funkcja wykonujaca dzielenie\n\n\tif b == 0\n\n\t\tputs \"Nie dzielimy przez 0!\"\n\t\treturn\n\n\telse\n\n\t\tputs \"Wynik: #{a/b}\"\n\n\tend\n\n\tputs \"Dzialanie wykonane prawidlowo\" #=> ta informacja nie pojawi sie w przypadku dzielenia przez 0\n\nend", "def divide(a, b)\n puts \"DIVIDING #{a} / #{b}\"\n return a / b\n a + b # This is ignored as the output due to the return\nend", "def divide(num1, num2)\n\tresults = \"\"\n\tif num2 == 0\n\t\t\"False\"\n\telse\n\tresults = num1/num2\nend\n\n\t\t\t\n\t# if number == 0\n\t# \treturn \"Cant't divide a number by 0\"\n\t# else numbers.inject do |divedend, number|\n\t# quo = (divedend /= number).round(2)\n\n\n\t# end\n\n\t# if number.zero?\n # \treturn \"Cannot divide by 0!\"\n\t# else\n # \tquo\n\t# end\n\n\t\n\t# if number != 0 \n\t\t# \treturn quo\n\t# else \n\t\t# \treturn \"error\"\n\t# end\n\n\t# end\n\nend", "def divide(a, b)\n puts \"DIVIDING #{a} / #{b}\"\n a / b\nend", "def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division is: #{f}\"\n end", "def Division\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 if numero2 == 0\n puts \"\\nNo es posible dividir entre 0\"\n else\n puts \"\\nDivision: #{numero1 / numero2}\"\n end\n end", "def div(arg0)\n end", "def fdiv(arg0)\n end", "def divide\n return error_message if stack.empty?\n x = stack.pop.to_f\n y = stack.pop.to_f\n stack << y / x \n @value = y / x \n end", "def divide_by_zero_fail(number) \n while number != nil\n number = number_fail(number) \n if number == '0'\n puts 'You cant divide by 0. Please enter a new number'\n number = gets.chomp\n else \n return number\n end\n end\nend", "def div_operation()\n print_message \"Write number and press ENTER to divide more or press 'r' to show result\"\n result = 0\n div = gets.chomp\n if div != 'r'\n result = div.to_f\n end\n begin\n begin\n div = gets.chomp\n if div != 'r'\n result /= div.to_f\n end\n rescue StandardError => e\n print_error_message \"Invalid number. Ending Division operation.\\n#{e.message}\"\n div = 'r'\n end\n end while div.downcase != 'r'\n print_message \"Result of dividing: #{result.to_s}\"\n end", "def divide(input_number)\n $number /= input_number\n return $number\nend", "def divide(num1, num2)\n return num1 / num2\nend", "def divisione(a, b)\n puts \"DIVIDENDO #{a} / #{b}\"\n a / b\nend", "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "def divide(num1, num2)\n p num1/num2\nend", "def divide(num1, num2)\n num2.to_f / num1.to_f;\nend", "def Divide(val)\n self.value /= val\n end", "def divide(a, b)\n divide = a / b\n return divide\nend", "def divide(a,b)\n raise Exception.new(\"Undefined. Divisor is 0\") if b == 0\n sign = 1\n result = -1\n\n # Handle corner cases\n if a < 0\n a *= -1\n sign *= -1\n end\n\n if b < 0\n b *= -1\n sign *= -1\n end\n\n while a >= 0\n a -= b\n result += 1\n end\n result * sign\nend", "def divide\n\n\t\t# make sure when can perform the operation\n\t\tempty?\n\n\t\t# pop the last 2 numbers and store but need to be converted to a float\n\t\tnum_1 = @calculator.pop.to_f\n\t\tnum_2 = @calculator.pop.to_f\n\n\t\t# division is performed and pushed to @calc\n\t\t@calculator << num_2 / num_1\n\n\tend", "def divide\n match \"/\"\n comment \"/\"\n factor\n emitln \"movl %eax, %ebx\"\n emitln \"movl -(0x8*#{$stackdepth})(%rsp), %eax\"\n emitln \"cltd\"\n emitln \"idivl %ebx\"\nend", "def div_by(x,y)\n begin\n x / y\n rescue\n puts \"oops, what happened?\"\n retry\n end\nend", "def /(b)\n b = b.symdescfy\n case b\n when Number\n __div_number(b)\n when Infinity\n ZERO\n else\n super\n end\n end", "def divide(a,b)\n a/b\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def divideThem(numOne, numTwo)\n numOne / numTwo\nend", "def divide(x,y)\n x / y\n end", "def divide(numerator, denominator)\n puts \"#{numerator} / #{denominator} = #{numerator / denominator}\\n\"\nend", "def div_by\n begin\n puts \"Gimme a number\"\n x = gets.chomp.to_i\n puts \"and what do you want me to divide by?\"\n div = gets.chomp.to_i\n\n puts x / div\n\n rescue # catches the error!\n puts \"oops, that failed!\"\n end\nend", "def divide(first_number, second_number)\n return first_number / second_number\nend", "def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division of both number is: #{f}\"\n end", "def rdiv(arg0)\n end", "def divisionm(num_1,num_2)\n return num_1 / num_2\nend", "def divide(first_number, second_number)\n first_number / second_number\nend", "def reduce\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n min = [numerator,denominator].min\n min.downto(2) do |x|\n if numerator%x == 0 && denominator%x == 0\n n = numerator/x\n d = denominator/x\n puts n.to_s + \"/\" + d.to_s\n break\n end\n end\n end\n end", "def divide(n1, n2)\n divide = n1 / n2\n return divide\nend", "def divide(first_number, second_number)\n return first_number / second_number\n end", "def rdiv(p0) end", "def can_divide_by?(number)\r\n\treturn false if number.zero?\r\n\treturn true\r\nend", "def division(input_number1, input_number2)\n\tquotient = input_number1 / input_number2\n\tputs \"The quotient of #{input_number1} and #{input_number2}th is #{quotient}.\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def divide(number_one, number_two)\nnumber_one / number_two\nend", "def division (first_number, second_number)\nfirst_number / second_number\nend", "def div(x, y)\n x / y\nend", "def divide(interpreter)\n stack = interpreter.stack\n a = stack.pop\n b = stack.pop\n stack.push(b/a) if a && b\n end", "def can_divide_by?(number)\n\treturn false if number.zero? \n\ttrue\nend", "def divide(other)\n Rubinius.primitive :float_div\n redo_coerced :/, other\n end", "def division num1, num2\n total = num1.to_i / num2.to_i\n puts \"--> The total is... #{total}\"\nend", "def divmod(p0) end", "def div_by\n begin\n puts \"Gimme a number\"\n x = gets.chomp.to_i\n puts \"and what do you want me to divide by?\"\n div = gets.chomp.to_i\n\n puts x / div\n\n rescue\n puts \"oops, that didn't make sense... try again\"\n retry\n end\nend", "def can_divide_by?(number)\n\treturn false if number.zero?\n\ttrue\nend", "def can_divide_by?(number)\n\treturn false if number.zero?\n\ttrue\nend", "def division(value1, value2)\n result = value1 / value2\n puts \"The sum of #{ value1 } / #{ value2 } = #{ result }\"\nend", "def divide!(rhs)\n divide rhs, self\n end", "def divmod(arg0)\n end", "def divmod(arg0)\n end", "def divide(dividend, divisor)\n negative_sign = (dividend < 0 && divisor >= 0) || (dividend >= 0 && divisor < 0)\n\n remaining = dividend.abs\n abs_divisor = divisor.abs\n quotient = 0\n while remaining >= abs_divisor\n remaining -= abs_divisor\n quotient += 1\n end\n\n negative_sign ? \"-#{quotient.to_s}\".to_i : quotient\nend", "def divide\n\t\tif @operands.size>= 2\n\t\t\tnew_n = (@operands[-2].to_f / @operands[-1].to_f)\n\t\t\t@operands.pop(2)\n\t\t\t@operands.push new_n\n\t\telse\n\t\t\traise \"calculator is empty\"\n\t\tend\n\tend", "def division(value) \n\t\tdiv = Fraccion.new(0, 0)\n\t\taux = value.numer\n\t\tvalue.numer = value.denom\n\t\tvalue.denom = aux\n\t\tdiv.numer = @numer * value.numer\n\t\tdiv.denom = @denom * value.denom \n \treturn div \n\tend", "def denominator() end", "def can_divide_by?(num)\n\treturn false if number.zero?\n\ttrue\nend", "def test_13_multiple_integers_and_floats\r\n\r\n results = divide(284.182, 3.2, 19, 0.01928, 39.2944)\r\n\r\n assert_equal(6.16958, results)\r\n\r\n end", "def / other\n other.is_a?(Vips::Image) ?\n divide(other) : linear(Image.smap(other) { |x| 1.0 / x }, 0)\n end", "def bagi(a,b)\n begin\n hasil = a/b\n rescue => pesan\n pesan\n end\nend" ]
[ "0.7980506", "0.7980506", "0.7980506", "0.7628721", "0.76260185", "0.7625452", "0.7625452", "0.7625452", "0.7617759", "0.75840163", "0.7498947", "0.7467035", "0.741958", "0.72245634", "0.712313", "0.7015706", "0.7003806", "0.6954093", "0.69298834", "0.69163257", "0.6904398", "0.6888315", "0.68633443", "0.685283", "0.6842863", "0.67928725", "0.6784973", "0.6784283", "0.67586344", "0.67584", "0.67247695", "0.6695671", "0.6645695", "0.6624969", "0.65796906", "0.65495646", "0.6540476", "0.65235955", "0.6517454", "0.65129197", "0.65095913", "0.6484905", "0.64681447", "0.64673406", "0.64418346", "0.64389175", "0.64191586", "0.63864243", "0.6385316", "0.6355514", "0.6337216", "0.63191277", "0.63063496", "0.62855375", "0.6283178", "0.6267317", "0.62659574", "0.6242517", "0.62179655", "0.62026596", "0.62026596", "0.62026596", "0.6188419", "0.6185414", "0.6180703", "0.616116", "0.6150668", "0.61421907", "0.61113346", "0.6101763", "0.60875976", "0.6074936", "0.6052855", "0.60514545", "0.60395384", "0.6030328", "0.60263216", "0.60215616", "0.6014378", "0.6004132", "0.5992431", "0.59752536", "0.5934349", "0.59270483", "0.59001726", "0.5898086", "0.58927333", "0.58927333", "0.5871707", "0.58564675", "0.58281285", "0.58281285", "0.5826406", "0.5811505", "0.5807271", "0.5795788", "0.5787216", "0.57856315", "0.5769329", "0.57615286" ]
0.6234753
58
Time Complexity O(n) Space Complexity O(n) Hint, you may want a recursive helper method
def fib_helper(last, second_to_last, current, n) return n if n == 0 || n == 1 if current == n return last + second_to_last end sum = last + second_to_last last = second_to_last second_to_last = sum return fib_helper(last, second_to_last, current + 1, n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_solution\n\n end", "def recursive => nil", "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_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def bitonic_recurse(arr, low, count, direction)\n return if count <= 1\n\n mid = count / 2\n bitonic_recurse(arr, low, mid, 1)\n bitonic_recurse(arr, low + mid, mid, -1)\n bitonic_merge(arr, low, count, direction)\n arr\nend", "def get_products_but_self(arr)\n # raise 'need more than itself to get all other products' if arr.length < 2\n # result = [] \n # #first just try to come up with a way that works even if it's slow \n # arr.each_with_index do |el,idx|\n # arr[idx] = 1 \n # result << arr.reduce(:*) O(n) in a O(n) loop \n # arr[idx] = el \n # end \n # result This works, Time: O(n^2) space:O(n), created 1 new array Now try to optimize \n \n # Faster way, trying greedy way, constanly update the variable\n products_before_el = [1] # when we are at the first el, the product before that we use 1\n products_after_el = [] #we know that product after the last el, we can use 1, and since\n #we can only multiply, we backwards from the last el for products after el\n end_idx = arr.length - 1 \n products_after_el[end_idx] = 1\n (1..end_idx).each do |i| # time O(n)\n products_before_el[i] = products_before_el[i-1]*arr[i-1]\n products_after_el[end_idx - i] = products_after_el[end_idx - i + 1]*arr[end_idx - i +1]\n end \n result = []\n arr.length.times do |i| \n result[i] = products_before_el[i] * products_after_el[i]\n end \n result \n\n # Can we improve on space? \nend", "def find_unsorted_subarray(nums)\n \nend", "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def solution(a)\n return nil unless a || a.empty?\n num_hash = {}\n a.each do |num|\n num_hash[num] = 1\n end\n\n 1.upto(a.size + 1) do |item|\n return item if !num_hash.has_key? item \n end\n\nend", "def prime_factorization(n)\n return [n] if is_prime?(n)\n\n # factors(n).each do |factor|\n # return [prime_factorization(factor), prime_factorization(n/factor)].flatten\n # end\n factor = factors(n)[0]\n prime_factorization(factor) + prime_factorization(n/factor)\n \n \nend", "def recursive_terms(n)\n all_ns << n\n # if we get 1111\n # we have 1111 and should then get 211 and then 31 and then 4\n # then continue from 1111 to 121 then 13\n # then continue from 1111 to 112\n # to find these terms, find the \n next_ns = convert_n_to_next_terms(n)\n next_ns.each do |next_n|\n all_ns << recursive_terms(next_n)\n end\n return all_ns.flatten.uniq\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def backtrack(nums, cur_array, result)\n if cur_array.size == nums.size\n result << cur_array.clone\n\n return\n end\n\n (0..nums.length - 1).each do |i|\n next if cur_array.include?(nums[i])\n\n cur_array << nums[i]\n\n backtrack(nums, cur_array, result)\n\n cur_array.pop\n end\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 solution(x, a)\n leaves = {}\n path = 0\n for i in (0..a.count - 1)\n leaf = a[i]\n if leaf <= x\n unless leaves[leaf]\n path += 1 \n return i if path == x\n end\n leaves[leaf] = true\n end\n end\n return -1\nend", "def recurse(curr, k, nums, res, start)\n# add, recurse, undo\n # basically forcing a base case\n if k == 0\n res << curr[0..-1] \n return\n end\n # start elims duplicates (like [3, 2] [2, 3])\n i = start\n while i < nums.length\n curr << nums[i]\n recurse(curr, k - 1, nums, res, i + 1)\n curr.pop\n i+=1\n end\n \n end", "def ptn(a)\n if a.size == 1 then\n return [a]\n end\n ret = Array.new\n # 重ならないパターン\n ret += a.perms\n # 重なるパターン\n h1 = Hash.new\n for i in 0..a.size - 1\n for j in i + 1..a.size - 1\n key = [a[i], 0, a[j]].to_s\n if !h1.key?(key) then\n h1.store(key, nil)\n h2 = Hash.new\n # a[i]とa[j]を範囲をずらしながら重ねる\n for k in 0..a[i].size + a[j].size\n t = [0] * a[j].size + a[i] + [0] * a[j].size\n for m in 0..a[j].size - 1\n t[k + m] += a[j][m]\n end\n # 余分な0を取り除く\n t.delete(0)\n # 4より大きい値がないかチェック\n next if t.any? {|v| v > 4}\n # 9より長くないかチェック\n next if t.size > 9\n # 重複チェック\n if !h2.key?(t.to_s) then\n h2.store(t.to_s, nil)\n # 残り\n t2 = a.dup\n t2.delete_at(i)\n t2.delete_at(j - 1)\n # 再帰呼び出し\n ret += ptn([t] + t2)\n end\n end\n end\n end\n end\n return ret\nend", "def main\n\n sum = 0\n\n (0..999).each do |i|\n sum += check(i)\n end\n\n puts \"Total - O(n) #{sum}\"\n\n # Needed to refresh following: https://en.wikipedia.org/wiki/Arithmetic_progression\n sum2 = sum_multiples(3, 1000) + sum_multiples(5, 1000) - sum_multiples(15, 1000)\n\n # Refreshed Big O too : http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o \n puts \"Total - O(1) #{sum2}\"\n\nend", "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "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 sum_recurse(num)\n return 0 if num == 0\n num[0] + sum_recurse(num.delete(1))\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def sub_sum_2(list)\r\n largest_sum = list.first\r\n current_sum = list.first\r\n \r\n # one loop only\r\n # need to get all subarr\r\n i = 1\r\n while i < list.length #loop to create subarr\r\n if current_sum < 0\r\n current_sum = 0\r\n end \r\n current_sum += list[i]\r\n if current_sum > largest_sum\r\n largest_sum = current_sum\r\n end\r\n i += 1\r\n end\r\n largest_sum\r\n end", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def sum_rec(nums)\nreturn nums[0] if nums.size == 1\nreturn 0 if nums.size == 0\n nums[0] + sum_rec(nums[1..-1])\nend", "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend", "def prime_factorization(num)\n # return [num] if prime?(num)\n # first_prime = find_prime_factor(num)\n # return [first_prime] + prime_factorization(num/first_prime)\n (2...(num/2)).each do |n|\n if num % n == 0\n multiplier = num / n\n return prime_factorization(n) + prime_factorization(multiplier)\n end\n end\n [num]\nend", "def count_recursive(n, m)\n if n < 0 or m < 0\n return 0\n end\n if n == 0\n return 1 # We found one solution!\n end\n return count_recursive(n, m-1) + count_recursive(n - S[m], m)\n\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def faster_fib_helper(solution_arr, current, n)\n # n is negative\n if n < 0\n raise ArgumentError, \"Fib(n) error - n must be 0 or larger.\"\n\n # base cases n = 0 , n = 1\n elsif n == 0 || n == 1\n return n\n\n # the other case we check for is if current has reached n\n # this means we can end the recursion\n # and the final return value will be the sum of the previous two\n # elements in solution_arr we have been saving up until this point\n elsif current == n\n # n or current works here since they're the same value at this point\n # can do this because now the array only holds two elements at a time.\n return solution_arr[0] + solution_arr[1]\n\n # otherwise we shovel the next fib # to the back of the array\n # again, found by summing the two elements in front\n # and recusively call the helper with current incremented\n else\n # we only have current number of elements at this point\n # we have to specifically save this in solution_arr, if we do it in the function call\n # it will create a new slot instead of re-using the old one i think\n solution_arr = [solution_arr[1], solution_arr[0] + solution_arr[1]]\n return faster_fib_helper(solution_arr, current + 1, n)\n end\n\nend", "def sub_sum_better(list)\n largest_sum = list.first\n\n #iterate over once.\n # as you iterate keep a tally of the sum.\n # indexing into an array is O(1)\n # [2, 3, -6, 7, -6, 7]\n\n sub_sum = 0\n list.each do |el|\n sub_sum += el\n largest_sum = sub_sum if sub_sum > largest_sum\n\n sub_sum = 0 if sub_sum < 0\n end\n\n largest_sum\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def death(arr,pos,m)\n #define an empty result string\n result = \"\"\n #If the array size is 1, just return the first index\n if arr.size == 1\n return arr[0].to_s\n end\n #If the position is bigger than the size of the array\n if pos+m > arr.size\n #Set the pos back into size of the array\n pos = (pos+m)%arr.size\n # append the number in the position to result\n result << arr[pos].to_s\n #delete the number (a.k.a. kill it)\n arr.delete_at(pos)\n #Append to result a recursive call to death\n result += death(arr,pos,m)\n #return the result\n return result\n end\n #If the position is small than the size of the array\n if arr.size > pos+m \n #The next target is updated according to m\n pos = pos + m\n #Append the number in the position to result\n result << arr[pos].to_s\n #delete the number (a.k.a. kill it)\n arr.delete_at(pos)\n #Append the result of a recursive call to death\n result += death(arr,pos,m)\n \n return result\n end\n #if the target is past the end of the array\n if arr.size == pos+m \n #set the position to 0\n pos = 0\n #Append that number\n result << arr[pos].to_s\n #delete it\n arr.delete_at(pos)\n #Append the result of a recursive call to death\n result += death(arr,pos,m)\n #return\n return result\n end\nend", "def findCicle(nodes, idInicio, passed)\n if(!passed.any?{|id| id == nodes.operationId})\n passed.push(nodes.operationId)\n nodes.entradas.each { \n |node|\n if(node.operationId != idInicio)\n return findCicle(node, idInicio, passed)\n else\n return true\n end \n }\n else \n return true\n end\n return false\nend", "def make_better_change(amount, coin_denoms)\n return [amount] if coin_denoms.include?(amount)\n return [] if amount <= 0\n\n coin_denoms.sort.reverse!\n all_possible_arr = []\n\n coin_denoms.each do |value|\n change_arr = []\n change_arr << value\n change_arr.concat(make_better_change(amount - value, coin_denoms))\n all_possible_arr << change_arr if change_arr.inject(:+) == amount\n end\n\n all_possible_arr.min_by { |arr| arr.length }\n\nend", "def n_naught_brute_vs_recursive(a)\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n\n while time_brute < time_recursive do\n a << a.sample\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n end\n\n result = a.length\nend", "def find_it(seq)\n uniqueInts=seq.uniq\n\n uniqueInts.each do |value|\n k=0\n seq.each do |mainSeq|\n k+=1 if mainSeq==value\n end\n return value if k%2==1\n end\nend", "def solution(a)\n left = 0\n right = a.sum\n a.each_with_index do |element, index|\n right -= element\n return index if left == right\n left += element\n end\n -1\nend", "def largest_contigious_subsum(list)\n debugger\n lcs = list[0] \n current_sum = list[0]\n puts lcs\n list.each_with_index do |num, i|\n current_sum += list[i + 1]\n if current_sum > lcs \n lcs = current_sum\n end\n end\n lcs \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 find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend", "def find_dup(a) \n 0.upto(a.length - 1).each {|i|\n while a[i] != i + 1 && !a[i].nil?\n if a[a[i] - 1] == a[i]\n return a[i]\n end\n aux = a[i]\n a[i] = a[aux - 1]\n a[aux - 1] = aux \n end\n }\n a.inspect\nend", "def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend", "def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\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 solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend", "def item_check(tree)\n if tree[0] == nil\n tree[1]\n else\n tree[1] + item_check(tree[0]) - item_check(tree[2])\n end\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 single_in_sorted(arr)\n mid = arr.length/2\n return arr[0] if arr.count == 1\n if arr[mid] != arr[mid + 1] && arr[mid] != arr[mid -1]\n return arr[mid]\n elsif arr[mid] != arr[mid + 1]\n single_in_sorted(arr[mid+1..-1])\n else\n single_in_sorted(arr[mid+1..-1])\n end\nend", "def find_amicables(n)\n pairs = []\n sum = 0\n for i in 0..n do \n next if pairs.include? i\n d = sum_proper_divisors(i)\n next if d == i\n p = sum_proper_divisors(d)\n if p == i \n pairs << d\n pairs << i\n sum += d + i\n end\n end\n return sum\nend", "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend", "def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend", "def find_unique_elements(arr)\n \nend", "def find_duplicate(nums)\n intersection = find_first_meeting(nums)\n find_cycle_start(nums,intersection)\nend", "def three_sum(nums)\n return [] if !nums || nums.size < 3\n ans = []\n i = 0 \n size = nums.size\n nums = nums.sort\n while i < size do \n if nums[i] == nums[i - 1] && i > 0 \n i += 1\n next\n end\n\n a = nums[i]\n target = -1 * a\n two_sum(nums[(i + 1)...size], target, a, ans)\n i += 1\n end\n ans\nend", "def sum_rec(arr)\n return arr.first if arr.size <= 1\n arr.pop + sum_rec(arr)\nend", "def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend", "def fun1 n\n return 0 if n == 1\n return 1 + fun1(n/2)\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend", "def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\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 find_from(current, left)\n total = current[0].reduce(:+)\n if left.length == 3\n fejs = left.permutation(3).to_a.select { |f, e, j|\n t1 = f + e + current[0][1]\n t2 = e + j + current[-1][-1]\n t1 == t2 && t2 == total\n }\n fejs.empty? ? [] : fejs.map { |fej|\n f, e, j = fej\n current + [[j, current[-1][-1], e], [f, e, current[0][1]]]\n }\n else\n left.flat_map { |inner|\n outer = total - current[-1][-1] - inner\n if (left - [inner]).include?(outer)\n find_from(current + [[outer, current[-1][-1], inner]],\n left - [inner, outer])\n else\n []\n end\n }\n end\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def checkSum(array, sum)\n if array.nil? or array.empty?\n return false\n else\n sortedArray = []\n sortedArray = array.sort # n*log(n)\n length = sortedArray.count\n rightPointer = length - 1\n leftPointer = 0\n result = false\n\n while leftPointer < rightPointer\n if sortedArray[leftPointer] == rightPointer\n result = false;\n break;\n elsif sortedArray[leftPointer] + sortedArray[rightPointer] > sum\n rightPointer -= 1\n elsif sortedArray[leftPointer] + sortedArray[rightPointer] < sum\n leftPointer += 1\n else\n result = true\n break;\n end\n end \n return result;\n\n # return checkHeadAndRear(sortedArray, sum, length) # n\n end\n\nend", "def f(n, x)\n # $count += 1\n if n == 0\n x <= 0 ? 0 : 1\n elsif x <= 1\n 0\n elsif 1 < x && x <= 1 + $a[n - 1]\n f(n - 1, x - 1)\n elsif x == 2 + $a[n - 1]\n $p[n - 1] + 1\n elsif 2 + ($a[n - 1]) < x && x <= 2 + 2 * $a[n - 1]\n $p[n - 1] + 1 + f(n - 1, x - 2 - $a[n - 1])\n else\n 2 * $p[n - 1] + 1\n end\nend", "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 better_inject_recursion(initial = nil,n=nil,&block)\n\t\tresult = 0\n\t\tn ||= 0\n\t\treturn result if n == self.length\n\t\tcurrent_element = initial.nil? ? self[n] : initial\n\t\tn+=1\n\t\tresult = yield(better_inject_recursion(nil,n,&block),current_element)\n\t\tend", "def find(parent, n)\n return n if n == parent[n]\n\n parent[n] = find(parent, parent[n])\n parent[n]\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 solution(h)\n n = h.size\n return 0 if n == 0\n stack = [h.first]\n blocks = 0\n (1...n).each { |y|\n if h[y] != stack.last\n while !stack.empty? && h[y] < stack.last\n stack.pop\n blocks += 1\n end\n stack << h[y] unless stack.last == h[y]\n end # != last\n }\n blocks += stack.count\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = list.first\n current_sum = 0\n list.each do |ele| \n current_sum += ele\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n current_sum = 0 if current_sum < 0 \n end\n largest_sum\nend", "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend", "def sum_rec(numbers)\n # base case\n return 0 if numbers.empty?\n # inductive step\n numbers[0] + sum_rec(numbers[1..-1])\nend", "def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend", "def recursiveSum(array, i, j, x)\n\tresult = 0\n\treturn if i >= array.size\n\tj = 0 if j == (array[i].size - 1)\n\tx = 0 if x == array[i].size\n\tif array[i][j] % array[i][x] != 0\n\t\tresult += recursiveSum(array, i, j, (x + 1))\n\telse \n\t\treturn (array[i][j] / array[i][x])\n\tend\n\treturn result\nend", "def sum_to_n? arr, n\n # YOUR CODE HERE\n unless arr.length > 1\n return false\n end\n h=Hash.new\n arr.each{|a|\n if h.key? a \n return true else h[n-a] = n end}\n return false\nend", "def compute(n)\n a = []\n a.push(1)\n a.push(1)\n n -=1\n first = 1\n second = 1\n n.times do\n third = first + second\n first = second\n second = third\n a.push(third)\n end\n #first\n a\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\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 commonChild(s1, s2)\n arr_s1 = s1.split(//)\n arr_s2 = s2.split(//)\n common = arr_s1 & arr_s2\n if common.length != 0\n s1_com = []\n s2_com = []\n arr_s1.each do |s1|\n if common.include?(s1)\n s1_com << s1\n end\n end\n arr_s2.each do |s2|\n if common.include?(s2)\n s2_com << s2\n end\n end\n row = [0]*(s2_com.size+1)\n for i in 1..s1_com.size\n column = [0]\n for j in 1..s2_com.size\n column.push s1_com[i-1] == s2_com[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n end\n row = column\n end\n return row[-1]\n else\n return 0\n end\n # create first liine\n # row = [0]*(s1.size+1)\n # for i in 1..s1.size\n # column = [0]\n # for j in 1..s2.size\n # column.push s1[i-1] == s2[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n # end\n # row = column\n # end\n # return row[-1]\n # # arr_s1 = s1.split(//)\n # # arr_s2 = s2.split(//)\n # common = arr_s1 & arr_s2\n # if common.length != 0\n # s1_com = []\n # s2_com = []\n # arr_s1.each do |s1|\n # if common.include?(s1)\n # s1_com << s1\n # end\n # end\n # arr_s2.each do |s2|\n # if common.include?(s2)\n # s2_com << s2\n # end\n # end\n # com_length = Array.new(s1_com.length, Array.new(s2_com.length, 0))\n # p com_length\n # com_length[0][1] = 'A'\n # com_length[1][1] = 'C'\n # com_length[1][0] = 'B'\n # p com_length[1][1]\n # s1_com.each_with_index do |s1,i|\n # s2_com.each_with_index do |s2, j|\n # if i == 0\n # if s1 == s2\n # com_length[i][j] = 1\n # else\n # if j != 0\n # if com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # else\n # if j == 0\n # if s1 == s2\n # com_length[i][1] = 1\n # end\n # else\n # if s1 == s2\n # com_length[i][j] = com_length[i-1][j-1] + 1\n # else\n # if com_length[i-1][j] != 0 && com_length[i][j-1] != 0\n # com_length[i][j] = [com_length[i-1][j], com_length[i][j-1]].max\n # elsif com_length[i-1][j] != 0\n # com_length[i][j] = com_length[i-1][j]\n # elsif com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # end\n # end\n # end\n # rs = 0\n # p com_length\n # com_length.each do |r|\n # if r.max > rs\n # rs = r.max\n # end\n # end\n # return rs\n # else\n # return 0\n # end\nend", "def solution(a)\n stack = []\n\n a.each_with_index do |n, i|\n if stack.empty?\n stack << [i, n]\n next\n end\n\n last_value = stack.last[1]\n\n if n == last_value\n stack << [i, n]\n else\n stack.pop\n end\n end\n\n return -1 if stack.empty?\n\n i, cd = stack.last\n\n count = a.inject(0) do |acc, n|\n cd == n ? acc + 1 : acc\n end\n\n count > a.length / 2 ? i : -1\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def biSearch_recur(array,low,high,k)\n if high < low\n return \"not found\"\n end\n \n mid = low + (high - low) / 2\n\n if array[mid] == k\n return mid\n elsif array[mid] > k \n return biSearch(array,low,mid-1,k)\n else\n return biSearch(array,mid+1,high,k) \n end\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend" ]
[ "0.6395889", "0.63333136", "0.6307341", "0.6163818", "0.6062601", "0.60455203", "0.59980667", "0.5973596", "0.592667", "0.5882138", "0.5869365", "0.58544946", "0.584376", "0.58200246", "0.57896274", "0.57827806", "0.5782224", "0.57502013", "0.5740515", "0.573646", "0.5702108", "0.57004046", "0.569702", "0.56958354", "0.5695331", "0.5688245", "0.5671672", "0.5667849", "0.5661797", "0.5656143", "0.56462806", "0.5641465", "0.56387466", "0.56360096", "0.56358594", "0.5630594", "0.56296635", "0.5613549", "0.5598563", "0.5589344", "0.55890095", "0.5581581", "0.5574461", "0.55726445", "0.5562263", "0.55612683", "0.5561067", "0.55603915", "0.5560083", "0.5541285", "0.55406964", "0.5537641", "0.5536096", "0.5534802", "0.5529906", "0.5526939", "0.5526648", "0.55166835", "0.5516322", "0.55155617", "0.5513044", "0.55123514", "0.5507066", "0.55054086", "0.5486228", "0.54834175", "0.5482416", "0.5477354", "0.5475081", "0.5469569", "0.54684526", "0.54655826", "0.54599774", "0.5459293", "0.54574585", "0.54554874", "0.5451435", "0.54481065", "0.5447827", "0.5446722", "0.54459995", "0.5445669", "0.5434987", "0.5431708", "0.54304403", "0.54279953", "0.54273814", "0.54239553", "0.5422901", "0.54214764", "0.54197365", "0.54183775", "0.5415586", "0.5412167", "0.5412092", "0.5411602", "0.5411577", "0.54106486", "0.54105926", "0.54090756", "0.5408298" ]
0.0
-1
Generates a registration key for use with the course.
def generate_registration_key self.registration_key = 'C'.freeze + SecureRandom.base64(8) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_key; end", "def generate_registration_key(components)\n string_to_encode = components.join('|')\n\n Digest::MD5.hexdigest(string_to_encode)\n end", "def generate_user_key\n\t\tself.key = loop do\n random_hex = SecureRandom.urlsafe_base64\n break random_hex unless self.class.exists?(key: random_hex)\n end\n\tend", "def gen_api_key\n u = UUID.new\n self.api_key = u.generate\n end", "def generate_key\n proposed_key = nil\n\n loop do\n num_part = rand(10**7).to_s.rjust(7, \"0\")\n proposed_key = \"#{IDB_CONFIG[:key_prefix]}-#{num_part}\"\n break unless self.class.find_by(key: proposed_key)\n end\n proposed_key\n end", "def generate_key\n begin\n multipliers = eval(self.software.multipliers)\n key = []\n self.challenge.split(\"-\").each_with_index do |word,i|\n word = word.to_i(16) # convert hex to dec\n word *= (word[0].even?) ? multipliers[i][:even] : multipliers[i][:odd]\n key << word.to_s(16).reverse[0,8].reverse # convert dec to hex, keep only 8 rightmost hex characters\n end\n self.activation_key = key.join(\"-\").upcase\n rescue\n self.activation_key = \"error!\"\n end\n end", "def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end", "def key_generator; end", "def key_generator; end", "def generate_access_key\n access_keys.generate_new\n end", "def secret_keygen\n ('k' + Digest.hexencode(rand(9).to_s + self.message[0..2]) + self.id.to_s) \n end", "def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end", "def generate_auth_key\n name = \"fasdfadf\"\n puts self.name\n puts name\n end", "def generate_key\n self.key = SecureRandom.hex(KEY_LENGTH / 2)\n end", "def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end", "def generate_email_validation_key\n # Auto activated for employer\n # self.email_validation_key = SecureRandom.base64(8)\n end", "def generate_validkey(from_string = nil)\n\t\tfrom_string ||= User.sha1(AuthHelper::Utils::random_string(30))\n write_attribute \"validkey\", from_string\n end", "def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end", "def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end", "def generate_key\n SecureRandom.hex(32)\nend", "def generate_api_key\n SecureRandom.random_number(2 ** 256).to_s(36)\n end", "def generate_api_key\n generate_uuid\nend", "def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end", "def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end", "def generate_api_key!\n\t\t@api_key = Digest::SHA1.hexdigest((Time.now.to_f + rand(100) * rand()).to_s) \n\tend", "def generate_api_key(id)\n request(:post, \"/users/#{id}/make_new_api_key.json\")\n end", "def generate_random_key\n (0...8).map { 65.+(rand(25)).chr }.join\n end", "def generate_random_key\n SecureRandom.random_bytes(32)\n end", "def generate_key\n length = 5\n begin\n self.key = SecureRandom.urlsafe_base64 length\n end while Invite.exists?(key: self.key)\n end", "def generate_unique_key(now = Time.now)\n u1 = ((now.to_i*1000*1000+now.usec) << 12 | rand(0xfff))\n uid = [u1 >> 32, u1 & 0xffffffff, rand(0xffffffff), rand(0xffffffff)].pack('NNNN')\n uid.unpack('C*').map { |x| \"%02x\" % x }.join\n end", "def generate_validation_key\n self.validation_key = SecureRandom.base64(8)\n end", "def generate_registration_token\n candidate_token = nil\n\n while candidate_token.nil?\n candidate_token = SecureRandom.hex(3).upcase\n candidate_token = nil unless Device.find_by(registration_token: candidate_token).nil?\n end\n\n self.registration_token = candidate_token\n end", "def save_verification_key\n self.verification_key = KeyGenerator.create\n end", "def key_generator\n self.class.rails_key_generator(secret_key_base)\n end", "def generate_new_key(device: nil)\n password = nil\n dev_id = nil\n get_device(device: device) do |device|\n telnet_config = {\n 'Host' => device.ip,\n 'Port' => 8080\n }\n connection = Net::Telnet.new(telnet_config)\n connection.puts(\"genkey\")\n waitfor_config = {\n 'Match' => /./,\n 'Timeout' => false\n }\n password = nil\n dev_id = nil\n while password.nil? or dev_id.nil?\n connection.waitfor(waitfor_config) do |txt|\n while line = txt.slice!(/^.*\\n/) do\n words = line.split\n if words[0] == \"Password:\"\n password = words[1]\n elsif words[0] == \"DevID:\"\n dev_id = words[1]\n end\n end\n end\n end\n connection.close\n end\n return password, dev_id\n end", "def gen_key( string )\n md5 = Digest::MD5.hexdigest( string )\n return md5[0, 3] + md5[29, 31]\nend", "def kid_generator; end", "def kid_generator; end", "def kid_generator; end", "def create_key\n self.key = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Api.exists?(key: random_token)\n end\n end", "def gen_key(string_key)\n b_key = self._hash_digest(string_key)\n return self._hash_val(b_key) { |x| x }\n end", "def generate\n key = Bitcoin::Key.generate.priv\n info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end", "def generate_api_key\n @user.generate_api_key\n @user.save\n redirect_to users_path\n end", "def generate_api_key(id)\n response = request(:post, \"/users/#{id}/make_new_api_key.json\")\n response[\"user\"]\n end", "def generate_new_key(\n name:,\n email: \"\",\n comment: \"\",\n creation_date: Time.now,\n key_validity_seconds: 1.year\n )\n generate_new_keys(\n name: name,\n email: email,\n comment: comment,\n creation_date: creation_date,\n key_validity_seconds: key_validity_seconds,\n ).first\n end", "def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end", "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless self.class.exists?(api_key: token)\n end\n end", "def generate_invitation_key\n self.invitation_key ||= 'I'.freeze + SecureRandom.base64(8)\n end", "def generate\n key = Bitcoin::Key.generate.priv\n @log.info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end", "def generate_api_key\n\t\tloop do\n\t\t\ttoken = SecureRandom.base64.tr('+/=', 'Qrt')\n\t\t\tbreak token unless User.exists?(api_key: token)\n\t\tend\n\tend", "def enable_registration_code(enable)\n if enable\n return true if current_course.registration_key\n\n current_course.generate_registration_key\n else\n current_course.registration_key = nil\n end\n current_course.save\n end", "def regen_key\n @user = current_user\n @user.regen_private_key\n send_data @user.private_key, :type => \"application/pem-keys\", :disposition => \"attachment\", :filename => \"#{@user.username}.pem\"\n end", "def generate_personal_key\n self.personal_key = OaUtils.generate_random_key\n self.state = :active\n end", "def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end", "def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end", "def generate\n Puppet.info \"Creating a new SSL key for #{name}\"\n @content = OpenSSL::PKey::RSA.new(Puppet[:keylength].to_i)\n end", "def enable_registration_code(enable)\n if enable\n return true if current_course.registration_key\n current_course.generate_registration_key\n else\n current_course.registration_key = nil\n end\n current_course.save\n end", "def generate_api_key\n begin\n api_key = SecureRandom.uuid\n end while ApiKey.exists?(:api_key => api_key)\n\n api = ApiKey.new\n api.api_key = api_key\n api.save\n\n self.api_key = api\n end", "def generate_api_key\n begin\n self.api_key = SecureRandom.hex(16)\n end while self.class.exists?(api_key: api_key)\n self.save\n self.api_key\n end", "def generate_email_validation_key\n self.email_validation_key = SecureRandom.base64(8) if !self.for_testing?\n end", "def get_credit_key(type, name)\n generate_store_key(\"#{type}-c:#{name}\")\n end", "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'RST')\n break token unless User.exists?(api_key: token)\n end\n end", "def get_registration_key(session_id)\n reverse_key = [owner_id, job_id, server].join(\"_\")\n Cache.get(\"#{session_id}_#{reverse_key}\")\n end", "def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end", "def generate_key(store)\n store.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Store.exists?(token: random_token)\n end\n end", "def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end", "def make_keypair\n\t gpg = OpenPGP::Engine::GnuPG.new(:homedir => '~/.gnupg')\n\t key_id = gpg.gen_key({\n\t\t :key_type => 'RSA',\n\t\t :key_length => 4096,\n\t\t :subkey_type => 'RSA',\n\t\t :subkey_length => 4096,\n\t\t :name => @dname,\n\t\t :comment => nil,\n\t\t #:email => '',\n\t\t #:passphrase => '',\n\t\t})\n\tend", "def keygen(&block)\n jiak.data.class_eval <<-EOS\n define_method(:keygen,&block)\n EOS\n end", "def generate_api_key\n self.api_key = SecureRandom.hex(16)\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def key_pair_name\n\n # return the key_pair_name if one is already generated\n return @key_pair_name if @key_pair_name\n\n # generate on from a random string of 10 upper and lowercase letters\n o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n @key_pair_name = (0..10).map { o[rand(o.length)] }.join\n return @key_pair_name\n\n end", "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "def generate_keys(from_wallet_name, master_key)\n ks = { 'master' => master_key }\n %w(recovery money social memo).each do |role|\n private_key = Xgt::Ruby::Auth.generate_wif(from_wallet_name, master_key, 'recovery')\n public_key = Xgt::Ruby::Auth.wif_to_public_key(private_key, @address_prefix)\n ks[\"#{role}_private\"] = private_key\n ks[\"#{role}_public\"] = public_key\n end\n ks['wallet_name'] = Xgt::Ruby::Auth.generate_wallet_name(ks['recovery_public'])\n ks\nend", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def gen_id\n SecureRandom.hex(32)\n end", "def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end", "def generate_api_key(length = 20)\n self.api_secret_key = SecureRandom.hex(length)\n end", "def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end", "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def make_keypair\n\t gpg = OpenPGP::Engine::GnuPG.new(:homedir => '~/.gnupg')\n\t key_id = gpg.gen_key({\n\t\t :key_type => 'DSA',\n\t\t :key_length => 1024,\n\t\t :subkey_type => 'ELG-E',\n\t\t :subkey_length => 1024,\n\t\t :name => @dname,\n\t\t :comment => nil,\n\t\t #:email => '',\n\t\t #:passphrase => '',\n\t\t})\n\tend", "def generate_keys\n\t\tself.token = OAuth::Helper.generate_key(20)[0,20]\n\t\tself.expires_at = 10.minutes.from_now\n\t\tself.authorized_at = Time.now\n\tend", "def generate_new_keys(\n name:,\n email: \"\",\n comment: \"\",\n creation_date: Time.now,\n key_validity_seconds: 1.year\n )\n\n generated =\n Rnp.new.generate_key(\n default_key_params(\n name: name,\n email: email,\n comment: comment,\n creation_date: creation_date,\n key_validity_seconds: key_validity_seconds,\n ),\n )\n\n %i[primary sub].map do |key_type|\n raw = generated[key_type]\n creation_hash = creation_params(\n raw: raw, activation_date: creation_date, metadata: raw.json,\n )\n\n RK::Key::PGP.create(creation_hash)\n end\n end", "def generate_api_key\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser/' +\n @uuid + '/apikey'\n response = Faraday.post(@url) do |req|\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n key = JSON.parse(response.body)\n puts \"\\n User ID: #{@uuid} \\n API key: #{key['apiKey']} \\n\\n\"\n end", "def rand_key\n return JString.new\n end", "def generate_access_key\n return if self.access_key.present?\n self.access_key = SecureRandom.uuid\n end", "def make_activation_code\n self.activation_code = self.class.make_key\n end", "def generate_keys\n key = OpenSSL::PKey::RSA.new 2048\n self.pubkey = key.public_key.to_s\n self.privkey = key.to_s\n self.save\n end", "def generate_key( username, password, contract)\n response_xml = self.call( :generate_key, message: {\n arg0: username,\n arg1: password,\n arg2: contract\n })\n response = IssueCentre::Response.parse( response_xml,\n {contract_id: contract})\n end", "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless Employee.exists?(api_key: token)\n end\n end", "def generate_id\n SecureRandom.hex(8)\n end", "def create_appplication_key\n\t\t# set guid key for current application_id\n\t\t# self.application_id = Admin::Guid.new.key\n\t\t@application_id = Admin::Guid.new.key\n\tend", "def generate_api_key\n @user.api_key = BCrypt::Engine.generate_salt\n end", "def generate_key(seed)\n key = \"\"\n 1.upto(KEY_LENGTH) do\n key += (((seed = (214013 * seed + 2531011) & 0x7fff_ffff) >> 16) & 0x0FF).chr # deconstructing in IDA showed Microsoft LCG\n end\n return key\nend", "def regenerate_api_key\n self.api_key = Digest::SHA1.hexdigest(\"#{self._id}-#{Time.now.to_f}-#{self.created_at}\")\n end", "def generate_key!\n unless priv_key\n tmp = OpenSSL::PKey.generate_key(self)\n set_key(tmp.pub_key, tmp.priv_key)\n end\n self\n end", "def registration\n user.registration_for course\n end", "def key(spec)\n return \"site-#{self.subdomain.to_s}-#{spec.to_s}\"\n end", "def generate_unique_name\n SecureRandom.uuid\n end" ]
[ "0.7567376", "0.7466668", "0.68773484", "0.6737915", "0.6720664", "0.67189175", "0.66886556", "0.66753656", "0.66753656", "0.6663184", "0.6658071", "0.6612307", "0.6592411", "0.6568493", "0.6560976", "0.65485245", "0.653845", "0.6535912", "0.6535912", "0.6526784", "0.65215755", "0.6483359", "0.6482734", "0.6482734", "0.64545184", "0.6441801", "0.63378036", "0.63362056", "0.63252354", "0.6323494", "0.6314864", "0.63032675", "0.6288761", "0.6268647", "0.62388086", "0.62387234", "0.62375027", "0.62375027", "0.62375027", "0.62362534", "0.62266886", "0.6215383", "0.62057763", "0.62027884", "0.62003124", "0.6198712", "0.6184905", "0.6176877", "0.6167799", "0.6160849", "0.615719", "0.6130723", "0.6119843", "0.61181116", "0.61181116", "0.61122674", "0.6110531", "0.6106023", "0.610451", "0.61035085", "0.6102715", "0.6095641", "0.609053", "0.6082245", "0.60700727", "0.6067049", "0.60660046", "0.60646397", "0.60308164", "0.60033995", "0.600144", "0.6000308", "0.6000308", "0.6000308", "0.599157", "0.59856045", "0.59687907", "0.59591395", "0.5946802", "0.5944556", "0.5942596", "0.59393847", "0.59303266", "0.59298307", "0.5907262", "0.5893213", "0.5888072", "0.5886541", "0.5876403", "0.58688337", "0.5860635", "0.58577216", "0.5852739", "0.5848886", "0.58488595", "0.58480006", "0.584432", "0.58404624", "0.58292276", "0.5828495" ]
0.82896674
0
Returns the root folder of the course.
def root_folder if new_record? material_folders.find(&:root?) || (raise ActiveRecord::RecordNotFound) else material_folders.find_by!(parent: nil) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def folder\n @root_folder\n end", "def root_folder\n scheduler_service.GetFolder(\"\\\\\")\n end", "def get_root_directory\n return @@root_directory\n end", "def get_root_directory\n return @@root_directory\n end", "def root_folder\n load unless loaded?\n @root_folder\n end", "def root_folder\n folders.first({ title: Folder::DefaultFolder, folder_id: nil })\n end", "def root\n folders.first\n end", "def rootDir\n if @workflow[:root_dir]\n OpenStudio.toPath(@workflow[:root_dir])\n else\n OpenStudio.toPath(@osw_dir)\n end\n end", "def get_root\n return File.join('/root/path', SETTINGS[:project])\n end", "def root_path\n RUBYCOCOA_ROOT.to_s\n end", "def root_path\n @root_path ||= File.expand_path(File.join('.', '../..'))\n end", "def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end", "def root\n Pathname.new(File.dirname(__dir__))\n end", "def root\n find_single_directory || @app_dir\n end", "def get_root_folder_id\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.about.get)\n rescue\n return nil\n end\n \n if result.status == 200\n result.data.rootFolderId\n else\n nil\n end\n end", "def root; Pathname(__dir__).parent; end", "def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end", "def root\n @root ||= Pathname.new(__FILE__).dirname.dirname.expand_path.to_s\n end", "def root\n Dir.pwd\n end", "def root\n @root ||= Pathname.new(File.expand_path(\"..\", __dir__))\n end", "def root\n File.dirname __dir__\n end", "def root\n File.dirname __dir__\n end", "def root(config = Pantry.config)\n Pathname.new(config.root_dir)\n end", "def root_folder_id\n self.root_folder\n end", "def root_path(full = true)\n\n if full\n path = Rails.root.join ProgramsDir\n else\n path = Pathname.new ProgramsDir\n end\n\n path.join self.name\n end", "def root\n @root ||= Pathname.new(File.expand_path('../../../', __FILE__))\n end", "def root_path\n File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n assignment_offering.assignment.url_part,\n user.email)\n end", "def root\n File.dirname __dir__\n end", "def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end", "def root\n @root ||= Pathname.new(\"#{__dir__}/../../../..\").cleanpath\n end", "def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend", "def root(path = nil)\n base = File.expand_path(File.dirname(__FILE__))\n path ? File.join(base, path) : base\n end", "def root\n Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end", "def root\n '../' * file.count('/')\n end", "def root\n root = ENV['JETS_ROOT'].to_s\n root = '.' if root == ''\n root = \"#{root}/\" unless root.ends_with?('/')\n Pathname.new(root)\n end", "def root_path\n @root_path ||= `git rev-parse --show-toplevel`.chomp\n end", "def root_dir\n self.class.plays_dir.join script_name\n end", "def root_dir\n superblock.root_dir\n end", "def root\n @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))\n end", "def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end", "def root_path(path) File.join(root, path) end", "def root\n File.expand_path(File.dirname(__dir__))\n end", "def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end", "def root path\n File.dirname(find_dotjam(path))\n end", "def root_path\n path = File.join(File.dirname(__FILE__), '../')\n Pathname.new(path).realpath\nend", "def root_dir\n BoB::Application.config.chapters_path.to_s\n end", "def root\n case parent\n when Pathname then parent\n when FileStore then parent.root\n else nil\n end\n end", "def root\n return @root if @root\n @root = dir = Dir.pwd\n begin\n dir = File.dirname(dir)\n return @root = dir if File.exist?(File.join(dir, \"#{BASENAME}.rb\"))\n end while dir != '/'\n\n @root\n end", "def root\n @root ||= Pathname.new(File.expand_path(\"../../\", __FILE__))\n end", "def root\n @root ||= Pathname.new(File.expand_path('../../', __FILE__))\n end", "def root\n return \".\".expand_path unless app_file?\n return @root if @root\n @guessed_root ||= begin\n dir = app_file.expand_path.dirname\n if dir.basename == \"lib\" and not (dir / \"lib\").directory?\n dir.dirname\n else\n dir\n end\n end\n end", "def root_dir\n File.join(self.runner.path, 'public')\n end", "def root\n\t\tFile.join(options[:root].to_s, user.id.to_s)\n\tend", "def root_folder\n connect\n\n @vm_folder\n end", "def root *folders\n File.expand_path(File.join(*([app_root, folders].flatten.uniq.tap{|path| path.delete(nil) })))\n end", "def getRoot\n @path[0]\n end", "def parent_directory\n File.dirname(@full_path).split('/').last\n end", "def parent_directory\n File.dirname(@full_path).split('/').last\n end", "def root(value = nil)\n if value\n @root = value\n else\n Utils::Kernel.Pathname(@root || Dir.pwd).realpath\n end\n end", "def root_path \n @root_path\n end", "def root\n find_single_directory || @droplet.root\n end", "def root\n @root ||= test? ? KOOD_ROOT.join('storage-test').to_s : KOOD_ROOT.join('storage').to_s\n end", "def root\n if @root.nil?\n root = ENV['PWD']\n until File.exists?(\"#{root}/Eulerfile.rb\") || File.expand_path(root) == '/' do\n root = File.dirname(root)\n end\n if not File.exists?(\"#{root}/Eulerfile.rb\")\n raise Euler::EulerFileNotFoundError.new \"Unable to find an Eulerfile.rb in any of the parent directories.\"\n end\n @root = root\n end\n @root\n end", "def root\n File.dirname(__FILE__)\n end", "def root_path\n attributes.fetch(:rootPath)\n end", "def root\n Rails.root || Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end", "def root\n Rails.root || Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end", "def talia_root(path = '')\n File.join('..', '..', '..', '..', path)\n end", "def folder\n @folder ||= File.expand_path('.')\n end", "def root\n @site.root\n end", "def location\n return unless exists?\n folder_pathname.relative_path_from(root_path)\n end", "def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end", "def root_path\n Pathname.new(upload_path_value).join(search_directory)\n end", "def folder_path\n File.expand_path @folder_path\n end", "def root\n @root ||= Pathname.new('.')\nend", "def folder_location\n @folder_location ||= Find.find(root_path).find do |path|\n FileTest.directory?(path) && path.split(\"/\").last == id.to_s\n end\n end", "def root\n File.expand_path '../../..', __FILE__\n end", "def lookup_root\n root = nil\n Dir.ascend(Dir.pwd) do |path|\n check = Dir[ROOT_GLOB].first\n if check\n root = path \n break\n end\n end\n root || Dir.pwd\n end", "def root_path\n return @root_path if @root_path\n\n @root_path = @sftp.root_path\n unless @root_path == ''\n if @root_path == '/'\n @root_path = ''\n else\n @root_path = '/' + @root_path unless @root_path.match(/\\A\\//)\n @root_path = @root_path.sub(/\\/\\z/, '') if @root_path.match(/\\/\\z/)\n end\n end\n @root_path\n end", "def get_path_root\n return self if @path.nil?\n @path.get_path_root\n end", "def root\n settings[:basedir]\n end", "def root\n File.expand_path(options[:root] || Dir.pwd)\n end", "def root_dir\n ManageIQ::Providers::Lenovo::Engine.root.join(\"content/ansible_runner\")\n end", "def output_root\n ETL.config.core[:job][:data_dir]\n end", "def staff_root_path\n office_root_path\n end", "def root\n application && application.config.root\n end", "def project_root()\n return @project_root_path if @project_root_path\n \n @project_root_path = Common::find_root_of(\"tiapp.xml\", Common::project_path)\n end", "def root_file_path; end", "def get_folder()\n f = Kamelopard::DocumentHolder.instance.current_document.folders.last\n Kamelopard::Folder.new() if f.nil?\n Kamelopard::DocumentHolder.instance.current_document.folders.last\n end", "def root_path\n defined?(Rails) && Rails.root ||\n defined?(Sinatra::Application) && Pathname.new(Sinatra::Application.root) ||\n defined?(ROOT_DIR) && Pathname.new(ROOT_DIR)\n end", "def root path = nil\n if path && configurable?\n @root = normalize_path(path)\n # resetting path to an empty string cause root should be an absolute path to templates.\n @path, @setup[:path] = nil\n path ''\n end\n @setup[:root] ||= @root ||\n (@controller.ctrl.slice.view.root if @controller) ||\n Presto::App.root\n end", "def subdir\n if core_project? or 'profile' == proj_type\n return @local_path.parent.relative_path_from(@platform.local_path + (proj_type + 's'))\n else\n return @local_path.parent.relative_path_from(@platform.local_path + @platform.contrib_path + (proj_type + 's'))\n end\n end", "def converted_root\n Pathname(__dir__).parent + \"converted\"\n end", "def root\n \"#{File.dirname(__FILE__)}/..\"\nend", "def a_dir\n self.path.split('/')[0...-1]\n end", "def rails_root\n @path\n end", "def root_path\n environment.paths.detect { |path| pathname.to_s[path] }\n end", "def root \n @root ||= User.root\n end", "def root\n @root || Merb::Config[:merb_root] || File.expand_path(Dir.pwd)\n end", "def parent_sub_dir\n return unless Filesystem.use_parent_sub_dir\n\n setting = Admin::AppConfiguration.find_default_app_config(app_type_id, 'filestore directory id')\n if setting\n unless setting.value.in?(Master.alternative_id_fields.map(&:to_s))\n raise FsException, 'An id name ending with \"_id\" is expected for \"filestore directory id\"'\n end\n\n \"#{setting.value.hyphenate}-#{master.send(setting.value)}\"\n else\n \"master-#{master_id}\"\n end\n end" ]
[ "0.76121235", "0.7424518", "0.7420176", "0.7420176", "0.7399154", "0.7246283", "0.7206369", "0.71779174", "0.716437", "0.70478123", "0.6980798", "0.6958754", "0.69286615", "0.6859045", "0.6853035", "0.6852559", "0.68472207", "0.6835592", "0.67934024", "0.67799634", "0.67789084", "0.67789084", "0.677361", "0.6760483", "0.67531115", "0.67189795", "0.67155087", "0.6706508", "0.66917735", "0.6682919", "0.66699857", "0.66477233", "0.66444004", "0.6639433", "0.66385", "0.66377634", "0.663429", "0.6622252", "0.6591726", "0.65877503", "0.6585795", "0.65494853", "0.6539888", "0.653938", "0.6527368", "0.6500064", "0.6493986", "0.64777744", "0.6475604", "0.647213", "0.64553875", "0.644772", "0.644622", "0.6441708", "0.6422663", "0.64173937", "0.63949555", "0.63949555", "0.639385", "0.6381733", "0.636686", "0.6355633", "0.6308848", "0.62945694", "0.62875235", "0.628266", "0.628266", "0.62632245", "0.6259518", "0.6226068", "0.6223525", "0.62200516", "0.6203181", "0.6196829", "0.6193187", "0.6180521", "0.6169479", "0.6142526", "0.61420345", "0.61393315", "0.61154974", "0.6101489", "0.60806787", "0.6078466", "0.6071105", "0.60685533", "0.60657674", "0.6065611", "0.604547", "0.604373", "0.6038474", "0.60374165", "0.60125285", "0.6009354", "0.6009258", "0.60078675", "0.60058063", "0.5997912", "0.5997678", "0.5990231" ]
0.6749608
25
Test if the course has a root folder.
def root_folder? if new_record? material_folders.find(&:root?).present? else material_folders.find_by(parent: nil).present? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root?\n \tfolder_id.nil?\n end", "def is_root?\n @path == '/' || @path == ''\n end", "def is_root?()\n @rootpath == @path\n end", "def root?\n !self.hier? || self.path == '/' || self.path.to_s.empty?\n end", "def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and @path.empty?\n end", "def root?\n self.path == '/'\n end", "def root?(path)\n \n root_objects = [\"gemfile\", \"procfile\", \"readme\"]\n current_objects = Dir[path + \"/*\"].map do |file|\n File.basename(file).downcase\n end\n dir = \"\"\n current_objects.each do |co|\n dir = (root_objects.include?(co) == true)? \"ROOT\" : \"NOT ROOT\"\n break if dir == \"ROOT\"\n end\n return true if dir == \"ROOT\"\n return false if dir == \"NOT ROOT\"\n \n end", "def root?\n is_root?(@path)\n end", "def root?\n !!(chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o =~ @path)\n end", "def root?\n !!@root || app_file?\n end", "def ensure_root\n if self.root? and self.root_cfs_directory.blank?\n self.root_cfs_directory = self\n self.save!\n end\n true\n end", "def root?\n full_name.empty?\n end", "def root?\n env[\"PATH_INFO\"] == '/'\n end", "def root_directory?(path)\n File.directory?(path) &&\n File.expand_path(path) == File.expand_path(File.join(path, \"..\"))\nend", "def root?; path == '' end", "def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end", "def file_inside_root?(full_path)\n full_path = File.expand_path full_path\n if full_path.match Regexp.new('^' + Regexp.escape(root_path))\n true\n else\n false\n end\n end", "def is_root?\n false\n end", "def root?\n true\n end", "def root?\n true\n end", "def root_folder\n load unless loaded?\n @root_folder\n end", "def folder?\n children.any?\n end", "def root?\n true\n end", "def root?\n false\n end", "def root?\n !has_parent?\n end", "def validnn?()\n return dir_exists?(\"/\") ? true : false\n end", "def is_public_root?\n false\n end", "def root?\n root\n end", "def root_valid?\n index_files = Dir[File.join(path, \"index.*\")].count\n return true if index_files > 0\n return false\n end", "def has_root?\n @root != nil\n end", "def root?\n false\n end", "def web_root? path\n path.start_with? SLASH\n end", "def exists?\n File.exists?(File.join(@root))\n end", "def is_root?\n @parent.nil?\n end", "def root?\n self.class.roots.exists?(self.id)\n end", "def root?\n root_id.nil?\n end", "def is_root?\n self.parent_id.nil?\n end", "def root_path_match?\n url == '/'\n end", "def is_root?()\n return (name.nil? and parent.nil?) \n end", "def subfolders?\n !self.subfolders.nil?\n end", "def root_folder\n if new_record?\n material_folders.find(&:root?) || (raise ActiveRecord::RecordNotFound)\n else\n material_folders.find_by!(parent: nil)\n end\n end", "def in_module_root?(path = Dir.pwd)\n PDK::Util::MODULE_FOLDERS.any? { |dir| PDK::Util::Filesystem.directory?(File.join(path, dir)) } ||\n PDK::Util::Filesystem.file?(File.join(path, 'metadata.json'))\n end", "def root?\n ROOT == self\n end", "def is_root?\n parent_id.nil?\n end", "def is_root?\n parent_id.nil?\n end", "def is_root_site?\n @depth == 0\n end", "def folder_reachable?\n Dir.exists? folder_path\n end", "def root?\n !parent\n end", "def valid_root_cache?\n return true\n (! options[:purge_cache]) && File.directory?(options[:cache_dir])\n end", "def root?\n self.parent ? false : true\n end", "def root?\n _parent_id.nil?\n end", "def folder?\n return false if type.nil?\n \"folder\".casecmp(type).zero?\n end", "def root? # :nodoc:\n not (id =~ ROOT_ID_REGEXP).nil?\n end", "def root?\n @parent.nil?\n end", "def folder\n @root_folder\n end", "def control_repo_root?(path = Dir.pwd)\n CONTROL_REPO_FILES.any? { |file| PDK::Util::Filesystem.file?(File.join(path, file)) }\n end", "def root?\n @type == ROOT\n end", "def lib_root?\n false\n end", "def end_of_path?(dir, root = nil)\n dir.nil? || dir.empty? || dir == '.' || dir == root\n end", "def root?\n context.root_component == self\n end", "def root?\n parent_id.nil?\n end", "def root?\n parent_id.nil?\n end", "def root?\n parent_id.nil?\n end", "def root?\n parent.nil?\n end", "def root?\n parent.nil?\n end", "def root?\n parent.nil?\n end", "def root?\n parent.nil?\n end", "def exists?\n folder_location.present?\n end", "def root?\n parent_id.nil?\n end", "def root?\n parent.nil?\n end", "def validate_directory_structure\n return false unless File.exists? @root\n Find.find(@root) do |path|\n stat = File::Stat.new path\n return false unless stat.uid == OWNER and stat.gid == GROUP\n if File.directory? path\n return false unless stat.mode == DIRMODE\n else\n return false unless stat.mode == FILEMODE\n end\n end\n true\n end", "def root?\n @parent.nil?\n end", "def parent_of?(folder)\n @location.parent_of?(folder.location)\n end", "def root?\n return @active_context.empty?\n end", "def root?\r\n\t\treturn parent == nil\r\n\tend", "def ensure_and_valid_root\n if root.empty?\n puts\n @root = prompt.ask('Path to redmine root:', required: true, default: 'redmine')\n end\n\n @root = File.expand_path(@root)\n\n unless Dir.exist?(@root)\n create_dir(@root)\n end\n\n logger.info(\"REDMINE_ROOT: #{@root}\")\n\n unreadable_files = []\n all_directories = []\n\n Find.find(@root).each do |item|\n if unreadable_files.size > CHECK_N_INACCESSIBLE_FILES\n break\n end\n\n # Installer only need read permission for a few files\n # but for sure it checks all of them\n if !File.readable?(item)\n unreadable_files << item\n next\n end\n\n # Actualy this permission should not be needed\n # becase deletable is checked by parent directory\n # if !File.writable?(item)\n # unreadable_files << item\n # end\n\n # Parent directory of the root can have any permission\n if item != @root\n all_directories << File.dirname(item)\n end\n end\n\n if unreadable_files.any?\n error \"Application root contains unreadable files. Make sure that all files in #{@root} are readable for user #{env_user} (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{unreadable_files.join(', ')})\"\n end\n\n unwritable_directories = []\n\n all_directories.uniq!\n all_directories.each do |item|\n if !File.writable?(item)\n unwritable_directories << item\n end\n end\n\n if unwritable_directories.any?\n error \"Application root contains unwritable directories. Make sure that all directories in #{@root} are writable for user #{env_user} (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{unwritable_directories.join(', ')})\"\n end\n end", "def is_tyrant_root?( dir )\n cfg = File.join( dir, config_file_basename )\n if File.directory?( dir ) and File.exist?( cfg ) then\n IO.readlines( cfg ).each do |line|\n return true if line.index( MAGIC_LINE )\n end\n end\n return false\n end", "def create_in_empty_directory?\n is_empty_directory?(@path)\n end", "def fully_qualified_dir_path?(path)\n path[0, 1] == '/'\n end", "def root_public?\n self.root.public?\n end", "def root_private?\n self.root.private?\n end", "def root?\n self.parent.nil?\n end", "def root?\n root == self\n end", "def is_root?\n \troot == id\n end", "def current_directory?\n File.exist? current_directory\n end", "def root?\n id == Id::ROOT\n end", "def is_root?() @name === '__root__'; end", "def root_folder\n folders.first({ title: Folder::DefaultFolder, folder_id: nil })\n end", "def root\n # search upward for a file called \".version50\"\n path = Pathname.new(Dir.pwd)\n while path.to_s != '/'\n # check if file exists in this directory\n if path.children(false).select { |e| e.to_s == '.version50' }.length > 0\n return path.to_s\n end\n\n # continue to traverse upwards\n path = path.parent\n end\n\n # .version50 file not found\n return false\n end", "def local_dir_exists?(full_path)\n File.directory?(full_path)\nend", "def directory?() end", "def has_parent?\n !root?\n end", "def root_page?\n current_page == root_page\n end", "def is_root?\n return call_ancestry_method(:is_root?) if use_ancestry?\n\n rel = relationship # TODO: Handle a node that is a root and a node at the same time\n rel.nil? ? true : rel.is_root?\n end", "def path_defined?(path)\n return (not root_defined_path_part[path].nil?)\n end", "def valid?\n prefix = File.expand_path(root_path)\n prefix == File.expand_path(@file)[0...prefix.size]\n end", "def within?(dir, root)\n expanded_root = File.expand_path(dir, root)\n File.expand_path(@parent, root) == expanded_root ||\n File.expand_path(@path, root).include?(expanded_root)\n end", "def exist?\n File.directory? @full_path\n end", "def root_path\n environment.paths.detect { |path| pathname.to_s[path] }\n end", "def is_root?( inventory )\n\t\tinventory.template_root?( @id )\n\tend" ]
[ "0.7659787", "0.75953543", "0.75504994", "0.75484115", "0.7547903", "0.72686625", "0.7230413", "0.7196258", "0.7129947", "0.700059", "0.68827796", "0.68824035", "0.68342066", "0.68228096", "0.6741974", "0.6735495", "0.67177004", "0.6713444", "0.6677862", "0.6677862", "0.6639106", "0.6617246", "0.66128427", "0.65390784", "0.6533149", "0.6532183", "0.6531873", "0.6527877", "0.65223503", "0.6519237", "0.64739114", "0.64613664", "0.6423318", "0.6401155", "0.6382589", "0.63818556", "0.6369032", "0.63657916", "0.636324", "0.6313351", "0.6308751", "0.6274311", "0.6268871", "0.62554336", "0.62554336", "0.6238123", "0.62258697", "0.62217116", "0.6204515", "0.6200769", "0.62007093", "0.6191472", "0.61761653", "0.61689377", "0.6155281", "0.6151819", "0.6151811", "0.61479205", "0.614323", "0.6125567", "0.6120369", "0.61132944", "0.61132944", "0.61060774", "0.61060774", "0.61060774", "0.61060774", "0.6104394", "0.6103183", "0.60896957", "0.6078347", "0.60697013", "0.60605687", "0.6059231", "0.6057103", "0.60491806", "0.604487", "0.6025552", "0.6002553", "0.59952664", "0.5993507", "0.5992534", "0.5986132", "0.59795636", "0.5978983", "0.5962944", "0.59620106", "0.5960553", "0.5956045", "0.59499985", "0.5942862", "0.59367794", "0.5931981", "0.5926465", "0.5917842", "0.5907443", "0.5907129", "0.5896651", "0.5884247", "0.58779556" ]
0.76919776
0
This is the max time span that the student can access a future assignment. Used in self directed mode, which will allow students to access course contents in advance before they have started.
def advance_start_at_duration settings(:course).advance_start_at_duration end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 max_time\n @max_time ||= 0.2\n end", "def max_time\n @max_time ||= defaults[:max_time]\n end", "def max_reserved_time\n @max_reserved_time_s && ( @max_reserved_time_s * 1000.0 ).round\n end", "def prev_max() self.scheduling.prev_max end", "def maximum_duration\n return @maximum_duration\n end", "def max_run_time\n 96.hours\n end", "def get_time_tutor_can_help\n start_time = self.student_requests.where(status:\"active\").first.start_time\n if(Time.now-start_time)/60>30 #if a tutor has been working longer than 30 min\n return Time.now.in_time_zone + 60*30\n end\n return start_time + 60*30\n end", "def time_remaining\n end", "def time_span\n unless start_date < end_date\n errors.add(:courses, \"Please choose a time span longer than one day.\")\n end\n end", "def max_idle_time\n @max_idle_time ||= options[:max_idle_time]\n end", "def last_possible_defense_semester\n study_length * 2\n end", "def last_possible_exam_semester\n study_length * 2 - 2\n end", "def time_remaining\n\n end", "def max_interval\n MAX_INTERVAL\n end", "def max_allowed_deadline_date\n @deadline_calculator.max_allowed_deadline_date(max_time_limit)\n end", "def lesson_length\n seconds = self.end_at - self.start_at\n seconds / 3600.0\n end", "def max_wait_time\n @data[\"max_wait_time\"]\n end", "def get_time_remaining\n\n end", "def maximum_advance\n return @maximum_advance\n end", "def attempting_times_left\n @times_left ||= begin\n return MAX_ATTEMPTING_TIMES unless question.actable.attempt_limit\n\n times = question.actable.attempt_limit - submission.evaluated_or_graded_answers(question).size\n times = 0 if times < 0\n times\n end\n end", "def time_limit\n [2, problem.time_limit].min\n end", "def max_session_duration \n @max_session_duration ||= 15.minutes\n end", "def max_usage_time(current_time, max_usage)\n statuses = Reservation.statuses\n start_time = (current_time.to_time - max_usage.hours).to_datetime\n active_reservations = equipment.reservations\n .where('start_time >= ? AND start_time < ?', start_time, current_time)\n .where('status = ?', statuses[:confirmed])\n used_time = active_reservations.sum { |res| ((res.end_time - res.start_time) / 3600) }\n used_time\n end", "def max_record_duration_in_seconds\n return @max_record_duration_in_seconds\n end", "def maximum_duration=(value)\n @maximum_duration = value\n end", "def time_remaining(options = {})\n options[:private] ||= false\n\n if options[:private]\n [duration - seconds_since_started, 0].max\n else\n [PUBLIC_TIME_LIMIT - seconds_since_started, 0].max\n end\n end", "def max_tp\r\n return 100\r\n end", "def effective_num_days\n [sessions.count, time_constraint(:max_days)].compact.min\n end", "def get_time_required\n 0 # number of minutes\n end", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def remaining\n max - used\n end", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end", "def effective_start_at\n start_at - course&.advance_start_at_duration\n end", "def validate_time_limit\n return if duplicating? ||\n time_limit.nil? ||\n (time_limit > 0 && time_limit <= max_time_limit)\n\n errors.add(:base, \"Time limit needs to be a positive integer less than or equal to #{max_time_limit} seconds\")\n\n nil\n end", "def time_to_finish\n past_time = Time.now - self[:start_time]\n seconds_to_go = past_time * self[:max] / self[:current] - past_time\n puts \"time to go: #{seconds_to_go.round}s\"\n end", "def timeout_in\n if user.admin? # should this not be 'self.admin?' ?\n 1.year\n else\n 2.days\n end\n end", "def timelimit\n 15.minutes\n end", "def schedule_to_close_timeout; Float::INFINITY; end", "def idle_time_limit\n super\n end", "def time_required\n @time_required ||= distribution.map(&:sum).max\n end", "def course_end\n self.course_start + self.course_length - 1\n end", "def effective_num_hours\n actual_hours = sessions.map(&:hours).reduce(&:+)\n [actual_hours, time_constraint(:max_hours)].compact.min\n end", "def max_age; end", "def max_le\n gclass.send(\"max_#{ssex}_life_expectancy\").years\n end", "def while_time_remaining; end", "def timeout_in\n\t if self.role=='admin'\n\t 7.days\n\t else\n\t 2.days\n\t end\n\tend", "def time_constraint\n return @time_constraint\n end", "def maximum_advance=(value)\n @maximum_advance = value\n end", "def max_consumption\n @max_consumption ||= begin\n augment = max_repeats == Float::INFINITY ? 10 : max_repeats\n self.next&.max_consumption.to_i + augment\n end\n end", "def max_record_duration_in_seconds=(value)\n @max_record_duration_in_seconds = value\n end", "def effective_end_time\n if start_time.nil?\n accommodated_end_time\n else\n [start_time + accommodated_duration, accommodated_end_time].min\n end\n end", "def time_cannot_be_in_the_past\n time1 = DateTime.now - 300.minutes\n time2 = self.time \n if time1 > time2 \n errors.add(:time, \"can't be in the past \")\n end\n end", "def max_slack_after(ends_at)\n next_reservation = Reservation.new(entity: self, ends_at: ends_at).next\n (next_reservation.begins_at - next_reservation.slack_before.minutes - ends_at) / 1.minute if next_reservation.present?\n end", "def limit\n @timeout\n end", "def seen_renewals_remaining\n Float::INFINITY\n end", "def get_elapse_time\n @start_time ||= @time_now\n return @time_now - @start_time\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def estimate_at_completion_duration\n return planned_duration - earned_schedule\n end", "def cooldown_remaining\n return 0 unless @cooldown_reset_event\n return (@cooldown_reset_event.time - @sim.runner.current_time) / 1000\n end", "def time_tolerance_seconds\n 600\n end", "def lifetime\n\t\t\t\tClock.runtime() - @start\n\t\t\tend", "def remaining\n [0, @duration - elapsed].max\n end", "def at_submission_limit?\n if assessment.max_submissions == -1\n false\n else\n count = assessment.submissions.where(course_user_datum: course_user_datum).count\n count >= assessment.max_submissions\n end\n end", "def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end", "def max_talk_time_length\n 240\n end", "def time_left\n @lifetime - @elapsed_time\n end", "def duration_before_automatic_denial\n return @duration_before_automatic_denial\n end", "def set_max_wait_time\n q = 'Set the MAX WAIT TIME after executing the RESTART command ' \\\n '(>= 180 secs): '\n until @max_wait && @max_wait.to_i > 179\n @max_wait = Utils.qna(q.cyan, true)\n end\n end", "def time_limit\n frm.div(:class=>\"tier2\").table(:index=>0)[3][0].text\n end", "def accept_deadline\n start_time + ((end_time - start_time) * 0.1)\n end", "def time_shift(current_course, target_course)\n shift = target_course.start_at - current_course.start_at\n shift >= 0 ? shift : 0\n end", "def limit ns, max_per_hour\n\t\t\t@monitor.synchronize do\n\t\t\t\t@timeout[ns] = Time.now.to_i\n\t\t\t\t@limit[ns] = max_per_hour\n\t\t\tend\n\t\tend", "def terminate_now\n current_assignment = self.student.student_teams.current.first\n if current_assignment.nil?\n return true \n else\n current_assignment.end_date = Date.current\n current_assignment.update_attribute(:end_date, Date.current)\n end\n end", "def timedout?(last_access)\n !timeout_in.nil? && last_access && last_access <= timeout_in.ago\n end", "def fifteen_minutes_remaining\n return nil unless fifteen_minutes && fifteen_minutes_usage\n\n fifteen_minutes - fifteen_minutes_usage\n end", "def training_sessions_remaining_this_month\n end", "def effective_duration\n if start_time.nil?\n accommodated_duration\n else\n effective_end_time - start_time\n end\n end", "def max_timeout\n self.device.max_timeout\n end", "def limited?\n\t\t\t(Time.new - last_run) < interval\n\t\tend", "def max_age=(_arg0); end", "def time_management\n @personal_best = current_user.reports.map(&:time_management).max.round(2) rescue 0\n @personal_best = \"#{@personal_best}% Questions Attended\"\n learning_curve 'time_management'\n data_presenter 'time_management'\n end", "def max_story; CPanel::MAX_STORY; end", "def calc_locked_out_till\n ends_on.since locked_out_duration\n end", "def waits_too_long?(account)\n is?(:asked) and self.asked <= 4.days.ago.to_date\n end", "def remaining_time\n # calculate how old is the feedback\n created_at = self.created_at.to_time\n diff_seconds = (Time.now - created_at).round\n remaining = TEN_MINUTES - diff_seconds\n\n remaining.to_s\n end", "def projected_duration\n 30 * 60 # Hardcode at 30 minutes for now\n end", "def token_expiration_window\n # TODO - configurable per tenant\n 72\n end", "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "def students_scheduled\n self.lessons.size\n end", "def effective_end_datetime\n end_date + 1.day + roster.switchover.minutes\n end", "def closed?\n minutes_open = (Time.zone.now - self.created_at)/60.0\n time_limit = workout_offering.time_limit_for(user)\n\n !time_limit.nil? && minutes_open >= time_limit\n end", "def closed?\n minutes_open = (Time.zone.now - self.created_at)/60.0\n time_limit = workout_offering.time_limit_for(user)\n\n !time_limit.nil? && minutes_open >= time_limit\n end", "def max_redirects(times)\n @redirects = times\n end", "def time_left\n return 0.0 if free?\n return end_time - Time.now.to_f\n end", "def past_time_threshold?\n return true if @past_time_threshold # no need to check again once past\n @past_time_threshold = (Time.now-@start_time) >= N_PLUS_ONE_TIME_THRESHOLD\n end", "def max_threads\n\t\t\t@max_threads ||= 30\n\t\tend", "def max_age\n cache_control.reverse_max_age ||\n cache_control.shared_max_age ||\n cache_control.max_age ||\n (expires && (expires - date))\n end", "def unseen_renewals_remaining\n return Float::INFINITY if unlimited_renewals?\n\n unseen_renewals_allowed - renewal_count\n end" ]
[ "0.65161735", "0.6395259", "0.61827666", "0.6162111", "0.6110366", "0.6030329", "0.5977856", "0.5964557", "0.5884338", "0.58637553", "0.58605313", "0.5844379", "0.58055365", "0.57782406", "0.57744265", "0.5771327", "0.5747992", "0.57369184", "0.5735673", "0.5702214", "0.56946546", "0.56909865", "0.56175154", "0.557762", "0.55719113", "0.5566418", "0.5552325", "0.5538526", "0.55306643", "0.54877174", "0.54703665", "0.5463435", "0.54585445", "0.5454856", "0.5452553", "0.5429618", "0.5419378", "0.5418724", "0.54068184", "0.5377557", "0.5372686", "0.5366899", "0.5355501", "0.53530425", "0.5351757", "0.534605", "0.534116", "0.5306326", "0.5302506", "0.5302018", "0.52977467", "0.528449", "0.52838486", "0.5282449", "0.52792823", "0.52763367", "0.52633965", "0.5258573", "0.5258573", "0.5253631", "0.5252667", "0.5246149", "0.52327543", "0.5223418", "0.5220666", "0.5204322", "0.52032423", "0.5198881", "0.51973826", "0.51966256", "0.5189895", "0.5173172", "0.5168959", "0.5160668", "0.515678", "0.5156656", "0.5151875", "0.51411813", "0.51292205", "0.5116499", "0.51099813", "0.51079327", "0.51041716", "0.5100498", "0.5097529", "0.5096741", "0.5088842", "0.50871646", "0.50862247", "0.5084028", "0.5077983", "0.50708145", "0.5066417", "0.5066417", "0.50562274", "0.50461036", "0.50380605", "0.50361025", "0.50335276", "0.5033005" ]
0.5141335
77
Convert the days to time duration and store it.
def advance_start_at_duration_days=(value) value = if value.present? && value.to_i > 0 value.to_i.days else nil end settings(:course).advance_start_at_duration = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration_days\n return nil if self.duration.blank?\n number,units=duration_parts\n return unless number.present? && units.present?\n\n if units=='years'\n number=12*number\n units='months'\n end\n number.send(units)\n end", "def duration_in_days=(value)\n @duration_in_days = value\n end", "def calculate_duration(duration)\n [duration.to_i, 'seconds']\n end", "def duration_in_days\n return @duration_in_days\n end", "def d2s(days)\n days * 24 * 60 * 60\n end", "def days ; Duration[self * 86400] ; end", "def time_days() (@time_end.jd - @time_start.jd) + 1; end", "def decompose_as_time\n s = self\n days = (s / 1.day).nil_if_zero\n reste = s % 1.day\n hours = (reste / 3600).nil_if_zero\n reste = reste % 3600\n minutes = (reste / 60).nil_if_zero\n seconds = (reste % 60).nil_if_zero\n {days: days, hours: hours, minutes: minutes, seconds: seconds}\n end", "def calc_play_seconds\n @time_days.to_i * 86400 + @time_hours.to_i * 3600 + @time_minutes.to_i * 60\n end", "def calc_duration\n @duration = (Time.now - @start) * 1000.0\n end", "def duration\n (Time.mktime(0)+(tracks.map(&:duration).inject(:+) || 0)).strftime(\"%H:%M:%S\")\n end", "def duration\n (self.end_date.to_i/60/60/24) - (self.start_date.to_i/60/60/24)\n end", "def duration\n if ending >= beginning\n (ending.to_i - beginning.to_i)\n else\n start_of_day = TimeOfDay.new(0,0,0)\n end_of_day = TimeOfDay.new(23,59,59)\n duration_day_1 = (end_of_day.to_i - beginning.to_i) + 1\n duration_day_2 = (ending.to_i - start_of_day.to_i)\n duration_day_1 + duration_day_2\n end\n end", "def server_duration\n # TODO: MAJOR HACK!\n # The db can't store the year,month, day information\n # So when we try to store 24:00 hours it gets saved a 2000-01-01 00:00:00\n # Therefore, we use the 'seconds' field to record that we rolled over\n # Then, when we convert back from server format to client format we know\n # if the 00:00 represents 00:00 or 24:00\n # Better to find a better format to record duration..\n value = ('2000-01-01 ' + @duration).to_time(:utc)\n value.day == 2 ? value + 1.seconds : value\n end", "def duration_seconds\n hours = hours_flight\n minutes = minutes_flight\n if hours && minutes\n hours * 3600 + minutes * 60\n else\n 0\n end\n end", "def duration\n @duration = to_seconds @data.fetch('duration', 0)\n end", "def adjusted_duration\n duration + assignment.submission_rule.periods.pluck(:hours).sum.hours\n end", "def d_days( v )\n TimeDelta.new( DAY_TO_MS * v )\n end", "def duration\n raw_duration.to_f/time_scale\n end", "def duration\n raw_duration.to_f/time_scale\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 durations\n @durations ||= Hash[ duration_keys.map{ |f, k| [ f, instance_variable_get(:\"@#{k}\") ] } ]\n end", "def update_actual_duration\n self.actual_duration = Date.today - self.startDate\n end", "def end_time(start, duration)\n DateTime.parse(start) + (duration / (24*60*60))\n end", "def duration\n entries.map{ |en| en['duration'] }.sum\n end", "def calculate_duration_fields(**duration_fields)\n result = duration_fields.dup\n\n case duration_fields.compact\n in { start_date: start_date, end_date: end_date }\n result.merge(duration: (end_date.to_date - start_date.to_date + 1).to_i)\n in { start_date: start_date, duration: duration }\n result.merge(end_date: start_date.to_date + (duration.to_i - 1).days)\n in { end_date: end_date, duration: duration }\n result.merge(start_date: end_date.to_date - (duration.to_i - 1).days)\n else\n result\n end\n end", "def duration\n @duration ||= timestamp_delta / 256.0\n end", "def duration_to_seconds(duration)\n t = Time.strptime(duration, '%Hh%Mm')\n hours_spent = t.hour\n minutes_spent = t.min\n\n temp = format('%sh%sm', hours_spent, minutes_spent)\n\n if temp != duration\n error_msg = [Hash[@error => 'time object: invalid duration string']]\n return error_msg\n end\n\n # Convert duration to seconds\n return (hours_spent * 3600) + (minutes_spent * 60)\n rescue\n error_msg = [Hash[@error => 'time object: invalid duration string']]\n return error_msg\n end", "def duration\n (finish - start)/3600\n end", "def duration\n assignment.duration + (extension&.time_delta || 0)\n end", "def days() 24 * hours end", "def elapsed\n ms = duration\n s = ms.to_i\n ms = ((ms - s) * 1000).to_i\n h = s / 3600\n s = s % 3600\n d = h / 24\n h = h % 24\n m = s / 60\n s = s % 60\n return d, h, m, s, ms\n end", "def get_duration\n ((finish - start) / 60 / 60) - (break_length / 60)\n end", "def duration\n if start_time && end_time\n end_time.to_i - start_time.to_i\n else\n 0.0\n end\n end", "def duration\n if @end_time.nil?\n raise StandardError.new(\"Cannot calculate trip duration. Trip is still in progress.\")\n else\n time_in_seconds = @end_time - @start_time\n time_in_hours = time_in_seconds / 3600\n end\n end", "def duration\n @duration ||= (range[1] - range[0]) / 1000.0\n end", "def end_time(starttime, duration)\n endtime = starttime\n if duration\n seconds = 0\n duration.split(\" \").each do |dur|\n if dur.include?(\"d\")\n seconds = seconds + (60 * 60 * 24 * dur.to_i) #add seconds in the number of days\n elsif dur.include?(\"h\")\n seconds = seconds + (60 * 60 * dur.to_i) #add seconds in the count of hours\n else\n seconds = seconds + (60 * dur.to_i) #add seconds in the count of minutes\n end\n end\n return endtime + seconds\n else\n return endtime + (60*60) #default of 1 hour\n end\nend", "def duration\n e_date = start_date\n all_tasks.each do |task|\n e_date = task.end_date if task.end_date > e_date\n end\n (e_date - start_date).to_i\n end", "def adjust_duration\n # convert minutes into seconds\n self.duration = duration.to_i * 60\n end", "def shift_duration #get the duration of a shift\n ((self.start_time && self.end_time) ? self.end_time - self.start_time : 0)/60/60\n end", "def stay_duration_seconds\n return 0 unless next_segment\n # when we arrive at the next airport, minus when we arrived at this\n # airport.\n (next_segment.departure_time.to_time - arrival_time.to_time).to_i\n end", "def duration\n @duration ||= tick * @data.values[0].length\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 duration\n duration = data(\"duration\")\n duration_to_seconds(duration.to_f) if duration\n end", "def duration # in days\n @due_date - @start_date + 1\n end", "def total_time\n minutes_to_human_readable_time(entries.internal.sum(:duration) + expected_remaining_work * 60)\n end", "def duration\n TingYun::Helper.time_to_millis(@exit_timestamp - @entry_timestamp)\n end", "def convert_to_duration(hours_param)\n times_array = hours_param.split(\":\")\n hrs = times_array[0].to_f\n min = times_array[1].to_f\n sec = times_array[2].to_f\n min = min / 60\n sec = sec / (60 * 60)\n hrs += (min + sec)\n end", "def date_time_duration(start_date, end_date)\n Converter.seconds_to_duration(end_date - start_date)\n end", "def to_days; Rational === @val ? @val/60/60/24 : @val/60.0/60/24 end", "def duration_cost(days = days_needed)\n days = 0 if days.nil?\n if days == 3\n cost = 0\n elsif days > 3 && days <= 7\n cost = 100 * days\n elsif(days > 7)\n cost = 700 + (50 * days)\n end\n end", "def get_video_duration\n # duration = Time.strptime((page.find('.ytp-time-duration').text),\"%H:%S\")\n label_time = (page.find('.ytp-time-duration').text).split(\":\")\n duration = label_time[0].to_i * 60 + label_time[1].to_i\n return duration\nend", "def duration\n 1 + (@end_date - @start_date).to_i\n end", "def duration_in_seconds\n reserve_end_at = row.reserve_end_at || end_time\n reserve_end_at = end_time if reserve_end_at > end_time\n reserve_start_at = row.reserve_start_at > start_time ? row.reserve_start_at : start_time\n (reserve_end_at - reserve_start_at).round\n end", "def check_duration\n calculate_duration if self.duration != get_duration\n end", "def new_duration\n @duration\n end", "def duration; ((endtime()- starttime()) / 60).to_i; end", "def minutes_as_duration\n WorkEntry.minutes_as_duration(self.minutes)\n end", "def set_dates_and_duration\n if start_date && end_date && !duration\n self.duration = (end_date - start_date).to_i + 1 # if it's same date, duration should be 1\n elsif start_date && !end_date && duration\n self.end_date = start_date + (duration - 1).days\n elsif !start_date && end_date && duration\n self.start_date = end_date - (duration - 1).days\n end\n end", "def duration_to_sec(duration)\n seconds, minutes, hours = duration.split(\":\").reverse\n\n (hours.to_i * 60 * 60) + (minutes.to_i * 60) + seconds.to_i\nend", "def duration\n @duration\n end", "def end_time\n start_time + treatment.duration.minutes\n end", "def entry_duration(entry)\n (entry.scheduled_datetime - entry.completed_datetime) / 1.hour\n end", "def countdown_duration(start_time, end_time)\n duration = nil\n if start_time && end_time\n # Calculate the difference between now and then\n difference = end_time - start_time\n\n #calculating the days, hours, minutes and seconds\n #out of the initial large seconds value generated by 'difference',\n #then dropping the values after the decimal\n days = (difference / (60*60*24)).to_i\n days_remainder = (difference % (60*60*24)).to_i\n hours = (days_remainder / (60*60)).to_i\n hours_remainder = (days_remainder % (60 * 60)).to_i\n minutes = (hours_remainder / 60).to_i\n seconds = (hours_remainder % 60).to_i\n\n # apply leading zero if needed\n duration = \"\"\n if days < 10\n duration << \"0\"\n end\n duration << days.to_s\n duration << \":\"\n if hours < 10\n duration << \"0\"\n end\n duration << hours.to_s\n duration << \":\"\n if minutes < 10\n duration << \"0\"\n end\n duration << minutes.to_s\n duration << \":\"\n if seconds < 10\n duration << \"0\"\n end\n duration << seconds.to_s\n\n end\n return duration\n end", "def task_duration\n\n if self.complete?\n sprintf(\"%4.1f\", (self.completed_on - self.created_on) / 1.day)\n else\n '0'\n end\n\n end", "def days ; self * 24.hours ; end", "def sec2dhms(secs)\n\ttime = secs.round\n\tsec = time % 60\n\ttime /= 60\n\t\n\tmins = time % 60\n\ttime /= 60\n\n\thrs = time % 24\n\ttime /= 24\n\n\tdays = time\n\t[days, hrs, mins, sec]\nend", "def determineTime(durations)\n h = []\n m = []\n s = []\n if durations.empty?\n return true\n else\n \tdurations.each do |time|\n split_time = time.split(\":\").map(&:to_i)\n h << split_time[0]\n m << split_time[1]\n s << split_time[2]\n end\n\n hours_seconds = h.inject(:+) * 3600\n minutes_seconds = m.inject(:+) * 60\n sum_time = hours_seconds + minutes_seconds + s.inject(:+)\n\n if durations.empty? || sum_time > 86400\n return false\n else\n return true\n end\n end\nend", "def duration\n # TODO: make sure this case handling for trip in prgress fits specs\n if end_time == nil\n return 0\n end\n start_in_sec = (@start_time.hour * 3600) + (@start_time.min * 60) + @start_time.sec\n end_in_sec = (@end_time.hour * 3600) + (@end_time.min * 60) + @end_time.sec\n return end_in_sec - start_in_sec\n end", "def parts_to_duration(parts)\n parts = parts.to_h.slice(*CAST_PARTS)\n return 0.seconds if parts.blank?\n\n seconds = 0\n parts = parts.map do |part, num|\n num = num.to_i unless num.is_a?(Numeric)\n next if num <= 0\n\n seconds += num.send(part).value\n [part.to_sym, num]\n end\n\n ActiveSupport::Duration.new(seconds, parts.compact)\n end", "def d_secs( v )\n TimeDelta.new( SEC_TO_MS * v )\n end", "def get_duration()\n puts \"The task will take #{(@date_end - @date_start).to_i} days\"\n end", "def entry_duration(entry)\n if !entry.completed_datetime.nil?\n (entry.completed_datetime - entry.scheduled_datetime) / 1.hour\n else\n 0.0\n end\n end", "def shift_duration\n duration = Utilities.time_diff_hours(shift_start, shift_end)\n\n if duration < 1 || duration > 24\n raise LogworkException::InvalidShiftHoursDuration.new,\n \"Unable to calculate your shift hours. Configuration values shift_start and/or shift_end are invalid.\"\n end\n\n duration\n end", "def elapsed_days t1\n ((Time.now - t1) / 86400).to_i + 1\n end", "def duration\n duration = @file_metadata.duration.to_s\n\n # in format like: 0:02:43 (approx)\n if duration.match /(\\d{1,2}):(\\d{1,2}):(\\d{1,2})/\n hours = $1.strip.to_i\n minutes = $2.strip.to_i\n seconds = $3.strip.to_i\n\n if hours.to_i == 0\n return sprintf(\"%02d:%02d\", minutes, seconds)\n else\n return sprintf(\"%01s:%02d:%02d\", hours, minutes, seconds)\n end\n elsif duration.match /(\\d{1,2})\\.(\\d{1,2}) s/i\n # in format like: 23.41 s (approx)\n # $1 = 23\n # $2 = 41\n seconds = $1.strip.to_i\n return sprintf(\"%02d:%02d\", 0, seconds)\n end\n end", "def duration\n vpm * 0.01\n end", "def duration_with_work_days\n if self.start_date && self.due_date\n RedmineBetterGanttChart::Calendar.workdays_between(self.start_date, self.due_date)\n else\n 0\n end\n end", "def update_target_duration\n self.target_duration = self.endDate - self.startDate\n end", "def get_duration\n duration_instance.span\n end", "def end_time\n start_time + duration\n end", "def duration_formatted\n if self.duration.days > 0\n hours = self.duration.total / 60 / 60\n self.duration.format \"#{hours}:%M:%S\"\n else\n self.duration.format \"%H:%M:%S\"\n end\n end", "def duration\n @duration ||=\n self.starts_at && self.ends_at &&\n ((self.ends_at - self.starts_at) / 60.0 / 60.0)\n end", "def duration\n self.end_time - self.start_time\n end", "def duration=(value)\n @duration = value\n end", "def duration=(value)\n @duration = value\n end", "def days\n self.to_i * 86_400\n end", "def duration\n data.duration\n end", "def getDuration\r\n\t\t\t\t\treturn @duration\r\n\t\t\t\tend", "def days\n # +1 because end_date is included in the duration range\n ((end_date - start_date) / 3600 / 24).to_i + 1\n end", "def duration\n @data['duration']['value']\n end", "def time_to_day_fraction(h, min, s)\n (h*3600 + min*60 + s)/86400.0\n end", "def convert_duration_to_nums(duration)\n duration_values = duration.scan(/\\d+/)\n duration_hash = { hour: 0, minutes: 0 }\n if duration.include?(\"&\")\n duration_hash[:hour] = duration_values[0].to_i\n duration_hash[:minutes] = duration_values[1].to_i\n elsif duration.include?(\"hour\")\n duration_hash[:hour] = duration_values[0].to_i\n else\n duration_hash[:minutes] = duration_values[0].to_i\n end\n duration_hash\n end", "def duration\n @end_date - @begin_date\n end", "def day_fraction_to_time(fr)\n hours, fr = (fr * 24).divmod(1)\n minutes, fr = (fr * 60).divmod(1)\n seconds, sec_fract = (fr * 60).divmod(1)\n [hours, minutes, seconds, sec_fract]\n end", "def duration\n return -1.0 if @start_time.nil? || @end_time.nil?\n (@end_time - @start_time) / 60.0\n end", "def calc_duration(id)\n comp = @components[id]\n # basic duration calculation\n if comp.start.is_a?(Numeric) && comp.duration.is_a?(Numeric)\n @max_duration = [@max_duration, (comp.start + comp.duration)].max\n return\n end\n # duration based on components\n if @components.has_key?(comp.start)\n # register start time\n start = @components[comp.start].start\n # calculate based on association\n if comp.duration.is_a?(Numeric)\n duration = comp.duration\n elsif [:WITH, :HIT].include?(comp.duration)\n comp.hit = comp.start if comp.duration == :HIT\n duration = @components[comp.start].duration\n elsif comp.duration == :MID\n start = @components[comp.start].start + @components[comp.start].duration/2.0\n duration = comp.default_duration\n elsif comp.duration == :AFTER\n start = @components[comp.start].start + @components[comp.start].duration\n duration = comp.default_duration\n end\n # apply new start and duration\n comp.start = start\n comp.duration = duration\n # calculate max duration\n @max_duration = [@max_duration, (start + duration)].max\n else\n # failsafe\n comp.start = 0\n comp.duration = 0\n end\n end", "def duration_to_seconds(duration)\n duration.to_f / 1000.0\n end", "def days\n @msecs / DAY_TO_MS_F\n end", "def getDurationHours\r\n\t\t\t\t\treturn @durationHour\r\n\t\t\t\tend", "def duration\n return @duration\n end" ]
[ "0.67037094", "0.6609587", "0.65135217", "0.6428791", "0.63726586", "0.635334", "0.62266695", "0.6143979", "0.61352617", "0.6099018", "0.60483307", "0.59891057", "0.59835106", "0.5950215", "0.5941363", "0.5935504", "0.5919524", "0.5913908", "0.5909194", "0.5909194", "0.5907545", "0.588726", "0.5875781", "0.5864289", "0.5862436", "0.5835047", "0.5832891", "0.5822465", "0.5794418", "0.5777513", "0.57767427", "0.57750297", "0.5753346", "0.57528895", "0.5737712", "0.57305056", "0.57256365", "0.57221574", "0.5709475", "0.5706053", "0.56991863", "0.5692214", "0.5652404", "0.56521475", "0.5650364", "0.5646356", "0.56389344", "0.5631825", "0.56293976", "0.5620224", "0.5611969", "0.56055784", "0.55952364", "0.5590741", "0.55866945", "0.5581138", "0.55807275", "0.5578053", "0.55736107", "0.5563164", "0.55512756", "0.55409485", "0.5540297", "0.55328834", "0.55255336", "0.55243397", "0.55210024", "0.5518564", "0.5515806", "0.5515031", "0.55050004", "0.55028296", "0.5501855", "0.54963946", "0.5495154", "0.5492184", "0.54876995", "0.548217", "0.54789424", "0.54777575", "0.54752076", "0.54738003", "0.5467598", "0.5463704", "0.5455262", "0.5455262", "0.5454153", "0.54479605", "0.5440829", "0.54282045", "0.5423899", "0.5414161", "0.5408857", "0.5408254", "0.5407582", "0.5404239", "0.5399847", "0.53966725", "0.5394207", "0.53920466", "0.5383824" ]
0.0
-1
POST /tests POST /tests.json
def create @admintheme = Theme.new(admintheme_params) respond_to do |format| if @admintheme.save format.html { redirect_to adminthemes_path, notice: 'Test was successfully created.' } format.json { render :show, status: :created, location: @admintheme } else format.html { render :new } format.json { render json: @admintheme.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v2_tests_post(test_detail, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: TestsApi#v2_tests_post ...\"\n end\n \n # verify the required parameter 'test_detail' is set\n fail \"Missing the required parameter 'test_detail' when calling v2_tests_post\" if test_detail.nil?\n \n # resource path\n path = \"/v2/tests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json', 'application/xml', 'text/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(test_detail)\n \n\n auth_names = []\n result = @api_client.call_api(:POST, 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 => 'TestSummary')\n if Configuration.debugging\n Configuration.logger.debug \"API called: TestsApi#v2_tests_post. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end", "def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end", "def test_post_success_with_param\n post \"/\", {:data => @test_obj} do |response|\n assert response.ok?, \"Create test object failed\"\n assert_equal response.body, @test_obj.to_json, \"Did not get @test_obj back\"\n end\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n render status: :ok, json: @tests\n end", "def create\n @test = Test.new(params[:test])\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render json: @test, status: :created, location: @test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_index \n post :index \n assert_response :success \n end", "def create\n @testtest = Testtest.new(testtest_params)\n\n respond_to do |format|\n if @testtest.save\n format.html { redirect_to @testtest, notice: 'Testtest was successfully created.' }\n format.json { render :show, status: :created, location: @testtest }\n else\n format.html { render :new }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = current_user.tests.build(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to thank_you_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n result = Test.new.create_test(test_params)\n if result\n return render json: {message: 'Test was created succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not created succesfully', error: true }\n end\n end", "def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end", "def test\n render json: { test: 'Tested.' }\n end", "def test\n render json: { test: 'Tested.' }\n end", "def create\n @jsontest = Jsontest.new(jsontest_params)\n\n respond_to do |format|\n if @jsontest.save\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully created.' }\n format.json { render :show, status: :created, location: @jsontest }\n else\n format.html { render :new }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Prueba creada exitosamente.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end", "def create\n @test_post = TestPost.new(test_post_params)\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render :show, status: :created, location: @test_post }\n else\n format.html { render :new }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end", "def create\n @test_post = TestPost.new(params[:test_post])\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render json: @test_post, status: :created, location: @test_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_test = UserTest.new(user_test_params)\n\n respond_to do |format|\n if @user_test.save\n format.html { redirect_to admin_user_tests_path, notice: 'User test was successfully created.' }\n format.json { render :show, status: :created, location: @user_test }\n else\n format.html { render :new }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end", "def test_the_application_can_create_an_item\n # Send a POST request to '/items' endpoint that creates a new item\n # with a title of 'Learn to test controllers' and a description 'This is great'\n # Assert that the controller responds with a status of 200\n # Assert that the controller responds with a body of 'Item created'\n # Assert that the ToDo table has an item in it\n end", "def create\n @test_detail = TestDetail.new(test_detail_params)\n\n respond_to do |format|\n if @test_detail.save\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully created.' }\n format.json { render :show, status: :created, location: @test_detail }\n else\n format.html { render :new }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end", "def test_create_a_task_with_valid_attributes\n post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1 } } # post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1, status_id: 1 } }\n assert_equal 1, Task.count # count is a method that ActiveRecord gives us\n assert_equal 200, last_response.status\n assert_equal \"created!\", last_response.body\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def create\n @testis = Teste.new(params[:testis])\n\n respond_to do |format|\n if @testis.save\n format.html { redirect_to @testis, notice: 'Teste was successfully created.' }\n format.json { render json: @testis, status: :created, location: @testis }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testis.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 test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end", "def test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def create\n @smoke_test = SmokeTest.new(params[:smoke_test])\n\n respond_to do |format|\n if @smoke_test.save\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully created.') }\n format.json { render :json => @smoke_test, :status => :created, :location => @smoke_test }\n format.xml { render :xml => @smoke_test, :status => :created, :location => @smoke_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @runtest = Runtest.new(runtest_params)\n\n respond_to do |format|\n if @runtest.save\n format.html { redirect_to @runtest, notice: 'Runtest was successfully created.' }\n format.json { render :show, status: :created, location: @runtest }\n else\n format.html { render :new }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testing_ = Testing.new(testing__params)\n\n respond_to do |format|\n if @testing_.save\n format.html { redirect_to @testing_, notice: 'Testing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testing_ }\n else\n format.html { render action: 'new' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end", "def run_test\n # Make sure that params have been set\n raise_error('You need to pass some params to run the test. At least, an url or script') unless block_given?\n params = Hashie::Mash.new\n yield params\n raise_error('No params were passed to run_test method') if params.empty?\n\n response = connection.post do |req|\n req.url \"#{TEST_BASE}\"\n req.params['k'] = key\n req.params['f'] = @params.f\n params.each do |k, v|\n req.params[k] = v\n end\n end\n return not_available (response) unless response.status == 200\n @response = Response.new(self, Hashie::Mash.new(JSON.parse(response.body)))\n end", "def create\n @tktest = Tktest.new(params[:tktest])\n\n respond_to do |format|\n if @tktest.save\n format.html { redirect_to @tktest, notice: 'Tktest was successfully created.' }\n format.json { render json: @tktest, status: :created, location: @tktest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application_test = ApplicationTest.new(application_test_params)\n\n respond_to do |format|\n if @application_test.save\n format.html { redirect_to @application_test, notice: 'Application test was successfully created.' }\n format.json { render :show, status: :created, location: @application_test }\n else\n format.html { render :new }\n format.json { render json: @application_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testing = Testing.new(testing_params)\n\n respond_to do |format|\n if @testing.save\n format.html { redirect_to @testing, notice: 'Testing was successfully created.' }\n format.json { render :show, status: :created, location: @testing }\n else\n format.html { render :new }\n format.json { render json: @testing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end", "def create\n @test10 = Test10.new(params[:test10])\n\n respond_to do |format|\n if @test10.save\n format.html { redirect_to @test10, notice: 'Test10 was successfully created.' }\n format.json { render json: @test10, status: :created, location: @test10 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_params\n params.require(:test).permit(:index, :new, :create, :show, :update, :delete)\n end", "def create\n tp = test_params.merge!(plate_id: params[:plate_id])\n @test = Test.new(tp)\n authorize Test\n respond_to do |format|\n if @test.save\n @test.plate.complete!\n @test.auto_retest!\n format.html { redirect_to plate_url(@test.plate), notice: 'Test was successfully created.'}\n format.json { render :show, status: :created, location: test }\n else\n format.html { render :new, status: :unprocessable_entity}\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type_test = TypeTest.new(type_test_params)\n\n respond_to do |format|\n if @type_test.save\n format.html { redirect_to @type_test, notice: 'Type test was successfully created.' }\n format.json { render :show, status: :created, location: @type_test }\n else\n format.html { render :new }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fixit_test = FixitTest.new(fixit_test_params)\n\n respond_to do |format|\n if @fixit_test.save\n format.html { redirect_to @fixit_test, notice: 'Fixit test was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fixit_test }\n else\n format.html { render action: 'new' }\n format.json { render json: @fixit_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_test = TestTest.new(params[:test_test])\n\n respond_to do |format|\n if @test_test.save\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully created.') }\n format.xml { render :xml => @test_test, :status => :created, :location => @test_test }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test_run = TestRun.new(params[:test_run])\n\n respond_to do |format|\n if @test_run.save\n format.html { redirect_to @test_run, notice: 'Test run was successfully created.' }\n format.json { render json: @test_run, status: :created, location: @test_run }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_datum = TestDatum.new(test_datum_params)\n\n respond_to do |format|\n if @test_datum.save\n format.html { redirect_to @test_datum, notice: 'Test datum was successfully created.' }\n format.json { render :show, status: :created, location: @test_datum }\n else\n format.html { render :new }\n format.json { render json: @test_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_params\n params.require(:test).permit(:description, :expected_result, :test_link)\n end", "def test_params\n params.require(:test).permit(:name, :test_type_id, :schedule, :duration, :is_online, :no_of_items, :subject_class_id)\n end", "def test_params\n params.require(:test).permit(:indentifier, :description, :time)\n end", "def create\n @what_test = WhatTest.new(what_test_params)\n\n respond_to do |format|\n if @what_test.save\n format.html { redirect_to @what_test, notice: 'What test was successfully created.' }\n format.json { render :show, status: :created, location: @what_test }\n else\n format.html { render :new }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @applicant_test = @applicant.applicant_tests.new(applicant_test_params)\n\n respond_to do |format|\n if @applicant_test.save\n format.html { redirect_to applicant_url(@applicant), notice: \"Test Agregado Correctamente.\" }\n format.json { render :show, status: :created, location: applicant_url(@applicant) }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @applicant_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\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::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end", "def create\n @test = Mg::Test.new(params[:test])\n\n if @test.save\n flash[:notice] = 'Test was successfully created.'\n redirect_to mg_test_url :id => @test.id\n else\n render :action => \"new\"\n end\n end", "def create\n @test1 = Test1.new(test1_params)\n\n respond_to do |format|\n if @test1.save\n format.html { redirect_to @test1, notice: \"Test1 was successfully created.\" }\n format.json { render :show, status: :created, location: @test1 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @httparty_test = HttpartyTest.new(httparty_test_params)\n\n respond_to do |format|\n if @httparty_test.save\n format.html { redirect_to @httparty_test, notice: 'Httparty test was successfully created.' }\n format.json { render :show, status: :created, location: @httparty_test }\n else\n format.html { render :new }\n format.json { render json: @httparty_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def testing_params\n params.require(:testing).permit(:requiredtests, :name, :customer, :description, :supplier, :supplierrefferenceno, :leadtime, :testdate, :results, :retestdate, :reresults, :cost, :trackingsheet)\n end", "def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end", "def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test\n render json: { message: 'Hello World' }\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_create_lead\n client.expects(:request).with(:post, 'https://api.com/rest/sites/site-123/leads',\n '{\"email\":\"lead@gmail.com\"}', nil)\n\n client.create_lead(\"site-123\", {email: \"lead@gmail.com\"})\n end", "def create\n @test_item = TestItem.new(test_item_params)\n\n respond_to do |format|\n if @test_item.save\n format.html { redirect_to @test_item, notice: 'Test item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = @subject.tests.new(params[:test])\n if @test.save\n redirect_to user_subject_tests_path\n else\n render :action => \"new\"\n end\n end", "def testtest_params\n params[:testtest]\n end", "def test_params\n params.require(:test).permit(:number, :model, :sample_received, :report_received, :inspection_id, :standard_id, :project_id, :comments)\n end", "def create_test_order(options)\n request :account, :post, 'order/test', options\n end", "def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end", "def create\n if has_missing_params?([:test_output, :test_run_id])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n test_run = TestRun.find(params[:test_run_id])\n begin\n test_run.create_test_script_results_from_json(params[:test_output])\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n rescue\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end", "def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_duplicate_user\n data = { 'email' => 'ace@base.se', 'password' => 'open1234' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n json_data = JSON last_response.body\n assert json_data['errors'].present?\n end", "def create\n @runscope_test = RunscopeTest.new(runscope_test_params)\n\n respond_to do |format|\n if @runscope_test.save\n format.html { redirect_to @runscope_test, notice: 'Runscope test was successfully created.' }\n format.json { render :show, status: :created, location: @runscope_test }\n else\n format.html { render :new }\n format.json { render json: @runscope_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_stuff = TestStuff.new(test_stuff_params)\n\n respond_to do |format|\n if @test_stuff.save\n format.html { redirect_to @test_stuff, notice: 'Test stuff was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_stuff }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usertest = Usertest.new(params[:usertest])\n\n respond_to do |format|\n if @usertest.save\n format.html { redirect_to @usertest, notice: 'Usertest was successfully created.' }\n format.json { render json: @usertest, status: :created, location: @usertest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usertest.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_params\n params.require(:test).permit(:name)\n end", "def test_create_user_unsuccessful\n data = {\n username: \"\",\n password: \"hoangvietanh91\",\n password_confirmation: \"hoangvietanh91\",\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"viet.anh@mulodo.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n expected = 1001\n resp = Net::HTTP.post_form(URI.parse('http://localhost:3000/v1/users'),data)\n actual = JSON.parse(resp.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def create\n @validation_test = ValidationTest.new(validation_test_params)\n\n respond_to do |format|\n if @validation_test.save\n format.html { redirect_to @validation_test, notice: 'Validation test was successfully created.' }\n format.json { render :show, status: :created, location: @validation_test }\n else\n format.html { render :new }\n format.json { render json: @validation_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t# add actions here\n # This action takes place in the test suite controller\n end", "def post_ruby\n \n code = params[:code]\n step = params[:step]\n @step = Step.find(step)\n @valid = 0\n @testCount = @step.code_tests.count\n @step.code_tests.each do |test|\n code = validateCode(code)\n @testcode = code + \"\\n print \" + test.input \n testResult = testResult(@testcode)\n logger.info\"..............................#{testResult}\"\n if testResult.to_s == test.output \n @valid += 1 \n end\n \n \n end\n @message = \"#{@valid} out of #{@testCount} testcases passed\"\n render json: {status: 'SUCCESS', testPass: @valid, testCount: @testCount, message:@message },status: :ok\n end", "def create\n @student_test = StudentTest.new(params[:student_test])\n\n respond_to do |format|\n if @student_test.save\n format.html { redirect_to @student_test, notice: 'Student test was successfully created.' }\n format.json { render json: @student_test, status: :created, location: @student_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_params\n params.require(:test).permit(:title, :short, :state)\n end", "def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_submit_signup\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy1\", :create_email =>\"fred@fred.com\" }\n assert_response :bad_request\n assert_equal \"Passwords do not match\", @response.body\n assert_nil session[:user]\n\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy\", :create_email =>\"fred@fred.com\" }\n assert_response :success\n assert_equal 'fred', session[:user][:username]\n end", "def test_should_create_group_invite_via_API_JSON\r\n \r\n end", "def test_create\n\n admin_session = cathy_admin_session\n # Verify that a platform can be added. The number of platforms will\n # increase by one.\n assert_equal(5, Platform.count)\n\n new_platform = { 'active' => '1', 'name' => 'Thunderbird' }\n\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n assert_equal(\"Platform #{new_platform['name']} added\", flash['notice'])\n assert_redirected_to(:action => 'list')\n \n # Try to add a second platform with the same name.\n # It should not get added.\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name has already been taken\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n\n # Try to add a platform withhout a name.\n # It should not get added.\n post(:create, { :new_platform => { 'active' => '1', 'name' => '' } }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name can't be blank\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n end", "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_suite }\n end\n end", "def test_checking_saving_values\n post '/save-values', :value1 => '1', :value2 => '2'\n token_json = JSON.parse(last_response.body)\n assert_not_equal \" \", token_json['id']\n end" ]
[ "0.72139466", "0.70664746", "0.70649576", "0.698973", "0.68169713", "0.6594761", "0.6549934", "0.6549934", "0.6549934", "0.6549934", "0.6549934", "0.6549934", "0.65116346", "0.64799345", "0.64702207", "0.6453199", "0.6437914", "0.6407723", "0.63976455", "0.6325744", "0.6325744", "0.6283378", "0.62668014", "0.6260816", "0.62560624", "0.62288237", "0.61961913", "0.6188176", "0.6154824", "0.61540574", "0.6147011", "0.60692245", "0.6059116", "0.60526246", "0.60483086", "0.6036433", "0.6036053", "0.602331", "0.60223776", "0.60143495", "0.6000325", "0.6000325", "0.59680325", "0.59668803", "0.596638", "0.5962468", "0.59621257", "0.59585273", "0.5957035", "0.5949743", "0.5933972", "0.5933741", "0.59257734", "0.58890355", "0.58874935", "0.58846396", "0.5880545", "0.58777946", "0.58772993", "0.5875763", "0.5863714", "0.5849156", "0.58476037", "0.58339614", "0.5832362", "0.5824599", "0.5823201", "0.5818945", "0.5816932", "0.58077663", "0.58029807", "0.5802522", "0.58021426", "0.58003795", "0.5793477", "0.57916695", "0.57905334", "0.578877", "0.57871956", "0.5785927", "0.57827896", "0.57810104", "0.57776976", "0.5774928", "0.5773101", "0.5764966", "0.57623637", "0.5757679", "0.57399404", "0.5738896", "0.573714", "0.57287496", "0.5727302", "0.57245606", "0.57121533", "0.5708125", "0.57014275", "0.5689672", "0.56882805", "0.5687434", "0.5680322" ]
0.0
-1
PATCH/PUT /tests/1 PATCH/PUT /tests/1.json
def update respond_to do |format| if @theme.update(adminthemes_params) format.html { redirect_to @admintheme, notice: 'Test was successfully updated.' } format.json { render :show, status: :ok, location: @admintheme } else format.html { render :edit } format.json { render json: @admintheme.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to root_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\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 if @test.update(test_params)\n render status: :ok, json: @test\n else\n self.send(:edit)\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\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 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 patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @test_stuff.update(test_stuff_params)\n format.html { redirect_to @test_stuff, notice: 'Test stuff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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 @test1.update(test1_params)\n format.html { redirect_to @test1, notice: \"Test1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fixit_test.update(fixit_test_params)\n format.html { redirect_to @fixit_test, notice: 'Fixit test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fixit_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n if @test10.update_attributes(params[:test10])\n format.html { redirect_to @test10, notice: 'Test10 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testing_.update(testing__params)\n format.html { redirect_to @testing_, notice: 'Testing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testtest.update(testtest_params)\n format.html { redirect_to @testtest, notice: 'Testtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @testtest }\n else\n format.html { render :edit }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @test.update(test_params)\n respond_to do |format|\n format.html { redirect_to admin_tests_path }\n format.json { render :show, status: :ok, location: admin_tests_path }\n end\n else\n respond_to do |format|\n format.html { render :edit, notice: \"Please do you test again. An unexpected error has occured!\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end \n end", "def test_change_status\n expected = 200\n post_id = 1\n data = {\n status: 1\n }\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s+'/status')\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 @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:load_test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @test.update(test_params)\n return render json: {message: 'Test was updated succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not updated succesfully', error: true }\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 @smoke_test = SmokeTest.find(params[:id])\n\n if not params[:smoke_test][:test_suite_ids] and not params[:smoke_test][:config_templates]\n @smoke_test.config_templates.clear\n @smoke_test.test_suites.clear\n end\n respond_to do |format|\n if @smoke_test.update_attributes(params[:smoke_test])\n\n @smoke_test.test_suites.clear if @smoke_test.test_suites.size == 0\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully updated.') }\n format.json { render :json => @smoke_test, :status => :ok }\n format.xml { render :xml => @smoke_test, :status => :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n if @testis.update_attributes(params[:testis])\n format.html { redirect_to @testis, notice: 'Teste was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jquery_test.update(jquery_test_params)\n format.html { redirect_to @jquery_test, notice: 'Jquery test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jquery_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jsontest.update(jsontest_params)\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully updated.' }\n format.json { render :show, status: :ok, location: @jsontest }\n else\n format.html { render :edit }\n format.json { render json: @jsontest.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 @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to patient_path(@test.patient), notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_test = TestTest.find(params[:id])\n\n respond_to do |format|\n if @test_test.update_attributes(params[:test_test])\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testfile.update(testfile_params)\n format.html { redirect_to @testfile, notice: 'Testfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update\n respond_to do |format|\n if @test_detail.update(test_detail_params)\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_detail }\n else\n format.html { render :edit }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Prueba actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n if @tktest.update_attributes(params[:tktest])\n format.html { redirect_to @tktest, notice: 'Tktest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tests_specification.update(tests_specification_params)\n format.html { redirect_to edit_tests_specification_path(@tests_specification), notice: \"Tests specification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tests_specification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tests_specification.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 @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n if @test_file.update_attributes(params[:test_file])\n format.html { redirect_to @test_file, notice: 'Test file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n respond_to do |format|\n if @what_test.update(what_test_params)\n format.html { redirect_to @what_test, notice: 'What test was successfully updated.' }\n format.json { render :show, status: :ok, location: @what_test }\n else\n format.html { render :edit }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n if @test_suite.update_attributes(params[:test_suite])\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n # jankety solution to set version properly\n @test_instance.update_version(true)\n\n format.html do\n redirect_to test_case_test_instances_url(@test_case),\n notice: 'Test instance was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json do\n render json: @test_instance.errors, status: :unprocessable_entity\n end\n end\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 patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n if @test_post.update_attributes(params[:test_post])\n format.html { redirect_to @test_post, notice: 'Test post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usertest = Usertest.find(params[:id])\n\n respond_to do |format|\n if @usertest.update_attributes(params[:usertest])\n format.html { redirect_to @usertest, notice: 'Usertest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usertest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n tp = test_params.merge!(plate_id: params[:plate_id])\n respond_to do |format|\n if @test.update(tp)\n format.html { redirect_to [@plate, @test], notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_case.update(test_case_params)\n TestMailer.admin_test_updated_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @test.update_question_details(test_params)\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update\n @admin_test = Admin::Test.find(params[:id])\n\n respond_to do |format|\n if @admin_test.update_attributes(params[:admin_test])\n format.html { redirect_to(@admin_test, :notice => 'Test was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @admin_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @test_user = TestUser.find(params[:id])\n\n respond_to do |format|\n if @test_user.update_attributes(params[:test_user])\n format.html { redirect_to @test_user, notice: 'Test user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_item.update(test_item_params)\n format.html { redirect_to @test_item, notice: 'Test item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_suite.update(test_suite_params)\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_suite }\n else\n format.html { render :edit }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n if @student_test.update_attributes(params[:student_test])\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n @test = TkdTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:tkd_test])\n format.html { redirect_to(@test, :notice => 'Test was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testsuite.update(testsuite_params)\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully updated.' }\n format.json { render :show, status: :ok, location: @testsuite }\n else\n format.html { render :edit }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test = Mg::Test.find(params[:id])\n\n if @test.update_attributes(params[:test])\n flash[:notice] = 'Test was successfully updated.'\n redirect_to mg_test_url :id => @test.id\n else\n render :action => \"edit\"\n end\n end", "def update\n respond_to do |format|\n if @reacttest.update(reacttest_params)\n format.html { redirect_to @reacttest, notice: 'Reacttest was successfully updated.' }\n format.json { render :show, status: :ok, location: @reacttest }\n else\n format.html { render :edit }\n format.json { render json: @reacttest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_submission = TestSubmission.find(params[:id])\n\n respond_to do |format|\n if @test_submission.update_attributes(params[:test_submission])\n format.html { redirect_to @test_submission, :notice => 'Test submission was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_submission.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end", "def update\n respond_to do |format|\n if @httparty_test.update(httparty_test_params)\n format.html { redirect_to @httparty_test, notice: 'Httparty test was successfully updated.' }\n format.json { render :show, status: :ok, location: @httparty_test }\n else\n format.html { render :edit }\n format.json { render json: @httparty_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n if @fixture.update_attributes(fixture_params)\n format.json { head :no_content }\n else\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n respond_to do |format|\n if @testtype.update(testtype_params)\n format.html { redirect_to @testtype, notice: 'Testtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testboot.update(testboot_params)\n format.html { redirect_to @testboot, notice: 'Testboot was successfully updated.' }\n format.json { render :show, status: :ok, location: @testboot }\n else\n format.html { render :edit }\n format.json { render json: @testboot.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(action, **args); end", "def update\n @dtest = Dtest.find(params[:id])\n\n respond_to do |format|\n if @dtest.update_attributes(params[:dtest])\n format.html { redirect_to @dtest, notice: t(:upd_test)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n format.html { redirect_to @test_instance, notice: 'Test instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json { render json: @test_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_test.update(user_test_params)\n format.html { redirect_to admin_user_tests_path, notice: 'User test was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_test }\n else\n format.html { render :edit }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_two.update(test_two_params)\n format.html { redirect_to @test_two, notice: 'Test two was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_two }\n else\n format.html { render :edit }\n format.json { render json: @test_two.errors, status: :unprocessable_entity }\n end\n end\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 logger.debug \"---------------------\"\n logger.debug \"---------------------\"\n @testing = Testing.find(params[:id])\n\n respond_to do |format|\n if @testing.update_attributes(params[:testing])\n format.html { redirect_to(@testing, :notice => 'Testing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test = @subject.tests.find_by_id(params[:id])\n if @test.update_attributes(params[:test])\n redirect_to user_subject_tests_path\n else\n render :action => \"edit\"\n end\n end", "def update\n respond_to do |format|\n if @testpat.update(testpat_params)\n format.html { redirect_to @testpat, notice: 'Testpat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testpat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testmethod = Testmethod.find(params[:id])\n\n respond_to do |format|\n if @testmethod.update_attributes(params[:testmethod])\n format.html { redirect_to(@testmethod, :notice => 'Test Method was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testmethod.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update\n respond_to do |format|\n if @test_call.update(test_call_params)\n format.html { redirect_to @test_call, notice: 'Test call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_call.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66275775", "0.6461822", "0.64604074", "0.64109653", "0.6391101", "0.6391101", "0.6391101", "0.6391101", "0.6391101", "0.6391101", "0.6391101", "0.63527983", "0.6351322", "0.6347684", "0.6342539", "0.6309748", "0.6279981", "0.62679595", "0.6245681", "0.62357527", "0.6209263", "0.6195203", "0.6195203", "0.6194294", "0.61740303", "0.61501163", "0.613049", "0.61156994", "0.60934246", "0.60912806", "0.6090163", "0.60869074", "0.60809165", "0.60770446", "0.6076414", "0.60690117", "0.6061204", "0.6060629", "0.6051979", "0.6050268", "0.6046161", "0.60224485", "0.6003105", "0.60028136", "0.5993105", "0.596686", "0.5965276", "0.5946943", "0.59346676", "0.5922956", "0.5910748", "0.59099996", "0.5907825", "0.589872", "0.58896863", "0.5879839", "0.58771235", "0.5876057", "0.586347", "0.5837994", "0.58377534", "0.58377534", "0.5835672", "0.58200413", "0.58179283", "0.58177984", "0.5817254", "0.5808301", "0.58035827", "0.5803295", "0.5798752", "0.5790944", "0.57756644", "0.57756364", "0.5772604", "0.5767833", "0.5763083", "0.5752701", "0.57500297", "0.5746925", "0.57465863", "0.5742051", "0.57401496", "0.57401496", "0.57395285", "0.5738995", "0.57340866", "0.572994", "0.5718542", "0.5718114", "0.57160187", "0.5713386", "0.5710465", "0.57065475", "0.5704354", "0.57010925", "0.5696247", "0.56960446", "0.56921047", "0.5685899", "0.56834275" ]
0.0
-1
DELETE /tests/1 DELETE /tests/1.json
def destroy @theme.destroy respond_to do |format| format.html { redirect_to adminthemes_url, notice: 'Admin was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Prueba eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\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\n @test = Mg::Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(mg_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @testtest.destroy\n respond_to do |format|\n format.html { redirect_to testtests_url, notice: 'Testtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n if @test.destroy\n return render json: { message: 'Test was removed succesfully.', error: false }\n else\n return render json: { message: 'Error :Something went wrong. Test was not removed.', error: true }\n end\n end", "def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testing_.destroy\n respond_to do |format|\n format.html { redirect_to testing_s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_test = TestTest.find(params[:id])\n @test_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jsontest.destroy\n respond_to do |format|\n format.html { redirect_to jsontests_url, notice: 'Jsontest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_stuff.destroy\n respond_to do |format|\n format.html { redirect_to test_stuffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @jquery_test.destroy\n respond_to do |format|\n format.html { redirect_to jquery_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tktest = Tktest.find(params[:id])\n @tktest.destroy\n\n respond_to do |format|\n format.html { redirect_to tktests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smoke_test = SmokeTest.find(params[:id])\n @smoke_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(smoke_tests_url) }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_detail.destroy\n respond_to do |format|\n format.html { redirect_to test_details_url, notice: 'Test detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usertest = Usertest.find(params[:id])\n @usertest.destroy\n\n respond_to do |format|\n format.html { redirect_to usertests_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 @fixit_test.destroy\n respond_to do |format|\n format.html { redirect_to fixit_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @httparty_test.destroy\n respond_to do |format|\n format.html { redirect_to httparty_tests_url, notice: 'Httparty test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_test = Admin::Test.find(params[:id])\n @admin_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url(subject_class_id: @test.subject_class_id), notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dtest = Dtest.find(params[:id])\n @dtest.destroy\n\n respond_to do |format|\n format.html { redirect_to dtests_url, notice: t(:dest_test) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = TkdTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend", "def destroy\n @test_item.destroy\n respond_to do |format|\n format.html { redirect_to test_items_url }\n format.json { head :no_content }\n end\n end", "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 @test_summary = TestSummary.find(params[:id])\n @test_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to test_summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to test_suites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testurl.destroy\n respond_to do |format|\n format.html { redirect_to testurls_url, notice: 'Testurl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test10 = Test10.find(params[:id])\n @test10.destroy\n\n respond_to do |format|\n format.html { redirect_to test10s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_data_url, notice: 'Test datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dovetest.destroy\n respond_to do |format|\n format.html { redirect_to dovetests_url, notice: 'Dovetest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @copyeditor_test.destroy\n respond_to do |format|\n format.html { redirect_to copyeditor_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find_by_id(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to user_subject_tests_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @translations_versions_test.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alram_test.destroy\n respond_to do |format|\n format.html { redirect_to alram_tests_url, notice: 'Alram test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @runtest.destroy\n respond_to do |format|\n format.html { redirect_to runtests_url, notice: 'Runtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ab_test.destroy\n respond_to do |format|\n format.html { redirect_to ab_tests_url, notice: 'Ab test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @what_test.destroy\n respond_to do |format|\n format.html { redirect_to what_tests_url, notice: 'What test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nginxtest.destroy\n respond_to do |format|\n format.html { redirect_to nginxtests_url, notice: \"Nginxtest was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n head :no_content\n end", "def destroy\n @user_test.destroy\n respond_to do |format|\n format.html { redirect_to user_tests_url, notice: 'User test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_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\n @test_set = TestSet.find(params[:id])\n permitted_to! :destroy, @test_set\n @test_set.destroy\n\n respond_to do |format|\n format.html { redirect_to test_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n teacher_exclusive\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: \"L'épreuve a été supprimée\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reacttest.destroy\n respond_to do |format|\n format.html { redirect_to reacttests_url, notice: 'Reacttest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @testpat.destroy\n respond_to do |format|\n format.html { redirect_to testpats_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_two.destroy\n respond_to do |format|\n format.html { redirect_to test_twos_url, notice: 'Test two was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @drug_test = DrugTest.find(params[:id])\n @drug_test.destroy\n\n respond_to do |format|\n format.html { redirect_to drug_tests_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 destroy\n @testing.destroy\n respond_to do |format|\n format.html { redirect_to testings_url, notice: 'Testing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @runscope_test.destroy\n respond_to do |format|\n format.html { redirect_to runscope_tests_url, notice: 'Runscope test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testmonial.destroy\n\n head :no_content\n end", "def destroy\n @test_call.destroy\n respond_to do |format|\n format.html { redirect_to test_calls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_post = TestPost.find(params[:id])\n @test_post.destroy\n\n respond_to do |format|\n format.html { redirect_to test_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @performance_test = PerformanceTest.find(params[:id])\n @performance_test.destroy\n\n respond_to do |format|\n format.html { redirect_to performance_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_record.destroy\n respond_to do |format|\n format.html { redirect_to test_records_url, notice: 'Test record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @testsuite.destroy\n respond_to do |format|\n format.html { redirect_to testsuites_url, notice: 'Testsuite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @type_test.destroy\n respond_to do |format|\n format.html { redirect_to type_tests_url, notice: 'Type test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.771419", "0.771419", "0.7699507", "0.74376744", "0.7418487", "0.7418487", "0.7418487", "0.7418487", "0.7418487", "0.7418487", "0.7418487", "0.74170816", "0.7390183", "0.7322365", "0.73147345", "0.7270275", "0.72675836", "0.7227697", "0.7193399", "0.718793", "0.7176366", "0.715625", "0.71377426", "0.7136246", "0.71350276", "0.71236855", "0.7106981", "0.71050316", "0.7105011", "0.7102667", "0.7094241", "0.7084838", "0.70582277", "0.70515597", "0.7050981", "0.7041329", "0.7035585", "0.7024097", "0.70228094", "0.70133823", "0.70092785", "0.69987494", "0.6988829", "0.6984175", "0.69582933", "0.6957629", "0.6932844", "0.69274104", "0.6926253", "0.69216514", "0.6908965", "0.6895417", "0.6885228", "0.6880373", "0.6878607", "0.6878607", "0.6871726", "0.68693274", "0.6864774", "0.68622655", "0.68593735", "0.68559945", "0.68506914", "0.68461585", "0.6844054", "0.68337554", "0.6833401", "0.6822839", "0.68135", "0.6810756", "0.6809209", "0.6806117", "0.67963094", "0.67950594", "0.6786457", "0.6786304", "0.6786304", "0.6786304", "0.6786304", "0.677976", "0.6777255", "0.67747796", "0.6774683", "0.6764138", "0.6762494", "0.67600256", "0.6759385", "0.6749592", "0.6742049", "0.67407787", "0.67359936", "0.67242855", "0.67224634", "0.6720864", "0.6710306", "0.6707018", "0.67063725", "0.67062163", "0.67048925", "0.6700004", "0.66948855" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_admintheme @admintheme = Theme.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 admintheme_params params.require(:theme).permit(:themecla_id,:title,:themeimg) 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 valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\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 backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "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 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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586", "0.629103", "0.6282451", "0.6243152", "0.62413", "0.6219024", "0.6213724", "0.62103724", "0.61945", "0.61786324", "0.61755824", "0.6173267", "0.6163613", "0.6153058", "0.61521065", "0.6147508", "0.61234015", "0.61168665", "0.6107466", "0.6106177", "0.6091159", "0.60817343", "0.6071238", "0.6062299", "0.6021663", "0.60182893", "0.6014239", "0.6011563", "0.60080767", "0.60080767", "0.60028875", "0.60005623", "0.59964156", "0.5993086", "0.5992319", "0.5992299", "0.59801805", "0.59676576", "0.59606016", "0.595966", "0.59591126", "0.59589803", "0.5954058", "0.5953234", "0.5944434", "0.5940526", "0.59376484", "0.59376484", "0.5935253", "0.5930846", "0.5926387", "0.59256274", "0.5917907", "0.5910841", "0.590886", "0.59086543", "0.59060425", "0.58981544", "0.5898102", "0.5896809", "0.5895416", "0.58947027", "0.58923644", "0.5887903", "0.58830196", "0.5880581", "0.5873854", "0.58697754", "0.5869004", "0.58669055", "0.5866886", "0.58664906", "0.5864619", "0.58630043", "0.5862495", "0.5861368", "0.5859712", "0.5855544", "0.58551925", "0.5851284", "0.5850602" ]
0.0
-1
This method needs to be implemented by the dataSource of an NSTableView. This function is used by the NSTableView to populate itself
def tableView_objectValueForTableColumn_row_(view, col, row) case col.identifier.to_s when "ID" return @customers[row].id when "FNAME" return @customers[row].first_name when "LNAME" return @customers[row].last_name when "STREET1" return @customers[row].street_1 when "CITY" return @customers[row].city when "ZIP" return @customers[row].zip when "EMAIL" return @customers[row].email else return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_source=(val)\n PPCurses.implements_protocol( val, %w(number_of_rows_in_table object_value_for ))\n @data_source = val\n @selected_row = 0\n \n # Determine frame size from datasource data\n height = @data_source.number_of_rows_in_table(self)\n width = 0 \n for i in 0..@data_source.number_of_rows_in_table(self)-1\n x = @data_source.object_value_for(self, 0, i).length\n if x > width then width = x end\n end\n \n # Add an extra line for the column header\n # and ====== divider \n height += 2\n \n sz = Size.new( width, height )\n setFrameSize( sz )\n \n end", "def list_data_changed\n if row_count == 0 # added on 2009-02-02 17:13 so cursor not hanging on last row which could be empty\n init_vars\n @current_index = 0\n set_form_row\n end\n @repaint_required = true\n end", "def list_data_changed\n if row_count == 0 # added on 2009-02-02 17:13 so cursor not hanging on last row which could be empty\n init_vars\n @current_index = 0\n set_form_row\n end\n @widget_scrolled = true # 2011-10-15 \n @repaint_required = true\n end", "def awakeFromNib\n reloadTable\n end", "def row; end", "def before_load\n data_class.rebuild_table\n super\n end", "def awakeFromNib\n @table.setTarget(self)\n @table.setDoubleAction('on_entry_activation:')\n @table.setDelegate(self)\n create_list_of_files\n filter_files(nil)\n end", "def tableView(tableView, viewForTableColumn:tableColumn, row:row)\n cell = tableView.makeViewWithIdentifier(tableColumn.identifier, owner:self)\n item = self.items.objectAtIndex(row)\n cell.from = item.from\n cell.subject = item.subject\n cell.date = item.date\n cell.brief = item.brief\n cell.selected = false\n cell\n end", "def tableView(aTableView, willDisplayCell:cell, forTableColumn:aTableColumn, row:rowIndex)\n cell.setRepresentedObject(@videoCollection[rowIndex])\n end", "def initialize_table; end", "def populate\n end", "def on_create\n # raise \"You must implement `on_create` in your BaseCell subclass\"\n end", "def rows\n fail \"Implement #{self.class}#rows\"\n end", "def contents\n super || DataTable.new(1, 1, '')\n end", "def initialize(cell)\n super(cell)\n end", "def populate\n\n end", "def prepareForReuse; end", "def test_load_from_xml_less_number_of_columns_with_refresh_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :column_paths => ['id'], \n :refresh_columns => true)\n\n # assert row count\n assert_equal(2, nhk_word_table.model.row_count)\n assert_equal(1, nhk_word_table.model.column_count)\n\n # assert first row\n assert_equal(\"1\", nhk_word_table.model.get_value_at(0, 0))\n\n # assert second row\n assert_equal(\"2\", nhk_word_table.model.get_value_at(1, 0))\n end", "def populate\n raise NotImplementedError\n end", "def parse_table; end", "def viewDidLoad\n if super\n if !self.reusableCells\n sortDescriptor = NSSortDescriptor.sortDescriptorWithKey(nil, ascending: true, selector: 'localizedCompare:')\n sortedCategories = articleDictionary.keys.sortedArrayUsingDescriptors [sortDescriptor]\n self.reusableCells = []\n self.articleDictionary.keys.each do |key|\n cell = HorizontalTableCellIphone.alloc.initWithFrame CGRectMake(0, 0, 320, 416)\n cell.articles = articleDictionary[key]\n self.reusableCells << cell\n end\n end\n \n self.tableView.backgroundColor = VerticalTableBackgroundColor\n self.tableView.rowHeight = CellHeight + (RowVerticalPadding * 0.5) + ((RowVerticalPadding * 0.5) * 0.5)\n \n end\n end", "def test_load_from_xml_large_number_of_columns_with_refresh_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :column_paths => ['id', 'expression', 'created-at'], \n :refresh_columns => true)\n\n # assert row count\n assert_equal(2, nhk_word_table.model.row_count)\n assert_equal(3, nhk_word_table.model.column_count)\n\n # assert for normal\n assert_for_normal(nhk_word_table)\n\n # assert first row\n assert_equal(\"2008-08-13T20:35:00Z\", nhk_word_table.model.get_value_at(0, 2))\n\n # assert second row\n assert_equal(\"2008-08-13T20:36:00Z\", nhk_word_table.model.get_value_at(1, 2))\n end", "def load\n super\n slice_records!\n\n self\n end", "def initialize_dynamic_table(table, run_control)\n table_model = @main_tab.getControl(table).getModel\n initialize_table_checks(table_model)\n run_control.addActionListener do |_e|\n table_model.uncheckDisplayedRecords\n table_model.setRecords(cluster_records(run_control.getSelectedItem))\n initialize_table_checks(table_model)\n end\n end", "def rows\n @rows\n end", "def on_data_changed\n store_data(data_class.all_columns)\n end", "def test_load_from_xml_nil_column_paths_with_refresh_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :refresh_columns => true)\n\n # assert for normal\n assert_for_normal(nhk_word_table)\n end", "def initialize(source_text = nil)\n @rows = []\n\n super(source_text)\n\n return unless source_text\n\n parsed_table_data = parse_source(source_text)\n populate_table(self, parsed_table_data)\n end", "def windowDidResize n\n self.table.reloadData\n end", "def update_values\n @layout.count.times do |indx|\n widget = @layout.item_at(indx).widget\n widget.build_values if widget && widget.is_a?(Qt::TableWidget)\n end\n end", "def repaint\n # we need to see if structure changed then regenerate @list\n _list()\n super\n end", "def build_table (number)\n @main_table.each{|child| @main_table.remove(child)}\n if number<=3\n @main_table.n_columns = number\n @main_table.n_rows = 1\n i = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n text.editable = false\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n @main_table.attach(scrolled,i,i+1,0,1)\n @main_table.show_all\n i+=1\n end\n else\n @main_table.n_rows = 2\n @main_table.n_columns = (number+1)/2\n i = 0\n fil = col = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n #Fils the first row. The fil variable acts like a controller. When it changes, the row has changed.\n if (col < @main_table.n_columns && fil == 0)\n @main_table.attach(scrolled,col,col+1,0,1)\n col+=1\n if col==@main_table.n_columns #All the columns have been filled. We change rows\n fil = 1; col = 0 #Restart the columns index\n end\n else #Second row statrs here\n @main_table.attach(scrolled,col,col+1,1,2)\n col+=1\n end\n @main_table.show_all\n i+=1\n end\n end\n end", "def on_select(tableView, tableViewDelegate)\n # implement in row class\n end", "def row(index)\n end", "def pre_render\n super\n @selected_indices = @source.selected_indices\n @left_margin = @source.left_margin\n @bg = @source.bgcolor\n @fg = @source.color\n @attr = NORMAL\n @row_focussed_attr ||= $row_focussed_attr\n end", "def initialize\n @columns = []\n @columns_lookup = []\n @rows = []\n @newline = \"\\r\\n\"\n end", "def columns; @columns; end", "def cellClass\n ElementTableViewCell\n end", "def columns; end", "def initialize_table\n @total_rows.times do |row|\n row_array = Array.new(@total_columns, \"\")\n @reconstructed_table.push(row_array)\n end\n end", "def prepare_data\n initial_data_eval \n initial_sorting if self.data_grid.sorting?\n filter\n global_summary_array\n pagination\n summary_array\n self.data_grid.row_styler\n prepare_data_for_filters\n end", "def refresh()\n model.clear\n data = get_data() # returns array of songs\n (0..data.length-1).each do |i|\n row = model.append # add_row()\n row[id(:id)] = data[i][0]\n row[id(:score)] = data[i][1]\n # row[id(:c4_win)] = data[i][2]\n # row[id(:c4_lost)] = data[i][3]\n # row[id(:c4_WinPercent)] = data[i][4]\n # row[id(:OnT_Total)] = data[i][5]\n # row[id(:OnT_W)] = data[i][6]\n # row[id(:OnT_L)] = data[i][7]\n # row[id(:OnT_WinPercent)] = data[i][8]\n # row[id(:T_Total)] = data[i][9]\n # row[id(:T_W)] = data[i][10]\n # row[id(:T_L)] = data[i][11]\n # row[id(:T_WinPercent)] = data[i][12]\n end\n\n end", "def refresh_live_display\n\t\t# update the table model rows without affecting user selections\n\t\trow_count = @channel_records_table_model.getRowCount\n\t\tif row_count > 0\n\t\t\t@channel_records_table_model.fireTableRowsUpdated(0, row_count-1)\n\t\tend\n\n\t\t# update the live timestamp\n\t\t@live_update_timestamp_label.text = Java::Date.new.toString\n\tend", "def rows\n RowCollection.new(@data)\n end", "def initialize(x, y, width, height, items, dataview=nil)\n super(x, y, width, height)\n @column_max = 2\n @ucItemsList = []\n window_update(items, dataview)\n self.index = 0\n end", "def initialize_data\n end", "def rows\n CellCollection.new(@data, @column)\n end", "def fire_row_changed ix\n return if ix >= @list.length\n clear_row @pad, ix\n # allow documents to reparse that line\n fire_handler :ROW_CHANGED, ix\n _arr = _getarray\n render @pad, ix, _arr[ix]\n\n end", "def after_build(cell)\n end", "def table; end", "def table; end", "def table; end", "def table; end", "def get_data\n raise \"This method should be overriden to return the JSON data for a concrete table\"\n end", "def [](index)\n load_data\n super\n end", "def test_load_from_xml_less_number_of_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :column_paths => ['id'])\n\n # assert row count\n assert_equal(2, nhk_word_table.model.row_count)\n\n # assert first row\n assert_equal(\"1\", nhk_word_table.model.get_value_at(0, 0))\n assert_nil(nhk_word_table.model.get_value_at(0, 1))\n\n # assert second row\n assert_equal(\"2\", nhk_word_table.model.get_value_at(1, 0))\n assert_nil(nhk_word_table.model.get_value_at(1, 1))\n end", "def initialize_copy(orig)\n super\n @table = @table.dup\n end", "def reloadTableOnFilteredData(notification)\n self.filteredData = notification.object.filteredData\n reloadTable\n end", "def initialize source\n @source = source\n @color = :white\n @bgcolor = :black\n @color_pair = $datacolor\n @attrib = NORMAL\n @_check_coloring = nil\n @icon_can_collapse = PLUS_MINUS\n @icon_can_expand = PLUS_PLUS\n @icon_not_visited = PLUS_Q\n @icon_no_children = \"+-\" # how about '+|'\n # adding setting column_model auto on 2014-04-10 - 10:53 why wasn;t this here already\n #tree_model(source.tree_model)\n end", "def importDataSource(file, *sync_column)\n\n\nend", "def rows\n @rows\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def _update_without_checking(columns)\n super(identifier_hash(columns))\n end", "def display\n raise Datasource::MethodOverride.new(\"display method needs to be overridden\")\n end", "def refresh_data\n raise NotImplementedError\n end", "def prefetch_rows\n raise NoMethodError, \"Not implemented for this raw driver\"\n end", "def build_options_for_new_row(attribute_name, _index, options)\n super\n\n options[:readonly] = true\n options[:data] ||= {}\n options[:data][:autocomplete] = attribute_name\n end", "def rows\r\n @all_rows\r\n end", "def tableView(tableView, objectValueForTableColumn:column, row:index)\n filteredData[index].send(column.identifier)\n end", "def columns; self.class.columns.dup; end", "def populate_matrix_with_row_headers\n create_empty_array\n collect_row_headers\n replace_row_helpers\nend", "def on_data_changed; end", "def refresh_items\n rows.clear\n\n items.each do |item|\n rows << [item]\n end\n end", "def rows\n gtk_instance.rows\n end", "def updated_data; end", "def initialize(cols)\n super()\n self.model = Gtk::TreeStore.new(*flatten_hash(cols).values)\n load_columns(cols)\n end", "def on_button_osoby_list_clicked\n @osoby_list_window.show\n osoba = Db::Osoba.new\n tablica = osoba.wczytajWszystkie();\n\n model = Gtk::ListStore.new(String, String, String)\n model.clear\n tablica.each_index do |index|\n arr = tablica[index];\n row = model.insert(index)\n # TODO Dlaczego nie przypisuje id do kolumny id\n # imienia do imienia etc..\n row.set_value(0,arr['id_osoby'])\n row.set_value(1,arr['Imie'])\n row.set_value(2,arr['Nazwisko'])\n end\n\n @treeview_osoby.set_model(model)\n \n# row-activated: self, path, column\n#\n# * self: the Gtk::TreeView\n# * path: the Gtk::TreePath\n# * column: the Gtk::TreeViewColumn\n # uchwyt dla kliknietego wiersza\n @treeview_osoby.signal_connect(\"row-activated\") do |view, path, column|\n # ustawienie id rekordu ktory zostal klikniety\n # dzieki temu przycisk edytuj umozliwi nam edycje okreslonego rekordu\n puts @osobay_list_selected_id = model.get_value(model.get_iter(path),0)\n on_button_osoba_edytuj_clicked\n end\n\n \n #czyszczenie kolun!\n @treeview_osoby.columns.each do |key|\n @treeview_osoby.remove_column(key);\n end\n # tworzenie kolumny\n @treeview_osoby.insert_column(0, \"Id\", Gtk::CellRendererText.new,{:text => 0})\n @treeview_osoby.insert_column(1, \"Imie\", Gtk::CellRendererText.new,{:text => 1})\n @treeview_osoby.insert_column(2, \"Nazwisko\", Gtk::CellRendererText.new,{:text => 2})\n end", "def row_size\n @delegate.getRowSize\n end", "def columns; self.class.columns; end", "def init_data\n end", "def show\n set_cell\n end", "def process_row\n # overwrite this class\n end", "def tableView_objectValueForTableColumn_row_(view, col, row)\n if view == @items_table\n\t\t\tcase col.identifier.to_s\n\t\t\twhen \"TITLE\"\n\t\t\t\treturn @items[row].title.to_s\n\t\t\twhen \"YEAR\"\n\t\t\t\treturn @items[row].year.split('-')[0].to_s\n\t\t\twhen \"GENRE\"\n\t\t\t\treturn @items[row].genre.to_s\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n \telsif view == @copies_table\n\t\t\tcase col.identifier.to_s\t\n\t\t\twhen \"SECTION\"\n\t\t\t\treturn @copies[row].section_name\n\t\t\twhen \"COPY_TYPE\"\n\t\t\t\treturn @copies[row].copy_type\n\t\t\twhen \"SPRICE\"\n\t\t\t\treturn @copies[row].sale_price\n\t\t\twhen \"WSPRICE\"\n\t\t\t\treturn @copies[row].wholesale_price\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n\t\tend\n end", "def rebuild(table); end", "def populateGrid\n\n\t\t@grid.matrix.each_with_index do | row, i |\n\n\t\t\trow.each_with_index do | col, j |\n\n\t\t\t\t@grid.matrix[i][j] = Cell.new(i, j, false)\n\t\t\tend\n\t\tend\n\tend", "def col; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def display_all_cell_headers\n # Interface method\n end", "def tableViewSelectionDidChange(notification)\n\t puts \"Getting copies for item_id '#{@items_table.selectedRow}'...\" #DEBUG\n\t\tif @items_table.selectedRow < 0\n\t\t @copies = nil\n\t else\n\t\t item_id = @items[@items_table.selectedRow].id\n\t\t @copies = Copy.find_by_item_id(item_id) \n\t\tend\n\t @copies_table.reloadData\n\t puts \"Got copies...\" #DEBUG\n\tend", "def after_render_field(record, column); end", "def tableView_objectValueForTableColumn_row(afileTable, aTableColumn, rowIndex)\n\t\tcolIndex = aTableColumn.identifier.to_i\n\t\treturn @rows[rowIndex][colIndex] if @rows and rowIndex < @rows.length and colIndex < @rows[rowIndex].length\n\tend", "def [](attr_name)\n attr_s = attr_name.to_s\n if interesting_for_scrooge?( attr_s )\n augment_callsite!( attr_s )\n fetch_remaining\n @scrooge_columns << attr_s\n end\n super\n end" ]
[ "0.58925354", "0.5593454", "0.5466672", "0.54511803", "0.5451133", "0.54354244", "0.53852814", "0.5290497", "0.5209445", "0.5180892", "0.5131673", "0.5120566", "0.5083637", "0.5077094", "0.5067756", "0.5061847", "0.50609744", "0.5058027", "0.5007701", "0.49867627", "0.49647877", "0.49590296", "0.49517408", "0.49490738", "0.4934875", "0.4920479", "0.49142167", "0.49002185", "0.48843694", "0.4861518", "0.485829", "0.48508224", "0.4838083", "0.4834466", "0.4829321", "0.48074308", "0.48072535", "0.4795862", "0.4792697", "0.47747007", "0.4772488", "0.47578895", "0.4748213", "0.47480237", "0.4737021", "0.47322834", "0.47319108", "0.47275516", "0.47207093", "0.47173327", "0.47173327", "0.47173327", "0.47173327", "0.47016603", "0.47007746", "0.4700461", "0.46990296", "0.4688012", "0.4684617", "0.46824634", "0.46712905", "0.46712905", "0.46712905", "0.4667781", "0.4650065", "0.46482387", "0.4625838", "0.4625807", "0.46237302", "0.46207756", "0.4619853", "0.46167007", "0.46119028", "0.4611424", "0.46092123", "0.45919022", "0.4577302", "0.45745817", "0.4561776", "0.45510942", "0.45498493", "0.4548248", "0.45422632", "0.45412663", "0.45391455", "0.45390606", "0.45352522", "0.45300937", "0.45300937", "0.45300937", "0.45300937", "0.45300937", "0.45300937", "0.45300937", "0.45216435", "0.45143467", "0.4514007", "0.45136204", "0.45113632" ]
0.45416477
84
This method needs to be implemented by the dataSource of an NSTableView.
def numberOfRowsInTableView_(view) return 0 if @customers.nil? return @customers.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_source=(val)\n PPCurses.implements_protocol( val, %w(number_of_rows_in_table object_value_for ))\n @data_source = val\n @selected_row = 0\n \n # Determine frame size from datasource data\n height = @data_source.number_of_rows_in_table(self)\n width = 0 \n for i in 0..@data_source.number_of_rows_in_table(self)-1\n x = @data_source.object_value_for(self, 0, i).length\n if x > width then width = x end\n end\n \n # Add an extra line for the column header\n # and ====== divider \n height += 2\n \n sz = Size.new( width, height )\n setFrameSize( sz )\n \n end", "def display\n raise Datasource::MethodOverride.new(\"display method needs to be overridden\")\n end", "def row; end", "def on_select(tableView, tableViewDelegate)\n # implement in row class\n end", "def tableView(aTableView, willDisplayCell:cell, forTableColumn:aTableColumn, row:rowIndex)\n cell.setRepresentedObject(@videoCollection[rowIndex])\n end", "def on_create\n # raise \"You must implement `on_create` in your BaseCell subclass\"\n end", "def cellClass\n ElementTableViewCell\n end", "def awakeFromNib\n reloadTable\n end", "def tableView(tableView, objectValueForTableColumn:column, row:index)\n filteredData[index].send(column.identifier)\n end", "def rows\n fail \"Implement #{self.class}#rows\"\n end", "def table; end", "def table; end", "def table; end", "def table; end", "def awakeFromNib\n @table.setTarget(self)\n @table.setDoubleAction('on_entry_activation:')\n @table.setDelegate(self)\n create_list_of_files\n filter_files(nil)\n end", "def list_data_changed\n if row_count == 0 # added on 2009-02-02 17:13 so cursor not hanging on last row which could be empty\n init_vars\n @current_index = 0\n set_form_row\n end\n @widget_scrolled = true # 2011-10-15 \n @repaint_required = true\n end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def list_data_changed\n if row_count == 0 # added on 2009-02-02 17:13 so cursor not hanging on last row which could be empty\n init_vars\n @current_index = 0\n set_form_row\n end\n @repaint_required = true\n end", "def windowDidResize n\n self.table.reloadData\n end", "def contents\n super || DataTable.new(1, 1, '')\n end", "def columns; end", "def col; end", "def tableView(tableView, viewForTableColumn:tableColumn, row:row)\n cell = tableView.makeViewWithIdentifier(tableColumn.identifier, owner:self)\n item = self.items.objectAtIndex(row)\n cell.from = item.from\n cell.subject = item.subject\n cell.date = item.date\n cell.brief = item.brief\n cell.selected = false\n cell\n end", "def row(index)\n end", "def on_data_changed; end", "def columns; @columns; end", "def table\n end", "def index\n @connection_table_columns = ConnectionTableColumn.all\n end", "def get_data\n raise \"This method should be overriden to return the JSON data for a concrete table\"\n end", "def fire_row_changed ix\n return if ix >= @list.length\n clear_row @pad, ix\n # allow documents to reparse that line\n fire_handler :ROW_CHANGED, ix\n _arr = _getarray\n render @pad, ix, _arr[ix]\n\n end", "def get_table(object)\n raise NotImplementedError, \"Subclasses must implement private method get_table\"\n end", "def tableView_objectValueForTableColumn_row(afileTable, aTableColumn, rowIndex)\n\t\tcolIndex = aTableColumn.identifier.to_i\n\t\treturn @rows[rowIndex][colIndex] if @rows and rowIndex < @rows.length and colIndex < @rows[rowIndex].length\n\tend", "def real_column; end", "def display_all_cell_headers\n # Interface method\n end", "def tableView(table_view, numberOfRowsInSection: section)\n self.todo_list_manager.todo_items.count\n end", "def row_size\n @delegate.getRowSize\n end", "def before_load\n data_class.rebuild_table\n super\n end", "def columns; self.class.columns; end", "def sid_column\n end", "def document\n raise Datasource::MethodOverride.new(\"document method needs to be overridden\")\n end", "def tableView(tableView, didSelectRowAtIndexPath:indexPath)\n stop_drawing!\n @presented_drawing.hide\n @note_text.resignFirstResponder\n @note_text.clear!\n case tableView.dataSource\n when $source # Selecting an Asset\n present_asset $source.contents[indexPath.row]\n when $current_asset # Selecting a Note\n present_note $current_asset.notes[indexPath.row]\n end\n update_draw_buttons\n end", "def initialize(cell)\n super(cell)\n end", "def datasource_columns\n self.class.datasource_columns || { }\n end", "def after_render_field(record, column); end", "def tableView_objectValueForTableColumn_row(tableView,tableColumn,row)\n path_len=@path.length+1\n case tableColumn.identifier.to_s\n when 'filename'\n File.basename(@filtered_files[row])\n when 'path'\n @filtered_files[row][path_len .. -1]\n end\n end", "def rows\n @rows\n end", "def numberOfSectionsInTableView tableView\n # // Return the number of sections.\n 1\n end", "def ignored_translation_table_colums(klass); end", "def test_load_from_xml_less_number_of_columns_with_refresh_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :column_paths => ['id'], \n :refresh_columns => true)\n\n # assert row count\n assert_equal(2, nhk_word_table.model.row_count)\n assert_equal(1, nhk_word_table.model.column_count)\n\n # assert first row\n assert_equal(\"1\", nhk_word_table.model.get_value_at(0, 0))\n\n # assert second row\n assert_equal(\"2\", nhk_word_table.model.get_value_at(1, 0))\n end", "def _table; @table end", "def numberOfRowsInTableView(view)\n # Return the number of items.\n @entries ? @entries.length : 0\n end", "def columns\n end", "def numberOfSectionsInTableView tableView\n 1\n end", "def item_column(detail)\n ''\n end", "def on_table?; @on_table; end", "def numberOfSectionsInTableView(table_view)\n 1\n end", "def numberOfSectionsInTableView(table_view)\n 1\n end", "def initialize_table; end", "def tableView(aView, validateDrop:info, proposedRow:row, proposedDropOperation:op)\n NSDragOperationEvery\n end", "def viewDidLoad\n if super\n if !self.reusableCells\n sortDescriptor = NSSortDescriptor.sortDescriptorWithKey(nil, ascending: true, selector: 'localizedCompare:')\n sortedCategories = articleDictionary.keys.sortedArrayUsingDescriptors [sortDescriptor]\n self.reusableCells = []\n self.articleDictionary.keys.each do |key|\n cell = HorizontalTableCellIphone.alloc.initWithFrame CGRectMake(0, 0, 320, 416)\n cell.articles = articleDictionary[key]\n self.reusableCells << cell\n end\n end\n \n self.tableView.backgroundColor = VerticalTableBackgroundColor\n self.tableView.rowHeight = CellHeight + (RowVerticalPadding * 0.5) + ((RowVerticalPadding * 0.5) * 0.5)\n \n end\n end", "def index\n @parent_proxy.columns.compact.index(self)\n end", "def [](index)\n load_data\n super\n end", "def columns\n @columns\n end", "def column_size\n @delegate.getColSize\n end", "def test_load_from_xml_large_number_of_columns_with_refresh_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :column_paths => ['id', 'expression', 'created-at'], \n :refresh_columns => true)\n\n # assert row count\n assert_equal(2, nhk_word_table.model.row_count)\n assert_equal(3, nhk_word_table.model.column_count)\n\n # assert for normal\n assert_for_normal(nhk_word_table)\n\n # assert first row\n assert_equal(\"2008-08-13T20:35:00Z\", nhk_word_table.model.get_value_at(0, 2))\n\n # assert second row\n assert_equal(\"2008-08-13T20:36:00Z\", nhk_word_table.model.get_value_at(1, 2))\n end", "def test_load_from_xml_nil_column_paths_with_refresh_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :refresh_columns => true)\n\n # assert for normal\n assert_for_normal(nhk_word_table)\n end", "def parse_table; end", "def values\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end", "def tableView(tableView, \n writeRowsWithIndexes:rowIndexes, \n toPasteboard:pboard)\n \n \n data = NSKeyedArchiver.archivedDataWithRootObject(rowIndexes)\n pboard.declareTypes( [\"TSTab\"], owner:self )\n pboard.setData(data, forType:\"TSTab\") \n \n return true\n end", "def cellStyle\n UITableViewCellStyleSubtitle\n end", "def augment_column_config(c)\n super\n set_default_data_index(c)\n set_default_xtype c\n end", "def display_cell_header(table_cell)\n # Interface method\n end", "def pre_render\n super\n @selected_indices = @source.selected_indices\n @left_margin = @source.left_margin\n @bg = @source.bgcolor\n @fg = @source.color\n @attr = NORMAL\n @row_focussed_attr ||= $row_focussed_attr\n end", "def row_tell\n @index\n end", "def show\n set_cell\n end", "def tableView_objectValueForTableColumn_row_(view, col, row)\n if view == @items_table\n\t\t\tcase col.identifier.to_s\n\t\t\twhen \"TITLE\"\n\t\t\t\treturn @items[row].title.to_s\n\t\t\twhen \"YEAR\"\n\t\t\t\treturn @items[row].year.split('-')[0].to_s\n\t\t\twhen \"GENRE\"\n\t\t\t\treturn @items[row].genre.to_s\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n \telsif view == @copies_table\n\t\t\tcase col.identifier.to_s\t\n\t\t\twhen \"SECTION\"\n\t\t\t\treturn @copies[row].section_name\n\t\t\twhen \"COPY_TYPE\"\n\t\t\t\treturn @copies[row].copy_type\n\t\t\twhen \"SPRICE\"\n\t\t\t\treturn @copies[row].sale_price\n\t\t\twhen \"WSPRICE\"\n\t\t\t\treturn @copies[row].wholesale_price\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n\t\tend\n end", "def test_load_from_xml_less_number_of_columns\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = ['ID', 'NHK語']\n\n # load_from_xml\n nhk_word_table.model.load_from_xml(@xml,\n :row_path => '*/nhk-word',\n :column_paths => ['id'])\n\n # assert row count\n assert_equal(2, nhk_word_table.model.row_count)\n\n # assert first row\n assert_equal(\"1\", nhk_word_table.model.get_value_at(0, 0))\n assert_nil(nhk_word_table.model.get_value_at(0, 1))\n\n # assert second row\n assert_equal(\"2\", nhk_word_table.model.get_value_at(1, 0))\n assert_nil(nhk_word_table.model.get_value_at(1, 1))\n end", "def student_index\n end", "def index\n @tm_table_columns = TmTableColumn.all\n end", "def tableView_objectValueForTableColumn_row_(view, col, row)\n if view == @items_table\n\t\t\tcase col.identifier.to_s\n\t\t\twhen \"TITLE\"\n\t\t\t\treturn @items[row].title.to_s\n\t\t\twhen \"YEAR\"\n\t\t\t\treturn @items[row].year.split('-')[0].to_s\n\t\t\twhen \"GENRE\"\n\t\t\t\treturn @items[row].genre.to_s\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n \telsif view = @copies_table\n\t\t\tcase col.identifier.to_s\t\n\t\t\twhen \"SECTION\"\n\t\t\t\treturn @copies[row].section_name\n\t\t\twhen \"COPY_TYPE\"\n\t\t\t\treturn @copies[row].copy_type\n\t\t\twhen \"PRICE\"\n\t\t\t\treturn @copies[row].sale_price\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n\t\tend\n end", "def numberOfRowsInTableView(sender)\n accounts.size\n end", "def test_new_with_hash_nil_rows\n # Initialize JTable and model\n nhk_word_table = JTable.new\n\n assert_raise(ArgumentError) do\n nhk_word_table.model = {:columns => [\"ID\", \"NHK語\"]}\n end\n end", "def on_data_changed\n store_data(data_class.all_columns)\n end", "def tableView(tableView, numberOfRowsInSection:section)\n @items.size\n end", "def tableView_objectValueForTableColumn_row_(view, col, row)\n\t\t\tcase col.identifier.to_s\n\t\t\twhen \"ID\"\n\t\t\t\treturn @customers[row].id\n\t\t\twhen \"FNAME\"\n\t\t\t\treturn @customers[row].first_name\n\t\t\twhen \"LNAME\"\n\t\t\t\treturn @customers[row].last_name\n\t\t\twhen \"STREET1\"\n\t\t\t\treturn @customers[row].street_1\n\t\t\twhen \"CITY\"\n\t\t\t\treturn @customers[row].city\n\t\t\twhen \"ZIP\"\n\t\t\t\treturn @customers[row].zip\n\t\t\twhen \"EMAIL\"\n\t\t\t\treturn @customers[row].email\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n end", "def tableView_objectValueForTableColumn_row_(view, col, row)\n\t\t\tcase col.identifier.to_s\n\t\t\twhen \"ID\"\n\t\t\t\treturn @customers[row].id\n\t\t\twhen \"FNAME\"\n\t\t\t\treturn @customers[row].first_name\n\t\t\twhen \"LNAME\"\n\t\t\t\treturn @customers[row].last_name\n\t\t\twhen \"STREET1\"\n\t\t\t\treturn @customers[row].street_1\n\t\t\twhen \"CITY\"\n\t\t\t\treturn @customers[row].city\n\t\t\twhen \"ZIP\"\n\t\t\t\treturn @customers[row].zip\n\t\t\twhen \"EMAIL\"\n\t\t\t\treturn @customers[row].email\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n end", "def delegate_method; end", "def initialize source\n @source = source\n @color = :white\n @bgcolor = :black\n @color_pair = $datacolor\n @attrib = NORMAL\n @_check_coloring = nil\n @icon_can_collapse = PLUS_MINUS\n @icon_can_expand = PLUS_PLUS\n @icon_not_visited = PLUS_Q\n @icon_no_children = \"+-\" # how about '+|'\n # adding setting column_model auto on 2014-04-10 - 10:53 why wasn;t this here already\n #tree_model(source.tree_model)\n end", "def column=(_); end", "def columns; self.class.columns.dup; end", "def sectionIndexTitlesForTableView(table_view)\n if self.respond_to?(:table_data_index)\n self.table_data_index\n end\n end", "def test_new_with_original_constructor\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = DefaultTableModel.new(4, 3)\n\n # assert row count\n assert_equal(4, nhk_word_table.model.row_count)\n\n # assert column count\n assert_equal(3, nhk_word_table.model.column_count)\n\n # assert cells\n for i in 1..nhk_word_table.model.row_count\n for j in 1..nhk_word_table.model.column_count\n assert_nil(nhk_word_table.model.get_value_at((i-1), (j-1)))\n end\n end\n end", "def on_button_osoby_list_clicked\n @osoby_list_window.show\n osoba = Db::Osoba.new\n tablica = osoba.wczytajWszystkie();\n\n model = Gtk::ListStore.new(String, String, String)\n model.clear\n tablica.each_index do |index|\n arr = tablica[index];\n row = model.insert(index)\n # TODO Dlaczego nie przypisuje id do kolumny id\n # imienia do imienia etc..\n row.set_value(0,arr['id_osoby'])\n row.set_value(1,arr['Imie'])\n row.set_value(2,arr['Nazwisko'])\n end\n\n @treeview_osoby.set_model(model)\n \n# row-activated: self, path, column\n#\n# * self: the Gtk::TreeView\n# * path: the Gtk::TreePath\n# * column: the Gtk::TreeViewColumn\n # uchwyt dla kliknietego wiersza\n @treeview_osoby.signal_connect(\"row-activated\") do |view, path, column|\n # ustawienie id rekordu ktory zostal klikniety\n # dzieki temu przycisk edytuj umozliwi nam edycje okreslonego rekordu\n puts @osobay_list_selected_id = model.get_value(model.get_iter(path),0)\n on_button_osoba_edytuj_clicked\n end\n\n \n #czyszczenie kolun!\n @treeview_osoby.columns.each do |key|\n @treeview_osoby.remove_column(key);\n end\n # tworzenie kolumny\n @treeview_osoby.insert_column(0, \"Id\", Gtk::CellRendererText.new,{:text => 0})\n @treeview_osoby.insert_column(1, \"Imie\", Gtk::CellRendererText.new,{:text => 1})\n @treeview_osoby.insert_column(2, \"Nazwisko\", Gtk::CellRendererText.new,{:text => 2})\n end", "def column_name; end", "def rows\n @rows\n end" ]
[ "0.57290924", "0.56181127", "0.55382395", "0.55299723", "0.5509954", "0.5412743", "0.54053926", "0.53441733", "0.53330666", "0.5300346", "0.5251905", "0.5251905", "0.5251905", "0.5251905", "0.5236163", "0.5220334", "0.51958966", "0.51958966", "0.51958966", "0.51958966", "0.51958966", "0.51958966", "0.51958966", "0.51845", "0.5180877", "0.5162734", "0.5125249", "0.510301", "0.507399", "0.50701725", "0.50618124", "0.5029205", "0.5023254", "0.50153136", "0.5000729", "0.499447", "0.4983301", "0.49717063", "0.49677658", "0.49639356", "0.4957666", "0.49557993", "0.49557322", "0.49520797", "0.49446845", "0.49441874", "0.49124134", "0.491217", "0.49083602", "0.48995793", "0.48816323", "0.48768654", "0.48765296", "0.48764744", "0.48754206", "0.48593032", "0.48505175", "0.4833854", "0.48307586", "0.48221314", "0.48219272", "0.48191828", "0.48191828", "0.4816415", "0.4813069", "0.48043975", "0.48005074", "0.47912505", "0.4781285", "0.4776317", "0.47747138", "0.4774103", "0.47730103", "0.47654432", "0.47650903", "0.4763633", "0.47550043", "0.47537592", "0.47509727", "0.47480783", "0.47379452", "0.47347984", "0.47305775", "0.47254214", "0.47174802", "0.4716913", "0.47135228", "0.47111416", "0.47026622", "0.4700564", "0.46881846", "0.46881846", "0.46682", "0.4666853", "0.466622", "0.46627545", "0.46569863", "0.46542147", "0.4653084", "0.46413326", "0.46342355" ]
0.0
-1
Converts the search attributes into an array only containing those that have nonblank values
def gen_conditions conditions = {} search_fields = [:title, :genre, :year, :directors, :actors] search_fields.each do |sf| conditions[sf] = self.send(sf).stringValue unless self.send(sf).nil? || self.send(sf).stringValue == "" end (conditions.empty?) ? nil : conditions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes\n (node.attributes['attrs'] || \"\").split(/\\s*,\\s*/).where_not.blank?\n end", "def search_attributes\n nil\n end", "def non_empty_attr\n attributes.reject {|x,y| x == 'id' or y.blank?}\n end", "def extra_attributes_to_filter\n # default value if not set\n return ['password'] unless @options[:filter_attributes]\n # parse option value\n if @options[:filter_attributes].kind_of? Array\n attrs = @options[:filter_attributes]\n elsif @options[:filter_attributes].kind_of? String\n attrs = @options[:filter_attributes].split(',').collect { |col| col.strip }\n else\n $LOG.error(\"Can't figure out attribute list from #{@options[:filter_attributes].inspect}. This must be an Array of column names or a comma-separated list.\")\n attrs = []\n end\n attrs\n end", "def search_attributes\n\t\t['dn', self.attr_firstname, self.attr_lastname, self.attr_mail, self.attr_member]\n\tend", "def normalize_blank_values\n attributes.each do |column, value|\n self[column].present? || self[column] = nil\n end\n end", "def criteria_with_blank_value(criteria)\n criteria.present? ? criteria : [\"\"]\n end", "def criteria_with_blank_value(criteria)\n criteria.presence || [\"\"]\n end", "def remove_blanks(input)\n output = (input.is_a?(Array) ? input : [input])\n output.select { |e| !e.blank? }\n end", "def filter_data\n @data.map do |currency|\n currency.select { |attribute,_|\n selected_attributes.include? attribute.to_s\n }\n end\n end", "def search_attrs_prep(initial_search_attr_values)\n self.search_attr_values = initial_search_attr_values\n self.search_attr_values = use_defaults if using_defaults\n\n if search_attr_values.respond_to? :to_unsafe_h\n self.search_attr_values = search_attr_values.to_unsafe_h.symbolize_keys\n end\n\n search_attributes = self.search_attributes.symbolize_keys\n ks = search_attributes.keys\n ks.each do |k|\n search_attr_values[k] = nil unless search_attr_values.key? k\n end\n\n search_attr_values.slice!(*ks)\n\n search_attr_values.each do |k, v|\n if v.blank?\n search_attr_values[k] = nil\n elsif v.is_a? Hash\n search_attr_values[k] = v.collect { |_, v1| v1 }\n elsif v.is_a?(String) && v.include?(\"\\n\")\n search_attr_values[k] = if search_attributes_config[k.to_sym].multiple == 'multiple-regex'\n \"(#{v.split(\"\\n\").map(&:squish).join('|')})\"\n else\n v.split(\"\\n\").map(&:squish)\n end\n end\n end\n\n search_attr_values[:ids_filter_previous] = nil\n\n if previous_filtering.sql_requests_filtering\n previous_filtering.requested = (search_attr_values[:_filter_previous_] == 'true')\n search_attr_values[:ids_filter_previous] = previous_filtering.filtering_ids\n end\n end", "def filter_by attributes\n\n all.select { |item| matches? item, attributes }\n\n end", "def blank?\n attributes.values.all?(&:blank?)\n end", "def remove_blank_attributes(attributes)\n attributes.delete_if { |key, value| clean_attribute(value) }\n end", "def values\n @attributes.reject { |k, _| tag_names.include?(k.to_s) }\n end", "def filter_search(attributes)\n # TODO CHANGE because to _unsafe h permits to inject all the things of attributes\n attributes.to_unsafe_h.inject(self) do |scope, (key, value)|\n # return scope.scoped if value.blank?\n if value.blank?\n scope.all\n else\n case key.to_sym\n when :order # order=field-(ASC|DESC)\n attribute, order = value.split('-')\n scope.order(\"#{table_name}.#{attribute} #{order}\")\n\n else # unknown key (do nothing or raise error, as you prefer to)\n scope.all\n end\n\n end\n end\n end", "def blank?\n attributes.values.all?(&:blank?)\n end", "def blank?\n attributes.values.all?(&:blank?)\n end", "def blank?\n attributes.values.all?(&:blank?)\n end", "def blank?\n attributes.values.all?(&:blank?)\n end", "def filter_attributes(attributes, to_filter)\n return nil if attributes.nil? || to_filter.nil?\n\n attributes.select { |key, _| to_filter.include? key.to_sym }\n end", "def normalize_blank_strings\n attributes.each do |column, value|\n self[column] = nil if value.is_a? String and value.blank?\n end\n end", "def attributes\n @attributes ||= []\n raise TypeError, \"attributes contain bad elements #{@attributes}\" unless @attributes.all?{ |attribute| attribute.is_a? String }\n @attributes.sort!\n @attributes.uniq!\n @attributes\n end", "def to_search_options\n @options.select { |key, value| value.present? }\n end", "def clean_attributes(attributes)\n attributes[:license] = Array(attributes[:license]) if attributes.key? :license\n attributes[:rights_statement] = Array(attributes[:rights_statement]) if attributes.key? :rights_statement\n remove_blank_attributes!(attributes)\n end", "def search_values_without_quotes_and_filters\n search_string.gsub(Regexp.union(FILTER_WORD_REGEX, REGEX_WORD_IN_QUOTES), '').split(' ')\n end", "def narray_attributes\n @attributes.select(&:narray?)\n end", "def domain_attrs\n attributes.symbolize_keys.select {|_k, v| !v.nil? }\n end", "def except_attributes\n [].freeze\n end", "def clean_attributes\n return attributes if group.nil? || !group.empty?\n\n filtered_attributes = attributes.dup\n filtered_attributes.delete(:group)\n end", "def attributes\n Address.attribute_list.index_with { |_attr| nil }\n end", "def get_query_params\n out = {}\n search_attributes.each do |val|\n out[val.field] = self.send(val.field) unless self.send(val.field).blank?\n end\n\n out\n end", "def comparison_attributes\n except_list = ['id', 'updated_at', 'created_at', 'verified_at']\n except_list << 'alternative_phone' unless Spree::Config[:alternative_shipping_phone]\n except_list << 'company' unless Spree::Config[:company]\n\n a = attributes.except(*except_list)\n a.each{|k, v|\n if v.is_a?(String)\n v = v.downcase.strip.gsub(/\\s+/, ' ')\n a[k] = v.present? ? v : nil\n end\n }\n a['state_name'] = nil if a['state_name'].blank?\n a\n end", "def extract_attributes!(attributes)\n active_source_attributes = attributes.inject({}) do |active_source_attributes, column_values|\n active_source_attributes[column_values.first] = attributes.delete(column_values.first) if self.class.column_names.include? column_values.first\n active_source_attributes\n end\n\n [ active_source_attributes, attributes ]\n end", "def values\n valid_criteria[attribute_name].nil? ? {} : valid_criteria[attribute_name][\"values\"]\n end", "def clean_array(ary)\n ary.compact.map(&:strip).reject(&:blank?).uniq\n end", "def extract_values(row, field)\n values = []\n ['', '[]', '[en]', '[en_US]'].each do |attr|\n values << row[field + attr] unless row[field + attr].nil?\n end\n values\n end", "def read_present\n @attrs.select { |k,v| !v.nil? }\n end", "def trim_params(params)\n Hash[*(params.select { |k,v| new.attributes.keys.include? k.to_s}.flatten)] \n end", "def reject_empty_text(arr)\n arr.reject { |x| x.type == :text && x.value == \"\" }\n end", "def parse_attribute_values\n values = []\n each_property do |name, value|\n values << AttributeValue.new(name, value)\n end\n\n DEFAULTS.each do |default|\n if values.find { |v| v.attribute.name == default.attribute.name }.nil?\n values << default\n end\n end\n\n values\n end", "def to_a\n array = []\n attributes.each do |value|\n array << deep_unwrap(value)\n end\n\n return array\n end", "def to_a\n array = []\n attributes.each do |value|\n array << deep_unwrap(value)\n end\n\n return array\n end", "def attributes; @attributes ||= []; end", "def except(attributes_to_exclude)\n attributes_to_exclude = [attributes_to_exclude] unless attributes_to_exclude.kind_of? Array\n attributes_to_exclude.map! { |a| a.to_s.singularize }\n attributes.select { |a| !attributes_to_exclude.include?(a.id) }\n end", "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def trim_all_fields\n self.attributes.each{|a| a.strip! if a.class == 'String'}\n end", "def clean_array(a)\n a.select{|el| el.gsub(/\\s/,\"\").size > 0}\n end", "def all_annotations_excluding_attributes(attribs, include_values = false)\n return [] if attribs.blank?\n\n obj_type = self.class.base_class.name\n\n options = {\n joins: :annotation_attribute,\n conditions: ['`annotations`.`annotatable_type` = ? AND `annotations`.`annotatable_id` = ? AND `annotation_attributes`.`name` NOT IN (?)',\n obj_type,\n id,\n attribs],\n order: '`annotations`.`updated_at` DESC'\n }\n\n options[:include] = [:value] if include_values\n\n fetch_annotations(options)\n end", "def scaffold_search_null_options\n @scaffold_search_null_options ||= scaffold_attributes(:search).reject{|f| scaffold_table_column_type(f).nil?}.collect{|f| [scaffold_column_name(f), f]}\n end", "def get_attribute_values() \n @attribute_values_flat\n end", "def attribute_names\n names = []\n @attributes.each {|values| names << values.keys if values}\n names.flatten.uniq\n end", "def scaffold_filter_attributes(action, attributes)\n allowed_attributes = scaffold_attributes(action).collect{|x| x.to_s}\n attributes.reject{|k,v| !allowed_attributes.include?(k.to_s.split('(')[0])}\n end", "def strip_blanks\n STRIP_ATTRS.each { |attr| self[attr] = self[attr].strip if !self[attr].blank? }\n end", "def except_empty\n self.reject{|k, v| v.to_s.empty?}\n end", "def get_without_fields\n # Initialize fields to return with empty array in order to include all\n fields = []\n query_params = request.query_parameters\n if query_params.has_key? 'without'\n fields = query_params['without'].downcase.split(',')\n fields.each do |field|\n fields.delete(field) if !AppData.column_names.include? field\n end\n end\n \n return fields\n end", "def strip_blanks!\n @content.reject! { |item| item[:type] == :blank }\n end", "def ext_attrs(values, attrs_skip = [])\n result = values.except *attrs_always_skip\n return result\n end", "def clean!\n reject!(&:blank?)\n map!(&:strip)\n uniq!\n end", "def to_ary\n attributes.map { |attr| attr.value if attr }\n end", "def _filtered_attributes\n return accessible_attributes.to_a if accessible_attributes.present?\n\n return self.new.attributes.keys - protected_attributes.to_a\n end", "def compact_blank\n reject { |_k, v| v.blank? }\n end", "def clean!\r\n reject!(&:blank?)\r\n map!(&:strip)\r\n uniq!\r\n end", "def remove_all_with_nil\n return self.map {|x| x.any?{ |e| e.nil? } ? nil : x}.compact\n end", "def attributes_to_set\n []\n end", "def filter_search_keys(search_keys)\n search_keys.delete_if { |_key, value| value.empty? }\n end", "def remove_empty_values( arr )\n raise ArgumentError.new( 'The argument must be an array.' ) unless arr.is_a?( Array )\n\n arr.reject { |a| ( a.empty? if a.is_a?( String ) ) }\n end", "def strip_attributes(attrs_to_check)\n attrs_to_check = model.attribute_names if @attrs_to_manage[:strip] == :all\n\n attrs_to_check.each do |attribute|\n value = strip_attribute(attribute)\n model[attribute] = value if value\n end\n end", "def query_attributes(query_expression) # :nodoc:\n attrs = []\n array = query_expression.scan(/['\"](.*?[^\\\\])['\"]/).flatten\n until array.empty? do\n attrs << array.shift # skip it's value\n array.shift #\n end\n attrs\n end", "def filter_skip_attributes_from_payload(obj)\n if obj.is_a? Hash\n obj.map do |k, v|\n if k == \"skip_attribute\" && v\n return ''\n else\n obj[k] = filter_skip_attributes_from_payload(v)\n if obj[k].blank?\n obj.delete(k)\n end\n end\n end\n elsif obj.is_a? Array\n obj.each_with_index do |o, i|\n obj[i] = filter_skip_attributes_from_payload(o)\n end\n end\n return obj\n end", "def to_conditions\n [to_s] + @values\n end", "def ignore_attributes(*attributes)\r\n @@ignored_attributes[name] = attributes.flatten.map(&:to_s)\r\n end", "def clean_attrs\n data = node.to_hash\n %w(run_list recipes roles).each { |k| data.delete(k) }\n data\n end", "def filter_attr_values(audited_changes: {}, attrs: [], placeholder: \"[FILTERED]\")\n attrs.each do |attr|\n next unless audited_changes.key?(attr)\n\n changes = audited_changes[attr]\n values = changes.is_a?(Array) ? changes.map { placeholder } : placeholder\n\n audited_changes[attr] = values\n end\n\n audited_changes\n end", "def glean(types, attribs)\n result = []\n send(types).each do |el|\n subresult = {}\n attribs.each do |key|\n v = el.attribute_value key.to_s\n subresult.update key => v\n end\n result << subresult\n end\n return result\n end", "def data_with_nils\n to_a\n end", "def contained_attributes\n @images.map(&:attribute).uniq\n end", "def blank_to_nil_params\n params[:nyucore].merge!(params[:nyucore]){|k, v| v.blank? ? nil : v.is_a?(Array) ? v.reject{|c| c.empty? } : v}\n end", "def clean_data\n clean_attributes = {}\n attributes.each do |key, value|\n # clean user inputted strings\n value = value.downcase.strip if value.is_a?(String)\n\n clean_attributes[key.to_sym] = value\n end\n clean_attributes\n end", "def clean_attributes(attributes)\n # attributes[:rights_license] = Array(attributes[:rights_license]) if attributes.key? :rights_license\n super( attributes )\n end", "def attributes\n []\n end", "def type_note_keys_without_blanks\n @args[:type_note_keys].reject(&:empty?)\n end", "def assemble(values)\n if allow_blank\n values\n else\n values.delete_if(&:blank?)\n end\n end", "def ignore_non_read_or_write_attributes\n ['title', 'email', 'expertise_list', 'tool_list', 'mbox_sha1sum']\n end", "def search_attribute(attrib)\n unless attrib.blank?\n attrib = attrib.to_s.strip\n search_attributes.insert(0, attrib) unless search_attributes.include?(attrib)\n end\n end", "def clean_all\n [@vc_primary, @vc_complement, @hc_between_strands].collect { |a| a.delete(nil); a.uniq!; a.sort! }\n end", "def compact_blank!\n reject! { |_k, v| v.blank? }\n end", "def filter_attributes(attrs)\n attributes = attrs.each_with_object({}) do |name, inst|\n next unless validates?(name)\n inst[name] = get_field(name)\n end\n\n optional_fields = _optional\n if optional_fields.present?\n optional_fields.each do |field|\n next unless validates?(field)\n attributes[field] = get_field(field)\n end\n end\n\n associated_fields = _associations\n if associated_fields.present?\n associated_fields.each do |assoc|\n next unless validates?(assoc)\n attributes[assoc] = get_association(assoc)\n end\n end\n\n attributes\n end", "def remove_empty_values(item)\n case item\n when BaseDecorator::EMPTY_VALUE\n nil\n when TrueClass, FalseClass\n item\n when Hash\n item.map { |k, v| [k, send(__method__, v)] }.to_h.compact.presence\n when Array\n item.map { |v| send(__method__, v) }.compact.presence\n else\n item.presence\n end\n end", "def searchable_attribute_names\n if model.respond_to?(:searchable_alchemy_resource_attributes)\n model.searchable_alchemy_resource_attributes\n else\n attributes.select { |a| searchable_attribute?(a) }\n .concat(searchable_relation_attributes(attributes))\n .collect { |h| h[:name] }\n end\n end", "def extract_search_text(*attributes)\n Array(attributes).map { |meth|\n Nokogiri::HTML(self.send(meth)).xpath(\"//text()\").\n map {|node| text = node.text; text.try(:strip!); text}.join(\" \")\n }.reject(&:blank?).join(\"\\n\")\n end", "def ignore_attributes\n read_inheritable_attribute(:attr_ignore) || []\n end", "def filtered_results(results)\n return [] if results.blank?\n\n members = results.first[:uniquemember]\n members = results.first[:member] if members.blank?\n members.map do |r|\n uid = r.split(\",\").first\n uid.split(\"=\", 2).last\n end\n end", "def search_attributes\n {:title => self.name, :description => (!self.description.blank?) ? self.description[0..100] : \"\", :image => ''}\n end", "def omitted_attributes\n (self.class.replicate_omit_attributes + @replicate_opts[:omit]).uniq\n end", "def compact\n select { |item| !item.nil? }\n end", "def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end", "def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end", "def clean_attribute(value)\n if value.kind_of?(Hash)\n value.delete_if { |key, value| clean_attribute(value) }.empty?\n elsif value.kind_of?(Array)\n value.delete_if { |value| clean_attribute(value) }.empty?\n else\n value.to_s.strip.empty?\n end\n end", "def fields\n a = attributes.keys.to_a\n a.delete_if { | e | e =~ /^id$/ }\n end" ]
[ "0.6521453", "0.6448496", "0.6295388", "0.6236678", "0.6206599", "0.61815405", "0.6179791", "0.6101561", "0.6085985", "0.6054999", "0.60363144", "0.60348827", "0.60063154", "0.6003182", "0.5949406", "0.5944801", "0.5936023", "0.5936023", "0.5936023", "0.5936023", "0.5932954", "0.5926429", "0.5904354", "0.58191276", "0.5791532", "0.5776567", "0.57742476", "0.57477146", "0.57462424", "0.5744872", "0.5738337", "0.57359904", "0.57042074", "0.56995195", "0.56988996", "0.56773555", "0.56749016", "0.5667397", "0.5653359", "0.56247276", "0.562125", "0.56061584", "0.56061584", "0.560303", "0.5594313", "0.5585998", "0.5585998", "0.55833364", "0.5576886", "0.5576039", "0.55755967", "0.5563181", "0.55619633", "0.55447966", "0.55420125", "0.55372286", "0.55300426", "0.5521722", "0.5503585", "0.5496444", "0.5493641", "0.5491149", "0.548972", "0.5487518", "0.5482333", "0.5481638", "0.5466476", "0.5461264", "0.5459818", "0.5457942", "0.5453408", "0.54462326", "0.5445937", "0.5441194", "0.5436967", "0.5422283", "0.5420348", "0.5408143", "0.5407703", "0.5407019", "0.5392625", "0.53906864", "0.5381366", "0.53809696", "0.5380837", "0.5369968", "0.5357148", "0.535493", "0.5347528", "0.53216696", "0.5317242", "0.53158754", "0.53119314", "0.530299", "0.52965206", "0.5293517", "0.52934396", "0.52890646", "0.52890646", "0.52889293", "0.52856827" ]
0.0
-1
Reset to starting state
def reset_sales_stuff @last_sale = nil @sale = nil @item = nil @copy = nil @customers = nil @first_name_field.setStringValue("") @last_name_field.setStringValue("") @item_id_field.setStringValue("") @price_field.setStringValue("") @format_field.setStringValue("") @title_field.setStringValue("") @type_field.setStringValue("") @notification_label.setStringValue("") @status_label.setStringValue("") @customers_table.reloadData end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @current = 0\n @state = :stopped\n end", "def reset_state\n @state = nil\n end", "def reset\n set InitialPosition\n end", "def reset\n end", "def reset\n end", "def reset\n end", "def reset\n end", "def reset\n end", "def reset\n end", "def reset()\n \n end", "def reset\n @state = :entry\n end", "def reset() end", "def reset\n # TODO\n end", "def reset!\n end", "def reset!\n end", "def reset!\n initialize\n end", "def reset_start!\n @start = nil\n end", "def reset\n\n end", "def reset\n end", "def reset\n end", "def reset()\n end", "def reset ; end", "def reset\n\n end", "def reset\n @round = 0\n @turn = 0 \n assign_player_colors\n seat_players\n seed_player_funds\n reset_state_bins\n add_home_state_picks\n pick_who_goes_first\n start_at_first_day\n end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def resets; end", "def reset\n\t\tend", "def reset\n \n end", "def reset\n setup\n end", "def reset\n self\n end", "def reset\n # Empty, but subclasses will override this.\n end", "def reset!; end", "def reset!; end", "def reset!; end", "def reset!; end", "def reset()\n #This is a stub, used for indexing\n end", "def reset()\n #This is a stub, used for indexing\n end", "def reset\n stop\n flush\n start\n end", "def reset\n initialize\n setup\n end", "def reset\n @state = :waiting\n @man_days_done = 0\n end", "def reset\n clear\n @position = 0\n @current_index = 0\n end", "def reset\n @current = nil\n @pos = 0\n end", "def reset\n raise \"Not implemented\"\n end", "def reset\n cleanup(true)\n end", "def reset\n each(&:reset)\n self\n end", "def reset\n\t\tdo_send('ARST 2')\n\tend", "def reset\n\t\t@r = 0\n\t\t@p = 0\n\t\t@t = 0\n\t\t@l = 0\n\t\t@s = 0\n\tend", "def do_reset\n\t\t\n\t\t\t# Mark state as reset\n\t\t\t@reset = true\n\t\t\t\n\t\t\t# Revert text and palette\n\t\t\tself.text = nil \n\t\t\tself.palette = @palette_normal\t\t\t\n\t\tend", "def reset\n @cursor = Point.new(0, 0)\n @delta = Point.new(0, 1)\n @stores = Code::FINAL_CONSONANTS.times.map do |consonant|\n case consonant\n when 21 then Queue.new # ㅇ\n when 27 then Port.new # ㅎ\n else Stack.new\n end\n end\n @selected_store = @stores[0]\n @finished = false\n end", "def reset\n @sw_start = Time.now\n @sw_time = 0\n self\n end", "def reset\n @count = @options[:start]\n end", "def clearState()\n\t\t\t@_previous_state = @_state\n\t\t\t@_state = nil\n\t\tend", "def reset\n\t\tself.rs \t= 0\n\t\tself.ps \t= 0\n\t\tself.ss \t= 0\n\t\tself.gen\t= Random.new(SEED)\n\tend", "def reset\n invoke_on_reset_callbacks\n self\n end", "def reset\n @offset = 0\n end", "def reset\n super\n @first_iteration = true\n end", "def reset()\n @x\n \n end", "def reset\n @count = 0\n end", "def reset\n @cpt = 0\n @errors = 0\n @stopped = false\n end", "def reset!\n instance.reset!\n end", "def reset!\n instance.reset!\n end", "def reset!\n tap { set_defaults }\n end", "def reset\n @pc_x = 0\n @pc_y = 0\n @step_no = 0\n @dir = RIGHT\n # The stack is an INTEGER stack. Any characters are pushed as their ASCII value\n @stack = Stack.new\n @stringmode = false\n @running = true\n end", "def reset!\n self.command = :reset\n end", "def reset!\n executions.reset\n end", "def reset\n super\n end", "def initialize\n reset\n end", "def initialize\n reset\n end", "def initialize\n reset\n end", "def initialize\n reset\n end", "def reset\n dup.reset!\n end", "def reset!\n raise if working?\n @is_complete = false\n end", "def reset()\n @result = false\n @tests = 0\n end", "def reset!\n self.instance.reset!\n end", "def reset!\n self.instance.reset!\n end", "def reset\n if @stage == :running\n @should_reset = true\n end\n end", "def reset(_object); end", "def reset\n exit({})\n end", "def reset\n @loaded = false\n @slots = [nil]*SlotCount\n @pending_actions = []\n end", "def reset()\r\n\t\t@time.reset\r\n\t\t@penalty.reset\r\n\t\t@usedHelp = 0\r\n\t\t@numberOfStars = 0\r\n\t\t@isFinished = false\r\n\t\t@nbClick = 0\r\n\t\treturn self\r\n\tend", "def clear\n current_state.clear\n end", "def initialize\r\n reset\r\n end", "def reset\n getok 'RSET'\n end", "def reset\n @attempt = 0\n end" ]
[ "0.81629455", "0.8025223", "0.8012655", "0.79935545", "0.79935545", "0.7918337", "0.7918337", "0.7918337", "0.7918337", "0.79175967", "0.7870235", "0.7854956", "0.7833612", "0.78078103", "0.78078103", "0.7779504", "0.7770728", "0.7767353", "0.7758424", "0.7758424", "0.77382505", "0.7724861", "0.77071154", "0.76549304", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7645761", "0.7621346", "0.76155245", "0.75911075", "0.75767046", "0.7569318", "0.75465804", "0.7534969", "0.7534969", "0.7534969", "0.7534969", "0.7514646", "0.7514646", "0.7513532", "0.75076085", "0.7497684", "0.74637336", "0.74616945", "0.73897713", "0.73796535", "0.7361792", "0.7323233", "0.7302881", "0.7287504", "0.7263778", "0.7260994", "0.72462606", "0.7231753", "0.7185519", "0.7167081", "0.71495295", "0.7148766", "0.7144925", "0.7134925", "0.71325886", "0.71308804", "0.71308804", "0.71180457", "0.7102613", "0.70986694", "0.7082919", "0.7064887", "0.7048829", "0.7048829", "0.7048829", "0.7048829", "0.7035087", "0.7026834", "0.7023842", "0.70208627", "0.70208627", "0.7005449", "0.6992463", "0.69875056", "0.69821763", "0.69800663", "0.6975708", "0.6972175", "0.6968789", "0.6967651" ]
0.0
-1
WRITE CODE BELOW HERE
def all_pages(array) sum = 0 array.each do |book| sum += book[:pages] end puts sum # array.reduce {|book| book[:pages]} # array.each {|book| puts book[:pages].class} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def writethis; end", "def probers; end", "def custom; end", "def custom; end", "def private; end", "def schubert; end", "def suivre; end", "def code_of_conduct; end", "def code_point; end", "def weber; end", "def jack_handey; end", "def strain; end", "def terpene; end", "def source() end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def processor; end", "def formation; end", "def operations; end", "def operations; end", "def who_we_are\r\n end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def inline_code; end", "def statement; end", "def do()\r\n\tend", "def script; end", "def script; end", "def rossini; end", "def usage; end", "def usage; end", "def out; end", "def villian; end", "def method\n\t\t# code code\n\tend", "def how_it_works\r\n end", "def write; end", "def write; end", "def sn\n end", "def src; end", "def src; end", "def src; end", "def codes; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def cmd; end", "def stderrs; end", "def run() end", "def sic_code; end", "def run\n end", "def code_point=(_); end", "def trd; end", "def header; end", "def header; end", "def header; end", "def mambo_no_5; end", "def instructions\n \n end", "def motto; end", "def under; end", "def post_process; end", "def p15\n\t\nend", "def cobasysprog\n end", "def compilereturn\n\n end", "def lines_of_code; end", "def lines_of_code; end", "def verdi; end", "def pass; end", "def pass; end", "def handle; end" ]
[ "0.7163798", "0.7163798", "0.7163798", "0.7163798", "0.7163798", "0.7163798", "0.7163798", "0.6512597", "0.6442167", "0.6345179", "0.6345179", "0.6325178", "0.63037944", "0.6266899", "0.6242245", "0.6177981", "0.6126921", "0.60830444", "0.60670304", "0.60617733", "0.6022185", "0.60084444", "0.60084444", "0.60084444", "0.60084444", "0.60084444", "0.60084444", "0.60084444", "0.60084444", "0.60084444", "0.59955", "0.59790623", "0.59611744", "0.59611744", "0.59416276", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.593389", "0.5927461", "0.5921077", "0.59057665", "0.5902201", "0.5902201", "0.58787715", "0.58755493", "0.58755493", "0.58708566", "0.5852758", "0.5851625", "0.58269835", "0.5823417", "0.5823417", "0.58043915", "0.5800351", "0.5800351", "0.5800351", "0.57954395", "0.57847315", "0.57847315", "0.57847315", "0.57847315", "0.57847315", "0.57847315", "0.57847315", "0.57847315", "0.5767589", "0.5761891", "0.5752492", "0.5739785", "0.5727776", "0.5724697", "0.57046056", "0.56806844", "0.56806844", "0.56806844", "0.5669404", "0.5668511", "0.5667451", "0.5666894", "0.56663084", "0.56549966", "0.56406885", "0.56380135", "0.56361943", "0.56361943", "0.5633532", "0.5627262", "0.5627262", "0.5622541" ]
0.0
-1
Reset request options to defaults.
def reset @item_ids = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n VALID_OPTIONS_KEYS.each{|k| send(\"#{k}=\", nil)}\n self.endpoint = DEFAULT_ENDPOINT\n self.proxy = DEFAULT_PROXY\n self.api_version = DEFAULT_API_VERSION\n self\n end", "def reset!\n @options = defaults\n end", "def reset!\n @options = defaults\n end", "def reset_options!\n @options = self::DEFAULT_OPTIONS.clone # 'self::' is necessary with ruby 1.8\n end", "def reset!\n @options = {}\n end", "def reset_options\n VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", default_options[key])\n end\n end", "def reset\n initialize(@options)\n end", "def reset!\n @options = Name.defaults.dup\n end", "def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n default_option = OnTheSnow::Config.const_get(\"DEFAULT_#{k.upcase}\")\n self.send(\"#{k}=\", default_option)\n opts[k.to_s] = default_option #unless default_option.nil?\n opts\n end\n self\n end", "def reset\n @options = Marshal.load(@default)\nend", "def clear_request\n @url = nil\n @options = nil\n end", "def reset\n self.api_key = DEFAULT_API_KEY\n self.user_agent = DEFAULT_USER_AGENT\n self.search_query_defaults = DEFAULT_SEARCH_SETTINGS\n self\n end", "def reset_request\n @params = @headers = @body = nil\n end", "def reset\n self.user_agent = DEFAULT_USER_AGENT\n self.environment = DEFAULT_ENVIRONMENT\n self.api_version = DEFAULT_API_VERSION\n self.server_url = DEFAULT_SERVER_URL\n self.client_name = DEFAULT_CLIENT_NAME\n self.client_key = DEFAULT_CLIENT_KEY\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self.middleware = DEFAULT_MIDDLEWARE\n self.accept = DEFAULT_ACCEPT\n self\n end", "def reset_options_with(options)\n set_agent_with(options[:user_agent]) if options.include? :user_agent\n @strict = options[:strict] if options.include? :strict\n if options.include? :load\n options = load_config_file(options[:load]) || {}\n options.symbolize_keys!\n end\n set_google_with(options[:google]) if options.include? :google\n @dicts = options[:dicts].symbolize_keys! if options.include? :dicts\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n # self.response = DEFAULT_RESPONSE\n self.faraday_options = DEFAULT_FARADAY_OPTIONS\n self.login = DEFAULT_LOGIN\n self.pass = DEFAULT_PASS\n self\n end", "def reset\n self.options = nil\n self.option_processors = nil\n end", "def default_request_options\n {:timeout => 0, :head => {}}\n end", "def reset! # :nodoc:\n @params = nil\n @request = nil\n @headers = nil\n end", "def reset\n self.request_headers = DEFAULT_REQUEST_HEADERS\n self.endpoint = DEFAULT_ENDPOINT\n self.monitoringdata_endpoint = DEFAULT_MONITORINGDATA_ENDPOINT\n self.applogs_endpoint = DEFAULT_APPLOGS_ENDPOINT\n self.apikey = DEFAULT_APIKEY\n end", "def reset\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self.timeout = DEFAULT_TIMEOUT\n self.platform_credentials = DEFAULT_PLATFORM_CREDENTIALS\n self.disable_ssl_peer_verification = DEFAULT_DISABLE_SSL_PEER_VERIFICATION\n self\n end", "def reset!\n self.api_key \t = DEFAULT_API_KEY\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "def reset!\n tap { set_defaults }\n end", "def set_default_options!\n @options ||= OpenStruct.new\n @options.skip_uncovered = false\n @options.mute = false\n @options.reports = []\n end", "def set_default_options\n end", "def reset!\n DeskApi::Configuration.keys.each do |key|\n send(\"#{key}=\", DeskApi::Default.options[key])\n end\n self\n end", "def reset\n self.endpoint = DEFAULT_ENDPOINT\n self.authmethod = DEFAULT_AUTH_METHOD\n self.apikey = DEFAULT_API_KEY\n self.consumer_key = DEFAULT_CONSUMER_KEY\n self.consumer_secret = DEFAULT_CONSUMER_SECRET\n self.oauth_token = DEFAULT_OAUTH_TOKEN\n self.oauth_token_secret = DEFAULT_OAUTH_TOKEN_SECRET\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self.client_id = DEFAULT_CLIENT_ID\n self.client_secret = DEFAULT_CLIENT_SECRET\n self.endpoint = DEFAULT_ENDPOINT\n self.authorize_endpoint = DEFAULT_AUTHORIZE_ENDPOINT\n self.token_endpoint = DEFAULT_TOKEN_ENDPOINT\n self.gateway = DEFAULT_GATEWAY\n self.access_token = DEFAULT_ACCESS_TOKEN\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "def reset\n @params = {}\n @query_filters = []\n @uri = ''\n self\n end", "def reset\n self.api_id = DEFAULT_API_ID\n self.url = DEFAULT_API_URL\n self.api_key = DEFAULT_API_KEY\n self.certificate_chain = DEFAULT_CERTIFICATE_CHAIN\n end", "def reset\n self.client_account = DEFAULT_CLIENT_ACCOUNT\n self.client_secret = DEFAULT_CLIENT_SECRET\n self.user_agent = DEFAULT_USER_AGENT\n self.endpoint = DEFAULT_ENDPOINT\n self.adapter = DEFAULT_ADAPTER\n self.connection_type = DEFAULT_CONNECTION\n end", "def reset\n self.api_key = DEFAULT_API_KEY\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self.should_cache = true\n self\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.client_id = DEFAULT_CLIENT_ID\n self.client_secret = DEFAULT_CLIENT_SECRET\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "def reset!\n @apps = {}\n @default_params = {}\n @basic_auth = nil\n end", "def reset\n\t\t\tself.access_token = DEFAULT_ACCESS_TOKEN\n\t\t\tself.authorization_endpoint = DEFAULT_AUTHORIZATION_ENDPOINT\n\t\t\tself.client_id = DEFAULT_CLIENT_ID\n\t\t\tself.client_secret = DEFAULT_CLIENT_SECRET\n\t\t\tself.endpoint = DEFAULT_ENDPOINT\n\t\t\tself.proxy = DEFAULT_PROXY\n\t\t\tself.user_agent = DEFAULT_USER_AGENT\n\t\tend", "def reset!\n self.api_username = DEFAULT_API_USERNAME\n self.api_key = DEFAULT_API_KEY\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self.raise_errors = DEFAULT_RAISE_ERRORS\n self\n end", "def reset\n self.api_key = DEFAULT_API_KEY\n self.api_version = DEFAULT_API_VERSION\n self.endpoint = DEFAULT_ENDPOINT\n self.adapter = DEFAULT_ADAPTER\n end", "def reset\n self.tap do |c|\n c.base_uri = DEFAULT_BASE_URI\n c.endpoint = DEFAULT_END_POINT\n c.api_secret = DEFAULT_API_SECRET\n c.api_key = DEFAULT_API_KEY\n end\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.user_login = DEFAULT_USER_LOGIN\n self.user_password = DEFAULT_USER_PASSWORD\n self.endpoint = DEFAULT_ENDPOINT\n self.format = DEFAULT_FORMAT\n self.proxy = DEFAULT_PROXY\n self.cookie = DEFAULT_COOKIE\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self.consumer_key = DEFAULT_CONSUMER_KEY\n self.consumer_secret = DEFAULT_CONSUMER_SECRET\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n end", "def reset\n self.size = DEFAULT_SIZE\n self.format = DEFAULT_FORMAT\n self.cacheLimit = DEFAULT_CACHELIMIT \n self.timeout = DEFAULT_TIMEOUT \n self.url = DEFAULT_URL\n self.key = DEFAULT_KEY\n self\n end", "def reset!\n configure do |c|\n DEFAULTS.each { |k, v| c.send(\"#{k}=\", v) }\n end\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.username = DEFAULT_USERNAME\n self.password = DEFAULT_PASSWORD\n self.endpoint = DEFAULT_ENDPOINT\n self.format = DEFAULT_FORMAT\n self.user_agent = DEFAULT_USER_AGENT\n self.faraday_options = DEFAULT_FARADAY_OPTIONS\n self.return_card_numbers = DEFAULT_RETURN_CARD_NUMBERS\n self\n end", "def reset\n self.endpoint = ENDPOINT\n self.user_agent = USER_AGENT\n self\n end", "def reset\n VALID_CONFIG_KEYS.each do |k, v|\n send(\"#{k}=\", v)\n end\n self.rpc_spec_path = ::ENV.fetch('RPC_SPEC_PATH', DEFAULT_RSPEC_PATH).to_s\n options\n end", "def reset\n self.api_key = nil\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self.platform_client_id = nil\n self.platform_client_secret = nil\n self\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.username = DEFAULT_USERNAME\n self.password = DEFAULT_PASSWORD\n self.organization = DEFAULT_ORGANIZATION\n self.endpoint = DEFAULT_ENDPOINT\n self.version = DEFAULT_VERSION\n self.path_prefix = DEFAULT_PATH_PREFIX\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self\n end", "def reset\n self.host = DEFAULT_HOST\n self.key = DEFAULT_KEY\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "def reset!\n reset_endpoints!\n reset_routes!\n reset_validations!\n end", "def reset\n self.adapter = DEFAULT_ADAPTER\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self.consumer_key = DEFAULT_CONSUMER_KEY\n self.consumer_secret = DEFAULT_CONSUMER_SECRET\n self.endpoint = DEFAULT_ENDPOINT\n self.xauth_username = DEFAULT_XAUTH_USERNAME\n self.xauth_password = DEFAULT_XAUTH_PASSWORD\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n self.logger = DEFAULT_LOGGER\n self\n end", "def set_defaults\r\n @options = {\r\n :caching => true\r\n }\r\n end", "def reset\n VALID_CONFIG_OPTIONS.each { |opt| self.send(\"#{opt}=\", nil) }\n self.logger = nil\n end", "def prepare_options(options)\n options = self.class.defaults.merge(self.options).merge(options)\n end", "def reset!\n self.api_key = nil\n self.host = nil\n self.request_headers = nil\n self.version = nil\n self.retry_max_count = nil\n self.retry_wait_seconds = nil\n self.return_response = nil\n self.logger = nil\n @settings = nil\n end", "def reset_defaults_and_overrides\n default.clear\n override.clear\n end", "def default_options\n sync{ @opts || {} }\n end", "def reset\n VALID_CONFIG_OPTIONS.each { |opt| self.reset_attribute(opt) }\n end", "def reset!\n @defaults.each do |k, v|\n instance_variable_set(k, v)\n end\n end", "def reset_defaults; end", "def reset\n @params = initial_params\n self\n end", "def clear_options\n @entries = {}\n end", "def reset\n self.mount_at = DEFAULT_MOUNT_AT\n self.dfly = DEFAULT_DFLY\n self.tabs = DEFAULT_TABS\n self.allowed_mime_types = DEFAULT_ALLOWED_MIME_TYPES\n self.icons = DEFAULT_ICONS\n self\n end", "def set_defaults\n default_user_agent = Config.user_agent || Typhoeus::USER_AGENT\n\n options[:headers] = {'User-Agent' => default_user_agent}.merge(options[:headers] || {})\n options[:headers]['Expect'] ||= ''\n options[:verbose] = Typhoeus::Config.verbose if options[:verbose].nil? && !Typhoeus::Config.verbose.nil?\n options[:maxredirs] ||= 50\n options[:proxy] = Typhoeus::Config.proxy unless options.has_key?(:proxy) || Typhoeus::Config.proxy.nil?\n end", "def reset\n self.company_id = DEFAULT_COMPANY_ID\n self.user_key = DEFAULT_USER_KEY\n self.secret_key = DEFAULT_SECRET_KEY\n self.endpoint = DEFAULT_ENDPOINT\n end", "def request_options(client)\n { verify: false }\n end", "def default_options=(opts); end", "def reset_storage_options!\n self.storage_options = storage_options_defaults.dup\n end", "def set_options\n options[:header] = @header unless @header.nil?\n options[:body] = @body unless @body.nil?\n options[:query] = @query unless @query.nil?\n end", "def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend", "def default_request_options\n {'ha_version' => ha_version, 'ha_format' => ha_format, 'ha_fancylayout' => ha_fancylayout} #, 'strict_oauth_spec_response' => true\n end", "def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end", "def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end", "def reset!\n Promisepay::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Promisepay::Default.options[key])\n end\n self\n end", "def options\n defaults.merge!(@options)\n end", "def options\n defaults.merge!(@options)\n end", "def reset\n @params = nil\n @logger = nil\n end", "def default_options; {} end", "def reset\n @config = nil\n @client = nil\n end", "def default_options=( opts )\n sync{ @opts = opts.nil? ? nil : opts.dup }\n end", "def set_default_options\n self.format = :csv\n self.type_system = nil\n self.conn_options = {}\n self.io_options = Hash.new{|h,k| h[k] = {}}\n end", "def request_options(opts = {})\n opts\n end", "def reset\n @params = Hash.new\n end", "def reset\n configure({})\n end", "def clear_options!\n clear_safety_options!\n self.timeless = false\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def reset_params\n @params = {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def reset\n reset_adapters\n reset_config\n reset_handlers\n reset_hooks\n end", "def reset!\n Octokit::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Octokit::Default.options[key])\n end\n self\n end", "def opts_reset!(hash)\n opts.reset!\n opts.configure_from_hash(hash)\n end", "def reset!\n Foxkit::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Foxkit::Default.options[key])\n end\n self\n end", "def reset!\n @application_name = NgpVan::Default.application_name\n @api_key = NgpVan::Default.api_key\n @api_endpoint = NgpVan::Default.api_endpoint\n @user_agent = NgpVan::Default.user_agent\n self\n end", "def reset_to_defaults!\n @allowlist_regexp = nil\n @custom_http_auth_scheme = UnsetString.new(\"custom_http_auth_scheme\")\n @env_var_to_hold_api_client_primary_key = NonNullString.new(\"env_var_to_hold_api_client_primary_key\",\"STITCHES_API_CLIENT_ID\")\n @env_var_to_hold_api_client= NonNullString.new(\"env_var_to_hold_api_client\",\"STITCHES_API_CLIENT\")\n @max_cache_ttl = NonNullInteger.new(\"max_cache_ttl\", 0)\n @max_cache_size = NonNullInteger.new(\"max_cache_size\", 0)\n @disabled_key_leniency_in_seconds = ActiveSupport::Duration.days(3)\n @disabled_key_leniency_error_log_threshold_in_seconds = ActiveSupport::Duration.days(2)\n end", "def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end", "def set_options(options={})\n @options.merge!(options)\n end" ]
[ "0.8153717", "0.80049723", "0.80049723", "0.7852717", "0.7788182", "0.7753053", "0.7624409", "0.75732845", "0.7503362", "0.748633", "0.73618525", "0.72853756", "0.7262728", "0.71707886", "0.7157197", "0.71203005", "0.710231", "0.7066108", "0.70409876", "0.70287114", "0.69267696", "0.6898614", "0.6873255", "0.68552744", "0.683801", "0.68287456", "0.6775322", "0.67650574", "0.67615366", "0.6756803", "0.67562693", "0.67400986", "0.6714216", "0.67112297", "0.6698611", "0.6692355", "0.6684426", "0.66767853", "0.66598016", "0.6650063", "0.66235936", "0.65926963", "0.659072", "0.65902877", "0.65459436", "0.6532258", "0.6506525", "0.64872366", "0.64735657", "0.6450203", "0.6445907", "0.6444246", "0.6439405", "0.64316267", "0.64245856", "0.6410212", "0.6399785", "0.6394449", "0.6387911", "0.6386495", "0.6378293", "0.6373572", "0.6347548", "0.63458645", "0.6339559", "0.6324445", "0.62955534", "0.62898976", "0.6274486", "0.6271266", "0.62660253", "0.624975", "0.624975", "0.6247847", "0.624572", "0.624572", "0.62322676", "0.622817", "0.62092185", "0.61961764", "0.61955965", "0.61933726", "0.6182694", "0.61807704", "0.61722887", "0.6170465", "0.6170465", "0.617001", "0.6164842", "0.61596256", "0.6144998", "0.6144998", "0.6144998", "0.61368525", "0.6135658", "0.6135523", "0.61352444", "0.6133065", "0.61060894", "0.6106042", "0.6101084" ]
0.0
-1
Create Employee notification for Owner.
def create_owner_with_service logger.info("creating owner>>>>>>>>>>>>>>>>>>>>>>>") if(property(:use_mobile_tribe)) empId = Employee.find_by_company_id(self.id) user = User.find_by_id(empId.user_id) mobile_tribe = Services::MobileTribe::Connector.new begin fields = { "companyId" => htmlsafe(empId.company_id.to_s), "userId" => htmlsafe(empId.user_id.to_s), "employeeId" => htmlsafe(empId.id.to_s), "firstName" => htmlsafe(user.firstname.to_s), "lastName" => htmlsafe(user.lastname.to_s), "status" => htmlsafe("active"), "phone" => htmlsafe(user.phone.to_s), "officePhone" => htmlsafe(empId.phone.to_s), "jobTitle" => htmlsafe(empId.job_title.to_s), "companyEmail" => htmlsafe(empId.company_email.to_s) } if empId.department_id.blank? fields["departmentId"] = "" else fields["departmentId"] = htmlsafe("-"+empId.department_id.to_s) end #"departmentId" => htmlsafe("-"+empId.department_id.to_s)} mobile_tribe.create_employee(fields) empId.update_attribute("is_mobiletribe_connect", "1") rescue Services::MobileTribe::Errors::MobileTribeError => e self.errors.add_to_base( "#{I18n.t('models.company.mobile_tribe_error')} #{e.to_s}" ) #self.owner_create_fail = true #Employee.find_by_company_id(self.id).delete self.delete_company_with_service Company.find_by_id(self.id).delete self.send(rollback_changes) return false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_employee\n \t\temployees.each do |employee|\n \t\t\tputs \"Notification sent to #{employee.name} at #{employee.email}\"\n \t\t\tputs \"\"\n \t\tend\t\n end", "def set_NotifyNewEntityOwner(value)\n set_input(\"NotifyNewEntityOwner\", value)\n end", "def create\n @employee = current_owner.employees.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = current_employee\n @event = @employee.events.new(event_params)\n\n respond_to do |format|\n if @event.save\n if @employee.role.name == \"HR\"\n EventMailer.send_event_email_to_all_employees(@event).deliver_later\n elsif @employee.role.name == \"Manager\"\n EventMailer.send_event_email_to_team(@event, @employee).deliver_later\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\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_notification; end", "def add_owner(owner)\n @user = User.find(owner)\n @owner = @user\n @app = @user.appointments.create(:booking_id => self.id, :owner => true, :confirmed => true, :status => 'booked')\n if @app.save\n BookingMailer.booking_email(@user, @app.booking, @owner).deliver\n end \n end", "def became_owner(expense)\n @expense = expense\n mail to: @expense.owner.email, subject: 'Expense Report Notification: You became the owner of an expense'\n end", "def create\r\n\t\t@notification = Notification.new(notification_params)\r\n\t\tif @notification.save\r\n\t\t\tAction.create(info: current_user.username + ' was sent this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend", "def notification_on_create\n create_notification(:create)\n end", "def notify_manager_for_panel(emp_from, req, resume, emp_to, emp_array)\n subject 'Interview added for your requirement'\n recipients [ emp_to.email ]\n from [ \"recruitment-no-reply@mirafra.com\" ]\n sent_on Time.now\n content_type 'text/html'\n body :emp_from => emp_from,\n :emp_to => emp_to,\n :emp_array => emp_array,\n :req => req,\n :resume => resume\n end", "def email_owner(event, apptmnt)\n user = User.find(apptmnt.owner_id)\n payload = {:user => user, :appointment => apptmnt}\n Outboundmail.outbound_event(event, user, payload)\n end", "def newly_created_opportunity\n # users = User.on_new_opportunity_subscriber\n user = User.find(97)\n opportunity = Opportunity.find(@opportunity_id)\n #NotificationMailer.newly_created_opportunities(user, opportunity).deliver_now\n opportunity.opportunity_email_notification.update_recently_added\n puts \"Notificação oportunidade criada recentemente\"\n end", "def create_welcome_notification\n factory = ActivityFactory.new self\n factory.generate :create, recipient: self\n end", "def employee\n @last_ext += 1\n p = Person.new\n p.office_phonenumber = Phonenumber.new(@phonenumber.prefix, phonenumber.number, @last_ext.to_s)\n p.office_email = Email.new(p)\n p.office_email.user_from_names(p, \".\")\n p.office_email.host = @domain\n p\n end", "def create_notification!\n ::Users::Notifications::NewBuyRequest.create(\n recipient_user_id: buyer.parent_id, sender_user_id: buyer_id, related_model_type:'Trading::BuyRequest', related_model_id: self.id,\n uri: Rails.application.routes.url_helpers.buy_request_path(self)\n )\n ::NotificationMail.create_from_mail(buyer_id, buyer.parent_id, UserMailer.new_buy_request(self.items.first, buyer) )\n end", "def create_notification(recipient, actor, action, notifiable)\n notification = Notification.create(recipient_id: recipient.id, actor_id: actor.id, action: action, notifiable: notifiable)\n end", "def invite_employee(employees, event)\n employees.each do |e|\n Attendance.create(user_id: e, event_id: event, rsvp: \"Invited\")\n end\n end", "def invited_and_create_notification(user, data_template, company)\n setup_email(user, company.id)\n @subject += 'Event Invitiation'\n @body[:url] = \"#{SITE}/activate/#{user.activation_code}\"\n @body[:loginurl] = \"#{SITE}/#{company.name}\"\n @support_email = \"#{SUPPORT_EMAIL}\"\n @invited_to_event = \"#{data_template.event.name}\"\n @invited_to_template = \"#{data_template.name}\"\n end", "def create_user_notification\n UsersNotification.create(user_id:self.id,notified:'y')\n end", "def create\n params['employee']['code_digest'] = Faker::Lorem.characters(10)\n @employee = Employee.new(employee_params)\n # byebug\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n \n \n format.json { render :show, status: :created, location: @employee }\n NewsletterMailer.weekly(\"hr@zelo.in\", \"Employeeid Generated\" , \"Employee Id\" , @employee.zoloid , \"Employee Code\" , @employee.code_digest , \"Link to register\" , \"https://welcome-to-zelo.herokuapp.com/new_employee_details/new\n\" ).deliver\n NewsletterMailer.weekly(\"soumitcse@gmail.com\", \"Employeeid Generated\" , \"Employee Id\" , @employee.zoloid , \"Employee Code\" , @employee.code_digest , \"Link to register\" , \"https://welcome-to-zelo.herokuapp.com/new_employee_details/new\n\" ).deliver\n # NewsletterMailer.weekly(\"soumitcse@zelo.in\", @employee.zoloid , @employee_details.name , @employee.code_digest; , \"Employeeid Generated\").deliver\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end", "def employeer_notification\n NotificationMailer.employeer_notification\n end", "def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end", "def new_participant_notification(participant)\n @participant = participant\n @pid = @participant.id\n @name = @participant.name\n @greeting = \"Hi\"\n @event_name = @participant.event.name\n @start_time = @participant.event.start_time.to_formatted_s(:long)\n\n mail to: \"#{@name} <#{@participant.email}>\", subject: \"Confirmation Needed: #{@event_name}\"\n end", "def create\n @event = Event.new(event_params)\n @creator = User.find(session[:user_id])\n\n @event.creator_id = @creator.id\n\n if @event.save\n\t\t\tEventCommitment.create(:user => @creator, :event => @event, :description => \"attend\")\n flash[:notice] = 'Event created.'\n redirect_to event_path(@event.id)\n else\n render(\"new\")\n end\n end", "def create_notification_mail!\n sender = status.eql?(:accept_recip_child) ? recipient : requester\n the_other_child = status.eql?(:accept_recip_child) ? requester : recipient\n ::NotificationMail.create_from_mail(sender.id, sender.parent_id, ::UserMailer.friend_request(self, sender, the_other_child),\n 'friend_request', self.id)\n end", "def send_email_to_owner\n return if !self.support_case or self.support_case.contact == self.created_by\n if AppSetting.config('Send Comment Notifications') == AppSetting::SEND_COMMENT_NOTIFICATIONS[:send_notification]\n SfcontactMailer.deliver_owner_notification(self)\n end\n rescue\n logger.info(\"Error occured creating case comment notification email: #{$!.message}\")\n end", "def create\n @event = Event.new(event_params)\n @event.user = @user\n @event.save\n # Cehck if there is any highschooler interested in talking to this undergraduate\n notify_highschooler if @user.interested_in_me.present?\n end", "def shift_notify(shift, employee)\n @shift_name = shift.employee.full_name\n @employee_name = employee.full_name\n @shift_time = shift.shift_day.strftime(\"%a-%d-%b\")\n @employee = employee.id\n @email = shift.employee.email\n\n mail(to: @email, subject:'Interested in your Shift')\n end", "def notify_employee\n \t\t@employees.each do |i| #loop through the array, each objects\n \t\tputs \"Hello #{i.email}\" #i access to a object\n\tend\t\nend", "def calendly_invitee_created\n puts \"Webhook call received for event created by #{calendly_invitee_email}\"\n if Profile.email_exist?(calendly_invitee_email)\n # do nothing\n else\n send_mail_to_invitee\n send_mail_for_event_deletion\n\n\n # Send mail to user, to created profile on our site.\n # Delete Event from calendly, (No documentation for the same)\n end\n end", "def notify_question_owner(answer)\n \t@answer = answer\n \t@question = answer.question\n \t@receiver = @question.user\n \tmail(to: @receiver.email,\n \t\t\t subject: \"You've got a new answer!\")\n end", "def create\n @employer = Employer.new(employer_params)\n\n respond_to do |format|\n if @employer.save\n UserNotifier.send_signup_email(@employer).deliver\n format.html { redirect_to @employer, notice: 'Employer was successfully created.' }\n format.json { render :show, status: :created, location: @employer }\n else\n format.html { render :new }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user_notification\n\t\tUserMailer.new_user_notification('test@test.com',User.where(:administrator => nil).first)\n end", "def add_owner_to_participants\n EventParticipant.create(user_id: self.user_id, event_id: self.id)\n end", "def create\n @event = Event.new(params[:event])\n @event.organization = current_user\n\n respond_to do |format|\n if @event.save\n\n @event.organization.follows.each do | follow | \n Pony.mail :to => \"\\\"#{follow.volunteer.name}\\\" <#{follow.volunteer.email}>\",\n :from => \"FundIt <fundit@fundit.org>\",\n :subject => \"#{@event.organization.name} created a new FundIt event #{@event.name}.\",\n :body => \"Check it out at http://fundit.herokuapp.com/organizations/#{@event.organization.id}/events/#{@event.id}.\"\n end\n\n format.html { redirect_to organization_event_url(@event.organization, @event), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def andrew_account_created_notification(person, options={})\n @person = person\n mail(:to=>[@person.personal_email],\n :subject=>options[:subject] || \"Andrew account information (\"+@person.email+\")\",\n :date=>Time.now)\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.employer = current_user.id\n \n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_path, notice: 'New Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n redirect_to :back\n end\n end\n end", "def on_create(instructable, address)\n @instructable = instructable\n if address == @instructable.user.email\n @reason = 'you created this class'\n else\n @reason = 'you are an admin of the system'\n end\n\n mail(to: address, subject: \"Class added: #{@instructable.name}\")\n end", "def fire_employee(employee)\n\n end", "def create\n @employee_event = EmployeeEvent.new(employee_event_params)\n\n respond_to do |format|\n if @employee_event.save\n format.html { redirect_to :back, notice: 'Employee was successfully added.' }\n else\n format.html { render :new }\n format.json { render json: @employee_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def hotel_notification(hotel, action, current_user)\n @user = current_user\n @action = action\n @hotel = hotel\n mail(to: \"zmb1391@gmail.com\", subject: \"Hotel created/updated/destroyed\")\n end", "def notify_resource_owner(request, user)\n @request = request\n @user = user\n @url = request_url(@request)\n \n mail :to => @user.email\n end", "def create_on_completed\n OnCompletedNotification.new\n end", "def create_admin_participation\n participation = Participation.create event: self\n ParticipationMailer.participation(participation).deliver\n end", "def tender_new_proposal_for_request_owner_email(the_request, the_proposal)\n @request = the_request\n @proposal = the_proposal\n mail(:to => @request.user.email,\n :subject => \"L'utente #{@proposal.user.login} ha postato una nuova offerta per la tua richiesta numero #{@request.id}\"\n )\n end", "def create\n @event = Event.new(event_params)\n users = User.all\n if @event.save\n @event.delay.call_notification(I18n.t('Notification.event_created'), I18n.t('Email.event_created'))\n render json: @event, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def notify_user(record)\n unless record.user_id == record.author_id\n create_notification(record, record.user)\n end\n end", "def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end", "def create\n @notification = current_user.notifications.new(params[:notification])\n @event = Event.find_by_id(params[:event_id]) if params[:event_id]\n @notification.event = @event if @event\n if @notification.save\n if @event\n redirect_to @event \n else\n redirect_to(@notification, :notice => 'Notification was successfully created.')\n end \n end\n end", "def create\n @eve_notification = EveNotification.new(params[:eve_notification])\n\n respond_to do |format|\n if @eve_notification.save\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully created.' }\n format.json { render json: @eve_notification, status: :created, location: @eve_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def employee_signup_email(employee)\n @employee = employee\n mail( :to => @employee.email,\n :subject => 'Thanks for signing up for Shiift' )\n end", "def create_notification\n\t\tNotification.create(title: self.title,\n\t\t\t\t\t\t\t\t\t\t\t\tnotification_type: 0,\n\t\t\t\t\t\t\t\t\t\t\t\tlocation: self.location,\n\t\t\t\t\t\t\t\t\t\t\t\tlatitude: self.latitude,\n\t\t\t\t\t\t\t\t\t\t\t\tlongitude: self.longitude,\n record_id: self.id,\n generated_by: self.created_by)\n\tend", "def create_employee\n user = User.new(first_name: \"Nelson\", last_name: \"Muntz\", username: \"nmuntz\", email: \"chris+nmuntz@cryptographi.com\", password: 'muffins1', password_confirmation: 'muffins1', job_title: 'Worker Guy')\n company_domain = \"cryptographi.com\"\n team = Team.find_by(domain_name: company_domain)\n if !team\n create_manager\n team = Team.find_by(domain_name: company_domain)\n end\n user.team = team\n manager = User.find_by(email: 'chris+rwiggum@cryptographi.com')\n user.manager_id = manager.id\n if user.save\n user.add_role :employee\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n if current_employee\n @employee.organization_id = current_employee.organization_id\n end\n\n respond_to do |format|\n if @employee.save\n if current_employee\n # If employee is logged in, notice should say you added employees to table\n format.html { redirect_to @employee,\n notice: \"#{@employee.first_name.capitalize} #{@employee.last_name.capitalize} was added on #{Time.new.strftime('%m/%d/%Y')}\"\n }\n else\n # If employee is not logged in, notice should say you just signed up\n session[:id] = @employee.id\n format.html { redirect_to organizations_path,\n notice: \"Thank you for signing up #{@employee.first_name.capitalize} #{@employee.last_name.capitalize}\"\n }\n end\n format.json { render :show, status: :created, location: @employee }\n @employee.schedule = Schedule.create(department_id: @employee.department_id)\n # Possibly move to after_save, if email changes, set needs_verification\n @employee.needs_verification!\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_NotifyLeadOwner(value)\n set_input(\"NotifyLeadOwner\", value)\n end", "def create\n @token = params[:invite_token]\n if @token.nil?\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Employee cannot be created.' }\n format.json { render :show, status: :unprocessable_entity, location: @employee }\n end\n else\n @employee = User.new(user_params)\n @employee.role = Employee.new(employee_params)\n @employee.role.shipping_address = Address.new(shipping_address_params)\n @employee.role.billing_address = Address.new(billing_address_params)\n\n @invitation = Invite.find_by token: @token\n @employee.role.business = @invitation.business\n\n Employee.transaction do\n User.transaction do\n Address.transaction do\n @employee.role.shipping_address.save!\n @employee.role.billing_address.save!\n @employee.role.save!\n @employee.save!\n end\n end\n end\n\n respond_to do |format|\n if @employee.persisted?\n format.html { redirect_to root_path, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create_notification\n Notification.create(\n notifiable_id: self.post.id, notifiable_type: 'Post', \n notification_type: 'Comment', source_user_id: self.user_id, target_user_hash: {},\n target_user_ids: [self.owner.id] , seen: false, custom_text: self.content)\n Notification.create(\n notifiable_id: self.post.id, notifiable_type: 'Post', \n notification_type: 'FollowedComment', source_user_id: self.user_id, target_user_hash: {},\n target_user_ids: self.notifiable_followers , seen: false, custom_text: self.content)\n end", "def parent_reserved_notification(order)\n\n @order = order\n @student = order.student\n @parent = @student.parent\n @admin = order.admin_user\n @greeting = \" #{@parent.name} y #{@student.name}\"\n\n mail(to: @parent.email, subject: \"Orden de Tutorias Reservada\", \n cc: [@admin.email,\"contacto@asset-tutores.com\", \"asistencia@asset-tutores.com\"])\n end", "def create_notification(record, user)\n Notification.create(\n user: user,\n object: record,\n name: \"topic_#{record.id_changed? ? 'created' : 'updated'}\"\n )\n end", "def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end", "def send_on_create_confirmation_instructions\n end", "def appointment_notification(event, client)\n @intake_form = ENV[\"INTAKE_FORM\"]\n @office_location = ENV[\"OFFICE_LOC\"]\n @event = event\n @counselors = return_counselor_lists(@event.users)\n @name = client.name\n email_with_name = %(\"#{client.name}\" <#{client.email}>)\n mail(to: email_with_name, subject: 'Appointment reminder and intake form for ITPH')\n end", "def notify(f, change, type = 'friend')\n reciprocal = f.mutual\n message = {\n type: type,\n email: current_user.email,\n change: change\n }\n if reciprocal\n message[:id] = reciprocal.id\n message[:other_id] = f.id\n else\n message[:id] = f.id\n end\n Notification.create user: f.other, body: message.to_json\n end", "def after_create(record)\n contents = to_sql_insert(record)\n to_logfile(contents)\n # Send a notification to the admin, if requested:\n if @email_on_create\n AgexMailer.action_notify_mail(\n record.respond_to?(:user) ? record.user : nil,\n \"#{@table_name} row CREATED\",\n contents\n ).deliver\n end\n end", "def send_mail_to_attendees_on_create\n if self.category.eql?(\"appointment\") and !self.attendees_emails.blank?\n user = self.matter_people.assignee\n att_arr = self.attendees_emails.split(\",\")\n for i in att_arr\n send_notificaton_to_attendees(user, self, i)\n end\n\n true\n end\n end", "def create\n @employee_email = EmployeeEmail.new(employee_email_params)\n\n respond_to do |format|\n if @employee_email.save\n format.html { redirect_to @employee_email, notice: 'Employee email was successfully created.' }\n format.json { render :show, status: :created, location: @employee_email }\n else\n format.html { render :new }\n format.json { render json: @employee_email.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_on_create_confirmation_instructions\n end", "def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end", "def organisation_and_operator_created(operator)\n @operator = operator\n @organisation = operator.organisation\n mail(\n to: @operator.email,\n subject: 'Confirmation instructions'\n )\n end", "def create\n super\n NotificationMailer.sign_up_notification(@user).deliver\n end", "def create\n if params[:brutto] != nil\n # hh = 'create'\n # byebug\n make_payment\n\n else\n @employee = Employee.new(employee_params)\n @employee.users_id = current_user.id\n @employee.fio = @employee.firstname.chars.first.upcase + \".\" + @employee.lastname\n # byebug\n respond_to do |format|\n if @employee.save\n around_create\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create (attendee)\n\n # respond_to do |format|\n\n # Sends email to user when user is created.\n ItineraryMailer.sample_email(attendee).deliver_now\n\n\n # format.html { redirect_to attendee, notice: 'Attendee was successfully created.' }\n # format.json { render :show, status: :created, location: attendee }\n # else\n # format.html { render :new }\n # format.json { render json: @attendee.errors, status: :unprocessable_entity }\n # end\n end", "def new_user_notification\n ModelMailer.new_user_notification\n end", "def signed_up_alert(evt)\n @evt = evt\n host = User.find_by_id(@evt.user_id)\n mail(:to => host.email, :subject => \"There is a seat request for your Local Yum event\", :from => \"\\\"Local Yum\\\" <notification@localyum.me>\")\n end", "def create_notification!(id: nil, priority: nil, type: nil, user_id: nil, name: nil, message: nil, details: nil)\n add_to_task_queue do\n notification_data_source.create_notification!(\n id: id,\n priority: priority,\n type: type,\n user_id: user_id,\n name: name,\n message: message,\n details: details\n )\n end\n end", "def create\n getFullNameEmployees\n @announcement = Announcement.new(announcement_params)\n if @announcement.global\n @announcement.employee_id=0\n end\n @announcement.accepted = false\n\n # @announcement.global = true\n respond_to do |format|\n\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Anuncio fue creado.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end", "def prayer_created(recipient, prayer)\n @recipient = recipient\n @prayer = prayer\n\n mail( :to => @recipient.full_email,\n :subject => \"New Prayer from #{@prayer.user.name}: #{truncate(@prayer.title, :length => 40)}\" )\n end", "def create_employee_user\n email = self.work_email\n user = User.new(email: self.work_email, password: 'appsimpact@#123', role: 'employee')\n user.save\n self.user_id = user.id\n end", "def create_notification!(id: nil, priority: nil, type: nil, user_id: nil, name: nil, message: nil, details: nil)\n not_implemented(__method__)\n end", "def send_on_create_instructions\n send_create_instructions\n end", "def create_and_notify\n comment = build\n\n begin\n send_email_notification(comment)\n rescue => e\n puts \"#{e} was raised while attempting to send notification \" +\n \"on #{commentable.class} #{commentable.id} to User #{commentable.user.id}\"\n end\n\n comment\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.user = current_user\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_mail_to_associates\n unless self.matter_people.blank?\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end\n end", "def create\n #debugger\n @event = Event.new(params[:event])\n @event.owner = current_user.id\n #@event.update_attribute(:owner,@current_user.id)\n @current_user.events << @event\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <mailgun@sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end", "def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end", "def create\n @event = Event.new(event_params)\n #Makes so that the created event is tied to the active user\n @event.user = current_user\n respond_to do |format|\n if @event.save\n # Event owner must join the event\n event = Event.last\n event_id = event.id\n event_user_id = event.user_id\n event_obs = 'I am the owner of this event'\n event_status = true\n act = Active.new(user_id: event_user_id, event_id: event_id, status: event_status, obs: event_obs)\n act.save\n save_events_file(\"eventlist.txt\")\n # end of joining event\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def welcome(owner)\n @greeting = \"Hi\"\n @first_name = owner[:first_name]\n email=owner[:email]\n # mail to: email, subject: 'Welcome to Where My Dogs At?'\n mail to: email\n end", "def new_endorsement\n endorsement = Endorsement.take\n\n NotifierMailer.new_endorsement endorsement.organization.id, endorsement.id\n end", "def invited_notification(user, data_template, company)\n setup_email(user, company.id)\n @subject += 'Event Invitiation'\n @body[:url] = \"#{SITE}/#{company.name}\"\n @support_email = \"#{SUPPORT_EMAIL}\"\n @invited_to_event = \"#{data_template.event.name}\"\n @invited_to_template = \"#{data_template.name}\"\n end", "def create\n @office_expense = OfficeExpense.new(office_expense_params)\n\n respond_to do |format|\n if @office_expense.save\n User.all.each do |user|\n ExpenseMailer.expense_added_mail(@office_expense, user).deliver\n end\n format.html { redirect_to @office_expense, notice: 'Office expense was successfully created.' }\n format.json { render :show, status: :created, location: @office_expense }\n else\n format.html { render :new }\n format.json { render json: @office_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_notification\n if followable_type == \"User\"\n Notification.create(\n target_id: followable_id,\n target_type: \"User\",\n notice_id: id,\n notice_type: \"Follow\",\n user_id: followable_id,\n notifier_id: follower_id\n )\n end\n end", "def create\n @employee = Employee.new(params[:employee])\n @employee.company_id=current_user.company_id\n respond_to do |format|\n if @employee.save_with_user(params) \n flash[:notice] = \"#{t(:text_new_user)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_created)}\"\n format.html { redirect_to lawfirm_admins_url}\n format.xml { render :xml => @lawfirm_admin, :status => :created, :location => @lawfirm_admin }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lawfirm_admin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end", "def create\n @center_attention_employee = CenterAttentionEmployee.new(center_attention_employee_params)\n\n respond_to do |format|\n if @center_attention_employee.save\n format.html { redirect_to @center_attention_employee, notice: \"Center attention employee was successfully created.\" }\n format.json { render :show, status: :created, location: @center_attention_employee }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @center_attention_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def demo_notification\n authorize @user, :message_angels?\n @user.angels.each do |angel|\n @client.messages.create(\n from: @twilio_phone,\n to: \"+#{angel.phone_number}\",\n body: \"#{angel.first_name}! #{@message}\"\n )\n end\n redirect_to ollivia_path, notice: 'Mensagens enviadas com sucesso.'\n end", "def after_create\n# SubmissUser.create(:submission_id => session[:submiss_id], :user_id => self.id, :submiss_admin => 'N')\n\t\tself.submiss_users.create(:submission_id => session[:submiss_id], :submiss_admin => 'N')\n\t\tUserNotifier.deliver_invitation(self, session[:submiss_id], session[:user_id])\n#\t\t deliver_invitation(@iu, session[:submiss_id], session[:user_id])\n puts('InviteeUser - after_create fired!')\n end", "def add_default_employees\n if transaction_include_action?(:create)\n self.employees.create!(first_name: \"Employee\", last_name: \"Solo\")\n self.employees.create!(first_name: \"Out of\", last_name: \"Office\")\n end\n end", "def publish_as(who, details)\n auth_as\n\n @logger.info(\"Attempting to create event for \" + who)\n @logger.debug details.to_yaml\n\n ret = @client.execute(\n api_method: @calendar.events.insert,\n parameters: {'calendarId' => who, 'sendNotifications' => true},\n body: details.to_json,\n headers: {'Content-Type' => 'application/json'}\n )\n @logger.debug ret.to_yaml\n ret\n end" ]
[ "0.6703223", "0.64166325", "0.6370728", "0.6271908", "0.62403893", "0.62388295", "0.6210563", "0.62016505", "0.6201373", "0.6092097", "0.6064204", "0.6020513", "0.59770507", "0.59309435", "0.5919393", "0.5891983", "0.58870584", "0.5863825", "0.58543235", "0.58476496", "0.58399016", "0.58386666", "0.58188546", "0.58147514", "0.58023685", "0.5776708", "0.57690775", "0.5768391", "0.5756415", "0.57548034", "0.5671601", "0.5670668", "0.56675375", "0.5666474", "0.5665622", "0.5662559", "0.56622565", "0.565438", "0.5650739", "0.5649783", "0.5645132", "0.5643459", "0.56322616", "0.56315684", "0.56178117", "0.56143034", "0.5607186", "0.56062573", "0.55903", "0.55733144", "0.5569274", "0.55663574", "0.55656034", "0.5563462", "0.5554627", "0.55219764", "0.5515192", "0.5506299", "0.5485398", "0.5484324", "0.54841685", "0.54809856", "0.5476319", "0.547586", "0.5475104", "0.54663765", "0.5464841", "0.545623", "0.54528224", "0.54512894", "0.5450322", "0.5449828", "0.5449116", "0.5446034", "0.54361665", "0.5431203", "0.54276824", "0.5423559", "0.54218274", "0.5417361", "0.5410463", "0.5408287", "0.54061466", "0.5405163", "0.540228", "0.53976315", "0.53932697", "0.53917503", "0.5389478", "0.5388349", "0.5386126", "0.53849936", "0.53830934", "0.5379714", "0.5375169", "0.5368672", "0.53667355", "0.5365742", "0.53551775", "0.53510785" ]
0.5859138
18
showing full object instead of just names of galleries asks Painting for a list of paintings by self Asks each Painting for its gallery asks the Gallery for its city returns cities in an array
def cities galleries.map do |gallery| gallery.city end #undefined method `city' for "New York":String end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cities\n galleries.map do |gallery| \n gallery.city \n end\n end", "def cities\n galleries.map do |gallery|\n gallery.city\n end\n end", "def cities\n galleries.map do |gallery|\n gallery.city\n end\n end", "def cities\n galleries.map {|gallery| gallery.city}\n end", "def cities\n galleries.map {|gallery| gallery.city}\n end", "def cities\n galleries.map do |c|\n c.city\n end\n end", "def cities\n self.galleries.map do |gi|\n gi.city\n end\n end", "def list_cities\n list_galleries.map do |gallery|\n gallery.city\n end\n end", "def cities\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery.city\n end\n end.compact.uniq\n end", "def cities\n self.galleries.map do |g|\n g.city\n end\nend", "def cities\n self.galleries.map{|painitng| painitng.city}\n end", "def all_cities\n city_arr = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n city_arr.map do |painting_ob|\n painting_ob.gallery.city\n end\nend", "def cities\n galleries.map {|g| g.city}\n end", "def cities\n Gallery.all.map{|list| list.city}\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def gallaries\n paintings.map{|paint| paint.gallery}\n\n end", "def cities()\n self.galleries().map { | gallery | gallery.city }.uniq\n end", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def galleries\n paintings.map do |p|\n p.gallery\n end\n end", "def list_galleries\n list_paintings.map do |gallery_painting|\n gallery_painting.gallery\n end\n end", "def cities\n galleries.map{|gallery| gallery.city}.uniq\n end", "def maps\n @cities = Art.joins(:galleries).where(\"galleries.show = true and arts.city <> '' \").pluck(\"city\").uniq!\n\n if params[:city].to_s != \"\"\n @city= params[:city].to_s== \"oa\" ? \"\" : params[:city].to_s\n search = \"galleries.show = true and arts.city = '\"+@city+\"'\"\n @galleries = Gallery.joins(:arts).where(search.to_s).distinct\n return\n end\n @galleries = Gallery.where(show: true).order('id DESC')\n end", "def all_galleries\n gallery_arr = Painting.all.select do |painting_ob|\n painting_ob.artist == self\n end\n gallery_arr.map do |painting_ob|\n painting_ob.gallery.name\n end\nend", "def cities \n galleries.map{|g| g.city}.uniq\n end", "def all_cities\n self.all_galleries.map do |gallery|\n gallery.city\n end.uniq\n end", "def all_featured_cities\n cities_featured = self.all_galleries_featured_in.map{|gallery| gallery.city}\n end", "def galleries\n paintings.map {|p| p.gallery}\n end", "def galleries\n galleries = self.paintings.map do |pi|\n pi.gallery\n end\n galleries.uniq\n end", "def galleries()\n self.paintings().map { | painting | painting.gallery }.uniq\n end", "def galleries\n self.paintings.map{|painitng| painitng.gallery}.uniq\n end", "def galleries\n paintings.map{|painting| painting.gallery}.uniq\n end", "def galleries\n galleries_array = paintings.map {|painting| painting.gallery}\n galleries_array.uniq\n end", "def galleries\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery\n end\n end.compact.uniq\n end", "def all_galleries\n self.all_paintings.map do |painting|\n painting.gallery\n end.uniq\n end", "def all_cities\n self.all.map do |gallery|\n gallery.city.uniq\n end\n end", "def cities\n gallaries.map{|place| place.city}\n\n end", "def galleries\n galleries = self.paintings.map do |p|\n p.gallery\n end\n galleries.uniq\nend", "def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end", "def paintings # Get a list of all the paintings by a specific(keywrod for instance method) artists\n Painting.all.select{|list| list.gallery == self}\n # binding.pry\n end", "def show\n @buildings = Building.all.where(campus: @campus.id)\n\n # преобразование массива точек в строку для SVG.js:\n @showPoints = []\n polygons_ids = Polygon.all.where(imageable_id: @campus.id).map{ |i| i.id }\n polygons_ids.each do |i|\n @showPoints << Point.all.where(polygon_id: i)\n .sort_by{ |j| j[:priority] }\n .map{ |j| \"#{j.ox}, #{j.oy}\" }\n .join(\" \")\n end\n # @buildings = Building.all.where(campus: @campus.id)\n end", "def index\n @city=\"\"\n @tag=\"\"\n @cssclass=\"\"\n @cities = Art.joins(:galleries).where(\"galleries.show = true and arts.city <> '' \").pluck(\"city\").uniq!\n\n if params[:tag].to_s != \"\"\n @galleries = Gallery.tagged_with(params[:tag].to_s).where(show: true).page(params[:page]).per_page(16).order('id DESC')\n @tag = params[:tag].to_s\n return\n end\n\n if params[:city].to_s != \"\"\n search = \"galleries.show = true and arts.city = '\"+params[:city].to_s+\"'\"\n @galleries = Gallery.joins(:arts).where(search.to_s).distinct.page(params[:page]).per_page(16)\n @city=params[:city].to_s\n return\n end\n\n @galleries = Gallery.where(show: true).page(params[:page]).per_page(16).order('id DESC')\n end", "def artists\n paintings.collect do |p|\n p.artist \n end\n end", "def all_galleries_featured_in\n my_galleries = self.all_my_paintings.map{|picture| picture.gallery}.uniq\n end", "def show\n @country = Country.includes(:regions).find(params[:id])\n @tours = Tour.search(params.merge({ region: @country.region_ids}))\n @attractions = @country.regions.map { |i| i.attractions }.flatten\n @hotels = @country.regions.map { |i| i.hotels }.flatten\n @photos = @country.regions.map { |i| i.gallery.photos if i.gallery }.flatten.uniq.compact\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country }\n end\n end", "def paintings\n Painting.all.select do |painting|\n painting.gallery == self\n end\n end", "def favorite_place_coords\n res = []\n stories.includes(:places => [{:place_categories => :parent}, :location]).each do |s|\n s.places.each do |p|\n next unless p.name.present?\n base_cat = p.get_parent_categories.first ? p.get_parent_categories.first.name : 'other'\n res << {name: p.name, base_category: base_cat, place_url: '/places/' + p.id.to_s, lat: p.location.lat, lng: p.location.lng}\n # binding.pry\n end\n end\n res\n end", "def artists\n paintings.map{|art| art.artist.name}\n\n end", "def all_paintings\n artist_paintings = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n artist_paintings.map do |painting_ob|\n painting_ob.title\n end\nend", "def show\n @genres = @circle.genres\n end", "def all_artists\n match = Painting.all.select{|painting| painting.gallery == self}\n match.map{|painting| painting.artist}\nend", "def paintings\n Painting.all.select do |a|\n a.gallery == self\n end\n end", "def print_city_list\n\n # simply call the print_vertices function of the graph API\n @query.get_graph.each_key { |city| puts \"#{get_city_info(city,\"name\")}\"}\n\n end", "def all_artist_names_by_gallery\n all_artists_by_gallery.map do |artist|\n # artist.name == Painting.artist.name\n artist.name\n end\n end", "def stay_city\n # cities = Country.all.map{|country|country.cities}\n # cities.map{|city|city.name}\n end", "def artists\n paintings.map do |painting|\n painting.artist\n end\n end", "def show\n @gmaps_links = []\n @round.albums.each do |album| \n album.places.each do |place|\n gmaps_link = place.address + ' ' + place.city + ' ' + place.state\n gmaps_link.gsub!(' ', '+')\n @gmaps_links << gmaps_link\n end\n end\n end", "def show\n @paintings = @artist.paintings\n end", "def show\n @images = @galleries_album.galleries\n end", "def show\n @search = Listing.search(params[:q])\n @listing = @search.result\n @categories = Category.all\n @category = Category.find(params[:id])\n @grouped_listing = @category.listings.group_by &:industry\n @area = Area.find(params[:id])\n @hash = Gmaps4rails.build_markers(@area.listings) do |listing, marker|\n marker.lat listing.latitude\n marker.lng listing.longitude\n marker.picture({\n \"url\" => \"http://google.com/mapfiles/kml/paddle/red-circle.png\",\n \"width\" => 60,\n \"height\" => 60})\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area }\n end\n end", "def populate\n json = params[:cities]\n cities = populate_database(json)\n cities.each{ |city|\n if(City.find_by_name(city.name).nil?)\n City.create({:name => city.name,:state => city.state,:lat => city.lat,:lng => city.lng,:link => api_city_url(city.name)})\n photos = get_images_url(city.lat,city.lng)\n photos.each{ |photo|\n #url_photo = photo['photo_file_url'].sub! 'http', 'https'\n CityImage.create({:url =>photo['photo_file_url'],:city_id => city.name})\n }\n end\n }\n render json: cities.to_json\n end", "def show\n @paintall = Painting.all\n end", "def show\n @countries = [[\"OC Oceania\",\"oc\"],[\"AD Andorra\", \"ad\"],[\"AE United Arab Emirates\", \"ae\"],[\"AF Afghanistan\", \"af\"],[\"AG Antigua and Barbuda\", \"ag\"],[\"AI Anguilla\", \"ai\"],[\"AL Albania\", \"al\"],[\"AM Armenia\", \"am\"],[\"AO Angola\", \"ao\"],[\"AQ Antarctica\", \"aq\"],[\"AR Argentina\", \"ar\"],[\"AS American Samoa\", \"as\"],[\"AT Austria\", \"at\"],[\"AU Australia\", \"au\"],[\"AW Aruba\", \"aw\"],[\"AX Åland Islands\", \"ax\"],[\"AZ Azerbaijan\", \"az\"],[\"BA Bosnia and Herzegovina\", \"ba\"],[\"BB Barbados\", \"bb\"],[\"BD Bangladesh\", \"bd\"],[\"BE Belgium\", \"be\"],[\"BF Burkina Faso\", \"bf\"],[\"BG Bulgaria\", \"bg\"],[\"BH Bahrain\", \"bh\"],[\"BI Burundi\", \"bi\"],[\"BJ Benin\", \"bj\"],[\"BL Saint Barthélemy\", \"bl\"],[\"BM Bermuda\", \"bm\"],[\"BN Brunei Darussalam\", \"bn\"],[\"BO Bolivia, Plurinational State of\", \"bo\"],[\"BQ Bonaire, Sint Eustatius and Saba\", \"bq\"],[\"BR Brazil\", \"br\"],[\"BS Bahamas\", \"bs\"],[\"BT Bhutan\", \"bt\"],[\"BV Bouvet Island\", \"bv\"],[\"BW Botswana\", \"bw\"],[\"BY Belarus\", \"by\"],[\"BZ Belize\", \"bz\"],[\"CA Canada\", \"ca\"],[\"CC Cocos (Keeling) Islands\", \"cc\"],[\"CD Congo, the Democratic Republic of the\", \"cd\"],[\"CF Central African Republic\", \"cf\"],[\"CG Congo\", \"cg\"],[\"CH Switzerland\", \"ch\"],[\"CI Côte d'Ivoire\", \"ci\"],[\"CK Cook Islands\", \"ck\"],[\"CL Chile\", \"cl\"],[\"CM Cameroon\", \"cm\"],[\"CN China\", \"cn\"],[\"CO Colombia\", \"co\"],[\"CR Costa Rica\", \"cr\"],[\"CU Cuba\", \"cu\"],[\"CV Cape Verde\", \"cv\"],[\"CW Curaçao\", \"cw\"],[\"CX Christmas Island\", \"cx\"],[\"CY Cyprus\", \"cy\"],[\"CZ Czech Republic\", \"cz\"],[\"DE Germany\", \"de\"],[\"DJ Djibouti\", \"dj\"],[\"DK Denmark\", \"dk\"],[\"DM Dominica\", \"dm\"],[\"DO Dominican Republic\", \"do\"],[\"DZ Algeria\", \"dz\"],[\"EC Ecuador\", \"ec\"],[\"EE Estonia\", \"ee\"],[\"EG Egypt\", \"eg\"],[\"EH Western Sahara\", \"eh\"],[\"ER Eritrea\", \"er\"],[\"ES Spain\", \"es\"],[\"ET Ethiopia\", \"et\"],[\"FI Finland\", \"fi\"],[\"FJ Fiji\", \"fj\"],[\"FK Falkland Islands (Malvinas)\", \"fk\"],[\"FM Micronesia, Federated States of\", \"fm\"],[\"FO Faroe Islands\", \"fo\"],[\"FR France\", \"fr\"],[\"GA Gabon\", \"ga\"],[\"GB United Kingdom\", \"gb\"],[\"GD Grenada\", \"gd\"],[\"GE Georgia\", \"ge\"],[\"GF French Guiana\", \"gf\"],[\"GG Guernsey\", \"gg\"],[\"GH Ghana\", \"gh\"],[\"GI Gibraltar\", \"gi\"],[\"GL Greenland\", \"gl\"],[\"GM Gambia\", \"gm\"],[\"GN Guinea\", \"gn\"],[\"GP Guadeloupe\", \"gp\"],[\"GQ Equatorial Guinea\", \"gq\"],[\"GR Greece\", \"gr\"],[\"GS South Georgia and the South Sandwich Islands\", \"gs\"],[\"GT Guatemala\", \"gt\"],[\"GU Guam\", \"gu\"],[\"GW Guinea-Bissau\", \"gw\"],[\"GY Guyana\", \"gy\"],[\"HK Hong Kong\", \"hk\"],[\"HM Heard Island and McDonald Islands\", \"hm\"],[\"HN Honduras\", \"hn\"],[\"HR Croatia\", \"hr\"],[\"HT Haiti\", \"ht\"],[\"HU Hungary\", \"hu\"],[\"ID Indonesia\", \"id\"],[\"IE Ireland\", \"ie\"],[\"IL Israel\", \"il\"],[\"IM Isle of Man\", \"im\"],[\"IN India\", \"in\"],[\"IO British Indian Ocean Territory\", \"io\"],[\"IQ Iraq\", \"iq\"],[\"IR Iran, Islamic Republic of\", \"ir\"],[\"IS Iceland\", \"is\"],[\"IT Italy\", \"it\"],[\"JE Jersey\", \"je\"],[\"JM Jamaica\", \"jm\"],[\"JO Jordan\", \"jo\"],[\"JP Japan\", \"jp\"],[\"KE Kenya\", \"ke\"],[\"KG Kyrgyzstan\", \"kg\"],[\"KH Cambodia\", \"kh\"],[\"KI Kiribati\", \"ki\"],[\"KM Comoros\", \"km\"],[\"KN Saint Kitts and Nevis\", \"kn\"],[\"KP Korea, Democratic People's Republic of\", \"kp\"],[\"KR Korea, Republic of\", \"kr\"],[\"KW Kuwait\", \"kw\"],[\"KY Cayman Islands\", \"ky\"],[\"KZ Kazakhstan\", \"kz\"],[\"LA Lao People's Democratic Republic\", \"la\"],[\"LB Lebanon\", \"lb\"],[\"LC Saint Lucia\", \"lc\"],[\"LI Liechtenstein\", \"li\"],[\"LK Sri Lanka\", \"lk\"],[\"LR Liberia\", \"lr\"],[\"LS Lesotho\", \"ls\"],[\"LT Lithuania\", \"lt\"],[\"LU Luxembourg\", \"lu\"],[\"LV Latvia\", \"lv\"],[\"LY Libya\", \"ly\"],[\"MA Morocco\", \"ma\"],[\"MC Monaco\", \"mc\"],[\"MD Moldova, Republic of\", \"md\"],[\"ME Montenegro\", \"me\"],[\"MF Saint Martin (French part)\", \"mf\"],[\"MG Madagascar\", \"mg\"],[\"MH Marshall Islands\", \"mh\"],[\"MK Macedonia, the former Yugoslav Republic of\", \"mk\"],[\"ML Mali\", \"ml\"],[\"MM Myanmar\", \"mm\"],[\"MN Mongolia\", \"mn\"],[\"MO Macao\", \"mo\"],[\"MP Northern Mariana Islands\", \"mp\"],[\"MQ Martinique\", \"mq\"],[\"MR Mauritania\", \"mr\"],[\"MS Montserrat\", \"ms\"],[\"MT Malta\", \"mt\"],[\"MU Mauritius\", \"mu\"],[\"MV Maldives\", \"mv\"],[\"MW Malawi\", \"mw\"],[\"MX Mexico\", \"mx\"],[\"MY Malaysia\", \"my\"],[\"MZ Mozambique\", \"mz\"],[\"NA Namibia\", \"na\"],[\"NC New Caledonia\", \"nc\"],[\"NE Niger\", \"ne\"],[\"NF Norfolk Island\", \"nf\"],[\"NG Nigeria\", \"ng\"],[\"NI Nicaragua\", \"ni\"],[\"NL Netherlands\", \"nl\"],[\"NO Norway\", \"no\"],[\"NP Nepal\", \"np\"],[\"NR Nauru\", \"nr\"],[\"NU Niue\", \"nu\"],[\"NZ New Zealand\", \"nz\"],[\"OM Oman\", \"om\"],[\"PA Panama\", \"pa\"],[\"PE Peru\", \"pe\"],[\"PF French Polynesia\", \"pf\"],[\"PG Papua New Guinea\", \"pg\"],[\"PH Philippines\", \"ph\"],[\"PK Pakistan\", \"pk\"],[\"PL Poland\", \"pl\"],[\"PM Saint Pierre and Miquelon\", \"pm\"],[\"PN Pitcairn\", \"pn\"],[\"PR Puerto Rico\", \"pr\"],[\"PS Palestine, State of\", \"ps\"],[\"PT Portugal\", \"pt\"],[\"PW Palau\", \"pw\"],[\"PY Paraguay\", \"py\"],[\"QA Qatar\", \"qa\"],[\"RE Réunion\", \"re\"],[\"RO Romania\", \"ro\"],[\"RS Serbia\", \"rs\"],[\"RU Russian Federation\", \"ru\"],[\"RW Rwanda\", \"rw\"],[\"SA Saudi Arabia\", \"sa\"],[\"SB Solomon Islands\", \"sb\"],[\"SC Seychelles\", \"sc\"],[\"SD Sudan\", \"sd\"],[\"SE Sweden\", \"se\"],[\"SG Singapore\", \"sg\"],[\"SH Saint Helena, Ascension and Tristan da Cunha\", \"sh\"],[\"SI Slovenia\", \"si\"],[\"SJ Svalbard and Jan Mayen\", \"sj\"],[\"SK Slovakia\", \"sk\"],[\"SL Sierra Leone\", \"sl\"],[\"SM San Marino\", \"sm\"],[\"SN Senegal\", \"sn\"],[\"SO Somalia\", \"so\"],[\"SR Suriname\", \"sr\"],[\"SS South Sudan\", \"ss\"],[\"ST Sao Tome and Principe\", \"st\"],[\"SV El Salvador\", \"sv\"],[\"SX Sint Maarten (Dutch part)\", \"sx\"],[\"SY Syrian Arab Republic\", \"sy\"],[\"SZ Swaziland\", \"sz\"],[\"TC Turks and Caicos Islands\", \"tc\"],[\"TD Chad\", \"td\"],[\"TF French Southern Territories\", \"tf\"],[\"TG Togo\", \"tg\"],[\"TH Thailand\", \"th\"],[\"TJ Tajikistan\", \"tj\"],[\"TK Tokelau\", \"tk\"],[\"TL Timor-Leste\", \"tl\"],[\"TM Turkmenistan\", \"tm\"],[\"TN Tunisia\", \"tn\"],[\"TO Tonga\", \"to\"],[\"TR Turkey\", \"tr\"],[\"TT Trinidad and Tobago\", \"tt\"],[\"TV Tuvalu\", \"tv\"],[\"TW Taiwan, Province of China\", \"tw\"],[\"TZ Tanzania, United Republic of\", \"tz\"],[\"UA Ukraine\", \"ua\"],[\"UG Uganda\", \"ug\"],[\"UM United States Minor Outlying Islands\", \"um\"],[\"US United States\", \"us\"],[\"UY Uruguay\", \"uy\"],[\"UZ Uzbekistan\", \"uz\"],[\"VA Holy See (Vatican City State)\", \"va\"],[\"VC Saint Vincent and the Grenadines\", \"vc\"],[\"VE Venezuela, Bolivarian Republic of\", \"ve\"],[\"VG Virgin Islands, British\", \"vg\"],[\"VI Virgin Islands, U.S.\", \"vi\"],[\"VN Viet Nam\", \"vn\"],[\"VU Vanuatu\", \"vu\"],[\"WF Wallis and Futuna\", \"wf\"],[\"WS Samoa\", \"ws\"],[\"YE Yemen\", \"ye\"],[\"YT Mayotte\", \"yt\"],[\"ZA South Africa\", \"za\"],[\"ZM Zambia\", \"zm\"],[\"ZW Zimbabwe\", \"zw\"]]\n @fullscreen = true\n @match = nil\n # current match\n if @table.matches.where(is_running: true).size > 0\n @match = @table.matches.where(is_running: true).first\n end\n # previous match\n if @table.matches.where(is_running: true).size == 0 && @table.matches.where(is_over: true).size > 0\n @match = @table.matches.where(is_over: true).reorder(\"matches.finished_at DESC\").first\n end\n if @table.banner.blank?\n @banner = false\n else\n @banner = true\n end\n end", "def display_cities(name_of_cities, urls, emails)\n i = 0\n while i < urls.length\n puts \"name => #{name_of_cities[i]}\"\n puts \"url => #{urls[i]}\"\n puts \"email => #{emails[i]}\"\n puts '==========='\n i += 1\n end\nend", "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 artist_names #return array of the names of all artists that have a painting in a gallery\n artists.name #pull array from artists method and call reader to get their name\n end", "def show\n @gastos = Gasto.all\n @company = Company.find(1)\n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @documents = @company.get_documents()\n @cajas = Caja.all \n @employees = @company.get_employees \n @tipomov = Tipomov.all \n end", "def artists\n self.paintings.map do |painting|\n painting.artist\n end.uniq\n end", "def items()\n data['galleries']\n end", "def show\n @place_images = nil\n if @place\n if @place.galleries.random\n @place_images = @place.galleries.random.images.random(3)\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def index\n @computer_geometries = ComputerGeometry.all\n end", "def show\n @rooms = Room.all.where(floor_id: @floor.id)\n\n # преобразование массива точек в строку для SVG.js (для полигонов этажей):\n # @showPointsOfFloor = []\n # polygons_ids = Polygon.all.where(imageable_id: @floor.id).map{ |i| i.id }\n # polygons_ids.each do |i|\n # @showPointsOfFloor << Point.all.where(polygon_id: i)\n # .sort_by{ |j| j[:priority] }\n # .map{ |j| \"#{j.ox}, #{j.oy}\" }\n # .join(\" \")\n # end\n\n # преобразование массива точек в строку для SVG.js (для полигонов аудиторий):\n @showPointsOfRooms = []\n @showNamesOfRooms = []\n polygons_ids = Polygon.all.where(imageable_id: Room.all.where(floor_id: @floor.id))\n polygons_ids.each do |i|\n @showPointsOfRooms << Point.all.where(polygon_id: i.id )\n .sort_by{ |j| j[:priority] }\n .map{ |j| \"#{j.ox}, #{j.oy}\" }\n .join(\" \")\n @showNamesOfRooms << Room.all.where(id: i.imageable_id)[0].name\n end\n end", "def show\n @gastos = Gasto.all\n @company = Company.find(1)\n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @documents = @company.get_documents()\n @cajas = Caja.all \n @employees = @company.get_employees \n @egresos = Egreso.order(:code)\n end", "def show\n @gastos = Gasto.all\n @company = Company.find(1)\n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @documents = @company.get_documents()\n @cajas = Caja.all \n @employees = @company.get_employees \n @egresos = Egreso.order(:code)\n end", "def full_descriptor\n city_country_tz = \"<img src='/images/flags/#{self.country.country_code.downcase}.png' /> #{self.utf8_name}\" # we will search on the ascii name but display the UTF8 one\n \n # if city has a region mapped in the db, print it out\n city_country_tz += \", #{self.region.name}\" if (self.region)\n \n # If the city has a country mapped in the db, print it out\n city_country_tz += \", #{self.country.name}\" if (self.country)\n \n # If the city has a time zone mapped in the db, print it out\n city_country_tz += \" (#{self.time_zone.name})\" if (self.time_zone) \n \n # this is a bad hack to make sure the seperator value is include\n # need to figure out how auto-complete can append this once a selection is selected\n #city_country_tz += \"; \"\n \n # Return the array\n city_country_tz\n end", "def index\n @grouped_companies = Company.all.group_by(&:geography) \n @companies = params[:q] ? company_filteration(params[:q],params[:region]) : Company.all\n render layout: \"browse\"\n end", "def index\n @spaces = Space.all\n\n # Index, downcase, and capitalize the categories\n dot_index = 0\n @spaces.group_by{|s| s.category.downcase}.each do |group|\n dot_color = Space.dot_colors[dot_index]\n group.last.each do |space|\n space.category = group.first.capitalize\n space.dot_color = dot_color\n end\n dot_index += 1\n end\n\n # Don't bother with generating markers for JSON\n respond_to do |format|\n format.html {\n\n @json = @spaces.to_gmaps4rails do |space, marker|\n marker.infowindow render_to_string(:partial => \"/spaces/marker\", :locals => { :space => space})\n marker.picture({\n :picture => \"http://maps.google.com/intl/en_us/mapfiles/ms/micons/#{space.dot_color}-dot.png\",\n :width => 32,\n :height => 32\n })\n marker.title space.name\n marker.json({ :id => space.id })\n end\n }\n format.json #render json\n end\n end", "def getAllCities\r\n result = []\r\n @vertex.each_value do |city|\r\n result << city.name\r\n end\r\n return result\r\n end", "def markers_ary( partners)\n partner_ary = []\n partners.map do |partner|\n partner_ary.push(\n { :lat =>partner.latitude ,\n :lng => partner.longitude,\n :picture =>\n {\n :url => asset_path('map-marker.png'),\n :width => 36,\n :height => 42\n },\n :infowindow => \"<div class='heading-blue'> #{partner.company}</div>\n <div class='content-grey'> #{partner.address}</div>\"\n },\n :option => { :do_clustering => false}\n )\n end\n partner_ary\n end", "def planets\n # go through my colonies\n self.colonies.map do |my_colony|\n # get the information about each planet the colony is on\n my_colony.planet\n end\n end", "def displayCities(dial_book)\n \n puts \"Available Cities: \"\n \n dial_book.each { |k, v| puts k }\n \nend", "def show_library\n @name_pool = []\n @planet_names = \"\"\n @planets.length.times do |i|\n @planet_names += \"#{i + 1}. #{@planets[i].name}\\n\"\n @name_pool << @planets[i].name\n end\n return @planet_names\n end", "def city_loop\n\t#loop through cities\n\t@cities.each do |t|\n\t\tputs \"#{t} is a town in Scotland\"\n\tend\n\nend", "def perform_gallery_search\n\n\n\n \trijksmuseum_key = ENV['RIJKSMUSEUM_KEY']\n escaped_search_term = self.escaped_search_term\n response = HTTParty.get(\"https://www.rijksmuseum.nl/api/en/collection?key=#{rijksmuseum_key}&format=json&q=#{escaped_search_term}&imgonly=true\")\n response_json = JSON.parse(response.body)\n rijksmuseum_response_count = response_json[\"count\"]\n rijksmuseum_array = response_json[\"artObjects\"]\n\n array_of_container_objects = []\n\n # rijksmuseum_array.each do |item|\n # container_array = {\n # title: \"\",\n # image: \"\",\n # artist: \"\",\n # id: \"\"\n # }\n\n # if item[\"longTitle\"].nil? || item[\"webImage\"].nil? || item[\"principalOrFirstMaker\"].nil?\n # # return cooper_hewitt_random_artwork_generator\n # container_array[:title] = \"Not found\"\n # container_array[:image] = \"Not found\"\n # container_array[:artist] = \"Not found\"\n # container_array[:id] = \"Not found\"\n # array_of_container_objects.push(container_array)\n # return array_of_container_objects\n # end\n # container_array[:title] = item[\"longTitle\"]\n # container_array[:image] = item[\"webImage\"][\"url\"]\n # container_array[:artist] = item[\"principalOrFirstMaker\"]\n # container_array[:id] = item[\"id\"]\n\n # array_of_container_objects.push(container_array)\n # end\n\n # container_array\n array_of_container_objects\n end", "def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end", "def show\n details = []\n\n param_city =params[:id].downcase\n city = City.find_by_name(param_city)\n puts api_city_culture_path(:city_id=>param_city).gsub(/\\/[^\\/]*$/,'') #trick because not having decleared the route as plurals I don't have the helper method for the index\n link_culture = api_city_culture_url(:city_id=>param_city).gsub(/\\/[^\\/]*$/,'')\n link_entertainment = api_city_entertainment_url(:city_id=>param_city).gsub(/\\/[^\\/]*$/,'')\n link_food = api_city_food_url(:city_id=>param_city).gsub(/\\/[^\\/]*$/,'')\n link_hotel = api_city_hotel_url(:city_id=>param_city).gsub(/\\/[^\\/]*$/,'')\n link_utility =api_city_utility_url(:city_id=>param_city).gsub(/\\/[^\\/]*$/,'')\n images = nil\n if city.nil?\n detail = {:name => param_city}\n details.append({:details => detail,:images => [],\n :link_culture =>link_culture,:link_entertainment => link_entertainment ,\n :link_food => link_food,:link_hotel =>link_hotel,:link_utility =>link_utility})\n else\n details.append({:details => city,:images => city.city_images,\n :link_culture =>link_culture,:link_entertainment => link_entertainment ,\n :link_food => link_food,:link_hotel =>link_hotel,:link_utility =>link_utility})\n end\n\n render json: details.to_json\n end", "def show\n\t\t@gallery = Gallery.find(params[:id])\n\t\t@albums = @gallery.project_albums\n\t\t@products = @gallery.featured_products.in_groups_of(4,false)\n\t\t@designer = @gallery.designer\n\t\t@other_galleries = @designer.galleries.where('id <> ?' , @gallery.id).in_groups_of(4,false)\n\t\t@sub_galleries = @gallery.sub_category.galleries.where('id <> ?' , @gallery.id).in_groups_of(4,false)\n\tend", "def all_my_paintings\n Painting.all.select{|picture| picture.artist == self}\n end", "def print_products(array)\n puts \"id\".ljust(5)+\"category\".ljust(15)+\"location\"\n puts \"-\" * 80\n array.each do |object|\n category_name = WAREHOUSE.execute(\"SELECT name FROM categories WHERE id = #{object.category_id}\")[0][\"name\"]\n location_name = WAREHOUSE.execute(\"SELECT name FROM locations WHERE id = #{object.location_id}\")[0][\"name\"]\n puts object.id.to_s.ljust(5) + category_name.ljust(15) + location_name\n end\n end", "def get_drawable_objects()\n @ary = []\n @ary += @monsters\n @ary += @towers.values\n @ary += @bullets\n @ary << @placed_tower if @placed_tower\n @ary\n end", "def show\n @educations = @city.educations\n @number_of_educations = @city.educations.count\n @pagy, @educations = pagy(@city.educations, items: 30)\n @page_title = @city.name\n end", "def list_gallery\n Galleries.all.each.with_index(1) { |gallery, i| puts \"#{i}. #{gallery.name}\"}\n end", "def get_demographics(options={})\n url_s=@@zillow_webservice_url+'GetDemographics.htm?zws-id='+@zwsid\n if options[:city]!=nil then\n url_s=url_s+'&city='+options[:city].to_s\n end\n if options[:state]!=nil then\n url_s=url_s+'&state='+options[:state].to_s\n end\n if options[:rid]!=nil then\n url_s=url_s+'&rid='+options[:rid].to_s\n end\n if options[:neighborhood]!=nil then\n url_s=url_s+'&neighborhood='+options[:neighborhood].to_s\n end\n fetch_result(url_s)\n end", "def paintings\n Painting.all.select{|painting| painting.artist == self}\n end", "def get_projects()\n a = []\n self.projects.each_index do |i|\n img = \"<img src='#{self.projects[i].thumbnail.url}' alt='#{self.projects[i].title}'/>\"\n a << \"<a href='/projects/#{self.projects[i].id}'><div class='box populated-box'>#{img}<div class='title'><p><span class='object-title'>#{self.projects[i].title}</span></p></div></div></a>\"\n end\n a.join.html_safe\n end", "def show\n @gallery = Gallery.find(params[:id])\n @category = Category.find(@gallery.category_id)\n @illustrations = @gallery.illustrations.find(:all, :order => \"sorted_order\")\n @illustration = @gallery.illustrations.build\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def show\n @gabinete_objects = GabineteObject.all\n @expo = Exhibit.find_by(id: @gabinete_object.exhibit_id)\n set_actual_obj(@gabinete_objects, @expo)\n \n @fotos = @gabinete_object.photos.all\n @historia = @gabinete_object.histories.all\n @gabinete_object.photos.each do |ima|\n @imagem_portada = ima if ima.ocapa == true\n @imagem_cara = ima if ima.cara == true\n end\n end", "def gallery\n @galleries = Gallery.all\n end", "def homes_info(homes)\n homes.each do |hm|\n puts \"#{hm.name} is in #{hm.city}\"\n puts \"Price: $#{hm.price} a night.\"\n end\nend" ]
[ "0.78167504", "0.77904457", "0.77904457", "0.7758796", "0.7758796", "0.7636955", "0.75682783", "0.75436413", "0.75296783", "0.74719405", "0.74590963", "0.73413813", "0.7328907", "0.72527254", "0.7055044", "0.7055044", "0.7055044", "0.7052989", "0.7041286", "0.70353687", "0.70012796", "0.6941667", "0.6890603", "0.68548596", "0.68336", "0.68023187", "0.6782275", "0.6776843", "0.67690706", "0.6629898", "0.6591297", "0.658579", "0.65538865", "0.6549818", "0.6524576", "0.6501628", "0.6427944", "0.64189786", "0.640537", "0.63653064", "0.6358143", "0.632669", "0.61633784", "0.61380786", "0.6037511", "0.60238075", "0.59957355", "0.596449", "0.594312", "0.59357536", "0.59139705", "0.5907581", "0.58908117", "0.5866432", "0.58465433", "0.58359486", "0.5820928", "0.578792", "0.57845396", "0.5767098", "0.574105", "0.57310945", "0.5673479", "0.56703013", "0.5648643", "0.5634648", "0.56321454", "0.5626398", "0.5623174", "0.56193274", "0.56068444", "0.55969995", "0.5586958", "0.5586127", "0.5586127", "0.55608785", "0.5553306", "0.55522925", "0.5547252", "0.5546769", "0.55460024", "0.554368", "0.55284107", "0.551218", "0.5488729", "0.54823077", "0.5477546", "0.5476695", "0.54647255", "0.5462202", "0.54551977", "0.5452458", "0.5424522", "0.54211605", "0.541029", "0.5404204", "0.54006", "0.53918624", "0.5390513", "0.5388822" ]
0.73919636
11
helper method for delete:
def maximum(tree_node = @root) tree_node.right.nil? ? tree_node : maximum(tree_node.right) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n \n end", "def delete\n \n end", "def delete\n end", "def delete\n\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 delete\n\n\tend", "def delete\n end", "def delete\n end", "def delete(*rest) end", "def delete(name)\n\n end", "def deleted(item)\n end", "def delete\n # TODO: implement delete\n end", "def destroy; delete end", "def delete\n raise NotImplementedError\n end", "def delete\n raise NotImplementedError\n end", "def delete(name); end", "def delete(name); end", "def delete(obj) ; end", "def delete\n\t\tfalse\n\tend", "def delete(object); end", "def delete\n raise NotImplementedError\n end", "def delete_operations; end", "def delete\n raise NotImplementedError\n end", "def delete; raise ActiveRecord::ReadOnlyRecord; end", "def delete(action, **args); end", "def delete(value)\n end", "def delete(value)\n end", "def delete!(*rest) end", "def deleteRequest\n\n end", "def delete_item\n\nend", "def del\n delete\n end", "def destroy\r\n\r\n end", "def delete_post\n\t \n \tend", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def delete\n return false\n end", "def destroy \r\n\r\n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy \n \n end", "def destroy\r\n end", "def destroy\r\n end", "def delete(oid)\n end", "def delete\n destroy\n end", "def delete\n destroy\n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def delete!\n request! :delete\n end", "def delete(contactname)\n\n end", "def _destroy_delete\n delete\n end", "def _destroy_delete\n delete\n end", "def delete(table, ids) # abstract\n end", "def destroy\n \n end", "def delete\n ret_val = error_if_exists('delete')\n super if ret_val\n return ret_val\n end", "def destroy\n\n end", "def delete(key)\n\n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\r\n end", "def destroy\n\t\t\n\tend", "def delete\n return @delete\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end" ]
[ "0.8373501", "0.80260485", "0.8013269", "0.80042505", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.79107374", "0.7799738", "0.77781236", "0.7493549", "0.7422571", "0.74152577", "0.7396308", "0.73679674", "0.7326224", "0.7326224", "0.7311375", "0.7311375", "0.7252753", "0.725267", "0.7244257", "0.7208222", "0.72013843", "0.71965003", "0.71889603", "0.7187095", "0.7183631", "0.7183631", "0.7167577", "0.7125145", "0.711353", "0.7107788", "0.7078295", "0.7065486", "0.705726", "0.705726", "0.705726", "0.705726", "0.705726", "0.705726", "0.705726", "0.705726", "0.705726", "0.705726", "0.70541155", "0.7052777", "0.7017235", "0.7017235", "0.70120704", "0.69652414", "0.69652414", "0.69552475", "0.69548935", "0.69548935", "0.6948128", "0.6948128", "0.6948128", "0.6948128", "0.6948128", "0.6948128", "0.6948128", "0.6945965", "0.6911031", "0.69078535", "0.69078535", "0.689664", "0.68946195", "0.68924433", "0.68908125", "0.68870634", "0.6877803", "0.6877803", "0.6877803", "0.6877803", "0.6877803", "0.6877803", "0.68777853", "0.68683136", "0.6865189", "0.6863397", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132", "0.6863132" ]
0.0
-1
a scrambled word and a dictionary of real words. Your program must then output all words that our scrambled word can unscramble to. Helper function to check if words are anagram of each other.
def anagram?(s1, s2) s1_array = s1.split("") s2_array = s2.split("") if s1_array.sort == s2_array.sort return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anagram?\n chars1 = @input1.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n chars2 = @input2.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n if\n self.allwords?\n if\n chars1 == chars2\n return \"These words are anagrams!\"\n elsif\n self.antigrams?\n return \"These words are not anagrams but they are antigrams!\"\n elsif self.antigrams? == false\n return \"These words are neither anagrams nor antigrams!\"\n end\n else\n return \"You need to input actual words!\"\n end\n end", "def anagrams?(word1, word2)\n w1 = Hash.new(0)\n word1.each_char do |char|\n w1[char] += 1\n end\n w2 = Hash.new(0)\n word2.each_char do |char|\n w2[char] += 1\n end\n return w1 == w2\nend", "def anagrams?(word1, word2)\n\n # let's use hash count \n counter1 = Hash.new(0)\n\n word1.each_char do |char|\n counter1[char] += 1\n end \n \n counter2 = Hash.new(0)\n word2.each_char do |char|\n counter2[char] += 1\n end \n\n if counter1 == counter2\n return true \n end \n\n return false\nend", "def word_unscrambler(arr, word)\n \n # get a helper function anangram or not\n \n # fileter out diff lengths\n same_length = arr.select{|dict_word| dict_word.length == word.length}\n \n matches = same_length.select{|string| anagram?(string, word)}\n \n matches\n \n #filter out non anagram words\n \n #\n\nend", "def are_anagrams?(word1, word2)\n #si las palabras son anagramas regresa true de lo contrario regresa false\n if canonical(word1) == canonical(word2) then true else false end\nend", "def word_unscrambler(word, dic)\n word = word.split(\"\").sort!\n anagrams = []\n\n i = 0\n while i < dic.length\n compare = dic[i].split(\"\").sort\n if word == compare\n anagrams << dic[i]\n end\n i += 1\n end\n p anagrams\nend", "def is_anagram?(word)\n#try determining if they are composed of the same letters.\n word.chars.sort == @word.chars.sort\n end", "def anagrams?(word1, word2)\n\treturn hashLetters(word1) == hashLetters(word2)\nend", "def is_anagram word1, word2\n \tpermute = permute_word(word1)\n \tpermute.each do |w|\n \t puts w.join\n \t if w.join.eql?(word2)\n \t \treturn true\n \t end\n \tend\n \treturn false\n end", "def anagrams?(word1, word2)\n\tarr1 = word1.split(\"\")\n \tarr2 = word2.split(\"\")\n\n count = Hash.new(0)\n \tcount2 = Hash.new(0)\n\n \tarr1.each {|word| count[word] += 1}\n \tarr2.each {|word| count2[word] += 1}\n\n if count == count2\n return true\n else\n return false\n end\nend", "def detect_anagram(word, dictionary)\n letter_array = word.downcase.split(//)\n word_array = []\n letter_array.permutation(word.length){|word| word_array << word.join }\n word_array.select {|word| dictionary.include?(word)}\nend", "def anagrams?(a_string, another_string)\n # TODO: implement the obvious method to test if two words are anagrams\n puts a_string_sorted = clean(a_string.downcase.chars.sort.join)\n puts another_string_sorted = clean(another_string.downcase.chars.sort.join)\n a_string_sorted == another_string_sorted\nend", "def anagrams?(word1, word2)\r\n return charCount(word1) == charCount(word2)\r\nend", "def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend", "def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend", "def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend", "def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend", "def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend", "def anagrams?(word1, word2)\n if word1.length != word2.length\n return false\n end\n word1.each_char do |ele|\n if !word2.include?(ele)\n return false\n end\n end\n return true\nend", "def anagram(words)\n words_hash = {}\n\n words.each do |w1|\n sorted_word = w1.chars.sort\n\n if words_hash.has_key?(sorted_word)\n words_hash[sorted_word] << w1\n else\n words_hash[sorted_word] = [w1]\n end\n end\n\n words_hash.values\nend", "def anagrams?(word1, word2)\n\treturn char_count(word1) == char_count(word2)\n \nend", "def anagrams?(word1, word2)\n\nend", "def anagrams?(word1, word2)\n\nend", "def unscramble(scrambled_word, dictionary)\n # slight optimization to only check against words in the dictionary\n # with the same length\n words_by_size = dictionary.inject({}) do |h, word|\n h[word.size] = h[word.size] ? h[word.size] << word : [word]\n h\n end\n\n words_to_check = words_by_size[scrambled_word.size]\n scrambled_word.chars.each do |c|\n words_to_check = words_to_check.select{|w| w.include? c}\n end\n\n words_to_check = words_to_check.select{|w| w.chars.all?{|c| scrambled_word.include? c}}\n\n puts \"#{scrambled_word} ==> #{words_to_check.first}\"\nend", "def first_anagram?(word1, word2)\n anagrams = []\n arr = word1.chars \n\n arr.permutation.each do |subArr|\n anagrams << subArr.join(\"\")\n end \n p anagram?(anagrams, word2) \nend", "def anagrams(word, words)\n words.select { |w| w.chars.sort == word.chars.sort }\nend", "def anagram?(word)\n normalize(word) == normalize(@word)\n end", "def check_anagrams(first_words, second_words)\n first_words.each_with_index do |word, index|\n if word.split('').sort == second_words[index].split('').sort\n puts true\n else\n puts false\n end\n end\nend", "def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n\n first_word.chars.each { |char| first_hash[char] += 1 }\n second_word.chars.each { |char| second_hash[char] += 1 }\n\n first_hash == second_hash\nend", "def fourth_anagram?(word1, word2)\n hash1 = Hash.new { |h, k| h[k] = 0 }\n hash2 = Hash.new { |h, k| h[k] = 0 }\n word1.chars.each do |char|\n hash1[char] += 1\n end\n word2.chars.each do |char|\n hash2[char] += 1\n end\n hash1 == hash2\nend", "def is_anagram(w1, w2)\n\tw1.downcase.split(\"\").sort.join == w2.downcase.split(\"\").sort.join\nend", "def second_anagram?(word1, word2)\n w1_copy = word1.dup\n w2_copy = word2.dup\n w1_copy.each_char do |ch1|\n w2_copy.each_char do |ch2|\n if ch1 == ch2\n w1_copy[w1_copy.index(ch1)] = \"\"\n w2_copy[w2_copy.index(ch2)] = \"\"\n end\n end\n end\n w1_copy.empty? && w2_copy.empty?\nend", "def anagrams(word, words)\n p words.select {|x| x.chars.sort == word.chars.sort }\nend", "def find_anagrams(word, dictionary)\n sort_chars = lambda{ |x| x.chars.sort.join }\n anagrams = Hash.new{|h,k| h[k] = [] }\n dictionary.each do |w|\n anagrams[sort_chars.call(w)] << w\n end\n return anagrams[sort_chars.call(word)]\nend", "def fourth_anagram?(word1, word2)\n hash1, hash2 = Hash.new { |h, k| h[k] = 0}, Hash.new { |h, k| h[k] = 0}\n\n word1.each_char do |char|\n hash1[char] += 1\n end\n\n word2.each_char do |char|\n hash2[char] += 1\n end\n\n hash1 == hash2\nend", "def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n first_word.each_char do |char|\n first_hash[char] += 1\n end\n second_word.each_char do |char|\n second_hash[char] += 1\n end\n first_hash == second_hash\nend", "def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\nend", "def are_anagrams(firstword, secondword)\n firstword.downcase.split(\"\").sort.join == secondword.downcase.split(\"\").sort.join\nend", "def anagram_finder(word, dictionary)\n\tag = []\ndictionary.each {|x| ag << x if word.split('').sort == x.split('').sort }\nag\nend", "def fourth_anagram?(word1, word2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash2[char] += 1}\n\n p hash1 == hash2\n\nend", "def anagrams?(str_sym_or_int_1, str_sym_or_int_2)\n str_sym_or_int_1.to_s.downcase.delete(' ').split('').sort.join == str_sym_or_int_2.to_s.downcase.delete(' ').split('').sort.join\nend", "def anagrams(word, words)\n word = word.chars.sort\n words.select{|x| x.chars.sort == word}\nend", "def fourth_anagram?(word1, word2)\n letters = Hash.new(0)\n word1.each_char do |char|\n letters[char] += 1\n end\n word2.each_char do |char2|\n letters[char2] -= 1\n end\n letters.all? {|k,v| v ==0}\nend", "def anagrams_maybe_better(string1, string2)\n return true if string1.chars.sort == string2.chars.sort\n false\nend", "def fourth_anagram(word1, word2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n word1.each_char { |char| hash1[char] += 1 }\n word2.each_char { |char| hash2[char] += 1 }\n\n hash1 == hash2\nend", "def anagram?(phrase_one, phrase_two)\n phrase_one.split('').sort == phrase_two.split('').sort\n end", "def third_anagram?(word1, word2)\n word1_chars = word1.split(\"\").sort\n word2_chars = word2.split(\"\").sort\n word1_chars == word2_chars\n\nend", "def third_anagram?(word_1, word_2)\n word_1.chars.sort == word_2.chars.sort\nend", "def anagrams(word1, word2)\n length = word1.length\n if word1.length == word2.length\n array = []\n while length>=0\n array.push(word1[length-1])\n length -= 1\n end\n length2 = word2.length\n while length2 >= 0\n if array.include?(word2[length2 - 1])\n length2 -= 1\n else\n return false\n end\n end\n return true\n else\n return false\n end\nend", "def anagramI?(str1, str2)\n anagrams = str1.split(\"\").permutation.to_a.map { |anagram| anagram.join(\"\") }\n anagrams.include?(str2)\nend", "def anagram_word?(test_word)\n sort_word(@word) == sort_word(test_word)\n end", "def anagrams?(s1, s2)\n return false if s1.downcase == s2.downcase\n \n a1 = s1.downcase.delete(' ').chars.sort\n a2 = s2.downcase.delete(' ').chars.sort\n\n a1 == a2\nend", "def combine_anagrams(words)\n anagrams = Hash.new()\n words.each do |word|\n letters = word.downcase.gsub(/[^a-z]/, \"\").split(\"\").sort.join\n anagrams[letters] = Array.new unless anagrams.include?(letters)\n anagrams[letters] << word\n end\n anagrams.values\nend", "def second_anagram?(word1, word2)\n return false if word1.length != word2.length\n word1.chars.each do |char1|\n word2.chars.each do |char2|\n if char1 == char2\n word1 = delete_char(word1, char1)\n word2 = delete_char(word2, char1)\n end\n end\n end\n\n word1.empty? && word2.empty?\nend", "def anagram(word)\n anagrams_array = %w(enlists google inlets banana)\n search = word.split('')\n search.sort!\n anagrams_array.each do |wordanna|\n new_word = wordanna.split('')\n new_word.sort!\n if search == new_word\n puts wordanna\n end\n end\nend", "def fourth_anagram?(word_1, word_2) #O(n)\n count1 = Hash.new(0) \n word_1.each_char { |char| count1[char] += 1 }\n\n count2 = Hash.new(0) \n word_2.each_char { |char| count2[char] += 1 }\n\n count1 == count2\nend", "def fourth_anagram(first_word, second_word)\n hash1 = Hash.new {|h, k| h[k] = []}\n first_word.each_char do |char|\n hash1[char] << char\n end\n second_word.each_char do |char|\n hash1[char] << char\n end\n hash1.values.all? {|ele| ele.length.even?}\nend", "def fourth_anagramb?(word1, word2)\n hash1 = Hash.new { |h, k| h[k] = 0}\n\n word1.each_char do |char|\n hash1[char] += 1\n end\n\n word2.each_char do |char|\n hash1[char] -= 1\n end\n\n hash1.each_value { |v| return false if v != 0}\n true\nend", "def is_anagram(w1, w2)\n\tif w1.split(//).sort == w2.split(//).sort\n\t\treturn true\n\tend\n\treturn false\nend", "def fourth_anagram?(word1, word2)\n letter_count = Hash.new { |hash, key| hash[key] = [] }\n\n split1= word1.chars\n split2 = word2.chars\n\n split1.each { |el| letter_count[el] << el }\n split2.each do |el2|\n if letter_count[el2].length > 0\n letter_count[el2].pop\n else\n return false\n end\n end\n\n return false if letter_count.any? { |key, value| value.count > 0 }\n true\n\nend", "def word_unscrambler(word, dictionary)\nresult = []\ndictionary.each do |entry|\n\tif entry.split(\"\").sort.join(\"\") == word.split(\"\").sort.join(\"\")\n\t\tresult << entry\n\tend\nend\nresult \nend", "def anagram (str1, str2)\n # to downcase and remove non alphanumeric characters \n str1_hash = str_to_hash(str1.downcase.gsub(/(\\W)/, \"\"))\n str2_hash = str_to_hash(str2.downcase.gsub(/(\\W)/, \"\"))\n\n if str1_hash == str2_hash\n return true\n else\n return false\n end\n\nend", "def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend", "def fourth_anagram2?(word1, word2)\n hash = Hash.new { |h, k| h[k] = 0 }\n word1.chars.each do |char|\n hash[char] += 1\n end\n word2.chars.each do |char|\n hash[char] -= 1\n end\n hash.keys.all? { |v| v == 0 }\nend", "def third_anagram?(word1, word2)\n split1= word1.chars.sort\n split2 = word2.chars.sort\n split1 == split2\nend", "def combine_anagrams(words)\n words_uniq = words.map{ |w| w.downcase.split(//).sort.join }.uniq\n words_uniq.map{ |wu| words.select{ |w| w.downcase.split(//).sort.join == wu }}\nend", "def anagram(words)\r\n result = words.group_by { |word| word.chars.sort.join }\r\n result.each {|k, v| p v unless v.size == 1}\r\nend", "def anagrams?(word_hash, comparison_hash)\n word_hash.each_key { |k| comparison_hash[k] -= word_hash[k] }\n comparison_hash.all? {|_k, v| v == 0 }\nend", "def third_anagram?(word1, word2)\n first = word1.chars.sort.join(\"\")\n second = word2.chars.sort.join(\"\")\n\n p first == second \nend", "def match(possible_anagrams)\n anagrams = []\n possible_anagrams.each do |possible_anagram|\n if possible_anagram.split(\"\").sort == @word.split(\"\").sort\n anagrams << possible_anagram\n end\n end\n anagrams\nend", "def match(array_possible_anagrams)\n matching_words=[]\n word_broken=self.word.split(\"\").sort\n array_possible_anagrams.each do |possible_match|\n #possible_match=possible.word\n possible_match_broken=possible_match.split(\"\").sort\n if possible_match_broken == word_broken\n matching_words << possible_match\n else\n end #end of if\n end #end of do\n matching_words\n end", "def anagrams(word)\n # anagrams of some \"ruby\" synonyms (up to three each)\n anagrams = {\n \"ruby\" => [\"bury\", nil, nil],\n \"rose\" => [\"ores\", \"roes\", \"sore\"],\n \"claret\" => [\"rectal\", \"coral\", nil],\n \"russet\" => [\"surest\", \"estrus\", nil]\n }\n\n puts \"\\n\"\n if not anagrams.keys.include?(word)\n puts \"#{word} has no anagrams\"\n else\n puts \"#{word} has this/these anagrams:\"\n puts \"\\n\"\n puts \"#{anagrams[word][0]}\"\n puts \"#{anagrams[word][1]}\"\n puts \"#{anagrams[word][2]}\"\n # Note. If value is nil, nothing is printed\n end\nputs \"\\n\"\nend", "def combine_anagrams(words)\n h = Hash.new()\n\n words.each do |word|\n lowercase_word = word.downcase\n sorted_lowercase_word = lowercase_word.chars.sort.join\n\n similar_words = h[sorted_lowercase_word]\n if not similar_words\n similar_words = []\n end\n similar_words << word\n h[sorted_lowercase_word] = similar_words\n\n end\n\n output = []\n h.each_value { |value| output << value }\n return output\nend", "def fourth_anagram?(word_1, word_2) # O(n)\n hash_1 = Hash.new(0)\n hash_2 = Hash.new(0)\n\n word_1.each_char {|char| hash_1[char] += 1}\n word_2.each_char {|char| hash_2[char] += 1}\n\n hash_1 == hash_2\nend", "def anagrams(word, words)\n # TODO: check if \"words\" has anagrams of \"word\" and return them in an array\nend", "def first_anagram?(word1, word2)\n permutations = word1.split('').permutation.to_a.map(&:join)\n permutations.include?(word2)\nend", "def valid_anagram(s,t)\n\n if s.length != t.length\n return false\n end\n\n #create hashes\n hash_table1 = Hash.new(0)\n hash_table2 = Hash.new(0)\n\n #check frequency of letters in string\n\n s.each_char do |ch|\n if hash_table1[ch] == nil?\n hash_table1[ch] = hash_table1[ch] + 1\n else\n hash_table1[ch] = 1\n end\n\n p hash_table1\n\n end\n\n t.each_char do |ch|\n if hash_table2[ch] == nil?\n hash_table2[ch] = hash_table2[ch] + 1\n else\n hash_table2[ch] = 1\n end\n p hash_table2\n end\n\n #compare both hash table\n\n return hash_table1 == hash_table2\n\nend", "def anagrams?(str1, str2)\n make_tally(str1) == make_tally(str2)\nend", "def make_anagram word1, word2\n s1 = word1.chars\n s2 = word2.chars\n\n count = 0\n\n # s1.each do |x|\n # if s2.include? x\n # count +=1\n # end\n # end \n # ana = (word1.size - count)*2\n\n freq = Hash.new(0)\n s1.each do |key|\n freq.store(key, freq[key]+1)\n end\n freq\n\n s2.each do |x|\n if freq[x] != nil\n freq[x] -= 1\n end\n end\n\n freq\n\n freq.each do |key,value|\n if value != 0\n count += value.abs\n end\n end\n\n count\n\nend", "def anagrams_v_one(str1,str2)\r\n\r\n # elvis\r\n # levis\r\n # lives\r\n # lsevi\r\n anagrams = []\r\n count = 0\r\n until count == 120 #5*4*3*2*1 = 120 \r\n shuffled = str1.chars.shuffle\r\n if !anagrams.include?(shuffled)\r\n anagrams << shuffled\r\n count +=1 \r\n end\r\n end\r\n anagrams.include?(str2.chars)\r\n # anagrams\r\nend", "def anagrams_v_one(str1,str2)\r\n\r\n # elvis\r\n # levis\r\n # lives\r\n # lsevi\r\n anagrams = []\r\n count = 0\r\n until count == 120 #5*4*3*2*1 = 120 \r\n shuffled = str1.chars.shuffle\r\n if !anagrams.include?(shuffled)\r\n anagrams << shuffled\r\n count +=1 \r\n end\r\n end\r\n anagrams.include?(str2.chars)\r\n # anagrams\r\nend", "def anagrams(array_of_words)\n ana_hash = Hash.new { |hash, key| hash[key] = [] }\n array_of_words.each { |word| ana_hash[word.split(\"\").sort.join] << word }\n ana_hash.map { |key, list| list }.select { |list| list.size > 1 }\nend", "def get_anagrams(word, dict)\n return nil if dict.empty?\n word_freq = char_freq(word)\n dict.select {|entry| anagrams?(word_freq, char_freq(entry))}.sort\nend", "def anagrams(string)\n# enable.txt is a Scrabble dictionary provided/recommended by Viking Code School\n dictionary = File.readlines(\"enable.txt\")\n stringy = string.strip.downcase\n# by SORTing the letters of the source string and the dictionary words you can easily match the results to find anagrams\n testy = stringy.chars.sort.join\n anagrams = []\n dictionary.each do |word|\n word = word.strip\n if word.length == stringy.length\n check = word.chars.sort.join\n if testy == check\n anagrams << word\n end\n end\n end\n if anagrams == []\n puts \"No anagrams were found for #{stringy.upcase}\"\n else\n anagrams.delete_at(anagrams.index(stringy))\n puts \"The following anagrams were found for #{stringy.upcase}\"\n puts \"#{anagrams}\"\n end\nend", "def are_anagrams?( s1, s2 )\r\n\ttransformS1 = s1.downcase.split('').sort.join('')\r\n\ttransformS2 = s2.downcase.split('').sort.join('')\r\n\treturn transformS1 == transformS2\r\nend", "def is_anagram(s, t)\n s.chars.sort == t.chars.sort\nend", "def anagram(words)\n words_hash = {}\n\n words_hash = words.each_with_object(Hash.new []) do |word, hash|\n hash[word.chars.sort] += [word]\n end\n\n words_array = words_hash.flatten\n final_hash = []\n\n words_array.each_index do |index|\n final_hash << words_array[index] if index.odd?\n end\n\n return final_hash\nend", "def match(array) #takes in an array of possible anagrams\n anagrams = []\n \n # iterate over array of words\n array.each do |word|\n # compare each word of array to OG word \n # determine if word is anagram\n if word.chars.sort == @word.chars.sort\n anagrams << word\n end\n end\n anagrams #return all matches/ empty array if no matches exist\n end", "def fifth_anagram?(first_word, second_word)\n word_count = Hash.new(0)\n first_word.chars.each { |char| word_count[char] += 1 }\n second_word.chars.each { |char| word_count[char] -= 1 }\n\n word_count.all? {|_, val| val == 0}\nend", "def combine_anagrams(words)\n word_list = Hash.new{|h, k| h[k] = []}\n \n words.each do |word|\n sorted = word.downcase.chars.sort.join\n # if not (word_list.include? sorted and word_list[sorted].include?(word))\n word_list[sorted] << word\n # end\n end\n \n word_list.map { |key,value| value }\nend", "def combine_anagrams (words)\n if(words.length == 0) \n return words\n end\n\n anagram_list = [];\n \n print words\n puts\n\n words = words.flatten\n\n#words = words & words\n\n words.each do |word|\n if(anagram_list.length == 0)\n then\n anagram_list << [word];\n next\n end\n\n sorted_word = word.downcase.scan(/./).sort.join\n\n print sorted_word\n\n# word_exists = anagram_list.flatten.select { |anag| anag =~ /#{word}/ }\n#if (word_exists != nil && word_exists.length == 1)\n#next\n#end\n \n inserted = false\n anagram_list.each_index do |i|\n print \" \" \n print anagram_list[i][0].downcase.scan(/./).sort.join\n print \"\\n\"\n if(anagram_list[i][0].downcase.scan(/./).sort.join == sorted_word)\n then\n anagram_list[i] << word\n inserted = true\n break\n end\n end\n anagram_list << [ word ] unless (inserted)\n end\n return anagram_list;\nend", "def fourth_anagram?(word1, word2) # O(3n) aka O(n)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n return hash.values.all?(&:zero?)\nend", "def is_anagram(s, t)\n return s.chars.sort == t.chars.sort\nend", "def bonus_anagram(str1, str2)\n cool_hash = Hash.new(0)\n str1.chars.each { |ch| cool_hash[ch] += 1 }\n str2.chars.each { |ch| cool_hash[ch] -= 1 }\n \n cool_hash.all? { |k, v| v == 0 }\nend", "def combine_anagrams(words)\n anagrams = Hash.new([])\n for i in 0..(words.length - 1)\n anagram_found = false\n if (i == 0)\n anagrams[words[i]] = []\n end\n for j in 0..(i-1)\n# puts \"Comparing #{words[i]} and #{words[j]}\"\n anagram1 = merge_sort(words[i].downcase)\n anagram2 = merge_sort(words[j].downcase)\n# puts \"#{anagram1} #{anagram2}\"\n if (merge_sort(words[i].downcase) == merge_sort(words[j].downcase))\n# puts \"#{words[i]} and #{words[j]} are the same anagram.\"\n anagrams[words[j]] << words[i]\n anagram_found = true\n #puts \"anagrams: #{anagrams.to_s}\"\n break\n end\n end\n anagrams[words[i]] = [] unless (anagram_found)\n end\n\n # Convert hash to an array.\n anagrams_arr = hash_to_array(anagrams)\n return anagrams_arr\n #return anagrams\nend", "def combine_anagrams(words)\r\n\t\r\n\tresult = []\r\n\twords1 = [];\r\n\twords.each {|w| words1 << w.to_s.downcase.chars.sort.join}\r\n\twords2 = words1.uniq\r\n\t\r\n\tfor i in 0 ... words2.size\r\n\t\tr = []\r\n\t\tw2 = words2[i]\r\n\t\tfor j in 0 ... words.size\r\n\t\t\tw = words[j]\r\n\t\t\tif w2.casecmp(w.to_s.downcase.chars.sort.join) == 0\r\n\t\t\t\tr << w\r\n\t\t\tend\r\n\t\tend\r\n\t\tresult << r\r\n\tend\r\n\t\r\n\treturn result\r\n\t\r\nend", "def combine_anagrams(words)\n groups = Hash.new\n words.each do |word|\n (groups[word.downcase.chars.sort.join] ||= []) << word\n end\n groups.flatten.values_at(* groups.flatten.each_index.select {|i| i.odd?})\nend", "def combine_anagrams(words)\n result = Hash.new\n words.each do |word|\n sw = word.downcase.split(//).sort\n if !result.has_key?(sw)\n result[sw] = Array.new\n end\n result[sw] << word\n end\n result.values\nend", "def third_anagram?(first_word, second_word)\n first_word.chars.sort == second_word.chars.sort\nend", "def check_anagrams(s1, s2)\n return false if s1.length != s2.length\n s1.chars.sort == s2.chars.sort\nend", "def anagrams?\n same_length? && same_letters?\n end" ]
[ "0.81273913", "0.79925317", "0.7935563", "0.7902196", "0.79003805", "0.7887153", "0.78770083", "0.7840942", "0.7840666", "0.7779616", "0.7759835", "0.774859", "0.77033216", "0.77022153", "0.77022153", "0.77022153", "0.769376", "0.769376", "0.76767683", "0.76373047", "0.76237524", "0.75803477", "0.75803477", "0.7577994", "0.7557141", "0.75395083", "0.75364643", "0.7531825", "0.7531532", "0.7499144", "0.7497527", "0.7487246", "0.74823016", "0.7481232", "0.7461666", "0.7457582", "0.744172", "0.7438235", "0.74366224", "0.74267", "0.7413576", "0.7412179", "0.7404505", "0.7388908", "0.7379246", "0.7374011", "0.73654896", "0.7364344", "0.7355958", "0.73533684", "0.7352685", "0.7351767", "0.73470205", "0.7337544", "0.7332306", "0.73259133", "0.7315085", "0.73098606", "0.7307118", "0.7305347", "0.7298037", "0.7289943", "0.72856206", "0.7276976", "0.7270909", "0.7255371", "0.7254473", "0.7251456", "0.7244642", "0.7232047", "0.7229562", "0.72291476", "0.7226959", "0.72265226", "0.721899", "0.7215285", "0.7214211", "0.7212435", "0.7212062", "0.7209243", "0.7209243", "0.7208531", "0.72040176", "0.72017974", "0.72017956", "0.7196057", "0.71902055", "0.7188872", "0.7188516", "0.7188127", "0.71784025", "0.717818", "0.7177639", "0.71743387", "0.71738225", "0.7167894", "0.71610016", "0.7158276", "0.7155537", "0.71555084", "0.7151777" ]
0.0
-1
I worked on this challenge [by myself ]. 2. Pseudocode 3. Initial Solution
def in_words(num) numbers = {0 => "zero", 1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six", 7 => "seven", 8 => "eight", 9 => "nine", 10 => "ten", 11 => "eleven", 12 => "twelve", 13 => "thirteen", 15 => "fifteen", 20 => "twenty", 30 => "thirty", 50 => "fifty"} num_array = num.to_s.split(//).map(&:to_i) case num_array.length when 1 numbers[num_array[0]] when 2 if num_array[1] == 0 if numbers[num].nil? numbers[num_array[0]] + "ty" else numbers[num] end else case num_array[0] when 1 if numbers[num].nil? numbers[num_array[1]] + "teen" else numbers[num] end when 2 numbers[20] + " " + numbers[num_array[1]] when 3 numbers[30] + " " + numbers[num_array[1]] when 5 numbers[50] + " " + numbers[num_array[1]] else numbers[num_array[0]] + "ty " + numbers[num_array[1]] end end else "one hundred" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\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 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 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 solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\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 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)\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 solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\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 solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend", "def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\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 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 isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend", "def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend", "def solution_one\n x = 0\n (1..999).each do |i|\n if (i % 5) == 0 || (i % 3) == 0\n x = x + i\n end\n end\n x\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 challenge; end", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend", "def three_sum(nums)\n nums.sort!\n res = []\n # for each num, find the two constituent targets\n for i in 0..nums.length - 3 do\n next if i > 0 && nums[i] == nums[i - 1]\n\n partial_target = 0 - nums[i]\n j = i + 1\n k = nums.length - 1\n while j < k\n if nums[j] + nums[k] == partial_target\n res.push([nums[i], nums[j], nums[k]])\n j+=1 while j < k && nums[j] == nums[j+1]\n k-=1 while j < k && nums[k] == nums[k-1]\n j+=1\n k-=1\n elsif nums[j] + nums[k] > partial_target\n k-=1 while j < k && nums[k] == nums[k-1]\n k-=1\n else\n j+=1 while j < k && nums[j] == nums[j+1]\n j+=1\n end\n end\n end\n return res\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 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 # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend", "def solution(n)\n sum = 0\n (1...n).each { |num| num % 3 == 0 || num % 5 == 0 ? sum += num : false }\n sum\nend", "def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend", "def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend", "def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend", "def solution(number)\n sum = 0\n for i in 1..number - 1\n if (i % 3 == 0 or i % 5 == 0)\n sum += i\n end\n i += i\n end\n return sum\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\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 input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend", "def solution(a)\n return 1 if a.count == 0\n \n real_sum = a.inject(:+)\n expected_sum = (a.count + 1) * (a.count + 2) / 2.0\n (expected_sum - real_sum).to_i\nend", "def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend", "def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend", "def solution(a)\n numbers = a.sort\n (0..numbers.length-3).each do |index|\n triplet = numbers[index..index + 2]\n max_value = triplet.max\n sum = triplet.min(2).inject(&:+)\n\n return 1 if sum > max_value\n end\n\n 0\nend", "def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend", "def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend", "def solve\n sum = 0\n (1..999).each do |n|\n if n % 3 == 0 or n % 5 == 0\n sum += n\n end\n end\n sum\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\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 solution(number)\n return 0 if number <= 3\n\n sum = 0\n (1..(number - 1)).each do |n|\n if (n % 3 == 0) || (n % 5 == 0)\n sum += n\n end\n end\n\n sum\nend", "def problem1(num)\n (1..num-1).select{|a| a%3 ==0 or a%5==0}.reduce(:+)\nend", "def solution(num)\n (1..num-1).select {|x| x % 3 == 0 || x % 5 == 0 }.inject(:+)\n # inject method is like reduce \n # can take in a range or array of numbers and optionally receive a block\n # passes each element and accumulates each sequentially\nend", "def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend", "def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend", "def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend", "def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend", "def solution2(a)\n\n counts = Hash.new(0)\n\n a.each do |int|\n counts[int] += 1\n end\n\n non_divisors = []\n\n a.each do |int|\n div_count = 0\n for i in 1..int do\n div_count += counts[i] if int % i == 0\n end\n non_divisors << a.length - div_count\n end\n\n non_divisors\n\nend", "def solution(number)\n counter = 3\n sol = 0\n while counter < number\n if (counter % 3 == 0) && (counter % 5 == 0)\n sol += counter\n elsif (counter % 3 == 0) || (counter % 5 == 0)\n sol += counter\n end\n counter += 1\n end\n p sol\nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend", "def solve\n n = 33\n while true\n begin\n n += 2\n end while n.prime?\n\n s, ds = 2, 6\n while s < n && !(n - s).prime?\n s += ds\n ds += 4\n end\n\n break if s >= n\n end\n \n n\n end", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend", "def solution(x, a)\n count = 1\n indices = []\n while count <= x\n indices << a.find_index(count)\n count += 1\n end\n\n if indices.include?(nil)\n -1\n else\n indices.sort.last\n end\nend", "def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend", "def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend", "def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend", "def oddball(arr)\n a, b, c = arr\n if a %2 == b %2\n expected = a %2\n arr.drop(2).each{|n| return n if n != a}\n elsif a%2 == c %2\n return b\n else\n return a\n end\nend", "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 ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def solution(number)\r\n (3...number).each_with_object([]) { |n, arr| arr << n if (n % 3).zero? || (n % 5).zero? }.uniq.sum\r\nend", "def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend", "def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend", "def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend", "def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend", "def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend", "def solution(number)\n(0...number).map{|x| x % 3 == 0 || x % 5 == 0 ? x : 0}.inject{|sum, x| sum + x}\nend", "def solution(number)\n (1..number-1).select{|x| x%3==0 || x%5 ==0 }.reduce(:+)\nend", "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", "def solution(number)\n return (0...number).select{ |x| ((x % 3 == 0) || (x % 5 == 0))}.reduce(:+)\nend", "def recursive_solution\n\n end", "def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\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 solution(n)\n number = 1\n stop = false\n while !stop\n results = []\n (1..n).each do |divider| \n if number % divider != 0\n results << false\n else\n results << true\n end\n end\n if results.count {|x| x == false } > 0\n stop = false\n number += 1\n else \n stop = true\n end \n end\n number\nend", "def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend", "def two_sum(nums)\n special = []\n count = 0\n x = nums.length\n i = 0\n j = 1\n while (i < x) && (i + j) < x\n \n if nums[i] + nums[i + j] == 0\n special[count] = i\n count += 1\n special[count] = i + j\n count += 1\n if i + j + 1 < x\n j = j + 1\n else \n i += 1\n j = 1\n end\n \n elsif nums[i] + nums[i+j] != 0 && (i + j + 1) < x\n j = j + 1\n \n elsif nums[i] + nums[i+j] != 0 && (i + j + 1) >= x && (i + 2) < x\n i += 1\n j = 1\n \n elsif i+2 == x && special.length != 0\n i += 3 \n elsif i+2 == x && special.length == 0\n return nil\n end \n end \n return special\nend", "def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend", "def happy? n\n visited = []\n until n == 1 || visited.include?(n)\n visited << n\n n = n.to_s.chars.map{ |x| x.to_i * x.to_i }.inject{ |sum, x| sum + x }\n end\n n == 1\nend", "def day_2_part_2\n noun = 0\n verb = 0\n\n while noun < 100\n while verb < 100\n if compute(noun, verb) == 19690720\n return (100 * noun) + verb\n end\n verb += 1\n end\n noun += 1\n verb = 0\n end\nend", "def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend", "def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend", "def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend", "def solution(number)\n return 0 if number < 3\n result = 0\n count = 3\n \n until count > number\n if count % 3 == 0 || count % 5 == 0\n result += count \n end\n count += 1\n end\n \n result\nend", "def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes 0!=1 class Quiz\n # find even values\n def solution1(input)\n # Final solution\n input.flatten.select do |value|\n value.even?\n end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.select do |value|\n # value.even?\n # end\n # end.flatten\n end\n\n # find value sum\n def solution2(input)\n # Final Solution\n input.flatten.inject(:+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.flatten.inject do |sum, value|\n # sum += value\n # end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.inject do |sum, value|\n # sum += value\n # end\n # end.inject do |sum, value|\n # sum += value\n # end\n end\n\n # find max value\n def solution3(input)\n # Final solution\n input.flatten.max\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.max\n # end.max\n end\n\n # sum the array lengths\n def solution4(input)\n # Final solution\n input.map(&:length).inject(0, :+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.map(&:length).inject{|sum, value| sum += value}\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.length\n # end.inject {|sum, value| sum += value}\n end\n\n # transform to factorials\n # Factorial is defined as the product of all the whole numbers from 1 to n\n # Examples:\n # 4! = 4*3*2*1\n # 1! = 1\n # 0! = 1\n def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes this work properly for all values (including 0, 1)\n input.map do |ary|\n ary.map do |value|\n (2..value).inject(1, :*)\n end\n end\n\n # First solution\n # Mostly optimized\n # Does 1 more multiplication than needed (mult by 1)\n #\n # input.map do |ary|\n # ary.map do |value|\n # (1..value).inject(1) do |factorial, value|\n # factorial *= value\n # end\n # end\n # end\n end\nend" ]
[ "0.66333103", "0.63587576", "0.63541335", "0.6329571", "0.6275753", "0.62671983", "0.623466", "0.62310106", "0.62255913", "0.62245643", "0.6219843", "0.621371", "0.6173556", "0.6168815", "0.6165275", "0.6163942", "0.6151856", "0.6142871", "0.612441", "0.6119218", "0.60963804", "0.6091807", "0.60876006", "0.6066195", "0.60582286", "0.6039496", "0.60356665", "0.60265523", "0.6001645", "0.59899557", "0.59899455", "0.5989232", "0.5979748", "0.59777564", "0.59741014", "0.5973695", "0.5966549", "0.5948984", "0.5946082", "0.59455305", "0.59394366", "0.59378", "0.593358", "0.5933331", "0.5932889", "0.592436", "0.5916792", "0.59115374", "0.59114146", "0.5911164", "0.59063935", "0.5904875", "0.59038705", "0.5899139", "0.5897036", "0.58916515", "0.58911824", "0.58906114", "0.5888669", "0.5881163", "0.58806086", "0.5878386", "0.5871929", "0.58658266", "0.58618236", "0.5856982", "0.58532035", "0.58519745", "0.5849057", "0.5847365", "0.5842571", "0.5841214", "0.5840701", "0.5837337", "0.58339006", "0.58304244", "0.5830066", "0.5821517", "0.5813756", "0.5810211", "0.58075345", "0.58046025", "0.57911325", "0.5788718", "0.57853454", "0.5784871", "0.5783829", "0.5782726", "0.5782051", "0.57796645", "0.57790846", "0.57783824", "0.5776958", "0.5776843", "0.5776821", "0.577589", "0.57756567", "0.5773277", "0.5773272", "0.5771994", "0.57718164" ]
0.0
-1
Register a record with the current transaction so that its after_commit and after_rollback callbacks can be called.
def add_transaction_record(record) current_transaction.add_record(record) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_transaction(*)\n @connection.add_transaction_record(self)\n end", "def after_commit(&blk)\n ActiveRecord::Base.connection.add_transaction_record(\n AfterCommitWrapper.new(&blk)\n )\n end", "def register_tx(data)\n transaction(:raw_register, data)\n end", "def insert_record(record, validate = true, raise = false, &block)\n if raise\n record.save!(validate: validate, &block)\n else\n record.save(validate: validate, &block)\n end\n end", "def save_record(record)\n record.save\n end", "def save_record(record)\n record.save\n end", "def after_create_save(record); end", "def with_transaction\n ActiveRecord::Base.transaction { yield }\n end", "def save\n @connection.transactions.save\n end", "def commit_db_transaction\n @transaction = @connection.commit\n end", "def save\n record = self\n @table.instance_eval { save(record) }\n end", "def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end", "def with_transaction(&block)\n base_model.transaction(&block)\n end", "def save\n\t\t@connection.transactions.save\n\tend", "def transaction(&block)\n yield\n commit\n end", "def transaction(&block)\n ActiveRecord::Base.transaction(&block)\n end", "def begin_db_transaction() end", "def begin_db_transaction() end", "def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end", "def on_prepare_transaction_commit(unit, transaction); end", "def within_transaction(object); end", "def add_transaction\n\t\t\t@@transactions << self\n\t\tend", "def transaction; end", "def transaction; end", "def transaction; end", "def add_transaction(t)\n @transactions << t\n end", "def record_transaction\n if self.save\n return true\n else\n return false\n end \n end", "def create_record(init)\n subject.transaction(requires_new: true) do\n InternalId.create!(\n **scope,\n usage: usage_value,\n last_value: init.call(subject) || 0\n )\n end\n rescue ActiveRecord::RecordNotUnique\n lookup\n end", "def within_transaction; end", "def within_transaction; end", "def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end", "def commit_db_transaction() end", "def commit_db_transaction() end", "def _create_record(&block)\n attributes_values = changes.map{|k, v| [k.to_sym, v.last]}.to_h\n attributes_values.delete(:Id)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id ||= new_id if self.class.primary_key\n\n @new_record = false\n\n yield(self) if block_given?\n\n id\n end", "def register!\n raise 'User is already registered!' if registered_at.present?\n self.registered_at = Time.now\n save!\n end", "def save_record\n if !saved_already?\n if valid?\n run_sql(\"INSERT INTO #{table} (#{string_field_names}) VALUES (#{stringify_self});\")\n @id = CONNECTION.last_insert_row_id\n else\n false\n end\n else\n update_record\n end\n end", "def commit( defer=false )\n save_logic( defer, false )\n end", "def add_transaction(transaction)\n transactions.push transaction\n end", "def after_commit(unit); end", "def commit\n @handle.commit\n super\n end", "def set_new_record(record)\n replace(record)\n end", "def transaction(options={}, &block)\n connection.transaction(options.update(:requires_new => true), &block)\n end", "def transaction\n @database.transaction { yield self }\n end", "def add_transaction_detail_record(record)\n raise InvalidTypeError, \"Expected record of type TransactionDetailRecord\" unless record.is_a?(TransactionDetailRecord) \n @transaction_detail_records << record\n end", "def commit_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n if supports_releasing_savepoints?\n log_connection_yield('Transaction.release_savepoint', conn){conn.release_savepoint(savepoint_obj(conn))}\n end\n else\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end\n end", "def before_create_save(record); end", "def write(record)\n @worker.enqueue record\n end", "def save!\n create_or_update or raise RecordNotSaved\n end", "def record(record)\n @db.save_doc(record)\n end", "def create_or_update_with_transaction\n Assessment.transaction do\n create_or_update_without_transaction\n end\n end", "def transaction\n start\n yield self\n rescue Object => ex\n rollback\n debug \"#{ex.class}: #{ex.message}\"\n ex.backtrace.each { |line| debug line }\n else\n commit\n end", "def transaction(&block)\n @in_transaction += 1\n begin\n yield self\n self.commit if @in_transaction > 0\n rescue => e\n self.rollback\n raise e\n ensure\n @in_transaction -= 1 unless @in_transaction == 0\n end\n end", "def commit()\n @conn.commit if @conn\n Log.i(\"#{@count} new bookings added\")\n end", "def add_to_register(register, user)\n self.register = register\n unless created_by\n self.created_by = user\n self.created_at = Time.now\n end\n save\n end", "def register(context = :registration)\n x = save(:context => context)\n run_callbacks(:register) { notify_observers :after_register }\n p self.errors unless x\n x\n end", "def begin\n db.transaction do\n yield\n end\n end", "def register(id)\n cached(id) do\n raise \"No fixture named #{id} has been registered\" unless block_given?\n\n ActiveSupport::Notifications.subscribed(method(:subscriber), \"sql.active_record\") do\n yield\n end\n end\n end", "def commit( transaction )\n fail NotImplementedError\n end", "def subscribe_record(record)\n return unless session.id\n Hyperloop.redis_instance.hset \"HRPS__#{record.class}__#{record.id}\", session.id.to_s, Time.now.to_f.to_s\n end", "def did_create\n @new_record = false\n self.class.identity_map[self.id] = self\n self.class.all.push self\n\n trigger_events(:create)\n end", "def transaction(&block); end", "def begin_db_transaction\n log('BEGIN', 'TRANSACTION') { @connection.begin }\n end", "def add_record(record)\n return unless @if_proc.call(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end", "def transaction(&block)\n block.call\n end", "def commit_transaction(conn)\n log_info(TRANSACTION_COMMIT)\n conn.commit\n end", "def begin_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n _trans(conn)[:savepoints][-1][:obj] = log_connection_yield('Transaction.savepoint', conn){conn.set_savepoint}\n else\n log_connection_yield('Transaction.begin', conn){conn.setAutoCommit(false)}\n set_transaction_isolation(conn, opts)\n end\n end", "def start_transaction!\n fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction\n @in_transaction = true\n\n query 'BEGIN'\n end", "def add_transaction(transaction)\n transactions << transaction\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 store(event,&callback_block)\n case event\n when :commit then @on_commit << callback_block\n when :rollback then @on_rollback << callback_block\n else raise \"unknown event #{event.inspect}\"\n end\n end", "def set_transaction_record\n @transaction_record = TransactionRecord.find(params[:id])\n end", "def set_transaction_record\n @transaction_record = TransactionRecord.find(params[:id])\n end", "def push_record(record)\n params = TogglRecord.new(record, config).push\n record[:id]\n end", "def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end", "def begin_db_transaction\n @connection.autocommit = false\n end", "def commit(transaction)\n raise NotImplementedError\n end", "def transaction(&blk)\n tap(&blk)\n end", "def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end", "def adjust_after_create\n # The record is in @record, do what you will, this precedes a save.\n end", "def commit\n\t\t\t if valid?\n\t\t\t\t\tcallback_process = setup(klass)\n\t\t\t\t\tklass.send(event, callback_process)\n\t\t\t\t\tklass\n\t\t\t else\n\t\t\t\t\tInnsights::ErrorMessage.log(\"#{klass} doesn't respond to callback event #{event}\")\n\t\t\t end\n\t\t\tend", "def store_invalid_record(record)\n return unless InvalidRecord.table_exists?\n\n invalid_record = InvalidRecord.where(record: record).first\n invalid_record ||= InvalidRecord.new\n invalid_record.record = record\n invalid_record.validation_errors = record.errors.messages\n invalid_record.save!\n end", "def commit()\n check_return_code(PureHailDB.ib_trx_commit(@trx_ptr))\n end", "def add_transaction(act_txn)\n @transactions << act_txn\n end", "def transaction(mode = :deferred, &block)\n @db.transaction(mode, &block)\n end", "def commit()\n #This is a stub, used for indexing\n end", "def commit\n @db.commit\n end", "def commit_db_transaction\n log('COMMIT', 'TRANSACTION') { @connection.commit }\n end", "def enqueue(record)\n @queue << record.representation\n end", "def after_create(record)\n return unless @playground.collecting?\n\n count = @ar_column ? (record.send(@ar_column) || 0) : 1\n\n identity = begin\n Vanity.context.vanity_identity\n rescue StandardError\n nil\n end\n identity ||= (@ar_identity_block.call(record) if @ar_identity_block)\n\n call_hooks record.send(@ar_timestamp), identity, [count] if count > 0 && @ar_scoped.exists?(record.id)\n end", "def add_record(name, record)\n klass_map = self.object_map[self.models[record.class]]\n\n # Panic if attempted to insert duplicate fixture record.\n if klass_map.include?(name.to_sym)\n raise \"Duplicate fixture for #{record.class} - #{name}\"\n end\n\n self.fixture_name_map[record] = name.to_s\n klass_map[name.to_sym] = record\n dot\n\n return record\n end", "def save\n result = nil\n if valid?\n self.record = attempted_record\n\n run_callbacks :before_save\n run_callbacks(new_session? ? :before_create : :before_update)\n run_callbacks(new_session? ? :after_create : :after_update)\n run_callbacks :after_save\n\n save_record\n self.new_session = false\n result = true\n else\n result = false\n end\n\n yield result if block_given?\n result\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def commit_transaction(tx)\n tx.execute\n end", "def transaction(object)\n object.db.transaction {raise ::Sequel::Error::Rollback unless yield}\n end", "def after_create(record)\n contents = to_sql_insert(record)\n to_logfile(contents)\n # Send a notification to the admin, if requested:\n if @email_on_create\n AgexMailer.action_notify_mail(\n record.respond_to?(:user) ? record.user : nil,\n \"#{@table_name} row CREATED\",\n contents\n ).deliver\n end\n end", "def push_new_record(record)\n handle_couch_response do\n RestClient.post(local_couch_database_url, record, content_type: :json)\n end\n end", "def commit; end", "def commit; end", "def commit; end" ]
[ "0.67611736", "0.6569975", "0.580643", "0.5750828", "0.572886", "0.572886", "0.56294", "0.5553481", "0.5507917", "0.5484063", "0.5471472", "0.5470923", "0.5438455", "0.54281294", "0.5419102", "0.5401728", "0.53990597", "0.53990597", "0.5393163", "0.5388992", "0.5381024", "0.537869", "0.5364166", "0.5364166", "0.5364166", "0.5359979", "0.53520745", "0.5333391", "0.5318554", "0.5318554", "0.53055274", "0.52987075", "0.52987075", "0.5292442", "0.5290458", "0.52858496", "0.52847904", "0.52804613", "0.5279296", "0.5275059", "0.5270452", "0.52616525", "0.52451664", "0.52352345", "0.52349746", "0.522942", "0.5229027", "0.52229625", "0.5215612", "0.5214304", "0.5209821", "0.5206466", "0.52017426", "0.51851577", "0.51815593", "0.51807296", "0.5177668", "0.51704806", "0.51526535", "0.5152463", "0.51520365", "0.513207", "0.51259047", "0.51237464", "0.5122287", "0.5115705", "0.5112979", "0.51123434", "0.5112336", "0.5111036", "0.5109189", "0.5109189", "0.5109152", "0.5096958", "0.5093423", "0.50919056", "0.508947", "0.50821185", "0.5074004", "0.5065906", "0.5065284", "0.5063201", "0.50621015", "0.50498015", "0.5047414", "0.5041998", "0.5039863", "0.5037604", "0.5034283", "0.50300026", "0.50267804", "0.5024078", "0.5024078", "0.5023427", "0.5009673", "0.5002511", "0.5001823", "0.5001472", "0.5001472", "0.5001472" ]
0.7074739
0
via method_missing affected_rows will be recognized as async method
def affected_rows(*args, &blk) execute(false) do |conn| conn.send(:affected_rows, *args, &blk) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affected_rows()\n #This is a stub, used for indexing\n end", "def async_result()\n #This is a stub, used for indexing\n end", "def fetch_rows(sql, &block)\n raise NotImplementedError, NOTIMPL_MSG\n end", "def handle_failed_rows?\n false\n end", "def affected_rows\n @connection.gathered_data[:affected_rows]\n end", "def _update_without_checking(columns)\n ds = _update_dataset\n lc = model.lock_column\n rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns))).all\n values[lc] = rows.first[lc] unless rows.empty?\n rows.length\n end", "def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.async_exec(sql)}\n\t\t\t\tend", "def update(*)\n unavailable_method\n end", "def synchronize_resultset; end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def execute_query(sql, args)\n @db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}\n end", "def method_missing(*args)\n @row.send(*args)\n end", "def execute_non_query(*args)\n raise NotImplementedError.new\n end", "def async(th)\n @eff.async.perform th\n end", "def method_missing(method, *args, &block)\n @client.execute(@path, method, args)\n end", "def affected\n IBM_DB.num_rows(@stmt)\n end", "def method_missing_with_async (method, *args, &block)\n method = method.to_s\n if method[0, 6] == 'async_'\n method = method.to_s\n called_method = method[6 , method.length]\n if Thread.critical\n return send(called_method, *args, &block)\n else\n return Proxy.new(self, called_method, args, &block)\n end\n else\n # Keep track of the current missing method calls to keep out of an infinite loop\n stack = Thread.current[:async_method_missing_methods] ||= []\n sig = MethodSignature.new(self, method)\n raise NoMethodError.new(\"undefined method `#{method}' for #{self.inspect}\") if stack.include?(sig)\n begin\n stack.push(sig)\n return method_missing_without_async(method, *args, &block)\n rescue Exception => e\n # Strip this method from the stack trace as it adds confusion\n e.backtrace.reject!{|line| line.include?(__FILE__)}\n raise e\n ensure\n stack.pop\n end\n end\n end", "def _update(*)\n fail NotImplementedError\n end", "def execute\n raise NotImplemented\n end", "def update_sql(sql, name = nil) #:nodoc:\n super\n self.affected_rows\n end", "def update(*)\n unavailable_method\n end", "def update(*)\n unavailable_method\n end", "def update(*)\n unavailable_method\n end", "def _refresh_get(ds)\n # SEQUEL5: Remove\n if use_prepared_statements_for?(:refresh)\n _set_prepared_statement_server(model.send(:prepared_refresh)).call(pk_hash)\n else\n super\n end\n end", "def process_row\n # overwrite this class\n end", "def prefetch_rows\n raise NoMethodError, \"Not implemented for this raw driver\"\n end", "def _update(columns)\n n = _update_without_checking(columns)\n raise(NoExistingObject, \"Attempt to update object did not result in a single row modification (SQL: #{_update_dataset.update_sql(columns)})\") if require_modification && n != 1\n n\n end", "def _update(columns)\n n = _update_without_checking(columns)\n raise(NoExistingObject, \"Attempt to update object did not result in a single row modification (SQL: #{_update_dataset.update_sql(columns)})\") if require_modification && n != 1\n n\n end", "def execute(*)\n super\n end", "def async_count(column_name = nil)\n async.count(column_name)\n end", "def run_bulk; end", "def execute\n fail NotImplementedError\n end", "def sql_update(sql)\n exec(sql)\n # return affected rows.\n end", "def execute\n raise NotImplementedError\n end", "def each_row\n end", "def execute!; end", "def delete\n execute_dui(delete_sql){|c| return c.affected_rows}\n end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def execute; end", "def execute; end", "def dynamodb_execute\n begin\n yield\n rescue => error\n return error\n end\n end", "def _update_without_checking(columns)\n if use_prepared_statements_for?(:update)\n _set_prepared_statement_server(model.send(:prepared_update, columns.keys)).call(Hash[columns].merge!(pk_hash))\n else\n super\n end\n end", "def asynchronous?() false end", "def call\n execute(*self.class.executes, abort_on_failure: true)\n end", "def _update_record(attribute_names = self.attribute_names)\n attribute_names = attributes_for_update(attribute_names)\n\n if attribute_names.empty?\n affected_rows = 0\n @_trigger_update_callback = true\n else\n affected_rows = _update_row(attribute_names)\n @_trigger_update_callback = affected_rows == 1\n end\n\n @previously_new_record = false\n\n yield(self) if block_given?\n\n affected_rows\n end", "def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end", "def processed_rows\n edited_rows_count + created_rows_count\n end", "def disable_insert_returning\n clone(:disable_insert_returning=>true)\n end", "def method_missing(name, *args, &block)\n super unless respond_to_missing?(name)\n _update_query(name, *args, &block)\n end", "def call(_rc)\n raise NotImplementedError\n end", "def handle_insert action, result; end", "def execute!\n raise 'Override this method'\n end", "def on_upsert\n #\n end", "def execute\n raise NotImplementedError\n end", "def index_corruption?; end", "def execute\n return performModify(true)\n end", "def update_sql(sql, name = nil)\n result = super\n result.length == 0 ? 0 : result.rows[0][0]\n end", "def to_i\n @affected_rows\n end", "def end_row\n @block.call(@current_row)\n @rows_loaded += 1\n end", "def execute()\n\n end", "def execute()\n\n end", "def affected_rows(conn)\n s = conn.info\n if s && s =~ /Rows matched:\\s+(\\d+)\\s+Changed:\\s+\\d+\\s+Warnings:\\s+\\d+/\n $1.to_i\n else\n conn.affected_rows\n end\n end", "def is_async_on_grid_obj?\n grid_operation? and sons.any? { |s| s.name.start_with? \"async\" } and not name.start_with? \"get_result\"\n end", "def update\n unavailable_method\n end", "def async_sum(identity_or_column = nil)\n async.sum(identity_or_column)\n end", "def async_lookup(args)\n unless (Hash === args)\n args = primary_key_hash(args)\n end\n\n dataset.where(args).limit(1).async_all do |rows|\n yield(rows.any? ? rows.first : nil)\n end\n\n return\n end", "def send_async(method, *arguments); end", "def execute_if_updated\n if updated?\n execute\n true\n else\n false\n end\n end", "def update\n throw :not_implemented\n end", "def method_missing(meth, *args, &block)\n read_only = (meth == :[])\n\n @db.transaction(read_only) do\n @db.send(meth, *args, &block)\n end\n end", "def after_row(&block)\n @after_row_handler = block\n end", "def _fetch(*)\n fail NotImplementedError\n end", "def execute\n # First, execute the SQL, applying the valid after_filters\n ret = apply_after_filters(execute_sql)\n\n # Set changed property to true\n changed\n\n # Notify all observers of the ids of the current result\n # set\n notify_observers(\n ret.collect{|instance| instance.send(model.primary_key)},\n self\n )\n\n # Reset the Query\n reset!\n\n # Return the results\n ret\n end", "def execute(sql, *args, &block)\n @db.log_yield(sql){super}\n rescue SwiftError => e\n @db.send(:raise_error, e)\n end", "def after_process_record (row: , result: , batch_id: )\n get_batch_params batch_id\n REDIS_BATCHES.rpush(@batch_success, row.to_json) if result == 'success'\n REDIS_BATCHES.rpush(@batch_error, row.to_json) if result == 'error'\n REDIS_BATCHES.decr(@batch_counter)\n after_complete_batch unless REDIS_BATCHES.get(@batch_counter).to_i > 0\n rescue => e\n Rails.logger.error \"#{self.name}.#{__method__} - #{e}\"\n end", "def log_row(row)\n #overwrite this class\n end", "def async_lookup args\n unless Hash === args\n args = primary_key_hash(args)\n end\n\n dataset.where(args).limit(1).async_all{ |rows|\n if rows.any?\n yield rows.first\n else\n yield nil\n end\n }\n nil\n end", "def update\n fail NotImplementedError\n end", "def execute(sql, name = 'SQL')\n log(sql, name) do\n @connection.async_exec(sql)\n end\n end", "def _update_record(*args, &block)\n attributes_values = changes.map{|k, v| [k.to_sym, v.last]}.to_h\n\n if attributes_values.empty?\n rows_affected = 0\n else\n rows_affected = self.class.unscoped._update_record attributes_values, id, id_was\n end\n\n yield(self) if block_given?\n\n rows_affected\n end", "def execute_update(op_row)\n if op_row.class.exists?(op_row.id)\n op_row.update\n else\n # for some reason the row doesn't exist, so we forcefully create it\n # TIP: if the record failed to be created the first time, we can simply\n # update it in the original source and it will be broadcasted again\n return execute_create(op_row)\n end\n return { op_row.id => op_row.errors.full_messages } if op_row.errors.count > 0\n nil\n rescue => e\n { :error => \"Record not found or Class cast failed. Updating #{op_row.class} - #{e.inspect} - #{op_row.to_yaml}\"}\n end", "def call!\n rows.map.with_index do |row, row_num|\n process_entities(row, row_num, &:call!)\n end\n end", "def execute\n raise NotImplementedError.new('Must override')\n end", "def connection_execute_method\n :query\n end", "def connection_execute_method\n :query\n end", "def _import(columns, values, opts=OPTS)\n if @opts[:returning]\n # no transaction: our multi_insert_sql_strategy should guarantee\n # that there's only ever a single statement.\n sql = multi_insert_sql(columns, values)[0]\n returning_fetch_rows(sql).map{|v| v.length == 1 ? v.values.first : v}\n elsif opts[:return] == :primary_key\n returning(insert_pk)._import(columns, values, opts)\n else\n super\n end\n end", "def with_sql_each(sql)\n if row_proc\n super(sql) do |obj|\n obj.forbid_lazy_load if obj.is_a?(InstanceMethods)\n yield obj\n end\n else\n super\n end\n end", "def changes\n @database.affected_rows\n end", "def execute_update!( activerecord_class )\n collector = @row_collectors[ activerecord_class.table_name ]\n process_text_log << \"Updating #{ activerecord_class.name }...\\r\\n\"\n sql_diff_text_log << \"\\r\\n-- Updates for #{ activerecord_class.name }:\\r\\n\"\n is_ok = true\n begin\n collector.non_duplicates_rows.each do |row|\n sql_attributes = {}\n if row.respond_to?(:swimmer_id) # Correct the swimmer_id link:\n row.swimmer_id = @master_swimmer.id\n sql_attributes['swimmer_id'] = @master_swimmer.id\n end\n # Correct the badge link, when included in the matrix:\n if row.respond_to?(:badge_id) && @dup_badge_matrix_ids.has_key?( row.badge_id )\n row.badge_id = @dup_badge_matrix_ids[ row.badge_id ]\n sql_attributes['badge_id'] = row.badge_id\n end\n\n if row.invalid? # Check validation:\n msg = \"\\r\\n\\r\\n-- *** Swimmer Merge: validation ERROR during #{ row.class.name } update!\\r\\n\" <<\n \"- row..............: #{ row.inspect }\\r\\n\" <<\n \"- sql_attributes...: #{ sql_attributes.inspect }\\r\\n\" <<\n \"\\r\\n- ERROR............: #{ ValidationErrorTools.recursive_error_for( row ) }\\r\\n\"\n# DEBUG\n puts msg\n process_text_log << msg\n end\n row.save!\n # Build-up SQL-diff:\n if sql_attributes.size > 0 # (false = no additional comment)\n sql_diff_text_log << to_sql_update( row, false, sql_attributes, \"\\r\\n\" )\n end\n end\n rescue\n process_text_log << \"\\r\\n\\r\\n*** Swimmer Merge: exception caught!\\r\\n\"\n process_text_log << \"*** Phase '#{ activerecord_class.name } UPDATE': #{ $!.to_s }\\r\\n\" if $!\n process_text_log << sql_diff_text_log\n is_ok = false\n end\n is_ok\n end", "def row(index)\n end", "def sql_with_returning(sql)\n table_ref = extract_table_ref_from_update_sql(sql)\n\n returning_columns = quote_returning_column_names(table_ref, nil, :update)\n\n return sql if returning_columns.blank?\n\n \"#{sql} RETURNING #{returning_columns.join(', ')}\"\n end", "def execute\n super()\n end", "def execute(original_row, updated_row, target)\n with_reporting(updated_row, target) do\n target.instance_exec(original_row, updated_row, &rule_code)\n end\n end", "def execute(&block)\n block # needs .call method here\nend", "def handle_row(business, row)\n\n end", "def execute_sql(crud_operation, model, should_retry=true, &sql_code)\n benchmark_db(crud_operation, model, &sql_code)\n rescue Sequel::DatabaseConnectionError, Sequel::DatabaseDisconnectError\n if should_retry\n execute_sql(crud_operation, model, false, &sql_code)\n else\n raise\n end\n end", "def db_rest_call(method, *args)\n begin\n return @db_rest.send method, *args\n rescue\n self.connected = false\n return nil\n end\n end", "def rows\n fail \"Implement #{self.class}#rows\"\n end", "def async_send(*args)\n meth = args.shift\n beanstalk = args.last.delete(:beanstalk) if args.last.is_a?(::Hash)\n\n Quebert.deprecate \"#async_send should be called via #{self.class.name}.async(#{beanstalk.inspect}).#{args.first}(#{args.map(&:inspect).join(', ')})\" do\n async(beanstalk || {}).send(meth, *args)\n end\n end", "def execute\n end" ]
[ "0.64348996", "0.61740804", "0.5846042", "0.5780616", "0.5659261", "0.5419465", "0.5415686", "0.5348129", "0.53349715", "0.5325317", "0.53207904", "0.5309817", "0.52947897", "0.52862483", "0.5277573", "0.5272878", "0.52659684", "0.52436966", "0.5200909", "0.519614", "0.51914096", "0.51914096", "0.51914096", "0.51900697", "0.51503474", "0.5111741", "0.50981367", "0.50981367", "0.5082512", "0.50733334", "0.5072292", "0.50672907", "0.5062191", "0.5061855", "0.505761", "0.50574976", "0.50483906", "0.5034765", "0.50249046", "0.50249046", "0.5016046", "0.5001899", "0.5000271", "0.49986693", "0.49965692", "0.49891886", "0.4984963", "0.49842632", "0.49809217", "0.49724418", "0.49651796", "0.49335456", "0.49276626", "0.49243245", "0.49120677", "0.49084216", "0.49018523", "0.48968065", "0.48956025", "0.4893333", "0.4893333", "0.48922503", "0.4871299", "0.486927", "0.48666012", "0.48658466", "0.48597908", "0.48524982", "0.48498535", "0.4840851", "0.48346704", "0.48301196", "0.48299018", "0.48236427", "0.48156247", "0.481323", "0.48128164", "0.48024383", "0.47971943", "0.47969007", "0.47904098", "0.47882822", "0.47865817", "0.4785025", "0.4785025", "0.47850206", "0.47798756", "0.47758284", "0.47749746", "0.47746292", "0.4770122", "0.47661135", "0.4765156", "0.47627074", "0.47597235", "0.47586548", "0.47571728", "0.47465777", "0.47447008", "0.47413403" ]
0.5835859
3
TODO make more elaborate self.description = '...'
def run license_key = read_license_key email = guess_email_address # Collect details about the environment. osx_vers = `/usr/bin/sw_vers -productVersion`.strip if defined?(Pre::Motion::Version) rm_vers = "#{Motion::Version} (stable), #{Pre::Motion::Version} (pre-release)" else rm_vers = Motion::Version end xcode_vers = begin xcodebuild = `which xcodebuild`.strip xcodebuild = '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild' if xcodebuild.empty? vers = '' if File.exist?(xcodebuild) vers = `#{xcodebuild} -version`.strip.scan(/Xcode\s(.+)$/).flatten[0].to_s end vers = 'unknown' if vers.empty? vers end environment = URI.escape("OSX #{osx_vers}, RubyMotion #{rm_vers}, Xcode #{xcode_vers}") system("open \"https://secure.rubymotion.com/new_support_ticket?license_key=#{license_key}&email=#{email}&environment=#{environment}\"") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description\n super || \"\"\n end", "def description\n description = \"\"\n end", "def description\n @description = \"Espresso\"\n end", "def description\n super + \", Soy\"\n end", "def description\n super + \", Whip\"\n end", "def description\n end", "def base_description(_); end", "def set_description\n\t\t@description = \"Sales by Rails\"\n\tend", "def description\n @description = \"Dark Roast Coffee\"\n end", "def description=(val)\n self[:description] = val\n end", "def description\n \"\"\n end", "def description\n ''\n end", "def description\n \"#{super} - CocaCola\"\n end", "def description\n end", "def description\n end", "def desc( description )\n @description = description\n end", "def initialize\n super(TITLE, DESCRIPTION, true)\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n self[:description]\n end", "def setDescription(description)\r\n\t\t\t\t\t@description = description\r\n\t\t\t\tend", "def setDescription(description)\r\n\t\t\t\t\t@description = description\r\n\t\t\t\tend", "def description=(description)\n end", "def description\n @description = \"House Blend Coffee\"\n end", "def description\n override_desc || self.to_s\n end", "def main_description; end", "def setDescription(description)\n @description = description.to_s\n end", "def full_description\n \"#{self.class.description} #{self.description}\"\n end", "def description\n super + \", Milk\"\n end", "def description; attributes[:description] || attributes[:desc] end", "def description\n \"#{super} - Tramezzino\"\n end", "def description=(value)\n super(\"value\" => value)\n end", "def description=(value)\n super(\"value\" => value)\n end", "def description\n\t\t\treturn @description || self.generate_description\n\t\tend", "def description\n nil\n end", "def description\n nil\n end", "def set_description\n self.description = \"#{self.manufacturer.code} #{self.manufacturer_model}\" unless self.manufacturer.nil?\n end", "def describe(name)\n super\n end", "def set_description(description)\n @description = description\n end", "def desc; end", "def description=(str)\n @description = str\n end", "def desc=(_); end", "def description\n return @description\n end", "def description\n nil\n end", "def description\n self[:description] || name\n end", "def desc\n Desc.new(self)\n end", "def initialize(description)\n\t\t@description = description.delete(\"\\n\") #remove the end of line\n\tend", "def description=(v)\n @description = v\n end", "def description; @text; end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def initialize\n super\n\n @name = UNSET\n @description = UNSET\n end", "def desc\n\tend", "def desc\n\tend", "def description= desc\n super(Rails::Html::FullSanitizer.new.sanitize(desc))\n end", "def description=(_arg0); end", "def description=(_arg0); end", "def description=(_arg0); end", "def description\n read_attribute(:description).presence || self.original_description\n end", "def description\n raise \"not implemented\"\n end", "def description(str)\n @description = str\n end", "def description\n \"testing\"\n end", "def description\n \"testing\"\n end", "def description_name\n !self.description.blank? ? self.description : NOT_SET\n end" ]
[ "0.76804006", "0.76804006", "0.76804006", "0.76804006", "0.76804006", "0.76804006", "0.76804006", "0.76804006", "0.76804006", "0.76804006", "0.76240027", "0.7601409", "0.7576711", "0.7501892", "0.7395768", "0.7370072", "0.7355383", "0.7317543", "0.7303333", "0.7302497", "0.729456", "0.72850966", "0.7266612", "0.7257405", "0.7257405", "0.72419935", "0.7237823", "0.723222", "0.723222", "0.723222", "0.723222", "0.72160053", "0.7208195", "0.7208195", "0.7168225", "0.7150663", "0.7144486", "0.7135741", "0.70854646", "0.7078737", "0.70585567", "0.7050262", "0.7049931", "0.70404464", "0.70404464", "0.70383984", "0.7035956", "0.7035956", "0.70357096", "0.7033315", "0.7029202", "0.7006998", "0.6988928", "0.69889134", "0.6977417", "0.69583017", "0.69493705", "0.69443", "0.6931214", "0.6930569", "0.6892327", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6879344", "0.6877164", "0.6855594", "0.6855594", "0.6846579", "0.68183124", "0.68183124", "0.68183124", "0.6804706", "0.68026066", "0.67939204", "0.679347", "0.679347", "0.6787456" ]
0.0
-1
Validate and submit the request
def submit! raise InvalidRequest.new(self) unless valid? command.call(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend", "def submit; end", "def perform\n validate_data_from_requests\n end", "def request \n\t\t\tif self.valid?\n\t\t\t\tpath = \"/#{Base.config.api_path}/#{self.request_action}\"\n\t\t\t\tconnection.post(path, self.to_xml).tap do |response|\n\t\t\t\t\treturn handle_response(response)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend", "def submit\n\t\tif save\n\t\t\tsubmit_request\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end", "def submit\r\n assert_exists\r\n submit_form \r\n @o.wait\r\n end", "def submits; end", "def submit\n end", "def submit\r\n @sess.DoRequests(@request_set)\r\n end", "def validate_request(call)\n call.validate_request\n end", "def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end", "def submit!\n\tend", "def validate_request!\n validate_accounts_presence!\n validate_account_funds!\n\n transaction_create_model.validate!\n end", "def execute!\n validate_request!\n\n build_response!\n end", "def POST; end", "def submit\n\t\t# puts params.inspect\n\n\n\t\tif params[:authenticity_token].present?\n\t\t\tputs \"here\"\n\t\t\t# submit hit\n\t\t\tsubmission_result = validation_submission(params)\n\t\t\tputs submission_result \n\t\t\t# puts submission_result.class \n\t\t\t# Test passed... Need more test\n\n\t\t\tif submission_result.class == Hash\n\t\t\t\t# submit_sequence_caller_for_aa_nt will save success and new to database automatically\n\t\t\t\t# uploading_result is for showing the status for user\n\t\t\t\tuploading_result = submit_sequence_caller_for_aa_nt(submission_result[\"aa\"],submission_result[\"nt\"], params[:uploader_name],params[:uploader_email])\n\n\t\t\t\trender json: { \"result\": uploading_result }\n\n\t\t\telsif submission_result.class == Array\n\t\t\t\t# there are errors\n\t\t\t\trender json: { \"errors\": submission_result }\n\t\t\tend\n\t\t\n\t\tend\n\n\tend", "def validate_order() \n\tputs \"Validating order\" \n\tdata = create_order()\n\tresponse = request_post(\"/api/order/validate\", data)\n\tputs response.body\nend", "def perform!\n options_key = request_method == :get ? :query : :form\n resp = self.class.public_send(request_method, uri.to_s,{ options_key => options })\n Response.new(api_key, resp.code, resp.body, resp.parsed_response,\n resp.headers).validate!\n end", "def validates?\n # include the params to validate our request\n request_params = denormalize params.merge({\n :Comando => \"validar\",\n :Token => @token || PagSeguro.config[\"authenticity_token\"]\n }).dup\n\n return true if PagSeguro.developer?\n\n # do the request\n uri = URI.parse(API_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.path)\n request.set_form_data request_params\n response = http.start {|r| r.request request }\n (response.body =~ /VERIFICADO/) != nil\n end", "def submit\n # validate_line_items\n Wheretocard::Response.from_order_request(self)\n end", "def validate(params)\n Request.new(params).validate(params)\n end", "def valid_params_request?; end", "def validrequest?(req)\n @stats.validated\n return true\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def validate!\n @ddl.validate_rpc_request(@action, @data)\n end", "def validate_request \n\t\tval_required='required'\n\t\tdata_val_required='data_required'\n\t\tuser_id=\"\";\n\t\tclient_id=\"\";\n\t\tsession_id=\"\";\n\t\t\n\t\tif(cookies[:user_id])\n\t\t\tuser_id= cookies[:user_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:client_id])\n\t\t\tclient_id= cookies[:client_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:session_id])\n\t\t\tsession_id= cookies[:session_id].to_s\n\t\tend\n\t\t\n\t\tif client_id.empty? == true || session_id.empty? == true\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\n\t\t\n\t\t@client=Client.where(pk_client_id: client_id)\t\t\n\t\tif (@client.count<=0)\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\t\t\t\n\t\t\n\t\t@device_users=DeviceUser.where(fk_client_id: client_id, pk_user_id: user_id, sessionid: session_id) \n\t\t\n\t\tif (@device_users.count<=0)\t\n\t\t\tlogger.debug \"device_users not found for client_id=\" + client_id+ \" and session_id=\" + session_id + \" \"\n\t\t\tcoockies_render_error('e1012',params[:response_type].to_s) \n\t\t\treturn false\n\t\telse\n\t\t\tif @device_users[0][:status_code] == 403\n\t\t\t\tcoockies_render_error('e2203',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\tif @device_users[0][:status_code] == 402\n\t\t\t\tcoockies_render_error('e2204',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\n\t\tparams[:user_id]=user_id\n\t\tparams[:client_id]=client_id\n\t\tparams[:session_id]=session_id\n\t\t\n\t\treturn true\n\tend", "def post; end", "def submit\n @submission = Requests::Submission.new(sanitize_submission(params), Patron.new(user: current_or_guest_user, session: session))\n respond_to do |format|\n format.js do\n valid = @submission.valid?\n @services = @submission.process_submission if valid\n if valid && @submission.service_errors.blank?\n respond_to_submit_success(@submission)\n elsif valid # submission was valid, but service failed\n respond_to_service_error(@services)\n else\n respond_to_validation_error(@submission)\n end\n end\n end\n end", "def do_request\n\t\t\tself.response = post_request(options)\n\t\tend", "def submit(request)\n url = request.to_url\n ActiveSupport::Notifications.instrument(\"amazon_flex_pay.api\", :action => request.action_name, :request => url) do |payload|\n begin\n http = RestClient.get(url)\n\n payload[:response] = http.body\n payload[:code] = http.code\n\n response = request.class::Response.from_xml(http.body)\n response.request = request\n response\n\n rescue RestClient::BadRequest, RestClient::Unauthorized, RestClient::Forbidden => e\n payload[:response] = e.http_body\n payload[:code] = e.http_code\n\n er = AmazonFlexPay::API::BaseRequest::ErrorResponse.from_xml(e.response.body)\n klass = AmazonFlexPay::API.const_get(er.errors.first.code)\n raise klass.new(er.errors.first.code, er.errors.first.message, er.request_id, request)\n end\n end\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def validate_request(call)\n @calls.validate_request(call)\n end", "def submit\n http = Net::HTTP.new(URL.host, URL.port)\n http.use_ssl = true\n http.start { |send| send.request(self) }.body\n end", "def post_request(object)\n end", "def post\r\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def check_submit_valid\n begin\n if params[:status][:source].length > \n JS_CONFIG[\"limits\"][\"max_source_code_len\"]\n raise t(\"status.prompts.source_code_too_long\") \n end\n begin\n @problem = Problem.find(params[:status][:pid])\n rescue\n raise t(\"problem.prompts.nonexist\")\n end\n if params[:status][:contest_belong].to_i == 0 &&\n @problem.hide && !current_user.is_admin?\n raise t(\"problem.prompts.nonexist\")\n else\n begin\n @contest = Contest.find(params[:status][:contest_belong].to_i)\n rescue\n raise t(\"contest.prompts.nonexist\")\n end\n unless @contest.has_user(current_user.username)\n raise t(\"global.prompts.access_denied\");\n end\n if ContestProblem.where(\n cid: params[:status][:contest_belong].to_i,\n pid: params[:status][:pid].to_i).empty?\n raise t(\"problem.prompts.nonexist\")\n end\n end\n raise t(\"status.prompts.language_unspecified\") if \n params[:status][:language].to_i == 0\n last_status = Status.where(username: current_user.username)\n .order(time_submit: :desc).first\n raise t(\"global.prompts.too_frequent\") if\n Time.now - last_status.time_submit < 5\n rescue Exception => e\n render status: :not_acceptable, json: { msg: e.message }\n return\n end\n end", "def validate\r\n\r\n end", "def validate!\n # pass\n end", "def perform\n\n r = validate_and_sanitize\n return r unless r.success?\n\n update_api_fields\n\n success\n end", "def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end", "def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end", "def accept! = self.user.create_accepted_request", "def submit(args = {})\n watercourse.set(args[:watercourse]) if args.key?(:watercourse)\n stop_day.set(args[:stop_day]) if args.key?(:stop_day)\n stop_month.set(args[:stop_month]) if args.key?(:stop_month)\n stop_year.set(args[:stop_year]) if args.key?(:stop_year)\n apply_day.set(args[:apply_day]) if args.key?(:apply_day)\n apply_month.set(args[:apply_month]) if args.key?(:apply_month)\n apply_year.set(args[:apply_year]) if args.key?(:apply_year)\n gauging_station.set(args[:gauging_station]) if args.key?(:gauging_station)\n hof_threshold.set(args[:hof_threshold]) if args.key?(:hof_threshold)\n contact_name.set(args[:contact_name]) if args.key?(:contact_name)\n contact_details.set(args[:contact_details]) if args.key?(:contact_details)\n sender_name.set(args[:sender_name]) if args.key?(:sender_name)\n sender_role.set(args[:sender_role]) if args.key?(:sender_role)\n sender_address.set(args[:sender_address]) if args.key?(:sender_address)\n submit_button.click\n end", "def validate\n end", "def send_request\n # validate that the hooked browser's session has been sent\n zombie_session = @params['zombie_session'] || nil\n raise WEBrick::HTTPStatus::BadRequest, \"Invalid session id\" if not BeEF::Filters.is_valid_hook_session_id?(zombie_session)\n \n # validate that the hooked browser exists in the db\n zombie = Z.first(:session => zombie_session) || nil\n raise WEBrick::HTTPStatus::BadRequest, \"Invalid hooked browser session\" if zombie.nil?\n \n # validate that the raw request has been sent\n raw_request = @params['raw_request'] || nil\n raise WEBrick::HTTPStatus::BadRequest, \"raw_request is nil\" if raw_request.nil?\n raise WEBrick::HTTPStatus::BadRequest, \"raw_request contains non-printable chars\" if not BeEF::Filters.has_non_printable_char?(raw_request)\n \n # validate nonce\n nonce = @params['nonce'] || nil\n raise WEBrick::HTTPStatus::BadRequest, \"nonce is nil\" if nonce.nil?\n raise WEBrick::HTTPStatus::BadRequest, \"nonce incorrect\" if @session.get_nonce != nonce\n \n # validate that the raw request is correct and can be used\n req_parts = raw_request.split(/ |\\n/) # break up the request\n verb = req_parts[0]\n raise 'Only GET or POST requests are supported' if not BeEF::Filters.is_valid_verb?(verb) #check verb\n uri = req_parts[1]\n raise 'Invalid URI' if not BeEF::Filters.is_valid_url?(uri) #check uri\n version = req_parts[2]\n raise 'Invalid HTTP version' if not BeEF::Filters.is_valid_http_version?(version) # check http version - HTTP/1.0\n host_str = req_parts[3]\n raise 'Invalid HTTP version' if not BeEF::Filters.is_valid_host_str?(host_str) # check host string - Host:\n host = req_parts[4]\n host_parts = host.split(/:/)\n hostname = host_parts[0]\n raise 'Invalid hostname' if not BeEF::Filters.is_valid_hostname?(hostname) #check the target hostname\n hostport = host_parts[1] || nil\n if !hostport.nil?\n raise 'Invalid hostport' if not BeEF::Filters.nums_only?(hostport) #check the target hostport\n end\n\n # (re)build the request\n green_request = StringIO.new(verb + \" \" + uri + \" \" + version + \"\\n\" + host_str + \" \" + host)\n request = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)\n request.parse(green_request)\n \n # Saves the new HTTP request.\n http = H.new(\n :request => raw_request,\n :method => request.request_method,\n :domain => request.host,\n :path => request.unparsed_uri,\n :request_date => Time.now,\n :hooked_browser_id => zombie.id\n )\n \n if request.request_method.eql? 'POST'\n http.content_length = request.content_length\n end\n \n http.save\n \n @body = '{success : true}'\n end", "def validate\n unless (e = errors).empty?\n raise InvalidRequestError, e.first\n end\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_validation_hash_details\n return r unless r.success?\n\n r = create_secure_data_acccess_token\n return r unless r.success?\n\n r = send_mail\n return r unless r.success?\n\n success_with_data({manager_validation_hash_id: @manager_validation_hash[:id]})\n\n end\n\n end", "def validate\n \n \n end", "def submit\n # we are authenticated from params or session\n if authenticated?\n @test_instance = submission_instance\n submission_save\n # params authentication failed. Redirect (html) or report failure (JSON)\n else\n submission_fail_authentication\n end\n end", "def validate_request(env)\n parameters = extract_request_parameters\n\n validate_flow_presence!(parameters)\n validate_msisdn!(parameters)\n validate_session_id!(parameters)\n\n parameters\n end", "def send_request; end", "def check_requests\n if requests.empty?\n errors.add('requests', 'there were no requests')\n return\n end\n\n requests.each do |request|\n next if request.valid?\n\n request.errors.each do |k, v|\n errors.add(k, v)\n end\n end\n end", "def create\n # rp - request parameters\n rp = req_params\n\n # сюда будем собирать ошибки при проверке заявки\n errors = {}\n\n model_name(rp, errors)\n aas_names(rp, errors)\n check_human(rp, errors)\n\n if errors.empty?\n export(rp) if PSOFT_DB\n mail(rp)\n render json: { message: format(I18n.t('request.status.ok'), id: rp.id || ' -') }\n else\n render status: :unprocessable_entity, json: errors\n end\n end", "def fill_form_and_submit(agent, creds, url, category, tech, data)\n case category\n when 'extensions'\n puts \"uploading #{category.chop}: #{data[category.chop].to_s}\" unless $quiet\n cat_page = get_page(agent, creds, url + CONFIG, {display: category, tech_hardware: 'custom_custom'})\n frm = cat_page.form('frm_extensions')\n when 'trunks'\n puts \"uploading #{category.chop}: #{data['trunk_name'].to_s}\" unless $quiet\n cat_page = get_page(agent, creds, url + CONFIG, {display: category, tech: tech.upcase})\n frm = cat_page.form('trunkEdit')\n end\n abort 'error: form not found' unless frm\n\n if $debug\n frm.fields.each { |field| puts \"send_sever_request: #{field.name}: #{field.value}\" }\n frm.checkboxes.each { |chkbx| puts \"send_sever_request: #{chkbx.name}: #{chkbx.value}\" }\n frm.radiobuttons.each { |rdb| puts \"send_sever_request: #{rdb.name}: #{rdb.value}\" if rdb.checked }\n end\n # Fill in the form, and submit it!\n data.each { |key, val| frm[key] = val }\n frm.submit\nend", "def validate_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate(@arguments)\n render json: { success: 'Params look great!' }, status: 200\n end\n end", "def schedule(subperiod,year,gs,expiry_date)\n #URL della servlet\n url = URI.parse(CONFIG['servlet']['address'])\n #impostazione del metodo POST\n req = Net::HTTP::Post.new(url.path)\n #parametri di autenticazione\n #req.basic_auth 'jack', 'pass'\n #dati da inviare op = ScheduleJob\n if expiry_date\n data = expiry_date.date\n day = data.day.to_i\n if day < 10\n day = \"0\" + day.to_s\n else\n day = day.to_s\n end\n month = data.mon.to_i\n if month < 10\n month = \"0\" + month.to_s\n else\n month = month.to_s\n end\n date = day + \"-\" + month + \"-\" + data.year.to_s\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s,\n 'date'=> date\n }, '&')\n else\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s\n }, '&')\n #connessione alla servlet\n end\n res = Net::HTTP.new(url.host, url.port).start {\n |http| http.request(req)\n }\n #controllo del codice di errore\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n return true\n when Net::HTTPNotAcceptable\n #parametri non corretti.. riportare alla form\n return false\n else\n #errore connessione.. riprovare\n return false\n end\n end", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend", "def submit_result\n process_submit_response(submit_request) if @score > 1363\n end", "def doPost(url)\n init\n checkHTTP(url)\n display\nend", "def handle_post(body)\n make_response(200, validate_questions(body))\nend", "def check\n req = GData::HTTP::Request.new(@base_uri + '/' + @model)\n sign_and_request(req)\n end", "def create\n #Instantiate a new object using form parameters\n require 'uri'\n require 'net/http'\n\n puts('------Parameters------')\n puts(params)\n puts('------Name------')\n puts(params['name'])\n puts('------------')\n\n params = {'subject' => \"Test Subject from Rails Controller\", 'message' => 'Test Message from Rails Controller', 'person_email' => 'JesseShawCodes@gmail.com' }\n\n puts(\"Those Params!!!\")\n\n=begin\n begin\n url = URI.parse('https://help.ginkgo-plus.dev/api/tickets')\n puts(url.host)\n puts(url.path)\n puts(url.port)\n puts('Lets see if there are any values above...')\n req = Net::HTTP::Post.new(url, {'X-DeskPRO-API-KEY' => '1:CMZ8MZAA8RQR2D9H5SMQWQD4R'})\n puts(\"Undefined http???\")\n req.body = {'subject' => \"Test Subject from Rails Controller\", 'message' => 'Test Message from Rails Controller', 'person_email' => \"JesseShawCodes@gmail.com\" }\n res = https.request(req)\n puts(\"I think it works???\")\n rescue => e\n puts(\"Failed: Ahhh bummer. It's broke\")\n puts(\"#{e}\")\n end\n\n # x = Net::HTTP.post_form(URI.parse('https://help.ginkgo-plus.dev/api/tickets'), params)\n # puts x.body\n\n @subject = Subject.new(params[:subject])\n\n #Save the object\n if @subject.save\n redirect_to(subjects_path)\n else\n render('new')\n end\n=end\n end", "def create\n errors = []\n @request = Request.new(request_params)\n page_info = do_url_check @request.url, errors\n do_email_check @request.email, errors\n if page_info && errors.length == 0\n begin\n total = page_info['total']\n @request.tarrif_parsed = @request.get_tarrif total\n @request.tarrif= @request.tarrif_parsed.join '_'\n if @request.tarrif_parsed[1] == 'FREE'\n @request.state = 'active'\n end\n @request.save! # save it second time to generate varsymbol\n @request.varsymbol = @request.generate_varsymbol @request.id\n @request.save!\n unless @request.tarrif_parsed[1] != 'FREE'\n # if this is not free tarrif, render SMS payment info text\n #html = render_to_string(\"partials/_smsPay.html.erb\", layout: false)\n #@request.sms_guide_html = html\n end\n RequestNotifier.NewRequestInfo(@request).deliver\n return respond_with(@request, location: nil)\n rescue ActiveRecord::RecordNotUnique => e\n if (e.message.include? 'index_requests_on_url_and_email')\n errors << 'Sledování s touto adresou pro zadaný email je již jednou zadáno.'\n return respond_with({errors: errors}, status: :unprocessable_entity, location: nil)\n else\n raise $!\n end\n end\n else\n return respond_with({errors: errors}, status: :unprocessable_entity)\n end\n end", "def submit_form_0966\n ClaimsApi::Logger.log('itf', detail: '0966 - Request Started')\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n ClaimsApi::Logger.log('itf', detail: '0966 - Controller Actions Completed')\n\n bgs_response = local_bgs_service.insert_intent_to_file(intent_to_file_options)\n if bgs_response.empty?\n ClaimsApi::IntentToFile.create!(status: ClaimsApi::IntentToFile::ERRORED, cid: token.payload['cid'])\n raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Veteran ID not found')\n else\n ClaimsApi::IntentToFile.create!(status: ClaimsApi::IntentToFile::SUBMITTED, cid: token.payload['cid'])\n ClaimsApi::Logger.log('itf', detail: 'Submitted to BGS')\n render json: bgs_response,\n serializer: ClaimsApi::IntentToFileSerializer\n end\n end", "def submit\n obj = ActiveSupport::Inflector.constantize(self.class.to_s.gsub(/Builder/, ''))\n obj.new(Client.post_xml_request(to_s))\n end", "def submit_request_release\n if @params['hiddenImagePath'] == ''\n @data = \"subject=Freimeldung aus Maco-Tec App&product_machine=#{@params['product_machine']}&pickup_date=#{@params['pickup_date']}&location=#{@params['location']}&company=#{@params['company']}&phone=#{@params['phone']}&email=#{@params['email']}&additional_location_information=#{@params['additional_location_information']}&hardware_id=#{Device.instance.hardware_id}&device_os=#{Device.instance.device_os}&locale=#{Device.instance.locale}&device_os_version=#{Device.instance.device_os_version}\" \n ConnectionController.service_request(\"send_request_release_test.php\",nil,\"post\",nil, @data, url_for(:action => :http_callback))\n else\n multipart_array = [{:filename => @params['hiddenImagePath'], :name => \"image\", :content_type => \"image/jpg\"},\n {:name => \"hardware_id\",:body => Device.instance.hardware_id},\n {:name => \"device_os\",:body => Device.instance.device_os},\n {:name => \"locale\",:body => Device.instance.locale},\n {:name => \"device_os_version\",:body => Device.instance.device_os_version},\n {:name => \"action\",:body => \"submit_request_release\"},\n {:name => \"subject\",:body => \"Freimeldung aus Maco-Tec App\"},\n {:name => \"product_machine\", :body => @params['product_machine']},\n {:name => \"pickup_date\", :body => @params['pickup_date']},\n {:name => \"location\", :body => @params['location']},\n {:name => \"company\", :body => @params['company']},\n {:name => \"phone\", :body => @params['phone']},\n {:name => \"email\", :body => @params['email']},\n {:name => \"additional_location_information\", :body => @params['additional_location_information']},\n ]\n ConnectionController.service_request(\"send_request_release_test.php\",nil,\"upload_file\",nil, nil, url_for(:action => :http_callback), nil, multipart_array)\n end\n render :action => :wait\n end", "def perform(request, response); end", "def validate(method)\n # If no requirements were specified, presume GET.\n requirements = @requirements.empty? ? [:get] : @requirements\n unless requirements.include? method\n raise RequestError, \"request method #{method} is not permitted\"\n end \n end", "def post\n end", "def process_request\n @build_xml = build_xml\n pickup_serv_log('Final XML Request : ' + @build_xml.to_s)\n api_url_srv = api_url + \"/pickup\"\n pickup_serv_log('URL for API : ' + api_url_srv.to_s)\n api_response = self.class.post(api_url_srv, :body => build_xml)\n pickup_serv_log('API Response : ' + api_response.to_s)\n puts api_response if @debug\n response = parse_response(api_response)\n if success?(response)\n pickup_serv_log('Successfully Done : ' + response.to_s)\n success_response(api_response, response)\n else\n failure_response(api_response, response)\n end\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 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 post!\n request! :post\n end", "def validate(input)\n result = ctx[:contract].new.call(input[:params])\n if result.errors.count.positive?\n Failure(error: ErrorService.bad_request_fail(result.errors.to_h))\n else\n ctx[:params] = result.to_h\n Success(input.merge(params: result.to_h))\n end\n end", "def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end", "def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def submit_request_project\n if @params['hiddenImagePath'] == ''\n @data = \"subject=Anfrage zu Projekt aus Maco-Tec App&project_number=#{@params['project_number']}&information=#{@params['information']}&company=#{@params['company']}&phone=#{@params['phone']}&email=#{@params['email']}&hardware_id=#{Device.instance.hardware_id}&device_os=#{Device.instance.device_os}&locale=#{Device.instance.locale}&device_os_version=#{Device.instance.device_os_version}\"\n ConnectionController.service_request(\"send_request_project_test.php\",nil,\"post\",nil, @data, url_for(:action => :http_callback))\n else\n multipart_array = [{:filename => @params['hiddenImagePath'], :name => \"image\", :content_type => \"image/jpg\"},\n {:name => \"hardware_id\",:body => Device.instance.hardware_id},\n {:name => \"device_os\",:body => Device.instance.device_os},\n {:name => \"locale\",:body => Device.instance.locale},\n {:name => \"device_os_version\",:body => Device.instance.device_os_version},\n {:name => \"action\",:body => \"submit_request_project\"},\n {:name => \"subject\",:body => \"Anfrage zu Projekt aus Maco-Tec App\"},\n {:name => \"project_number\", :body => @params['project_number']},\n {:name => \"information\", :body => @params['information']},\n {:name => \"company\", :body => @params['company']},\n {:name => \"phone\", :body => @params['phone']},\n {:name => \"email\", :body => @params['email']}\n ]\n ConnectionController.service_request(\"send_request_project_test.php\",nil,\"upload_file\",nil, nil, url_for(:action => :http_callback), nil, multipart_array)\n end\n render :action => :wait\n end", "def post_data; end", "def send_request(req); end", "def checkin_submit_manual\n\t\tif params[:rfid] && params[:sublocation] && params[:mainlocation]\n\t\t\tbegin\n\t\t\t\t@checkin = CheckIn.new(params[:checkin])\n\t\t\t @checkin.room = Room.find(params[:sublocation])\n\t\t \t@checkin.user = User.find_by_rfid(params[:rfid]) || raise {\"invalid rfid #\"}\n\t\t rescue Exception\n\t\t \trender :text => \"***FAIL*** +++RFID card is not assigend to a user yet. Please visit a staff member at the counter...+++\", :status => 404\n\t\t \treturn\n\t\t end\n\t\t @checkin.check_in_time = DateTime.now\n\t\t respond_to do |format|\n\t\t if @checkin.save\n\t\t format.json { render json: @checkin, status: :created, location: @checkin }\n\t\t else\n\t\t format.json { render json: @checkin.errors, status: \"***FAIL*** +++RFID card is not assigend to a\n\t\t user yet. Please visit a staff member at the counter...+++\" }\n\t\t end\n\t\t end\t\n\t\tend\n\tend" ]
[ "0.711916", "0.7014459", "0.6919038", "0.6829978", "0.6788692", "0.67806745", "0.6761566", "0.67257017", "0.6695757", "0.6630653", "0.6606051", "0.654261", "0.6488721", "0.6460057", "0.6430894", "0.63586116", "0.6322532", "0.6321476", "0.6309891", "0.6234208", "0.6222027", "0.6172491", "0.6159869", "0.6142365", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6141625", "0.6117673", "0.6101164", "0.6100451", "0.609236", "0.60706496", "0.6069956", "0.60561544", "0.60531485", "0.6013976", "0.6009487", "0.5982826", "0.59652644", "0.5944196", "0.5927425", "0.59223133", "0.5921142", "0.5917935", "0.5917935", "0.59150094", "0.5911302", "0.5904139", "0.5900709", "0.5877921", "0.58513606", "0.5848453", "0.5844451", "0.5843296", "0.5841152", "0.5806149", "0.57962835", "0.57880145", "0.5785091", "0.5770725", "0.5757361", "0.57550216", "0.57477367", "0.57446456", "0.5732184", "0.5731785", "0.57314324", "0.5731394", "0.5722888", "0.57196695", "0.57192695", "0.57172585", "0.57130927", "0.5705348", "0.56978184", "0.56978184", "0.5689094", "0.5689094", "0.5689094", "0.5689094", "0.5667586", "0.56670916", "0.5652661", "0.5652661", "0.5650252", "0.5650252", "0.5650252", "0.5650252", "0.56498665", "0.5647323", "0.5645578", "0.56437224" ]
0.7029805
1
GET /eods/1 GET /eods/1.json
def show @user = User.find(params[:user_id]) @eod = Eod.find_by(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end", "def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end", "def show\n @depoevento = Depoevento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @depoevento }\n end\n end", "def show\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @eou }\n end\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def show\n @evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end", "def show\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @especy }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def show\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soiree }\n end\n end", "def show\n @enterprise_datum = EnterpriseDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enterprise_datum }\n end\n end", "def index\n @offices = Office.all\n json_response(@offices)\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end", "def index\n @episodes = Episode.all\n\n render json: @episodes\n end", "def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\n end\n end", "def show\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etsy }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def show\n @energy_datum = EnergyDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy_datum }\n end\n end", "def index\n @employees = @client.employees\n @events = fetch_events\n end", "def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\n end\n end", "def show\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etape }\n end\n end", "def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def show\n @eicon = Eicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eicon }\n end\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n ends = End.find_each\n render json: ends\n end", "def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end", "def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def get_search_cep\r\n self.class.get(\"/13040089/json/\") \r\n end", "def show\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dayoff }\n end\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end", "def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end", "def show\n @escala = Escala.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @escala }\n end\n end", "def show\n @open_erp = OpenErp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @open_erp }\n end\n end", "def index\n @event = Event.all\n render json: @event\n end", "def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @edge_types = EdgeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @edge_types }\n end\n end", "def search\n render json: PersonEvent.first(10)\n end", "def index\n @eversions = Eversion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eversions }\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 @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @estadios = Estadio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estadios }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def show\n @do_exercise = DoExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @do_exercise }\n end\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def index\n @events = Event.all\n render json: @events\n end", "def show\n @ovode = Ovode.find_by_url(params[:id])\n \n @title = @ovode.try(:seotitle)\n @seodesc = @ovode.try(:seodesc)\n @seokeys = @ovode.try(:seokeywords)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ovode }\n end\n end", "def show\n json_response(@office)\n end", "def show\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estoque }\n end\n end", "def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end", "def show\n @ope_kind = OpeKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ope_kind }\n end\n end", "def index\n @ejes = Eje.all\n end", "def set_eod\n @eod = Eod.find(params[:id])\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def get_editions(params = {})\n get_json(get_editions_url(params))\n end", "def index\n # render json: Epicenter.where('owner_id = ?', @epicenter.id)\n puts Epicenter.all.count\n render json: Epicenter.all\n end", "def show\n @oai_endpoint = OaiEndpoint.find(params[:id])\n respond_to do |format|\n format.html { render :template => 'oai_endpoints/show', :layout => params[:layout] || true }\n format.json { render :json => @oai_endpoint.as_json }\n end\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end", "def show\n @economia4 = Economia4.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @economia4 }\n end\n end", "def show\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end", "def show\n @enterprise = Enterprise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enterprise }\n end\n end", "def show\n @energy = Energy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy }\n end\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end", "def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end", "def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end", "def show\n \n @erp = Erp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @erp }\n end\n end", "def index\n data = get_index_data\n @dayoffs = data.page(params[:current_page]).per(PER_PAGE)\n respond_to do |format|\n format.html {\n render \"dashboards/admin_dashboard\"\n }\n\n format.json {\n render json: {\n total_page: @data.total_page,\n data: ActiveModel::SerializableResource.new(@dayoffs, each_serializer: AdminDayoffSerializer)\n }, status: :ok\n }\n end\n end", "def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end", "def index\n @episodes = @series.episodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @episodes }\n end\n end", "def index\n render json: Event.all, status: :ok\n end", "def unassigned\n @eobs = Eob.unassigned\n puts @eob.inspect\n @title = \"Unassigned EOB's\"\n @subtitle = \"Link the EOB to an open claim\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end", "def index\n if params[:event_id].blank?\n @offerings = Offering.all\n else\n @offerings = Offering.find_all_by_event_id params[:event_id]\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end", "def show\n @estate = Estate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate }\n end\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def show\n @eatvent = Eatvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eatvent }\n end\n end", "def index\n @e_dates = EDate.all\n end", "def show\n render json: @elector\n end", "def getex\n url = prefix + \"getex\" + id_param\n return response(url)\n end", "def index\n @ephems = Ephem.page(params[:page])\n end", "def show\n @orc = Orc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orc }\n end\n end", "def index\n @equipment_orders = EquipmentOrder.all\n respond_to do |format|\n format.json { render json: @equipment_orders }\n end\n end", "def show\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_type }\n end\n end", "def index\n @api_v1_exercises = Api::V1::Exercise.all\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end" ]
[ "0.6362789", "0.63448405", "0.62461716", "0.6200196", "0.60983086", "0.60964125", "0.60925984", "0.6072614", "0.60415006", "0.6040837", "0.5995396", "0.5984661", "0.59739596", "0.59710366", "0.59548473", "0.5951778", "0.594346", "0.594026", "0.59353954", "0.59284735", "0.5921592", "0.5884665", "0.58737135", "0.58689374", "0.5860231", "0.5855809", "0.58555347", "0.58482367", "0.5844873", "0.5830638", "0.5825076", "0.5811532", "0.58111745", "0.5802487", "0.5801621", "0.57996356", "0.578779", "0.57715994", "0.57703024", "0.5762722", "0.57600313", "0.5758982", "0.5757747", "0.5757747", "0.5754743", "0.5749027", "0.5748175", "0.5747717", "0.5745308", "0.57428217", "0.5742733", "0.5737622", "0.57367164", "0.5733589", "0.57319653", "0.5731248", "0.57299155", "0.57273865", "0.57249653", "0.5714328", "0.5712687", "0.5708582", "0.5708451", "0.5704988", "0.5697447", "0.5694035", "0.56924224", "0.5692282", "0.5683012", "0.56764954", "0.56745684", "0.5674311", "0.56730354", "0.56687707", "0.56655985", "0.56646556", "0.56632596", "0.5662653", "0.5650988", "0.5649543", "0.5644818", "0.5641699", "0.5640942", "0.564086", "0.5638664", "0.5638401", "0.56378335", "0.5632983", "0.5632212", "0.563162", "0.5631315", "0.56247586", "0.5622901", "0.56184095", "0.56170183", "0.56151825", "0.5607934", "0.56065947", "0.56042", "0.5603167" ]
0.5771239
38
POST /eods POST /eods.json
def create # redirect_to user_eod_path(@user,@eod) # render 'show' @user = User.find(params[:user_id]) sumott = 0 case @user.role when "QA" qaeods_attributes = params[:eod][:qaeods_attributes] qaeods_attributes.each do |key, value| sumott = sumott + value[:Pre_QA_H].to_f + value[:Review_H].to_f + value[:QA_H].to_f + value[:Bug_Management_H].to_f + value[:Audio_QA_H].to_f + value[:N_Review_H].to_f + value[:N_QA_H].to_f + value[:N_Bug_Management_H].to_f + value[:Project_Management_H].to_f + value[:Other_H].to_f + value[:mis_meeting].to_f + value[:mis_training].to_f + value[:mis_others].to_f + value[:ab_sickleave].to_f + value[:ab_shiftleave].to_f + value[:ab_annualleave].to_f + value[:ab_holiday].to_f + value[:ab_others].to_f + value[:vpp_H].to_f + value[:N_vpp_H].to_f end when "Loc" loceods_attributes = params[:eod][:loceods_attributes] loceods_attributes.each do |key, value| sumott = sumott + value[:familiarization_H].to_f + value[:Review_H].to_f + value[:translation_H].to_f + value[:bugfix_H].to_f + value[:audiodelivery_H].to_f + value[:N_Review_H].to_f + value[:N_translation_H].to_f + value[:N_bugfix_H].to_f + value[:Project_Management_H].to_f + value[:Other_H].to_f + value[:vpp_H].to_f + value[:N_vpp_H].to_f + value[:mis_meeting].to_f + value[:mis_training].to_f + value[:mis_others].to_f + value[:ab_sickleave].to_f + value[:ab_shiftleave].to_f + value[:ab_annualleave].to_f + value[:ab_holiday].to_f + value[:ab_others].to_f + value[:audioonsite_H].to_f + value[:polish_H].to_f end end params[:eod][:sumott] = sumott @eod = @user.eods.create(eod_params) if @eod.errors.any? render 'new' # render plain: @eod.errors.inspect else redirect_to @eod.user end #redirect_to @eod.user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eod_params\n params.require(:eod).permit!\n end", "def create\n @dia_evento = DiaEvento.new(dia_evento_params)\n\n if @dia_evento.save\n render json: @dia_evento, status: :created, location: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\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 post(endpoint, options)\n #Send request\n res = RestClient.post endpoint,\n options,\n content_type: :json\n\n #Process and return response\n return JSON.parse(res.body, object_class: OpenStruct)\nend", "def create\n @offices = Office.create!(office_params)\n json_response(@offices, :created)\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def post_data(body)\r\n raise ConfigError, 'no json_records' if body.empty?\r\n # Create REST request header\r\n header = get_header(body.bytesize)\r\n # Post REST request \r\n response = RestClient.post(@uri, body, header)\r\n\r\n return response\r\n end", "def create\n @eou = Eou.new(params[:eou])\n\n respond_to do |format|\n if @eou.save\n format.html { redirect_to @eou, :notice => 'Eou was successfully created.' }\n format.json { render :json => @eou, :status => :created, :location => @eou }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end", "def create\n @depoevento = Depoevento.new(params[:depoevento])\n\n respond_to do |format|\n if @depoevento.save\n format.html { redirect_to @depoevento, notice: 'Depoevento was successfully created.' }\n format.json { render json: @depoevento, status: :created, location: @depoevento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @depoevento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @edrife = Edrive.new(edrife_params)\n\n respond_to do |format|\n if @edrife.save\n format.html { redirect_to @edrife, notice: 'Edrive was successfully created.' }\n format.json { render :show, status: :created, location: @edrife }\n else\n format.html { render :new }\n format.json { render json: @edrife.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ovode = Ovode.new(params[:ovode])\n\n respond_to do |format|\n if @ovode.save\n format.html { redirect_to @ovode, notice: 'ovode was successfully created.' }\n format.json { render json: @ovode, status: :created, location: @ovode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ovode.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def post(_endpoint_path, _body, _extra_headers = {})\n response\n end", "def create\n @odsreserf = Odsreserf.new(odsreserf_params)\n\n respond_to do |format|\n if @odsreserf.save\n format.html { redirect_to @odsreserf, notice: 'Odsreserf was successfully created.' }\n format.json { render :show, status: :created, location: @odsreserf }\n else\n format.html { render :new }\n format.json { render json: @odsreserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end", "def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['forename'] = forename\n params['surname'] = surname\n params['job_title'] = job_title\n params['description'] = description\n params['email'] = email\n params['phone_number'] = phone_number\n return doCurl(\"post\",\"/entity/employee\",params)\n end", "def create\n @off_day = OffDay.new(off_day_params)\n\n respond_to do |format|\n if @off_day.save\n format.html { redirect_to @off_day, notice: 'Off day was successfully created.' }\n format.json { render :show, status: :created, location: @off_day }\n else\n format.html { render :new }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(endpoint, body, headers = {})\n headers = { accept: :json, content_type: :json }.merge(headers)\n @rest_resource[endpoint].post body, headers\n end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def destroy\n @eod.destroy\n respond_to do |format|\n format.html { redirect_to eods_url, notice: 'Eod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ephem = Ephem.new(ephem_params)\n\n respond_to do |format|\n if @ephem.save\n format.html { redirect_to @ephem, notice: 'Ephem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ephem }\n else\n format.html { render action: 'new' }\n format.json { render json: @ephem.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityDocument( entity_id, name, filedata)\n params = Hash.new\n params['entity_id'] = entity_id\n params['name'] = name\n params['filedata'] = filedata\n return doCurl(\"post\",\"/entity/document\",params)\n end", "def create_doi\n response = RestClient.post DoiConfig.url_for_creating_doi, data, :content_type => 'text/plain'\n return response\n end", "def create\n @e_date = EDate.new(e_date_params)\n\n respond_to do |format|\n if @e_date.save\n format.html { redirect_to @e_date, notice: 'E date was successfully created.' }\n format.json { render :show, status: :created, location: @e_date }\n else\n format.html { render :new }\n format.json { render json: @e_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @episode = Episode.new(episode_params)\n\n if @episode.save\n render json: @episode, status: :created, location: @episode\n else\n render json: @episode.errors, status: :unprocessable_entity\n end\n end", "def create\n @etape = Etape.new(params[:etape])\n\n respond_to do |format|\n if @etape.save\n format.html { redirect_to @etape, notice: 'Etape was successfully created.' }\n format.json { render json: @etape, status: :created, location: @etape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etape.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @eje = Eje.new(eje_params)\n\n respond_to do |format|\n if @eje.save\n format.html { redirect_to @eje, notice: 'Eje was successfully created.' }\n format.json { render :show, status: :created, location: @eje }\n else\n format.html { render :new }\n format.json { render json: @eje.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\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 create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def create\n @outside = Outside.new(outside_params)\n\n respond_to do |format|\n if @outside.save\n format.html { redirect_to @outside, notice: 'Outside was successfully created.' }\n format.json { render :show, status: :created, location: @outside }\n else\n format.html { render :new }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @enterprise_datum = EnterpriseDatum.new(params[:enterprise_datum])\n\n respond_to do |format|\n if @enterprise_datum.save\n format.html { redirect_to @enterprise_datum, notice: 'Enterprise datum was successfully created.' }\n format.json { render json: @enterprise_datum, status: :created, location: @enterprise_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enterprise_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deed = Deed.create(deed_params)\n\n if @deed.save\n render json: @deed, status: :created, location: @deed\n else\n render json: @deed.errors, status: :unprocessable_entity\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def set_eod\n @eod = Eod.find(params[:id])\n end", "def create_employee(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/employees'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def create\n @eocm = EOCM.new(eocm_params)\n\n respond_to do |format|\n if @eocm.save\n format.html { redirect_to @eocm, notice: 'EOCM was successfully created.' }\n format.json { render :show, status: :created, location: @eocm }\n else\n format.html { render :new }\n format.json { render json: @eocm.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end", "def create\n @ess = Esse.new(ess_params)\n\n respond_to do |format|\n if @ess.save\n format.html { redirect_to esses_url, notice: 'Esse was successfully created.' }\n format.json { render :show, status: :created, location: @ess }\n else\n format.html { render :new }\n format.json { render json: @ess.errors, status: :unprocessable_entity }\n end\n end\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end", "def json\n Oj.to_json(@req)\n end", "def create\n @dayoff = Dayoff.new(params[:dayoff])\n\n respond_to do |format|\n if @dayoff.save\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully created.' }\n format.json { render json: @dayoff, status: :created, location: @dayoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @especy = Especie.new(params[:especy])\n\n respond_to do |format|\n if @especy.save\n format.html { redirect_to @especy, notice: 'Especie was successfully created.' }\n format.json { render json: @especy, status: :created, location: @especy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end", "def post endpoint, body = {}\n body.merge!(api_key: api_key, namespace: namespace)\n\n response = connection.post do |req|\n req.url endpoint\n req.body = body.to_json\n end\n\n format_response_or_raise_error(response)\n end", "def create\n @energy_datum = EnergyDatum.new(params[:energy_datum])\n\n respond_to do |format|\n if @energy_datum.save\n format.html { redirect_to @energy_datum, notice: 'Energy datum was successfully created.' }\n format.json { render json: @energy_datum, status: :created, location: @energy_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @energy_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @thuoc = Thuoc.new(thuoc_params)\n\n respond_to do |format|\n if @thuoc.save\n format.html { redirect_to @thuoc, notice: \"Thuoc was successfully created.\" }\n format.json { render :show, status: :created, location: @thuoc }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @thuoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @donee = Donee.new(donee_params)\n\n respond_to do |format|\n if @donee.save\n format.html { redirect_to @donee, notice: 'Donee was successfully created.' }\n format.json { render :show, status: :created, location: @donee }\n else\n format.html { render :new }\n format.json { render json: @donee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :POST)\n end", "def create\n @dino = Dino.new(dino_params)\n\n if @dino.save\n render json: @dino, status: :created, location: @dino\n else\n render json: @dino.errors, status: :unprocessable_entity\n end\n end", "def create\n @door_event = DoorEvent.new(door_event_params)\n\n respond_to do |format|\n if @door_event.save\n format.html { redirect_to @door_event, notice: 'Door event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @door_event }\n else\n format.html { render action: 'new' }\n format.json { render json: @door_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_elasticsearch(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/elastic_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :index => target['database'],\n :port => target['port'],\n :type => target['table'],\n :nodesWanOnly => target['es_nodes_wan_only'],\n :purpose => 'FAILED_EVENTS'\n }\n }\nend", "def create\n @eatable = Eatable.new(eatable_params)\n\n respond_to do |format|\n if @eatable.save\n format.html { redirect_to @eatable, notice: 'Eatable was successfully created.' }\n format.json { render :show, status: :created, location: @eatable }\n else\n format.html { render :new }\n format.json { render json: @eatable.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end", "def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n @outdoor = Outdoor.new(params[:outdoor])\n\n respond_to do |format|\n if @outdoor.save\n format.html { redirect_to @outdoor, notice: 'Outdoor was successfully created.' }\n format.json { render json: @outdoor, status: :created, location: @outdoor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outdoor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ev = Ev.new(ev_params)\n\n respond_to do |format|\n if @ev.save\n format.html { redirect_to @ev, notice: 'Ev was successfully created.' }\n format.json { render :show, status: :created, location: @ev }\n else\n format.html { render :new }\n format.json { render json: @ev.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @eintrag = Eintrag.new(eintrag_params)\n\n respond_to do |format|\n if @eintrag.save\n format.html { redirect_to @eintrag, notice: 'Eintrag was successfully created.' }\n format.json { render :show, status: :created, location: @eintrag }\n else\n format.html { render :new }\n format.json { render json: @eintrag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @doadore = Doadore.new(doadore_params)\n\n respond_to do |format|\n if @doadore.save\n format.html { redirect_to @doadore, notice: 'Doadore was successfully created.' }\n format.json { render :show, status: :created, location: @doadore }\n else\n format.html { render :new }\n format.json { render json: @doadore.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def create\n @endorsement = Endorsement.new(endorsement_params)\n\n if @endorsement.save\n render json: @endorsement, status: :created, location: @endorsement\n else\n render json: @endorsement.errors, status: :unprocessable_entity\n end\n end", "def post(endpoint)\n respond_with(\n connection(endpoint).post(prepare(endpoint.uri), custom_dump(endpoint.req_params)),\n endpoint\n )\n end", "def create\n @expediente = Expediente.new(params[:expediente])\n \n respond_to do |format|\n if @expediente.save\n format.html { redirect_to @expediente, notice: 'Expediente was successfully created.' }\n format.json { render json: @expediente, status: :created, location: @expediente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expediente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food_event = FoodEvent.new(food_event_params)\n\n respond_to do |format|\n if @food_event.save\n format.html { redirect_to @food_event, notice: 'Food event was successfully created.' }\n format.json { render :show, status: :created, location: @food_event }\n else\n format.html { render :new }\n format.json { render json: @food_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wod = Wod.new(wod_params)\n\n if @wod.save\n render json: @wod, status: :created\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create_elasticsearch_addressbase_data(title_address_data)\n id = title_address_data[:uprn]\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new \"/#{$ELASTICSEARCH_ADDRESSBASE}/#{$ELASTICSEARCH_POSTCODE_SEARCH}/#{id}\"\n request['Content-Type'] = 'application/json'\n request.body = title_address_data.to_json\n conn.request(request)\nend", "def POST; end", "def create\n @edu_doc = current_user.edu_docs.new(edu_doc_params)\n\n respond_to do |format|\n if @edu_doc.save\n format.html { redirect_to edu_docs_path, notice: \"Edu doc was successfully created.\" }\n format.json { render :index, status: :created, location: @edu_docs }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @edu_doc.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def CreateArticle params = {}\n \n APICall(path: 'help_center/articles.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @oeuvre = Oeuvre.new(oeuvre_params)\n\n respond_to do |format|\n if @oeuvre.save\n format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully created.' }\n format.json { render :show, status: :created, location: @oeuvre }\n else\n format.html { render :new }\n format.json { render json: @oeuvre.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @unpaid_offdays = UnpaidOffday.all\n @unpaid_offday = UnpaidOffday.create(unpaid_offday_params)\n\n @employees = Employee.all.order(:first_name)\n @unpaid_offday_types = UnpaidOffdayType.all.order(:unpaid_offday_type_title)\n @orders = Order.all.order(:order_no)\n\n=begin\n @unpaid_offday = UnpaidOffday.new(unpaid_offday_params)\n\n respond_to do |format|\n if @unpaid_offday.save\n format.html { redirect_to @unpaid_offday, notice: 'Unpaid offday was successfully created.' }\n format.json { render :show, status: :created, location: @unpaid_offday }\n else\n format.html { render :new }\n format.json { render json: @unpaid_offday.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend", "def update\n if @dia_evento.update(dia_evento_params)\n render json: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\n end\n end", "def upsert_marketo_lead(params)\n # todo: verify required fields? perhaps get form fields and validation logic from marketo?\n # removing params included by rails\n params.delete :action\n params.delete :controller\n params.delete :marketo_form\n # parse incoming values to json\n body = {\n #\"action\"=>\"createOnly\",\n \"lookupField\"=>\"email\",\n \"input\"=>[params]\n }.to_json\n @body = body\n # set post uri\n uri = URI(Config.get_create_lead_url)\n # setup http request\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n uri.query = \"access_token=#{get_marketo_token}\"\n request = Net::HTTP::Post.new(uri, { 'Content-Type' => 'application/json' })\n request.body = @body\n # make http request\n response = http.request(request)\n return response.body\n end", "def create(opts)\n operation = {create: { _index: opts[:index], _type: opts[:type] }}\n operation[:create][:_id] = opts[:id] if opts[:id]\n @buffer.puts operation.to_json\n @buffer.puts opts[:body].to_json\n end", "def create\n @outside_request = OutsideRequest.new(params[:outside_request])\n\n respond_to do |format|\n if @outside_request.save\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully created.' }\n format.json { render json: @outside_request, status: :created, location: @outside_request }\n else\n format.html { render action: \\\"new\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @elder = Elder.new(elder_params)\n\n respond_to do |format|\n if @elder.save\n format.html { redirect_to @elder, notice: 'Se añadió correctamente la información.' }\n format.json { render :show, status: :created, location: @elder }\n else\n format.html { render :new }\n format.json { render json: @elder.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_params\n params.require(:event).permit(:title, :description, :location, :duration, :price, :start_date)\n end", "def create\n if :opr == 'edit'\n update\n else\n @employee = Employee.create({:name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end\n\n\n end", "def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n permission_denied and return if current_user.cannot 'create_odt'\n @odt = Odt.new(odt_params)\n\n respond_to do |format|\n if @odt.save\n format.html { redirect_to odts_url, success: @odt.table_name_to_show.concat(' fue creada satisfactoriamente.') }\n format.json { render :show, status: :created, location: @odt }\n else\n format.html { render :new }\n format.json { render json: @odt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inspection = Inspection.new(inspection_params)\n @clients = @inspection.try(:appointment).try(:insp_request).try(:property).try(:clients)\n create_documents\n respond_to do |format|\n if @inspection.save\n format.html { redirect_to @inspection, notice: 'Inspection was successfully created.' }\n format.json { render json: @inspection }\n else\n format.html { render :new }\n format.json { render json: @inspection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end" ]
[ "0.58552516", "0.5814527", "0.563768", "0.56346804", "0.5552279", "0.55255324", "0.5497939", "0.5427224", "0.5410804", "0.5385012", "0.5375739", "0.536578", "0.53646475", "0.53500783", "0.5341978", "0.53407824", "0.53286856", "0.5289954", "0.52610636", "0.5250427", "0.5244246", "0.5228988", "0.5208952", "0.5186384", "0.5167363", "0.51635635", "0.516263", "0.5156516", "0.5151689", "0.5132003", "0.51267767", "0.5110429", "0.5107895", "0.510505", "0.51036525", "0.51005286", "0.5096612", "0.5095078", "0.509474", "0.5092449", "0.5088483", "0.5053839", "0.50518155", "0.5049509", "0.5048321", "0.50440186", "0.50376326", "0.5037557", "0.50366974", "0.50265205", "0.5019979", "0.501628", "0.5015773", "0.50084454", "0.50061995", "0.50000226", "0.49961254", "0.49943587", "0.49918205", "0.4985688", "0.49757597", "0.49698678", "0.49689496", "0.49665105", "0.49619922", "0.49576953", "0.4955272", "0.49532872", "0.49519417", "0.49513048", "0.4945612", "0.49440843", "0.49367458", "0.49334964", "0.4931911", "0.4927071", "0.49254432", "0.49245787", "0.4920658", "0.49170506", "0.49105278", "0.4910434", "0.4908926", "0.49033445", "0.49007282", "0.48989066", "0.4895978", "0.48934558", "0.4890049", "0.48802078", "0.48799378", "0.48681417", "0.4866664", "0.48650324", "0.48622888", "0.48603877", "0.48592326", "0.48591006", "0.48576388", "0.48534957", "0.48529816" ]
0.0
-1
PATCH/PUT /eods/1 PATCH/PUT /eods/1.json
def update @eod = Eod.find(params[:id]) @user = @eod.user sumott = 0 case @user.role when "QA" qaeods_attributes = params[:eod][:qaeods_attributes] qaeods_attributes.each do |key, value| sumott = sumott + value[:Pre_QA_H].to_f + value[:Review_H].to_f + value[:QA_H].to_f + value[:Bug_Management_H].to_f + value[:Audio_QA_H].to_f + value[:N_Review_H].to_f + value[:N_QA_H].to_f + value[:N_Bug_Management_H].to_f + value[:Project_Management_H].to_f + value[:Other_H].to_f + value[:mis_meeting].to_f + value[:mis_training].to_f + value[:mis_others].to_f + value[:ab_sickleave].to_f + value[:ab_shiftleave].to_f + value[:ab_annualleave].to_f + value[:ab_holiday].to_f + value[:ab_others].to_f + value[:vpp_H].to_f + value[:N_vpp_H].to_f end when "Loc" loceods_attributes = params[:eod][:loceods_attributes] loceods_attributes.each do |key, value| sumott = sumott + value[:familiarization_H].to_f + value[:Review_H].to_f + value[:translation_H].to_f + value[:bugfix_H].to_f + value[:audiodelivery_H].to_f + value[:N_Review_H].to_f + value[:N_translation_H].to_f + value[:N_bugfix_H].to_f + value[:Project_Management_H].to_f + value[:Other_H].to_f + value[:vpp_H].to_f + value[:N_vpp_H].to_f + value[:mis_meeting].to_f + value[:mis_training].to_f + value[:mis_others].to_f + value[:ab_sickleave].to_f + value[:ab_shiftleave].to_f + value[:ab_annualleave].to_f + value[:ab_holiday].to_f + value[:ab_others].to_f + value[:audioonsite_H].to_f + value[:polish_H].to_f end end params[:eod][:sumott] = sumott if @eod.errors.any? render 'edit' else if @eod.update(eod_params) redirect_to @eod.user else render 'edit' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 patch!\n request! :patch\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "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 put!\n request! :put\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end", "def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\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 @ephem.update(ephem_params)\n format.html { redirect_to @ephem, notice: 'Ephem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ephem.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 rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "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_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update(data = :object || :json)\n end", "def update\n respond_to do |format|\n if @eje.update(eje_params)\n format.html { redirect_to @eje, notice: 'Eje was successfully updated.' }\n format.json { render :show, status: :ok, location: @eje }\n else\n format.html { render :edit }\n format.json { render json: @eje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n if @soiree.update_attributes(params[:soiree])\n format.html { redirect_to @soiree, notice: 'Soiree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @soiree.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def 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 @eou = Eou.find(params[:id])\n\n respond_to do |format|\n if @eou.update_attributes(params[:eou])\n format.html { redirect_to @eou, :notice => 'Eou was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = [{ 'op' => operation, 'path' => path, 'value' => value }]\n patch_options = { 'If-Match' => @data['eTag'] }\n response = @client.rest_patch(@data['uri'], patch_options.merge('body' => body), @api_version)\n @client.response_handler(response)\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n respond_to do |format|\n if @empolyee.update(empolyee_params)\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\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 update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto 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 respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto 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 # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_url, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n end", "def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end", "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end", "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.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 @depoevento = Depoevento.find(params[:id])\n\n respond_to do |format|\n if @depoevento.update_attributes(params[:depoevento])\n format.html { redirect_to @depoevento, notice: 'Depoevento was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @depoevento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def update\n respond_to do |format|\n if @endpoint.update(endpoint_params)\n format.html { redirect_to root_url, notice: 'Endpoint was successfully updated.' }\n format.json { head :ok }\n else\n format.html { head :unprocessable_entity }\n format.json { render json: @endpoint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n if @etape.update_attributes(params[:etape])\n format.html { redirect_to @etape, notice: 'Etape was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @etape.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "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 patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n respond_to do |format|\n if @enterprise.update(enterprise_params)\n format.html { redirect_to @enterprise, notice: 'Enterprise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @enterprise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @edrife.update(edrife_params)\n format.html { redirect_to @edrife, notice: 'Edrive was successfully updated.' }\n format.json { render :show, status: :ok, location: @edrife }\n else\n format.html { render :edit }\n format.json { render json: @edrife.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_evento.update(servico_evento_params)\n format.html { redirect_to @servico_evento, notice: 'Evento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_evento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Your entry was successfully updated sir.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @partner_permissions = args[:partner_permissions] if args.key?(:partner_permissions)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update\n @event_request = EventRequest.find(params[:id])\n\n respond_to do |format|\n if @event_request.update_attributes(params[:event_request])\n format.html { redirect_to @event_request, notice: 'Event request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "def update\n #respond_to do |format|\n # if @request.update(request_params)\n # format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @eocm.update(eocm_params)\n format.html { redirect_to @eocm, notice: 'EOCM was successfully updated.' }\n format.json { render :show, status: :ok, location: @eocm }\n else\n format.html { render :edit }\n format.json { render json: @eocm.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 cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end", "def update\n begin\n if @object.update_attributes(params[object_name])\n render :json => @object.to_json, :status => 201\n else\n error = error_response_method($e1)\n render :json => error\n end\n rescue Exception=>e\n error = error_response_method($e11)\n render :json => error\n end\n end", "def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end", "def update\n @ore = Ore.find(params[:id])\n \n respond_to do |format|\n if @ore.update_attributes(params[:ore])\n format.html { redirect_to @ore, notice: 'Ore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update(request)\n end", "def update(request)\n end", "def update\n respond_to do |format|\n if @eintrag.update(eintrag_params)\n format.html { redirect_to @eintrag, notice: 'Eintrag was successfully updated.' }\n format.json { render :show, status: :ok, location: @eintrag }\n else\n format.html { render :edit }\n format.json { render json: @eintrag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anything.update(anything_params)\n format.html { redirect_to @anything, notice: 'Anything was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n error_msg(ErrorCodes::OBJECT_ERROR, \"#{I18n.t \"endnote_files.errors.not_found\"}: #{params[:id]}\")\n render_json\n end", "def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n if @employe.update_attributes(params[:employe])\n format.html { redirect_to @employe, notice: 'Employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\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!(**args)\n @object_definitions = args[:object_definitions] if args.key?(:object_definitions)\n @operation_ids = args[:operation_ids] if args.key?(:operation_ids)\n end", "def update!(**args)\n @object_definitions = args[:object_definitions] if args.key?(:object_definitions)\n @operation_ids = args[:operation_ids] if args.key?(:operation_ids)\n end", "def update\n respond_to do |format|\n if @ecole.update(ecole_params)\n format.html { redirect_to ecoles_url, notice: 'Ecole was successfully updated.' }\n format.json { render :show, status: :ok, location: @ecole }\n else\n format.html { render :edit }\n format.json { render json: @ecole.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6517392", "0.6462041", "0.63238883", "0.63200426", "0.63113713", "0.61453897", "0.61118037", "0.609613", "0.60948586", "0.609127", "0.6081107", "0.60590154", "0.60545415", "0.6027764", "0.60211766", "0.601166", "0.601166", "0.5998876", "0.5997617", "0.5997617", "0.59771824", "0.59419173", "0.59287", "0.58992344", "0.58948374", "0.5890583", "0.5880052", "0.5877446", "0.58771306", "0.58746547", "0.5871955", "0.5867772", "0.58617485", "0.5845972", "0.58330303", "0.5826644", "0.58242685", "0.5817594", "0.5817594", "0.5815127", "0.58125925", "0.580987", "0.57904726", "0.5790306", "0.57881814", "0.57862735", "0.5780583", "0.5779856", "0.57777536", "0.57777536", "0.57768905", "0.57768905", "0.57768905", "0.5776167", "0.57689434", "0.5768593", "0.57654697", "0.57602656", "0.57562983", "0.57552475", "0.5754679", "0.57536405", "0.57516605", "0.57507503", "0.574437", "0.574429", "0.574429", "0.5738122", "0.57311016", "0.57298654", "0.5729036", "0.5720762", "0.5718655", "0.5715422", "0.5713127", "0.57090205", "0.57040256", "0.57028127", "0.5696928", "0.56932515", "0.56926155", "0.56918746", "0.5691343", "0.56860197", "0.5685524", "0.5675936", "0.56734395", "0.56734395", "0.56728995", "0.5668582", "0.5667503", "0.5667056", "0.5666911", "0.5666151", "0.5663106", "0.566164", "0.5657089", "0.5656527", "0.5653843", "0.5653843", "0.56519955" ]
0.0
-1
DELETE /eods/1 DELETE /eods/1.json
def destroy @eod.destroy respond_to do |format| format.html { redirect_to eods_url, notice: 'Eod was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete(*rest) 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 delete\n request(:delete)\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete!( opts = {} )\n http_action :delete, nil, opts\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 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 cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def delete(oid)\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: Alien.delete(params[\"id\"])\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete\n api(\"Delete\")\n end", "def delete(path)\n RestClient.delete request_base+path\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 execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete(*args)\n request(:delete, *args)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete!\n request! :delete\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete\n @client.delete_document(@path)\n end", "def deleteEntityEmployee( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/employee\",params)\n end", "def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete\n\n end", "def delete\n \n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def delete\n \n end", "def delete\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def destroy\n @ephem.destroy\n respond_to do |format|\n format.html { redirect_to ephems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @edetail = Edetail.find_by(id: params[:id])\n @edetail.destroy\n respond_to do |format|\n format.html { redirect_to edetails_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 delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n 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(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @ovode = Ovode.find_by_url(params[:id])\n @ovode.destroy\n\n respond_to do |format|\n format.html { redirect_to ovodes_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @employee_events = EmployeeEvent.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @employee_event.delete\n elsif params[:type]=='restore'\n @employee_event.restore\n @employee_event.update(deleted_at: nil)\n end\n\n @employee_event.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Host was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @eou = Eou.find(params[:id])\n @eou.destroy\n\n respond_to do |format|\n format.html { redirect_to eous_url }\n format.json { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete!(*rest) end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @soiree = Soiree.find(params[:id])\n @soiree.destroy\n\n respond_to do |format|\n format.html { redirect_to soirees_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n @evclient = Evclient.find(params[:id])\n @evclient.destroy\n\n respond_to do |format|\n format.html { redirect_to evclients_url }\n format.json { head :ok }\n end\n end", "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "def destroy\n @depoevento = Depoevento.find(params[:id])\n @depoevento.destroy\n\n respond_to do |format|\n format.html { redirect_to depoeventos_url }\n format.json { head :ok }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @etape = Etape.find(params[:id])\n @etape.destroy\n\n respond_to do |format|\n format.html { redirect_to etapes_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \tself.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id)).delete_one\n end", "def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end", "def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end", "def delete(*args)\n execute(:delete, *args)\n end", "def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end", "def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def destroy\n @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @eva.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: '評価を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @energy_datum = EnergyDatum.find(params[:id])\n @energy_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to energy_data_url }\n format.json { head :no_content }\n end\n end", "def delete(name)\n\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tetramod = Tetramod.find(params[:id])\n @tetramod.destroy\n\n respond_to do |format|\n format.html { redirect_to tetramods_url }\n format.json { head :no_content }\n end\n end", "def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end" ]
[ "0.7037621", "0.69911313", "0.6830123", "0.67439836", "0.67431396", "0.6724506", "0.66881603", "0.66881543", "0.66649115", "0.6638534", "0.6617207", "0.6617207", "0.6617207", "0.6617207", "0.660277", "0.6581897", "0.65782344", "0.65676016", "0.65528125", "0.65462583", "0.65462583", "0.6542322", "0.6541495", "0.6538207", "0.6534004", "0.65327436", "0.65324926", "0.6530716", "0.652996", "0.652761", "0.65257704", "0.65228426", "0.6520619", "0.6498244", "0.64873314", "0.6461912", "0.6457813", "0.6445907", "0.6442006", "0.6432989", "0.64263654", "0.6416993", "0.6414302", "0.6413395", "0.6412348", "0.64122856", "0.64042205", "0.64017236", "0.64017236", "0.64017236", "0.64017236", "0.64017236", "0.64017236", "0.64017236", "0.64016473", "0.6401397", "0.6400799", "0.6388268", "0.6385393", "0.6377854", "0.63773185", "0.63765484", "0.6369496", "0.6369496", "0.63636005", "0.6347617", "0.6346101", "0.6345895", "0.6334798", "0.6334524", "0.63259524", "0.63258356", "0.63156986", "0.63156986", "0.6311117", "0.63068676", "0.63034666", "0.6300601", "0.6299574", "0.6295323", "0.62913346", "0.62896144", "0.62888974", "0.62818015", "0.62804204", "0.6271192", "0.62687725", "0.6266857", "0.6266633", "0.6265577", "0.62609965", "0.6256318", "0.6252532", "0.6251183", "0.6250003", "0.6246648", "0.6244766", "0.6239313", "0.62320167", "0.62318724" ]
0.68679804
2
Use callbacks to share common setup or constraints between actions.
def set_eod @eod = Eod.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 setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; 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 workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; 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 shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def eod_params params.require(:eod).permit! 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
Helper methods Is user has specified permission ? perm:: Permission name
def has_perm? (perm) self.u_perms.each { |p| return true if perm == p.perm } false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permission?(permission_key)\n current_user_has_permission? permission_key\n end", "def has_permission?(perm)\n !permissions.nil? && permissions.include?(perm.to_sym)\n end", "def has_permission?(perm)\n !permissions.nil? && permissions.include?(perm.to_sym)\n end", "def has_permission?(permission)\n permissions.include? permission.to_s\n end", "def user?\n permissions == 'user'\n end", "def has_permission?(permission:)\n permissions.include? permission.to_sym\n end", "def user_permission\n has_controller_permission?('user')\n end", "def edit_user_permission?(permission)\n edit_user_permission = session.dig(:edit_user, 'permissions')\n return if edit_user_permission.nil?\n\n edit_user_permission.include?(permission)\n end", "def has_permission?(permission)\n permissions.include?(permission)\n end", "def has_permission?(repo, user, permission)\n RepositoryPermissionsService.permission_for(repo, user).try(:permission) == permission.to_s.downcase\n end", "def can?(permission)\n permissions.include?(permission.to_s) || super_admin?\n end", "def permission(name)\n permissions.detect { |p| p.name == name }\n end", "def has_permission?(permission)\n permission = permission.name if permission.is_a?(Permission)\n my_permissions.include?(permission)\n end", "def has_permission?(permission)\n current_permissions.include?(permission)\n end", "def has_permission?(permission)\n self.permissions.include?(permission)\n end", "def access_rights_for_permission(perm)\n sym = Lockdown.get_symbol(perm)\n\n permissions[sym]\n rescue \n raise SecurityError, \"Permission requested is not defined: #{sym}\"\n end", "def current_user_has_permission?(permission)\n CheckUserPermissions.new(current_user, current_guild).allowed?(permission)\n end", "def access_in_perm?(name)\n if perm = Lockdown::Configuration.permission(name)\n return session_access_rights.include?(perm.regex_pattern)\n end\n false\n end", "def has_permission?(level)\n return self.id == 220509153985167360 if level == :ink\n my_permission = self.class.bot_owner_permission\n case level\n when :user\n true\n when :moderator\n if self.id == 220509153985167360\n my_permission == :moderator || my_permission == :administrator\n else\n self.role?(469976942003748875) || self.role?(466545066924572674)\n end\n when :administrator\n if self.id == 220509153985167360\n my_permission == :administrator\n else\n self.role?(466545066924572674)\n end\n end\n end", "def checked_permission?(permission)\n new_user_permission = session.dig(:new_user, 'permissions')\n return if new_user_permission.nil?\n\n new_user_permission.include?(permission)\n end", "def accountant_can_write?(permission)\n session[:usertype].to_s == 'accountant' and session[\"acc_#{permission}\".to_sym].to_i == 2\n end", "def permission?()\n return nil\n end", "def has_access?(permission, user)\n raise UnknownUserException if user.nil?\n\n AccessProvider.action_permitted_for_user?(permission, user)\n end", "def has_access?(permission, user)\n raise UnknownUserException if user.nil?\n AccessProvider.is_action_permitted_for_user?(permission, user)\n end", "def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end", "def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\n end", "def moderator?\n permissions == 'moderator'\n end", "def has_user_permission?(object)\n object and object.user and current_user and object.user == current_user\n end", "def accountant_can_read?(permission)\n session[:usertype].to_s == 'accountant' and session[\"acc_#{permission}\".to_sym].to_i == 1\n end", "def ansible_check_permissions pb, u, uma\n u.info!\n perm = pb['extra_data']['PERMISSIONS'].split('')\n mod = perm.values_at(*Array.new(3) { |i| uma + 3 * i }).map { | value | value == '1' ? true : false }\n return (\n (u.id == pb['uid'] && mod[0]) ||\n (u.groups.include?(pb['gid']) && mod[1]) ||\n (mod[2]) ||\n (u.groups.include?(0))\n )\nend", "def has_permission?(required_permission)\n return true if self.is_admin\n load_permissions unless self.loaded_permissions.present?\n\n if self.loaded_permissions.include?(required_permission.upcase)\n return true\n else\n return false\n end\n end", "def authorise\n tmp_permission = @object_to_route_to.permission?\n if tmp_permission == \"yes\"\n permision_name = @pdt_method.method_name\n return @env.authorise(extract_actual_program_name(@pdt_method.program_name),permision_name,@user)\n elsif tmp_permission == nil\n return true\n else\n permision_name = tmp_permission\n return @env.authorise(extract_actual_program_name(@pdt_method.program_name),permision_name,@user)\n end\n\n end", "def user_permission(paid, cancelled, signed_in, admin)\n\tif paid == \"no\" or cancelled == \"yes\"\n\treturn \"Go away!\"\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\treturn \"You can see and change all the pages!\"\n\telsif signed_in == \"yes\" and admin == \"no\"\n\treturn \"You can see all the pages!\"\n\telsif signed_in == \"no\"\n\treturn \"You can't see any of the pages, please sign in!\"\n\tend\nend", "def has_permission_for_user(user, *permission)\n has_policy(Util.join_slice(user, *permission))\n end", "def add_user_permission(u)\n\t\t\n\tend", "def have_permission?(project, user)\n member = space_memberships.find_by(user: user)\n project.present? && member.lead_or_admin_or_contributor?\n end", "def evaluate_permission(permission, *args)\n # object; Event, Discount, etc\n o = args[0]\n # default to allow\n result = true\n role = get_role_of(o)\n\n\n # evaluate procs\n if (proc = PermissionUtilities.has_procs?(permission))\n result &= proc.call(o, self)\n end\n\n # Here is where the addition of adding collaborations may reside\n\n # finally, determine if the user (self) can do the requested action\n result &= allowed_to_perform?(permission, role)\n\n # so we don't need to do everything again\n cache.set_for_role(\n name: permission,\n value: result,\n role: role\n )\n\n result\n end", "def tiene_permiso?\n if not protect?(action_name)\n return true\n end\n if @session['user'] and autorizado?(@session['user'], controller_name)\n return true\n end\n store_location\n access_denied\n return false\n end", "def permission?(user, level, server)\n determined_level = if user.webhook? || server.nil?\n 0\n else\n user.roles.reduce(0) do |memo, role|\n [@permissions[:roles][role.id] || 0, memo].max\n end\n end\n\n [@permissions[:users][user.id] || 0, determined_level].max >= level\n end", "def has_permission_with?(user)\r\n\t\t\treturn user.has_permission?(privacy_owner, self.class.privacy_rule_name, privacy_object_id)\r\n\t\tend", "def can_access?\n allows_current_user_access_to? :access\n end", "def user_has_permission?( access_type )\n if @pcp_permission.nil? then\n determine_group_map( access_type )\n @pcp_group_act = @pcp_step.acting_group_index\n @pcp_permission = PcpSubject.same_group?( @pcp_group_act, @pcp_group_map )\n end \n @pcp_permission\n end", "def can_grant_permissions?\n perms.include? Perm.grant_permissions\n end", "def can_grant_permissions?\n perms.include? Perm.grant_permissions\n end", "def can?(thing)\n return true if admin?\n # Check if user is granted the function\n return true if granted?(thing)\n # Check if user is denied the function\n return false if denied?(thing)\n # Ignore \"System Admin\" function from CSUM/CSEM users\n return false if thing.include?(\"System Admin\")\n roles.include?(thing)\n end", "def show?\n @current_user.permission('Bid', :guest)\n end", "def check_permission(event, role)\n case role\n when 'botmaster'\n {\n granted: event.user.id == BOTMASTER_ID,\n allowed: ['botmasters']\n }\n else\n names = Role.owners(role).pluck(:username)\n {\n granted: Role.exists(event.user.id, role),\n allowed: role.pluralize #names\n }\n end\nend", "def user_permission(instance,current_user)\n\t\tcase instance\n\t\twhen User #IF THAT THING IS A USER, ONLY A USER OR AN ADMIN CAN CHANGE\n\t\t\ttrue if self.admin || instance == current_user\n\t\telse\n\t\t\t#IF THAT THING IS SOMETHING BESIDES A USER, ONLY AN ADMIN OR THE USER THAT THE THING BELONGS TO CAN CHANGE IT\n\t\t\ttrue if self.admin || instance.user == current_user\n\t\tend\n\tend", "def accountant_allow_read(permission)\n return accountant_right(permission) > 0\n end", "def check_permissions!(*which)\n Razor.config['auth.enabled'] and user.check_permissions(*which)\n true\n end", "def has_permission?(permission)\n permission=Permission.gfind(permission)\n permissions.reload.include?(permission)\n end", "def authorize?(user)\n user && user.moderator?\n end", "def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end", "def has_permission?\n if current_user == nil\n redirect_to ('/')\n end\n end", "def admin?\n permissions == 'admin'\n end", "def permiso_requerido\n if not protect?(action_name)\n return true\n end\n if @session['user'] and autorizado?(@session['user'], controller_name)\n return true\n end\n store_location\n access_denied\n return false\n end", "def setPermission( other_user, perm )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if not self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"creating special users group\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n self.special_users = {}\n end\n self.special_users[other_user.id.to_s] = perm\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"new permission:\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end", "def create?\n @current_user.permission('Bid', :clerk)\n end", "def valid_permission_level?(level)\n level == \"viewer\" or level == \"editor\" or level == \"admin\"\n end", "def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end", "def has_permission_char?(permchar, theoretically=false)\n has_permission?(Ricer::Irc::Permission.by_char(permchar), theoretically)\n end", "def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end", "def parse_permission(name)\n if name.reverse.index(VIEWER.reverse)\n return VIEWER\n elsif name.reverse.index(EDITOR.reverse)\n return EDITOR\n elsif name.reverse.index(USER.reverse)\n return USER\n elsif name.reverse.index(ADMIN.reverse)\n return ADMIN\n else\n @logger.info \"Error in parsing permission\"\n end\n nil\n end", "def parse_permission(name)\n if name.reverse.index(VIEWER.reverse)\n return VIEWER\n elsif name.reverse.index(EDITOR.reverse)\n return EDITOR\n elsif name.reverse.index(USER.reverse)\n return USER\n elsif name.reverse.index(ADMIN.reverse)\n return ADMIN\n else\n @logger.info \"Error in parsing permission\"\n end\n nil\n end", "def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end", "def perm_check(event)\n\t perms = {}\n @permissions.each do |p|\n if p == :bot_owner\n perms[p] = @bot.owners.include?(event.author.id)\n else\n perms[p] = event.author.permission?(p)\n end\n end\n if !perms.values.all?\n noperms = []\n perms.keys.each do |p|\n if !perms[p]\n noperms << p\n end\n end\n Commandorobo::NoPermission.new(noperms)\n else\n true\n end\n end", "def hasPermission user, resourceId, permissionType\n # first allow if resource has a webacls assigned to group \"pubic\"\n @webaclExists = Webacl.where(group_id: \"public\", resource_id: resourceId, acl_mode: permissionType).first\n if @webaclExists.nil?\n groupIds = Array.new\n user.groups.each do |group|\n groupIds.push(group.group_id)\n end\n resources = Webacl.where(:group_id => groupIds)\n @webaclExists = resources.where(resource_id: resourceId, acl_mode: permissionType).first\n end\n !@webaclExists.nil?\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def forum_admin?\n privilege?('User Manager')\n end", "def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end", "def public_access?(perm_symbol)\n obj = find_permission_object(perm_symbol)\n obj.nil? ? false : obj.public_access? \n end", "def permissions = {}", "def isAdmin?\n if session[:perm] == 1\n return true;\n else\n return false;\n end\n end", "def is_admin?\n\t\tself.permission_level >= 3\n\tend", "def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end", "def allow?(principle:, permission:)\n # Check in array order\n ordered_check(principle: principle, permission: permission, owner: owner, group: group)\n end", "def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end", "def user_permission_greater? page, level \n return true if admin\n \n # access for non-members is not permitted\n as_member = Member.first(:conditions => { :user_id => id, :project_id => page.project.id })\n return false if as_member.nil?\n\n # user specific permissions have preference\n #Rails.logger.info \"Accessing user permission for user #{id} / member #{as_member.id} and page #{page.id}\"\n user_permission = WikiPageUserPermission.first(\n :conditions => {\n :wiki_page_id => page.id,\n :member_id => as_member.id\n }\n )\n\n unless user_permission.nil?\n Rails.logger.info \"Level: #{user_permission.level} => #{level}\"\n return user_permission.level >= level\n end\n \n # check whether the user belongs to a role that has permissions set\n role_permissions = WikiPageRolePermission.find(:all, :conditions => {:wiki_page_id => page.id})\n unless role_permissions.nil? or as_member.roles.empty?\n roles_ids = as_member.roles.map { |x| x.id }\n Rails.logger.info \"Accessing role permission\"\n \n role_permissions.each do |role|\n if roles_ids.index(role.role_id)\n Rails.logger.info \"Role.level #{role.level} >= #{level}\"\n return role.level >= level\n end\n end\n end\n\n # check default permission\n Rails.logger.info \"Checking default\"\n (default = page.default_permission) ? default.level >= level : true\n end", "def get_permission_name(permission)\n case permission\n when Footprint32::PRIVATE\n return \"Private\"\n when Footprint32::FRIENDS\n return \"Friends\"\n else\n return \"Public\"\n end\n end", "def can_access?(user)\n user == self.user\n end", "def is_allowed(permission, rule)\r\n return true if rule == :all\r\n return true if rule == :edit && ( permission == :update ||\r\n permission == :delete ||\r\n permission == :create )\r\n permission == rule\r\n end", "def is_allowed(permission, rule)\r\n return true if rule == :all\r\n return true if rule == :edit && ( permission == :update ||\r\n permission == :delete ||\r\n permission == :create )\r\n permission == rule\r\n end", "def isModerador?\n if session[:perm] == 2\n return true;\n else\n return false;\n end\n end", "def show?\n @current_user.permission('Donor', :guest)\n end", "def user_permission(singed_in, admin, paid, cancelled)\n\tif paid == \"no\" or cancelled == \"yes\"\n\t\tputs(\"go away\")\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\t\tputs(\"You can see and change all the pages!\")\t\n\telsif signed_in == \"yes\" and admin == \"no\"\n\t\tputs(\"You can see all the pages!\")\n\telsif singed_in == \"no\" and admin == \"no\"\t\n\t\tputs(\"You can't see any of the pages, please sign in!\")\nend\nend", "def has_permission? *perms\n permissions.map(&:name).includes_all? *perms\n end", "def authorize?(person)\n person.is_admin?\n end", "def authorize?(user)\n required_perm = \"%s/%s\" % [ params[:controller], params[:action] ]\n\n if user.authorized? required_perm\n return true\n end\n\n return false\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def user_has_permissions?(*permission_set)\n return false if !(@user = authenticate_user)\n \n if !permission_set.is_a? Array\n permission_set = [ permission_set ]\n end\n \n if session[:user_is_superuser]\n for perm in permission_set\n perm = perm.to_s\n session[('user_can_' + perm).to_sym] = true\n end\n return true\n end\n \n for perm in permission_set\n perm = perm.to_s\n session[('user_can_' + perm).to_sym] ||= @user.send('can_' + perm).to_i == 1\n return session[('user_can_' + perm).to_sym]\n end\n end", "def can_authorize?(user, a)\n user != self and may_authorize and\n (abilities | ADMIN_TASKS).include?(a)\n end", "def manager_permission\n if session[:position].to_s == \"Manager\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n :position => session[:position]\n return false\n end\n end", "def has_resource_permission()\n resource = resource().find(params[:id])\n unless (current_user.admin? or current_user == resource)\n redirect_to(user_path(current_user), :alert => t(:permission_denied))\n end\n return true\n end", "def permitted?(model_name, requested_flags = 0)\n return false if self.kind != Kind::ROLE\n return true if admin?\n\n p = self.model_permissions.find_by_model(model_name)\n if requested_flags == 0\n p\n else\n p && p.permitted?(requested_flags)\n end\n end", "def authorization_required\n\n return true if is_admin?\n\n if !is_me?(@user)\n flash[:notice] = \"You don't have permission to do that.\"\n permission_denied\n false\n end\n end", "def can?(*args)\n permissions.can?(*args)\n end", "def can_access?(profile, options)\n \n can_access_resource = options.include?(attribute_get(:permission_modifier_all)) \n \n if profile and not can_access_resource\n superuser_access = profile.is_superuser?\n can_access_group = (options.include?(attribute_get(:permission_modifier_group)) and profile.usergroups.map{|item| item.group }.include?(attribute_get(:permission_group))) \n can_access_owner = (options.include?(attribute_get(:permission_modifier_owner)) and profile.username == attribute_get(:permission_owner))\n \n can_access_resource = (superuser_access or can_access_group or can_access_owner)\n end\n \n return can_access_resource\n \n end", "def require_permission\n if Goal.find(params[:id]).user != current_user\n redirect_to goals_url, flash: { error: \"You do not have permission to do that.\"}\n end\n end", "def can_modify_guidance?\n perms.include? Perm.modify_guidance\n end", "def can_modify_guidance?\n perms.include? Perm.modify_guidance\n end" ]
[ "0.7816381", "0.76925504", "0.7671803", "0.7650873", "0.7641437", "0.7624167", "0.7591785", "0.7566242", "0.7479298", "0.7401533", "0.73998207", "0.73507184", "0.7345575", "0.7329308", "0.7289794", "0.7253234", "0.72445464", "0.7239672", "0.7182424", "0.7142562", "0.71342486", "0.7103233", "0.7098816", "0.70903677", "0.7076429", "0.70574945", "0.7044887", "0.7038974", "0.7025328", "0.7020379", "0.6999777", "0.6994654", "0.6975587", "0.69629115", "0.6945649", "0.69243133", "0.6922579", "0.69224846", "0.6893384", "0.68518984", "0.684295", "0.6836765", "0.6829302", "0.6829302", "0.6827387", "0.6804675", "0.679981", "0.67689615", "0.6734827", "0.67326087", "0.6725665", "0.6725035", "0.67216045", "0.671946", "0.67036724", "0.6702996", "0.66870075", "0.6679928", "0.6678092", "0.66686565", "0.66600823", "0.6656155", "0.66484565", "0.6643647", "0.6642403", "0.6635215", "0.6624176", "0.6614946", "0.661489", "0.6612456", "0.6608966", "0.66074246", "0.66036", "0.6595596", "0.6581502", "0.6581144", "0.6580722", "0.6579329", "0.6559318", "0.65578526", "0.65577704", "0.65577704", "0.65526056", "0.65510726", "0.6546985", "0.65420955", "0.653919", "0.6533756", "0.6527138", "0.65262944", "0.652565", "0.65238136", "0.6522848", "0.6521892", "0.6521867", "0.65188015", "0.65155286", "0.650793", "0.65017456", "0.65017456" ]
0.6826681
45
Triangulation subroutine Takes as input vertices in array vertices Returned is a list of triangular faces in the array tris These triangles are arranged in a consistent clockwise order.
def triangulate(vertices) edges = [] tris = [] # sort by X coord vertices = vertices.sort_by {|p|p.x} # center/radius cache used by circum_circle cc_cache = {} # Set up the supertriangle # This is a triangle which encompasses all the sample points. # The supertriangle coordinates are added to the end of the # vertex list. The supertriangle is the first triangle in # the triangle list. number_of_vertices = vertices.size bounding_p1, bounding_p2, bounding_p3 = get_bounding_vertices(vertices) vertices << bounding_p1 << bounding_p2 << bounding_p3 tris << ITRIANGLE.new(number_of_vertices, number_of_vertices+1, number_of_vertices+2) # Include each point one at a time into the existing mesh vertices.each_with_index { |current_point, i| edges.clear # Set up the edge buffer. # If the point (xp,yp) lies inside the circumcircle then the # three edges of that triangle are added to the edge buffer # and that triangle is removed. j = 0 tris_size = tris.size while j < tris_size current_triangle = tris[j] if !current_triangle.complete p1 = vertices[current_triangle.p1] p2 = vertices[current_triangle.p2] p3 = vertices[current_triangle.p3] inside,xc,yc,r = circum_circle(current_point, p1, p2, p3, cc_cache) if (xc + r) < current_point.x current_triangle.complete = true end if inside edges << IEDGE.new(current_triangle.p1, current_triangle.p2) edges << IEDGE.new(current_triangle.p2, current_triangle.p3) edges << IEDGE.new(current_triangle.p3, current_triangle.p1) tris.delete_at(j) tris_size -= 1 j -= 1 end end j += 1 end #while j while !edges.empty? edge = edges.shift rejected = edges.reject! {|e| e == edge} tris << ITRIANGLE.new(edge.p1, edge.p2, i) if rejected.nil? end } #each i # Remove supertriangle vertices 3.times do vertices.pop end number_of_vertices = vertices.size # Remove triangles with supertriangle vertices # These are triangles which have a vertex number greater than number_of_vertices tris.delete_if {|tri| tri.p1 >= number_of_vertices || tri.p2 >= number_of_vertices || tri.p3 >= number_of_vertices} [ vertices, tris ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangulate(geometry)\n ring = geometry.exterior_ring\n\n input = ring.points.map { |point| [point.x, point.y] }\n input.pop if input.first == input.last\n\n cdt = Poly2Tri::CDT.new(input)\n cdt.triangulate!\n cdt.triangles\n end", "def validate_triangulation(triangles, message = true)\n # Remove to enable validation\n if (message)\n log \"=== skipping triangle validation ===\"\n end\n return\n # Partition things first into buckets to speed things up a bit\n buckets = []\n box_size = 2\n -180.step(179, box_size) do |x|\n inner_bucket = []\n -90.step(89, box_size) do |y|\n x_hi = x + box_size\n y_hi = y + box_size\n set = []\n triangles.each do |triangle|\n check = false\n triangle.points.each do |point|\n if (point.x >= x && point.x <= x_hi &&\n point.y >= y && point.y <= y_hi)\n check = true\n end\n end\n if (check)\n set.push(triangle)\n end\n end\n inner_bucket.push(set)\n end\n buckets.push(inner_bucket)\n end\n count = 0\n buckets.each do |bucket|\n bucket.each do |set|\n if (set.length > 0)\n count += set.length\n if (validate_triangle_bucket(set) == false)\n return false\n end\n end\n end\n end\n return true\nend", "def triangle(atomids)\n if atomids.size != 3\n raise SizeError\n end\n atoms = []\n atomids.each do |atomid|\n atom = atom_by_id(atomid)\n raise AtomNotFoundError, atomid unless atom\n atoms << atom\n end\n #pp atoms\n tri = CrystalCell::Povray::Triangle.new(\n *atoms.map { |atom| atom.position.to_v3d(self.axes)},\n CrystalCell::Povray::Element.color( atoms[0].element)\n )\n tri.to_pov\n end", "def raw_mesh_vertices\r\n vertices = []\r\n definition = TT::Instance.definition( @instance )\r\n for entity in definition.entities\r\n next unless entity.is_a?( Sketchup::Edge )\r\n vertices.concat( entity.vertices )\r\n end\r\n vertices.uniq!\r\n vertices\r\n end", "def topological_sort(vertices)\n arr = []\n next_v = []\n \n vertices.each do |v|\n if v.in_edges.empty?\n next_v.push(v) \n end \n end\n while next_v.length > 0\n current = next_v.shift\n arr.push(current)\n \n while current.out_edges.length > 0\n edge = current.out_edges.pop\n if edge.to_vertex.in_edges.length == 1\n next_v.push(edge.to_vertex) \n end \n edge.destroy!\n end\n end\n \n arr.length == vertices.length ? arr : []\n end", "def identifier_triangle_points\n point_to_triangles = []\n (@maillage_points.length+1).times do\n point_to_triangles << []\n end\n @triangles.length.times do |i|\n t = @triangles[i]\n point_to_triangles[t.p1.num] << i\n point_to_triangles[t.p2.num] << i\n point_to_triangles[t.p3.num] << i\n end\n return point_to_triangles\n end", "def vertices\n vertices = []\n\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n\n vertices\n end", "def mesh_vertices\r\n # private ?\r\n d = TT::Instance.definition( @instance )\r\n transformation = @instance.model.edit_transform\r\n points = mesh_points( final_subdivs, transformation )\r\n vertices = raw_mesh_vertices()\r\n\r\n # <debug>\r\n unless points.size == vertices.size\r\n Console.log( 'mesh_vertices' )\r\n Console.log( \"> Points: #{points.size}\" )\r\n Console.log( \"> Vertices: #{vertices.size}\" )\r\n end\r\n # </debug>\r\n\r\n patch_vertices = []\r\n for point in points\r\n vertex = vertices.find { |v| v.position == point } # (!) Optimize\r\n patch_vertices << vertex\r\n vertices.delete( vertex )\r\n end\r\n patch_vertices\r\n end", "def vertices\n (0...vertex_count).map { |i| self[i] }\n end", "def vertices\n end", "def vertices\n end", "def vertices\n to_a\n end", "def vertices\n VertexList.new(1, nil, [@centre])\n end", "def topological_sort(vertices)\n queue = []\n list = []\n vertices.each { |vertex| queue << vertex if vertex.in_edges.empty? }\n\n until queue.empty?\n removal = queue.shift\n list << removal\n\n removal.out_edges.each do |edge|\n outer_vertex = edge.to_vertex\n # remove the edge\n outer_vertex.in_edges.delete(edge)\n # check if that vertex has no more in_edges\n queue << outer_vertex if outer_vertex.in_edges.empty?\n end\n end\n # if successfully remove all vertices => the list will hold all the vertices => same length, else, it is not succeeded\n list.length == vertices.length ? list : []\nend", "def vertices\n\tend", "def topological_sort(vertices)\n queue = []\n list = []\n new_to_list = []\n\n vertices.each do |vertex|\n queue.push(vertex) if vertex.in_edges.length == 0\n end\n\n while queue.length > 0\n new_to_list = [].concat(queue)\n\n while !queue.empty?\n vertex = queue.pop\n end\n\n # Add neighbors of removed wo in edges\n new_to_list.each do |vertex|\n vertex.out_edges.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue << edge.to_vertex\n end\n edge.destroy!\n end\n end\n\n # Add new_to_list to list\n list = list.concat(new_to_list)\n new_to_list = []\n end\n\n if vertices.length == list.length\n return list\n else\n return []\n end\nend", "def topological_sort(vertices)\n return []\nend", "def face_to_lines(face)\n Kernel.raise \"non tris not supported\" if face.verts.length != 3\n v1, v2, v3 = face.verts.map { |vert| [vert.render_x, vert.render_y, vert.y] }.sort_by { |vert| vert.y }\n cross = VectorMath::normalize(VectorMath::cross3((face.verts[1] - face.verts[0]).row_vector, (face.verts[2] - face.verts[0]).row_vector))\n r = 254 * VectorMath::dot(cross,[0.0, 1.0, 0.0]).abs + 1\n g = 254 * VectorMath::dot(cross,[1.0, 0.0, 0.0]).abs + 1\n b = 254 * VectorMath::dot(cross,[0.0, 0.0, 1.0]).abs + 1\n g = b = r\n out = draw_tri(v1.x,v1.y,v2.x,v2.y,v3.x,v3.y,r,g,b)\nend", "def topological_sort(vertices)\n sorted, queue = [], []\n\n vertices.each do |vtx|\n queue << vtx if vtx.in_edges.empty?\n end\n\n until queue.empty?\n next_vtx = queue.shift\n sorted << next_vtx\n #enumerable tracks index so destroy throws\n #off the each method\n until next_vtx.out_edges.empty?\n edge = next_vtx.out_edges.first\n dependent = edge.to_vertex\n edge.destroy!\n if dependent.in_edges.empty?\n queue << dependent\n end\n end\n vertices.delete(next_vtx)\n end\n return [] if vertices.count > 0\n sorted\nend", "def topological_sort(vertices)\n queue = []\n result = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.push(vertex)\n end\n end\n\n until queue.empty?\n vertex = queue.shift\n result << vertex\n\n vertex.out_edges.dup.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex) \n end\n edge.destroy!\n end\n end\n \n if vertices.length == result.length\n return result\n else\n return []\n end\nend", "def vertices\n @vert\n end", "def topological_sort(vertices)\n vertex_queue = []\n sorted_queue = []\n\n vertex_count = {}\n\n #vertex queue has vertex which do not have any in_edges\n vertices.each do |vertex|\n vertex_count[vertex] = vertex.in_edges.count\n vertex_queue << vertex if vertex.in_edges.empty?\n end\n\n # while !vertex_queue.empty?\n until vetex_queue.empty?\n new_vertex = vertex_queue.shift\n sorted_queue << new_vertex\n\n new_vertex.out_edges.each do |out|\n to_vertex = out.to_vertex\n\n vertex_count[to_vertex] -= 1\n vertex_queue << to_vertex if vertex_count[to_vertex] == 0\n end\n end\n sorted_queue\nend", "def topological_sort(vertices)\n queue = Queue.new\n sorted_arr = []\n in_edges_count = {}\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n in_edges_count[vertex] = vertex.in_edges.length\n end\n\n until queue.empty?\n test_vertex = queue.shift\n\n sorted_arr << test_vertex\n test_vertex.out_edges.each do |edge|\n destination_vertex = edge.to_vertex\n in_edges_count[destination_vertex] -= 1\n queue << destination_vertex if in_edges_count[destination_vertex].zero?\n end\n end\n\n return [] if sorted_arr.length < vertices.length\n sorted_arr\nend", "def topological_sort(vertices)\n queue = []\n sorted = []\n # keep track of vertex in_edges count so that\n # it doesnt get prematurely pushed into queue\n count = {}\n\n # find started vertexes\n vertices.each do |vertex|\n queue.push(vertex) if vertex.in_edges.empty?\n count[vertex] = vertex.in_edges.count\n end\n\n until queue.empty?\n vertex = queue.shift\n sorted << vertex\n vertex.out_edges.each do |edge|\n vert = edge.to_vertex\n count[vert] -= 1\n queue.push(vert) if count[vert] == 0\n end\n end\n\n sorted.count == vertices.count ? sorted : []\nend", "def topological_sort(vertices)\n\n sorted = []\n sub_ans = []\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n sub_ans.push(vertex)\n end\n end\n\n return sub_ans if sub_ans.empty?\n\n until sub_ans.empty?\n current = sub_ans.shift\n sorted << current\n current.out_edges.each do |edge|\n edge.to_vertex.in_edges.delete(edge)\n if edge.to_vertex.in_edges.empty?\n sub_ans.push(edge.to_vertex)\n end\n end\n end\n if sorted.length < vertices.length\n return []\n end\n sorted\nend", "def topological_sort(vertices)\n queue = []\n list = []\n\n vertices.each do |v|\n if v.in_edges.empty?\n queue << v\n end\n end\n\n\n while queue.length > 0\n curr = queue.shift\n list << curr\n\n (curr.out_edges.length-1).downto(0) do |i|\n if curr.out_edges[i].to_vertex.in_edges.length == 1\n queue << curr.out_edges[i].to_vertex\n end\n curr.out_edges[i].destroy!\n end\n end\n\n vertices.length == list.length ? list : []\nend", "def topological_sort(vertices)\n next_vertex = Queue.new\n result = []\n vertices.each do |vertex|\n next_vertex.push(vertex) if vertex.in_edges.length < 1\n end\n\n while !next_vertex.empty?\n vertex = next_vertex.pop\n vertex.out_edges.each do |edge|\n new_vertex = edge.to_vertex\n next_vertex.push(new_vertex) if new_vertex.in_edges.length <= 1\n end\n vertex.out_edges.each{|edge| edge.destroy!}\n result.push(vertex)\n end\n result\nend", "def topological_sort(vertices)\n queue = []\n list = []\n vertices.each { |vertex| queue << vertex if vertex.in_edges.empty? }\n\n until queue.empty?\n removal = queue.shift\n list << removal\n\n removal.out_edges.each do |edge|\n outer_vertex = edge.to_vertex\n\n outer_vertex.in_edges.delete(edge)\n\n queue << outer_vertex if outer_vertex.in_edges.empty?\n end\n end\n\n return list if list.length == vertices.length\n\n []\nend", "def topological_sort(vertices)\n queue = []\n result = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.push(vertex)\n end\n end\n\n until queue.empty?\n vertex = queue.shift\n result << vertex\n\n vertex.out_edges.reverse.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex)\n end\n edge.destroy!\n end\n end\n\n if vertices.length == result.length\n return result\n else\n return []\n end\nend", "def vertices\n @vertices\n end", "def topological_sort(vertices)\n sorted = []\n top_queue = []\n # vertices_hash = {}\n\n # vertices.each { |vertex| vertices_hash[vertex] = true }\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top_queue << vertex\n end\n end\n\n until top_queue.empty?\n current_vertex = top_queue.shift\n sorted << current_vertex\n\n until current_vertex.out_edges.empty?\n edge = current_vertex.out_edges[0]\n neighbor = edge.to_vertex\n edge.destroy!\n\n if neighbor.in_edges.empty?\n top_queue.push(neighbor)\n end\n\n end\n # vertices_hash.delete(current_vertex)\n end\n\n # vertices_hash.empty? ? sorted : []\n # Or\n sorted.length == vertices.length ? sorted : []\nend", "def left_tri(tri)\n\nend", "def polygon_vertices(sides, size)\n vertices = []\n sides.times do |i|\n angle = -2 * Math::PI * i / sides\n vertices << angle.radians_to_vec2() * size\n end\n return vertices\n end", "def topological_sort(vertices)\n res = []\n queue = []\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n vertex = queue.shift\n res << vertex\n out_edges = vertex.out_edges.dup\n out_edges.each do |edge|\n queue << edge.to_vertex if edge.to_vertex.in_edges.length == 1\n edge.destroy!\n end\n end\n res\nend", "def topological_sort(vertices)\n \nend", "def polygon_vertices(sides, size)\n vertices = []\n sides.times do |i|\n angle = -2 * Math::PI * i / sides\n vertices << radians_to_vec2(angle) * size\n end\n return vertices\n end", "def topological_sort(vertices)\n sorted = []\n queue = []\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current_vert = queue.shift\n sorted << current_vert\n current_vert.out_edges.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue << edge.to_vertex\n end\n end\n current_vert.out_edges.each do |edge|\n edge.destroy!\n end\n end\n\n return [] if sorted.length < vertices.length\n sorted\nend", "def vertices\n [\n pos,\n Vertex.new(pos.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z),\n Vertex.new(pos.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x, pos.y + dims.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z + dims.z)\n ]\n end", "def topological_sort(vertices)\n sorted = []\n top = []\n\n vertices.each do |vertx|\n if vertx.in_edges.empty?\n top << vertx\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n\n edges = current.out_edges.dup\n\n edges.each do |edge|\n\n destination = edge.to_vertex\n\n edge.destroy!\n\n if destination.in_edges.empty?\n top << destination\n end\n\n end\n\n end\n return sorted if sorted.length == vertices.length\n []\nend", "def topological_sort(vertices)\n list = []\n sorted = []\n count_set = {}\n\n vertices.each do |vertex|\n count_set[vertex] = vertex.in_edges.count\n list << vertex if vertex.in_edges.empty?\n end\n\n until list.empty?\n vertex = list.shift\n sorted << vertex\n\n vertex.out_edges.each do |edge|\n to = edge.to_vertex\n count_set[to] -= 1\n list << to if count_set[to] == 0\n end\n end\n\n if sorted.length == vertices.length\n sorted\n else\n []\n end\nend", "def getTri()\n\t#open file\n\tf=File.open(\"tri.txt\", \"r\")\n\t#init tri array\n\ttri = []\n\t#for each line\n\tf.each_line do |line|\n\t\t#strip end line chars\n\t\tline.strip!\n\t\t#read into array of fixnum\n\t\ttri << line.split(' ').map(&:to_i)\n\tend\n\t#close file\n\tf.close\n\t#return triangle array\n\treturn tri\nend", "def topological_sort(vertices)\n sorted = []\n queue = []\n vertices.each do |v|\n queue << v if v.in_edges.empty?\n end\n until queue.empty?\n u = queue.shift\n until u.out_edges.empty?\n e = u.out_edges.pop\n v = e.to_vertex\n e.destroy!\n queue << v if v.in_edges.empty?\n end\n sorted << u\n vertices.delete(u)\n end\n vertices.empty? ? sorted : []\nend", "def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end", "def topological_sort(vertices)\n visited = vertices.map { |v| [v, false] }.to_h\n result = []\n visited.each do |vertex, status|\n begin\n visit(vertex, visited, result) unless status\n rescue\n result = []\n break\n end\n end\n result\nend", "def t\n adj_t = Array.new(vertices.length) { [] }\n adj.each_with_index do |adj_j, j|\n adj_j.each do |v|\n adj_t[vertices.index(v)] << vertices[j]\n end\n end\n dup.tap { |g| g.adj = adj_t }\n end", "def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end", "def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end", "def triangulate(points)\n case points.length\n when 0\n Hull.new([])\n\n when 1\n Hull.new(points)\n\n when 2\n points[0].add(points[1])\n points[1].add(points[0])\n Hull.new(points)\n\n when 3\n h = Hull.new(points)\n\n # Because points are known to be sorted, p1 is leftmost and p3 is rightmost\n p1, p2, p3 = points\n\n # Connect points to each other in counterclockwise order\n cross = p2.cross(p1, p3)\n if cross < 0\n # p2 is right of p1->p3; put p2 on the bottom\n p1.add(p2)\n p2.add(p3)\n p3.add(p1)\n\n p3.add(p2)\n p2.add(p1)\n p1.add(p3)\n elsif cross > 0\n # p2 is left of p1->p3; put p2 on the top\n p1.add(p3)\n p3.add(p2)\n p2.add(p1)\n\n p1.add(p2)\n p2.add(p3)\n p3.add(p1)\n else\n # p2 is on a line between p1 and p3; link left-to-right\n p1.add(p2)\n p2.add(p3)\n\n p3.add(p2)\n p2.add(p1)\n end\n\n h\n\n else\n # 4 or more points; divide and conquer\n n = points.length / 2\n left = points[0...n]\n right = points[n..-1]\n\n merge(triangulate(left), triangulate(right))\n end\n end", "def polygon_vertices(sides, size)\n return [CP::Vec2.new(-size, size), CP::Vec2.new(size, size), CP::Vec2.new(size, -size), CP::Vec2.new(-size, -size)]\n end", "def tarian_topological_sort(vertices)\n sorted = []\n visited = Set.new\n\n vertices.each do |vertex|\n dfs!(vertex, visited, sorted) unless visited.include?(vertex)\n end\n\n sorted\nend", "def topological_sort(vertices)\n list = []\n queue = []\n\n queue = enqueue(vertices, queue)\n\n until queue.empty?\n vertex = queue.shift\n list << vertex\n\n new_vertices = vertex.out_edges.map(&:to_vertex)\n out_edges = vertex.out_edges.dup\n\n out_edges.each(&:destroy!)\n vertex.out_edges = []\n\n queue = enqueue(new_vertices, queue)\n end\n\n list.length == vertices.length ? list : []\nend", "def get_vertices\n getVertices.iterator.to_route(:graph => self, :element_type => :vertex)\n end", "def verts_on_paths(current_vertex, t, current_path=[], paths=[])\n if current_vertex == t\n paths << current_path + [current_vertex]\n else\n adjacent_undirected(current_vertex).each do |v|\n # Don't recur if we're repeating vertices (i.e. reject non-simple paths)\n verts_on_paths(v, t, current_path + [current_vertex], paths) if current_path.count(current_vertex) == 0\n end\n end\n \n paths.flatten.uniq\n end", "def topological_sort(vertices)\n queue = []\n result = []\n count = {}\n vertices.each do |vertex|\n count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n vertex = queue.shift\n result << vertex\n vertex.out_edges.each do |edge|\n to = edge.to_vertex\n count[to] -= 1\n queue << to if count[to] == 0\n end\n end\n if count.values.reduce(:+).zero?\n result\n else\n []\n end\nend", "def vertices\n result = [[@origin_x, @origin_y, @origin_z]]\n dimensions = [@length, @width, @height]\n \n dimensions.each_with_index do |dimension, index|\n temp = result[0].dup\n temp[index] += dimension\n result << temp\n (index...dimensions.length).each do |index2|\n next if index == index2\n temp2 = temp.dup\n temp2[index2] += dimensions[index2]\n result << temp2\n end\n end\n result << [@origin_x + @length, @origin_y + @width, @origin_z + @height]\n result\n end", "def topological_sort(vertices)\n sorted = []\n queue = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n sorted << current\n\n current.out_edges.dup.each do |edge|\n next_vertex = edge.to_vertex\n edge.destroy!\n if next_vertex.in_edges.empty?\n queue << next_vertex\n end\n\n end\n end\n\n sorted.count == vertices.count ? sorted : []\nend", "def topological_sort(vertices)\n sorted = []\n top = []\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top << vertex\n end\n end\n\n until top.empty?\n vertex = top.shift\n sorted << vertex\n neighbors = vertex.out_edges.map(&:to_vertex)\n\n vertex.disconnect!\n\n neighbors.each do |neighbor|\n if neighbor.in_edges.empty?\n top << neighbor\n end\n end\n end\n\n return sorted if sorted.length == vertices.length\n\n []\nend", "def add_triangle(points: nil)\n fail \"Needs an array of 3 points\" if points.nil?\n fail \"Needs an array of 3 points\" unless points.length.eql? 3\n \n self.add_moveto(points[0])\n self.add_lineto(points[1])\n self.add_lineto(points[2])\n self.add_lineto(points[0])\n self.add_closesubpath()\n end", "def topological_sort(vertices)\n queue = vertices.select { |vertex| vertex.in_edges.empty? }\n sorted_vertices = []\n\n until queue.empty?\n vertex = queue.shift\n vertices.delete(vertex)\n vertex.out_edges.length.times do\n out_edge = vertex.out_edges[0]\n to_vertex = out_edge.to_vertex\n queue.push(to_vertex) if to_vertex.in_edges.length == 1\n out_edge.destroy!\n end\n\n sorted_vertices.push(vertex)\n end\n\n vertices.empty? ? sorted_vertices : []\nend", "def vertices\n @vertices.keys\n end", "def topological_sort(vertices)\n queue = []\n order = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n order << current\n\n current.out_edges.dup.each do |edge|\n to_vert = edge.to_vertex\n queue << to_vert if to_vert.in_edges.count <= 1\n edge.destroy!\n end\n end\n\n order.length == vertices.length ? order : []\nend", "def topological_sort(vertices)\n #Khan's\n sorted = []\n top = []\n has_in_edges = {}\n\n # O(|v|) time\n #take vertex if it has no in-edges\n vertices.each do |vertex|\n has_in_edges[vertex] = vertex.in_edges.length\n if vertex.in_edges.empty?\n top.push(vertex)\n end\n end\n\n # O(|e| set) time\n until top.empty?\n current = top.shift\n sorted.push(current)\n current.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n has_in_edges[to_vertex] -= 1\n if has_in_edges[to_vertex] == 0\n top.push(to_vertex)\n end\n end\n\n end\n\n return sorted if sorted.length == vertices.length\n []\nend", "def topological_sort(vertices)\n num_edges = {}\n queue = []\n\n vertices.each do |vertex|\n num_edges[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n sorted = []\n\n while queue.length > 0\n vertex = queue.shift\n sorted.push(vertex)\n\n vertex.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n\n num_edges[to_vertex] -= 1\n if num_edges[to_vertex] == 0\n queue.push(to_vertex)\n end\n end\n end\n\n if sorted.length == vertices.length\n sorted\n else\n []\n end\nend", "def mesh2strips(n,a)\n dx = 2.0/n\n dy = 2.0/n\n row = n+1\n\n n.times do |j|\n glBegin(GL_TRIANGLE_STRIP)\n rowi = j*row\n row.times do |x|\n add_vertex(a[rowi+x])\n add_vertex(a[rowi+row+x])\n end\n glEnd\n end\n end", "def triangles()\n @triangles = []\n loop_start_time = Time.now\n while @triangles.size != @count\n begin\n t = Triangle.new(*random_coordinate_triplet)\n if t.possible? && within_threshold(t) && within_threshold2(t)\n @triangles << t\n else\n if (Time.now - loop_start_time) > 10\n raise 'too much calculation'\n end\n end\n rescue Math::DomainError\n puts \"Out of domain... trying again.\"\n end\n end\n @triangles\n end", "def topological_sort(vertices)\n count = {}\n sorted = []\n free_queue = []\n\n vertices.each do |vertex|\n count[vertex.value] = vertex.in_edges.length\n if vertex.in_edges.empty?\n free_queue.unshift(vertex)\n end\n end\n\n until free_queue.empty?\n # debugger\n current = free_queue.pop\n # p free_queue.map{|e|e.value}\n sorted << current\n # p current.out_edges.length\n verts = []\n current.out_edges.each do |edge|\n count[edge.to_vertex.value] -= 1\n # vert = edge.to_vertex\n # verts << vert\n end\n\n\n vertices.each do |vertex|\n free_queue.unshift(vertex) if count[vertex.value] == 0 && sorted.index(vertex).nil?\n end\n\n end\n sorted = sorted.uniq\n return [] if sorted.length != vertices.length\n sorted\nend", "def triangle(a, b, c)\n #sort arguments by length\n triangle_array = [a, b, c].sort\n\n #initialize variables to sorted sides\n x = triangle_array[0]\n y = triangle_array[1]\n z = triangle_array[2]\n \n # rule out invalid triangles\n if x + y <= z || (x*y*z) == 0\n return :invalid\n end\n\n if x == y && x == z\n :equilateral\n elsif x == y || x == z || y == z\n :isosceles\n else\n :scalene\n end\nend", "def topological_sort(vertices)\n # visited = Set.new\n # # visited = Array.new(vertices.length, false)\n # cycle = [false]\n # result = []\n #\n # vertices.each do |vertex|\n # unless visited.include?(vertex)\n # visit(vertex, visited, result, cycle)\n # end\n # end\n #\n # if cycle == [true]\n # return []\n # else\n # return result\n # end\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n queue = []\n result = []\n vertices.each do |vert|\n queue << vert if vert.in_edges.empty?\n end\n # byebug\n count = 0\n until queue.empty?\n vertex = queue.pop\n result << vertex\n to_destroy = []\n for i in (0..(vertex.out_edges.length - 1))\n edge = vertex.out_edges[i]\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex)\n end\n to_destroy << edge\n i += 1\n end\n to_destroy.each do |edge|\n edge.destroy!\n end\n count += 1\n end\n result\nend", "def topological_sort(vertices)\n queue = fill_queue(vertices)\n result = []\n \n i = 0\n while queue \n vert = queue.pop\n vert.out_edges.map do |edge|\n queue.unshift(edge.to_vertex)\n edge.destroy! \n end\n result << vert\n fill_queue(vertices) if queue.empty? && !(vertices.empty?)\n end\n\n return vertices.empty? ? [] : result\nend", "def topological_sort(vertices)\n queue = []\n order = []\n in_edge_count = {}\n\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queeue.shift\n order << current\n\n current.out_edges.each do |edge|\n to_vert = edge.to_vertex\n in_edge_count[to_vert] -= 1\n queue << to_vert if in_edge_count[to_vert] == 0\n end\n\n end\n\n order.length == vertices.length ? order : []\nend", "def topological_sort(vertices)\n queue = []\n order = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n curr = queue.shift\n neighbors = []\n curr.out_edges.each {|edge| neighbors << edge.to_vertex }\n\n curr.out_edges.each {|edge| edge.destroy!}\n\n neighbors.each do |adj|\n queue << adj unless queue.include?(adj)\n end\n\n vertices.delete(curr)\n order << curr\n end\n\n return [] unless order.uniq.length == order.length\n order\nend", "def topological_sort(vertices)\n results = []\n queue = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue << vertex\n end\n end\n\n until queue.empty?\n current_node = queue.pop\n current_node.out_edges.each do |node|\n node.destroy!\n end\n end\nend", "def get_transpose()\n transpose_graph = Graph.new(26)\n\n for i in 0..@number_of_vertices -1 do\n @adjacent_list[i].each do |x|\n transpose_graph.add_edge(x, i)\n end\n end\n\n transpose_graph\n end", "def topological_sort(vertices)\n in_edge_count = {}\n queue = []\n visited = {}\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n sorted = []\n\n until queue.empty?\n vertex = queue.pop\n sorted << vertex\n\n vertex.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n in_edge_count[to_vertex] -= 1\n queue << to_vertex if in_edge_count[to_vertex] == 0\n end\n end\n sorted.length == vertices.length ? sorted : []\nend", "def topological_sort(vertices)\n sorted = []\n top = []\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top.push(vertex)\n end\n end\n until top.empty?\n current = top.pop\n sorted.push(current)\n current.out_edges.each do |edge|\n if (edge.to_vertex.in_edges - [edge]).empty?\n top.push(edge.to_vertex)\n end\n end\n current.out_edges.each do |edge|\n edge.destroy!\n end\n # vertices.delete(current)\n end\n sorted.length == vertices.length ? sorted : []\nend", "def topological_sort(vertices)\n in_edge_count = {}\n list = []\n queue = []\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n u = queue.shift\n list << u\n u.out_edges.each do |vertex|\n to_vertex = vertex.to_vertex\n in_edge_count[to_vertex] -= 1\n queue << to_vertex if in_edge_count[to_vertex] == 0\n end\n end\n list\nend", "def vertices\n @vertices\n end", "def triangle_test(x)\n\t#split input into array\n array = x\n\t\n #delete first array so only dealing with triangle sides\n array.delete_at(0)\n \n #split array into smaller array of arrays of 3 sides each\n triangle_arrays = array.each_slice(3).to_a \n\n #iterate through each \"triangle\"\n triangle_arrays.each do |a, b, c|\n\n if (a == b) && (a == c)\n puts \"Equilateral\"\n elsif (a == b) || (a == c) || (b == c)\n puts \"Isoceles\"\n else\n puts \"None of these\"\n end\n\nend\n \nend", "def inward_vertices(vertex, a_lists)\n inward = []\n adj_lists.each do |v|\n adj_vertices(v.name, a_lists).each do |adj_v|\n if adj_v == vertex\n inward << v.name\n break\n end\n end\n end\n inward\n end", "def install_order(arr)\n vertices = {}\n max = 0 \n arr.each do |tuple|\n vertices[tuple[0]] = Vertex.new(tuple[0]) unless verticles[tuple[0]]\n vertices[tuple[1]] = Vertex.new(tuple[1]) unless verticles[tuple[1]]\n # create an edge for each pair \n\n Edge.new(vertices[tuple[1]], vertices[tuple[0]])\n\n max = tuple.max if tuple.max > max \n end \n\n independent = []\n (1..max).each do |i| \n independent << i unless vertices[i]\n end \n\n independent + topological_sort(vertices.values).map { |v| v.value }\nend", "def topological_sort_khans(vertices)\n sorted = []\n queue = []\n in_degrees = {}\n\n vertices.each do |vertex|\n queue.unshift(vertex) if vertex.in_count == 0\n in_degrees[vertex] = vertex.in_count\n end\n\n until queue.empty?\n current = queue.pop\n sorted << current\n\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n\n in_degrees[destination] -= 1\n queue.unshift(destination) if in_degrees[destination] == 0\n end\n\n end\n\n sorted\nend", "def triangle(a, b, c)\n #\n # My first solution\n #\n # # Test that the triangle is valid\n # # No side can be <= 0\n # raise TriangleError if a <= 0 || b <= 0 || c <= 0\n # # Sum of any two sides must be > third side\n # raise TriangleError if a >= b+c || b >= a+c || c >= a+b\n\n # return :equilateral if a == b && b == c\n # return :isosceles if a == b || b == c || a == c\n # return :scalene\n #\n\n #\n # The Stack Overflow assisted version\n #\n\n # Sort the triangle sides in ascending order such that a is the smallest\n a, b, c = sides = [a, b, c].sort\n\n # If a <= 0\n raise TriangleError if a <= 0 || a + b <= c\n # Slightly easier to read version:\n # raise TriangleError unless a > 0 || a + b > c\n\n # Find out how many unique lengths there are. If 1, return :equilateral; if\n # 2, return :isoceles; if 3, return :scalene. Note the clever usage of the\n # negative indexing into the array to directly map the number of unique sides\n # to the type of triangle without needing to pad the array\n [:scalene, :isosceles, :equilateral][-sides.uniq.size]\nend", "def topological_sort(vertices)\n in_edge_store = {}\n queue = []\n\n vertices.each do |vertex|\n in_edge_store[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n ordered_vertices = []\n until queue.empty?\n current_vertex = queue.shift\n ordered_vertices << current_vertex\n current_vertex.out_edges.each do |edge|\n next_vertex = edge.to_vertex\n in_edge_store[next_vertex] -= 1\n queue << next_vertex if in_edge_store[next_vertex] == 0\n end\n end\n\n ordered_vertices\nend", "def topological_sort(vertices)\n out_queue = []\n sorted = []\n sorted_hash = {}\n\n until sorted.length == vertices.length \n out_queue = vertices.select do |v| \n v.in_edges.empty? && !sorted_hash.include?(v.value)\n end\n # Break if Cyclic/Disconnected Graph\n return [] if out_queue.empty?\n\n until out_queue.empty?\n vertice = out_queue.shift\n sorted << vertice\n sorted_hash[vertice.value] = true\n vertice.out_edges[0].destroy! until vertice.out_edges.empty?\n end\n end\n\n sorted\nend", "def add_vertices(*a)\n a.each { |v| add_vertex v }\n end", "def topological_sort(vertices)\n sorted = []\n top = []\n \n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top << vertex\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n current.out_edges.each do |edge|\n if edge.to_vertex.in_edges.empty?\n top << edge.to_vertex\n end\n edge.destroy!\n end\n vertices.delete(current)\n end\n sorted\nend", "def subdivide\n ab = (midpoint a, b).normalize\n bc = (midpoint b, c).normalize\n ca = (midpoint c, a).normalize\n smallerTriangles = Array.new\n smallerTriangles << (Triangle.new a, ab, ca)\n smallerTriangles << (Triangle.new ab, b, bc)\n smallerTriangles << (Triangle.new bc, c, ca)\n smallerTriangles << (Triangle.new ab, bc, ca)\n end", "def pascals_triangle(n)\n triangles = [[1]]\n while triangles.length < n\n triangles << next_line(triangles[-1])\n end\n triangles\nend", "def topological_sort(vertices)\n sorted = []\n top_nodes_queue = []\n\n vertices.each do |vertix|\n top_nodes_queue.push(vertix) if vertix.in_edges.length == 0\n end\n\n until top_nodes_queue.empty?\n unpopped = top_nodes_queue.shift\n sorted << unpopped\n\n (unpopped.out_edges.length - 1).downto(0).each do |index|\n edge = unpopped.out_edges[index]\n if edge.to_vertex.in_edges.length == 1\n\n top_nodes_queue.push(edge.to_vertex)\n end\n to_vertex = edge.to_vertex\n edge.destroy!\n end\n end\n\n return [] unless vertices.length == sorted.length\n sorted\nend", "def topological_sort(vertices)\n sorted = []\n queue = []\n in_edge_counts = {}\n\n vertices.each do |vertex|\n in_edge_counts[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n sorted << current\n\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n in_edge_counts[destination] -= 1\n queue << destination if in_edge_counts[destination] == 0\n end\n end\n sorted\nend", "def triangle(a,b,c)\n raise TriangleError unless is_valid_triangle?(a,b,c)\n h = [a]\n h << b unless h.include?(b)\n h << c unless h.include?(c)\n return :equilateral if h.length == 1\n return :isosceles if h.length == 2\n :scalene\nend", "def triangle(a, b, c)\n sides = [a,b,c]\n validate_sides(sides)\n\n unique_side_lengths = sides.uniq.length\n\n case unique_side_lengths\n when 1\n :equilateral\n when 2\n :isosceles\n when 3\n :scalene\n end\nend", "def topological_sort(vertices)\n in_edges = {}\n result = []\n queue = vertices.select do |vertex|\n in_edges[vertex] = vertex.in_edges.length\n vertex.in_edges.empty?\n end\n\n until queue.empty?\n vertex = queue.pop\n result.push(vertex)\n vertex.out_edges.map(&:to_vertex).each do |vertex|\n in_edges[vertex] -= 1\n queue.unshift(vertex) if in_edges[vertex] == 0\n end\n end\n in_edges.all?{|vertex,count| count == 0} ? result : []\n\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort\n return :invalid if arr[0] + arr[1] <= arr[2]\n return :equilateral if arr[0] == arr[1] && arr[1] == arr[2]\n return :isosceles if arr.uniq.size == 2\n return :scalene if arr.uniq.size == 3\nend", "def triangle_interp str\r\n\ttriangle = str.split(/\\n/)\r\n\ttriangle.each_with_index { |row, i| triangle[i] = row.split(/\\s/)}\r\nend", "def topological_sort(vertices)\n sorted = []\n top = Queue.new\n vertices.each do |vertex|\n if vertex.in_edges.empty? \n top.enq(vertex)\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n while current.out_edges.length != 0\n edge = current.out_edges[0]\n if edge.to_vertex.in_edges == [edge]\n top.enq(edge.to_vertex)\n end\n edge.destroy!\n end\n\n end\n\n if sorted.length != vertices.length\n return []\n end\n\n sorted\nend", "def topological_sort(vertices)\n result = []\n visited = {}\n #Set visited hash to all false\n vertices.each { |vertex| visited[vertex] = false }\n\n # Until all nodes are visited\n until visited.all? { |vertex, visited| visited }\n\n #find the unvisited items.\n non_visited_vertices = visited.reject { |vertex, visited| visited }.keys\n\n #visit any unvisited vertex (arbitrarily the first)\n has_no_cycle = visit(non_visited_vertices[0],\n result, visited)\n\n # If there is a cycle then return an empty array.\n return [] if !has_no_cycle\n end\n\n #Return the result.\n result\n end", "def vertices\n (@structure.keys | @structure.values).flatten.uniq\n end", "def convex_sub_polygon\n subsets = []\n vertices.each_cons(3) do |p1, p2, p3|\n subsets << [p2, [p1, p2, p3]]\n end\n subsets.sort.first.last\n end", "def triangle(nrows)\n return [[1]] if nrows <= 1\n previous = triangle(nrows-1)\n center = previous[-1].enum_for(:each_cons, 2).map {|a| a[0] + a[1] }\n return previous << ( [1] + center + [1] )\nend" ]
[ "0.5961779", "0.59357077", "0.57481325", "0.56980664", "0.5694085", "0.55993134", "0.5536002", "0.5523026", "0.55033845", "0.54762787", "0.54762787", "0.54664916", "0.5460731", "0.54319644", "0.54158217", "0.54020816", "0.5386715", "0.5336958", "0.5319766", "0.5317978", "0.5315467", "0.5305977", "0.5303733", "0.52901775", "0.52872276", "0.52851367", "0.527877", "0.52725446", "0.52710956", "0.52624714", "0.52579796", "0.5246146", "0.524579", "0.5239825", "0.52243567", "0.5215786", "0.52150184", "0.5199681", "0.5195348", "0.51855874", "0.5181254", "0.5165563", "0.51528865", "0.51432884", "0.5142089", "0.51351565", "0.51351565", "0.513275", "0.5130601", "0.512779", "0.51199245", "0.5115883", "0.51067024", "0.510326", "0.50987315", "0.5094874", "0.50903666", "0.5089561", "0.508838", "0.50869733", "0.50853115", "0.5077629", "0.5077516", "0.506798", "0.50653243", "0.5065184", "0.5064556", "0.5061675", "0.5061383", "0.50511837", "0.50508964", "0.5049539", "0.5048962", "0.50482756", "0.50448686", "0.50442564", "0.5019869", "0.50023526", "0.49947277", "0.49817201", "0.49814695", "0.49803367", "0.49788818", "0.49768117", "0.49737448", "0.49691272", "0.4962558", "0.49440134", "0.49417412", "0.49404836", "0.49391174", "0.49196002", "0.4900492", "0.4898252", "0.48936212", "0.48926428", "0.48874348", "0.48865926", "0.48779532", "0.4875351" ]
0.7567029
0
Return TRUE if a point p is inside the circumcircle made up of the points p1, p2, p3 The circumcircle center is returned in (xc,yc) and the radius r The return value is an array [ inside, xc, yc, r ] Takes an optional cache hash to use for radius/center caching NOTE: A point on the edge is inside the circumcircle
def circum_circle(p, p1, p2, p3, cache = nil) dx,dy,rsqr,drsqr = [] cached = cache && cache[[p1, p2, p3]] xc, yc, r = [] rsqr = 0 if cached xc, yc, r, rsqr = cached else # Check for coincident points if (points_are_coincident(p1,p2) || points_are_coincident(p2,p3) || points_are_coincident(p1,p3)) #puts("CircumCircle: Points are coincident.") return [ false, 0, 0, 0 ] end if (p2.y-p1.y).abs < EPSILON m2 = - (p3.x-p2.x) / (p3.y-p2.y) mx2 = (p2.x + p3.x) * 0.5 my2 = (p2.y + p3.y) * 0.5 xc = (p2.x + p1.x) * 0.5 yc = m2 * (xc - mx2) + my2 elsif (p3.y-p2.y).abs < EPSILON m1 = - (p2.x-p1.x) / (p2.y-p1.y) mx1 = (p1.x + p2.x) * 0.5 my1 = (p1.y + p2.y) * 0.5 xc = (p3.x + p2.x) * 0.5 yc = m1 * (xc - mx1) + my1 else m1 = - (p2.x-p1.x) / (p2.y-p1.y) m2 = - (p3.x-p2.x) / (p3.y-p2.y) mx1 = (p1.x + p2.x) * 0.5 mx2 = (p2.x + p3.x) * 0.5 my1 = (p1.y + p2.y) * 0.5 my2 = (p2.y + p3.y) * 0.5 xc = (m1 * mx1 - m2 * mx2 + my2 - my1) / (m1 - m2) yc = m1 * (xc - mx1) + my1 end dx = p2.x - xc dy = p2.y - yc rsqr = dx*dx + dy*dy r = Math.sqrt(rsqr) cache[[p1, p2, p3]] = [ xc, yc, r, rsqr ] if cache end dx = p.x - xc dy = p.y - yc drsqr = dx*dx + dy*dy [ (drsqr <= rsqr), xc, yc, r ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_in_circle(p, c)\n difference_v = T_VECTORS.pop.set(p) - c.position\n radius_sq = c.r * c.r\n distance_sq = difference_v.lengthsq\n T_VECTORS.push(difference_v)\n # If the distance between is smaller than the radius then the point is inside the circle.\n distance_sq <= radius_sq\n end", "def inside_circle?(point, radius)\n (self.distance_to(point) <= radius)\n end", "def point_inside_circle? circle_center_point, radius\n Geometry.point_inside_circle? self, circle_center_point, radius\n end", "def intersection_chk (x1, y1, x2, y2, center_x, center_y, radius)\n\n\t#check if the circle is in the bounding box rounded by sw_x, sw_y, ne_x, ne_y (southwest point and northeast point)\n\tif x1 < x2\n\t\tsw_x = x1\n\t\tne_x = x2\n\telse\n\t\tsw_x = x2\n\t\tne_x = x1\n\tend\n\n\tif y1 < y2\n\t\tsw_y = y1\n\t\tne_y = y2\n\telse\n\t\tsw_y = y2\n\t\tne_y = y1\n\tend\n\tsw_x = sw_x - radius\n\tsw_y = sw_y - radius\n\tne_x = ne_x + radius\n\tne_y = ne_y + radius\n\n\tif center_x > ne_x || center_x < sw_x || center_y > ne_y || center_y < sw_y\n\t\treturn -1\n\tend\n\n\t#offset the center to 0,0\n\tx1_ = x1 - center_x\n\ty1_ = y1 - center_y\n\tx2_ = x2 - center_x\n\ty2_ = y2 - center_y\n\n\t#check for intersection\n\tdx = x2_ - x1_\n\tdy = y2_ - y1_\n\tdr = Math.sqrt(dx*dx + dy*dy)\n\td = x1_*y2_ - x2_*y1_\n\tresult = radius*radius*dr*dr - (d*d)\n\tif result < 0\n\t\treturn -1\n\telse\n\t\treturn Math.sqrt(((center_x - x1)*(center_x - x1) + (center_y - y1)*(center_y - y1)).abs)\n\tend\nend", "def include?(point)\n Math.sqrt((point.x - @middle.x)**2 + (point.y - @middle.y)**2) <= @radius\n end", "def in_sphere?(coords, radius)\n coords.reduce(0) { |s, c| s + c*c } <= radius**2\nend", "def intersects_with?(o_circle)\n pts_distance(@center, o_circle.center) < @radius + o_circle.radius\n end", "def in?(*p)\n point = p.to_point\n point.in?(self.computed)\n end", "def outside?(p1, p2, p3, q)\n return true if q.equal?(p1) || q.equal?(p2) || q.equal?(p3)\n\n x, y, rsquared = MB::Geometry.circumcircle(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)\n\n dx = q.x - x\n dy = q.y - y\n dsquared = dx * dx + dy * dy\n\n MB::M.sigfigs(dsquared, RADIUS_SIGFIGS) >= MB::M.sigfigs(rsquared, RADIUS_SIGFIGS)\n end", "def circumcenter(x1, y1, x2, y2, x3, y3)\n b1 = perpendicular_bisector(x1, y1, x2, y2)\n b2 = perpendicular_bisector(x2, y2, x3, y3)\n\n x, y = line_intersection(b1, b2)\n return nil if x.nil? || y.nil?\n\n [x, y]\n end", "def get_intersection(center = @root, nr_tests = 500)\n circles = []\n\n each do |node|\n next if node == center\n\n circles << Circle.get_bisector(center.p, node.p)\n\n # admissible = true\n # lc = []\n # circles.each do |c|\n # i = c.triple_inclusion(center.p, circ)\n # if i.zero?\n # lc << c\n # elsif i == 1\n # lc << c\n # admissible = false\n # # break\n # end\n # end\n # lc << circ if admissible\n # circles = lc\n end\n\n circles.uniq!\n admissibles = [false] * circles.length\n get_ud_pts(nr_tests).each do |pt|\n counter = 0\n index = -1\n circles.length.times do |i|\n if circles[i].separates(center.p, pt)\n counter += 1\n index = i\n end\n end\n admissibles[index] = true if counter == 1\n end\n\n center.border = []\n\n admissibles.length.times do |i|\n center.border << circles[i] if admissibles[i]\n end\n\n # center.border = circles\n center.angles = get_angles(center)\n end", "def point_inside?(point)\n Geom.point_in_polygon_2D(point, hexagon(position, RADIUS), true)\n end", "def isInside(_pos)\n _pos = Geo2D::Point::sureGeoObj(_pos) ;\n distance = centerPos().distanceTo(_pos) ;\n return distance < @radius ;\n end", "def in?(px, py)\n ix, iy = @max+100, @max+100\n nbintersections = 0\n @points.each_index do |index|\n ax, ay = *@points[index]\n bx, by = *@points[(index + 1) % @points.length]\n nbintersections += intersectsegment(ax, ay, bx, by, ix, iy, px, py)\n end\n return (nbintersections%2 == 1)\n end", "def circumcircle(x1, y1, x2, y2, x3, y3)\n x, y = circumcenter(x1, y1, x2, y2, x3, y3)\n return nil if x.nil? || y.nil?\n\n dx = x - x1\n dy = y - y1\n rsquared = dx * dx + dy * dy\n\n [x, y, rsquared]\n end", "def within_radius_of?(center, radius)\n return false unless center\n (self.point == center.point) || (center.distance_to(self) <= radius)\n end", "def circle?()\n return (@height == @width) & (@type == \"ellipse\")\n end", "def include?(point)\r\n (point - @pos).abs <= @radius\r\n end", "def contains? position\n # If POI is given instead of location, get location first\n position = position.location if PointOfInterest === position\n\n x = position[0]\n y = position[1]\n\n # Use the raycasting technique to determine if point is inside polygon\n # We are in 2D, which makes it easier.\n # We can also choose the direction of the ray, which makes it almost trivial\n # (Choose ray paralell to x-achis\n intersections = 0\n\n [vertices, vertices.first].flatten.each_cons(2) do |v1, v2|\n # Check if we are inside bounding recangle of 2 vertices\n v1x = v1[0]\n v1y = v1[1]\n v2x = v2[0]\n v2y = v2[1]\n if (v1y < y and y <= v2y) or (v1y >= y and y > v2y)\n # check if we are LEFT of or onthe line from v1 to v2 is at this x coordinate\n cp.polygon(*p.map_vertices.map{|v| v.to_a}.flatten)\n vx = v2x - v1x\n vy = v2y - v1y\n if (x <= v1x and x < v2x)\n intersections +=1\n elsif x >= v1x and x > v2x\n next\n else\n x_line = v1x + vx * (y - v1y) / vy\n if vy == 0 or vx == 0 or x < x_line\n intersections += 1\n end\n end\n end\n end\n return intersections.odd?\n end", "def bresenham_circle_coordinates\n coordinates = []\n\n populate_symmetric = -> (x, y) {\n coordinates << [x, y]\n coordinates << [x, -y]\n coordinates << [-x, -y]\n coordinates << [-x, y]\n coordinates << [y, x]\n coordinates << [y, -x]\n coordinates << [-y, -x]\n coordinates << [-y, x]\n }\n\n # start from the upper point of the circle\n x = 0\n y = @r\n\n delta = 3 - 2 * y\n\n while x <= y do\n populate_symmetric[x, y]\n\n if delta < 0\n delta += 4 * x + 6\n else\n delta += 4 * (x - y) + 10\n y -= 1\n end\n\n x += 1\n end\n\n # move circle to proper center position\n coordinates.uniq.map { |x, y| [x + @x, y + @y] }\n end", "def in_center(point)\n\t\tif @center.nil?\n\t\t\tif\n\t\t\t\tif @width % 2 == 1\n\t\t\t\t\t(point.x == (@width - 1) / 2)\n\t\t\t\telse\n\t\t\t\t\t(Range.new(@width / 2 - 1, @width / 2) === point.x)\n\t\t\t\tend\n\n\t\t\t\tif\n\t\t\t\t\tif @height % 2 == 1\n\t\t\t\t\t\t(point.y == (@height - 1) / 2) \n\t\t\t\t\telse\n\t\t\t\t\t\t(Range.new(@height / 2 - 1, @height / 2) === point.y)\n\t\t\t\t\tend\n\n\t\t\t\t\t@center = point\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def contains p\n naive_walls = Road.naive_walls @n0.pos, @n1.pos\n a = naive_walls[0].p0\n b = naive_walls[0].p1\n c = naive_walls[1].p1\n d = naive_walls[1].p0\n p.in_convex_poly([a, b, c, d])\n end", "def incircle\n # Circle.new(self.incenter, self.inradius)\n end", "def Point3dIsPointInCCWSector(arg0, arg1, arg2, arg3, arg4)\n ret = _invoke(1610743861, [arg0, arg1, arg2, arg3, arg4], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def intersects?(other)\n# (@x <= other.x_outer && other.x <= @x_outer) || (@y <= other.y_outer && other.y <= @y_outer) ||\n# (@z <= other.z_outer && other.z <= @z_outer)\n\n\n (other.x < (@x + @l)) && ((other.x + other.l) > @x) &&\n (other.y < (@y + @w)) && ((other.y + other.w) > @y) &&\n (other.z < (@z + @h)) && ((other.z + other.h) > @z)\n\n end", "def points_of_intersection(other)\n return false unless intersects? other\n p0 = center\n p1 = other.center\n p2 = intersection_center other\n h = height other\n d = center.distance other.center\n\n x3 = p2.x + h*(p1.y - p0.y)/d\n y3 = p2.y - h*(p1.x - p0.x)/d\n x4 = p2.x - h*(p1.y - p0.y)/d\n y4 = p2.y + h*(p1.x - p0.x)/d\n\n [Point.new(x: x3, y: y3), Point.new(x: x4, y: y4)]\n end", "def is_encloses_point?(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point objects' unless point.is_a?(Point)\n\n return false if vertices.include?(point)\n\n sides.each do |s|\n return false if s.contains?(point)\n end\n\n # move to point, checking that the result is numeric\n lit = []\n vertices.each do |v|\n lit << v - point\n end\n\n poly = Polygon.new(*lit)\n # polygon closure is assumed in the following test but Polygon removes duplicate pts so\n # the last point has to be added so all sides are computed. Using Polygon.sides is\n # not good since Segments are unordered.\n args = poly.vertices\n indices = (-args.length..0).to_a\n\n if poly.is_convex?\n orientation = nil\n indices.each do |i|\n a = args[i]\n b = args[i + 1]\n test = ((-a.y)*(b.x - a.x) - (-a.x)*(b.y - a.y)) < 0\n \n if orientation.nil?\n orientation = test\n elsif test != orientation\n return false\n end\n end\n\n return true\n end\n\n hit_odd = false\n p1x, p1y = args[0].x, args[0].y\n indices[1..-1].each do |i|\n p2x, p2y = args[i].x, args[i].y\n\n if [p1y, p2y].min < 0 && [p1y, p2y].max >= 0 && \n [p1x, p2x].max >= 0 && p1y != p2y\n\n xinters = (-p1y)*(p2x - p1x)/(p2y - p1y) + p1x\n hit_odd = !hit_odd if p1x == p2x or 0 <= xinters \n end \n\n p1x, p1y = p2x, p2y\n end\n\n return hit_odd\n end", "def intersection(shape, rect)\n # if both are rectangles return rectangle intersection result\n return rect_intersection(shape, rect) if shape.is_a?(Rect)\n # temporary variables\n x, y, r, d = shape.x, shape.y, shape.radius, shape.direction\n # iterate through all of rectangle's points\n [rect.x, rect.x+rect.width-1].each {|i| [rect.y, rect.y+rect.height-1].each {|j|\n # if within special circle radius\n if Math.hypot(x - i, y - j) < r ||\n Math.hypot(x - i - 1, y - j) < r ||\n Math.hypot(x - i, y - j - 1) < r ||\n Math.hypot(x - i - 1, y - j - 1) < r\n case d\n when 2 then return true if j - y >= 0 && i - x <= j - y && x - i - 1 <= j - y\n when 4 then return true if x - i - 1 >= 0 && j - y <= x - i - 1 && y - j - 1 <= x - i - 1\n when 6 then return true if i - x >= 0 && j - y <= i - x && y - j - 1 <= i - x\n when 8 then return true if y - j -1 >= 0 && i - x <= y - j - 1 && x - i - 1 <= y - j - 1\n else\n # full circle, intersection exists\n return true\n end\n end}}\n # initialize arrays\n rects, coos, rad = [], [], (r / SQRT_2).to_i\n # radius line end coordinates and rectangles depending on which circle part\n case d\n when 2\n coos.push([x - 1 - rad, y + rad])\n coos.push([2 * x - coos[0][0] - 1, coos[0][1]])\n rects.push(Rect.new(x - 1, y, 2, r))\n when 4\n coos.push([x - 1 - rad, y - 1 - rad])\n coos.push([coos[0][0], 2 * y - coos[0][1] - 1])\n rects.push(Rect.new(x - r, y - 1, r, 2))\n when 6\n coos.push([x+rad.to_i, y - 1 - rad])\n coos.push([coos[0][0], 2 * y - coos[0][1] - 1])\n rects.push(Rect.new(x, y - 1, r, 2))\n when 8\n coos.push([x - 1 - rad, y - 1 - rad])\n coos.push([2 * x - coos[0][0] - 1, coos[0][1]])\n rects.push(Rect.new(x - 1, y - r, 2, r))\n else\n rects.push(Rect.new(x - 1, y, 2, r), Rect.new(x - r - 1, y - 1, r, 2),\n Rect.new(x, y - 1, r, 2), Rect.new(x - 1, y - r - 1, 2, r))\n end\n # intersection exists if intersecting with any of the radius rectangles\n return true if rects.any? {|rec| rect_intersection(rect, rec)}\n # rectangle's border lines\n top_left = [rect.x, rect.y]\n bottom_right = [rect.x + rect.width - 1, rect.y + rect.height - 1]\n bottom_left = [rect.x, rect.y + rect.height - 1]\n top_right = [rect.x + rect.width - 1, rect.y]\n # iterate through rectangle's border lines\n [top_left, bottom_right].each {|i| [bottom_left, top_right].each {|j|\n # iterate through the characteristic lines\n coos.each {|c|\n # if borderline of rectangle intersects with diagonal radius line\n if line_intersection(i[0], i[1], j[0], j[1], c[0], c[1], x, y)\n # intersection exists\n return true\n end}}}\n # intersection does not exist\n return false\n end", "def calc_points_for_arc(cx, cy,radius=1.0, beg_angle=0, end_angle = 360, degree_inc = 1.0)\r\n# - - - - - - - - - - - - - - - - - - - - -\r\n if beg_angle > end_angle\r\n #swap if starting point is higher than ending point\r\n tt = beg_angle\r\n end_angle = beg_angle\r\n beg_angle = tt\r\n end #if\r\n res = Array.new\r\n curr_angle = beg_angle\r\n #p2 = calc_point_rotated_relative(p2.x, p2.y,1)\r\n #print \"angle_inc = \", angle_inc, \"\\n\"\r\n #print \"pp = \", pp, \"\\n\"\r\n \r\n start_point = calc_point_from_angle(0,0,beg_angle, radius)\r\n last_point = start_point \r\n res.append(start_point)\r\n \r\n # sets up the change of the \r\n stop_angle = end_angle\r\n if (end_angle == 360) && (beg_angle == 0)\r\n stop_angle -= 1\r\n end #if\r\n\r\n cnt = 1\r\n #print \" relative rotate point = \", p2, \"\\n\"\r\n while (curr_angle <= stop_angle)\r\n curr_angle += angle_inc\r\n p2 = calc_point_rotated_relative(last_point.x, last_point.y, angle_inc)\r\n print \" relative rotate point = \", p2, \"\\n\"\r\n res.append(p2)\r\n last_point = p2\r\n end\r\n return cnt\r\nend", "def calc(radius, const, point)\n result = true\n prev_value = point\n\n (1..MAX_ITERATION).to_a.each do |i|\n break i if (prev_value = prev_value ** 2 + const).abs > radius\n true\n end\n end", "def find_intersection(lx, ly, m, cx, cy, r, dir)\n qa = m*m+1\n qb = 2*(ly*m -lx*m*m - cy*m - cx)\n qc = lx*lx*m*m + -2*lx*ly*m + 2*lx*cy*m +\n ly*ly + -2*ly*cy +\n cy*cy + cx*cx - r*r\n\n x = quadratic(qa, qb, qc, dir)\n y = (x-lx)*m + ly\n [x, y]\n end", "def point_is_inside(point)\n result = false\n vertex1 = @points.length - 1\n for vertex2 in 0...@points.length\n if ((@points[vertex2].y > point.y) != (@points[vertex1].y >= point.y)) && (point.x <= (points[vertex1].x - points[vertex2].x) * (point.y - points[vertex2].y) / (points[vertex1].y - points[vertex2].y) + points[vertex2].x)\n result = !result\n end\n vertex1 = vertex2\n vertex2 += 1\n end\n return result\n end", "def points_for_circle(x, y, r)\n cur_page.points_for_circle(x, y, r)\n end", "def calculate_coordinates\n bresenham_circle_coordinates\n end", "def incenter\n return @incenter if defined?(@incenter)\n\n s = self.sides\n l = [1, 2, 0].map { |i| s[i].length }\n p = l.sum\n\n x_arr = self.vertices.map { |v| v.x / p }\n y_arr = self.vertices.map { |v| v.y / p }\n\n x = l[0] * x_arr[0] + l[1] * x_arr[1] + l[2] * x_arr[2]\n y = l[0] * y_arr[0] + l[1] * y_arr[1] + l[2] * y_arr[2]\n\n @incenter = Point.new(x, y)\n @incenter\n end", "def calculate_circle_area(radius)\nend", "def calculate_circle_area(radius)\nend", "def calculate_circle_area(radius)\n area = PI * radius**2\n return area\nend", "def calc_point_from_angle(cx, cy, angle, length)\r\n # - - - - - - - - - - - - - - - - - - - - -\r\n #System.Convert.ToInt32(System.Convert.ToDouble(originX) * Math.Cos(radians)), originY + #System.Convert.ToInt32(System.Convert.ToDouble(originY) * Math.Sin(radians)))\r\n # radians = (90 - angle) * degree_to_radian;\r\n if (angle > 360) \r\n angle = angle % 360\r\n end #if\r\n #print \"(cx=\", cx, \" cy=\", cy, \" angle=\", angle, \", length=\", length, \")\\n\"\r\n\r\n #if (angle > 360)\r\n # angle = angle % 360.0\r\n\r\n \r\n quad = 1\r\n tang = angle\r\n\r\n## if (angle == 9999)\r\n## if (angle == 0)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle == 90)\r\n## return CNCPoint.new(cx + length, cy)\r\n## elsif(angle == 180)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle == 270)\r\n## return CNCPoint.new(cx - length, cy)\r\n## elsif(angle == 360)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle > 90)\r\n## quad = 2\r\n## tang -= 90\r\n## elsif (angle > 180)\r\n## quad = 3\r\n## tang -= 180\r\n## elsif (angle > 270)\r\n## quad = 4\r\n## tang -= 180\r\n## end #else\r\n## end # 99999\r\n## #print \"tang = \", tang, \" quad=\", quad, \"\\n\"\r\n##\r\n\r\n radians = conv_degree_to_radian(tang -90)\r\n\r\n\r\n new_x = cx + Math.cos(radians) * (length)\r\n new_y = cy + Math.sin(radians) * (length)\r\n\r\n #print \"(new_x = \", new_x, \" new_y=\", new_y, \")\\n\"\r\n##\r\n## if (angle == 9999)\r\n## case quad\r\n## when 1\r\n## # nothing needs to be done\r\n## when 2\r\n## # x is ok\r\n## #new_y = 0 - new_y\r\n## when 3\r\n## new_x = 0 - new_x\r\n## new_y = 0 - new_y\r\n## when 4\r\n## new_x = 0 - new_x\r\n## end\r\n## end # 9999\r\n##\r\n\r\n aRes = CNCPoint.new(new_x, new_y)\r\n return aRes\r\n end", "def points_on_circle(center, normal, radius, numseg)\r\n # Get the x and y axes\r\n axes = Geom::Vector3d.new(normal).axes\r\n center = Geom::Point3d.new(center)\r\n xaxis = axes[0]\r\n yaxis = axes[1]\r\n \r\n xaxis.length = radius\r\n yaxis.length = radius\r\n\r\n # compute the points\r\n da = (Math::PI * 2) / numseg\r\n pts = []\r\n for i in 0...numseg do\r\n angle = i * da\r\n cosa = Math.cos(angle)\r\n sina = Math.sin(angle)\r\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\r\n pts.push(center + vec)\r\n end\r\n \r\n # close the circle\r\n pts.push(pts[0].clone)\r\n\r\n pts\r\nend", "def in?(x, y)\n ((x-@x)**2) + ((y-@y)**2) <= (@r**2)\n end", "def is_cousins(root, x, y)\n nodes = [ root ]\n #'til nodes empty use this while to extract the node whit shift function of array'\n until nodes.empty?\n cousins = []\n cousin_vals = []\n\n until nodes.empty?\n node = nodes.shift\n\n child_vals = [node&.left&.val, node&.right&.val]\n #cheking childs\n return false if child_vals.include?(x) && child_vals.include?(y)\n\n cousin_vals.push(node.left.val) if node.left\n cousin_vals.push(node.right.val) if node.right\n\n return true if cousin_vals.include?(x) && cousin_vals.include?(y)\n\n cousins.push(node.left) if node.left\n cousins.push(node.right) if node.right\n end\n # return founded cousins\n nodes = cousins\n end\n\n false\nend", "def test_circle_vs_circle(cir_a, cir_b)\n depth_x = test_intervals(cir_a.interval_x, cir_b.interval_x)\n return false if depth_x == 0\n\n depth_y = test_intervals(cir_a.interval_y, cir_b.interval_y)\n return false if depth_y == 0\n\n @coll_normal = cir_a.samp - cir_b.samp\n mag = @coll_normal.magnitude\n @coll_depth = cir_a.radius + cir_b.radius - mag\n\n if @coll_depth > 0\n @coll_normal.div!(mag)\n @cpa = cir_a\n @cpb = cir_b\n true\n else\n false\n end\n end", "def test_circle_circle(a, b, response)\n # Check if the distance between the centers of the two\n # circles is greater than their combined radius.\n difference_v = T_VECTORS.pop.set(b.position) - a.position\n total_radius = a.r + b.r\n total_radius_sq = total_radius * total_radius\n distance_sq = difference_v.lengthsq\n # If the distance is bigger than the combined radius, they don't intersect.\n if distance_sq > total_radius_sq\n T_VECTORS.push(difference_v)\n return false\n end\n # They intersect. If we're calculating a response, calculate the overlap.\n if response\n dist = Math.sqrt(distance_sq)\n response.a = a\n response.b = b\n response.overlap = total_radius - dist\n response.overlap_n = difference_v.normalize\n response.overlap_v = difference_v * response.overlap\n response.a_in_b = a.r <= b.r && dist <= b.r - a.r\n response.b_in_a = b.r <= a.r && dist <= a.r - b.r\n end\n T_VECTORS.push(difference_v)\n return true\n end", "def test_obb_vs_circle(rect_a, cir_a)\n @coll_depth = Numeric::POSITIVE_INFINITY\n depths = []\n\n # first go through the axes of the rectangle\n 2.times do |i|\n box_axis = rect_a.axes[i]\n depth = test_intervals(rect_a.projection(box_axis), cir_a.projection(box_axis))\n return false if depth == 0\n\n if depth.abs < @coll_depth.abs\n @coll_normal = box_axis\n @coll_depth = depth\n end\n depths[i] = depth\n end\n\n # determine if the circle's center is in a vertex region\n r = cir_a.radius\n if depths[0].abs < r and depths[1].abs < r\n vertex = closest_vertex_on_obb(cir_a.samp, rect_a)\n\n # get the distance from the closest vertex on rect to circle center\n @coll_normal = vertex - cir_a.samp\n mag = @coll_normal.magnitude\n @coll_depth = r - mag\n\n if @coll_depth > 0\n # there is a collision in one of the vertex regions\n @coll_normal.div!(mag)\n else\n # rect_a is in vertex region, but is not colliding\n return false\n end\n end\n @cpa = rect_a\n @cpb = cir_a\n true\n end", "def c_radius \n Math.sqrt((@x*@x)+(@y*@y))\n end", "def get_cen(player, opponent)\n taken = player + opponent # all occupied board positions\n if (taken & @center).size == 0 # if center is open\n position = 4 # then take it\n else\n get_op_cor(player, opponent) # otherwise check for opposite corner\n end\n end", "def surrounding(position, radius)\n dlat = 0.0001\n dlng = 0.0001\n (1..radius).map do |r|\n (-r..r).map do |rlat|\n points = [sum(position, [dlat * rlat, dlng * (r - rlat.abs)])]\n if rlat.abs != r\n points += [sum(position, [dlat * rlat, dlng * (rlat.abs - r)])]\n end\n points\n end.flatten(1)\n end\nend", "def cornacchia(d, p)\r\n\t\treturn nil if -1 == kronecker_symbol(-d, p)\r\n\r\n\t\t# Compute square root\r\n\t\tx0 = mod_sqrt(-d, p)\r\n\t\tx0 = p - x0 if x0 <= p >> 1\r\n\t\ta = p\r\n\t\tb = x0\r\n\t\tborder = isqrt(p)\r\n\r\n\t\t# Euclidean algorithm\r\n\t\twhile border < b\r\n\t\t\ta, b = b, a % b\r\n\t\tend\r\n\r\n\t\t# Test solution\r\n\t\tc, r = (p - b ** 2).divmod(d)\r\n\t\treturn nil if 0 != r\r\n\r\n\t\tq = c.square?\r\n\t\treturn nil unless q\r\n\r\n\t\treturn [b, q]\r\n\tend", "def iterate\n self.mec ||= Circle.new\n # Handle degenerate cases first\n if @points.size == 1\n self.mec.center = @points.to_a[0]\n self.mec.radius = 0\n elsif @points.size == 2\n a = @points.to_a\n self.mec.center = a[0].center(a[1])\n self.mec.radius = a[0].distance(self.mec.center)\n else\n puts \"points = #{@points.map{|p| p.to_s}.join(\", \")}\" if @debug\n a = convex_hull\n puts \"convex hull = #{a.map{|p| p.to_s}.join(', ')}\" if @debug\n point_a = a[0]\n point_c = a[1]\n while (true)\n point_b = nil\n best_theta = 180.0;\n for point in @points\n if point != point_a && point != point_c\n theta_abc = point.angle_between(point_a, point_c)\n puts \"a: #{point_a} c: #{point_c} p: #{point} best_theta: #{best_theta} theta_abc: #{theta_abc}\" if @debug\n if theta_abc < best_theta\n point_b = point\n best_theta = theta_abc\n end\n end\n end\n puts \"Found best theta: #{best_theta}, a = #{point_a}, b = #{point_b}, c = #{point_c}\" if @debug\n if best_theta >= 90.0 || point_b.nil?\n self.mec.center = point_a.center(point_c)\n self.mec.radius = point_a.distance(self.mec.center)\n return self.mec\n end\n ang_bca = point_c.angle_between(point_b, point_a)\n ang_cab = point_a.angle_between(point_c, point_b)\n puts \"ang_bca = #{ang_bca}, ang_cab = #{ang_cab}\" if @debug\n if ang_bca > 90.0\n point_c = point_b\n elsif ang_cab <= 90.0\n puts \"breaking ...\" if @debug\n break\n else\n point_a = point_b\n end\n end\n ch1 = (point_b - point_a).scale(0.5)\n ch2 = (point_c - point_a).scale(0.5)\n n1 = ch1.normal_left\n n2 = ch2.normal_left\n ch1 = point_a + ch1\n ch2 = point_a + ch2\n self.mec.center = Point.inf_line_intersection(ch1, n1, ch2, n2)\n self.mec.radius = self.mec.center.distance(point_a)\n end\n self.mec\n end", "def contains?(p)\n areaABP = Triangle.new(a, b, p).area\n areaACP = Triangle.new(a, c, p).area\n areaBCP = Triangle.new(b, c, p).area\n (areaABP + areaACP + areaBCP - area < 0.1)\n end", "def triple_inclusion(p, circ, eps = 0.001)\n # TODO: handle lines\n return 0 if @r.nil? || circ.r.nil?\n\n dist = (@c - circ.c).abs\n r_max = [@r, circ.r].max\n r_min = [@r, circ.r].min\n\n if dist + r_min >= r_max + eps\n return 0\n elsif in_disk?(p) && circ.in_disk?(p)\n return @r < circ.r ? 1 : 2\n elsif !in_disk?(p) && !circ.in_disk?(p)\n return @r > circ.r ? 1 : 2\n else\n return 0\n end\n end", "def in_polar_coordinates\n return [] unless recognized_format?\n radius_data.map.with_index { |r, i| [i * 2 * Math::PI / radius_data.size, r] }\n end", "def collide_point?(x,y)\n nself = normalize()\n x.between?(nself.left,nself.right) && y.between?(nself.top,nself.bottom)\n end", "def area_of_circle(radius)\n Math::PI*(radius*radius)\nend", "def circle_info(radius)\n {:area => Math::PI * (radius * radius),\n :perimeter => Math::PI * (2 * radius),\n :sphere_volume => ((4/3)* Math::PI * (radius ** 3)),\n :sphere_surface_area => (4* (Math::PI * (radius * radius)))}\nend", "def contract_inside(center, point, gamma=0.5)\n p = center + ( point - center ) * gamma\n p.result = func(p)\n p\n end", "def circle_area(circle)\n circle.radius**2*Math::PI\nend", "def check(x, y)\n calc(RADIUS, const, x + y * 1i)\n end", "def include?(pnt)\n pnt.lat >= south && pnt.lng >= west && pnt.lat < north && pnt.lng < east\n end", "def collide_point?(point)\n distance = Math.hypot(point[0]-@rect.center[0],point[1]-@rect.center[1])\n distance < @rect.w/2\n end", "def exists_sq?(hx, hy)\n x, y = *hex_to_sq(hx, hy)\n x_is_inside = x >= 0 && x < @radius * 2 + 1 # Refactor this into constant SQ_LENGTH\n y_is_inside = y >= 0 && y < @radius * 2 + 1\n x_is_inside && y_is_inside\n end", "def ==(point3)\n (@x == point3.x)&&(@y == point3.y)&&(@z == point3.z)\n end", "def intersect?(r)\n @x < r.x + r.w && @x + @w > r.x && @y < r.y + r.h && @y + @h > r.y\n end", "def points_for_arc(x, y, r, start_angle, end_angle)\n cur_page.points_for_arc(x, y, r, start_angle, end_angle)\n end", "def contains?(point)\n point.inside?(self)\n end", "def counter_clockwise(a, b, c)\n oriented_area(a, b, c).positive?\n end", "def isInside(_pos)\n return @shape.insidePoint?(_pos) ;\n end", "def res_include(x, y, res)\r\n res.each{|rx, ry| return true if x == rx && y == ry}\r\n return false\r\n end", "def segments_intersection(a, b, c, d)\n denominator = (b.y - a.y)*(d.x - c.x) - (a.x - b.x)*(c.y - d.y) \n return false if denominator == 0\n x = ( (b.x - a.x) * (d.x - c.x) * (c.y - a.y) + (b.y - a.y) * (d.x - c.x) * a.x - (d.y - c.y) * (b.x - a.x) * c.x ) / denominator\n y = -( (b.y - a.y) * (d.y - c.y) * (c.x - a.x) + (b.x - a.x) * (d.y - c.y) * a.y - (d.x - c.x) * (b.y - a.y) * c.y ) / denominator\n if (x - a.x) * (x - b.x) <= 0 && (y - a.y) * (y - b.y) <= 0 && (x - c.x) * (x - d.x) <= 0 && (y - c.y) * (y - d.y) <= 0 \n return true\n else\n return false\n end\n end", "def IsPentagonal (input)\n\ttemp = (Math.sqrt(1 + 24 * input) + 1.0) / 6.0\n\treturn (temp == temp.round)\nend", "def check_polygon\n return false if @points.length < 3\n zpoints = Array.new(@points)\n zpoints += [@points[0], @points[1]]\n side_prev = zcrossproduct(zpoints[0], zpoints[1], zpoints[2])\n for i in 1...(zpoints.length-2)\n side_next = zcrossproduct(zpoints[i], zpoints[i+1], zpoints[i+2])\n return false if (side_prev * side_next < 0)\n end\n return true\n end", "def intersects?(r2)\n if @p2.x <= r2.p1.x or r2.p2.x <= @p1.x \n return false\n elsif @p2.y >= r2.p1.y or r2.p2.y >= @p1.y\n end\n return true\n end", "def contains?(x,y)\n\t\tdx = Haversine.distance([@yc,@xc],[@yc,x]).to_km\n\t\tdy = Haversine.distance([@yc,@xc],[y,@xc]).to_km\n\t\t#puts dx\n\t\t#puts dy\n\t\treturn (dx < @w and dy < @h)\n\tend", "def segment_segment_intersection(ax, ay, bx, by, cx, cy, dx, dy)\n\treturn false if ((cx == ax) && (cy == ay)) || ((dx == ax) && (dy == ay)) || ((cx == bx) && (cy == by)) || ((dx == bx) && (dy == by))\n\t\t#(self.cp(bx, by, cx, cy, ax, ay) != self.cp(bx, by, dx, dy, ax, ay)) && (self.cp(dx, dy, ax, ay, cx, cy) != self.cp(dx, dy, bx, by, cx, cy))\n\t\t(self.class.cp(bx, by, cx, cy, ax, ay) != self.class.cp(bx, by, dx, dy, ax, ay)) && (self.class.cp(dx, dy, ax, ay, cx, cy) != self.class.cp(dx, dy, bx, by, cx, cy))\n\tend", "def intersectPoint p\n if real_close_point(x,y,p.x,p.y) then self\n else NoPoints.new\n end\n end", "def get_arc_points(cx,cy,radius, beg_angle, end_angle, degree_inc = 1.0)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n deg = beg_angle\r\n degree_inc = degree_inc.abs\r\n ares = Array.new\r\n while (deg < end_angle)\r\n #print \"(deg = \", deg, \")\\n\"\r\n cp = calc_point_from_angle(cx,cy, deg, tradius)\r\n ares.append(cp)\r\n deg += degree_inc\r\n end #while\r\nend", "def contains_point?(point)\n x, y = point.x, point.y\n tuples = @points.zip(@points[1..-1] + [@points[0]])\n crossings =\n tuples.select do |a, b|\n (b.y > y != a.y > y) && (x < (a.x - b.x) * (y - b.y) / (a.y - b.y) + b.x)\n end\n\n crossings.size % 2 == 1\n end", "def circleArea(r)\t\t\t# Function called circleArea with parameter r\n PI * r ** 2 \t\t\t# Compute the area of the circle with the given r radius\nend", "def north_radius(xy, cluster)\n north_arr = []\n x, y = xy[0], xy[1]\n ny = y - 1\n in_cluster = cluster.include?([x, ny])\n while in_cluster == true\n \tnorth_arr << [x, ny]\n \tny -= 1\n \tin_cluster = false unless cluster.include?([x, ny])\n end\n radius = north_arr.length\n return radius \n end", "def contains(v)\n if @area == (Tri.area(v, @points[:a], @points[:c]) + \n Tri.area(v, @points[:b], @points[:a]) + \n Tri.area(v, @points[:c], @points[:b]))\n return true\n else\n return false\n end\n end", "def circleArea(r)\n PI * r ** 2 \nend", "def inside?(x, y)\n x >= 0 && x < @width && y >= 0 && y < @height\n end", "def contains_pos?(*args)\n px, py, pz = *Moon::Vector3.extract(args.singularize)\n px.between?(0, xsize) && py.between?(0, ysize) && pz.between?(0, zsize)\n end", "def sp_points_on_circle(center, normal, radius, numseg, rotAngle)\n # Get the x and y axes\n axes = Geom::Vector3d.new(normal).axes\n center = Geom::Point3d.new(center)\n xaxis = axes[0]\n yaxis = axes[1]\n xaxis.length = radius\n yaxis.length = radius\n rotAngle = 0.0 unless rotAngle.is_a?(Numeric)\n # Compute the points\n da = (Math::PI*2) / numseg\n pts = []\n for i in 0...numseg do\n angle = rotAngle + (i * da)\n cosa = Math.cos(angle)\n sina = Math.sin(angle)\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\n pts.push(center + vec)\n end\n # Close the circle\n pts.push(pts[0].clone)\n pts\n end", "def contains_point?(pt)\n pt.x.between?(left, left + width - 1) &&\n pt.y.between?(top, top + height - 1)\n end", "def circumcenter\n return @circumcenter if defined?(@circumcenter)\n\n a, b, c = self.sides.map { |side| side.perpendicular_bisector }\n \n @circumcenter = a.intersection(b)[0]\n @circumcenter\n end", "def is_convex?\n return @is_convex if defined?(@is_convex)\n\n @is_convex = false\n\n cw = Polygon.is_right?(vertices[-2], vertices[-1], vertices[0])\n (1...vertices.length).each do |i|\n if cw ^ Polygon.is_right?(vertices[i - 2], vertices[i - 1], vertices[i])\n return @is_convex\n end\n end\n\n # check for intersecting sides\n sides = self.sides\n sides.each_with_index do |si, i|\n points = [si.p1, si.p2]\n\n first_number = 0\n first_number = 1 if i == sides.length - 1\n (first_number...i - 1).each do |j|\n sj = sides[j]\n if !points.include?(sj.p1) && !points.include?(sj.p2)\n hit = si.intersection(sj)\n return @is_convex if !hit.empty?\n end\n end\n end\n \n @is_convex = !@is_convex\n @is_convex\n end", "def find_radi(xy, cluster)\n north = north_radius(xy, cluster)\n south = south_radius(xy, cluster)\n east = east_radius(xy, cluster)\n west = west_radius(xy, cluster)\n ne = ne_radius(xy, cluster)\n nw = nw_radius(xy, cluster)\n se = se_radius(xy, cluster)\n sw = sw_radius(xy, cluster)\n\n all = [north, south, east, west, ne, nw, se, sw]\n return all\n end", "def interior?(coords)\n x, y, z = coords\n x >= @origin_x && x <= @max_x &&\n y >= @origin_y && y <= @max_y &&\n z >= @origin_z && z <= @max_z\n end", "def inradius\n @inradius ||= 2 * self.area / self.perimeter\n end", "def circleArea(r)\t# Declare a function named circleArea that takes a parameter r (the radius)\n PI * r ** 2 \t# Calculate the area of the circle using the given values\nend", "def sector_a_intfx_coords\n [ [-1.5 * @radius, @radius], [-1.5 * @radius, -@radius], \n [-1.5 * @radius, 3 * @radius], [-3 * @radius, 2 * @radius],\n [-3 * @radius, 0], [-3 * @radius, -2 * @radius],\n [-1.5 * @radius, -3 * @radius] ]\n end", "def octagonal?\n fcache[:octagonal] ||= (Math.sqrt(3*self +1)+1)% 3 == 0\n end", "def intersection(lat, lng, r)\n \n # Convert degrees to meters\n x1 = Segment.length([lat, lng], [lat, @a[1]]) # lng\n x1 *= -1 if lng > @a[1]\n\n y1 = Segment.length([lat, lng], [@a[0], lng]) # lat\n y1 *= -1 if lat > @a[0]\n \n x2 = Segment.length([lat, lng], [lat, @b[1]]) # lng\n x2 *= -1 if lng > @b[1]\n\n y2 = Segment.length([lat, lng], [@b[0], lng]) # lat\n y2 *= -1 if lat > @b[0]\n \n # Circle equation: lat**2 + lng**2 = r**2\n # Segment equation: lat = y1 + (lng-x1)/(x2-x1) * (y2-y1)\n # See also: http://mathworld.wolfram.com/Circle-LineIntersection.html\n \n dx = x2 - x1\n dy = y2 - y1\n dr = Math.sqrt(dx**2 + dy**2) # Caution: this is estimation\n d = x1*y2 - x2*y1 \n delta = r**2 * dr**2 - d**2 \n\n sgn = lambda{ |x| x < 0 ? -1 : 1 }\n coordinates = lambda do |sign|\n x = (d*dy + sign * sgn[dy] * dx * Math.sqrt(delta)) / dr**2\n y = (-d*dx + sign * dy.abs * Math.sqrt(delta)) / dr**2\n\n intersection_lat = 180*y / (Math::PI * R) + lat\n intersection_lng = x / ( Math.cos(intersection_lat*Rad)*R) * (180/Math::PI) + lng\n \n [intersection_lat, intersection_lng] if (@a[1]..@b[1]).include?(intersection_lng) || (@b[1]..@a[1]).include?(intersection_lng) and\n (@a[0]..@b[0]).include?(intersection_lat) || (@b[0]..@a[0]).include?(intersection_lat)\n end\n \n if delta > 0\n # Return closest point (to point @a) of two\n [-1, 1].map{ |sign| coordinates[sign] }.compact.sort_by{|x,y| y }.first\n elsif delta == 0\n # Tangent line: only one point\n coordinates[0]\n else\n # No intersecting points\n nil\n end\n end", "def checkPosition(x, y)\n width = @object.width\n height = @object.height\n\n if @collisions != nil and # Position values has not been made yet\n @curX == x and # Position and size has not changed\n @curY == y and \n @curWidth == width and \n @curHeight == height\n # Skip code to boost performance\n return \n else\n # Refresh current values from the object\n refreshCurrentValues()\n end\n \n xWidthFromCenter = width / 2 - OFFSET\n\n # Set corners and middle points as their own values\n @top_left = [x - xWidthFromCenter, y - (height - OFFSET)]\n @top_right = [x + xWidthFromCenter, y - (height - OFFSET)]\n @bottom_left = [x - xWidthFromCenter, y]\n @bottom_right = [x + xWidthFromCenter, y]\n @center_top = [x + xWidthFromCenter, y - (height - OFFSET)]\n @center_right = [x + xWidthFromCenter, y - (height / 2)]\n @center_bottom = [x, y]\n @center_left = [x - xWidthFromCenter, y - (height / 2)]\n\n @collisions = []\n @collisions += [@top_left, @top_right, @bottom_left, @bottom_right,\n @center_top, @center_right, @center_bottom, @center_left]\n end", "def contains_point(x,y,z)\n behind = true\n @planes.each{|p|\n behind = (0 >= p.distance_to_point(x,y,z))\n break if not behind\n }\n return behind\n end", "def find_center(cluster)\n sumx = 0; sumy = 0\n total = cluster.length\n cluster.each do |x,y|\n sumx += x \n sumy += y\n end\n xavg = (sumx.to_f / total).round \n yavg = (sumy.to_f / total).round \n center_pos = []\n if (cluster.include?([xavg, yavg]) == false)\n distance_to_center = 100\n cluster.each do |x,y|\n xdiff = (xavg - x).abs\n ydiff = (yavg - y).abs\n xdiff_squared = xdiff ** 2\n ydiff_squared = ydiff ** 2\n distance_squared = xdiff_squared + ydiff_squared\n distance = distance_squared ** 0.5\n if distance < distance_to_center\n center_pos = [x,y]\n distance_to_center = distance\n end\n end\n else\n center_pos = [xavg, yavg]\n end\n return center_pos\n end", "def pentagonal?(algorithm = :inverse)\n p = self.to_i\n\n if algorithm == :quadratic\n quadratic_solutions = quadratic 3, -1, -(2 * p)\n x2 = quadratic_solutions[1]\n !x2.is_a?(Complex) && (x2 * 10) % 10 == 0.0\n else\n inverse = (Math.sqrt(24 * p + 1) + 1) / 6\n inverse == inverse.to_i\n end\n end", "def get_circle_area(ch, d, dir = 0)\n return Circle.new(ch.real_x / 4 + 16, ch.real_y / 4 + 16, d * 32, dir)\n end" ]
[ "0.6527931", "0.64388806", "0.6419674", "0.6232615", "0.6070144", "0.60322005", "0.59882295", "0.5920445", "0.5892221", "0.58235496", "0.5785036", "0.57087463", "0.56787616", "0.567436", "0.56622255", "0.5594087", "0.55539906", "0.5534976", "0.5505675", "0.55012363", "0.54830277", "0.5438106", "0.54341966", "0.5389902", "0.5363996", "0.5354797", "0.5342456", "0.53403676", "0.53108555", "0.53081053", "0.52975273", "0.5277311", "0.5253819", "0.525321", "0.5241896", "0.52372116", "0.52372116", "0.52347296", "0.5224793", "0.5224547", "0.5221008", "0.52143914", "0.5204594", "0.52030253", "0.51944226", "0.51941615", "0.5192504", "0.51896733", "0.51855415", "0.51795155", "0.5177953", "0.51498705", "0.51157725", "0.51126224", "0.510752", "0.5079794", "0.5052694", "0.50481373", "0.5045082", "0.50424486", "0.50312537", "0.5024786", "0.50196", "0.50162685", "0.5005814", "0.500456", "0.50019705", "0.5001107", "0.49944657", "0.4989235", "0.4979414", "0.49755836", "0.49739614", "0.49675113", "0.49671626", "0.4960815", "0.49470755", "0.4942857", "0.49274305", "0.492654", "0.49132743", "0.49046344", "0.4900033", "0.4898958", "0.48751202", "0.48715293", "0.48701754", "0.4866474", "0.48639783", "0.48495552", "0.4844664", "0.48396805", "0.48192", "0.48189327", "0.481861", "0.48171923", "0.48122507", "0.48050606", "0.4798751", "0.4797693" ]
0.7627279
0
The token_type of the token_permission_type Returns String
def to_s token_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n self.token_type\n end", "def token_type; end", "def token_type\n \"Bearer\"\n end", "def getTokenKind()\r\n return @curr_token.id\r\n end", "def token_type\n 'Bearer'\n end", "def parse_token_type\n token_type = get_element('//t:RequestSecurityTokenResponse/t:TokenType')\n @validation_errors << \"TokenType field is empty.\" and return if token_type.nil?\n @validation_errors << \"Invalid token type.\" unless token_type == self.class.token_type\n end", "def token_type\n target_audience ? :id_token : :access_token\n end", "def scout_token \n\treturn $tokens[$index].type\nend", "def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end", "def current_type\n @token_type[@current_tok]\n end", "def role\n permission_type\n end", "def to_s\n token\n end", "def get_authentication_header\n \"#{token_type} #{token}\"\n end", "def get_token(type = 'csrf')\n type = 'csrf' unless TOKEN_TYPES.include?(type)\n\n return @tokens[type] if @tokens.key?(type)\n\n params = {\n action: 'query',\n meta: 'tokens',\n type: type\n }\n\n resp = post(params)\n tokens = resp['query']['tokens']\n token = tokens[\"#{type}token\"]\n @tokens[type] = token\n token\n end", "def get_permission_name(permission)\n case permission\n when Footprint32::PRIVATE\n return \"Private\"\n when Footprint32::FRIENDS\n return \"Friends\"\n else\n return \"Public\"\n end\n end", "def grant_type\n @grant_type ||= nil\n return @grant_type if @grant_type\n if code && redirect_uri\n \"authorization_code\"\n elsif refresh_token\n \"refresh_token\"\n elsif username && password\n \"password\"\n elsif issuer && signing_key\n \"urn:ietf:params:oauth:grant-type:jwt-bearer\"\n end\n end", "def getTokenKind()\n $tokens.at(0)\nend", "def token_types\n @tokens.map(&:type)\n end", "def token_types\n @tokens.map(&:type)\n end", "def type\n self.class.type_enum_map.key(@cred_struct[:type])\n end", "def token_types\n attributes.fetch(:tokenTypes)\n end", "def platform_authorized_key(type)\n \"#{type.graphql_name}.authorized\"\n end", "def text_permission\n return unless @user.loa3?\n\n dig_out('permissions', 'permission_type', VAProfile::Models::Permission::TEXT)\n end", "def get_token_type_as_target_label(generator, ttype)\n name = generator.attr_grammar.get_token_display_name(ttype)\n # If name is a literal, return the token type instead\n if ((name.char_at(0)).equal?(Character.new(?\\'.ord)))\n return String.value_of(ttype)\n end\n return RJava.cast_to_string(generator.attr_grammar.attr_name + Grammar.attr_grammar_type_to_file_name_suffix[generator.attr_grammar.attr_type]) + \"_\" + name\n # return super.getTokenTypeAsTargetLabel(generator, ttype);\n # return this.getTokenTextAndTypeAsTargetLabel(generator, null, ttype);\n end", "def get_token_text_and_type_as_target_label(generator, text, token_type)\n name = generator.attr_grammar.get_token_display_name(token_type)\n # If name is a literal, return the token type instead\n if ((name.char_at(0)).equal?(Character.new(?\\'.ord)))\n return String.value_of(token_type)\n end\n text_equivalent = (text).nil? ? name : text\n if (text_equivalent.char_at(0) >= Character.new(?0.ord) && text_equivalent.char_at(0) <= Character.new(?9.ord))\n return text_equivalent\n else\n return RJava.cast_to_string(generator.attr_grammar.attr_name + Grammar.attr_grammar_type_to_file_name_suffix[generator.attr_grammar.attr_type]) + \"_\" + text_equivalent\n end\n end", "def provider_type\n provider.to_s.gsub(\"oauth2\", \"\").try(:titleize)\n end", "def type_str\n Types.type_str(type)\n end", "def token\n @token\n end", "def type\n @type.to_s\n end", "def token\n configuration.token\n end", "def token\n @token\n end", "def to_str\n @content_type\n end", "def token\n @data[:token]\n end", "def token\n end", "def permission_classification\n return @permission_classification\n end", "def xlate_authen_type()\n return AUTHEN_TYPE_XLATES[@authen_type] if (AUTHEN_TYPE_XLATES.has_key?(@authen_type))\n return(@authen_type.to_s) \n end", "def fully_qualified_token(token, institution_type)\n institution_type.nil? ? token : token + '_' + institution_type\n end", "def token\n @access_token.token\n end", "def access_type\n @access_type\n end", "def to_s\n self.token.to_s\n end", "def token_key\n @token_key\n end", "def token_type(headers = T.unsafe(nil)); end", "def security_type_label\n self.security_type.label.titleize\n end", "def convert_buffer_to_token(token_type); end", "def type_str\n MARKETPLACEAPP_TYPES[type]\n end", "def token\n @attributes[:token]\n end", "def type\n TYPES[roletype_id]\n end", "def get_user_type(user)\n userExists = User.find_by_id(user.id)\n if userExists && user.permission_level == 1\n return \"Admin\"\n elsif userExists && user.permission_level == 0\n return \"Standard\"\n end\n end", "def default_permission\n\t\treturn self.app_id.downcase.gsub(/\\W+/, '_' ).to_sym\n\tend", "def get_authentication_header\n acquire_token if token_expired\n \"#{token_type} #{token}\"\n end", "def get_authentication_header\n acquire_token if token_expired?\n \"#{token_type} #{token}\"\n end", "def type_authorization!()\n @type = TAC_PLUS_AUTHOR\n end", "def tokenize_permissions\n permissions = find_all_permission_methods\n #TODO there is a shortcut to do this, I can't remember it\n permissions_hash = {}\n permissions.each do |permission|\n permission.to_s! unless permission.is_a?(String)\n permissions_hash[permission] = self.send(permission)\n end\n self.permission_tokens = permissions_hash.to_json\n end", "def to_s\n @content_type\n end", "def token_s\n fail 'sub-class to implement'\n end", "def token\n @token ||= @context[\"value\"]\n end", "def calculate_token_grant_types\n types = grant_flows - [\"implicit\"]\n types << \"refresh_token\" if refresh_token_enabled?\n types\n end", "def access_token_prefix\n \"Token\"\n end", "def access\n case self.code\n when Code.regular_code\n return \"regular\"\n when Code.admin_code\n return \"admin\"\n when Code.superadmin_code\n return \"super-admin\"\n end\n end", "def user_type\n user_types = []\n if admin\n user_types << \"Admin\"\n end\n if agent\n user_types << \"Agent\"\n end\n if customer\n user_types << \"Customer\"\n end\n user_types.join(\" / \")\n end", "def token_for(provider)\n ident = self.identities_dataset.where(:provider => provider.to_s).first\n if(ident)\n ident.credentials[:token]\n end\n end", "def solr_field_for(permission_type, permission_category)\n permissions = Hydra.config.permissions[permission_type.to_sym]\n permission_category == 'group' ? permissions.group : permissions.individual\n end", "def permission\n perm = data.fetch(\"permissionSources\")\n .map { |i| i[\"permission\"] }\n .first\n .downcase\n GITHUB_TO_TERRAFORM_PERMISSIONS.fetch(perm)\n end", "def tokenType(token)\n\n tag = case token\n when /^(class|constructor|function|method|field|static|var|int|char|boolean|void|true|false|null|this|let|do|if|else|while|return)$/ then :keyword\n\n when /\\{|\\}|\\(|\\)|\\[|\\]|\\.|\\,|\\;|\\+|\\-|\\*|\\/|\\&|\\||\\<|\\>|\\=|\\~/ then :symbol\n\n when /^\\d+/ then :integerConstant\n when /\\\"/ then :stringConstant\n when /^[^\\d]\\w*/ then :identifier\n else :error\n end\n\n return tag\n\n end", "def token(request)\n end", "def to_s\n content_type\n end", "def to_str\n content_type\n end", "def grant_permission\n @attributes[:grant_permission]\n end", "def code\n\t\ttoken\n\tend", "def type \n\t\n\t$cst.add_branch(\"type\")\n\t\n\tmatch_token(\"T_TYPE\", $tokens[$index])\n\t\n\t$cst.ascend\nend", "def type\n return @type if @type != \"unknown\"\n info\n @type\n end", "def type\n @type.name\n end", "def mutationtype\n response_params[\"brq_mutationtype\"]\n end", "def user_token\n google_account.id.to_s\n end", "def authentication_type; end", "def current_user_type_to_s\n stringa_res= \"\"\n if current_user == nil\n stringa_res= \"nil\"\n else\n stringa_res= current_user.class.to_s\n end\n stringa_res\n end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def human_auth_method\n self[:auth_method].to_human\n end", "def current_usertype\n current_account.user_type\n end", "def user_type; end", "def get_devise_auth_token\n authorization = Authorization.where(:provider => 'devise', :customer_id => id.to_s).first\n\n unless authorization.blank?\n authorization.token\n end\n end", "def get_type\n\n end", "def oauth_token\n read_attribute(oauth_token_field)\n end", "def type\n content.split(' ', 2).first\n end", "def token\n if notification_config && notification_config['host_token'] && @resource.callback # we need to have a token available for this service\n notification_config['host_token'][notification_host]\n elsif notification_config && notification_config['token']\n notification_config['token']\n else\n nil # send no token; assume no authorization needed\n end\n end", "def token_auth\n Hash['type' => 'token',\n 'token' => @token,]\n end", "def request_token\n @request_token\n end", "def type_str\n self.class.const_get(:TYPE_STR)\n end", "def type\n response[\"type\"]\n end", "def type\n response[\"type\"]\n end", "def type_name\n activity_types(true)[self.activity_type]\n end", "def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end", "def protection_type\n @descriptive_detail.protection_type\n end", "def type\n params['TYPE']\n end", "def type\n Type.new(type_param).yard_type_string\n end" ]
[ "0.78728765", "0.7169333", "0.68952453", "0.6755076", "0.6750078", "0.6668135", "0.66671294", "0.6665158", "0.66342777", "0.65830404", "0.6532922", "0.6527771", "0.64109445", "0.638725", "0.63509697", "0.63202524", "0.62928003", "0.6112256", "0.6112256", "0.610819", "0.61008507", "0.6093494", "0.608872", "0.6067717", "0.6053822", "0.6053213", "0.6042686", "0.6038056", "0.60109985", "0.5989544", "0.5965389", "0.5950499", "0.5937798", "0.59374917", "0.59302104", "0.591192", "0.5901804", "0.5867587", "0.58575654", "0.58360475", "0.5818176", "0.5801008", "0.5795947", "0.57909185", "0.57654995", "0.57573706", "0.57548064", "0.5743314", "0.5711088", "0.57082075", "0.57069975", "0.5700271", "0.5687025", "0.5686184", "0.56808907", "0.56806535", "0.56782967", "0.5667283", "0.566688", "0.5665934", "0.5655849", "0.5652666", "0.5644765", "0.56409895", "0.56246954", "0.5617618", "0.5610716", "0.5610301", "0.5609974", "0.5602684", "0.5601", "0.55997616", "0.5587251", "0.5586896", "0.55845505", "0.55744845", "0.5570127", "0.5570127", "0.5570127", "0.5570127", "0.5570127", "0.5570127", "0.5562479", "0.5552995", "0.5539919", "0.55375856", "0.5535808", "0.5533276", "0.5520073", "0.55172765", "0.5508128", "0.5503771", "0.5499558", "0.5496396", "0.5496396", "0.5496308", "0.5484095", "0.5481455", "0.5480339", "0.54759437" ]
0.80233765
0
GET /prd_attributes GET /prd_attributes.xml
def index @prd_attributes = PrdAttribute.all(:include => [:products, :prd_attribute_devices], :order => "id DESC") respond_to do |format| format.html # index.html.erb format.xml { render :xml => @prd_attributes } format.json { @returns = [] @prd_attributes.each do |factor| @returns << mapping_to_hash(factor, PrdAttribute.json_mapping_table) end render :json => @returns } format.rule { @prd_attribute_list_output = [] # prd_attribute_list_output에 product_list.rule에 사용할 row를 정리 # @prd_attributes.each do |prd_attribute| if not prd_attribute.data_to_ruleset_list.blank? @prd_attribute_list_output << prd_attribute.data_to_ruleset_list + "\n" end end # product_list.rule에 대해서 정의함 # @output = render_to_string(:file => TMPL_PATH + RULE['PrdAttribute']['tmpl_list']) file_name = RULE_PATH + RULE['PrdAttribute']['rule_list'] File.delete(file_name) if File.exist?(file_name) file = File.open(file_name, "w") file << @output file.close # prd_attributres에 대해서 # #@prd_attributes.each { |prd_attribute| # @prd_conditions_what, @prd_conditions_where, @prd_conditions_when, @prd_conditions_who = [], [], [], [] # @prd_conditions = Hash.new # @prd_conditions[:what] = @prd_conditions_what # @prd_conditions[:where] = @prd_conditions_where # @prd_conditions[:who] = @prd_conditions_who # @prd_conditions[:when] = @prd_conditions_when # charging_account.rule # #@prd_balances_output = PrdBalance.data_to_prd_ruleset(prd_attribute.products[0].id, @prd_conditions) #save_to_ruleset_charging_account(prd_attribute.name, @prd_balances_output) #} render :rule => @output } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end", "def new\n @prd_attribute = PrdAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_attribute }\n format.json { render :json => @prd_attribute }\n end\n end", "def show \n require 'open-uri'\n\n @prd_attribute = PrdAttribute.find(params[:id], :include => [:products, :prd_attribute_devices])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_attribute }\n format.json {\n\n\t \trender :json => mapping_to_hash(@prd_attribute, PrdAttribute.json_mapping_table)\n\t }\n format.rule {\n product = @prd_attribute.products[0]\n f = open(\"http://localhost:3000/products/\"+product.id.to_s+\".rule\")\n @webpage = f.read\n f.close\n\n render :rule => @webpage\n\t }\n end\n end", "def index\n @idp_attributes = IdpAttribute.all\n end", "def fetch_custom_attributes\n endpoint = \"/api/#{@version}/custom-attributes/\"\n make_get_request(endpoint)\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def index\n @actattributes = Actattribute.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actattributes }\n end\n end", "def show\n @attr_type = AttrType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attr_type }\n end\n end", "def index\n @product_attribute_fields = ProductAttributeField.find(:all)\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @product_attribute_fields }\n end\n end", "def show\n @prd_etc = PrdEtc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def index\n @attributes = Attribute.all\n end", "def show\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def index\n @product_product_attributes = ProductProductAttribute.all\n end", "def index\n @attractives = Attractive.all\n end", "def index\n @device_attributes = @device.device_attributes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @device_attributes }\n end\n end", "def show\n @product_attribute_field = ProductAttributeField.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @product_attribute_field }\n end\n end", "def get_attributes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AttributesApi.get_attributes ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/attributes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 = ['application/json']\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 \n auth_names = ['PureCloud Auth']\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 => 'AttributeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AttributesApi#get_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @attr_val = AttrVal.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attr_val }\n end\n end", "def index\n @attr_types = AttrType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attr_types }\n end\n end", "def custom_attributes(product_id)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attributes\")\n\n handle_response(response, status)\n end", "def show\n @attribute_group = AttributeGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attribute_group }\n end\n end", "def get_attributes\n from_server single_url do |response|\n payload_to_attributes(response.data)\n end\n end", "def show\n render json: @attribute_set\n end", "def new\n @catalog_product_attributes = CatalogProductAttributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end", "def get_products_attributes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProductsAttributesApi.get_products_attributes ...\"\n end\n # resource path\n local_var_path = \"/attributes\"\n\n # query parameters\n query_params = {}\n query_params[:'includes'] = @api_client.build_collection_param(opts[:'includes'], :csv) if !opts[:'includes'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order_by'] = @api_client.build_collection_param(opts[:'order_by'], :multi) if !opts[:'order_by'].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 = ['APIKeyHeader']\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 => 'Array<Attribute>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductsAttributesApi#get_products_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @attribute = Attribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute }\n end\n end", "def show\n @attribute = Attribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @attribute }\n end\n end", "def show\n @collection_attribute = CollectionAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection_attribute }\n end\n end", "def index\n @ref_attributes = RefAttribute.all\n end", "def show\n @ais_attribute = AisAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ais_attribute }\n end\n end", "def get_varray_attributes(varray_id,auth=nil, cert=nil)\n\t\trest_get(\"#{@base_url}/vdc/varrays/#{varray_id}/available-attributes\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)\n\tend", "def get_attributes\n\t\t\t@@attributes\n\t\tend", "def show\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attri }\n end\n end", "def index\n @user_attributes = UserAttribute.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_attributes }\n end\n end", "def show\n @taxon_attribute = TaxonAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxon_attribute }\n end\n end", "def index\n @part_attributes = PartAttribute.all\n end", "def show\n @attraction = Attraction.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @attraction }\n end\n end", "def get_attributes(node_id:)\n {\n method: \"DOM.getAttributes\",\n params: { nodeId: node_id }.compact\n }\n end", "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def attributes\n @attributes\n end", "def show\n @question_attribute = QuestionAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_attribute }\n end\n end", "def index\n @exp_attributes = ExpAttribute.all\n end", "def show\n format.xml {\n render :xml# => @mobile_cfr_prods.to_xml\n }\n end", "def index\n @c_attributes = CAttribute.all\n end", "def show_page_attributes\n attributes\n end", "def show\n @user_attribute = UserAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_attribute }\n end\n end", "def show\n @actattribute = Actattribute.find(params[:id])\n \n respond_to do |format|\n #format.html # show.html.erb\n format.png # show the badge image\n #format.xml { render :xml => @actattribute }\n end\n end", "def index\n @topic_attributes = TopicAttribute.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @topic_attributes }\n end\n end", "def index\n @configattribincls = Configattribincl.all\n end", "def index\n @product_licence_details = ProductLicenceDetail.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_licence_details }\n end\n end", "def custom_attribute(product_id, attribute_name)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attributes/#{attribute_name}\")\n\n handle_response(response, status)\n end", "def attributes\n data[:attributes]\n end", "def show\n\t\t@ptax = Ptax.find(params[:id])\n\t\trespond_to do |format|\t\t\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @ptaxes }\t\t#Render to XML File\n\t\tend\n\tend", "def index\n @chef_att_debs = ChefAttDeb.all\n end", "def show\n @entitlement = Entitlement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entitlement }\n end\n end", "def attributes\n @attributes\n end", "def get_attribs_all( )\n url = \"#{self.url}/cid?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['results'] if ok?( status ) && response['results']\n return status, ''\n end", "def index\n @collectible_attribute_lists = CollectibleAttributeList.all\n end", "def get_prodid\n\t\t@attributes[:app_prod_id]\n\tend", "def index\n @attribute_lists = AttributeList.all\n end", "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def index\n @iconographic_attributes = IconographicAttribute.all.paginate(page: params[:page], per_page: 50).order('name ASC')\n end", "def show\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_layer }\n end\n end", "def get_attributes(node)\n unless inside_testkitchen?\n data = get_search(:node, \"name:#{node}\")\n\n merge_attributes(data)\n else\n kitchen_provisioner_config[:attributes]\n end\n end", "def show\n @site_attribute = @site.site_attributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site_attribute }\n end\n end", "def show\n @pr = Pr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pr }\n end\n end", "def index # NOT USED \n puts \"xxxxxxx NodeAttrC a:index NNNNN NOT USED xxxxxxx\"\n @node_attrbs = NodeAttrb.paginate(page: params[:page])\n end", "def find(product_attribute_name)\n path = \"/product-attribute-definitions/#{product_attribute_name}\"\n\n response, status = BeyondApi::Request.get(@session,\n path)\n\n handle_response(response, status)\n end", "def create\n @catalog_product_attributes = CatalogProductAttributes.new(params[:catalog_product_attributes])\n\n respond_to do |format|\n if @catalog_product_attributes.save\n flash[:notice] = 'CatalogProductAttributes was successfully created.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { render :xml => @catalog_product_attributes, :status => :created, :location => @catalog_product_attributes }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog_product_attributes.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @product_licence_detail = ProductLicenceDetail.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_licence_detail }\n end\n end", "def index\n @attribute_sets = AttributeSet.all\n render json: @attribute_sets\n end", "def fetch_xml_attr(path, xml, attribute = \"id\") # :doc:\n XML::Parser.parse(xml.body, \"/pairwise/#{path}\", attribute)\n end", "def attributes\n scraper.attributes.keys + uri_response_attributes + [:feed]\n end", "def show\n @attribute_permission = AttributePermission.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_permission }\n end\n end", "def attributes\n end", "def index\n @attr_templates = AttrTemplate.all\n end", "def index\n @site_attributes = @site.site_attributes\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @site_attributes }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n @actattributes = @activity.actattributes\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end", "def attributes\n end", "def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end", "def attrs\n @item_data ||= @active_domain.nil? ? EMPTY_ITEM_DATA : get_items(@query)\n @item_data[:attrs]\n end", "def attribs\n\t\t@attributes\n\tend", "def all(params = {})\n path = \"/product-attribute-definitions\"\n\n handle_all_request(path, :product_attribute_definitions, params)\n end", "def show\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prize }\n end\n end", "def show\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prize }\n end\n end", "def show\n @catalogs_priority = Catalogs::Priority.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end", "def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/hc_elementretrieveallattributes\"\n end", "def attributes\n @attributes ||= attribute_names.inject({}) do |hash, name|\n attribute_values = saml.xpath(\"//saml:Attribute[@Name='#{name}']/saml:AttributeValue/text()\")\n hash[name] = attribute_values.length > 1 ? attribute_values.collect(&:to_s) : attribute_values.to_s\n hash\n end\n end", "def show\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ppos_prerequisite }\n end\n end", "def index\n @admin_attributes = Admin::Attribute.all\n end", "def show\n @produtividade = Produtividade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produtividade }\n end\n end", "def show\n @topic_attribute = TopicAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic_attribute }\n end\n end", "def attributes\n @context[:attributes]\n end", "def attributes\n @attributes ||= []\n @attributes\n end", "def show\n @risk_probability = RiskProbability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @risk_probability }\n end\n end", "def list attributes={}\n attributes[:max] ||= 10\n get(\"issue?#{URI.encode_www_form(attributes)}\")\n end", "def attributes\n @attributes ||= []\n end", "def show\n @section_piece_param = SectionPieceParam.find(params[:id])\n \n @html_attributes = HtmlAttribute.find(@section_piece_param.html_attribute_ids.split(','))\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section_piece_param }\n end\n end", "def show\n @exposure = Exposure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exposure }\n end\n end", "def show\n @priced_item = PricedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @priced_item }\n end\n end" ]
[ "0.65538925", "0.64128906", "0.62780434", "0.61299366", "0.61127985", "0.60396576", "0.6029874", "0.60003895", "0.5939791", "0.5900972", "0.58877265", "0.5884976", "0.5880299", "0.5870859", "0.5822988", "0.58207846", "0.5759431", "0.5735771", "0.5735414", "0.56915164", "0.56906605", "0.5661113", "0.56414664", "0.56339467", "0.5619962", "0.5612334", "0.5609506", "0.560377", "0.5587431", "0.5564042", "0.5545114", "0.55309206", "0.55264", "0.5522319", "0.55122197", "0.5492876", "0.5490101", "0.5484087", "0.54651105", "0.5459384", "0.5433812", "0.54024297", "0.53984934", "0.53888595", "0.53870183", "0.53845644", "0.5376392", "0.53745216", "0.5345995", "0.5308097", "0.5296815", "0.5289794", "0.5289639", "0.52828693", "0.5280644", "0.5277173", "0.52750933", "0.52745795", "0.5274065", "0.5269281", "0.5257956", "0.52565205", "0.5255946", "0.5238363", "0.52353907", "0.5230948", "0.52213705", "0.5205378", "0.5204946", "0.5201964", "0.519354", "0.51918405", "0.5182745", "0.51795644", "0.517494", "0.5168769", "0.5164522", "0.5162389", "0.5159909", "0.51572055", "0.51559746", "0.5151357", "0.5150199", "0.51480824", "0.51480824", "0.51410556", "0.5127133", "0.51260805", "0.5124008", "0.5123363", "0.51212597", "0.5114248", "0.5113123", "0.5104003", "0.5102606", "0.50968736", "0.5080537", "0.5071743", "0.5061797", "0.5058374" ]
0.5057427
100
GET /prd_attributes/1 GET /prd_attributes/1.xml
def show require 'open-uri' @prd_attribute = PrdAttribute.find(params[:id], :include => [:products, :prd_attribute_devices]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @prd_attribute } format.json { render :json => mapping_to_hash(@prd_attribute, PrdAttribute.json_mapping_table) } format.rule { product = @prd_attribute.products[0] f = open("http://localhost:3000/products/"+product.id.to_s+".rule") @webpage = f.read f.close render :rule => @webpage } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end", "def new\n @prd_attribute = PrdAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_attribute }\n format.json { render :json => @prd_attribute }\n end\n end", "def show\n @attr_type = AttrType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attr_type }\n end\n end", "def show\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def show\n @prd_etc = PrdEtc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def index\n @actattributes = Actattribute.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actattributes }\n end\n end", "def show\n @product_attribute_field = ProductAttributeField.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @product_attribute_field }\n end\n end", "def fetch_custom_attributes\n endpoint = \"/api/#{@version}/custom-attributes/\"\n make_get_request(endpoint)\n end", "def index\n @product_attribute_fields = ProductAttributeField.find(:all)\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @product_attribute_fields }\n end\n end", "def show\n @attribute_group = AttributeGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attribute_group }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def index\n @idp_attributes = IdpAttribute.all\n end", "def index\n @device_attributes = @device.device_attributes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @device_attributes }\n end\n end", "def show\n @attr_val = AttrVal.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attr_val }\n end\n end", "def index\n @attributes = Attribute.all\n end", "def index\n @attr_types = AttrType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attr_types }\n end\n end", "def new\n @catalog_product_attributes = CatalogProductAttributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end", "def show\n @collection_attribute = CollectionAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection_attribute }\n end\n end", "def index\n @product_product_attributes = ProductProductAttribute.all\n end", "def fetch_xml_attr(path, xml, attribute = \"id\") # :doc:\n XML::Parser.parse(xml.body, \"/pairwise/#{path}\", attribute)\n end", "def index\n @attractives = Attractive.all\n end", "def show\n @attribute = Attribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute }\n end\n end", "def show\n @attribute = Attribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @attribute }\n end\n end", "def get_attributes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AttributesApi.get_attributes ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/attributes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 = ['application/json']\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 \n auth_names = ['PureCloud Auth']\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 => 'AttributeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AttributesApi#get_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @question_attribute = QuestionAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_attribute }\n end\n end", "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def show\n @taxon_attribute = TaxonAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxon_attribute }\n end\n end", "def custom_attributes(product_id)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attributes\")\n\n handle_response(response, status)\n end", "def get_products_attributes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProductsAttributesApi.get_products_attributes ...\"\n end\n # resource path\n local_var_path = \"/attributes\"\n\n # query parameters\n query_params = {}\n query_params[:'includes'] = @api_client.build_collection_param(opts[:'includes'], :csv) if !opts[:'includes'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order_by'] = @api_client.build_collection_param(opts[:'order_by'], :multi) if !opts[:'order_by'].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 = ['APIKeyHeader']\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 => 'Array<Attribute>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductsAttributesApi#get_products_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @user_attribute = UserAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_attribute }\n end\n end", "def show\n format.xml {\n render :xml# => @mobile_cfr_prods.to_xml\n }\n end", "def get_attributes\n from_server single_url do |response|\n payload_to_attributes(response.data)\n end\n end", "def show\n @ais_attribute = AisAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ais_attribute }\n end\n end", "def index\n @ref_attributes = RefAttribute.all\n end", "def show\n render json: @attribute_set\n end", "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def show\n @actattribute = Actattribute.find(params[:id])\n \n respond_to do |format|\n #format.html # show.html.erb\n format.png # show the badge image\n #format.xml { render :xml => @actattribute }\n end\n end", "def index\n @topic_attributes = TopicAttribute.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @topic_attributes }\n end\n end", "def index\n @user_attributes = UserAttribute.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_attributes }\n end\n end", "def find(product_attribute_name)\n path = \"/product-attribute-definitions/#{product_attribute_name}\"\n\n response, status = BeyondApi::Request.get(@session,\n path)\n\n handle_response(response, status)\n end", "def show\n @site_attribute = @site.site_attributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site_attribute }\n end\n end", "def show\n\t\t@ptax = Ptax.find(params[:id])\n\t\trespond_to do |format|\t\t\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @ptaxes }\t\t#Render to XML File\n\t\tend\n\tend", "def show\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attri }\n end\n end", "def custom_attribute(product_id, attribute_name)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attributes/#{attribute_name}\")\n\n handle_response(response, status)\n end", "def show\n @pr = Pr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pr }\n end\n end", "def show\n @attraction = Attraction.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @attraction }\n end\n end", "def get_prodid\n\t\t@attributes[:app_prod_id]\n\tend", "def show\n @risk_probability = RiskProbability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @risk_probability }\n end\n end", "def create\n @catalog_product_attributes = CatalogProductAttributes.new(params[:catalog_product_attributes])\n\n respond_to do |format|\n if @catalog_product_attributes.save\n flash[:notice] = 'CatalogProductAttributes was successfully created.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { render :xml => @catalog_product_attributes, :status => :created, :location => @catalog_product_attributes }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog_product_attributes.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @topic_attribute = TopicAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic_attribute }\n end\n end", "def show\n @catalogs_priority = Catalogs::Priority.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end", "def show\n @entitlement = Entitlement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entitlement }\n end\n end", "def index\n @part_attributes = PartAttribute.all\n end", "def get_varray_attributes(varray_id,auth=nil, cert=nil)\n\t\trest_get(\"#{@base_url}/vdc/varrays/#{varray_id}/available-attributes\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)\n\tend", "def show\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ppos_prerequisite }\n end\n end", "def index\n @exp_attributes = ExpAttribute.all\n end", "def show\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prize }\n end\n end", "def show\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prize }\n end\n end", "def new\n @attr_type = AttrType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attr_type }\n end\n end", "def get_attributes(node_id:)\n {\n method: \"DOM.getAttributes\",\n params: { nodeId: node_id }.compact\n }\n end", "def index\n @c_attributes = CAttribute.all\n end", "def index\n @product_licence_details = ProductLicenceDetail.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_licence_details }\n end\n end", "def show\n @p_stat = PStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @p_stat }\n end\n end", "def show\n @product_licence_detail = ProductLicenceDetail.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_licence_detail }\n end\n end", "def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @criterion }\n end\n end", "def set_configattribdetail\n @configattribdetail = Configattribdetail.find(params[:id])\n end", "def get_attributes\n\t\t\t@@attributes\n\t\tend", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @device_attribute }\n end\n end", "def show\n @produtividade = Produtividade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produtividade }\n end\n end", "def show\n @exposure = Exposure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exposure }\n end\n end", "def index\n @configattribincls = Configattribincl.all\n end", "def show\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_layer }\n end\n end", "def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/hc_elementretrieveallattributes\"\n end", "def show\n respond_to do |format|\n format.html\n format.xml { render xml: @variate.to_xml }\n end\n end", "def index # NOT USED \n puts \"xxxxxxx NodeAttrC a:index NNNNN NOT USED xxxxxxx\"\n @node_attrbs = NodeAttrb.paginate(page: params[:page])\n end", "def show\n @pdig = Pdig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def show\n @applicant_status = ApplicantStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @applicant_status }\n end\n end", "def index\n @site_attributes = @site.site_attributes\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @site_attributes }\n end\n end", "def new\n @actattribute = Actattribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actattribute }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n @actattributes = @activity.actattributes\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end", "def show\n @attribute_permission = AttributePermission.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_permission }\n end\n end", "def show\n @production = Production.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @production }\n end\n end", "def new\n @product_attribute_field = ProductAttributeField.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @product_attribute_field }\n end\n end", "def show\n @crit_requirement = CritRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crit_requirement }\n end\n end", "def index\n @attribute_lists = AttributeList.all\n end", "def index\n @iconographic_attributes = IconographicAttribute.all.paginate(page: params[:page], per_page: 50).order('name ASC')\n end", "def update\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n\n respond_to do |format|\n if @catalog_product_attributes.update_attributes(params[:catalog_product_attributes])\n flash[:notice] = 'CatalogProductAttributes was successfully updated.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalog_product_attributes.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @prizecount = Prizecount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prizecount }\n end\n end", "def show\n @domicile_type = DomicileType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @domicile_type }\n end\n end", "def new\n @attribute_group = AttributeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attribute_group }\n end\n end", "def show\n @nr_parameter = NrParameter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nr_parameter }\n end\n end", "def show\n @xml_sample = XmlSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xml_sample }\n end\n end", "def show\n @capd = Capd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @capd }\n end\n end", "def show\n @patient_condition = PatientCondition.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient_condition }\n end\n end", "def show\n @product_status = ProductStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_status }\n end\n end", "def index\n @chef_att_debs = ChefAttDeb.all\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def attributes\n @attributes\n end", "def show\n @priced_item = PricedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @priced_item }\n end\n end", "def show\n @ezr_content_class_attribute = EzrContentClassAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ezr_content_class_attribute }\n end\n end" ]
[ "0.6534519", "0.63717496", "0.616081", "0.6001217", "0.5922237", "0.5906426", "0.5858503", "0.5826477", "0.5826188", "0.5795023", "0.5787475", "0.57841873", "0.57708144", "0.57056504", "0.5701562", "0.56770927", "0.56564415", "0.5638742", "0.5630739", "0.55832416", "0.5581015", "0.5546558", "0.55443984", "0.5540092", "0.55328685", "0.5503632", "0.5500545", "0.5470129", "0.54537195", "0.5423245", "0.5421364", "0.5418486", "0.54178274", "0.5415351", "0.5391964", "0.53894556", "0.5378538", "0.5352193", "0.53386086", "0.53383607", "0.53320986", "0.5330625", "0.5325461", "0.53067946", "0.5302355", "0.5290796", "0.52864164", "0.5283022", "0.5266398", "0.5262416", "0.5259844", "0.524089", "0.52390105", "0.52204883", "0.5213076", "0.52099574", "0.5193862", "0.5193862", "0.5182368", "0.51683456", "0.5165427", "0.5162502", "0.51571524", "0.5151527", "0.5150545", "0.5150465", "0.5142182", "0.5139104", "0.51271015", "0.51197296", "0.51143765", "0.5107389", "0.51026857", "0.5096651", "0.5096501", "0.5084314", "0.5083279", "0.50793344", "0.5079047", "0.5077014", "0.5076178", "0.50746316", "0.506812", "0.5066899", "0.5066858", "0.506543", "0.506432", "0.506291", "0.50628984", "0.5056695", "0.5055378", "0.50540334", "0.5051509", "0.5051256", "0.50491315", "0.5041771", "0.50409085", "0.5039593", "0.50366986", "0.5036225" ]
0.6185393
2
GET /prd_attributes/new GET /prd_attributes/new.xml
def new @prd_attribute = PrdAttribute.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @prd_attribute } format.json { render :json => @prd_attribute } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @attr_type = AttrType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attr_type }\n end\n end", "def new\n @actattribute = Actattribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actattribute }\n end\n end", "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def new\n @catalog_product_attributes = CatalogProductAttributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end", "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def new\n @pr = Pr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pr }\n end\n end", "def new\n @product_attribute_field = ProductAttributeField.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @product_attribute_field }\n end\n end", "def new\n @attribute = Attribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute }\n end\n end", "def create\n @catalog_product_attributes = CatalogProductAttributes.new(params[:catalog_product_attributes])\n\n respond_to do |format|\n if @catalog_product_attributes.save\n flash[:notice] = 'CatalogProductAttributes was successfully created.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { render :xml => @catalog_product_attributes, :status => :created, :location => @catalog_product_attributes }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog_product_attributes.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @attribute = Attribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @attribute }\n end\n end", "def new\n @attribute_group = AttributeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attribute_group }\n end\n end", "def new\n @attr_val = AttrVal.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attr_val }\n end\n end", "def new\n @prerequisite = Prerequisite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prerequisite }\n end\n end", "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def new\n @ppos_prerequisite = PposPrerequisite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ppos_prerequisite }\n end\n end", "def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @production }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @prize = Prize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prize }\n end\n end", "def new\n @catalogs_priority = Catalogs::Priority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @collection_attribute = CollectionAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection_attribute }\n end\n end", "def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def new\n @ptid = Ptid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptid }\n end\n end", "def new\n @device_attribute = @device.device_attributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @device_attribute }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @entitlement = Entitlement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entitlement }\n end\n end", "def new\n @predicition = Predicition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @predicition }\n end\n end", "def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end", "def new\n @question_attribute = QuestionAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_attribute }\n end\n end", "def new\n @newtype = params[:newtype]\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def new\n @topic_attribute = TopicAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic_attribute }\n end\n end", "def new\n @cap = Cap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cap }\n end\n end", "def new\n @cap = Cap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cap }\n end\n end", "def new\n @p_stat = PStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p_stat }\n end\n end", "def new\n\t\t@produt = Produt.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml {render :xml => @produt}\n\t\tend\n\tend", "def new\n @package_relationship = PackageRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @package_relationship }\n end\n end", "def new\n @taxon_attribute = TaxonAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon_attribute }\n end\n end", "def new\n @prop = Prop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prop }\n end\n end", "def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def create\n @attr_type = AttrType.new(params[:attr_type])\n\n respond_to do |format|\n if @attr_type.save\n flash[:notice] = 'AttrType was successfully created.'\n format.html { redirect_to(@attr_type) }\n format.xml { render :xml => @attr_type, :status => :created, :location => @attr_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attr_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end", "def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end", "def new\n @bp_triple = BpTriple.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bp_triple }\n end\n end", "def new\n @capd = Capd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @capd }\n end\n end", "def new\n @provision = Provision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provision }\n end\n end", "def new\n @pcategory = Pcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pcategory }\n end\n end", "def new\n @product = Product.new\n assign_lovs\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @product }\n end\n end", "def new\n @classified_person_category = ClassifiedPersonCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified_person_category }\n end\n end", "def new\n @deposit_threshold = DepositThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deposit_threshold }\n end\n end", "def new\n @package = Package.new\n @priority = Priority.find(:all)\n #logger.debug @priority[0]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @package }\n end\n end", "def new\n @requirement = Requirement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requirement }\n end\n end", "def new\n @produtividade = Produtividade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produtividade }\n end\n end", "def new\n @prizecount = Prizecount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prizecount }\n end\n end", "def new\n @pais = Pais.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pais }\n end\n end", "def new\n @relationship = Relationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relationship }\n end\n end", "def new\n @nr_parameter = NrParameter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nr_parameter }\n end\n end", "def new\n @user_attribute = UserAttribute.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_attribute }\n end\n end", "def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @child_dupa2 = ChildDupa2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @child_dupa2 }\n end\n end", "def create\n @actattribute = Actattribute.new(params[:actattribute])\n\n respond_to do |format|\n if @actattribute.save\n flash[:notice] = 'Attribute was successfully created.'\n format.html { redirect_to(actattributes_path) }\n format.xml { render :xml => @actattribute, :status => :created, :location => @actattribute }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @actattribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end", "def new\n default_data\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @title = \"New income classification\"\n @incomeclassification = Incomeclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incomeclassification }\n end\n end", "def new\n @classified_person = ClassifiedPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified_person }\n end\n end", "def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end", "def new\n @proposed_person = ProposedPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proposed_person }\n end\n end", "def new\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end", "def new\n @periode = Periode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periode }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @ais_attribute = AisAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ais_attribute }\n end\n end", "def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end", "def new\n new_prc\n\n setup_campuses_and_semesters\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prc }\n end\n end", "def new\n @catalog_product = CatalogProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product }\n end\n end", "def new\n @blueprint = Blueprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blueprint }\n end\n end", "def new\n @exposure = Exposure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exposure }\n end\n end", "def new\n @pro_temp = ProTemp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pro_temp }\n end\n end", "def new\n @risk_probability = RiskProbability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @risk_probability }\n end\n end", "def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approval }\n end\n end", "def new\n @prod = Prod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @prod }\n end\n end", "def new\n @product_status = ProductStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_status }\n end\n end", "def new\n @collective = Collective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collective }\n end\n end", "def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end", "def new\n @product = Product.new(:active => true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @proffesion = Proffesion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proffesion }\n end\n end", "def new\n @bp_request = BpRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bp_request }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compliance }\n end\n end", "def new\n @priced_item = PricedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @priced_item }\n end\n end", "def new\n @procurement = Procurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @procurement }\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end" ]
[ "0.71981746", "0.70892644", "0.70838976", "0.70710653", "0.7034725", "0.68184686", "0.673044", "0.66846985", "0.66785336", "0.6670787", "0.6628466", "0.65922934", "0.65876406", "0.6562596", "0.65579057", "0.6534814", "0.6501297", "0.648799", "0.6471098", "0.64651185", "0.64586616", "0.6446239", "0.6436109", "0.6429457", "0.64214814", "0.64189804", "0.6407028", "0.63947225", "0.63937545", "0.6386714", "0.63845813", "0.6382527", "0.6382527", "0.6371285", "0.6367553", "0.63628036", "0.63620365", "0.6357275", "0.6346599", "0.63444215", "0.63358825", "0.6325616", "0.6319002", "0.63006353", "0.629916", "0.629761", "0.6292122", "0.6290615", "0.62892455", "0.6288613", "0.6288522", "0.6287147", "0.62778693", "0.6274875", "0.6271048", "0.62702113", "0.6267391", "0.626531", "0.6238323", "0.6238323", "0.6237417", "0.6233961", "0.62307864", "0.6230396", "0.62277013", "0.62259793", "0.621407", "0.6212012", "0.62119275", "0.62118757", "0.6204125", "0.6199844", "0.6195016", "0.618976", "0.618635", "0.6185589", "0.6184724", "0.61821103", "0.61768436", "0.61757296", "0.6174854", "0.616975", "0.6169065", "0.6160936", "0.6160329", "0.61553437", "0.6152929", "0.61499566", "0.61496204", "0.6143092", "0.6140748", "0.61405164", "0.6138969", "0.6138969", "0.6138969", "0.6138969", "0.6138969", "0.6138969", "0.6138969", "0.6138969" ]
0.792203
0
POST /prd_attributes POST /prd_attributes.xml
def create @prd_attribute = PrdAttribute.new @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i @prd_attribute.name = params[:prd_attribute]['name'] @prd_attribute.rollover = params[:prd_attribute]['rollover'] @prd_attribute.code = params[:prd_attribute]['code'] @prd_attribute.prd_type = params[:prd_attribute]['prd_type'] @prd_attribute.description = params[:prd_attribute]['description'] @prd_attribute.status_id = params[:prd_attribute]['status'].to_i @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee'].to_i @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee'].to_i @prd_attribute.target_user = params[:prd_attribute]['target_user'] @prd_attribute.start_date = params[:prd_attribute]['start_date'] @prd_attribute.end_date = params[:prd_attribute]['end_date'] respond_to do |format| if @prd_attribute.save format.html { redirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully created.') } format.xml { render :xml => @prd_attribute, :status => :created, :location => @prd_attribute } format.json { product = Product.new product.prd_attribute_id = @prd_attribute.id product.save! # bundle일 때에는 해당하는 product id들을 저장 # if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE' product_ids = [] params[:prd_attribute]['ref_products'].each do |product_id| product_ids << product_id['product_id'].to_s end @prd_attribute.ref_products = product_ids.join(",") end @prd_attribute.save # product devices 저장 # if not params[:prd_attribute]['devices'].blank? params[:prd_attribute]['devices'].each do |device| prd_attribute_device = PrdAttributeDevice.new prd_attribute_device.code_factor_id = device['device'].to_i prd_attribute_device.prd_attribute_id = @prd_attribute.id prd_attribute_device.product_id = product.id prd_attribute_device.save! end end # product에 대한 기본 conditions 설정 # product.set_default_conditions(@prd_attribute, product) render :json => mapping_to_hash(@prd_attribute, PrdAttribute.json_mapping_table), :status => :created, :location => @prd_attribute } else format.html { render :action => "new" } format.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity } format.json { render :json => @prd_attribute.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @prd_attribute = PrdAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_attribute }\n format.json { render :json => @prd_attribute }\n end\n end", "def create\n @idp_attribute = IdpAttribute.new(idp_attribute_params)\n\n respond_to do |format|\n if @idp_attribute.save\n format.html { redirect_to @idp_attribute, notice: 'IdP attribute was successfully created.' }\n format.json { render :show, status: :created, location: @idp_attribute }\n format.js { @status = 'success'}\n else\n format.html { render :new }\n format.json { render json: @idp_attribute.errors, status: :unprocessable_entity }\n format.js { @status = 'fail' }\n end\n end\n end", "def create\n @catalog_product_attributes = CatalogProductAttributes.new(params[:catalog_product_attributes])\n\n respond_to do |format|\n if @catalog_product_attributes.save\n flash[:notice] = 'CatalogProductAttributes was successfully created.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { render :xml => @catalog_product_attributes, :status => :created, :location => @catalog_product_attributes }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog_product_attributes.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @prd_tag = PrdTag.new(prd_tag_params)\n\n respond_to do |format|\n if @prd_tag.save\n format.html { redirect_to @prd_tag, notice: 'Prd tag was successfully created.' }\n format.json { render :show, status: :created, location: @prd_tag }\n else\n format.html { render :new }\n format.json { render json: @prd_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @attr = Attr.new(attr_params)\n @attr.inspection = @inspection\n respond_to do |format|\n if @attr.save\n format.html { redirect_to @attr, notice: 'Attr was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attr }\n else\n format.html { render action: 'new' }\n format.json { render json: @attr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product_product_attribute = ProductProductAttribute.new(product_product_attribute_params)\n\n respond_to do |format|\n if @product_product_attribute.save\n format.html { redirect_to @product_product_attribute, notice: 'Product product attribute was successfully created.' }\n format.json { render :show, status: :created, location: @product_product_attribute }\n else\n format.html { render :new }\n format.json { render json: @product_product_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prd_attribute = PrdAttribute.find(params[:id])\n\n @prd_attribute.code = params[:prd_attribute]['code']\n @prd_attribute.name = params[:prd_attribute]['name']\n @prd_attribute.rollover = params[:prd_attribute]['rollover']\n @prd_attribute.description = params[:prd_attribute]['description']\n @prd_attribute.status_id = params[:prd_attribute]['status'].to_i\n @prd_attribute.prd_type = params[:prd_attribute]['prd_type']\n @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i\n\n @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i\n @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee']\n @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee']\n @prd_attribute.target_user = params[:prd_attribute]['target_user']\n @prd_attribute.start_date = params[:prd_attribute]['start_date']\n @prd_attribute.end_date = params[:prd_attribute]['end_date']\n\n respond_to do |format|\n format.html { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\tredirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully updated.') \n\t\t\telse \n \t\tformat.html { render :action => \"edit\" }\n\t\t\tend\n\t\t}\n format.xml { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\thead :ok \n\t\t\telse \t\t\n \t\tformat.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\t}\n format.json {\n\n # bundle일 때에는 해당하는 product id들을 저장\n #\n if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE'\n product_ids = []\n\t\t\t params[:prd_attribute]['ref_products'].each do |product_id|\n\t\t\t product_ids << product_id['product_id'].to_s\n\t\t end\n\t\t @prd_attribute.ref_products = product_ids.join(\",\")\n end \n\t\t @prd_attribute.save\n\n # product devices 저장\n #\n if not params[:prd_attribute]['devices'].blank?\n params[:prd_attribute]['devices'].each do |device|\n prd_attribute_device = PrdAttributeDevice.new\n prd_attribute_device.code_factor_id = device['device'].to_i\n prd_attribute_device.prd_attribute_id = @prd_attribute.id\n prd_attribute_device.product_id = @prd_attribute.products[0].id\n prd_attribute_device.save!\n end\n end\n\n \t#render :json => @prd_attribute.errors, :status => :unprocessable_entity\n\t\t\thead :ok\n\t }\n end\n end", "def create\n @attractive = Attractive.new(attractive_params)\n\n respond_to do |format|\n if @attractive.save\n format.html { redirect_to @attractive, notice: 'Attractive was successfully created.' }\n format.json { render :show, status: :created, location: @attractive }\n else\n format.html { render :new }\n format.json { render json: @attractive.errors, status: :unprocessable_entity }\n end\n end\n end", "def idp_attribute_params\n params.require(:idp_attribute).permit(:order, :name, :attribute_resolver, :enable)\n end", "def create\n @prd_etc = PrdEtc.new(params[:prd_etc])\n\n respond_to do |format|\n if @prd_etc.save\n format.html { redirect_to(@prd_etc, :notice => 'PrdEtc was successfully created.') }\n format.xml { render :xml => @prd_etc, :status => :created, :location => @prd_etc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_etc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def attribute_params\n params.require(:attribute).permit(:attribute_id, :attribute_type, :name, :sex, :is_neuter)\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end", "def create\n @actattribute = Actattribute.new(params[:actattribute])\n\n respond_to do |format|\n if @actattribute.save\n flash[:notice] = 'Attribute was successfully created.'\n format.html { redirect_to(actattributes_path) }\n format.xml { render :xml => @actattribute, :status => :created, :location => @actattribute }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @actattribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @attr_type = AttrType.new(params[:attr_type])\n\n respond_to do |format|\n if @attr_type.save\n flash[:notice] = 'AttrType was successfully created.'\n format.html { redirect_to(@attr_type) }\n format.xml { render :xml => @attr_type, :status => :created, :location => @attr_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attr_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @attr_val = AttrVal.new(params[:databaseformalizer_attr_val])\n \n respond_to do |format|\n if @attr_val.save\n format.html { redirect_to @attr_val, notice: 'Attr val was successfully created.' }\n format.json { render json: @attr_val, status: :created, location: @attr_val }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attr_val.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product_attribute_field = ProductAttributeField.new(params[:product_attribute_field])\n\n respond_to do |format|\n if @product_attribute_field.save\n flash[:notice] = 'Product_attribute_fields was successfully created.'\n format.html { redirect_to(admin_product_attribute_field_path(@product_attribute_field)) }\n format.xml { render :xml => @product_attribute_field, :status => :created, :location => @product_attribute_field }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product_attribute_field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @attribute = Attribute.new(attribute_params)\n\n respond_to do |format|\n if @attribute.save\n format.html { redirect_to @attribute, notice: 'Attribute was successfully created.' }\n format.json { render :show, status: :created, location: @attribute }\n else\n format.html { render :new }\n format.json { render json: @attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prd_threshold = PrdThreshold.new(params[:prd_threshold])\n\n respond_to do |format|\n if @prd_threshold.save\n format.html { redirect_to(@prd_threshold, :notice => 'PrdThreshold was successfully created.') }\n format.xml { render :xml => @prd_threshold, :status => :created, :location => @prd_threshold }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_threshold.errors, :status => :unprocessable_entity }\n end\n end\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 create\n @exp_attribute = ExpAttribute.new(exp_attribute_params)\n\n if @exp_attribute.save\n render :show, status: :created, location: @exp_attribute\n else\n render json: @exp_attribute.errors, status: :unprocessable_entity\n end\n end", "def create\n @ref_attribute = RefAttribute.new(ref_attribute_params)\n\n respond_to do |format|\n if @ref_attribute.save\n format.html { redirect_to @ref_attribute, notice: 'Uusi viitetyyppi luotu onnistuneesti.' }\n format.json { render :show, status: :created, location: @ref_attribute }\n else\n format.html { render :new }\n format.json { render json: @ref_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxon_attribute = TaxonAttribute.new(params[:taxon_attribute])\n\n respond_to do |format|\n if @taxon_attribute.save\n format.html { redirect_to @taxon_attribute, notice: 'Taxon attribute was successfully created.' }\n format.json { render json: @taxon_attribute, status: :created, location: @taxon_attribute }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxon_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chef_att_deb = ChefAttDeb.new(chef_att_deb_params)\n\n respond_to do |format|\n if @chef_att_deb.save\n format.html { redirect_to @chef_att_deb, notice: 'Chef att deb was successfully created.' }\n format.json { render :show, status: :created, location: @chef_att_deb }\n else\n format.html { render :new }\n format.json { render json: @chef_att_deb.errors, status: :unprocessable_entity }\n end\n end\n end", "def attendant_params\n params.require(:attendant).permit(:cpf, :name, :birth_date, :hiring_date, :unit_id)\n end", "def create\n @gen_attraction = GenPackage.find_by_name(params[:city]).gen_attractions.build(name: \"Test\")\n\n respond_to do |format|\n if @gen_attraction.save\n format.html { redirect_to gen_attractions_path, notice: 'Gen attraction was successfully created.' }\n format.json { render :show, status: :created, location: gen_attractions_path }\n else\n format.html { render :new }\n format.json { render json: gen_attractions_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_to_newgistics\n document = Spree::Newgistics::DocumentBuilder.build_product([self])\n response = Spree::Newgistics::HTTPManager.post('/post_products.aspx', document)\n\n if response.status == 200\n errors = Nokogiri::XML(response.body).css('errors').children.any?\n update_column(:posted_to_newgistics, true) unless errors\n end\n\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def rapport_params\n params.require(:rapport).permit(:echeance,\n ephemerides_attributes: [\n :id, :echeance, :lever, :coucher, :variation\n ],\n previsions_attributes: [\n :id, :echeance,\n domaines_attributes: [\n :id, :zone, :nom,\n cartes_attributes: [\n :id, :echeance,\n villes_attributes: [\n :id, :nom, :temperature, :temperature_min, :temperature_max, \n :uv, :temps_sensible, :vent_vitesse, :vent_direction\n ]\n ],\n zones_attributes: [\n :id, :nom, :temperature, :temperature_min, :temperature_max, \n :uv, :temps_sensible, :vent_vitesse, :vent_direction,\n :temperature_mer, :etat_mer, :lamb_x, :lamb_y\n ]\n ]\n ] \n )\n end", "def create\n @admin_attribute = Admin::Attribute.new(admin_attribute_params)\n\n respond_to do |format|\n if @admin_attribute.save\n format.html { redirect_to admin_attributes_path, notice: 'Attribute was successfully created.' }\n format.json { render :show, status: :created, location: @admin_attribute }\n else\n format.html { render :new }\n format.json { render json: @admin_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def product_product_attribute_params\n params.require(:product_product_attribute).permit(:product_id, :product_attribute_id)\n end", "def attr_params\n params.require(:attr).permit(:name)\n end", "def attr_params\n params[:attr].permit(:name, :type, :value, :foreign_key, :ordinal, :group, :visible, :editable, :required, :input)\n end", "def create\n puts \"xxxxxxx NodeAttrbsC a:create NNNN NOT USED xxxxxxx\"\n # Whitelisting is used to secure our actions from processing un-identified\n # parameters sent in the http request, this is a new Rails 4 feature\n @node_attrb = NodeAttrb.new(white_listed_params)\n # debug\n # @node_attrb[:user] = current_user \n if @node_attrb.save\n flash[:success] = \"NodeAttrb #{@node_attrb.name} saved successfully.\"\n puts \"XXXXXXXXXX redirect_to node_attrbs_path \",node_attrbs_path, \"YYYYYYYYYY\"\n redirect_to node_attrbs_path\n else\n render :new\n end\n end", "def create\n @device_attribute = @device.device_attributes.build(params[:device_attribute])\n\n respond_to do |format|\n if @device_attribute.save\n flash[:notice] = 'DeviceAttribute was successfully created.'\n format.html { redirect_to(device_device_attributes_path(@device, @device_attribute)) }\n format.xml { render :xml => @device_attribute, :status => :created, :location => @device_attribute }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @device_attribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @configattribdetail = Configattribdetail.new(configattribdetail_params)\n @configattribdetail.configattrib_id=session[:configattrib_id]\n respond_to do |format|\n if @configattribdetail.save\n format.html { redirect_to @configattribdetail, notice: 'Configattribdetail was successfully created.' }\n format.json { render :show, status: :created, location: @configattribdetail }\n else\n format.html { render :new }\n format.json { render json: @configattribdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def attraction_params\n params.require(:attraction).permit(:name, :description)\n end", "def create\n @attribute = Attribute.new(params[:attribute])\n\n respond_to do |format|\n if @attribute.save\n format.html { redirect_to @attribute, :notice => 'Attribute was successfully created.' }\n format.json { render :json => @attribute, :status => :created, :location => @attribute }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @attribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def firm_params\n params.require(:firm).permit(:title, :description, products_attributes: [:id, :title, :price, :description, :category_id, :_destroy])\n end", "def create\n @attribute = Attribute.new(params[:attribute])\n\n respond_to do |format|\n if @attribute.save\n format.html { redirect_to @attribute, notice: 'Attribute was successfully created.' }\n format.json { render json: @attribute, status: :created, location: @attribute }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_prod_dpt = PostProdDpt.new(post_prod_dpt_params)\n\n if @post_prod_dpt.save\n render json: @post_prod_dpt, status: :created, location: @post_prod_dpt\n else\n render json: @post_prod_dpt.errors, status: :unprocessable_entity\n end\n end", "def gen_attraction_params\n params.require(:gen_attraction).permit(:short_url, :iframe_url, :image, :image_thumb, :name, :description, :pricing, :location, :link, :image_description, :phone, :website, :hours, :rating, :iframe_id, :button_id, :gen_packages_id)\n end", "def prduct_params\n params.require(:prduct).permit(:name, :product_type, :description, :manufacturer_id, :has_mib, :has_access, project_ids: [])\n end", "def create\n @prd_m = PrdM.new(prd_m_params)\n\n respond_to do |format|\n if @prd_m.save\n format.html { redirect_to @prd_m, notice: 'Prd m was successfully created.' }\n format.json { render :show, status: :created, location: @prd_m }\n else\n format.html { render :new }\n format.json { render json: @prd_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_attribute_type = ItemAttributeType.new(item_attribute_type_params)\n\n if @item_attribute_type.save\n render :show, status: :created, location: @item_attribute_type\n else\n render json: @item_attribute_type.errors, status: :unprocessable_entity\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\n end", "def create\n @attribute_set = AttributeSet.new(attribute_set_params)\n\n respond_to do |format|\n if @attribute_set.save\n format.html { redirect_to @attribute_set, notice: 'Attribute set was successfully created.' }\n format.json { render :show, status: :created, location: @attribute_set }\n else\n format.html { render :new }\n format.json { render json: @attribute_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def prd_m_params\n params.require(:prd_m).permit(:SKU, :SKU_DVLPR, :SKU_SOURCE_PRD, :PRD_NAME, :PRD_NAME, :PRD_NAME_SUBTITLE, :PRD_DVLPR_ORG_NAME, :PRD_CTGRY_CD, :PRD_TYPE, :SP_PRD_TYPE, :SET_PRD_F, :SET_PRD_TYPE, :SALE_F, :RCVNG_PLCNT_PRD_F, :DLVRY_LD_TIME, :DB_PRD_DLVRY_MTHD, :LIC_TYPE, :LIC_FROM, :LIC_TO, :DSTRBTR_DISP_F, :PRD_ST, :ACDMC_LIC_F, :PRD_DLVRY_MTHD, :PRD_DESC, :PRD_NOTE, :PRD_NOTICE, :PRD_OTHER_INFO, :URL_PRD, :URL_INSTALL_GUID, :URL_LIC_AUTH_GUID, :URL_INSTALLER, :URL_PRD_IMAGE, :URL_DL, :MEMO, :SUBSCRIPTION_LIC_TERM, :SUBSCRIPTION_LIC_TERM_UNIT, :MNT_LIC_TERM, :MNT_LIC_TERM_UNIT, :ACCNT_CD_DVLPR, :ACCNT_CD_VNDR, :RGSTR_DT, :RGSTR_USR, :LST_UPD_DT, :LST_UPD_USR)\n end", "def production_params\n params.require(:production).permit(:troop_id, :description, production_details_attributes: [:id, :weight, :weight_control, :observation])\n end", "def attr_params\n att = params.fetch(:attr, {}).permit(:name, :attr_type)\n att.merge({ relation_id: params.fetch(:relation_id) })\n end", "def prd_tag_params\n params.require(:prd_tag).permit(:name)\n end", "def create_attrib_item_values \n @base_attribs = []\n @attribs = params[:attrib]\n @attribs.keys.each do | key |\n @base_attribs << AttribItemValue.new(attrib_id: key, value: @attribs[key])\n #puts \"AttribItemValue: #{@base_attribs.last.attrib.id}, #{@base_attribs.last.value}\"\n end if @attribs\n #puts \"Attribs: #{@attribs}, @base_attribs: #{@base_attribs.size}\"\n modified_item_parms = item_params\n modified_item_parms[:attrib_values] = @base_attribs\n modified_item_parms\n end", "def create\n auction_attribute = Auction::ProductAttribute.new(auction_attribute_params)\n\n begin\n if auction_attribute.save!\n flash_msg('success', '添加属性成功!', 'index')\n end\n rescue Exception => e\n flash['danger'] = \"添加属性失败!#{error_msg(auction_attribute)}\"\n return redirect_to action: 'new'\n # flash_render('danger', \"添加属性失败!#{error_msg(auction_attribute)}\", 'new')\n end\n end", "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def item_attribute_ledger_params\n params.require(:item_attribute_ledger).permit(:item_id, :data_attribute_id, :data)\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end", "def create\n @attri = Attri.new(params[:attri])\n\n respond_to do |format|\n if @attri.save\n format.html { redirect_to @attri, notice: 'Attri was successfully created.' }\n format.json { render json: @attri, status: :created, location: @attri }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attri.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1\")\n end", "def create\n @c_attribute = CAttribute.new(c_attribute_params)\n\n respond_to do |format|\n if @c_attribute.save\n format.html { redirect_to @c_attribute, notice: 'C attribute was successfully created.' }\n format.json { render :show, status: :created, location: @c_attribute }\n else\n format.html { render :new }\n format.json { render json: @c_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n res = self.class.post('/', body: attrs)\n res.created?\n end", "def create\n @entitlement = Entitlement.new(params[:entitlement])\n\n respond_to do |format|\n if @entitlement.save\n format.html { redirect_to(@entitlement, :notice => 'Entitlement was successfully created.') }\n format.xml { render :xml => @entitlement, :status => :created, :location => @entitlement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entitlement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tax_code_params\n params.require(:tax_code).permit(TaxCode.accessible_attributes.to_a)\n end", "def create\n @section_piece_param = SectionPieceParam.new(params[:section_piece_param])\n @section_piece_param['html_attribute_ids'] = params[:html_attribute_ids].join(',') \n respond_to do |format|\n if @section_piece_param.save\n format.html { redirect_to(@section_piece_param, :notice => 'SectionPieceParam was successfully created.') }\n format.xml { render :xml => @section_piece_param, :status => :created, :location => @section_piece_param }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section_piece_param.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(attrs = nil)\n attrs ||= attributes\n execute_request do\n faraday_connection.post { |req| req.body = adapter.serialize(attrs) }\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def product_params\n params.require(:product).permit(:title, :description, :sku_code, :specifications, :features, :remove_picture, :picture,:attributes_titles, category_ids:[], technology_ids:[], approval_ids:[], :models_attributes => [:id, :sku_code,:characteristics,:_destroy], :downloads_attributes => [:id, :title, :pdf, :_destroy])\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def procategory_params\n params.require(:procategory).permit(:name, :description, :ddc, :status)\n end", "def attri_params\n params.require(:attri).permit(:name, :agroup_id, :id_sort, :parent_id, :keycode)\n end", "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def create\n @iconographic_attribute = IconographicAttribute.new(iconographic_attribute_params)\n\n respond_to do |format|\n if @iconographic_attribute.save\n format.html { redirect_to @iconographic_attribute, notice: 'Iconographic attribute was successfully created.' }\n format.json { render :show, status: :created, location: @iconographic_attribute }\n else\n format.html { render :new }\n format.json { render json: @iconographic_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def thermal_production_params\n params.require(:thermal_production).permit(:company_id, :note,\n thermal_production_items_attributes: [:id, :thermal_production_id, :caldo_freddo, :utenza, :nome_generatore, :matricola, :potenza, :dest_acs, :_destroy])\n end", "def post(attributes, header = {})\n return new(attributes) if ApiKits.config.mock\n url = \"#{ApiKits.config.api_uri}#{self.resource_path}\"\n response = ApiKits::Dispatcher.post(url, { self.root_node.to_sym => attributes }, header)\n build(response, url)\n end", "def create\n @ais_attribute = AisAttribute.new(params[:ais_attribute])\n\n respond_to do |format|\n if @ais_attribute.save\n format.html { redirect_to @ais_attribute, notice: 'Record was successfully created.' }\n format.json { render json: @ais_attribute, status: :created, location: @ais_attribute }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ais_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @question_attribute = QuestionAttribute.new(params[:question_attribute])\n\n respond_to do |format|\n if @question_attribute.save\n flash[:notice] = 'QuestionAttribute was successfully created.'\n format.html { redirect_to(@question_attribute) }\n format.xml { render :xml => @question_attribute, :status => :created, :location => @question_attribute }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_attribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(attrs = nil)\n attrs ||= attributes\n\n execute_request('POST') do |uri, headers|\n HTTP.http_client.post(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end", "def service_attribute_value_params\n params.require(:service_attribute_value).permit(:service_attribute_id, :key, :name)\n end", "def create_attributes_folder(development_project, title, description = '')\n\n payload = {\n dimension: {\n meta: {\n title: title,\n summary: description,\n tags: '',\n deprecated: 0\n },\n content: {\n attributes: []\n }\n }\n }\n\n result = development_project.client.post(development_project.md['obj'], payload)\n development_project.objects(result['uri'])\nend", "def fill\n @attributes = params[:pdf_form]\n export\n end", "def ref_attribute_params\n params.require(:ref_attribute).permit(:name)\n end", "def update\n #@gen_attraction = GenAttraction.create( gen_attraction_params )\n respond_to do |format|\n if @gen_attraction.update(gen_attraction_params)\n format.html { redirect_to :gen_attractions, notice: 'Gen attraction was successfully updated.' }\n format.json { respond_with_bip(@gen_attraction) }\n else\n format.html { render :edit }\n format.json { render json: @gen_attraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity = Entity.new(params[:databaseformalizer_entity])\n @entity.attr_vals.clear\n EntitiesHelper.setAttrVals(params[:attr_vals], @entity)\n \n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully created.' }\n format.json { render json: @entity, status: :created, location: @entity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @catalog_product_attributes = CatalogProductAttributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end", "def especie_params\n params.require(:especie).permit(:nombre, :estatus, :fuente, :nombre_autoridad, :numero_filogenetico,\n :cita_nomenclatural, :sis_clas_cat_dicc, :anotacion, :categoria_taxonomica_id, :parent_id,\n especies_catalogos_attributes: [:id, :observaciones, :catalogo_id, :_destroy],\n especies_regiones_attributes: [:id, :observaciones, :region_id, :tipo_distribucion_id, :_destroy],\n nombres_regiones_attributes: [:id, :observaciones, :region_id, :nombre_comun_id, :_destroy],\n nombres_regiones_bibliografias_attributes: [:id, :observaciones, :region_id, :nombre_comun_id, :bibliografia_id, :_destroy]\n )\n end", "def create\n @collectible_attribute_list = CollectibleAttributeList.new(collectible_attribute_list_params)\n\n respond_to do |format|\n if @collectible_attribute_list.save\n format.html { redirect_to @collectible_attribute_list, notice: 'Collectible attribute list was successfully created.' }\n format.json { render :show, status: :created, location: @collectible_attribute_list }\n else\n format.html { render :new }\n format.json { render json: @collectible_attribute_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_params\n params.require(:product).permit(:ic,:name)\n end", "def pregnancy_params\n params.require(:pregnancy).permit(:name, :dog_id, :heat_start_date, :due_date, :surgery_date, :total_puppy, :note, :pictures_attributes => [:id, :file, '_destroy'])\n end", "def variation_params\n params.require(:variation).permit(:project_item_id, :approved, :project_id, :item_id, :item_attribute_id)\n end", "def recipe_prod_params\n params.require(:recipe_prod).permit(:recipes_id, :prods_id)\n end", "def taxon_determination_params\n params.require(:taxon_determination).permit(:biological_collection_object_id, :taxon_determination_id, :position, :year_made, :month_made, :day_made)\n end", "def create\n models = params[:product][:models_attributes]\n if !models.nil?\n models.each do |model|\n model[1][:characteristics] = sanitize_attributes(model[1][:characteristics])\n end\n end\n clean_params = product_params\n clean_params[:specifications] = sanitize_data(clean_params[:specifications])\n clean_params[:features] = sanitize_data(clean_params[:features])\n clean_params[:attributes_titles] = sanitize_attributes(clean_params[:attributes_titles])\n\n @product = Product.new(clean_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to [:admin, @product], notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def req_params\n params.require(:req).permit(:dbr_id,\n :req_number, \n :fiscal_year, \n :create_by_org, \n :status, \n :operating_entity, \n :title, \n :pec, \n :sag, \n :panel, \n :majcom_panel, \n :majcom_directorate, \n :eeic, \n :object_class, \n :esp, \n :rccc, \n :aai, \n :req_total, \n :funding_secured, \n :authorized_amount, \n :owner_priority, \n :grp, \n :unit, \n :final_FY, \n :pop_start_date, \n :pop_end_date, \n :method_of_purchase, \n :priority_level, \n :budget_authority, \n :needby_date, \n :contract_number, \n :reviewed_by, \n :point_of_contact,\n :installation,\n answers_attributes: [\n :question_id,\n :id,\n :text,\n :boolean,\n :answer\n ]\n )\n end", "def create\n @tax_p = TaxP.new(params[:tax_p])\n @tax_p.tax_paid_and_refund_id = @tax_paid_and_refund.id\n\n respond_to do |format|\n if @tax_p.save\n flash[:notice] = 'TaxP was successfully created.'\n format.html { redirect_to(tax_ps_url) }\n # format.html { redirect_to(@tax_p) }\n # format.xml { render :xml => @tax_p, :status => :created, :location => @tax_p }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tax_p.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_products_attributes_with_http_info(attribute, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProductsAttributesApi.add_products_attributes ...\"\n end\n # verify the required parameter 'attribute' is set\n if @api_client.config.client_side_validation && attribute.nil?\n fail ArgumentError, \"Missing the required parameter 'attribute' when calling ProductsAttributesApi.add_products_attributes\"\n end\n # resource path\n local_var_path = \"/attributes\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(attribute)\n auth_names = ['APIKeyHeader']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Attribute>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductsAttributesApi#add_products_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @prduct = Prduct.new(prduct_params)\n\n respond_to do |format|\n if @prduct.save\n format.html { redirect_to @prduct, notice: 'Prduct was successfully created.' }\n format.json { render :show, status: :created, location: @prduct }\n else\n format.html { render :new }\n format.json { render json: @prduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pdig = Pdig.new(params[:pdig])\n\n respond_to do |format|\n if @pdig.save\n flash[:notice] = 'Pdig was successfully created.'\n format.html { redirect_to(@pdig) }\n format.xml { render :xml => @pdig, :status => :created, :location => @pdig }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pdig.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_outcome_request\n raise IMS::LTI::InvalidLTIConfigError, \"\" unless has_required_attributes?\n\n res = post_service_request(@lis_outcome_service_url,\n 'application/xml',\n generate_request_xml)\n\n @outcome_response = extend_outcome_response(OutcomeResponse.new)\n @outcome_response.process_post_response(res)\n end", "def custom_attributes(product_id)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attributes\")\n\n handle_response(response, status)\n end", "def create\n @attribute_group = AttributeGroup.new(params[:attribute_group])\n\n respond_to do |format|\n if @attribute_group.save\n format.html { redirect_to(@attribute_group, :notice => 'Attribute group was successfully created.') }\n format.xml { render :xml => @attribute_group, :status => :created, :location => @attribute_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attribute_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def product_params\n params.require(:product).permit(\n :gtin, :bar_code_type, :unit_descriptor, :internal_supplier_code, :brand_name, :description_short, :description_full, :active,\n client_products_attributes: [:id, client_attributes: [:client_type, :gln, :full_name, :short_name, :description]]\n )\n end" ]
[ "0.6226755", "0.6016898", "0.59168947", "0.58473545", "0.5731617", "0.573151", "0.5638003", "0.561468", "0.5600245", "0.5581907", "0.5556145", "0.55492705", "0.55184126", "0.55076", "0.54967743", "0.5494441", "0.54814786", "0.5480252", "0.54514563", "0.5427169", "0.5426517", "0.5418958", "0.5418624", "0.5406214", "0.5387454", "0.53713846", "0.5361792", "0.5361211", "0.5355152", "0.53516436", "0.5339056", "0.5306958", "0.53033745", "0.5293716", "0.5286441", "0.52533424", "0.52451974", "0.52226204", "0.5209964", "0.5205273", "0.52029973", "0.5187757", "0.518466", "0.51844466", "0.5184102", "0.5178701", "0.5173275", "0.5169224", "0.5163795", "0.5158787", "0.51503384", "0.5148387", "0.5134808", "0.51343715", "0.512896", "0.51269096", "0.5124248", "0.51087624", "0.5091497", "0.5088813", "0.5088297", "0.5085456", "0.50770235", "0.5063906", "0.50573546", "0.5054212", "0.503804", "0.5031705", "0.5021173", "0.50199157", "0.50186086", "0.50177497", "0.5017604", "0.5008016", "0.5006271", "0.50047165", "0.50014764", "0.4999345", "0.49985746", "0.49941462", "0.49874762", "0.49834496", "0.49806502", "0.49784932", "0.49761972", "0.4972349", "0.49706194", "0.49700317", "0.49680898", "0.49674767", "0.49664855", "0.49633923", "0.49576804", "0.49549797", "0.495496", "0.49534032", "0.49526596", "0.4946382", "0.49436978", "0.49434668" ]
0.6485095
0
PUT /prd_attributes/1 PUT /prd_attributes/1.xml
def update @prd_attribute = PrdAttribute.find(params[:id]) @prd_attribute.code = params[:prd_attribute]['code'] @prd_attribute.name = params[:prd_attribute]['name'] @prd_attribute.rollover = params[:prd_attribute]['rollover'] @prd_attribute.description = params[:prd_attribute]['description'] @prd_attribute.status_id = params[:prd_attribute]['status'].to_i @prd_attribute.prd_type = params[:prd_attribute]['prd_type'] @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee'] @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee'] @prd_attribute.target_user = params[:prd_attribute]['target_user'] @prd_attribute.start_date = params[:prd_attribute]['start_date'] @prd_attribute.end_date = params[:prd_attribute]['end_date'] respond_to do |format| format.html { if @prd_attribute.update_attributes(params[:prd_attribute]) redirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully updated.') else format.html { render :action => "edit" } end } format.xml { if @prd_attribute.update_attributes(params[:prd_attribute]) head :ok else format.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity } end } format.json { # bundle일 때에는 해당하는 product id들을 저장 # if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE' product_ids = [] params[:prd_attribute]['ref_products'].each do |product_id| product_ids << product_id['product_id'].to_s end @prd_attribute.ref_products = product_ids.join(",") end @prd_attribute.save # product devices 저장 # if not params[:prd_attribute]['devices'].blank? params[:prd_attribute]['devices'].each do |device| prd_attribute_device = PrdAttributeDevice.new prd_attribute_device.code_factor_id = device['device'].to_i prd_attribute_device.prd_attribute_id = @prd_attribute.id prd_attribute_device.product_id = @prd_attribute.products[0].id prd_attribute_device.save! end end #render :json => @prd_attribute.errors, :status => :unprocessable_entity head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n\n respond_to do |format|\n if @catalog_product_attributes.update_attributes(params[:catalog_product_attributes])\n flash[:notice] = 'CatalogProductAttributes was successfully updated.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalog_product_attributes.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 @taxon_attribute = TaxonAttribute.find(params[:id])\n\n respond_to do |format|\n if @taxon_attribute.update_attributes(params[:taxon_attribute])\n format.html { redirect_to @taxon_attribute, notice: 'Taxon attribute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attr_type = AttrType.find(params[:id])\n\n respond_to do |format|\n if @attr_type.update_attributes(params[:attr_type])\n flash[:notice] = 'AttrType was successfully updated.'\n format.html { redirect_to(@attr_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attr_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update\n @prd_etc = PrdEtc.find(params[:id])\n\n respond_to do |format|\n if @prd_etc.update_attributes(params[:prd_etc])\n format.html { redirect_to(@prd_etc, :notice => 'PrdEtc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prd_etc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@gen_attraction = GenAttraction.create( gen_attraction_params )\n respond_to do |format|\n if @gen_attraction.update(gen_attraction_params)\n format.html { redirect_to :gen_attractions, notice: 'Gen attraction was successfully updated.' }\n format.json { respond_with_bip(@gen_attraction) }\n else\n format.html { render :edit }\n format.json { render json: @gen_attraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n @actattribute = Actattribute.find(params[:id])\n\n respond_to do |format|\n if @actattribute.update_attributes(params[:actattribute])\n flash[:notice] = 'Attribute was successfully updated.'\n expire_page(actattributes_path(@actattribute))\n format.html { redirect_to(actattributes_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @actattribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_firmware(attributes = {})\n patch('replace', '/firmware', attributes)\n end", "def update\n @product_attribute_field = ProductAttributeField.find(params[:id])\n\n respond_to do |format|\n if @product_attribute_field.update_attributes(params[:product_attribute_field])\n flash[:notice] = 'Product_attribute_fields was successfully updated.'\n format.html { redirect_to(admin_product_attribute_field_path(@product_attribute_field)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_attribute_field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n if @prd_threshold.update_attributes(params[:prd_threshold])\n format.html { redirect_to(@prd_threshold, :notice => 'PrdThreshold was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prd_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @attr.update(attr_params)\n format.html { redirect_to [@inspection, @attr], notice: 'Attr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attr.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attr_val = AttrVal.find(params[:id])\n \n respond_to do |format|\n if @attr_val.update_attributes(params[:databaseformalizer_attr_val])\n format.html { redirect_to @attr_val, notice: 'Attr val was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attr_val.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_resource(resource, attributes)\n resource.attributes = attributes\n resource.save\n resource\n end", "def update\n respond_to do |format|\n if @idp_attribute.update(idp_attribute_params)\n format.html { redirect_to @idp_attribute, notice: 'IdP attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @idp_attribute }\n format.js { @status = 'success'}\n else\n format.html { render :edit }\n format.json { render json: @idp_attribute.errors, status: :unprocessable_entity }\n format.js { @status = 'fail' }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_product_attribute.update(product_product_attribute_params)\n format.html { redirect_to @product_product_attribute, notice: 'Product product attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_product_attribute }\n else\n format.html { render :edit }\n format.json { render json: @product_product_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attribute = Attribute.find(params[:id])\n\n respond_to do |format|\n if @attribute.update_attributes(params[:attribute])\n format.html { redirect_to @attribute, :notice => 'Attribute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @attribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prd_tag.update(prd_tag_params)\n format.html { redirect_to @prd_tag, notice: 'Prd tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @prd_tag }\n else\n format.html { render :edit }\n format.json { render json: @prd_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attributes = {})\n set_all(attributes)\n update_options = {\n 'If-Match' => @data.delete('eTag'),\n 'Body' => @data\n }\n response = @client.rest_put(@data['uri'], update_options, @api_version)\n body = @client.response_handler(response)\n set_all(body)\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n @attribute = Attribute.find(params[:id])\n\n respond_to do |format|\n if @attribute.update_attributes(params[:attribute])\n format.html { redirect_to @attribute, notice: 'Attribute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @attractive.update(attractive_params)\n format.html { redirect_to @attractive, notice: 'Attractive was successfully updated.' }\n format.json { render :show, status: :ok, location: @attractive }\n else\n format.html { render :edit }\n format.json { render json: @attractive.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n if @taxirequest.update_attributes(params[:taxirequest])\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxirequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update\n @pr = Pr.find(params[:id])\n\n respond_to do |format|\n if @pr.update_attributes(params[:pr])\n format.html { redirect_to(@pr, :notice => 'Pr was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pr.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n params[:product_attr].to_a.each do |key, attr|\n product = Product.find(key)\n product.update_attributes(attr)\n end\n redirect_to(harman_employee_pricing_admin_products_path, notice: \"Pricing updated successfully.\")\n end", "def update\n @ais_attribute = AisAttribute.find(params[:id])\n\n respond_to do |format|\n if @ais_attribute.update_attributes(params[:ais_attribute])\n format.html { redirect_to @ais_attribute, notice: 'Record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ais_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entity = Entity.find(params[:id])\n @entity.attr_vals.clear\n EntitiesHelper.setAttrVals(params[:attr_vals], @entity)\n @entity.attributes = params[:databaseformalizer_entity]\n \n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_attributes(attributes)\n attributes, rdf_attributes = extract_attributes!(attributes)\n rdf_attributes.each do |k,v|\n send(k + \"=\", v)\n send('save_' + k)\n end\n end", "def update\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n if @prize.update_attributes(params[:prize])\n flash[:notice] = 'Prize was successfully updated.'\n format.html { redirect_to(@prize) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prize.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n if @attri.update_attributes(params[:attri])\n format.html { redirect_to @attri, notice: 'Attri was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attri.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_attribute = QuestionAttribute.find(params[:id])\n\n respond_to do |format|\n if @question_attribute.update_attributes(params[:question_attribute])\n flash[:notice] = 'QuestionAttribute was successfully updated.'\n format.html { redirect_to(@question_attribute) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_attribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update attrs\n put '', :body => {self.class.api_name => self.class.opts_to_query_opts(attrs)}\n end", "def update\n\n @l1.modified_by_user_id = current_user.id\n if @l1.update!(l1_params)\n if params[:attr].present?\n params[:attr].each do |att|\n attr_value_object = AttributeValue.find_by_label_attribute_id_and_object_id_and_object_type(att[0], @l1.id, 'L1')\n if attr_value_object.present?\n attr_value_object.value = att[1]\n attr_value_object.save!\n else\n AttributeValue.create_single_attribute_value(att[0], att[1], @l1, 'L1') \n end\n end\n end \n AdditionalInfo.create(work_flow_id: @workflow.id, object_id: @l1.id,object_type: 'L1' , status: @l1.status, user_id: current_user.id)\n\n redirect_to root_path, notice: @workflow.L1+' was successfully updated.'\n else\n render :edit\n end\n end", "def create\n\n @prd_attribute = PrdAttribute.new\n\n @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i\n @prd_attribute.name = params[:prd_attribute]['name']\n @prd_attribute.rollover = params[:prd_attribute]['rollover']\n @prd_attribute.code = params[:prd_attribute]['code']\n @prd_attribute.prd_type = params[:prd_attribute]['prd_type']\n @prd_attribute.description = params[:prd_attribute]['description']\n @prd_attribute.status_id = params[:prd_attribute]['status'].to_i\n\n @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i\n @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee'].to_i\n @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee'].to_i\n @prd_attribute.target_user = params[:prd_attribute]['target_user']\n @prd_attribute.start_date = params[:prd_attribute]['start_date']\n @prd_attribute.end_date = params[:prd_attribute]['end_date']\n\n respond_to do |format|\n if @prd_attribute.save\n format.html { redirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully created.') }\n format.xml { render :xml => @prd_attribute, :status => :created, :location => @prd_attribute }\n format.json {\n\t\t\tproduct = Product.new\n product.prd_attribute_id = @prd_attribute.id\n product.save!\n\n # bundle일 때에는 해당하는 product id들을 저장\n #\n if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE'\n product_ids = []\n\t\t\t params[:prd_attribute]['ref_products'].each do |product_id|\n\t\t\t product_ids << product_id['product_id'].to_s\n\t\t end\n\t\t @prd_attribute.ref_products = product_ids.join(\",\")\n end \n\t\t @prd_attribute.save\n\n # product devices 저장\n #\n if not params[:prd_attribute]['devices'].blank?\n params[:prd_attribute]['devices'].each do |device|\n prd_attribute_device = PrdAttributeDevice.new\n prd_attribute_device.code_factor_id = device['device'].to_i\n prd_attribute_device.prd_attribute_id = @prd_attribute.id\n prd_attribute_device.product_id = product.id\n prd_attribute_device.save!\n end\n end\n\n # product에 대한 기본 conditions 설정\n #\n product.set_default_conditions(@prd_attribute, product)\n\n\t\t\trender :json => mapping_to_hash(@prd_attribute, PrdAttribute.json_mapping_table), :status => :created, :location => @prd_attribute \n\t\t}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity }\n format.json { \n\t\t\trender :json => @prd_attribute.errors, :status => :unprocessable_entity \t}\n end\n end\n end", "def update_attribute\n end", "def update(attributes)\n self.class.new(GeoIQ.put(\"#{path}.json\", attributes).parsed_response)\n end", "def update attributes\n attributes.each do |name, value|\n send \"#{name}=\", value if respond_to? \"#{name}=\"\n end\n save\n end", "def update\n @entitlement = Entitlement.find(params[:id])\n\n respond_to do |format|\n if @entitlement.update_attributes(params[:entitlement])\n format.html { redirect_to(@entitlement, :notice => 'Entitlement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entitlement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_attr\n @attr = Attr.find(params[:id])\n end", "def set_attr\n @attr = Attr.find(params[:id])\n end", "def update\n respond_to do |format|\n if @attribute_set.update(attribute_set_params)\n format.html { redirect_to @attribute_set, notice: 'Attribute set was successfully updated.' }\n format.json { render :show, status: :ok, location: @attribute_set }\n else\n format.html { render :edit }\n format.json { render json: @attribute_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ref_attribute.update(ref_attribute_params)\n format.html { redirect_to @ref_attribute, notice: 'Ref attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @ref_attribute }\n else\n format.html { render :edit }\n format.json { render json: @ref_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @variate = Variate.find(params[:id])\n\n respond_to do |format|\n if @variate.update_attributes(params[:variate])\n flash[:notice] = 'Variate was successfully updated.'\n format.html { redirect_to variate_url(@variate) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @variate.errors.to_xml }\n end\n end\n end", "def update\n if @exp_attribute.update(exp_attribute_params)\n render :show, status: :ok, location: @exp_attribute\n else\n render json: @exp_attribute.errors, status: :unprocessable_entity\n end\n end", "def update_attributes(atts)\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end", "def update!(**args)\n @attribute_id = args[:attribute_id] if args.key?(:attribute_id)\n end", "def update\n respond_to do |format|\n if @configattribdetail.update(configattribdetail_params)\n format.html { redirect_to @configattribdetail, notice: 'Configattribdetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @configattribdetail }\n else\n format.html { render :edit }\n format.json { render json: @configattribdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @asproduct = Asproduct.find(params[:id])\n\n respond_to do |format|\n if @asproduct.update_attributes(params[:asproduct])\n format.html { redirect_to @asproduct, notice: 'Asproduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_kapp_attribute_definition(kapp_slug, name, body, headers=default_headers)\n @logger.info(\"Updating the \\\"#{name}\\\" Kapp attribute definition in the \\\"#{kapp_slug}\\\" kapp.\")\n put(\"#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions/#{encode(name)}\",body, headers)\n end", "def update_harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n Array(params[:product_attr].to_unsafe_h).each do |key, attr|\n product = Product.find(key)\n product.update(attr)\n end\n redirect_to(harman_employee_pricing_admin_products_path, notice: \"Pricing updated successfully.\")\n end", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update_attributes(atts)\n atts.delete('_type')\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end", "def update\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n\n respond_to do |format|\n if @ppos_prerequisite.update_attributes(params[:ppos_prerequisite])\n flash[:notice] = 'PposPrerequisite was successfully updated.'\n format.html { redirect_to(@ppos_prerequisite) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ppos_prerequisite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_feature(feature_key, attributes)\n features[feature_key].update_attribute(attributes)\n save\n end", "def update\n @predicate = Predicate.find(params[:id])\n if @predicate.scope_type == 'Attribute type' && aspect?\n @predicate.project_id = current_aspect.id\n end\n\n respond_to do |format|\n if @predicate.update_attributes(params[:predicate])\n format.html { redirect_to @predicate, notice: 'Predicate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @predicate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n @product.attributes = params[:product]\n render_after_save('edit')\n end", "def update\n @prod = Prod.find(params[:id])\n\n respond_to do |format|\n if @prod.update_attributes(params[:prod])\n format.html { redirect_to @prod, :notice => 'Prod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @prod.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update_attributes(params)\n @ident = params[:ident].to_s\n @description = params[:description].to_s\n end", "def set_product_product_attribute\n @product_product_attribute = ProductProductAttribute.find(params[:id])\n end", "def update(attributes: {})\n attributes = attributes.with_indifferent_access\n clean_attributes(attributes)\n titleize(attributes)\n sync_tags(attributes)\n parse_ingredients(attributes)\n recipe.update(attributes)\n recipe_response\n rescue StandardError => e\n error_response(e)\n end", "def update_form_attribute_definition(kapp_slug, name, body, headers=default_headers)\n @logger.info(\"Updating the \\\"#{name}\\\" Form attribute definition in the \\\"#{kapp_slug}\\\" kapp.\")\n put(\"#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions/#{encode(name)}\",body, headers)\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n end", "def update\n @sample_product = SampleProduct.find(params[:id])\n\n respond_to do |format|\n if @sample_product.update_attributes(params[:sample_product])\n format.html { redirect_to(@sample_product, :notice => 'Sample product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sample_product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iconographic_attribute.update(iconographic_attribute_params)\n format.html { redirect_to @iconographic_attribute, notice: 'Iconographic attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @iconographic_attribute }\n else\n format.html { render :edit }\n format.json { render json: @iconographic_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def new\n @prd_attribute = PrdAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_attribute }\n format.json { render :json => @prd_attribute }\n end\n end", "def update_attributes(attributes = nil)\r\n self.attributes = attributes\r\n save\r\n end", "def update\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n if @onecompany_product.update_attributes(params[:onecompany_product])\n format.html { redirect_to @onecompany_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onecompany_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @configattribincl.update(configattribincl_params)\n format.html { redirect_to @configattribincl, notice: 'Configattribincl was successfully updated.' }\n format.json { render :show, status: :ok, location: @configattribincl }\n else\n format.html { render :edit }\n format.json { render json: @configattribincl.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incentive = Incentive.find(params[:id])\n\n respond_to do |format|\n if @incentive.update_attributes(params[:incentive])\n format.html { redirect_to(@incentive, :notice => 'Incentive was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incentive.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @attribute.update(attribute_params)\n format.html { redirect_to @attribute, notice: 'Attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @attribute }\n else\n format.html { render :edit }\n format.json { render json: @attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_attributes(attribs = {})\n attribs.each { |name, value| write_attribute(name, value) }\n end", "def update\n if @item_attribute_type.update(item_attribute_type_params)\n render :show, status: :ok, location: @item_attribute_type\n else\n render json: @item_attribute_type.errors, status: :unprocessable_entity\n end\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 @pdig = Pdig.find(params[:id])\n\n respond_to do |format|\n if @pdig.update_attributes(params[:pdig])\n flash[:notice] = 'Pdig was successfully updated.'\n format.html { redirect_to(@pdig) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pdig.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save\n self.attributes =\n if persisted?\n PROXY.patch(\"#{resources_name}/#{id}\", attributes)\n else\n @persisted = true\n PROXY.post(resources_name, attributes)\n end\n end", "def update\n @proposed_person = ProposedPerson.find(params[:id])\n\n respond_to do |format|\n if @proposed_person.update_attributes(params[:proposed_person])\n flash[:notice] = 'ProposedPerson was successfully updated.'\n format.html { redirect_to(@proposed_person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @proposed_person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n get_product\n @product_detail = @product.details.find(params[:id])\n @product_detail.update_attributes(params[:product_detail])\n end", "def update\n begin\n @prov_xn = ProvXn.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error(\"record not found during update: #{$!}\")\n return(head :not_found)\n end\n if @prov_xn.update_attributes(params[:prov_xn])\n return(head :ok)\n else\n logger.error(\"validation error during update: [#{$!}] :: [#{@prov_xn.errors.full_messages}]\")\n render :xml => @prov_xn.errors, :status => 400\n end\n end", "def product_product_attribute_params\n params.require(:product_product_attribute).permit(:product_id, :product_attribute_id)\n end", "def update\n @priced_item = PricedItem.find(params[:id])\n\n respond_to do |format|\n if @priced_item.update_attributes(params[:priced_item])\n flash[:notice] = 'PricedItem was successfully updated.'\n format.html { redirect_to([:admin, @priced_item]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @priced_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @domicile_type = DomicileType.find(params[:id])\n\n respond_to do |format|\n if @domicile_type.update_attributes(params[:domicile_type])\n format.html { redirect_to(@domicile_type, :notice => 'Domicile type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domicile_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @device_attribute.update_attributes(params[:device_attribute])\n flash[:notice] = 'DeviceAttribute was successfully updated.'\n format.html { redirect_to(device_device_attribute_path(@device, @device_attribute)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device_attribute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @produtividade = Produtividade.find(params[:id])\n\n respond_to do |format|\n if @produtividade.update_attributes(params[:produtividade])\n format.html { redirect_to(@produtividade, :notice => 'Produtividade was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @produtividade.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @prioridade_adocao = PrioridadeAdocao.find(params[:id])\n\n respond_to do |format|\n if @prioridade_adocao.update_attributes(params[:prioridade_adocao])\n format.html { redirect_to @prioridade_adocao, notice: 'Prioridade adocao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prioridade_adocao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\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_attributes!(attributes = nil)\r\n self.attributes = attributes\r\n save!\r\n end", "def update\n @food_product.update(food_product_params)\n end", "def update\n @catalogs_priority = Catalogs::Priority.find(params[:id])\n\n respond_to do |format|\n if @catalogs_priority.update_attributes(params[:catalogs_priority])\n format.html { redirect_to(@catalogs_priority, :notice => 'Priority was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalogs_priority.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_attributes(_params)\n assign_attributes _params\n save\n end", "def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end", "def update\n @production = Production.find(params[:id])\n\n respond_to do |format|\n if @production.update_attributes(params[:production])\n format.html { redirect_to(@production, :notice => 'Production was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @production.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64087325", "0.6311469", "0.61315656", "0.60436094", "0.58606386", "0.5845868", "0.5800207", "0.57984424", "0.5787223", "0.57798105", "0.5776507", "0.5734052", "0.57293284", "0.572496", "0.5718098", "0.57012695", "0.5687673", "0.5682747", "0.5672973", "0.56634986", "0.5661976", "0.56549895", "0.5653187", "0.5600826", "0.5578661", "0.55761296", "0.55746955", "0.5567629", "0.55607295", "0.5560637", "0.5558606", "0.5556358", "0.55507547", "0.5541519", "0.5538348", "0.55320895", "0.55243105", "0.55189985", "0.5517636", "0.55119956", "0.55109227", "0.55109227", "0.55002105", "0.5500177", "0.54931116", "0.5487655", "0.5477272", "0.5476308", "0.5472989", "0.5472768", "0.5471189", "0.54571646", "0.54535466", "0.54535466", "0.54515564", "0.54514956", "0.5441057", "0.5438986", "0.54270524", "0.5421805", "0.54172117", "0.54128325", "0.53837085", "0.5382552", "0.5381016", "0.5377656", "0.5376413", "0.53741217", "0.53696483", "0.5364259", "0.5362167", "0.5354934", "0.535426", "0.5352806", "0.53507304", "0.5341595", "0.5340664", "0.5339518", "0.5336214", "0.53287345", "0.5328417", "0.53222567", "0.5318666", "0.5315588", "0.5314295", "0.5312154", "0.5311208", "0.5306862", "0.5305606", "0.53039336", "0.5299588", "0.52988386", "0.5298668", "0.52969986", "0.5294298", "0.5293723", "0.5291", "0.5289435", "0.5287692", "0.5286433" ]
0.645485
0
DELETE /prd_attributes/1 DELETE /prd_attributes/1.xml
def destroy @prd_attribute = PrdAttribute.find(params[:id]) @prd_attribute.destroy #delete_rules() respond_to do |format| format.html { redirect_to(prd_attributes_url) } format.xml { head :ok } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n @catalog_product_attributes.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalog_product_attributes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @actattribute = Actattribute.find(params[:id])\n @actattribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(actattributes_url) }\n format.xml { head :ok }\n end\n end", "def delete(attribute); end", "def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxon_attribute = TaxonAttribute.find(params[:id])\n @taxon_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prd_threshold = PrdThreshold.find(params[:id])\n @prd_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_thresholds_url) }\n format.xml { head :ok }\n end\n end", "def DeleteAttributes(args)#(key, domainName, itemName, attributes)\n raise Error::NoSuchDomain.new if @storge.find_domain_by_name(args[:key],args[:domainName]).blank?\n @storge.delete_one_item_attrs(args[:key], args[:domainName], args[:itemName], args[:attributes])\n end", "def delete_attribute(key); end", "def destroy\n @product_attribute_field = ProductAttributeField.find(params[:id])\n @product_attribute_field.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_product_attribute_fields_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ais_attribute = AisAttribute.find(params[:id])\n @ais_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to ais_attributes_url, notice: 'Record was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete_service_attributes(url, attributes)\n callback = Proc.new{ |hslp, err, cookie| }\n\n begin\n cookie = FFI::MemoryPointer.new(:void)\n result = SLPDelAttrs(@handle, url, attributes, callback, cookie)\n raise Error, \"SLPDelAttrs(): #{result}\" if result != :SLP_OK\n ensure\n cookie.free unless cookie.null?\n end\n\n attributes\n end", "def destroy\n # @idp_attribute.destroy\n respond_to do |format|\n format.html { redirect_to idp_attributes_url, notice: 'IdP attribute can not be destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_configuration_product\r\n # node = ProductPackageProduct.find(params[:id].to_i).destroy\r\n # redirect_to :action => \"configuration_products\", :id => node.parent_id\r\n ExampleConfigurationProduct.delete params[:id]\r\n redirect_to :action => \"configuration_products\", :id => params[:id]\r\n end", "def destroy\n @attribute = Attribute.find(params[:id])\n @attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attribute = Attribute.find(params[:id])\n @attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to attributes_url }\n format.json { head :no_content }\n end\n end", "def delete(product_attribute_name)\n path = \"/product-attribute-definitions/#{product_attribute_name}\"\n\n response, status = BeyondApi::Request.delete(@session,\n path)\n\n handle_response(response, status, respond_with_true: true)\n end", "def destroy\n @attr_val = AttrVal.find(params[:id])\n @attr_val.destroy\n \n respond_to do |format|\n format.html { redirect_to databaseformalizer_attr_vals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @collection_attribute = CollectionAttribute.find(params[:id])\n @collection_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(collection_attributes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attri = Attri.find(params[:id])\n @attri.destroy\n\n respond_to do |format|\n format.html { redirect_to attris_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question_attribute = QuestionAttribute.find(params[:id])\n @question_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_attributes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attribute_group = AttributeGroup.find(params[:id])\n @attribute_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(attribute_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attractive.destroy\n respond_to do |format|\n format.html { redirect_to attractives_url, notice: 'Attractive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_attribute(*args)\n end", "def destroy\n @device_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(device_attributes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @configattribdetail.destroy\n respond_to do |format|\n format.html { redirect_to configattribdetails_url, notice: 'Configattribdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @topic_attribute = TopicAttribute.find(params[:id])\n \n @topic_attribute.opinions.each do |opinion|\n opinion.destroy\n end\n \n @topic_attribute.destroy\n\n respond_to do |format|\n format.html { \n redirect_to(root_path)\n #topic_attributes_url\n }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @attr.destroy\n respond_to do |format|\n format.html { redirect_to attrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_attribute.destroy\n respond_to do |format|\n format.html { redirect_to ref_attributes_url, notice: 'Ref attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exp_attribute.destroy\n end", "def destroy\n @ezr_content_class_attribute = EzrContentClassAttribute.find(params[:id])\n @ezr_content_class_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(ezr_content_class_attributes_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete_custom_attribute(product_id, attribute_name)\n response, status = BeyondApi::Request.delete(@session, \"/products/#{product_id}/attributes/#{attribute_name}\")\n\n handle_response(response, status, respond_with_true: true)\n end", "def destroy\n @item_attribute_type.destroy\n end", "def destroy\n @user_attribute = UserAttribute.find(params[:id])\n @user_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_attributes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image_attrib.destroy\n end", "def destroy\n @gen_attraction.destroy\n respond_to do |format|\n format.html { redirect_to gen_attractions_url, notice: 'Gen attraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site_attribute = @site.site_attributes.find(params[:id])\n @site_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(site_site_attributes_url(@site)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attribute_set.destroy\n respond_to do |format|\n format.html { redirect_to attribute_sets_url, notice: 'Attribute set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @karyalay_attribute.destroy\n respond_to do |format|\n format.html { redirect_to karyalay_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @product_product_attribute.destroy\n respond_to do |format|\n format.html { redirect_to product_product_attributes_url, notice: 'Product product attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_node(xpath, attrs)\n @doc.find(xpath).each do |node|\n node.remove! if node_match?(node, attrs)\n end\n end", "def destroy\n @admin_attribute.destroy\n respond_to do |format|\n format.html { redirect_to admin_attributes_url, notice: 'Attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end", "def delete\n execute_prlctl('delete', @uuid)\n end", "def destroy\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n @ppos_prerequisite.destroy\n\n respond_to do |format|\n format.html { redirect_to(ppos_prerequisites_url) }\n format.xml { head :ok }\n end\n end", "def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end", "def destroy\n @default_attribute.destroy\n CharacterAttribute.where(default_attribute_id: @default_attribute.id).destroy_all\n respond_to do |format|\n format.html { redirect_to({ controller: 'default_attributes', action: 'index', book_id: @book.id }) }\n format.json { head :no_content }\n end\n end", "def destroy\n @configattribmaster.destroy\n respond_to do |format|\n format.html { redirect_to configattribmasters_url, notice: 'Configattribmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete_all(xpath); end", "def destroy\n @attribute_list.destroy\n respond_to do |format|\n format.html { redirect_to attribute_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entitlement = Entitlement.find(params[:id])\n @entitlement.destroy\n\n respond_to do |format|\n format.html { redirect_to(entitlements_url) }\n format.xml { head :ok }\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 delete\n namespace.delete(dn)\n @attributes = (@original_attributes||{}).merge(@attributes)\n @original_attributes = nil\n self\n end", "def del_attribs_by_cid(id )\n url = \"#{self.url}/cid/#{id}?auth=#{self.authtoken}\"\n status, _ = rest_delete( url )\n return status\n end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def destroy\n @attribute.destroy\n respond_to do |format|\n format.html { redirect_to attributes_url, notice: 'Attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_kapp_attribute_definition(kapp_slug, name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Kapp attribute definition from the \\\"#{kapp_slug}\\\" kapp.\")\n delete(\"#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions/#{encode(name)}\", headers)\n end", "def destroy\n @c_attribute.destroy\n respond_to do |format|\n format.html { redirect_to c_attributes_url, notice: 'C attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_attribute(attr_name)\n debug(\"Model#delete_attribute(#{attr_name.inspect})\")\n set_attribute(attr_name, nil)\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def delete_attributes(ents)\n ents.each { |e|\n e.delete_attribute('MSPhysics') if e.get_attribute('MSPhysics', 'Type', 'Body') == 'Body'\n e.delete_attribute('MSPhysics Body')\n #~ e.delete_attribute('MSPhysics Joint')\n dict = e.attribute_dictionary('MSPhysics Joint')\n if dict\n dict.keys.each { k|\n e.delete_attribute('MSPhysics Joint', k) if k != 'Type'\n }\n end\n e.delete_attribute('MSPhysics Script')\n e.delete_attribute('MSPhysics Buoyancy Plane')\n }\n end", "def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdigs_url) }\n format.xml { head :ok }\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 delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def destroy\n #@tax_p = TaxP.find(params[:id])\n @tax_p = get_taxp_form_paramid(params[:id])\n @tax_p.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_ps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n row.delete_attribute(attr_name)\n row.save\n end", "def destroy\n @attr_template.destroy\n respond_to do |format|\n format.html { redirect_to attr_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @media_attribute = MediaAttribute.find(params[:id])\n @media_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_attributes_url) }\n format.xml { head :ok }\n end\n end", "def delete \n @product_licence_detail = ProductLicenceDetail.find_by_product_licence_id(params[:id], :conditions => {:status => 1})\n @product_licence = ProductLicence.find(params[:id])\n @product_licence.update_attributes(:disabled_at => Time.zone.now, :status => 0) unless @product_licence.nil?\n @product_licence_detail.update_attributes(:disabled_at => Time.zone.now, :status => 0) unless @product_licence_detail.nil?\n @subproduct_licence = SubproductAssignment.find_all_by_product_licence_id(params[:id])\n @subproduct_licence.each do |sub|\n sub.update_attributes(:status => 0)\n end\n respond_to do |format|\n format.html { redirect_to(new_product_licence_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attribute_master.destroy\n @attribute_masters = AttributeMaster.all\n end", "def destroy\n @tax.destroy\n\n head :no_content\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @iconographic_attribute.destroy\n respond_to do |format|\n format.html { redirect_to iconographic_attributes_url, notice: 'Iconographic attribute 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 delete_specific_revision_attributes(attributes)\n necessary_attributes = PageVersioning::Config[klass + '_revision_specific_attributes']\n attributes.delete_if { |key, value| necessary_attributes.include?(key) }\n attributes\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete( *attributes )\n\n\t\t# If no attributes are given, delete the whole entry\n\t\tif attributes.empty?\n\t\t\tself.log.info \"No attributes specified; deleting entire entry for %s\" % [ self.dn ]\n\t\t\tself.directory.delete( self )\n\n\t\t# Otherwise, gather up the LDAP::Mod objects that will delete the given attributes\n\t\telse\n\t\t\tself.log.debug \"Deleting attributes: %p\" % [ attributes ]\n\t\t\tmods = attributes.flatten.collect do |attribute|\n\n\t\t\t\t# Delete particular values of the attribute\n\t\t\t\tif attribute.is_a?( Hash )\n\t\t\t\t\tattribute.collect do |key,vals|\n\t\t\t\t\t\tvals = [ vals ] unless vals.is_a?( Array )\n\t\t\t\t\t\tvals.collect! {|val| self.get_converted_attribute(key, val) }\n\t\t\t\t\t\tLDAP::Mod.new( LDAP::LDAP_MOD_DELETE, key.to_s, vals )\n\t\t\t\t\tend\n\n\t\t\t\t# Delete all values of the attribute\n\t\t\t\telse\n\t\t\t\t\tLDAP::Mod.new( LDAP::LDAP_MOD_DELETE, attribute.to_s, [] )\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tself.directory.modify( self, mods.flatten )\n\t\tend\n\n\t\tself.clear_caches\n\n\t\treturn true\n\tend", "def destroy\n @chef_att_deb.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_debs_url, notice: 'Chef att deb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aspect = Aspect.find(params[:id])\n @aspect.destroy\n\n respond_to do |format|\n format.html { redirect_to(aspects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @cita = Cita.find(params[:id])\n paciente_id=@cita.paciente_id\n Operation.delete_all \"cita_id = #{@cita.id}\"\n consulta=Consulta.find_by_cita_id(params[:id])\n consulta.update_attributes(:cita_id => nil)\n @cita.destroy\n \n respond_to do |format|\n format.html { redirect_to :controller => \"lab\",:action => \"crea_cita\",:id => paciente_id,:id_cons => consulta.id }\n format.xml { head :ok }\n end\n end", "def destroy\n @capd = Capd.find(params[:id])\n @capd.destroy\n\n respond_to do |format|\n format.html { redirect_to(capds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post_prod_dpt.destroy\n\n head :no_content\n end" ]
[ "0.67909056", "0.66456294", "0.6457805", "0.644428", "0.643452", "0.64122725", "0.64104486", "0.63862956", "0.6329849", "0.6303584", "0.63021", "0.63020825", "0.62941283", "0.62666476", "0.6243546", "0.62334406", "0.62334406", "0.62170446", "0.62099105", "0.62030715", "0.62025625", "0.61863077", "0.6174445", "0.61648816", "0.6164326", "0.6147379", "0.611104", "0.609316", "0.6091983", "0.60904175", "0.607523", "0.60615", "0.6052399", "0.60282695", "0.6017995", "0.6013503", "0.5998579", "0.59789014", "0.59490144", "0.5945632", "0.5943382", "0.5937544", "0.5925241", "0.5919426", "0.59019536", "0.5892415", "0.5866117", "0.58647645", "0.58448976", "0.5842832", "0.58301514", "0.5822375", "0.58195037", "0.58164424", "0.5811881", "0.5802518", "0.579522", "0.57936704", "0.5792555", "0.5791306", "0.5791099", "0.5781421", "0.5780781", "0.5772812", "0.5772812", "0.5772812", "0.5772812", "0.5766958", "0.57606494", "0.5756569", "0.57401145", "0.5731695", "0.5728128", "0.57190675", "0.571673", "0.5712782", "0.5711026", "0.5711026", "0.5711026", "0.5703387", "0.56903094", "0.56712943", "0.5670978", "0.5669563", "0.56646997", "0.56643546", "0.5662065", "0.5659498", "0.56575894", "0.5655054", "0.56506276", "0.5631893", "0.56238234", "0.5621506", "0.5620573", "0.562039", "0.5619819", "0.56181943", "0.5613411", "0.5605966" ]
0.72387856
0
Reads a file for an xml document
def read(file) f = File.open file @doc = Nokogiri::XML(f) @current_node = @doc.root; f.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(filename)\n File.open(filename, \"r\") {|f| load_xml(f.read)}\n end", "def read_xml\n @epub.file.read_xml(abs_filepath)\n end", "def load_xml file\n f = File.open file\n doc = Nokogiri::XML f\n f.close\n doc\n end", "def xml\n File.read(\"#{@file_path}.xml\")\n end", "def load_xml_doc( filename )\n File.open( filename, 'r') do |file|\n return Oga.parse_xml( file )\n end\n\n puts \"ERROR: loading #{filename}\"\n return nil\n end", "def load_xml_document file_name\n xml_file = File.new file_name, \"r\"\n return Document.new xml_file\n end", "def load_xml(file_path)\n # Read the source XML file.\n puts \"file_path: #{file_path}\"\n raw_xml = File.read(file_path)\n\n # Parse raw_xml using Nokogiri.\n parsed_doc = Nokogiri.XML(raw_xml)\nend", "def read_xml(xml)\n REXML::Document.new(File.read(xml)).root\nend", "def read\n Hash.from_xml(File.open(file_name))\n end", "def read_file(file)\n build_xml(Ripper::SexpBuilder.new(IO.read(file)).parse)\n end", "def read_file(file)\n build_xml(Ripper::SexpBuilder.new(IO.read(file)).parse)\n end", "def read_XML_file(xfile)\n result_array = []\n if File.file?(xfile)\n puts \"\\n\\nOPENING #{xfile}\"\n f = File.open(xfile)\n doc = Nokogiri::XML(f)\n if is_squish?(doc)\n result_array = squish_parser(doc)\n else\n result_array = rspec_parser(doc)\n end\n else\n puts \"\\nNot a file: #{xfile} - verify options (-x for directory, -f for a specific file)\"\n end\n return result_array \n end", "def doc_xml(file)\n content = nil\n Zip::Archive.open(file) do |archive|\n archive.fopen('word/document.xml') do |f|\n content = f.read\n end\n end\n content\n end", "def read( nexml )\n case nexml\n when /\\.xml$/\n XML::Reader.file( nexml, :options => parse_opts )\n when IO\n XML::Reader.io( nexml, :options => parse_opts )\n when String\n XML::Reader.string( nexml, :options => parse_opts )\n end\n end", "def nokogiri_xml(file_path)\n Nokogiri::XML(File.open(file_path), nil, 'UTF-8')\n end", "def from_file(file_path)\n from_xml(File.read(file_path))\n end", "def load_XML(file)\n begin\n xml_file = File.open(file)\n xml_obj = Document.new(xml_file)\n xml_file.close\n rescue => e\n puts \"ERROR: Unable to create XML object from file: #{file}\"\n puts e.message\n puts e.backtrace\n exit 1\n end\n return xml_obj\nend", "def read(file) \n @file = Nokogiri::XML(file){ |cfg| cfg.noblanks } \n end", "def moddify_document(path)\n doc = nil\n File.open(path,'r+') do | file|\n xml_string = file.read\n doc = process_xml(xml_string) if valid_xml?(xml_string)\n end\n doc\nend", "def read document_file_name\n path_to_document = File.join(items_from, document_file_name)\n \n raise DocumentNotFound unless document_exists? path_to_document\n \n ActiveDocument::FileUtils.open path_to_document\n end", "def read file\n File.open file\n end", "def load_rop(file_path)\n f = File.open(file_path, 'rb')\n xml = REXML::Document.new(f.read(f.stat.size))\n f.close\n return xml\n end", "def parse_xml(filename)\n @parser = Parser.new :pregenerated => filename\n @parser.parse\n end", "def open_file(language)\n begin\n xml_file = File.open(file_path(language))\n doc = Nokogiri::XML(xml_file)\n yield doc\n rescue Errno::ENOENT => e\n abort(e.message)\n end\n end", "def proofread_document(xml)\n use_document(xml)\n proofread # returns valid?\n end", "def load_ingest_content( filename )\n xml_doc = TaskHelpers.load_xml_doc( filename )\n return xml_doc\n end", "def xml(path)\n Nokogiri::XML read path\n end", "def read(path)\n @file_data = Nokogiri.parse(open(path).read)\n self\n end", "def parse_xml(file)\n\t\tdata = []\n\t\t# Break open XML and go through nodes\n\t\tbegin\n\t\t\tfile = file_sanitizer(file)\n\t\t\tdata = XmlSimple.xml_in(file, {'ForceArray' => false })\n\t\trescue Exception => e\n\t\t\traise e\n\t\tend\n\t\tdata\n\tend", "def load_unattend(xml_path)\n print_status(\"Reading #{xml_path}\")\n f = session.fs.file.new(xml_path)\n raw = \"\"\n until f.eof?\n raw << f.read\n end\n\n begin\n xml = REXML::Document.new(raw)\n rescue REXML::ParseException => e\n print_error(\"Invalid XML format\")\n vprint_line(e.message)\n return nil, raw\n end\n\n return xml, raw\n end", "def xml_load(file_path)\n result = MultiXml.parse(File.read(file_path)).to_smash[:configuration]\n xml_format(result)\n end", "def parse_file filename\n encoding = @options.encoding\n filename = filename.encode encoding\n\n @stats.add_file filename\n\n return if RDoc::Parser.binary? filename\n\n content = RDoc::Encoding.read_file filename, encoding\n\n return unless content\n\n filename_path = Pathname(filename).expand_path\n begin\n relative_path = filename_path.relative_path_from @options.root\n rescue ArgumentError\n relative_path = filename_path\n end\n\n if @options.page_dir and\n relative_path.to_s.start_with? @options.page_dir.to_s then\n relative_path =\n relative_path.relative_path_from @options.page_dir\n end\n\n top_level = @store.add_file filename, relative_name: relative_path.to_s\n\n parser = RDoc::Parser.for top_level, filename, content, @options, @stats\n\n return unless parser\n\n parser.scan\n\n # restart documentation for the classes & modules found\n top_level.classes_or_modules.each do |cm|\n cm.done_documenting = false\n end\n\n top_level\n\n rescue Errno::EACCES => e\n $stderr.puts <<-EOF\nUnable to read #{filename}, #{e.message}\n\nPlease check the permissions for this file. Perhaps you do not have access to\nit or perhaps the original author's permissions are to restrictive. If the\nthis is not your library please report a bug to the author.\n EOF\n rescue => e\n $stderr.puts <<-EOF\nBefore reporting this, could you check that the file you're documenting\nhas proper syntax:\n\n #{Gem.ruby} -c #{filename}\n\nRDoc is not a full Ruby parser and will fail when fed invalid ruby programs.\n\nThe internal error was:\n\n\\t(#{e.class}) #{e.message}\n\n EOF\n\n $stderr.puts e.backtrace.join(\"\\n\\t\") if $DEBUG_RDOC\n\n raise e\n nil\n end", "def read_file(filename)\n begin\n document = File.open(filename, 'r')\n document.readlines\n rescue\n puts 'File not found'\n end\nend", "def read_file(filename); end", "def read\n @epub.file.read(abs_filepath)\n end", "def readSrepData(config_index)\n file_name = $srep_file_path + config_index.to_s() + \".xml\"\n f = File.open(file_name)\n doc = Nokogiri::XML(f)\n f.close\n return doc\nend", "def read_file(file)\n File.read(file)\n end", "def read_file(file)\n File.read(file)\n end", "def load_xml(path)\n fail MethodDenied, :load_xml if infobase.read_only?\n infobase.designer do\n loadConfigFromFiles path\n end.run.wait.result.verify!\n path\n end", "def read\n file.read\n end", "def load_xml(file_name = @file_name)\n\t\tputs \"loading xml...\"+file_name\n\t\ttweet_loader = TweetLoader.new(file_name)\n\t\ttweet_loader.load_tweets\n\t\t@tweets = tweet_loader.get_tweets\n\tend", "def text_from_content_xml(content_file)\n listener = TextListener.new\n File.open(content_file) do |io|\n REXML::Document.parse_stream(io, listener)\n end\n listener.get_all_text\nend", "def doc(path, options = {})\n require 'nokogiri'\n\n File.open(path) do |f|\n yield Nokogiri::XML(f)\n end\n end", "def read\n file\n end", "def read_file(file_name)\n begin\n content = File.open(file_name).read\n return content\n rescue\n raise\n end\n end", "def read_file(file, context)\n File.read(file)\n end", "def load_xml( fileName )\r\n begin\r\n str = IO.read(fileName)\r\n load_xml_rules_as_string(str)\r\n rescue Exception => e\r\n raise RuleLoadingError, \"loading xml file\"\r\n end\r\n end", "def get_file_doc(prptfile, filename)\n Zip::ZipFile.open(prptfile, Zip::ZipFile::CREATE) do |zipfile|\n return REXML::Document.new zipfile.read(filename)\n end\nend", "def parse_DOCX input_file\n\n begin\n reader = Docx::Document.open(input_file.tempfile)\n \n # Catch common error to invalid DOCX\n rescue Zip::ZipError => error\n flash[:alert] = \"Error parsing document. Is this a Word Docuemnt (docx)?\"\n return \"\"\n end\n document = Nokogiri::HTML(reader.to_html).text\n \n flash[:notice] = \"Word Document (docx) Processed.\"\n return document\n \n end", "def read_file(path)\n File.read(path)\n end", "def DataLoadFromFile(filename)\n file = File.new(filename)\n \n @xml_data = file\n self.ScrapAnalyse()\n end", "def get_xml_document(workflow_file)\n xml_file = File.new(workflow_file)\n document = Document.new(xml_file)\n end", "def update_xml_from_file(base='public/static/xml_downloads')\n filename = \"#{base}/#{nct_id}.xml\"\n if !File.exists?(filename)\n # update error\n return\n end\n\n content = File.read(filename)\n\n xml = Nokogiri::XML(content)\n if xml.xpath('//clinical_study').length > 0\n self.content = content\n return false unless changed?\n return update content: content\n else\n # add error\n end\n end", "def read_file(file)\n File.read(file)\nend", "def read_file(file, context); end", "def load_file_contents(file)\n File.open(file, 'r').read\n end", "def read_file(file, context)\n File.read(file, file_read_opts(context))\n end", "def read(file)\n filepath = File.join(File.dirname(__dir__), file)\n file = File.read(filepath)\n Success(file)\n rescue\n Failure(\"Failed to parse file\")\n end", "def parse_file\n @filecontent ||= File.read(@filepath)\n end", "def read_big_xml\n return File.read(File.expand_path('../../benchmark/fixtures/big.xml', __FILE__))\nend", "def readFile(fname)\n\tinf = File.new(fname, \"r\")\n\tret = inf.read()\n\tinf.close\n\treturn ret\nend", "def load_file_contents(filename)\n File.open(filename).readlines\n end", "def read_file(absolute_path); end", "def raw_file(filename)\n doc = Nokogiri::XML(File.read(filename, encoding: \"UTF-8\")) do |config|\n config.huge\n end\n new(doc, filename, raw: true)\n end", "def support_rdoc_document_file!\n IO.read(\".document\").gsub(/^[ \\t]*#.+/m, '').split(/\\s+/)\n rescue Errno::ENOENT\n []\n end", "def read_xml(filename=$g_language_strings)\n filename = $g_lang_strings_file\n all_strings_hash={}\n\n config = XmlSimple.xml_in(filename, {'KeyAttr' => 'resources/String'})\n config['string'].each do |var|\n all_strings_hash[var[\"name\"]]=var[\"content\"]\n end\n\n return all_strings_hash\n end", "def read_source\n source = []\n File.open($source_file, \"r\") do |file|\n doc = REXML::Document.new(file)\n doc.root.elements.each do |element|\n source << [element.name.strip, element.text.strip]\n end\n end\n return source\nend", "def read_file(resource)\n File.read(resource)\n end", "def readfile(filename)\n\tfilename = File.expand_path(filename, File.dirname(__FILE__))\n\tFile.read(filename)\nrescue\n\tnil\nend", "def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end", "def load_xml(xml_url)\n\t\t\tfile = File.new(xml_url)\n\t\t\tload_map(file)\n\t\t\tfile.close\n\t\tend", "def initialize(path)\n @filename = path\n file = nil\n file = open(path)\n @errors = [] \n \n @document = Nokogiri::XML(file)\n @document.remove_namespaces!\n @node = @document.root\n unless self.valid?\n self.errors << {:xml => 'invalid xml passed in'}\n #raise \"Unable to load file. Is it in the correct format?\"\n end\n end", "def read(filename)\n buffer = File.read filename if File.exist? filename\n end", "def read(filename)\n buffer = File.read filename if File.exist? filename\n end", "def xml_fixture(name)\n File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', \"#{name}.xml\"))\nend", "def initialize(file_content)\n # Open XML file\n self.fichero = file_content\n # Initialize XML Document\n @doc = Document.new self.fichero\n # Initialize attribute default values\n self.lista_devoluciones = []\n end", "def input\n RDF::Util::File.open_file(inputDocument)\n end", "def read_text(filename); end", "def read(file)\n if @options[:input_file]\n file = File.join(File.dirname(@options[:input_file]), file)\n end\n File.read(file)\n end", "def ovl_read_file(rel_file)\n File.read(ovl_expand_file(rel_file), encoding: \"UTF-8\")\n end", "def open_document\n @document = Nokogiri::XML(open(@feed_uri).read)\n end", "def proofread_document_internal(xml_url)\n use_document(xml_url, true)\n proofread # returns valid?\n end", "def read_feeds(fname, locale, offset)\r\n File.foreach(fname) {|line| xml_feed_entries(line, locale, offset)}\r\n end", "def get_elements_from_filename(fileSpec)\n # Split fileSpec into path and filename\n var = Array.new()\n (var[1], var[2]) = File.split( fileSpec )\n # Determine file extension\n tempExt = File.extname(var[2])\n\n debug_out \"Testing file read location, #{fileSpec}... \"\n\n\n # Open file...\n fFileHANDLE = File.new(fileSpec, \"r\")\n if fFileHANDLE == nil then\n fatalerror(\"Could not read #{fileSpec}.\\n\")\n end\n\n # Global variable $XMDoc is used elsewhere for access to\n # HOT2000 model file elements access using Path.\n if ( tempExt.downcase == \".h2k\" )\n $XMLdoc = Document.new(fFileHANDLE)\n elsif ( tempExt.downcase == \".flc\" )\n $XMLFueldoc = Document.new(fFileHANDLE)\n elsif ( tempExt.downcase == \".cod\" )\n $XMLCodedoc = Document.new(fFileHANDLE)\n else\n $XMLOtherdoc = Document.new(fFileHANDLE)\n end\n fFileHANDLE.close() # Close the since content read\n\n if ( tempExt.downcase == \".h2k\" )\n return $XMLdoc.elements()\n elsif ( tempExt.downcase == \".flc\" )\n return $XMLFueldoc.elements()\n elsif ( tempExt.downcase == \".cod\" )\n return $XMLCodedoc.elements()\n else\n return $XMLOtherdoc.elements()\n end\nend", "def load_xml(xml)\n @mmdoc = REXML::Document.new(xml)\n end", "def read(opts = {})\n filename = opts.fetch(:filename, @filename)\n encoding = opts.fetch(:encoding, @encoding)\n return unless File.file? filename\n\n mode = encoding ? \"r:#{encoding}\" : 'r'\n File.open(filename, mode) { |fd| parse fd }\n self\n end", "def read_file(file_path)\n raise(format(ERROR_FILE_NOT_EXIST, file_path)) unless File.exist?(file_path)\n\n File.read(file_path)\n end", "def read_config_file(file); end", "def import_nessus_xml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\n\t\tif data.index(\"NessusClientData_v2\")\n\t\t\timport_nessus_xml_v2(args.merge(:data => data))\n\t\telse\n\t\t\timport_nessus_xml(args.merge(:data => data))\n\t\tend\n\tend", "def parse_file(filename)\n File.open(filename, 'r') { |f| parse f }\n end", "def get_xml_of_type( asdcp_type, file )\n begin\n xml = Nokogiri::XML( open file )\n rescue Exception => e\n @logger.info \"#{ file }: #{ e.message }\"\n return FALSE\n end\n unless xml.errors.empty?\n xml.errors.each do |error|\n # expected errors from non-xml\n next if error.message =~ /Start tag expected/ or error.message =~ /Document is empty/\n @logger.info \"Syntax error: #{ file }: #{ error }\"\n end\n return FALSE\n end\n\n case xml.root.node_name\n when asdcp_type\n return xml\n else\n return FALSE\n end\nend", "def extract_docx_document_xml\n extract_zip_archive_file_contents(\n 'word/document.xml'\n )\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def xml_parser(directory_name, filename)\n @doc = Document.new File.new(directory_name + filename)\n get_dataset_name(filename)\n set_topics\n set_dataset_rel_and_attr\n get_footnotes\n record_attributes\n @dataset.save\n end", "def read_file\n @read_file ||= File.open(self.file)\n end" ]
[ "0.79731673", "0.76209915", "0.74321127", "0.7430983", "0.73843217", "0.72938585", "0.72395647", "0.70664537", "0.69445425", "0.69028014", "0.69028014", "0.6876141", "0.67945975", "0.6754631", "0.66623855", "0.66580325", "0.66309625", "0.6566314", "0.652696", "0.6508213", "0.64814425", "0.6438968", "0.6406326", "0.63056093", "0.6260967", "0.6238355", "0.62269306", "0.6205644", "0.6114252", "0.6069759", "0.605563", "0.6051614", "0.6032551", "0.60072744", "0.5978098", "0.59733903", "0.5958181", "0.5958181", "0.59458506", "0.59424394", "0.59322655", "0.59094834", "0.5907065", "0.59062505", "0.5871466", "0.58683455", "0.58340245", "0.5804848", "0.5795117", "0.57817894", "0.5771734", "0.5733503", "0.56658334", "0.5665136", "0.5664073", "0.5653539", "0.5627257", "0.56251186", "0.561518", "0.56088734", "0.5597016", "0.5593391", "0.5590654", "0.55900955", "0.55674225", "0.5558001", "0.5537755", "0.5534966", "0.5515224", "0.55103374", "0.5505545", "0.5497482", "0.54943305", "0.54943305", "0.54904103", "0.5484464", "0.54721814", "0.54691535", "0.54613566", "0.5458965", "0.545651", "0.5441868", "0.5425488", "0.5420624", "0.5415317", "0.54041034", "0.5403919", "0.5401049", "0.5396074", "0.53897583", "0.5387715", "0.5385838", "0.5376245", "0.5376245", "0.5376245", "0.5376245", "0.5376245", "0.5376245", "0.5372182", "0.5367904" ]
0.73612195
5
Returns true if the given node is valid
def is_valid(node = @current_node) return node != nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?\n inner_root.children.detect{|node| node.valid? == false} == nil # should be explicitely nil !!\n end", "def valid?\n return true unless applicable?\n\n inclusive = spec['inclusive']\n\n case inclusive\n when true, false\n nodes.size > 0\n else\n in_nodes = tree.select(inclusive)\n nodes.size == 0 or in_nodes.size > 0\n end\n end", "def valid_tree?\n true\n end", "def are_node_basic_fields_valid?(node)\n err = []\n err << \"Node uid is not provided\" unless node['uid']\n\n err.any? ? fail_validation(node, err) : true\n end", "def valid?\n has_children? and children.inject(true) { |result, el| result and el.valid? }\n end", "def scanned_node?(node); end", "def are_node_basic_fields_valid?(node)\n err = []\n\n err << \"Status provided '#{node['status']}' is not supported\" if\n node['status'] && !valid_status?(node['status'])\n err << \"progress value provided, but no status\" if\n !node['status'] && node['progress']\n err << \"Node uid is not provided\" unless node['uid']\n\n err.any? ? fail_validation(node, err) : true\n end", "def node?\n node.present?\n end", "def inconsistent_node?(node)\n return true if !root ||\n !node\n return false if node.tree_node?\n v2 = node.v2?\n return true unless !v2 || node.depth != 0\n return false if v2 == v2?\n\n #state = INVALID\n return true\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def is_valid?\n leaf_nodes = each_leaf\n leaf_nodes.map(&:is_closed?).reduce(&:&)\n end", "def text_element_valid? node\n node.traverse do |self_or_descendant|\n if self_or_descendant.text?\n begin\n if find_elmt_index(self_or_descendant).nil?\n throw \"Text element for '#{self_or_descendant.text}' can't be found in elmt_bounds.\"\n end\n rescue Exception => exc\n return false\n end\n return false unless nknode_valid?(self_or_descendant)\n end\n end\n return true\n end", "def valid?\n build_xml\n\n validation = RelaxNGSchema.instance.validate(@xml.document)\n if validation.empty?\n true\n else\n logger.error validation.map(&:message).join(\"\\n\")\n logger.debug @xml.to_s\n false\n end\n end", "def valid_tree?\n false\n end", "def check(node); end", "def valid?\n @token.valid?\n end", "def tree_nodes_valid?\n (root_tree_node.present? || top_nav_node_info_cd.zero?) &&\n (branch_tree_node.present? || sub_nav_node_info_cd.zero?) &&\n (leaf_tree_node.present? || trd_nav_node_info_cd.zero?)\n end", "def valid_node_data?(node, min_val, max_val, left_or_right)\n return true if node.nil?\n case left_or_right\n # This left or right split is essential to preserve the structure of binary tree that\n # all nodes less than or equal to parent go to left and only nodes greater than current node\n # go to right\n # This leads to a small bug that max value cannot be allocated to any node in the binary tree\n #\n # Run the algorithm for following binary tree\n # 100\n # 90 110\n # 80 95 105 115\n # 120\n #\n when :left\n return true if node.value >= min_val && node.value <= max_val\n when :right\n return true if node.value >= min_val && node.value < max_val\n else\n false # This use case should never be reached\n end\n false\n end", "def node(node)\n true\n end", "def valid?\n valid == true\n end", "def valid?\n check!\n true\n rescue\n false\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end" ]
[ "0.72213846", "0.7154274", "0.7041897", "0.70019966", "0.69212425", "0.67188084", "0.6704628", "0.66957223", "0.66861844", "0.6680971", "0.6680971", "0.66616297", "0.66254604", "0.66079724", "0.6578558", "0.653918", "0.6476036", "0.6467516", "0.645639", "0.64520454", "0.6446374", "0.64431024", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.64373076", "0.6436596", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516", "0.64333516" ]
0.8611224
0
Sets the current node.
def set_current(node) @current_node = node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_node(val)\n self.node = val\n self\n end", "def set_node(val)\n self.node = val\n self\n end", "def current=(node)\n\t\t\t@try_current[-1] = node\n\t\tend", "def node=(node)\n @node = node\n end", "def node=(val)\r\n case val\r\n when Node, NilClass\r\n @node = val\r\n end\r\n end", "def node=(val)\n attributes['node'] = val\n end", "def node=(val)\n attributes['node'] = val\n end", "def set_node\n @node = ::Node::Node.find(params[:id])\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def node=(node)\n retract[:node] = node\n end", "def __set_current(current)\n @current = current\n end", "def set_node\r\n @node = Node.find(params[:id])\r\n end", "def set_node\n @node = @current_user.nodes.find_by(short_id: params[:id])\n end", "def setLeft(nodeCurrent, nodeLeft)\n return nodeCurrent.setLeft(nodeLeft)\n end", "def node=(node)\n items_node[:node] = node\n end", "def set_current c\n @current = c\n end", "def head\n @current_node = @head\n end", "def set_root_node\n self.x_node = \"root\"\n get_node_info(x_node)\n end", "def set_next(node)\n @next_node = node\n end", "def next_node\n @current_node = @current_node.children[0]\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def node=(_); end", "def node=(_); end", "def set_next(node)\n\t\t\t@next = node\n\t\tend", "def next_node\n @current_node = @current_node.children[0]\n end", "def set_head(value)\n @head = new_node(value)\nend", "def parent=(parent_node); end", "def parent=(parent_node); end", "def set_prev(node)\n @prev_node = node\n end", "def []=(index, value)\n node = find_node(index)\n node.value = value\n end", "def set_child(name, node)\n send :\"#{name}=\", node\n end", "def node=(v)\n @node = v.to_s\n if USE_STRINGPREP\n @node = IDN::Stringprep.nodeprep(@node) if @node\n end\n end", "def set_newnode\n @newnode = Newnode.find(params[:id])\n end", "def node=(node)\n query[:node] = node\n end", "def node=(node)\n query[:node] = node\n end", "def node=(node)\n subscription_node[:node] = node\n end", "def set_current_object(reference)\n unless @current_object.nil?\n @current_object = reference\n else\n @parent.set_current_object(reference)\n end\n end", "def next=(node)\n @next = node\n end", "def set_prev(node)\n\t\t\t@prev = node\n\t\tend", "def node=(node)\n publish[:node] = node\n end", "def current=(treeish)\n @repository.git.reset treeish\n end", "def set_root(node)\n @root_address = node.node_address\n @nodes.first_entry = node.node_address\n end", "def assignSiblingNode(sibling)\n\t\t@siblingNode = sibling \n\tend", "def replace_head(node)\n self.head = node\n end", "def markNode name\n\t\tgetNode(name).marked = true\n\tend", "def set_node\n params[:id] = params[:id] + '/' if (params[:id] == 'rest')\n @node = Fedora.rest(params[:id])\n end", "def node=(node)\n purge_node[:node] = node\n end", "def initialize\n @root = Node.new\n @current_node = @root\n end", "def SetMtu(node)\n @rstack.SetMtu(node)\n end", "def set_to(value)\n @native.set_current_value(value)\n end", "def current_node\n Neo4j.load(@traversal_position.currentNode.getId)\n end", "def setRight(nodeCurrent, nodeRight)\n return nodeCurrent.setRight(nodeRight)\n end", "def []=(index, value)\n node = get_node_at_index(index)\n node.value = value\n node.value\n end", "def root=(value) @root = value end", "def root=(value) @root = value end", "def node=(node)\n unsubscribe[:node] = node\n end", "def root=(value)\n @root = value\n end", "def set(index, element)\n node_at_index = get(index)\n node_at_index.element = element\n end", "def set_parent(parent_node)\n @parent = parent_node\n end", "def set_root(value)\n\t\t@root = BSTNode.new(value)\n\tend", "def set_star_node\n @star_node = StarNode.find(params[:id])\n end", "def update(node); end", "def threadlocal_ref_node=(reference_node)\n Thread.current[:local_ref_node] = reference_node.nil? ? nil : reference_node._java_node\n end", "def threadlocal_ref_node=(reference_node)\n Thread.current[:local_ref_node] = reference_node.nil? ? nil : reference_node._java_node\n end", "def node=(_arg0); end", "def root=(value)\n @root = value\n end", "def root=(value)\n @root = value\n end", "def set_pm_node\n @pm_node = Pm::Node.find(params[:id])\n end", "def set_story_node\n @story_node = StoryNode.find(params[:id])\n end", "def set(node, weight)\n change_by node, nil, weight\n end", "def set_replacement(parent, node, replacement, property)\n if node == @root\n @root = replacement\n else\n parent.send(property+'=',replacement)\n end\n end", "def set_manage_node\n @manage_node = Manage::Node.find(params[:id])\n end", "def root=(v)\n @@root = v\n end", "def node=(node)\n raise Deployment::InvalidArgument.new self, 'Not a node used instead of the graph node!', node unless node.is_a? Deployment::Node\n @node = node\n end", "def last=(node)\n return self.sibling = node\n end", "def set_node(doc, node, value, namespace: nil)\n if namespace\n doc.at(\"xmlns|#{node}\", xmlns: namespace).content = value\n else\n doc.at(node).content = value\n end\n end", "def reset\r\n super\r\n @rootNode = @currentNode = Document.new\r\n end", "def set_member(member)\n @document.root << build_node(member)\n\n @member = member\n end", "def set(node_id, addr)\n @@directory_lock.synchronize do\n @@directory[node_id] = addr\n end\n end", "def set_power_grid_node\n @power_grid_node = PowerGridNode.find(params[:id])\n end", "def current\n return nil unless @node\n @node.item\n end", "def shift\n (e = node_set.shift) && NodeProxy.new(e, parent)\n end", "def child_node=(_); end", "def add_node(current_node, v)\n left = current_node.left if current_node.left\n right = current_node.right if current_node.right\n current_node.left = TreeNode.new(v)\n current_node.right = TreeNode.new(v)\n current_node.left.left = left\n current_node.right.right = right\nend", "def set_current_revision\n raise NotImplementedError\n end", "def set_attribute_node( new_attr )\n if new_attr.owner_document != self.owner_document then\n raise \"WRONG_DOCUMENT_ERR\"\n end\n if not new_attr.owner_element.nil? then\n raise \"INUSE_ATTRIBUTE_ERR\"\n end\n old_attr = nil\n @attr_nodes << new_attr\n new_attr._set_owner_element( self )\n old_attr\n end", "def left=(other)\n raise TypeError, 'Left must be a node or nil.' unless other.is_a?(Node) || other.nil?\n\n @left = other\n end", "def link(node_link)\n @node_link = node_link\n self\n end", "def parent= parent_node\n parent_node.add_child(self)\n parent_node\n end", "def set_node_value(node_id:, value:)\n {\n method: \"DOM.setNodeValue\",\n params: { nodeId: node_id, value: value }.compact\n }\n end", "def initialize node\n raise ArgumentError, \"Expected SGF::Node argument but received #{node.class}\" unless node.instance_of? SGF::Node\n @root = node\n @current_node = node\n end", "def push(node)\n node.parent = self if node.respond_to? :parent\n super(node)\n end", "def nodeValue=(text)\n self.childNodes = [text]\n end", "def node=(node)\n fail Deployment::InvalidArgument, \"#{self}: Not a node used instead of the task node\" unless node.is_a? Deployment::Node\n @node = node\n end", "def set(str)\n puts \"setting \" + str\n char = str[0] || TERM_CHAR\n next_node = find_child(char)\n\n unless next_node\n next_node = Node.new(char)\n @children << next_node\n end\n\n if str == ''\n return\n else\n next_node.set(str[1..-1])\n end\n end", "def set_current(current)\n if length.zero?\n self.scene = nil\n return\n # Don't bother looking for current image\n elsif scene.nil? || scene >= length\n self.scene = length - 1\n return\n elsif !current.nil?\n # Find last instance of \"current\" in the list.\n # If \"current\" isn't in the list, set current to last image.\n self.scene = length - 1\n each_with_index do |f, i|\n self.scene = i if f.__id__ == current\n end\n return\n end\n self.scene = length - 1\n end", "def set_current_identity\n Identity.current_identity = @current_identity\n end", "def force_current\n @current = true\n end" ]
[ "0.7911279", "0.7911279", "0.7470951", "0.739517", "0.7286752", "0.69640344", "0.69640344", "0.69106114", "0.689993", "0.689993", "0.689993", "0.6890156", "0.6852821", "0.6783472", "0.67271954", "0.670349", "0.6699798", "0.6671914", "0.6670677", "0.6619546", "0.6579447", "0.657051", "0.6543009", "0.64938915", "0.64938915", "0.6408802", "0.6404231", "0.63245845", "0.62790936", "0.62790936", "0.6191141", "0.6164264", "0.6158456", "0.6152301", "0.6133324", "0.6131903", "0.6131903", "0.6107802", "0.6101556", "0.60849446", "0.60617423", "0.60531515", "0.6027292", "0.60088426", "0.60049003", "0.60003144", "0.59671104", "0.59554046", "0.59347075", "0.5930151", "0.5907502", "0.5896155", "0.5885866", "0.58835316", "0.5874219", "0.58384454", "0.58384454", "0.5821583", "0.5786248", "0.5778675", "0.5776072", "0.57736456", "0.577068", "0.576935", "0.57665765", "0.57665765", "0.57505506", "0.57325864", "0.57325864", "0.57220495", "0.5713613", "0.5707552", "0.57029474", "0.569095", "0.56895024", "0.5677922", "0.5669189", "0.56613845", "0.5656134", "0.5639683", "0.5637908", "0.56374073", "0.5625382", "0.5617842", "0.5611201", "0.56061065", "0.5600068", "0.5598184", "0.55928206", "0.5592665", "0.55901575", "0.5580958", "0.55714995", "0.55607337", "0.5556765", "0.5546002", "0.55429465", "0.5541478", "0.5536329", "0.55344844" ]
0.85755503
0
Returns a set of nodes based on the provided xpath query
def xpath(query) return is_valid ? @doc.xpath(query) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_elements(xpath); end", "def find_all_nodes(xpath, select_result_value=false)\n if self.feed_data_type != :xml\n raise \"The feed data type is not xml.\"\n end\n return FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [xpath],\n :select_result_value => select_result_value)\n end", "def xpathall(path,xml)\n r=[]\n XPath.each(xml,path){|x|r<<x}\n r\nend\n", "def elements_by_xpath(value)\n find_by_xpath(value)\n end", "def /(*paths)\n NodeSet[paths.map { |path| xpath(path) }]\n end", "def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|elm|\n elm.extend(ElementHelper)\n elm\n block_given? ? (yield elm) : elm\n }\n end", "def extract_all_nodes(xpath, node = xml, namespaces = DEFAULT_NAMESPACES)\n _extract_nodes(:match, xpath, node, namespaces)\n end", "def search(xpath)\n return self.each_element( xpath ){}\n end", "def retrieve_xmlelements(xpath_str)\n collection = []\n if NOKOGIRI\n @xml.xpath(xpath_str).each { |pelem|\n collection << XMLElement.new(pelem)\n }\n else\n @xml.elements.each(xpath_str) { |pelem|\n collection << XMLElement.new(pelem)\n }\n end\n collection\n end", "def search(*selectors)\n NodeSet.new selectors.map {|selector|\n xpath(selector).to_a.concat(css(selector).to_a)\n }.flatten.uniq\n end", "def xpaths xpath_str\n find_elements :xpath, xpath_str\n end", "def get_all_xpath(values)\n\t\tif values.nil? then\n\t\t\treturn []\n\t\tend\n\t\treturn xpath('//' + values.join(XPATH_JOIN))\n\tend", "def xpath(path)\n raise NotImplementedError, 'query by XPath unsupported'\n end", "def xpath_all(pdoc, path, namespace = '')\n if namespace!=\"\"\n return REXML::XPath.match(pdoc, path, namespace)\n else\n return REXML::XPath.match(pdoc, path);\n end\n return []\n end", "def elements_by_xpath(xpath)\r\n element = Element.new(nil, self)\r\n elem_names = element.elements_by_xpath(self, xpath)\r\n a = elem_names.inject([]) {|elements,name| elements << element_factory(name)}\r\n end", "def find(query)\n path = if xml.namespaces.empty?\n \"//#{query}\"\n else\n \"//xmlns:#{query}\"\n end\n\n xml.xpath(path).map do |node|\n hsh = XMLUtils.to_hash node\n block_given? ? yield(hsh) : hsh\n end\n end", "def xpath_all(pdoc, path, namespace = '')\n begin\n if namespace != \"\"\n return pdoc.find(path, namespace) if pdoc.find(path, namespace)\n else\n return pdoc.find(path) if pdoc.find(path)\n end\n rescue\n return []\n end\n end", "def xpath(xpath)\n @doc.xpath(xpath)\n end", "def on_path(ast_node, context)\n nodes = XML::NodeSet.new\n\n ast_node.children.each do |test|\n nodes = process(test, context)\n\n if nodes.empty?\n break\n else\n context = nodes\n end\n end\n\n return nodes\n end", "def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end", "def xpath; end", "def xpath; end", "def get_content_array(xpath_query)\n scraped_array = Array.new\n pos = 0\n @current_page.search(xpath_query).each do |var|\n scraped_array[pos] = var.content.strip\n pos += 1\n end\n scraped_array\n end", "def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end", "def xpath(*args); end", "def xpath(*args); end", "def folders\n xpath './folder'\n end", "def elements_by_type(type)\n\t\treturn xpath('//' + type)\n\tend", "def all_xpaths(parsed_doc)\n xpaths = parsed_doc.xpath('//*').map do |node|\n node.path.gsub(/\\[\\d*\\]/, \"[]\")\n end.uniq\nend", "def xpath(expression)\n document.xpath expression\n end", "def xpath_each(from_root_node, path)\n REXML::XPath.each(from_root_node, path, &Proc.new)\n end", "def on_test(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |xml_node|\n nodes << xml_node if node_matches?(xml_node, ast_node)\n end\n\n return nodes\n end", "def search(xpath)\n results = self.find(xpath).to_a\n if block_given?\n results.each do |result|\n yield result\n end\n end\n return results\n end", "def generate_xpath_queries!\n # do nothing\n end", "def search(xpath)\n results = self.find(xpath).to_a\n if block_given?\n results.each do |result|\n yield result\n end\n end\n return results\n end", "def search(xpath)\n results = self.find(xpath).to_a\n if block_given?\n results.each do |result|\n yield result\n end\n end\n return results\n end", "def search(path)\n self.find_by_xpath(path)\n end", "def find(selector)\n nodes = @_node.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def find(xpath, nslist = nil)\n if not self.doc\n raise(TypeError, \"A node must belong to a document before \" +\n \"it can be searched with XPath.\")\n end\n \n context = XPath::Context.new(self)\n context.node = self \n context.register_namespaces_from_node(self)\n context.register_namespaces_from_node(self.doc.root)\n context.register_namespaces(nslist) if nslist\n\n context.find(xpath)\n end", "def xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n let results = [];\n within ||= document\n\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n for (let i = 0; i < xpath.snapshotLength; i++) {\n results.push(xpath.snapshotItem(i));\n }\n\n return results;\n }\n JS\n\n evaluate_func(expr, selector, within)\n end", "def nodes\n strong_memoize(:nodes) do\n nodes = doc.xpath(XPATH)\n nodes.drop(EMBED_LIMIT).each(&:remove)\n\n nodes\n end\n end", "def query_selector_all(node_id:, selector:)\n {\n method: \"DOM.querySelectorAll\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end", "def xpath(*paths)\n if paths.last.is_a? Hash\n super(*paths) || []\n else\n super(*paths, ns_decl) || []\n end\n end", "def make_nodes(ids, opt)\n result = []\n ids.each do |id|\n id = id.tr('\"', '')\n selector = \"//*[@capybara-ng-match='#{id}']\"\n nodes = page.driver.find_xpath(selector)\n\n raise NotFound.new(\"Failed to match found id to node\") if nodes.empty?\n result.concat(nodes)\n end\n page.evaluate_script(\"clearCapybaraNgMatches('#{opt[:root_selector]}')\");\n result\n end", "def to_xpath(prefix, visitor); end", "def query_root_node(xpath_query, namespaces = {})\n if !@root_node.nil?\n @root_node.xpath(xpath_query, namespaces)\n end\n end", "def get_element_by_xpath(xpath)\n\t\t# restituisco l'elemento corrispondente - nota: a priori un xpath non è univoco, per questo\n\t\t# in realtà blocco[] è un array di risultati\n\t\t@doc.xpath(xpath)\n\tend", "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "def find(xpath)\n\t\t\t@document.xpath(xpath)\n\t\tend", "def at_xpath(*args); end", "def at_xpath(*args); end", "def nodeset_for(symbols)\n ng_xml.xpath(self.class.terminology.xpath_for(symbols))\n end", "def extract_rows\n @rows ||= load_page.search(\"//div[contains(concat(' ',normalize-space(@class),' '),' flightresult ')]\")\n end", "def xpath(*paths)\n paths[0] = paths[0].to_s\n\n if paths.size > 1 && (namespaces = paths.pop).is_a?(Hash)\n paths << namespaces.inject({}) { |h,v| h[v[0].to_s] = v[1]; h }\n end\n\n nokogiri_xpath *paths\n end", "def getNodes(root, xp=\"//xmlns:offer\", debug=true)\r\n\tnodes = root.xpath(xp)\r\n\tif debug\r\n\t\tputs nodes.count().to_s + \" nodes found\" \r\n\tend\r\n\treturn nodes\r\nend", "def each_node\n return to_enum(__method__) unless block_given?\n\n doc.xpath(query).each do |node|\n yield node\n end\n end", "def xpath_query_for(node_name, options={})\n xpath_query = \"#{options[:is_child] ? '/' : '//'}#{node_name}\"\n extras = []\n extras += [%Q{.=\"#{options[:content]}\"}] if options[:content]\n\n extras += options[:attributes].map do |k,v|\n %Q{@#{k}=\"#{v}\"}\n end if options[:attributes]\n\n xpath_query << \"[#{extras.join(' and ')}]\" unless extras.empty?\n\n if options[:child]\n child = options.delete(:child)\n child_options = {\n :is_child => true,\n :attributes => child[:attributes],\n :content => child[:content],\n :child => child[:child]\n }\n return xpath_query << \"#{xpath_query_for(child[:node_name], child_options)}\"\n else\n xpath_query\n end\nend", "def delete_all(xpath); end", "def retrieve_elements(filter)\n elements_array = Array.new\n\n if NOKOGIRI\n @xml.xpath(filter.to_s).each { |pelem|\n elements_array << pelem.text if pelem.text\n }\n else\n @xml.elements.each(filter.to_s) { |pelem|\n elements_array << pelem.text if pelem.text\n }\n end\n\n if elements_array.size == 0\n return nil\n else\n return elements_array\n end\n\n end", "def fakesearch_all_nodes(options = {})\n fakesearch_nodes(nil, options)\nend", "def elements(selector)\n @doc.search(selector)\n end", "def bookmarks\n xpath './bookmark'\n end", "def find_all(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def query_selector_all(expr)\n Traverser.new(expr).evaluate(Context.new(node: self))\n end", "def page_all_xpath(xpath, timeout=nil, recurse=true)\r\n begin\r\n return page.all(:xpath, xpath)\r\n rescue\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n page_all_xpath(xpath, timeout, false)\r\n else\r\n raise \"Failed to find element with xpath: [\" + xpath + \"]\"\r\n end\r\n end\r\n end", "def process_query\n @results = str_to_obj.flatten.collect do |url|\n doc = Mechanize.new.get(url)\n els = doc.search(CGI.unescape(@xpath))\n els.map { |el| [el.text] }\n end\n @results = @results.flatten.map { |r| [r] }\n end", "def at_xpath(*paths)\n result = nil\n\n paths.each {|path|\n if result = xpath(path).first\n break\n end\n }\n\n result\n end", "def search *paths\n ns = paths.last.is_a?(Hash) ? paths.pop : {}\n xpath(*(paths.map { |path|\n path =~ /^(\\.\\/|\\/)/ ? path : CSS.xpath_for(path, :prefix => \".//\")\n }.flatten.uniq) + [ns])\n end", "def select_nodes(ypath, tree)\n case ypath\n when Hash\n if path = ypath['path'] || ypath['ypath']\n nodes = tree.select(path)\n else\n nodes = tree.select('*') # all nodes\n end\n YES.constraints.each do |c|\n next unless Constraints::NodeConstraint === c\n checklist = c.checklist(spec, tree, nodes)\n selection = checklist.select{ |v| v.valid? }\n nodes.concat(selection.map{ |s| s.node })\n end\n nodes\n else\n tree.select(ypath)\n end\n end", "def to_xpath(prefix = T.unsafe(nil), visitor = T.unsafe(nil)); end", "def parse_page(url, xpaths)\n doc = get_page(url)\n return xpaths.map { |xp|\n doc.xpath(xp)\n }\n end", "def getOffers(root, xp=\"//xmlns:offer\", debug=true)\r\n\toffers = root.xpath(xp)\r\n\tif debug\r\n\t\tputs offers.count().to_s + \" nodes found\" \r\n\tend\r\n\treturn offers\r\nend", "def find(selector)\n nodes = current_frame.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def xpath_for(selector, options = T.unsafe(nil)); end", "def list_from_config(xpath, config, options = {})\n REXML::XPath.match(config, xpath).map do |r|\n hash = Util.xml_to_hash(r, \"search\")\n from_hash(hash, options)\n end\n end", "def find_all(value)\n nodes = []\n self.each {|node| nodes << node if node.value == value}\n nodes\n end", "def xpath xpath_str\n find_element :xpath, xpath_str\n end", "def each_node(safe_path, xpath, &block)\n return enum_for(:each_node, safe_path, xpath) unless block\n\n require 'nokogiri'\n\n with_encoding_check(safe_path) do |stream, encoding|\n stream_xml_nodes(stream, xpath, encoding, &block)\n end\n end", "def get_all_lines(page)\n return page.xpath('//tr[@class=\"cmc-table-row\"]')\nend", "def findAll(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def item_node_set(input_element)\n input_element.xpath(XPATH[:item])\n end", "def query_body_nodes\n body_node = query_body_node\n query_body_node && query_body_node.elements\n end", "def on_type_test_node(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |node|\n if node.is_a?(XML::Node) or node.is_a?(XML::Document)\n nodes << node\n end\n end\n\n return nodes\n end", "def document_to_object( xpath = XPATH, namespace = NAMESPACE)\n obj = []\n \n document.xpath( xpath, namespace ).each do | node |\n hash_data = hash_from_xml( node.children )\n obj << hash_data\n end\n \n obj\n end", "def find_all_nodes(*args)\n nodes = @nodes.find_all_nodes(*args)\n nodes.find_all { |n| context?(n) }\n end", "def search(xpath)\n context = current_context\n begin\n if namespaces.default && !xpath.include?(':') \n find(namespaced(xpath),\n in_default_namespace(namespaces.default.href))\n else \n #find(xpath)\n context.find(xpath) \n end\n rescue Exception => ex\n raise ex, xpath\n end\n end", "def xpath\n options[:xpath] || xpath_by_tag_type\n end", "def fetch_listing_nodes\n @page_nodes.each do |node|\n all_rows = node.css('table')[1].css('tr:not(.directionheader)')\n all_rows.each do |row|\n @listing_nodes.push(\n row.css('td')\n )\n end\n end\n end", "def search(xpath, &proc)\n @doc.search(xpath, &proc)\n end", "def xpath_of(node)\n node.xpath.to_s\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def query_selector_all(selector)\n document.query_selector_all selector\n end", "def find_all_nodes(*args)\n raise NotImplementedError\n nodes = @database.all_nodes\n # TODO: design node finder syntax\n nodes\n end", "def getItems\n @doc.css('[itemscope]').select {|el| !el.has_attribute?('itemprop')}.map {|n| NodeProxy.new(n)}\n end", "def find_node(xpath, select_result_value=false)\n if self.feed_data_type != :xml\n raise \"The feed data type is not xml.\"\n end\n return FeedTools::XmlHelper.try_xpaths(self.channel_node, [xpath],\n :select_result_value => select_result_value)\n end", "def document_to_array( xpath = DIF_XPATH, namespace = NAMESPACE)\n a = []\n document.xpath( xpath, namespace ).each do | node |\n dif = Gcmd::Dif.new\n dif.load_xml node.to_s\n a << dif.document_to_hash\n end\n a\n end", "def nodes()\n return SearchNodes.new(:node => self, :return_many => true)\n end", "def get_elements(path)\n elements = self./(path)\n return nil unless elements\n elements = elements.map{|element| Element.new(element)}\n end", "def get_elements(path)\n elements = self./(path)\n return unless elements\n elements = elements.map{|element| Element.new(element)}\n end", "def xpath(node)\n \n @xpath ||= '/'\n @depth ||= 0\n @attr_selectors[node.depth] = {}\n \n while @attr_selectors.last != @attr_selectors[node.depth]\n @attr_selectors.slice!(-1)\n end\n \n name = node.name.gsub(/#text/, \"text()\")\n node.attributes.each do |a|\n @attr_selectors[@depth][\"@#{a[0]}\"] = a[1]\n end\n\n if @depth < node.depth\n @xpath.concat(\"/#{name}\")\n elsif @depth == node.depth\n @xpath.sub!(/\\/[#()a-z0-9]*$/, \"/#{name}\")\n elsif @depth > node.depth\n @xpath.sub!(/\\/[#()a-z0-9]*\\/[#()a-z0-9]*$/, \"/#{name}\")\n else\n raise \"Can't parse node depth to create XPATH\"\n end\n\n @depth = node.depth\n @xpath.clone\n end" ]
[ "0.7205551", "0.71301764", "0.69440466", "0.6718571", "0.67178035", "0.65306026", "0.65018433", "0.6460227", "0.6439678", "0.6438726", "0.64033467", "0.63817286", "0.63785887", "0.6378162", "0.6378062", "0.6353705", "0.63107264", "0.63105214", "0.62567365", "0.61916524", "0.6177634", "0.6177634", "0.61736625", "0.61150587", "0.60981184", "0.60981184", "0.6036588", "0.6010543", "0.6005455", "0.59684753", "0.5932915", "0.5928339", "0.590745", "0.58966845", "0.58814406", "0.58814406", "0.5796401", "0.57323396", "0.571296", "0.56638056", "0.56440914", "0.5643548", "0.5618152", "0.5615233", "0.56094456", "0.5599867", "0.5582985", "0.5578132", "0.55751", "0.55687106", "0.55687106", "0.55487657", "0.5547473", "0.5547008", "0.5532518", "0.55303717", "0.5521979", "0.5498645", "0.54935217", "0.547186", "0.5470311", "0.5466979", "0.5456918", "0.5452752", "0.5446338", "0.5429023", "0.5428765", "0.5402491", "0.53984153", "0.5392213", "0.5382339", "0.53766644", "0.5357467", "0.5343039", "0.53427416", "0.53388953", "0.53300315", "0.5323869", "0.53218406", "0.531981", "0.53149414", "0.5307382", "0.5303656", "0.52884036", "0.52700686", "0.5266594", "0.52501565", "0.52361476", "0.52284193", "0.52222687", "0.5220432", "0.5213983", "0.52114844", "0.52099997", "0.520326", "0.51903737", "0.5189952", "0.517587", "0.51757556", "0.5157087" ]
0.6144487
23
Returns a set of nodes with a type included in the provided array
def get_all_xpath(values) if values.nil? then return [] end return xpath('//' + values.join(XPATH_JOIN)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def types(types)\n select { |node| types.include?(node.type) }\n end", "def types(types)\n select { |node| types.include?(node.type) }\n end", "def array_of(*kinds, &block)\n lambda do |node|\n result = NodeFilters.filter(node, kinds)\n block ? result.map(&block) : result\n end\n end", "def get_array_type(array)\r\n\t\t\r\n\t\tif @l_identificadores != nil\r\n\t\t\tarray << @tipo1\r\n\t\t\t@l_identificadores.get_array_type(array)\r\n\t\telse\r\n\t\t\tarray << @tipo2\r\n\t\t\tarray << @tipo1\t\r\n\t\t\treturn array\r\n\t\tend\r\n\r\n\tend", "def types(array)\n yield(array)\nend", "def elements_by_type(type)\n\t\treturn xpath('//' + type)\n\tend", "def find_type_elements(type, nested = T.unsafe(nil), elements = T.unsafe(nil)); end", "def find_nodes(target_types, ignoring = [])\n result = []\n look_for_types(target_types, ignoring) { |exp| result << exp }\n result\n end", "def add_types(type, arr)\n lst = @shared[type]\n arr.each{ |t| lst.push(t) if !lst.include?(t) }\n end", "def possible_node_types(type)\n possible_types(type) & node_types\n end", "def nodes(attrs={})\n if attrs.is_a?(Hash) and attrs.has_key?(:type)\n attrs[:type].constantize.find(session, \"label_node_ids LIKE '%#{id}%'\")\n else\n Ecore::Node.find(session, \"label_node_ids LIKE '%#{id}%'\")\n #.inject(NodeArray.new) do |arr,n|\n # n.session = session\n # arr << n\n #end\n end\n end", "def elements_with_type(type, element_type = N::URI)\n return unless(rdf_active? && is_iri?)\n qry = ActiveRDF::Query.new(element_type).distinct.select(:s)\n qry.where(:s, RDF.type, type)\n qry.regexp(:s, \"^#{@uri_s}\")\n qry.execute\n end", "def registered_node_types\n [Nodes::String, Nodes::Excludes, Nodes::MustInclude, Nodes::Text]\n end", "def type(type)\n select { |node| node.type.equal?(type) }\n end", "def type(type)\n select { |node| node.type == type }\n end", "def registered_node_types\n [Nodes::String, Nodes::MustExclude, Nodes::MustInclude, Nodes::Text]\n end", "def on_type_test_node(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |node|\n if node.is_a?(XML::Node) or node.is_a?(XML::Document)\n nodes << node\n end\n end\n\n return nodes\n end", "def resolveTypeBranch(typeName, arrayComp = nil)\n # puts \"typeName is #{typeName}: #{arrayComp}\"\n\n if not arrayComp then\n search = typeName\n else\n search = arrayComp\n end\n\n if cppType?(search) then\n return @genClasses[@filename] += (@@indent + cppCode(mapXMLToCpp(search), \"_\" + @elemName) + \"\\n\")\n end\n\n found = false\n if @types.has_key?(search) then\n found = true\n value = @types[search]\n case value.class.name\n when \"Array\"\n value.each{|a|\n @elemName = a.keys[0]\n ## condition true means it has to be a resolvable simple type\n if a.keys[0] == a.values[0] then\n puts \"key=>value match? #{a.keys[0]} and #{a.values[0]}\"\n if not cppType?(search) then\n #One more search\n puts \"One more search\"\n resolveTypeBranch(a.values[0])\n else\n return @genClasses[@filename] += (@@indent + cppCode(mapXMLToCpp(a.values[0]), \"_\" + @elemName) + \"\\n\")\n end\n else\n resolveTypeBranch(a.keys[0], a.values[0])\n end\n }\n when \"String\"\n puts \"typeName = #{typeName} arrayComp #{arrayComp} @elemName #{@elemName} value #{value}\"\n resolveTypeBranch(value)\n else\n end #end case\n end #end types.has_key\n\n if not found then\n if cppType?(search) then\n return @genClasses[@filename] += (@@indent + cppCode(mapXMLToCpp(search), \"_\" + @elemName) + \"\\n\")\n else\n throw \"Failed to resolve xmlType #{search} for element/attribute #{@elemName}\"\n end\n end\n end", "def elements\n return @types.dup\n end", "def type(types)\n types = [types] unless types.is_a?(Array)\n any_in(:_type => types)\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 array_of(array, klass)\n array.any? { |i| i.class == klass }\n end", "def find_by_type(types); end", "def find_by_type(types); end", "def types(pattern = nil)\n @types ||= @doc.xpath(\"//*\").map { |e| e.name }.uniq\n\n pattern ?\n @types.select { |t| t =~ Regexp.new(pattern) } :\n @types\n end", "def types(pattern = nil)\n @types ||= @doc.xpath(\"//*\").map { |e| e.name }.uniq\n\n pattern ?\n @types.select { |t| t =~ Regexp.new(pattern) } :\n @types\n end", "def add_shared(arr)\n arr.each{ |t| add_types(t, arr) }\n end", "def all_by_name_and_type(name, type)\n where(name: name, array_type: type).order_by(&:array_index).to_a\n end", "def get_types(type)\n result = []\n types = TYPE_CONVERSION_TREE[type]\n if types\n result += types\n types.each do |t|\n result |= get_types(t)\n end\n end\n result\n end", "def others(array)\n array.select{|elt| not(any?{|name| elt.kind_of?(name)})}\n end", "def r_nodes\n support[:map].select do |key, node|\n node[:types].any? { |type| type.fetch(:only, {})[:language] == ['r'] }\n end\n end", "def array_of(type)\n new_class = Class.new(TypedArray)\n new_class.set_element_type(type)\n new_class\n end", "def my_array_method(my_array)\n results = []\n # .instance_of is only returns true if the object is an instance of that exact class, not a subclass.\n results << my_array.select { |x| x.is_a? Fixnum} # [3, 2]\n results << my_array.select { |x| !x.is_a? Fixnum} # [\"I\", \"want\", \"pets\", \"but\", \"only\", \"have\"]\n return results #[[2, 3], [\"I\", \"want\", \"pets\", \"but\", \"only\"]]\nend", "def populate_dom(array)\n node_count = 0\n current_node = @root\n current_depth = 0\n array.each do |hash|\n if DEEP_NODE.include? hash[:type]\n new_node = Node.new(hash, [], current_node, current_node.depth + 1)\n current_node.children << new_node\n current_node = new_node\n current_depth += 1\n else #hash[:type] == \"close\"\n current_depth -= 1 \n current_node = current_node.parent\n end\n node_count += 1\n end\n node_count\n end", "def populate_adjacency_list_via_array(array)\n @vertices = array.flatten.uniq.map { |v| Vertex.new('WHITE', 1, nil, [], v) }\n # Only directed edges are being added to the edges list\n @edges = array.map { |edge| Edge.new(find(edge[0]), find(edge[1])) }\n populate_adjacency_list\n end", "def by_type\n return @by_type if @by_type\n\n @by_type = {}\n self.all.each do |set|\n next unless set[:types].count > 0\n\n set[:types].each do |t|\n @by_type[t] ||= []\n @by_type[t] << set\n end\n end\n\n @by_type\n end", "def types\n @types ||= []\n end", "def hierarchies(array)\n count = 0\n array.reduce([]) { |acc, value| acc << array.slice(0, count += 1) }\n end", "def id_types\n identifiers.map(&:type).uniq\n end", "def find_type_elements_except(type, nested_except = T.unsafe(nil), elements = T.unsafe(nil)); 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 matching_sets(path, type); end", "def all_group_or_elems(type)\n if type == :group\n self.elements_groups\n elsif type == :elem\n self.elements\n end\n end", "def concat(array)\n array = array.to_a if array.is_a? Set\n push *array\n end", "def build_tree(input_array)\n sorted_set = input_array.sort.uniq\n build_tree_aux(sorted_set, 0, sorted_set.length - 1)\n end", "def nodes(nodeSet = Set.new)\n @topo.eachNode do |n|\n nodeSet << n\n end\n return nodeSet\n end", "def powerset(arr)\n arr.inject([Set.new].to_set) do |powerset, el|\n new_powerset = Set.new\n powerset.each do |subset|\n new_powerset << subset\n new_powerset << subset + [el]\n end\n new_powerset\n end\n end", "def children_of_the_array(array, source)\n retval = array.select{ |a| a if a[\"source\"] == source or a[\"source\"].include?(source)}.map{ |a| { \"name\" => a[\"name\"],\n \"type\" => a[\"type\"],\n \"id\" => a[\"id\"],\n \"children\" => [] } }\n retval.each do |children|\n children[\"children\"] = children_of_the_array(array, children[\"id\"])\n end\n return retval\n end", "def type(node, type); end", "def get_data_elements_by_type(patient, type)\n matches = []\n patient.dataElements.each do |data_element|\n matches << data_element if data_element[:_type] == type\n end\n matches\n end", "def create_graph(arr)\n nodes = []\n (0...arr.size).each do |i|\n node = Node.new(i)\n nodes.push(node)\n end\n nodes.each_with_index do |node,i|\n arr[i].each {|val| node.connections.push(nodes[val])} \n end\n nodes\nend", "def create_graph(arr)\n nodes = []\n (0...arr.size).each do |i|\n node = Node.new(i)\n nodes.push(node)\n end\n nodes.each_with_index do |node,i|\n arr[i].each {|val| node.connections.push(nodes[val])} \n end\n nodes\nend", "def find_by_type(types)\n matches = []\n matches << self if to_type == types\n @value.each do |v|\n matches += v.find_by_type(types) if v.respond_to?(:find_by_type)\n end\n matches\n end", "def array_to_binary(arr)\n node = Node.new(arr[0])\n arr.slice(1..-1).each {|el| insert_into_tree(node, el) }\n node\nend", "def resource_type_for_node(node)\n result = []\n @resource_type_mapping.each do |class_name, resource_type|\n result << resource_type if node.is_a?(class_name)\n end\n\n result\n end", "def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend", "def convert_to(ary, type)\n new = []\n ary.each_index do |row|\n new << ary[row].collect {|elem| elem.send(type)}\n end\n new\n end", "def build_tree_arbitrary(arr)\n node = Node.new(arr[0])\n queue = [node]\n @root = node\n i = 0\n\n until queue.empty?\n node = queue.shift\n children = node_children(node, i, arr)\n queue.concat(children)\n i += 2\n end\n end", "def types(types); end", "def build_document_components_array(node_set)\n node_set\n .reject { |node| node.respond_to?(:html_dtd?) && node.html_dtd? }\n .map { |node| build_document_component(node) }\n end", "def components_with_type(type)\n array = []\n @components.each_value do |c|\n array << c.proxy.name if c.proxy.respond_to?(:has_type?) &&\n c.proxy.has_type?(type)\n end\n array\n end", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def node_types\n schema.possible_types(node_interface)\n end", "def get_array(element, path='.')\n return unless element\n \n result = element/path\n if (result.is_a? Nokogiri::XML::NodeSet) || (result.is_a? Array)\n result.collect { |item| self.get(item) }\n else\n [self.get(result)]\n end\n end", "def resolveTypeBranch2(typeName, arrayComp = nil)\n puts \"typeName is #{typeName}: #{arrayComp}\"\n if not arrayComp then\n if @types.has_key?(typeName) then\n value = @types[typeName]\n case value.class.name\n when \"Array\"\n value.each{|a|\n puts \"in array of type branch #{typeName}|#{a}\"\n resolveTypeBranch(typeName, a)\n }\n when \"String\"\n puts \"should return typeName is #{typeName} and value is #{value}\"\n if cppType?(value) then\n return @genClasses[@filename] += (@@indent + cppCode(mapXMLToCpp(value), \"_\" + @elemName) + \"\\n\")\n else\n\n throw \"type #{typeName} has value #{value} not found in @types\n should have resolved to cpp type by now\" if not @types.has_key?(value)\n\n resolveTypeBranch(value, nil)\n end\n else\n\n throw \"Structure of @type tree is wrong as #{typeName} has hash type of\n #{@types[typeName].class.name}\"\n\n end #case\n else\n ## @elemName is a real hack\n @genClasses[@filename] += (@@indent + cppCode(mapXMLToCpp(typeName), \"_\" + @elemName) + \"\\n\")\n end\n else #arrayComp\n throw \"type #{typeName} not found in @types\" if not @types.has_key?(typeName)\n\n case arrayComp.class.name\n when \"Hash\"\n puts \"#{typeName}: #{arrayComp.values[0]}\"\n begin\n @elemName = arrayComp.keys[0]\n resolveTypeBranch(arrayComp.values[0])\n rescue\n @genClasses[@filename] += (@@indent + cppCode(mapXMLToCpp(arrayComp.values[0]), \"_\" + arrayComp.keys[0]) + \"\\n\")\n end\n\n #Cheating as no type component is a string only hashes but we call this\n #function with the elemName and arrayComp from element and we are really\n #looking to resolve arrayComp and at same time requiring the use of\n #elemName\n\n #when String #(Instead of this hack we can introduce a current element\n #name local variable for element/attribute name)\n\n else\n throw \"Unknown @type #{typeName} with ruby type of #{arrayComp.class.name}\"\n end\n\n end\n\n end", "def find_all(value)\n nodes = []\n self.each {|node| nodes << node if node.value == value}\n nodes\n end", "def build_tree(arr)\n\tend", "def to_a\n @nodes\n end", "def nodetype() @records.get_data(GRT_NODETYPE); end", "def resources_by_type(ast)\n raise_unless_xpath!(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each do |resource|\n result[resource_type(resource)] << resource\n end\n result\n end", "def others(array)\n array.select{|elt| not(elt.kind_of?(Meta))}\n end", "def content_type_classes(meta=false)\n (meta ? @metadata_tree.node_types : @content_tree.node_types).dup\n end", "def Array(type)\n Strict(::Array).of(type)\n end", "def array_node?(node)\n node.attributes['type'] == 'collection'\n end", "def my_array_splitting_method(source)\n new_array =[]\n new_array.push(source.select {|item| item.is_a? Integer})\n new_array.push(source.select {|item| item.is_a? String})\n p new_array\n\nend", "def get_all_image_types_for_job(image_type_obj_array)\r\n image_type_array = image_type_obj_array.map {|image_type| image_type.image_type} unless image_type_obj_array.blank?\r\n image_type_array\r\n end", "def select(array)\n final_selections = []\n\n for elem in array do\n result = yield(elem)\n final_selections << elem if result\n end\n \n final_selections\nend", "def reference_types\n types = []\n\n # Will need the 008[24] and 006[7]\n f8_24 = self['008[24]']\n f6_7 = self['006[7]']\n\n\n\n if (f8_24.include? 'e') || (f6_7.include? 'e')\n types << 'EN'\n end\n\n if f6_7.include? 'd'\n types << 'DI'\n types << 'DR'\n end\n\n if f8_24.include? 'd'\n types << 'DI'\n end\n\n if f8_24.include? 'r'\n types << 'DR'\n end\n\n types << 'EN' if @xv6XX.match? /encyclopedias/i\n types << 'DI' if @xv6XX.match? /dictionaries/i\n types << 'DR' if @xv6XX.match? /directories/i\n\n types.uniq!\n return types\n end", "def populate_adjacency_list_via_array(array)\n @vertices = array.flatten.uniq.map { |v| Vertex.new('WHITE', 1, nil, [], v) }\n # Both forward and backward edges are being added to the edges list\n forward_edges = array.map { |edge| Edge.new(find(edge[0]), find(edge[1])) }\n backward_edges = array.map { |edge| Edge.new(find(edge[1]), find(edge[0])) }\n @edges = forward_edges + backward_edges\n populate_adjacency_list\n end", "def on_type_test_text(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |node|\n nodes << node if node.is_a?(XML::Text)\n end\n\n return nodes\n end", "def flatten(array)\n a = []\n array.each do |n|\n if n.is_a? Array\n b = flatten(n)\n b.each { |x| a << x }\n else\n a << n\n end\n end\n a\nend", "def jmaki_type_include(type)\n if (@jmaki_types == nil)\n @jmaki_types = Array.new\n end\n @jmaki_types << type\n end", "def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end", "def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end", "def build_array(node)\r\n return [] if node.nil?\r\n results = []\r\n results.concat build_array(node.left)\r\n results << node.payload\r\n results.concat build_array(node.right)\r\n results\r\nend", "def load_genres(tag_arr)\n\n\t\t@genres = Array.new(tag_arr.size)\n\n\t\ttag_arr.each_with_index do |el ,i|\n\n\t\t\t\t@genres[i] = true if el == 1\n\n\t\t\t\t@genres[i] ||= false #might not be necessary\n\n\t\t\tend\n\n\tend", "def set_parent(node, array)\n\t\tnode_array = []\n\t\tarray.each do |position|\n\t\t\tchild_node = Node.new(position, node)\n\t\t\tnode_array << child_node\n\t\tend\n\t\treturn node_array\n\tend", "def subtypes(allow_caching = true)\n my_node(allow_caching).subclasses.collect { |st| SourceClass.new(st.uri) }\n end", "def getTypeUrlFromTypesObject(types)\n return types.map {|x| x['type']['url']}.compact\nend", "def produce_tree(ary); end", "def reflect_array(array)\n reflection = []\n array.each { |element| reflection.unshift(element) }\n reflection\nend", "def extract_types(doc)\n types = []\n @raw_types.each do |raw_type|\n doc.each_element_with_attribute('name', raw_type, 0,\n '//schema/complexType') do |type_node|\n type = {:name => raw_type, :fields => []}\n ext_node = REXML::XPath.first(type_node, 'complexContent/extension')\n if ext_node\n base_type = ext_node.attribute('base').to_s.gsub(/^.+:/, '')\n type[:base] = base_type\n @raw_types << base_type unless @raw_types.include?(base_type)\n seq_node = REXML::XPath.first(ext_node, 'sequence')\n fields = get_element_fields(seq_node)\n process_method_field_types(fields)\n type[:fields] += fields\n end\n seq_node = REXML::XPath.first(type_node, 'sequence')\n if seq_node\n fields = get_element_fields(seq_node)\n process_method_field_types(fields)\n type[:fields] += fields\n end\n types << type\n end\n end\n return types\n end", "def friendly_types_list(arr)\n fixed_arr = Array(arr).map do |x|\n case x\n when \"TrueClass\"\n \"true\"\n when \"FalseClass\"\n \"false\"\n else\n x\n end\n end\n fixed_arr.compact.join(\", \")\n end", "def flatten(array)\n container = []\n\n array.each do |element|\n if element.is_a?(Array)\n container += element\n else\n container << element\n end\n end\n\n container\nend", "def arr(n)\n\n return [n] if !n.kind_of?(Array)\n\n butts = []\n\n n.each do |ele|\n\n butts += arr(ele)\n end\n\n # if n.kind_of?(Array) == false\n # butts << n\n \n # else\n # arr(n[0])\n # end\n\n butts\n \n\nend", "def my_array_splitting_method(source)\n new_array = []\n new_array << source.select { |i| i.is_a? Integer }\n new_array << source.select { |i| i.is_a? String }\n new_array\nend", "def externals(type)\n @externals ||= []\n\n type = type.to_sym\n parent_externals = if superclass.respond_to?(:externals)\n superclass.externals(type)\n else\n []\n end\n\n my_externals = @externals.select do |external|\n external.type == type\n end\n\n (parent_externals + my_externals).uniq\n end", "def add_classes(rule_set, class_array)\n rule_set.each_selector do |selector|\n selector_name = selector.to_s.strip\n if selector_name[0] == '.'\n selector_name = selector_name[1, selector_name.length]\n unless class_array.include?(selector_name)\n class_array << selector_name\n end\n end\n end\n end", "def get_type_trophies(type)\n trophies = []\n @knights.each do |knight|\n knight.trophies.each do |trophy|\n packet = [knight.id, trophy] \n trophies << packet if trophy.type == type\n end\n end\n return trophies\n end" ]
[ "0.6270133", "0.6270133", "0.6219962", "0.58022994", "0.5709348", "0.5707796", "0.5702014", "0.5658399", "0.5600445", "0.55492353", "0.54454195", "0.5416081", "0.53924054", "0.5359042", "0.53554666", "0.53327984", "0.5291171", "0.5253226", "0.5240951", "0.5231185", "0.52054685", "0.51926184", "0.5189932", "0.5189932", "0.51829493", "0.51829493", "0.5168458", "0.5140355", "0.5132106", "0.50900024", "0.50895923", "0.5077679", "0.5060433", "0.5024625", "0.5011909", "0.500777", "0.49617946", "0.4928255", "0.49281925", "0.49236438", "0.49206603", "0.49152446", "0.49105865", "0.49103242", "0.49087316", "0.4906713", "0.4902152", "0.4896243", "0.48950997", "0.48793143", "0.4856449", "0.4856449", "0.48506868", "0.48497146", "0.48421317", "0.48320603", "0.48311666", "0.48268092", "0.482519", "0.4820869", "0.48089293", "0.48057848", "0.48057848", "0.48057848", "0.47998878", "0.47926557", "0.47868955", "0.4774625", "0.47713077", "0.4766614", "0.4766063", "0.47637984", "0.47546765", "0.4745214", "0.47435442", "0.47402534", "0.47374696", "0.47071055", "0.47035524", "0.46982098", "0.4690364", "0.4689771", "0.46819848", "0.46643937", "0.4664221", "0.4664221", "0.46632978", "0.46588224", "0.465877", "0.46517196", "0.46496427", "0.4645789", "0.46422297", "0.46407613", "0.4640174", "0.46379057", "0.46311802", "0.46303248", "0.46180075", "0.46169013", "0.46164355" ]
0.0
-1
Returns a set of nodes based on the provided css query
def css(query) return is_valid ? @doc.css(query) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def css *args\n if children.any?\n children.css(*args)\n else\n NodeSet.new(document)\n end\n end", "def search(*selectors)\n NodeSet.new selectors.map {|selector|\n xpath(selector).to_a.concat(css(selector).to_a)\n }.flatten.uniq\n end", "def elements(css_query, output = process_output)\n Hpricot::Elements[*css_query.to_s.split(\",\").map{|s| s.strip}.map do |query|\n output[query]\n end.flatten]\n end", "def html_nodes\n document = Nokogiri::HTML(@file.content)\n document.css(@config['record_css_selector'])\n end", "def css(selector)\n raise NotImplementedError, 'query by CSS selector unsupported'\n end", "def css css_selector\n @scene.get_root.lookup_all(css_selector).map {|e| e}\n end", "def tags(css_query, output = process_output)\n output.content_for_all(css_query)\n end", "def find_css\n @dom.css(STYLE_ELEMENT_QUERY).map { |element| read_stylesheet(element) }.compact\n end", "def query_selector_all(expr)\n Traverser.new(expr).evaluate(Context.new(node: self))\n end", "def find_all(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def query_selector_all(node_id:, selector:)\n {\n method: \"DOM.querySelectorAll\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end", "def fetch_nodes_between head_selector, tail_selector\n Rake::Task[:@man_html_dom].invoke\n\n head = @man_html_dom.at(head_selector) or raise head_selector\n body = []\n\n tail = head\n body << tail while\n tail = tail.next_sibling and\n not tail.matches? tail_selector\n\n [head, body, tail]\nend", "def query_selector_all(selector)\n document.query_selector_all selector\n end", "def fetch_listing_nodes\n @page_nodes.each do |node|\n all_rows = node.css('table')[1].css('tr:not(.directionheader)')\n all_rows.each do |row|\n @listing_nodes.push(\n row.css('td')\n )\n end\n end\n end", "def find(selector)\n nodes = @_node.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def findAll(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def find(query)\n path = if xml.namespaces.empty?\n \"//#{query}\"\n else\n \"//xmlns:#{query}\"\n end\n\n xml.xpath(path).map do |node|\n hsh = XMLUtils.to_hash node\n block_given? ? yield(hsh) : hsh\n end\n end", "def parse_response_body\n CSS_SELECTORS_MAP\n .each_with_object([]) { |(*args), array| array << search_node(*args) }\n .flatten\n .map { |url| Absolutely.to_abs(base: response_url, relative: url) }\n .uniq\n end", "def selectors\n @selectors ||= []\n end", "def css(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n return Array.from(within.querySelectorAll(selector));\n }\n JS\n\n evaluate_func(expr, selector, within)\n end", "def extract_rows\n @rows ||= load_page.search(\"//div[contains(concat(' ',normalize-space(@class),' '),' flightresult ')]\")\n end", "def query(selector, attr, *filters)\n (filters.any? ? doc.search(*filters).css(selector) : doc.css(selector))\n .map { |node| URI.join(uri, node.attr(attr)) rescue nil }\n .find_all { |uri| uri.is_a?(URI) }\n .uniq\n end", "def css(selector)\n @doc.css(selector)\n end", "def extract_css\n @dom.css(STYLE_ELEMENT_QUERY).map { |element|\n stylesheet = read_stylesheet(element)\n element.remove if stylesheet\n stylesheet\n }.compact\n end", "def nodes\n strong_memoize(:nodes) do\n nodes = doc.xpath(XPATH)\n nodes.drop(EMBED_LIMIT).each(&:remove)\n\n nodes\n end\n end", "def each_node\n return to_enum(__method__) unless block_given?\n\n doc.xpath(query).each do |node|\n yield node\n end\n end", "def find_all_nodes(xpath, select_result_value=false)\n if self.feed_data_type != :xml\n raise \"The feed data type is not xml.\"\n end\n return FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [xpath],\n :select_result_value => select_result_value)\n end", "def node_css_selector(node)\n return nil if node.nil?\n\n # Use the CSS id if one is set\n return \"##{node['id']}\" if node['id']\n\n # Default Nokogiri selector\n node.css_path.gsub('html > body > ', '')\n end", "def get_elements(xpath); end", "def nodes(node_name)\n Nokogiri.XML(subject.to_xml.to_s).remove_namespaces!.css(node_name)\nend", "def /(*paths)\n NodeSet[paths.map { |path| xpath(path) }]\n end", "def to_css\n queries.map {|q| q.to_css}.join(', ')\n end", "def to_css\n queries.map {|q| q.to_css}.join(', ')\n end", "def crawler_items\n crawler_data.css('.sresult')\n end", "def find(selector)\n nodes = current_frame.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def search *paths\n ns = paths.last.is_a?(Hash) ? paths.pop : {}\n xpath(*(paths.map { |path|\n path =~ /^(\\.\\/|\\/)/ ? path : CSS.xpath_for(path, :prefix => \".//\")\n }.flatten.uniq) + [ns])\n end", "def get_source_selectors\n case @source\n when \"Asahi Shimbun\"\n [\"div.body p\"]\n when \"BBC\"\n [\"div.story-body p\", \"div.map-body p\"]\n when \"CNN\"\n [\"section#body-text p\"]\n when \"Chosun Ilbo\"\n [\"div.article p\"]\n when \"New York Times\"\n [\"p.story-content\", \"p.story-body-text\"]\n when \"Nippon.com\"\n [\"div#detail_contents\"]\n when \"The Economist\"\n ['div[itemprop=\"articleBody\"] p']\n when \"The Guardian\"\n ['div[itemprop=\"articleBody\"] p', 'div.flexible-content-body p']\n when \"The Japan Times\"\n ['div#jtarticle p']\n when \"The Japan Daily Press\"\n [\"div.post p\"]\n when \"Japan Today\"\n ['div#article_content p']\n when \"South China Morning Post\"\n ['[property=\"content:encoded\"] p']\n when \"Tokyo Reporter\"\n [\"div.entry-content p\"]\n when \"WSJ\"\n [\"div.articleBody p\", \"article.articleBody p\"]\n else\n []\n end\n end", "def make_nodes(ids, opt)\n result = []\n ids.each do |id|\n id = id.tr('\"', '')\n selector = \"//*[@capybara-ng-match='#{id}']\"\n nodes = page.driver.find_xpath(selector)\n\n raise NotFound.new(\"Failed to match found id to node\") if nodes.empty?\n result.concat(nodes)\n end\n page.evaluate_script(\"clearCapybaraNgMatches('#{opt[:root_selector]}')\");\n result\n end", "def get_content_array(xpath_query)\n scraped_array = Array.new\n pos = 0\n @current_page.search(xpath_query).each do |var|\n scraped_array[pos] = var.content.strip\n pos += 1\n end\n scraped_array\n end", "def process_nodes(html_nodes, properties); end", "def at_css(*rules)\n result = nil\n\n rules.each {|rule|\n if result = css(rule).first\n break\n end\n }\n\n result\n end", "def derived_css(html, selector)\n runon = html.css('.runon')\n runon.each do |r|\n n = r.css('[title=\"Derived word\"]')\n if n.text == @word\n node = r.css(selector)\n yield(node)\n end\n end\n end", "def find! css_selector\n res = find(css_selector)\n raise \"Selector(#{css_selector}) returned no results!\" unless res\n res\n end", "def have_css_classes(names) # rubocop:disable Style/PredicateName\n CustomMatchers::NodeCssClassMatcher.new names\nend", "def all_nodes\n nodes = []\n visit_nodes do |node|\n nodes.push node\n end\n nodes\n end", "def select_nodes(&block)\n each_node.select &block\n end", "def ret_matching_nodes(parent_idh)\n if parent_idh[:model_name] == :node\n return [parent_idh]\n end\n filter = [:eq, :assembly_id, parent_idh.get_id()]\n if node_filter = ret_filter(pattern, :node)\n filter = [:and, filter, node_filter]\n end\n sp_hash = {\n cols: [:id, :group_id, :display_name],\n filter: filter\n }\n Model.get_objs(parent_idh.createMH(:node), sp_hash)\n end", "def get_all_lines(page)\n return page.xpath('//tr[@class=\"cmc-table-row\"]')\nend", "def search_for_selectors(search, expectedCount)\n # get all links for current page\n links = get_position_links\n # count used to put all information for 1 position in 1 array\n count = 1\n # link_index used to add the appropriate links to array\n link_index= 0\n # Sub array that will hold the information of 1 position\n job_content = []\n # Super array that holds information of all positions\n job_array = []\n @page.search(search).each do |selector|\n job_content << selector.text.strip\n if count % expectedCount == 0\n job_content << links[link_index]\n link_index += 1\n job_array << job_content\n job_content = []\n end\n count += 1\n end\n # Return super array\n job_array\n end", "def nodes_until_hr\n nodes = []\n until !body_has_more_nodes? ||\n NodeAnalyzer.new(@body_enumerator.peek).hr?\n nodes << @body_enumerator.next\n end\n nodes\n end", "def selectors\n self.class.selectors\n end", "def on_test(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |xml_node|\n nodes << xml_node if node_matches?(xml_node, ast_node)\n end\n\n return nodes\n end", "def prepare_method(query)\n query.first == :xpath ?\n :have_xpath :\n :have_css\n end", "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "def duplication\n nodes = @html.css('*')\n nodes.map do |node|\n # siblings\n siblings = node.xpath('following-sibling::*')\n if siblings.any?\n duplicated_classes?(siblings) ? 1 : 0\n #siblings.before(node).map(&:children)\n end\n end.compact.inject(:+)\n end", "def query_body_nodes\n body_node = query_body_node\n query_body_node && query_body_node.elements\n end", "def get_classes_with_color(css)\n # Double quoted strings: /\"([^\\\\\"]|\\\\.)*\"/\n # Single quoted strings: /'([^\\\\']|\\\\.)*'/\n # Color regex: /#(\\h{3}){1,2}\\b|\\brgba?\\([^()]+\\)|\\bhsla?\\([^()]+\\)/i\n # hex: /#(\\h{3}){1,2}\\b/\n # rgb/a: /\\brgba?\\([^()]+\\)/\n # hsl/a: /\\bhsla?\\([^()]+\\)/\n css = css.gsub(/\\/\\*.*?\\*\\//m, '')\n css.scan(/([^{}]+)\\{(\n (?:[^{}\"']|\"(?:[^\\\\\"]|\\\\.)*\"|'(?:[^\\\\']|\\\\.)*')*\n (?:\\#(?:\\h{3}){1,2}\\b|\\brgba?\\([^()]+\\)|\\bhsla?\\([^()]+\\))\n (?:[^{}\"']|\"(?:[^\\\\\"]|\\\\.)*\"|'(?:[^\\\\']|\\\\.)*')*\n )\\}/ix).map do |selector, block|\n rules = block.scan(/(?:[^\"';]|\"(?:[^\\\\\"]|\\\\.)*\"|'(?:[^\\\\']|\\\\.)*')+\n :(?:[^\"';]|\"(?:[^\\\\\"]|\\\\.)*\"|'(?:[^\\\\']|\\\\.)*')+/ix)\n rules.select!{ |r| r.gsub(/\".*\"|'.*'/, '').match(/\\#(?:\\h{3}){1,2}\\b|\\brgba?\\([^()]+\\)|\\bhsla?\\([^()]+\\)/i) }\n rules.map!(&:strip)\n { selector: selector.strip, rules: rules }\n end\nend", "def find_all(value)\n nodes = []\n self.each {|node| nodes << node if node.value == value}\n nodes\n end", "def nodes()\n return SearchNodes.new(:node => self, :return_many => true)\n end", "def query_selector(selector)\n document.query_selector selector\n end", "def find_all_nodes(*args)\n raise NotImplementedError\n nodes = @database.all_nodes\n # TODO: design node finder syntax\n nodes\n end", "def find_nodes(target_types, ignoring = [])\n result = []\n look_for_types(target_types, ignoring) { |exp| result << exp }\n result\n end", "def xpathall(path,xml)\n r=[]\n XPath.each(xml,path){|x|r<<x}\n r\nend\n", "def extract_all_nodes(xpath, node = xml, namespaces = DEFAULT_NAMESPACES)\n _extract_nodes(:match, xpath, node, namespaces)\n end", "def css\n options.fetch :css, CSS_SELECTOR\n end", "def css_impl(_roots, _parsed)\n throw 'TODO'\n end", "def css_selector *args\n tag = @tag\n type = :full\n args.each { |a|\n case\n when a.is_a?(Symbol)\n type = a\n else\n tag = a\n end\n }\n\n metaphor = (de_ref(tag) || {}.freeze)\n\n final = case\n\n when type == :full && tag?(metaphor, :group)\n css = metaphor[:children].inject([]) { |memo, c|\n if !(tag?(c, :group)) && !c[:__parent]\n memo << css_selector(c, :full)\n end\n memo\n }\n\n if css\n css.join COMMA\n else\n nil\n end\n\n when tag?(metaphor, :style)\n p = metaphor[:parent]\n if p\n css_selector p, type\n end\n\n when type == :full && parent?(metaphor, :group)\n grand_parent = metaphor[:parent][:parent]\n grand_css = grand_parent && css_selector(grand_parent, :full)\n use_grand = !(metaphor[:__] && metaphor[:__children].detect { |e| tag?(e, :_) })\n\n if grand_css && use_grand\n grand_css.split(COMMA).map { |css|\n css << SPACE << css_selector(metaphor, :tag)\n }.join COMMA\n else\n css_selector metaphor, :tag\n end\n\n when type == :tag\n id = metaphor[:id]\n name = if id\n '#' << Clean.html_id(id).to_s\n else\n metaphor[:tag_name].to_s\n end\n\n if metaphor[:class]\n name << '.'.freeze\n name.<<(\n metaphor[:class].map { |name|\n Clean.css_class_name(name.to_s)\n }.join('.'.freeze)\n )\n end\n\n if metaphor[:pseudo]\n name << \":#{metaphor[:pseudo]}\"\n end\n\n if tag[:__]\n name << SPACE << tag[:__children].map { |c|\n css_selector(c, :tag)\n }.join(SPACE)\n end\n\n name = if name.empty?\n nil\n else\n name\n end\n\n when type == :ancestor\n if metaphor[:id]\n nil\n else\n selectors = []\n p = metaphor[:parent]\n while p\n selectors.unshift(css_selector(p, :tag)) unless [:style, :group].freeze.include?(p[:tag_name])\n p = p[:id] ? nil : p[:parent]\n end # === while\n\n selectors.compact.join(SPACE)\n end\n\n else\n [css_selector(metaphor, :ancestor), css_selector(metaphor, :tag)].compact.join SPACE\n end\n\n return nil if !final || final.empty?\n final.gsub(' _!:'.freeze, ':'.freeze)\n end", "def slice_of_css(start, stop)\n start == stop ? [start] : [start, *slice_of_css(start.next, stop)]\nend", "def elements(selector)\n @doc.search(selector)\n end", "def predicates\n @graphs.inject([]) {|memo, g| memo += g.predicates}\n end", "def tags\n node.css(\"category\").map(&:text)\n end", "def find_all_nodes(*args)\n nodes = @nodes.find_all_nodes(*args)\n nodes.find_all { |n| context?(n) }\n end", "def jira_search\n\n @lunch_special = SlackJIRABot.new\n doc = Nokogiri::HTML(open('http://www.truetastes.com/anitas-cafe-lunch-catering/'))\n\n ####\n # Search for nodes by css\n\n if(doc)\n doc.css('div.specials_copy').each do |specials|\n @lunch_special.html_content = specials.inner_html\n @lunch_special.text_content = specials.content\n end\n end\n\n return @lunch_special\n\nend", "def select_nodes(ypath, tree)\n case ypath\n when Hash\n if path = ypath['path'] || ypath['ypath']\n nodes = tree.select(path)\n else\n nodes = tree.select('*') # all nodes\n end\n YES.constraints.each do |c|\n next unless Constraints::NodeConstraint === c\n checklist = c.checklist(spec, tree, nodes)\n selection = checklist.select{ |v| v.valid? }\n nodes.concat(selection.map{ |s| s.node })\n end\n nodes\n else\n tree.select(ypath)\n end\n end", "def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end", "def elements_by_type(type)\n\t\treturn xpath('//' + type)\n\tend", "def list_dom_loaded\n ar = []\n nodes.reject(&:invisible?).each do |node|\n ar += node.list_dom_loaded if node.respond_to?(:dom_loaded?) && node.dom_loaded?\n end\n ar\n end", "def sliced_nodes\n @sliced_nodes ||= begin\n case arguments[:order] || 'newest'\n when 'newest'\n if after\n nodes.where(\"created_at < ?\", created_at_from_cursor(after)).order(created_at: :desc)\n elsif before\n nodes.where(\"created_at > ?\", created_at_from_cursor(before)).order(created_at: :desc)\n else\n nodes.order(created_at: :desc)\n end\n when 'oldest'\n if after\n nodes.where(\"created_at > ?\", created_at_from_cursor(after)).order(created_at: :asc)\n elsif before\n nodes.where(\"created_at < ?\", created_at_from_cursor(before)).order(created_at: :asc)\n else\n nodes.order(created_at: :asc)\n end\n else\n raise GraphQL::ExecutionError, \"Unknown order: #{order}\"\n end\n end\n end", "def at_css(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n return within.querySelector(selector);\n }\n JS\n\n evaluate_func(expr, selector, within)\n end", "def get_calculated_style( query, style )\n #begin assemble javascript\n script = \"return jQuery('\"\n \n #selector query\n script << \"#{query}\"\n script << \"').css('\"\n \n #css styles to verify\n script << \"#{style}\"\n script << \"');\"\n \n begin\n return @wd.execute_script(\"#{script}\")\n rescue Selenium::WebDriver::Error::JavascriptError\n return \"Unable to obtain\"\n end\n end", "def find css_selector\n @scene.lookup css_selector\n end", "def find_all_in_scope(node, predicate); end", "def getItems\n @doc.css('[itemscope]').select {|el| !el.has_attribute?('itemprop')}.map {|n| NodeProxy.new(n)}\n end", "def search(query)\n\t\t\t\t\t\tresult = []\n\t\t\t\t\t\tif !query.blank?\n\t\t\t\t\t\t\tself.available_selectors.each do |selector_ref, selector_def|\n\t\t\t\t\t\t\t\tselector_def[:search].call(query.to_s).each do |found_params|\n\t\t\t\t\t\t\t\t\tresult << {\n\t\t\t\t\t\t\t\t\t\tvalue: encode_value(selector_ref, found_params),\n\t\t\t\t\t\t\t\t\t\ttitle: selector_def[:title].call(found_params)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\treturn result\n\t\t\t\t\tend", "def fakesearch_all_nodes(options = {})\n fakesearch_nodes(nil, options)\nend", "def css\n Sass::Tree::Visitors::ToCss.new.visit(self)\n end", "def apply( nodes )\n nodes = nodes.to_a\n results = nodes\n difference = nodes\n until difference.empty?\n step_results = @selector.apply( difference )\n difference = step_results - results\n results.concat( difference )\n end\n \n return results.reverse\n end", "def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end", "def get_inflated_node_list\n Chef::Node.list(true)\n end", "def node_list\n list = {}\n search = Chef::Search::Query.new\n query = config[:query]\n\n ui.msg \"Search nodes '#{query}'\"\n search.search('node', query) do |node|\n if node['chef'] && node['chef']['client_version']\n version = node['chef']['client_version']\n\n list[version] ||= []\n list[version] << node\n end\n end\n ui.msg ''\n\n list\n end", "def at_css(*args); end", "def at_css(*args); end", "def where(query)\n components = query.match(NODE_QUERY_SYNTAX)\n\n raise BadReferenceError, \"for reference: #{query}\" unless components\n search_node_components(components)\n end", "def childNodes\n NodeList.new(\n native_node.children.map do |child|\n next if child.is_a? Nokogiri::XML::ProcessingInstruction\n Browser.wrap_node(child)\n end.compact\n )\n end", "def nodes\n NODE_LIST_REGEX.match(@text).to_s.scan(NODE_REGEX).map do |match|\n Node.new(match[1], match[2], match[3].to_i)\n end\n end", "def elements_by_xpath(value)\n find_by_xpath(value)\n end", "def nodeset_for(symbols)\n ng_xml.xpath(self.class.terminology.xpath_for(symbols))\n end", "def get_courses\n self.get_page.css(\".post\")\n end", "def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end", "def nodes(nodeSet = Set.new)\n @topo.eachNode do |n|\n nodeSet << n\n end\n return nodeSet\n end" ]
[ "0.6573356", "0.6561223", "0.6100464", "0.60985225", "0.6066445", "0.5941786", "0.59309095", "0.59168774", "0.5831138", "0.57481235", "0.5699979", "0.56963116", "0.56922334", "0.5687673", "0.5544549", "0.5489984", "0.5481854", "0.5461843", "0.5452489", "0.5447596", "0.54129255", "0.54061735", "0.53735685", "0.53426737", "0.5301531", "0.5297306", "0.5278835", "0.52706915", "0.5259428", "0.5245256", "0.5240706", "0.52032244", "0.52032244", "0.5160924", "0.51533204", "0.51419646", "0.513541", "0.5046084", "0.5043933", "0.5036763", "0.50070494", "0.49712935", "0.49438566", "0.49333385", "0.49298885", "0.49171016", "0.4882478", "0.4877298", "0.48724133", "0.48714086", "0.48682147", "0.48678726", "0.48641822", "0.48623165", "0.4857556", "0.4855293", "0.48416284", "0.48403472", "0.48193535", "0.48105425", "0.48081866", "0.48020983", "0.48013565", "0.47955883", "0.4791273", "0.4784328", "0.47607222", "0.47552076", "0.47406706", "0.4738919", "0.4735729", "0.47268558", "0.4722814", "0.4717628", "0.47150037", "0.4713197", "0.47071454", "0.47029412", "0.46947998", "0.4689084", "0.46871036", "0.46748796", "0.4674169", "0.46670082", "0.46619463", "0.46381462", "0.46374577", "0.46277776", "0.46249947", "0.4624145", "0.46209154", "0.46209154", "0.46174815", "0.46097606", "0.4604465", "0.46014693", "0.4591988", "0.45874485", "0.4587425", "0.45846295" ]
0.64105386
2
Returns the root node of the current xml document
def root return @doc == nil ? nil : @doc.root; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_node\n if @root_node.nil?\n # TODO: Fix this so that added content at the end of the file doesn't\n # break this stuff.\n # E.g.: http://smogzer.tripod.com/smog.rdf\n # ===================================================================\n begin\n if self.xml_document.nil?\n return nil\n else\n @root_node = self.xml_document.root\n end\n rescue Exception\n return nil\n end\n end\n return @root_node\n end", "def root_element\n root.xml \n end", "def root\n @root ||= NodeProxy.new(@doc.root) if @doc && @doc.root\n end", "def root\n return nil unless self.document\n self.document.root\n end", "def get_root(doc)\n doc.children.first\n end", "def root_node\n root_nodes.first\n end", "def get_root(doc)\n # skip :REXML::XMLDecl\n # REXML children does not properly implement shift (or pop)\n root = doc.children.find { |el, i| el.kind_of?(REXML::Element) }\n if root.nil?\n raise ArgumentError, \"XML document does not contain any elements\"\n else\n root\n end\n end", "def xml_document\n @root_node.to_s\n end", "def xml_document\n @root_node.to_s\n end", "def root\n return @root\n end", "def root\n return @root\n end", "def root\n @elements[@root_name]\n end", "def root\n subject.root(node)\n end", "def root\n @root\n end", "def root_node; end", "def root_node(node)\n return node.respond_to?(:root_node) ? node.root_node : node\n end", "def root\n return @root\n end", "def get_root\n return self if tag == :root || parent.nil?\n parent.get_root\n end", "def root\n @root ||= start\n end", "def root\n @elements[@root]\n end", "def root\n @attributes[:root]\n end", "def document_root_element; end", "def root\n @root ||= (parent ? parent.root : self)\n end", "def root\n @root ||= (parent ? parent.root : self)\n end", "def root_document\n ri = root_item\n return self if ri == nil # i.e, if it is a root document\n ri_id = ri.id\n return if ri_id == nil\n DocumentRepository.find(ri_id)\n end", "def root\n node = self\n node = node.parent while node.parent\n node\n end", "def root\n node = self\n node = node.parent while node.parent\n node\n end", "def root\n node = self\n node = node.parent while node.parent\n node\n end", "def root\n node = self\n node = node.parent while !node.parent.nil?\n node\n end", "def root_name\n return unless document.root\n\n document.root.name\n end", "def root\n return nodes.first if nodes.size == 1\n nodes.find { |node| root?(node) }\n end", "def document_root\n return @document_root\n end", "def root\n @parent.root\n end", "def root\n unless @root\n @root = Entry.new\n self.class.parse @root, @raw\n @raw = nil\n end\n\n @root\n end", "def node()\n self.root.node()\n end", "def xml_root(string) # :doc:\n xml = XML::Document.new\n xml.root = XML::Node.new(string)\n xml\n end", "def root\n self\n end", "def root\n self\n end", "def root\n root? ? self : parent.root\n end", "def rootNamespace\n @namespace ? @namespace.rootNamespace : self\n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def root\n root = self\n until (parent = root.parent).nil?\n root = parent\n end\n root\n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def root\n if self.root?\n self\n else\n self.parent.root\n end\n end", "def root\n self_and_ancestors.first\n end", "def root\n @root.to_s\n end", "def root\n case @release\n when 'R2.0.9', nil\n @schema.xpath(\"./xs:element[@name='#{@basename}']\")[0]\n when 'R2.0.8'\n @schema.xpath('./xs:element[last()]')[0]\n else\n raise \"unexpected release: #{@release}\"\n end\n end", "def node(xml)\n xml = xml.strip.gsub(/\\n|\\s{2,}/, '')\n Nokogiri::XML(xml).root\n end", "def root\n\t\t\t\tfind_root[0].to_s\n\t\t\tend", "def root \n parent.nil? ? self : parent.root\n end", "def root\n cursor = self\n cursor = cursor.up until cursor.root?\n cursor\n end", "def get_root()\n \n end", "def root\n parent ? parent.root : self\n end", "def root\n parent ? parent.root : self\n end", "def root\n return self if root?\n (root_relation_enabled? && root_ancestor) || ancestors.first\n end", "def root\n return @root if defined?(@root)\n\n @root = nil\n\n @root = issue.root if issue\n end", "def root\n return @notes.find { |note| note.part == :root } || self.low_note\n end", "def root_node_id\n 1\n end", "def global; return root end", "def root\n ancestors.first || self\n end", "def doc\n @doc ||= xml_doc @xml\n end", "def root\n return self if is_root?\n ancestors.select { |category| category.is_root? }.first\n end", "def get_xml_doc()\n doc = REXML::Document.new \"<top description='My Description' name='My Data Set'></top>\"\n root_node = @all_depths[0].first[1]\n doc.elements[\"top\"].add_element root_node.xml\n\n # see method below\n xml_recurse_helper(root_node)\n\n return doc\n end", "def set_root_node\n self.x_node = \"root\"\n get_node_info(x_node)\n end", "def document\n @doc ||= Nokogiri::XML(@xml)\n end", "def find_root_document\n cursor = self\n while cursor.parent_document\n cursor = cursor.parent_document\n end\n cursor\n end", "def root\n n = self\n while n.parent \n n = n.parent\n end\n n\n end", "def root\n @group.root\n end", "def document_root\n @hash[\"DocumentRoot\"]\n end", "def zk_root\n @@mutex.synchronize { @@zk_root ||= DEFAULT_ROOT }\n end", "def root\n first :parent_id => nil\n end", "def root\n if self.dotted_ids\n self.class.find(self.dotted_ids.split('.').first)\n else\n node = self\n node = node.parent while node.parent\n node\n end\n end", "def getRoot(filename, debug=false)\r\n\troot = Nokogiri::XML(open(filename))\r\n\troot.encoding = 'UTF-8'\r\n\t#printl \"it's open\",debug\r\n\treturn root\r\nend", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def new_empty_doc\n Atom::XML::Document.new\n end", "def head\n return @root\n end", "def root \n context.metadata.root\n end", "def root\n return @root if @root\n return self if parent.nil?\n @root = parent.root\n end", "def root\n @__cache__[:root] ||= @superstate ? @superstate.root : self\n end", "def getContentAsREXMLRoot() \n return REXML::Document.new(@obj.getContent().toString(), { :compress_whitespace => :all}).root\n end", "def root\r\n\t\t\t\tself.find(:first, :conditions => 'parent_id IS NULL')\r\n\t\t\tend", "def root\n @root_address ? @cache.get(@root_address) : nil\n end", "def root\n object = self\n while (object.parent) do object = object.parent; end\n object || self\n end", "def root\n instance.options[:root]\n end", "def root\n instance.options[:root]\n end", "def start_document\n @doc = Nokogiri::XML::Document.new\n end" ]
[ "0.86464584", "0.80143654", "0.7838439", "0.78090966", "0.78021294", "0.77411765", "0.75728893", "0.7465455", "0.7465455", "0.7384013", "0.7384013", "0.7369182", "0.7290095", "0.7176249", "0.71647877", "0.7164394", "0.7126299", "0.7118492", "0.7091329", "0.700699", "0.6981143", "0.6980837", "0.6887528", "0.6875845", "0.6867676", "0.68635535", "0.68635535", "0.6840794", "0.6787829", "0.67578655", "0.6752337", "0.6725977", "0.66825616", "0.66742086", "0.666284", "0.66363996", "0.6603137", "0.6603137", "0.6592867", "0.6592495", "0.6585729", "0.65802425", "0.6555107", "0.65294343", "0.65089285", "0.6493717", "0.6482886", "0.64773506", "0.6472482", "0.6463265", "0.6461147", "0.644729", "0.6432152", "0.6432152", "0.6392165", "0.63731396", "0.6354463", "0.6345684", "0.63397855", "0.63098997", "0.63055116", "0.6289357", "0.62879056", "0.6278296", "0.6262434", "0.6258542", "0.62226564", "0.62169474", "0.61840594", "0.61563927", "0.6151708", "0.614202", "0.6133418", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.6133129", "0.61223567", "0.61115444", "0.61092234", "0.6082344", "0.6081868", "0.60735273", "0.60682243", "0.6039994", "0.603903", "0.60346824", "0.60346824", "0.6016043" ]
0.80426675
1
Returns the line of the given node
def line(node = @current_node) return is_valid(node) ? node.line : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line\n @line ||= Line.get(@attrs['LineCode'])\n end", "def line\n return 1 unless lexing_context && locator\n locator.line_for_offset(lexing_context[:end_offset])\n end", "def line\n @line ||= Line.get(@attrs['Line'])\n end", "def node_at(line, column); end", "def node_at(line, column)\n tree_at(line, column).first\n end", "def line\n lines.first\n end", "def get_line\n @lines.shift\n end", "def line\n location&.line\n end", "def line_one\n return @line_one\n end", "def line(line_no)\n @line[line_no]\n end", "def line(line_no)\n @line[line_no]\n end", "def line(line_no)\n @line[line_no]\n end", "def line(line_no)\n @line[line_no]\n end", "def line(line_no)\n @line[line_no]\n end", "def line(line_no)\n @line[line_no]\n end", "def line(line_no)\n @line[line_no]\n end", "def line(line_no)\n @line[line_no]\n end", "def line\n buffer[line_number]\n end", "def line(pos=pos())\n lines[line_index(pos)]\n end", "def line(n)\n @lines[n]\n end", "def line_one\n @line_one\n end", "def line\n location.nil? ? nil : location.line\n end", "def line\n lines.line(y)\n end", "def get_line(code)\n return code[2][0]\n end", "def line(pos=pos)\n lines[line_index(pos)]\n end", "def with_lineno?(node); end", "def getLine\r\n\t\treturn @Line\r\n\tend", "def line_code\n @attrs['Line']\n end", "def get_line\n raise NotImplementedError\n end", "def line\n\t\t\tself.src.line\n\t\tend", "def line_for_offset(offset)\n @locator.line_for_offset(offset) + @leading_line_count\n end", "def line\n @line = line_cell.split(' ').last.to_f\n if opponent_cell['@']\n @line *= -1\n end\n @line\n end", "def line_id\n @line_number - 1\n end", "def lineno\n @__line\n end", "def line\n\t\treturn @file_data[@current_line]\n\tend", "def line_for_position(position); end", "def line_for_position(position); end", "def line_for_position(position); end", "def current_line\n @lines[@current_index]\n end", "def from_line\n position.new_line\n end", "def line_for_offset(token, offset = nil)\n locator_method_with_offset(token, :line_for_offset, offset || token.offset)\n end", "def line\n return 0 unless self.method\n # We subtract 1 because the ip is actually set to what it should do\n # next, not what it's currently doing (unless we are at the start of\n # a new context).\n if self.from_eval? and self.env.caller_env\n ip = self.env.caller_env.registration_ip - 1\n else\n ip = self.ip - 1\n ip = 0 if ip < 0\n end\n self.method.line_from_ip(ip)\n end", "def string\n @line\n end", "def line\n return 0 unless @method\n\n ip = @ip\n ip -= 1 unless ip_on_current?\n\n return @method.first_line unless ip > 0\n\n @method.line_from_ip(ip)\n end", "def line\n location.line\n end", "def line\n @cm.line_from_ip(ip)\n end", "def line\n @session.request(:vim_get_current_line)\n end", "def line_number\n @value.line_number if @value.respond_to?(:line_number)\n end", "def element_line(element); end", "def line\n 1\n end", "def source_line\n @source_location[1]\n end", "def find_end_line(node)\n if node.if_type? && node.else?\n node.loc.else.line\n elsif node.if_type? && node.ternary?\n node.else_branch.loc.line\n elsif node.if_type? && node.elsif?\n node.each_ancestor(:if).find(&:if?).loc.end.line\n elsif node.block_type? || node.numblock_type?\n node.loc.end.line\n elsif (next_sibling = node.right_sibling) && next_sibling.is_a?(AST::Node)\n next_sibling.loc.line\n elsif (parent = node.parent)\n parent.loc.respond_to?(:end) && parent.loc.end ? parent.loc.end.line : parent.loc.line\n else\n node.loc.end.line\n end\n end", "def getLine(theLines, theIndex)\n\n\treturn theLines.fetch(theIndex, EMPTY_LINE);\n\nend", "def line_before\n line[0..column - 1].to_s\n end", "def line(num) lines(num, 1) end", "def start_line\n attributes.fetch(:startLine)\n end", "def current_line\n # get the actual offset\n start = @buffer.get_iter_at_offset(@@offset)\n\n # get the command\n line = @buffer.get_text(start, @buffer.end_iter)\n\n return line\n end", "def line\n end", "def line\n end", "def line(number); end", "def original_text\n @line\n end", "def tree_at(line, column); end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line(number)\n lines[number - 1]\n end", "def line(number)\n end", "def from_line_index\n from_line - 1\n end", "def get_line(exception)\n # SyntaxErrors have weird line reporting\n # when there's trailing whitespace,\n # which there is for BabyBro documents.\n return (exception.message.scan(/:(\\d+)/).first || [\"??\"]).first if exception.is_a?(::SyntaxError)\n (exception.backtrace[0].scan(/:(\\d+)/).first || [\"??\"]).first\n end", "def line_for_offset(offset)\n end", "def line_number\n\t\t\t@line_index + 1\n\t\tend", "def lineno()\n #This is a stub, used for indexing\n end", "def find_line(&_block)\n raise ArgumentError, 'No block given' unless block_given?\n\n each_line do |line|\n return line if yield line\n end\n end", "def lineno\n @lineno || uninitialized!\n end", "def line_index()\n end", "def line\n\t\t\t@line.set(buffer.line.start, buffer.line.end)\n\t\tend", "def node\n return @node\n end", "def offset_on_line(offset)\n @locator.offset_on_line + @leading_line_offset\n end", "def line\n @files.first ? @files.first[1] : nil\n end", "def line\n @files.first ? @files.first[1] : nil\n end", "def line_after\n line[column..-1].to_s\n end", "def linode?(node = __getnode)\n node.key?(\"linode\")\n end", "def line_for_offset(obj, offset)\n # TODO: Should really use the SourceAdpater\n # https://github.com/puppetlabs/puppet-strings/blob/ede2b0e76c278c98d57aa80a550971e934ba93ef/lib/puppet-strings/yard/parsers/puppet/statement.rb#L22-L25\n\n # Puppet 5 exposes the source locator on the Pops object\n return obj.locator.line_for_offset(offset) if obj.respond_to?(:locator)\n\n # Revert to Puppet 4.x location information. A little more expensive to call\n obj_loc = Puppet::Pops::Utils.find_closest_positioned(obj)\n obj_loc.locator.line_for_offset(offset)\n end", "def line_offset\n\t\t\t@offset - @line_range.min\n\t\tend", "def pos_on_line(offset)\n end", "def line(pos = T.unsafe(nil)); end", "def target_line_number\n model.source_location(target_symbol)[:line_number]\n end", "def row\n return nil unless @row\n if @row < 0\n return FFI::NCurses.LINES + @row\n end\n @row\n end" ]
[ "0.71782935", "0.7125175", "0.70600444", "0.6977402", "0.69341874", "0.678375", "0.67634153", "0.6708213", "0.670025", "0.6694176", "0.6694176", "0.6694176", "0.66926646", "0.66926646", "0.66926646", "0.66926646", "0.66926646", "0.66711825", "0.6632219", "0.6618952", "0.6593647", "0.6568954", "0.6563449", "0.6542772", "0.6537521", "0.6533215", "0.6528126", "0.65155894", "0.64987075", "0.64261895", "0.6406541", "0.6394234", "0.6384327", "0.63717765", "0.6321434", "0.6301729", "0.6301729", "0.6301729", "0.62926906", "0.6283767", "0.6282425", "0.6264521", "0.6259152", "0.6252333", "0.6219841", "0.6184319", "0.6160158", "0.6150536", "0.61473525", "0.61433053", "0.61362207", "0.6113567", "0.6044275", "0.6040359", "0.6039495", "0.60209644", "0.6020626", "0.5998132", "0.5998132", "0.5993212", "0.5989883", "0.5965768", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.5933534", "0.59212816", "0.5917988", "0.5914242", "0.5906431", "0.5846562", "0.58415556", "0.58363503", "0.5824547", "0.58015174", "0.5795996", "0.5756336", "0.5729029", "0.5720578", "0.5712904", "0.5712904", "0.5704016", "0.57013464", "0.5697545", "0.5692395", "0.5687145", "0.5681605", "0.5670897", "0.5669054" ]
0.87152517
0
Returns an array of children of the current node
def children return children_of @current_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children\n node.children\n end", "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def get_children\n return children\n end", "def get_children\n return @children\n end", "def children\n self.node.children.collect(&:content)\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n Array.new\n end", "def node_children(node)\n children = @navigator.call(node)\n return Array::EMPTY_ARRAY if children.nil?\n Enumerable === children ? children.to_a.compact : [children]\n end", "def children\n _children\n end", "def children\n []\n end", "def get_children()\n return @space.get_children()\n end", "def children\n @children ||= []\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def children_get()\n @children\n end", "def get_children\n @children\n end", "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 _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def get_children\n \t@children\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def children\n []\n end", "def children\n @children\n end", "def children\n @children\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def children\n @ref.children.to_ruby\n end", "def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end", "def current_children\n children.map {|c| c.current }\n end", "def children()\r\n raise \"get_children is not implemented for class #{self.class}\"\r\n end", "def children\n self.class.children(self) \n end", "def children\n @root.children & @initial_contents\n end", "def children\n if no_child?\n []\n else\n [ body ]\n end\n end", "def children\n entries\n end", "def children\n children_nodes = Array.new\n i = 0\n while i < self.board.rows.length\n j = 0\n while j < self.board.rows.length\n if self.board.empty?([i,j])\n duped_board = self.board.dup\n duped_board.[]=([i,j],self.next_mover_mark) \n duped_node = self.class.new(duped_board,self.alternate_mark,[i,j])\n children_nodes << duped_node\n end\n j += 1\n end\n i += 1\n end\n return children_nodes\n end", "def children\n attributes.fetch(:children)\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def children\n NodeSetProxy.new(@node.children, self)\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 NodeSetProxy.new(@node.children, self)\n end", "def tree_children\n\n tree[2]\n end", "def children\n rows\n end", "def children_of(node)\n\t\treturn is_valid(node) ? node.children : nil\n\tend", "def get_node_children(parent,parent_id)\n @kids = []\n children = parent.get_elements(\"children\")\n children.each do |child|\n ps = construct_node(child,parent_id)\n if ps != nil\n @kids << ps\n end\n end\n if !@kids.empty?\n @kids = @kids.sort_by { |k| k.name.downcase }\n end\n @kids\n end", "def children\n children = []\n children << up_child unless up_child.nil?\n children << down_child unless down_child.nil?\n children << left_child unless left_child.nil?\n children << right_child unless right_child.nil?\n children\n end", "def children\n ary = normal_children.dup\n ary << fallback_child if fallback_child\n ary\n end", "def children\n res = []\n @board.rows.each_with_index do |row, x|\n row.each_with_index { |item, y| res << [x,y] }\n end\n res\n end", "def all_children\n children(all: true)\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def children; []; end", "def children\n [@before, @mid, @after].compact\n end", "def children\n [@before, @mid, @after].compact\n end", "def getChildren\n begin\n elementObject = waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT)\n children = Squish::Object.children(elementObject)\n return children\n rescue Exception => e\n\t Log.TestFail(\"#{self.class.name}::#{__method__}(): Failed to get children for #{@name}: #{e.message}\")\n return nil\n end\n end", "def grand_children\n []\n end", "def values\n @children\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def all_children\n reload\n nodes = []\n queue = children.to_a\n until queue.empty?\n node = queue.pop\n nodes.push(node)\n queue += node.children.to_a\n queue.flatten!\n end\n nodes\n end", "def children\n raise NotImplementedError\n end", "def children\n tree_search_class.where(tree_parent_id_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def children() []; end", "def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end", "def children\n\n children_array = []\n @board.rows.each_index do |row_idx|\n @board.rows[row_idx].each_index do |col_idx|\n if @board[[row_idx, col_idx]].nil?\n dup_board = @board.dup\n dup_board[[row_idx, col_idx]] = @next_mover_mark\n next_next_mark = switch_mark\n children_array << TicTacToeNode.new(dup_board, next_next_mark, [row_idx, col_idx])\n end\n end\n end\n children_array\n end", "def children\n @resource.children\n end", "def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\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 children\n list = Array.new\n (0..2).each do |x|\n (0..2).each do |y|\n pos = [x,y]\n list << create_node(pos) if @board.empty?(pos)\n end\n end\n return list\n end", "def children\n rows + tags\n end", "def current_children\n\t p @children\n\tend", "def children\n children_arr = []\n @board.rows.each_index do |i|\n @board.rows.each_index do |j|\n if @board.empty?([i, j])\n children_arr << TicTacToeNode.new(@board.dup, @next_mover_mark, @board[i, j])\n end\n end\n end\n children_arr\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def children\n return @children if !@children.nil?\n @children = all_children.find_all{|collection| collection.url.count('/') == self.url.count('/') + 1}\n end", "def children\n children = []\n @board.rows.each_with_index do |row, r_idx|\n row.each_index do |c_idx|\n kid_board = @board.dup\n pos = [r_idx, c_idx]\n if kid_board.empty?(pos)\n kid_board[pos] = @next_mover_mark\n children << TicTacToeNode.new(kid_board, next_mark, pos)\n end\n end\n end\n children\n end", "def children\n children = []\n @board.rows.each_with_index do |row, row_idx|\n row.each_with_index do |col, col_idx|\n if @board.empty?([row_idx, col_idx])\n dup_board = @board.dup\n dup_board[[row_idx, col_idx]] = @next_mover_mark\n child_node = TicTacToeNode.new(dup_board, other_mark(@next_mover_mark), [row_idx, col_idx])\n children << child_node\n end\n end\n end\n children\n end", "def children\n nodes = []\n\n self.get_empty_posns.each do |posn| \n updated_board = @board.dup\n updated_board[posn] = @next_mover_mark\n next_mark = @next_mover_mark == :x ? :o : :x\n new_node = TicTacToeNode.new(updated_board, next_mark, posn) \n nodes << new_node\n end\n\n nodes\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def extract_children_from(obj)\n\t\tif obj.nil? then\n\t\t\treturn []\n\t\tend\n\t\t\n\t\toutput = []\n\t\tset = obj.children\n\t\tset.each do |node|\n\t\t\toutput << node\n\t\tend\n\t\t\n\t\treturn output\n\tend", "def all_children\n find_all_children_with_dotted_ids\n end", "def children\n array = []\n @board.rows.each do |row|\n @board.row.each do |el|\n if el.empty?\n new_board = @board.dup\n new_board[row][el] = @next_mover_mark\n prev_move = [row, el]\n new_node = TicTacToeNode.new(new_board, alternate_mover_mark, prev_move)\n array << new_node\n end\n end\n end\n array\n end", "def children\n out = [] \n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n out << next_move_node(pos) if @board.empty?(pos)\n end\n end\n out\n end", "def children\n out_edges.each{|e| e.dest}\n end", "def children\n children = []\n board.rows.each_index do |row|\n board.rows[row].each_index do |col|\n pos = [row, col]\n if board[pos].nil?\n new_board = board.dup\n new_board[pos] = next_mover_mark\n children << self.class.new(new_board, switch_mark(next_mover_mark), pos)\n end\n end\n end\n children\n end" ]
[ "0.85183483", "0.8328256", "0.8261618", "0.8234224", "0.8159584", "0.8103686", "0.8103686", "0.8075742", "0.8075742", "0.8075742", "0.8053072", "0.7976374", "0.7973109", "0.7956186", "0.79393244", "0.79280365", "0.7924833", "0.7895326", "0.7877886", "0.7867015", "0.78425753", "0.7810291", "0.7810291", "0.7810291", "0.7810291", "0.7780862", "0.77648246", "0.7747639", "0.7747639", "0.77249265", "0.77028126", "0.77028126", "0.7648085", "0.76472324", "0.7624856", "0.7582069", "0.74709153", "0.7458522", "0.743111", "0.73889256", "0.73788863", "0.7364061", "0.7346455", "0.7339303", "0.73343813", "0.73272794", "0.7306876", "0.72892845", "0.7278901", "0.72623456", "0.72485614", "0.7235399", "0.72329956", "0.7215176", "0.7185341", "0.7180941", "0.7165257", "0.71596014", "0.7145243", "0.7145243", "0.71280825", "0.71210897", "0.7107209", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.7094703", "0.70939255", "0.7087077", "0.7082432", "0.70629454", "0.7060507", "0.70426273", "0.704053", "0.7028715", "0.7028598", "0.70247394", "0.7022656", "0.7017572", "0.7015129", "0.7007723", "0.6998088", "0.69918483", "0.69612193", "0.69404393", "0.6940351", "0.69240123", "0.6902348", "0.6900317", "0.6884272", "0.6882693", "0.6875115" ]
0.87402105
0
Returns an array of children of the given parent node
def children_of(node) return is_valid(node) ? node.children : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_children(parent,parent_id)\n @kids = []\n children = parent.get_elements(\"children\")\n children.each do |child|\n ps = construct_node(child,parent_id)\n if ps != nil\n @kids << ps\n end\n end\n if !@kids.empty?\n @kids = @kids.sort_by { |k| k.name.downcase }\n end\n @kids\n end", "def children\n node.children\n end", "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def children\n Array.new\n end", "def children\n\t\treturn children_of @current_node\n\tend", "def node_children(node)\n children = @navigator.call(node)\n return Array::EMPTY_ARRAY if children.nil?\n Enumerable === children ? children.to_a.compact : [children]\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def get_childs\n childs = Category.any_in(parent_ids: [parent.id])\n\n results = Array.new\n childs.each do |child|\n results << child\n end\n\n results\n end", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "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 get_children\n return children\n end", "def children\n []\n end", "def children\n tree_search_class.where(tree_parent_id_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def children\n []\n end", "def children\n self.node.children.collect(&:content)\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def children\n @children ||= []\n end", "def get_children\n return @children\n end", "def children\n self.class.where('? = ANY(parent_ids)', id.to_s)\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def children\n _children\n end", "def children(entity)\n self.all(:parent_id => entity.id)\n end", "def children\n ary = normal_children.dup\n ary << fallback_child if fallback_child\n ary\n end", "def children\n @ref.children.to_ruby\n end", "def children\n rows\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_get()\n @children\n end", "def children(*args)\n self.class.send(:with_scope, :find=>{:conditions=>['parent_node_id=?', self.child_node_id]}) do\n self.class.find(:all, *args)\n end\n end", "def children\n children = []\n children << up_child unless up_child.nil?\n children << down_child unless down_child.nil?\n children << left_child unless left_child.nil?\n children << right_child unless right_child.nil?\n children\n end", "def get_children(parent_uri,array)\n\tchildren = AAT.find({\n\t\t\"s\" => parent_uri,\n\t\t\"p\" => GETTY_NARROWER\n\t\t})\n\n\t# Return nil if no children\n\tif children.count == 0\n\t\treturn array\n\telse\n\t\tchildren.each do |child|\n\t\t\tchild_uri = child[\"o\"]\n\t\t\tarray << get_hash(child_uri)\n\t\tend\n\t\treturn array\n\tend\nend", "def siblings\n return [] unless parent\n parent.children.reject { |p| p == self }\n end", "def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end", "def children\n @children\n end", "def children\n @children\n end", "def siblings\n parent&.children || []\n end", "def children\n entries\n end", "def get_children\n @children\n end", "def children\n res = []\n @board.rows.each_with_index do |row, x|\n row.each_with_index { |item, y| res << [x,y] }\n end\n res\n end", "def _children\n @children\n end", "def grand_children\n []\n end", "def _children\n @children\n end", "def pull_out(parent_hash)\n return parent_hash[\"data\"][\"children\"]\n rescue\n return []\n end", "def children; []; end", "def children\n dataset.nested.filter(self.class.qualified_parent_column => self.id)\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def children\n self.class.find(:all, \n :select => \"a.*\",\n :joins => \"a join #{self.class.bridge_class.table_name} b on a.id = b.#{self.class.parent_foreign_key}\", \n :conditions => [\"b.#{self.class.child_foreign_key} = ? and b.#{self.class.levels_from_parent} = 1\", self.id])\n end", "def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\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 _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def get_children\n \t@children\n end", "def children\n children_nodes = Array.new\n i = 0\n while i < self.board.rows.length\n j = 0\n while j < self.board.rows.length\n if self.board.empty?([i,j])\n duped_board = self.board.dup\n duped_board.[]=([i,j],self.next_mover_mark) \n duped_node = self.class.new(duped_board,self.alternate_mark,[i,j])\n children_nodes << duped_node\n end\n j += 1\n end\n i += 1\n end\n return children_nodes\n end", "def children_of(post)\n posts.find_all { |t| t.parent_post == post.id }\n end", "def children\n self.class.children(self) \n end", "def children\n if self.rep_parent.nil?\n return super\n else\n the_children = Array.new\n self.rep_parent.children.each do |child|\n if child.is_a?(Repeatable)\n \n child.repititions.\n where(:show_date => self.show_date).each do |r|\n the_children << r\n end\n elsif child.show_date == self.show_date\n the_children << child\n end\n end\n return the_children\n end\n end", "def children\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} = #{self.id}\", :order => acts_as_nested_set_options[:left_column])\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end", "def children\n if no_child?\n []\n else\n [ body ]\n end\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def children\n out_edges.each{|e| e.dest}\n end", "def parent_adopts_children\n if parent(true)\n self.class.transaction do\n children(true).each{|child| parent.children << child}\n end\n else\n orphan_children\n end\n end", "def children\n array = []\n @board.rows.each do |row|\n @board.row.each do |el|\n if el.empty?\n new_board = @board.dup\n new_board[row][el] = @next_mover_mark\n prev_move = [row, el]\n new_node = TicTacToeNode.new(new_board, alternate_mover_mark, prev_move)\n array << new_node\n end\n end\n end\n array\n end", "def visit_children(parent)\n parent.children.each do |child|\n child.node_parent = parent\n visit(child)\n end\n end", "def visit_children(parent)\n parent.children.each do |child|\n child.node_parent = parent\n visit(child)\n end\n end", "def get_children()\n return @space.get_children()\n end", "def children\n list = Array.new\n (0..2).each do |x|\n (0..2).each do |y|\n pos = [x,y]\n list << create_node(pos) if @board.empty?(pos)\n end\n end\n return list\n end", "def children\n rows + tags\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def children\n child_array = []\n board.rows.each_index do |row|\n board.rows[row].each_index do |col|\n pos = [row, col]\n if board[pos].nil?\n new_board = board.dup\n new_board[pos] = next_mover_mark\n child_array << self.class.new(new_board, switch_mark(next_mover_mark), pos)\n end\n end\n end\n child_array\n end", "def child_ids\n\n children.collect { |cfei| Ruote.extract_child_id(cfei) }\n end", "def children() []; end", "def children\n\n children_array = []\n @board.rows.each_index do |row_idx|\n @board.rows[row_idx].each_index do |col_idx|\n if @board[[row_idx, col_idx]].nil?\n dup_board = @board.dup\n dup_board[[row_idx, col_idx]] = @next_mover_mark\n next_next_mark = switch_mark\n children_array << TicTacToeNode.new(dup_board, next_next_mark, [row_idx, col_idx])\n end\n end\n end\n children_array\n end", "def children\n Feature.find(:all, :conditions => [ 'parent_id=?', self.id] )\n end", "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end", "def children\n children_arr = []\n @board.rows.each_index do |i|\n @board.rows.each_index do |j|\n if @board.empty?([i, j])\n children_arr << TicTacToeNode.new(@board.dup, @next_mover_mark, @board[i, j])\n end\n end\n end\n children_arr\n end", "def children\n raise NotImplementedError\n end", "def children()\r\n raise \"get_children is not implemented for class #{self.class}\"\r\n end", "def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end" ]
[ "0.7896279", "0.7297625", "0.72965854", "0.7293801", "0.7281092", "0.72345966", "0.71894103", "0.71894103", "0.71894103", "0.71709126", "0.71709126", "0.7163972", "0.7153677", "0.7138193", "0.70532924", "0.70358676", "0.7027525", "0.7010547", "0.693609", "0.69115555", "0.6890005", "0.688288", "0.6879724", "0.68605036", "0.6821284", "0.6796788", "0.6796788", "0.67402655", "0.66866153", "0.6659447", "0.66571724", "0.66560143", "0.6653193", "0.66381663", "0.66359377", "0.6634105", "0.6633485", "0.66099894", "0.66006273", "0.658881", "0.658881", "0.65841675", "0.65561086", "0.6556011", "0.65393466", "0.6536352", "0.6522912", "0.65180856", "0.6515765", "0.65102375", "0.65058637", "0.65003365", "0.64942753", "0.6473302", "0.6469455", "0.6467881", "0.6467881", "0.6467881", "0.6467881", "0.644316", "0.6442372", "0.64304054", "0.6413227", "0.64014065", "0.63964295", "0.6390668", "0.63862526", "0.63816667", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.63258076", "0.6320711", "0.6320151", "0.6309086", "0.63045156", "0.6302222", "0.6302222", "0.62960744", "0.62938356", "0.62833464", "0.6278552", "0.6278351", "0.6272764", "0.6271456", "0.6255618", "0.6247211", "0.6236629", "0.62338567", "0.6229362", "0.62292856", "0.62247145" ]
0.64241475
62
Extract children from an object into an array. Intended for use with Node and NodeSet objects
def extract_children_from(obj) if obj.nil? then return [] end output = [] set = obj.children set.each do |node| output << node end return output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end", "def children\n Array.new\n end", "def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend", "def children\n @ref.children.to_ruby\n end", "def get_children\n return @children\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def children\n @children ||= []\n end", "def children\n ary = normal_children.dup\n ary << fallback_child if fallback_child\n ary\n end", "def get_children\n return children\n end", "def getObjectChildren _obj, _args\n \"_obj getObjectChildren _args;\" \n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def node_children(node)\n children = @navigator.call(node)\n return Array::EMPTY_ARRAY if children.nil?\n Enumerable === children ? children.to_a.compact : [children]\n end", "def get_children(h, n)\n rr = h[n[:id]]\n if !rr.nil?\n rr[:children]\n else\n []\n end\n end", "def get_children(h, n)\n rr = h[n[:id]]\n if !rr.nil?\n rr[:children]\n else\n []\n end\n end", "def _children\n @children\n end", "def children\n []\n end", "def children\n []\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def getChildren\n begin\n elementObject = waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT)\n children = Squish::Object.children(elementObject)\n return children\n rescue Exception => e\n\t Log.TestFail(\"#{self.class.name}::#{__method__}(): Failed to get children for #{@name}: #{e.message}\")\n return nil\n end\n end", "def convert_children\n children.map {|ch| convert ch }.compact\n end", "def _children\n @children\n end", "def get_kids(obj)\n # if it's a hash, then there are more layers\n if(obj.class.to_s == \"Hash\")\n # drill down and keep getting kids\n obj.keys.map{|name| {:name=>name, :children=> get_kids(obj[name])}}\n else\n # Otherwise, we're at the edge. Just build an array of \"name\" hashes.\n obj.map{|name| {:name=>name}}\n end\nend", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def children\n _children\n end", "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 children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end", "def children_get()\n @children\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def children\n attributes.fetch(:children)\n end", "def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end", "def pull_out(parent_hash)\n return parent_hash[\"data\"][\"children\"]\n rescue\n return []\n end", "def children\n node.children\n end", "def children\n []\n end", "def extract_children(tag, children)\n children.map do |child|\n if child[\"children\"]\n extract_children(\"#{tag},#{child['name']}\", child[\"children\"])\n else\n [child[\"url\"], child[\"name\"], \"\", tag]\n end\n end\n end", "def children; []; end", "def get_children\n @children\n end", "def children() []; end", "def values\n @children\n end", "def get_children(args = '', output = :OBJECT)\n kids = {}\n if args.blank?\n if $GLOBALS['post']\n args = { post_parent: $GLOBALS['post'].post_parent }\n else\n return kids\n end\n elsif args.is_a? Integer\n args = { post_parent: args}\n elsif args.is_a? String\n args = { post_parent: args.to_i}\n elsif args.is_a? Railspress::WpPost\n args = { post_parent: args.post_parent }\n end\n\n defaults = {\n numberposts: -1,\n post_type: 'any',\n post_status: 'any',\n post_parent: 0,\n }\n\n r = defaults.merge args\n\n children = get_posts(r)\n\n return kids if children.nil?\n\n return children unless r[:fields].blank?\n\n # update_post_cache(children)\n\n children.each do |child|\n kids[child.id] = child\n end\n\n if output == :OBJECT\n kids\n elsif output == :ARRAY_A\n weeuns = {}\n kids.values.each do |kid|\n weeuns[kid.id] = kid.attributes\n end\n return weeuns\n elsif output == :ARRAY_N\n babes = {}\n kids.values.each do |kid|\n babes[kid.id] = kid.attributes.values\n end\n return babes\n else\n kids\n end\n end", "def children\n entries\n end", "def children\n self.node.children.collect(&:content)\n end", "def all_children_deep(flag=nil)\n\t\tarr = []\n\t\tall_children(flag).each do |c|\n\t\t\tarr << c\n\t\t\tc.all_children_deep(flag).each do |cc|\n\t\t\t\tarr << cc\n\t\t\tend\n\t\tend\t\t\t\n\t\tarr\n\tend", "def children\n []\n end", "def all_children\n reload\n nodes = []\n queue = children.to_a\n until queue.empty?\n node = queue.pop\n nodes.push(node)\n queue += node.children.to_a\n queue.flatten!\n end\n nodes\n end", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def get_children\n \t@children\n end", "def children\n @children\n end", "def children\n @children\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def objects_hierarchy_at(path:)\n return [] if path.nil?\n\n nodes = @roots\n\n path.inject([]) { |hierarchy, index|\n node = nodes[index]\n\n hierarchy << node.value\n\n nodes = node.children\n\n hierarchy\n }\n end", "def children\n instance_variables.each do |var|\n child = instance_variable_get var\n if child.kind_of? Node\n yield child\n elsif child.kind_of? Array\n child.each { |x| yield x if x.kind_of? Node }\n end\n end\n end", "def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end", "def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end", "def children\n if no_child?\n []\n else\n [ body ]\n end\n end", "def to_a\n extracted_children = children.map { |c| c.respond_to?(:to_a) ? c.to_a : c }\n extracted_children.zip(Array.new(children.length, separator)).flatten[0..-2]\n end", "def get_childs(recursive, ret_obj)\n\n return self.class.get_childs(self.id, recursive, ret_obj)\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 descendants\n children + children.map(&:children).flatten\n end", "def object_tree\n head, *rest = array_tree\n object_subtree(head,rest)\n end", "def children\n @children ||= begin\n nodes =\n if comment?\n []\n elsif defined?(@value.class::ParseTreeVisitor)\n @value.class::ParseTreeVisitor.new(@value, {}).children\n elsif @value.respond_to?(:nodelist)\n Array(@value.nodelist)\n else\n []\n end\n # Work around a bug in Liquid::Variable::ParseTreeVisitor that doesn't return\n # the args in a hash as children nodes.\n nodes = nodes.flat_map do |node|\n case node\n when Hash\n node.values\n else\n node\n end\n end\n nodes.map { |node| Node.new(node, self, @template) }\n end\n end", "def get_node_children(parent,parent_id)\n @kids = []\n children = parent.get_elements(\"children\")\n children.each do |child|\n ps = construct_node(child,parent_id)\n if ps != nil\n @kids << ps\n end\n end\n if !@kids.empty?\n @kids = @kids.sort_by { |k| k.name.downcase }\n end\n @kids\n end", "def children\n child_array = []\n board.rows.each_index do |row|\n board.rows[row].each_index do |col|\n pos = [row, col]\n if board[pos].nil?\n new_board = board.dup\n new_board[pos] = next_mover_mark\n child_array << self.class.new(new_board, switch_mark(next_mover_mark), pos)\n end\n end\n end\n child_array\n end", "def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end", "def get_children()\n return @space.get_children()\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def children\n\t\treturn children_of @current_node\n\tend", "def get_children()\n {}\n end", "def children\n out_edges.each{|e| e.dest}\n end", "def children\n @root.children & @initial_contents\n end", "def children\n children_nodes = Array.new\n i = 0\n while i < self.board.rows.length\n j = 0\n while j < self.board.rows.length\n if self.board.empty?([i,j])\n duped_board = self.board.dup\n duped_board.[]=([i,j],self.next_mover_mark) \n duped_node = self.class.new(duped_board,self.alternate_mark,[i,j])\n children_nodes << duped_node\n end\n j += 1\n end\n i += 1\n end\n return children_nodes\n end", "def get_children_from(tree_hash)\n child_nodes = []\n if tree_hash != nil then \n tree_hash.each do |k, v| \n if v != nil then child_nodes.push(Tree.new({k => v})) end \n end\n end\n return child_nodes\n end", "def children_of(obj, strict = true, relations = nil)\n\t set = compute_children_of([obj].to_value_set, relations || self.relations)\n\t set.delete(obj) if strict\n\t set\n\tend", "def children(pat=nil, *rest, &blk)\n return descendants(*rest, &blk) if pat == :*\n res = []\n @contents.each{|c|\n if pat.nil? or pat === c\n if rest == []\n res << c\n yield c if block_given?\n else\n res += c.children(*rest, &blk)\n end\n end\n }\n res\n end", "def parse_children(children)\n case children\n when Array\n children\n when Proc, Method\n parse_children(children.call(self))\n when nil\n nil\n else\n [children]\n end\n end", "def children_of_the_array(array, source)\n retval = array.select{ |a| a if a[\"source\"] == source or a[\"source\"].include?(source)}.map{ |a| { \"name\" => a[\"name\"],\n \"type\" => a[\"type\"],\n \"id\" => a[\"id\"],\n \"children\" => [] } }\n retval.each do |children|\n children[\"children\"] = children_of_the_array(array, children[\"id\"])\n end\n return retval\n end", "def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end", "def to_a\n ret = [self]\n if self.kids\n self.kids.each do |kid|\n kid.to_a.each {|node|\n ret.push node\n }\n end\n end\n ret\n end", "def children\n children = []\n children << up_child unless up_child.nil?\n children << down_child unless down_child.nil?\n children << left_child unless left_child.nil?\n children << right_child unless right_child.nil?\n children\n end", "def children(path)\n entries = []\n @content_tree.with_subtree(path, nil, 2, true) do |node|\n next if node.path == path\n entries << node\n end\n entries\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def children_names; @children.keys; end", "def children\n self.class.children(self) \n end", "def children\n [@before, @mid, @after].compact\n end", "def children\n [@before, @mid, @after].compact\n end", "def children\n res = []\n @board.rows.each_with_index do |row, x|\n row.each_with_index { |item, y| res << [x,y] }\n end\n res\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end" ]
[ "0.7106915", "0.6998907", "0.6959831", "0.6923284", "0.69081885", "0.6811364", "0.6805195", "0.6761696", "0.67529523", "0.6745616", "0.6731596", "0.67303765", "0.67075676", "0.6700036", "0.6700036", "0.6700036", "0.669388", "0.66851604", "0.66851604", "0.6681883", "0.6660352", "0.6660352", "0.6657177", "0.6657177", "0.6633146", "0.662992", "0.6628857", "0.6623171", "0.66200674", "0.66200674", "0.66200674", "0.66200674", "0.66187775", "0.66057456", "0.6585736", "0.65818816", "0.65736336", "0.6565924", "0.65559405", "0.6555252", "0.6521794", "0.6520518", "0.65148187", "0.6486959", "0.64761955", "0.64663196", "0.6454672", "0.645131", "0.6446405", "0.6426562", "0.6425677", "0.6418945", "0.6412127", "0.6382779", "0.6335042", "0.6334495", "0.6334495", "0.63246775", "0.6316921", "0.62830615", "0.627826", "0.62508297", "0.62387025", "0.6224517", "0.6218574", "0.62131387", "0.62089175", "0.6203822", "0.617522", "0.6159289", "0.6147844", "0.613312", "0.61312944", "0.6125791", "0.6122563", "0.61217684", "0.61087316", "0.61080885", "0.6105551", "0.6103238", "0.6097536", "0.6092138", "0.6087882", "0.6084182", "0.6080174", "0.6078979", "0.60767806", "0.60689205", "0.606051", "0.6055067", "0.6043883", "0.6036856", "0.6036856", "0.60295165", "0.60254645", "0.60254645", "0.60254645", "0.60254645", "0.60254645", "0.60254645" ]
0.8473741
0
Returns the attribute keys of the current node
def attr_keys return attr_keys_in @current_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys\n attribute_nodes.map(&:node_name)\n end", "def attr_keys_in(node)\n\t\treturn is_valid(node) ? node.keys : nil\n\tend", "def keys\n @attributes.keys\n end", "def attribute_keys\n return [] unless self[:attributes]\n self[:attributes].keys\n end", "def keys\n attributes.keys\n end", "def keys\n Keys[to_attr_list]\n end", "def keys\n getAttributeNames.to_a\n end", "def keys\n getAttributeNames.to_a\n end", "def keys\n getAttributeNames.to_a\n end", "def attributes\n @attrs.keys\n end", "def attribute_keys\n self.class.attribute_keys\n end", "def keys(tf = true)\n attributes(tf).keys\n end", "def keys(model)\n model.attributes.keys\n end", "def attribute_names\n @attributes.keys\n end", "def attribute_names\n @attributes.keys\n end", "def attribute_names\n @attributes.keys\n end", "def attribute_names\n @attributes.keys\n end", "def attributes\n\t\treturn attributes_of @current_node\n\tend", "def attributes_of(node)\n\t\tmap = Hash.new\n\t\t\n\t\tif !is_valid node then\n\t\t\treturn map\n\t\tend\n\t\t\n\t\tvarKeys = attr_keys_in node\n\t\tif !varKeys.nil? then\n\t\t\tvarKeys.each do |key|\n\t\t\t\tmap[key] = node[key]\n\t\t\tend\n\t\tend\n\t\treturn map\n\tend", "def attribute_names\n @attributes.keys\n end", "def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end", "def attributes\n node[1]\n end", "def attribute_names\n @name_to_definition.keys\n end", "def keys\n @children.map(&:title)\n end", "def keys\n @key\n end", "def attributes\n @data.keys\n end", "def keys\n map(&:key)\n end", "def keys\n deprecate # 07/31/2012\n doc = xml get('/user/keys').to_s\n doc.elements.to_a('//keys/key').map do |key|\n key.elements['contents'].text\n end\n end", "def keys\n map { |line| line.key }\n end", "def attribute_names\n @attribute_names ||= attributes.keys\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) { |node, h|\n h[node] = enumerate_attrs_by_node(node)\n }\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) do |node, h|\n h[node] = enumerate_attrs_by_node(node)\n end\n end", "def list_attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes.keys\n end", "def attribute_names\n @attributes.keys.sort\n end", "def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend", "def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend", "def attribute_names\n @attributes.keys.sort\n end", "def keys\n\n self.to_h.keys\n end", "def keys\n list = []\n each_key{|key| list << key}\n list\n end", "def keys\n end", "def key_ids\n @keys.keys\n end", "def attribute_names\n names = []\n @attributes.each {|values| names << values.keys if values}\n names.flatten.uniq\n end", "def keys\n end", "def keys\n end", "def keys\n end", "def attribute_names\n @attributes.map(&:name)\n end", "def keys\n @data.keys\n end", "def keys\n @data.keys\n end", "def attributes\n self.attribute_keys.inject({}) do |hash, key|\n hash[key] = self.__send__(key) if self.__send__(key)\n hash\n end\n end", "def keys\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def get_nodes\n @weights.keys\n end", "def keys\n items.keys\n end", "def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end", "def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end", "def get_array_of_symbolic_keys\n # getting array of keys (in symbol form)\n all_fields = self.attributes.keys.map do |key|\n key.to_sym;\n end\n return all_fields\n end", "def attribute_names\n attributes.keys.sort\n end", "def attribute_names\n attributes.keys.sort\n end", "def keys\n @navigable_map.key_set.to_a\n end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n\t\t@matrix.keys\n\tend", "def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end", "def keys\n DoesKeyValue::State.instance.keys[self.to_s]\n end", "def list_keys\n @keys.keys\n end", "def key_attributes\n [\n first_and_middle_names,\n family_name,\n date_of_birth,\n place_of_birth,\n parent_first_and_middle_names,\n parent_family_name,\n other_parent_first_and_middle_names,\n other_parent_family_name\n ]\n end", "def keys\n return []\n end", "def attribute_names\n @attribute_names ||= attribute_definitions.keys.collect {|a|a.to_s}\n end", "def keys\n fields.map { |f| f.name }\n end", "def keys\n [ name ]\n end", "def members\n attributes.keys\n end", "def attribute_names\n @attribute_names ||= attribute_definitions.keys.map(&:to_s)\n end", "def keys\n @inputs.keys\n end", "def list_keys()\n # TODO\n end", "def attributes\n ATTRIBUTE_NAMES\n end", "def attribute_names\n relvar_def.attribute_names\n end", "def keys\n return [], []\n end", "def key_attrs\n @key_attrs ||= {}\n end", "def list_keys\n @keydict.keys\n end", "def keys\n struct.keys\n end", "def keys\n @data.keys.sort.collect { |k| k.to_sym }\n end", "def getAllTransNameKeys\n parents = self.getAllParents\n allRecs = parents.concat([self])\n treeKeys = (allRecs).map { |rec| rec.name_key if rec}\n end", "def key_attributes\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = attributes[a.name] }\n attrs\n end", "def attributes\n @content.keys\n end", "def get_keys()\n\t\t\treturn @config.keys\n\t\tend", "def keys(key)\n Array(@nesting) + Array(key)\n end", "def address_keys\n address_attr = params[:user][\"addresses_attributes\"].values\n address_attr[0].keys\n end", "def keys\n self.map('lambda{|(key, _)| key}')\n end", "def keys\n values.map(&:to_sym)\n end" ]
[ "0.90559864", "0.81568533", "0.80238926", "0.798886", "0.7812277", "0.77941734", "0.7712413", "0.7712413", "0.7712413", "0.7467831", "0.74057436", "0.73241997", "0.723899", "0.7219216", "0.7219216", "0.7219216", "0.7219216", "0.7200891", "0.7109218", "0.7092491", "0.70062256", "0.689717", "0.6880861", "0.6864664", "0.68625355", "0.6861345", "0.6813962", "0.6771937", "0.67666155", "0.6743306", "0.6738249", "0.67116654", "0.66680074", "0.6665157", "0.665999", "0.665999", "0.662517", "0.6619975", "0.6611807", "0.6611509", "0.6582526", "0.6581654", "0.6579051", "0.6579051", "0.6579051", "0.65732247", "0.65652966", "0.65652966", "0.65336347", "0.6531422", "0.65185493", "0.65185493", "0.65178406", "0.65138537", "0.649662", "0.649662", "0.6491546", "0.6488431", "0.6488431", "0.64798623", "0.64681333", "0.64681333", "0.64681333", "0.64681333", "0.64681333", "0.64681333", "0.64681333", "0.64681333", "0.64681333", "0.6462351", "0.6462351", "0.6462351", "0.6456195", "0.6452402", "0.64514", "0.6444352", "0.64167494", "0.639899", "0.6396251", "0.6396052", "0.6383187", "0.6366784", "0.63474447", "0.63468516", "0.6334444", "0.6332093", "0.63237184", "0.6305005", "0.62986875", "0.6297532", "0.6286051", "0.6284819", "0.62638605", "0.6253509", "0.62524575", "0.624727", "0.6243044", "0.6240398", "0.6236895", "0.6223542" ]
0.8992906
1
Returns the attribute keys of the given node
def attr_keys_in(node) return is_valid(node) ? node.keys : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys\n attribute_nodes.map(&:node_name)\n end", "def attr_keys\n\t\treturn attr_keys_in @current_node\n\tend", "def attributes_of(node)\n\t\tmap = Hash.new\n\t\t\n\t\tif !is_valid node then\n\t\t\treturn map\n\t\tend\n\t\t\n\t\tvarKeys = attr_keys_in node\n\t\tif !varKeys.nil? then\n\t\t\tvarKeys.each do |key|\n\t\t\t\tmap[key] = node[key]\n\t\t\tend\n\t\tend\n\t\treturn map\n\tend", "def keys\n getAttributeNames.to_a\n end", "def keys\n getAttributeNames.to_a\n end", "def keys\n getAttributeNames.to_a\n end", "def attribute_keys\n return [] unless self[:attributes]\n self[:attributes].keys\n end", "def keys\n @attributes.keys\n end", "def keys\n Keys[to_attr_list]\n end", "def keys\n attributes.keys\n end", "def keys(tf = true)\n attributes(tf).keys\n end", "def attribute_keys\n self.class.attribute_keys\n end", "def keys(model)\n model.attributes.keys\n end", "def keys\n map { |line| line.key }\n end", "def keys\n map(&:key)\n end", "def keys\n deprecate # 07/31/2012\n doc = xml get('/user/keys').to_s\n doc.elements.to_a('//keys/key').map do |key|\n key.elements['contents'].text\n end\n end", "def keys\n list = []\n each_key{|key| list << key}\n list\n end", "def attribute_names\n @attributes.keys\n end", "def attribute_names\n @attributes.keys\n end", "def attribute_names\n @attributes.keys\n end", "def attribute_names\n @attributes.keys\n end", "def attributes\n @attrs.keys\n end", "def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end", "def xml_node_to_hash(nokogiri_node)\n\t\t\tattributes = Hash.new\n\n\t\t\tnokogiri_node.each do |k,v|\n\t\t\t\tattributes[k.to_sym] = v.value\n\t\t\tend\n\n\t\t\treturn attributes\n\t\tend", "def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend", "def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend", "def attribute_names\n @attributes.keys\n end", "def get_array_of_symbolic_keys\n # getting array of keys (in symbol form)\n all_fields = self.attributes.keys.map do |key|\n key.to_sym;\n end\n return all_fields\n end", "def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end", "def attribute_names\n @name_to_definition.keys\n end", "def keys\n @children.map(&:title)\n end", "def key_ids\n @keys.keys\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) { |node, h|\n h[node] = enumerate_attrs_by_node(node)\n }\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) do |node, h|\n h[node] = enumerate_attrs_by_node(node)\n end\n end", "def hkeys(key)\n node_for(key).hkeys(key)\n end", "def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end", "def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end", "def attribute_names\n names = []\n @attributes.each {|values| names << values.keys if values}\n names.flatten.uniq\n end", "def keys\n @key\n end", "def get_nodes\n @weights.keys\n end", "def sorted_keys(nodes)\n keys = []\n nodes.each do |n|\n n.cells.each do |c|\n keys << c.key\n end\n end\n keys.uniq.sort { |a, b| a <=> b }\n end", "def address_keys\n address_attr = params[:user][\"addresses_attributes\"].values\n address_attr[0].keys\n end", "def keys\n @navigable_map.key_set.to_a\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n @data.keys.sort.collect { |k| k.to_sym }\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def list_keys()\n # TODO\n end", "def attributes_for_node(node_name)\n node(node_name).attributes\nend", "def attribute_names\n @attribute_names ||= attributes.keys\n end", "def list_keys\n @keys.keys\n end", "def keys\n fields.map { |f| f.name }\n end", "def attributes\n node[1]\n end", "def attribute_names\n @attributes.keys.sort\n end", "def keys(name)\n key_schema(name).each_with_object({}) do |s, h|\n h[s.key_type.downcase.to_sym] = s.attribute_name\n end\n end", "def keys(key)\n Array(@nesting) + Array(key)\n end", "def list_keys\n @keydict.keys\n end", "def attribute_names\n @attributes.keys.sort\n end", "def keys\n values.map(&:to_sym)\n end", "def keys\n\n self.to_h.keys\n end", "def keys\n self.map('lambda{|(key, _)| key}')\n end", "def attribute_names\n attributes.keys.sort\n end", "def attribute_names\n attributes.keys.sort\n end", "def keys\n return [], []\n end", "def keys\n end", "def keys\n end", "def keys\n end", "def keys\n\t\t@matrix.keys\n\tend", "def keys\n return []\n end", "def keys\n items.keys\n end", "def key_for(node)\n \"#{id}-#{node.id}\"\n end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys\n end", "def keys\n @data.keys\n end", "def keys\n @data.keys\n end", "def attribute_names\n @attributes.map(&:name)\n end", "def keys\n end", "def attributes\n @data.keys\n end", "def attribute_names\n @attribute_names ||= attribute_definitions.keys.collect {|a|a.to_s}\n end", "def keys(lft, rgt)\n lft, rgt = lft.keys, rgt.keys\n lft = lft.map { |key| (ix = rgt.index(key)) ? rgt[ix] : key }\n lft.concat(rgt).uniq\n end", "def list_attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes.keys\n end", "def keys\n @keys ||= [column_for_order_by(relation), primary_key].compact.uniq\n end", "def keys\n [ name ]\n end", "def keys\n @map.keys\n end", "def keys\n @map.keys\n end", "def keys\n entries.keys\n end", "def getKeys(data_keys)\r\n data_keys[0].keys\r\n end", "def keys\n map(&:key).uniq\n end", "def attributes\n self.attribute_keys.inject({}) do |hash, key|\n hash[key] = self.__send__(key) if self.__send__(key)\n hash\n end\n end", "def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end" ]
[ "0.8781843", "0.81699824", "0.77056885", "0.7474048", "0.7474048", "0.7474048", "0.74337006", "0.73340183", "0.7273205", "0.72146", "0.7184335", "0.6848043", "0.68173", "0.6806917", "0.6763627", "0.6697388", "0.664985", "0.664917", "0.664917", "0.664917", "0.664917", "0.66454977", "0.6612986", "0.6595096", "0.65690583", "0.65690583", "0.65580976", "0.64803964", "0.64778906", "0.64606905", "0.6439652", "0.64336437", "0.6372689", "0.63474894", "0.633084", "0.630262", "0.630262", "0.62976664", "0.6286986", "0.62844956", "0.62605846", "0.62557477", "0.6239264", "0.6229162", "0.6229162", "0.6210744", "0.62079364", "0.62079364", "0.62079364", "0.61929274", "0.61898243", "0.61872315", "0.61858183", "0.6175585", "0.61732733", "0.6171803", "0.6170323", "0.61699003", "0.6168745", "0.6167785", "0.61486036", "0.61335087", "0.6124743", "0.6110937", "0.6110937", "0.6098801", "0.60856205", "0.60856205", "0.60856205", "0.60831296", "0.6077478", "0.6070465", "0.6066266", "0.6063998", "0.6063998", "0.6063998", "0.6063998", "0.6063998", "0.6063998", "0.6063998", "0.6063998", "0.6063998", "0.605504", "0.60525", "0.60525", "0.603594", "0.60296804", "0.6015849", "0.6006031", "0.6003142", "0.5999527", "0.5996339", "0.5994615", "0.5994502", "0.5993158", "0.59880406", "0.59589815", "0.59587353", "0.5954076", "0.5942241" ]
0.8404115
1
Returns a hash of attributes for the current node
def attributes return attributes_of @current_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end", "def hash\n @attrs\n end", "def attributes\n node[1]\n end", "def hash\n node_id.hash\n end", "def attributes_of(node)\n\t\tmap = Hash.new\n\t\t\n\t\tif !is_valid node then\n\t\t\treturn map\n\t\tend\n\t\t\n\t\tvarKeys = attr_keys_in node\n\t\tif !varKeys.nil? then\n\t\t\tvarKeys.each do |key|\n\t\t\t\tmap[key] = node[key]\n\t\t\tend\n\t\tend\n\t\treturn map\n\tend", "def attributes_hash\n attributes_hash = section.attributes.to_hash\n attributes_hash.each { |k, attr| attributes_hash[k] = attr.value }\n end", "def attr_keys\n\t\treturn attr_keys_in @current_node\n\tend", "def attributes_hash\n self.info.to_hash.symbolize_keys\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def keys\n attribute_nodes.map(&:node_name)\n end", "def attributes_hash(object); end", "def attributes\n self._attributes.inject({}) do |hash, attr|\n hash[attr.to_s] = send(attr)\n hash\n end\n end", "def to_hash\n attributes\n end", "def to_hash\n @attributes\n end", "def to_hash\n @attributes\n end", "def attributes\n @attrs.keys\n end", "def attributes_for_node(node_name)\n node(node_name).attributes\nend", "def xml_node_to_hash(nokogiri_node)\n\t\t\tattributes = Hash.new\n\n\t\t\tnokogiri_node.each do |k,v|\n\t\t\t\tattributes[k.to_sym] = v.value\n\t\t\tend\n\n\t\t\treturn attributes\n\t\tend", "def node_hash(node_id)\n \n end", "def attributes\n Hash[instance_variables.map{|attrib| [attrib.to_s[1..attrib.to_s.size], nil]}]\n end", "def to_hash\n @attributes\n end", "def attributes\n full_attributes.to_hash(self)\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) { |node, h|\n h[node] = enumerate_attrs_by_node(node)\n }\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) do |node, h|\n h[node] = enumerate_attrs_by_node(node)\n end\n end", "def attributes\n self.attribute_keys.inject({}) do |hash, key|\n hash[key] = self.__send__(key) if self.__send__(key)\n hash\n end\n end", "def attributes_get\n h = {}\n self.class.attributes.each do |a|\n h[a] = attribute_get(a)\n end\n h\n end", "def attributes_get\n h = {}\n self.class.attributes.each do |a|\n h[a] = attribute_get(a)\n end\n h\n end", "def chef_node_attribute_data\n node_data = node.to_h\n node_data['chef_environment'] = node.chef_environment\n\n node_data\n end", "def root_hash\n self.node_hash root_node_id\n end", "def attributes\n (@original_attributes||{}).merge(@attributes).keys.inject({}) do |hash, key|\n hash[key] = read_attribute(key)\n hash\n end\n end", "def attributes\n unless @attributes\n @attributes = node.attributes.collect do |att|\n visitor(AttributeVisitor) { |v| v.visit(att) }\n end\n end\n @attributes\n end", "def attributes\n return {\n :level => level,\n :message => message,\n :line => line,\n :column => column,\n :file => file,\n :filename => filename,\n :node => node\n }\n end", "def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end", "def attributes\n @attributes ||= {}\n @attributes\n end", "def get_node_attributes_stub\n []\n end", "def get_attributes\n h = {}\n if @reader.has_attributes?\n if @reader.move_to_first_attribute == 1\n h[@reader.name] = @reader.value\n while @reader.move_to_next_attribute == 1\n h[@reader.name] = @reader.value\n end\n end\n @reader.move_to_element # reset main pointer in libxml\n end\n # p h\n h\n end", "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "def to_hash\n hash = {}; self.attributes.each { |k,v| hash[k] = v }\n end", "def attributes\n attrs = Hash.new\n attribute_list.each do |attribute|\n value = self.send(attribute)\n attrs[attribute] = value unless value.nil?\n end\n attrs\n end", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attribute_keys\n return [] unless self[:attributes]\n self[:attributes].keys\n end", "def current_attributes\n attributes.each_key.each_with_object({}) do |key, h|\n h[key] = public_send(key)\n end\n end", "def attributes\n ATTRIBUTES.inject({}) do |hash, attribute|\n hash[attribute] = self.send(attribute)\n hash\n end\n end", "def attributes\n ATTRIBUTES.inject({}) do |hash, attribute|\n hash[attribute] = self.send(attribute)\n hash\n end\n end", "def find_attributes(node, &block); end", "def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end", "def serializable_hash\n return nil if @object.nil?\n @node = attributes\n include_links!\n # include_associations! if _embed\n @node\n end", "def attributes\n (node.attributes['attrs'] || \"\").split(/\\s*,\\s*/).where_not.blank?\n end", "def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end", "def get_attributes(node)\n unless inside_testkitchen?\n data = get_search(:node, \"name:#{node}\")\n\n merge_attributes(data)\n else\n kitchen_provisioner_config[:attributes]\n end\n end", "def attributes\n @_attributes ||= Hash.new.with_indifferent_access\n end", "def attributes(context = nil)\n context ||= Context.current\n context.value(CURRENT_ATTRIBUTES_HASH) || {}\n end", "def attribute_hash\n instance_vars = self.send(:instance_variables)\n values = {}\n instance_vars.each do |var|\n values[(var.to_s.delete('@')).to_sym] = self.instance_variable_get(var)\n end\n values\n end", "def hash\n element.hash\n end", "def get_attributes\n\t\t\t@@attributes\n\t\tend", "def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end", "def attribs\n\t\t@attributes\n\tend", "def attributes\n self.class._attributes.dup.each_with_object({}) do |name, hash|\n hash[name] = send(name)\n end\n end", "def attributes\n @attributes ||= attribute_names.inject({}) do |hash, name|\n attribute_values = saml.xpath(\"//saml:Attribute[@Name='#{name}']/saml:AttributeValue/text()\")\n hash[name] = attribute_values.length > 1 ? attribute_values.collect(&:to_s) : attribute_values.to_s\n hash\n end\n end", "def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end", "def attributes\n @data.keys\n end", "def keys\n @attributes.keys\n end", "def attributes\n data[:attributes]\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def to_hash\n {}.tap do |hash|\n @original_attrs.keys.each do |at|\n hash[at] = send(at)\n end\n end\n end", "def attributes # :nodoc:\n @attributes ||= {}\n end", "def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end", "def attributes\n self\n .class\n .attribute_names\n .map { |attr| [attr, send(attr)] }\n .reject { |_, value| value.nil? }\n .map do |attr, value|\n [attr, value.respond_to?(:attributes) ? value.attributes : value]\n end\n .to_h\n end", "def attributes(hash)\n hash.keys.inject(\"\") { |attrs, key| attrs + %{#{key}=\"#{hash[key]}\" } }\n end", "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end", "def attributes\n @cache[:attributes]\n end", "def to_hash\n Hash[self.class.attributes.map {|attr| [attr, send(attr)]}]\n end", "def attributes\n @element_map\n end", "def json_attributes\n attributes.merge(\n node_from_id: from_character_id, \n node_to_id: to_character_id,\n strengh: force.abs,\n label: title)\n end", "def node()\n result = super.stringify_keys\n result.merge! volume.attributes.stringify_keys unless volume.nil?\n result\n end", "def to_hash\n hash = {}\n self.attributes.each {|attr| hash[attr.to_sym] = self.send(attr)}\n hash\n end", "def attributes\n _fast_attributes\n\n rescue NameError\n\n method = \"def _fast_attributes\\n\"\n method << \" @_attributes ||=\\n\"\n method << \" begin\\n\"\n method << \" h = {}\\n\"\n\n self.class.attributes.each do |name|\n method << \" h[:\\\"#{name}\\\"] = send(:\\\"#{name}\\\") if include_#{name}?\\n\"\n end\n\n method << \" h\\n\"\n method << \" end\\n\"\n method << \"end\"\n\n self.class.class_eval method\n\n _fast_attributes\n end", "def attr_hash(attrs)\n h = {}\n attrs.each {|k,v| h[k] = v}\n h\n end", "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:product_identity_id] = product_identity_id\n r[:langcode] = lang_code_3_chars\n r[:mappings] = mappings\n r\n end", "def attributes\n Hash.new.tap do |atts|\n _attributes.instance_variables.each do |ivar|\n # todo: figure out why it's setting @constructor and @toString\n next if ivar == :@constructor || ivar == :@toString || ivar == :@_attributes || ivar == :@_data || ivar == :@_forms\n\n att = ivar[1..-1].to_sym\n atts[att] = _attributes.send(att)\n\n if form_name = _form[att.to_s.to_sym]\n atts[att] = wedge(form_name, atts[att].respond_to?(:attributes)? atts[att].attributes : atts[att]).attributes\n end\n end\n end\n end", "def to_hash\n hash = {}\n roxml_attributes.values.each do |attr|\n value = send(attr.accessor)\n value = if value.is_a?(Array)\n value.map { |v| v.respond_to?(:to_hash) ? v.to_hash : v }\n else\n value.respond_to?(:to_hash) ? value.to_hash : value\n end\n\n hash[attr.attr_name.to_sym] = value if value.present?\n end\n\n hash\n end", "def attributes\n hash = HashWithIndifferentAccess.new\n\n self.class.attribute_names.each_with_object(hash) do |name, attrs|\n attrs[name] = read_attribute(name)\n end\n end", "def attributes\n # Note: the values returned here are ignored by\n # ActiveModel::Serializers#serializable_hash; just the keys are\n # used to again call those getter methods... But we do want to\n # check the values so we can leave 'nil' out of the hash.\n attribute_keys.inject(\n ActiveSupport::HashWithIndifferentAccess.new) do |result, key|\n value = send(key)\n result[key] = value unless value == nil\n result\n end\n end", "def attributes_to_hash(element)\n hash = {}\n element.attributes.each do |a, v|\n hash.store a.to_s, v.to_s\n end\n hash\n end", "def list_attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes.keys\n end", "def fav_attr\n xml = Nokogiri::XML(self, nil, 'UTF-8') {|config| config.nonet}\n xml.remove_namespaces!\n\n attrs = {}\n if ut = xml.at_xpath('/ead/archdesc/did/unittitle')\n attrs[:unittitle] = ut.content.gsub(/\\s+/, ' ').sub(/[\\s,]+$/, '')\n end\n if uid = xml.at_xpath('/ead/archdesc/did/unitid')\n attrs[:unitid] = uid.content.rstrip\n end\n\n attrs.merge(digest: digest)\n end", "def to_hash\n attributes.dup\n end", "def attr_info; end", "def attributes\n self.class.attribute_names.map do |name|\n [name.to_s, self.send(name)]\n end.to_h\n end", "def attributes\n %w(id cluster_id job_id created_at token title view script_type cache_completed).map do |attribute|\n [ attribute, nil ]\n end.to_h\n end" ]
[ "0.80647045", "0.75737137", "0.7371458", "0.7178217", "0.7173893", "0.7097687", "0.70500326", "0.701273", "0.69741315", "0.69741315", "0.69741315", "0.69466156", "0.6904702", "0.68266094", "0.68118197", "0.67625374", "0.67510116", "0.67456764", "0.6737818", "0.6679685", "0.6671536", "0.66589445", "0.66443133", "0.6613717", "0.66067827", "0.6602852", "0.6598287", "0.6587597", "0.65868", "0.65868", "0.65561223", "0.6554171", "0.65511626", "0.6544465", "0.6538795", "0.65227383", "0.6521779", "0.65057987", "0.64838564", "0.64775276", "0.6474353", "0.64254576", "0.64154434", "0.6397106", "0.6397106", "0.6397106", "0.63954705", "0.63946277", "0.6383879", "0.6383879", "0.6379397", "0.63775563", "0.63637656", "0.6357235", "0.6354215", "0.6350104", "0.63488895", "0.6327671", "0.62917423", "0.6290238", "0.62800974", "0.6265249", "0.6262402", "0.6253595", "0.62506145", "0.6233757", "0.6229384", "0.6221326", "0.6218291", "0.62181336", "0.62181336", "0.62181336", "0.62181336", "0.62181336", "0.62164307", "0.6208473", "0.6204084", "0.62028235", "0.6194828", "0.61804867", "0.6178812", "0.6175425", "0.6169155", "0.61618024", "0.61595976", "0.6157147", "0.61501163", "0.6141195", "0.61366844", "0.6132205", "0.6129017", "0.61217386", "0.6119222", "0.6118978", "0.6116815", "0.61150044", "0.61129355", "0.6104852", "0.60892063", "0.60848236" ]
0.75875473
1
Returns a hash of attributes for a given node
def attributes_of(node) map = Hash.new if !is_valid node then return map end varKeys = attr_keys_in node if !varKeys.nil? then varKeys.each do |key| map[key] = node[key] end end return map end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end", "def xml_node_to_hash(nokogiri_node)\n\t\t\tattributes = Hash.new\n\n\t\t\tnokogiri_node.each do |k,v|\n\t\t\t\tattributes[k.to_sym] = v.value\n\t\t\tend\n\n\t\t\treturn attributes\n\t\tend", "def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end", "def node_hash(node_id)\n \n end", "def hash\n node_id.hash\n end", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def node_hash_from_node(ast)\n hash = {}\n ast.children.each { |cn| hash[cn.children[0]] = cn.children[1] }\n hash\n end", "def hash\n @attrs\n end", "def attributes_for_node(node_name)\n node(node_name).attributes\nend", "def attributes\n node[1]\n end", "def keys\n attribute_nodes.map(&:node_name)\n end", "def attributes_hash\n attributes_hash = section.attributes.to_hash\n attributes_hash.each { |k, attr| attributes_hash[k] = attr.value }\n end", "def xml_node_to_hash(node)\n\t# If we are at the root of the document, start the hash\n\tif node.element?\n\t\tresult_hash = {}\n\t\tif node.attributes != {}\n\t\t\tattributes = {}\n\t\t\tnode.attributes.keys.each do |key|\n\t\t\t\tattributes[node.attributes[key].name.to_sym] = node.attributes[key].value\n\t\t\tend\n\t\tend\n\t\tif node.children.size > 0\n\t\t\tnode.children.each do |child|\n\t\t\t\tresult = xml_node_to_hash(child)\n\n\t\t\t\tif child.name == \"text\"\n\t\t\t\t\tunless child.next_sibling || child.previous_sibling\n\t\t\t\t\t\treturn result unless attributes\n\t\t\t\t\t\tresult_hash[child.name.to_sym] = result\n\t\t\t\t\tend\n\t\t\t\telsif result_hash[child.name.to_sym]\n\n\t\t\t\t\tif result_hash[child.name.to_sym].is_a?(Object::Array)\n\t\t\t\t\t\tresult_hash[child.name.to_sym] << result\n\t\t\t\t\telse\n\t\t\t\t\t\tresult_hash[child.name.to_sym] = [result_hash[child.name.to_sym]] << result\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tresult_hash[child.name.to_sym] = result\n\t\t\t\tend\n\t\t\tend\n\t\t\tif attributes\n\t\t\t\t#add code to remove non-data attributes e.g. xml schema, namespace here\n\t\t\t\t#if there is a collision then node content supersets attributes\n\t\t\t\tresult_hash = attributes.merge(result_hash)\n\t\t\tend\n\t\t\treturn result_hash\n\t\telse\n\t\t\treturn attributes\n\t\tend\n\telse\n\t\treturn node.content.to_s\n\tend\nend", "def find_attributes(node, &block); end", "def attributes_hash(object); end", "def attributes_to_hash(element)\n hash = {}\n element.attributes.each do |a, v|\n hash.store a.to_s, v.to_s\n end\n hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def node_to_hash(node)\n puts \"You must define a `node_to_hash` method in your child class to parse the Nokogiri nodes\"\n end", "def get_attributes(node)\n unless inside_testkitchen?\n data = get_search(:node, \"name:#{node}\")\n\n merge_attributes(data)\n else\n kitchen_provisioner_config[:attributes]\n end\n end", "def to_hash\n @to_hash ||= RISBN::NokogiriUtils.hash_from_node(xml_nodes)[:entry]\n end", "def get_node_attributes_stub\n []\n end", "def get_attributes(node_id:)\n {\n method: \"DOM.getAttributes\",\n params: { nodeId: node_id }.compact\n }\n end", "def attributes_hash\n self.info.to_hash.symbolize_keys\n end", "def chef_node_attribute_data\n node_data = node.to_h\n node_data['chef_environment'] = node.chef_environment\n\n node_data\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) { |node, h|\n h[node] = enumerate_attrs_by_node(node)\n }\n end", "def enumerate_attrs\n @node_attrs.keys.each_with_object({}) do |node, h|\n h[node] = enumerate_attrs_by_node(node)\n end\n end", "def attrs_from_node_and_registry(node, registry)\n attrs = {}\n \n registry.each do |attribute, path|\n leaf = node.find(path).first\n attrs[attribute] = leaf.content if leaf.respond_to?(:content)\n attrs[attribute] = leaf.value if leaf.respond_to?(:value)\n end\n\n attrs\n end", "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end", "def attr_hash(attrs)\n h = {}\n attrs.each {|k,v| h[k] = v}\n h\n end", "def to_hash\n h = hash.dup\n @hash.each do |name, node|\n h[name] = node.to_hash if node.respond_to? :to_hash\n end\n h\n end", "def nodes_hash(nodes)\n nodes.each_with_object({}) do |node, hash|\n model = node.get(:model)\n attributes = model.to_hash\n\n attributes.merge!(node.properties.except(:model, :cc_in, :cc_out))\n\n attributes.each do |key, value|\n attributes[key] = value.to_hash if value.is_a?(ValueObject)\n end\n\n if model.max_demand\n attributes[:max_demand] = model.max_demand\n elsif !model.queries.key?(:max_demand)\n # Keep the Refinery value if it was set by a query.\n attributes.delete(:max_demand)\n end\n\n attributes[:demand] = node.demand.to_f\n attributes[:input] = slots_hash(node.slots.in)\n attributes[:output] = slots_hash(node.slots.out)\n\n attributes.delete(:queries)\n\n hash[node.key] = attributes\n end\n end", "def to_hash\n hash = {}; self.attributes.each { |k,v| hash[k] = v }\n end", "def attributes\n\t\treturn attributes_of @current_node\n\tend", "def to_hash\n @attributes\n end", "def convert_attr_hash(attrs = [])\n h = {}\n attrs.each do |v|\n # v is Nokogiri::XML::SAX::Parser::Attribute\n # see http://nokogiri.org/Nokogiri/XML/SAX/Parser/Attribute.html\n key = v.prefix ? v.prefix + ':' : ''\n key += v.localname\n\n h[key.to_sym] = v.value\n end\n h\n end", "def attr_keys\n\t\treturn attr_keys_in @current_node\n\tend", "def to_hash\n attributes\n end", "def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end", "def to_hash\n @attributes\n end", "def to_hash\n @attributes\n end", "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "def attributes(hash)\n hash.keys.inject(\"\") { |attrs, key| attrs + %{#{key}=\"#{hash[key]}\" } }\n end", "def to_hash\n hash = {}\n roxml_attributes.values.each do |attr|\n value = send(attr.accessor)\n value = if value.is_a?(Array)\n value.map { |v| v.respond_to?(:to_hash) ? v.to_hash : v }\n else\n value.respond_to?(:to_hash) ? value.to_hash : value\n end\n\n hash[attr.attr_name.to_sym] = value if value.present?\n end\n\n hash\n end", "def attributes_get\n h = {}\n self.class.attributes.each do |a|\n h[a] = attribute_get(a)\n end\n h\n end", "def attributes_get\n h = {}\n self.class.attributes.each do |a|\n h[a] = attribute_get(a)\n end\n h\n end", "def attributes\n (node.attributes['attrs'] || \"\").split(/\\s*,\\s*/).where_not.blank?\n end", "def attr_keys_in(node)\n\t\treturn is_valid(node) ? node.keys : nil\n\tend", "def to_hash\n {\n amount: self.amount,\n address: self.to_node.address\n }\n end", "def hash\n element.hash\n end", "def to_hash\n {}.tap do |hash|\n @original_attrs.keys.each do |at|\n hash[at] = send(at)\n end\n end\n end", "def root_hash\n self.node_hash root_node_id\n end", "def attributes\n self._attributes.inject({}) do |hash, attr|\n hash[attr.to_s] = send(attr)\n hash\n end\n end", "def serializable_hash\n return nil if @object.nil?\n @node = attributes\n include_links!\n # include_associations! if _embed\n @node\n end", "def attributes\n @attributes ||= attribute_names.inject({}) do |hash, name|\n attribute_values = saml.xpath(\"//saml:Attribute[@Name='#{name}']/saml:AttributeValue/text()\")\n hash[name] = attribute_values.length > 1 ? attribute_values.collect(&:to_s) : attribute_values.to_s\n hash\n end\n end", "def attributes\n self.attribute_keys.inject({}) do |hash, key|\n hash[key] = self.__send__(key) if self.__send__(key)\n hash\n end\n end", "def to_hash\n attribute_hash = {}\n simple_attributes.each do |att|\n attribute_hash[att] = self.send(att) unless self.send(att).nil?\n end\n \n attribute_hash\n end", "def attr_hash\n hash = create_hash\n hash.delete(\"id\")\n hash.delete(\"errors\")\n return hash\n end", "def hash\n [rel, href].hash\n end", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:product_identity_id] = product_identity_id\n r[:langcode] = lang_code_3_chars\n r[:mappings] = mappings\n r\n end", "def hash\n [self.class, self.val, self.attribute].hash\n end", "def clean_attrs\n data = node.to_hash\n %w(run_list recipes roles).each { |k| data.delete(k) }\n data\n end", "def to_hash\n XMLUtils.to_hash xml\n end", "def attributes\n unless @attributes\n @attributes = node.attributes.collect do |att|\n visitor(AttributeVisitor) { |v| v.visit(att) }\n end\n end\n @attributes\n end", "def fav_attr\n xml = Nokogiri::XML(self, nil, 'UTF-8') {|config| config.nonet}\n xml.remove_namespaces!\n\n attrs = {}\n if ut = xml.at_xpath('/ead/archdesc/did/unittitle')\n attrs[:unittitle] = ut.content.gsub(/\\s+/, ' ').sub(/[\\s,]+$/, '')\n end\n if uid = xml.at_xpath('/ead/archdesc/did/unitid')\n attrs[:unitid] = uid.content.rstrip\n end\n\n attrs.merge(digest: digest)\n end", "def hash\n @node.sort.push(@edge).hash\n end", "def attributes\n Hash[instance_variables.map{|attrib| [attrib.to_s[1..attrib.to_s.size], nil]}]\n end", "def attr(node,name_attribute='Name')\n node.attributes[name_attribute].value\n end", "def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end", "def get_attributes\n h = {}\n if @reader.has_attributes?\n if @reader.move_to_first_attribute == 1\n h[@reader.name] = @reader.value\n while @reader.move_to_next_attribute == 1\n h[@reader.name] = @reader.value\n end\n end\n @reader.move_to_element # reset main pointer in libxml\n end\n # p h\n h\n end", "def attributes\n (@original_attributes||{}).merge(@attributes).keys.inject({}) do |hash, key|\n hash[key] = read_attribute(key)\n hash\n end\n end", "def attribites_to_hash\n hash = {}\n if !@attributes.nil?\n @attributes.each { |attr|\n downcaseAttr = attr.downcase\n if instance_attribute_defined?(downcaseAttr)\n hash[attr.to_sym] = get(downcaseAttr)\n end\n }\n end\n\n if !@schemaLocation.nil?\n hash[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n hash[\"xsi:schemaLocation\"] = \"#{@schemaLocation}\"\n end\n return hash;\nend", "def to_hash\n index_hash = Hash.new\n self.each do |node|\n index_hash[node.node_name] = node.to_s\n end\n index_hash\n end", "def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end", "def extract_attr_value(xml)\n raw = {}\n default_when_xpath_err {\n @path.each(xml) do |node|\n raw[node.name] = node.text\n end\n }\n raw\n end", "def node_subhashes(node)\n l_hash = node.left ? node.left._hash : self.class.null_hash_at(node.depth + 1)\n r_hash = node.right ? node.right._hash : self.class.null_hash_at(node.depth + 1)\n [l_hash, r_hash]\n end", "def attributes\n return {\n :level => level,\n :message => message,\n :line => line,\n :column => column,\n :file => file,\n :filename => filename,\n :node => node\n }\n end", "def attributes\n @attrs.keys\n end", "def get_attributes(element)\n attributes = {}\n element.attributes.each { |n, v| attributes[n] = v }\n attributes\n end", "def attrs_hash(attrs)\n HashWithIndifferentAccess.new(attrs)\n end", "def attributes\n attrs = Hash.new\n attribute_list.each do |attribute|\n value = self.send(attribute)\n attrs[attribute] = value unless value.nil?\n end\n attrs\n end", "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:files] = mappings_for_files.map { |e| e.to_hash }\n r\n end", "def get_attributes(element, requestor = self)\n result = Hash.new\n element_helper = ElementHelper.new requestor\n result['self'] = element_helper.get_element_info element\n result['pappy'] = element_helper.get_element_info element, 1\n result['granny'] = element_helper.get_element_info element, 2\n return result\n end", "def to_hash\n hash = {}\n self.attributes.each {|attr| hash[attr.to_sym] = self.send(attr)}\n hash\n end", "def to_hash(hash={})\n node_hash = {}\n\n # Insert node hash into parent hash correctly.\n insert_node_hash_into_parent(hash, name, node_hash)\n\n # Handle child elements\n each_child do |child|\n handle_child_element(child, node_hash)\n end\n\n # Remove content node if it is blank\n remove_blank_content_node node_hash\n\n # Handle attributes\n each_attr { |a| node_hash[a.name] = a.value }\n\n hash\n end", "def rdn_attributes\n\t\treturn make_rdn_hash( self.rdn )\n\tend", "def attrs_for_record(node, record_class)\n record_class.fields_map.inject({}) do |attrs, (field, xpath)|\n element = node.xpath(\"./#{xpath}\")\n\n value = if element.children.length > 1\n element.children.map(&:to_s)\n else\n text = element.text\n text = text.strip if text\n end\n value = Array(value).map{|e| e.encode('UTF-8') }\n value = value.first if value.length == 1\n\n attrs = attrs.merge(field => value)\n end\n end", "def get_hash(path=\"\")\n Element.get_hash(@element, path)\n end", "def to_hash\n doodle.attributes.inject({}) {|hash, (name, attribute)| hash[name] = send(name); hash}\n end", "def get_node_and_component_attributes(_opts = {})\n node_attrs = get_node_attributes_stub\n component_attrs = get_objs(cols: [:component_attrs]).map { |r| r[:attribute] }\n component_attrs + node_attrs\n end", "def attr_hash(nodoc)\n {\n precedence: statement.jump(:ident).source,\n default: statement.jump(:assign)[1].source,\n docstring: nodoc ? '' : statement.docstring,\n path: statement.source.match(MATCH)[3]\n }\n end", "def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end", "def md5\n @attributes[:md5]\n end", "def to_hash\n attributes.dup\n end", "def attribute_keys\n return [] unless self[:attributes]\n self[:attributes].keys\n end", "def attribute_hash\n instance_vars = self.send(:instance_variables)\n values = {}\n instance_vars.each do |var|\n values[(var.to_s.delete('@')).to_sym] = self.instance_variable_get(var)\n end\n values\n end", "def transfer_node_attributes(nodes, attributes); end", "def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end" ]
[ "0.7783991", "0.7623897", "0.7268262", "0.72092825", "0.7129924", "0.6954855", "0.6922437", "0.6921246", "0.6772712", "0.6702666", "0.66946703", "0.6683129", "0.6681362", "0.66218", "0.661858", "0.654317", "0.6523913", "0.6523913", "0.6523913", "0.6508815", "0.64791906", "0.6445084", "0.6433625", "0.6414941", "0.638575", "0.6377281", "0.6370061", "0.6363881", "0.6363594", "0.6306692", "0.62990457", "0.62544", "0.62239826", "0.6221636", "0.62117374", "0.620663", "0.6176151", "0.6175419", "0.6169058", "0.6161342", "0.61498976", "0.61385006", "0.6135114", "0.613081", "0.6125669", "0.61251163", "0.61251163", "0.6121756", "0.60878384", "0.6076576", "0.607005", "0.60532206", "0.60393476", "0.60246307", "0.602269", "0.601973", "0.6019177", "0.6018437", "0.6016616", "0.60102874", "0.59990716", "0.59958744", "0.5989002", "0.5987668", "0.59797996", "0.5967061", "0.59655964", "0.5961757", "0.59562385", "0.5956058", "0.5953564", "0.5947659", "0.5941423", "0.5939921", "0.5939534", "0.59333354", "0.59242576", "0.5908019", "0.5907906", "0.5905564", "0.59044343", "0.5875635", "0.5868058", "0.58671516", "0.58613485", "0.5858438", "0.5855103", "0.58540046", "0.5853135", "0.5852591", "0.58513355", "0.5849131", "0.5849055", "0.5845028", "0.5840723", "0.583859", "0.5830359", "0.5827644", "0.58203936", "0.5808401" ]
0.7868834
0
Returns the value of the given node attribute
def attribute_value(key, node = @current_node) if is_valid(node) && node.key?(key) then return node.attribute(key).to_s else return '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr(node,name_attribute='Name')\n node.attributes[name_attribute].value\n end", "def value(node, attribute); end", "def value(node, attribute); end", "def get_attribute(node, attr_name)\n node.attribute(attr_name)\n end", "def attr(node, attribute_name, namespace = nil)\n attr = (attribute_name.is_a? Symbol) ? attribute_name.to_s : attribute_name\n node.attribute(attr, namespace).value if node.attribute(attr) \n end", "def get_value(attribute,xml)\n xml.xpath(\".//#{attribute}\").first.content\n end", "def get_attribute( name )\n @attr_nodes.each do |attr|\n if attr.name == name then\n #//////////////////////////\n # 変更する\n #//////////////////////////\n return attr.value\n end\n end\n return \"\"\n end", "def attr_val(xpath)\n Utilities::attr_val(@entry, xpath)\n end", "def get_attribute(node, attr_name)\n #There has been a method shift between 0.5 and 0.7\n if defined?(node.property) == nil\n return node.attributes[attr_name]\n else\n if defined?(node[attr_name])\n return node[attr_name]\n else\n return node.property(attr_name)\n end\n end\n end", "def get_attribute_value(attribute)\n data[attribute]\n end", "def getAttribute\n if (@nodeValues.size > @INDEX)\n tmp = @nodeValues[@INDEX]\n result = @xmlTool.searchForAttribute(tmp, @attributeElementName, @attributeName)\n return result\n else\n return \"\"\n end\n\n end", "def attribute_value(element,attribute_name)\n element.attribute_value(element,attribute_name)\n end", "def node_value\n return @value\n end", "def scrape_attribute_value(element, attribute)\n scrape element if !element.not_nil?\n return @result[attribute]\n end", "def getAttribute(name)\n attr = getAttributeNode(name)\n if attr.nil?\n ''\n else\n attr.nodeValue\n end\n end", "def attr(key,name)\n value = nil\n\n if NOKOGIRI\n element=@xml.xpath(key.to_s.upcase)\n if element.size == 0\n return nil\n end\n\n attribute = element.attr(name)\n\n value = attribute.text if attribute != nil\n else\n element=@xml.elements[key.to_s.upcase]\n\n value = element.attributes[name] if element != nil\n end\n\n return value\n end", "def attribute_value\n @attributes.each { | id, value | return value }\n end", "def getAttributeNode(name)\n @attr.getNamedItem(name)\n end", "def value\n node.value\n end", "def value\n @attributes[:value]\n end", "def value\n attributes.fetch(:value)\n end", "def nodeValue\n @value\n end", "def get attribute\n attributes[attribute]\n end", "def get_attribute(name); end", "def get_attribute(name); end", "def get_attribute_or_element_value(xml, attr, default = nil, &f)\n val = default\n begin\n snip = xml.elements[attr]\n if snip.elements.size > 0\n if snip.elements.size == 1 && snip.elements['object']\n # must be an otml reference to a different OTObject\n # return the refid\n val = snip.elements['object'].attributes['refid'].to_s\n else\n # otherwise just return the whole snippet\n val = snip.to_s\n end\n else\n val = snip.get_text.to_s\n end\n rescue\n begin\n val = xml.attributes[attr].to_s\n rescue\n # logger.warn(\"Couldn't find attribute or element: #{attr}\")\n end\n end\n begin\n if f\n val = yield(val)\n end\n rescue\n val = default\n end\n return val\n end", "def get_node_value(node)\n node\n end", "def raw_attribute(name)\n\t\t\t@node.attribute(name).contents.to_s rescue nil\n\t\tend", "def dom_attribute(name); end", "def [](name)\n @_node.hasAttribute(name.to_s) ? @_node.getAttribute(name.to_s) : nil\n end", "def value element_name\n begin\n el_attribute = el element_name\n el_attribute.attribute('value')\n rescue Exception => e\n $LOG.error \"error in getting element value \\n element name : #{element_name} \"+e.message\n raise \"error in getting element value \\n element name : #{element_name} \"+e.message\n end\n end", "def attribute attr\n @ref.attribute(TRANSLATOR.cocoaify(attr)).to_ruby\n end", "def qattr(ns, attribute_name)\n attr_name, ns_map = qname(ns, attribute_name)\n attribute = xpath(\"@#{attr_name}\", ns_map).first # this should return a Nokogiri::XML::Attr object if the attribute exists\n attribute.value if attribute\n end", "def get_value\n read_attribute('text_value')\n end", "def xattr(xml, expression, attr = nil)\n node = xml.xpath(expression)\n\n if node.class == NilClass or node.empty?\n nil\n elsif attr.nil? or attr == ''\n result = node.inner_text\n else\n result = node.attribute(attr).to_s\n end\n\n # Catch blank result values\n if result != '0x0000000000000000'\n result\n else\n nil\n end\n end", "def get_attribute_value(attribute)\n values = read_attr_val(attribute.id)\n return nil unless values\n if attribute.atype == ProductAttribute::Atype_String\n return values[0]\n elsif attribute.atype == ProductAttribute::Atype_Currency\n MoneyUtils.format(values[1])\n else\n return Integer(values[1])\n end\n end", "def extract_attr_value(xml)\n raw = {}\n default_when_xpath_err {\n @path.each(xml) do |node|\n raw[node.name] = node.text\n end\n }\n raw\n end", "def element\n \"Attribute\"\n end", "def attribute(name)\n attr = nc.att(name)\n get(attr)\n end", "def getValue page, attribute\n if attribute == 'rating'\n return page.search('.ratingValue').children[1].text\n end\nend", "def fetch_attribute(path, default = nil)\n node.dig(*path.split('.')) || default\nend", "def value_of_node(node_name)\n value_of_nodes(node_name).first\nend", "def get_attrib(attrib)\n Attrib.get(attrib, self) rescue nil\n end", "def _read_attribute(attr)\n @attributes[attr]\n end", "def get_tag_attr (tag_path, attr_name)\n\n $test_logger.log(\"Get XML tag attribute #{tag_path}, #{attr_name}\")\n\n raise \"XML doc not loaded\" if @xml_ilv_node == nil\n\n #Get target tag\n target_tag = @xml_ilv_node.elements[tag_path]\n\n #Raise exception if no tag is found\n raise \"XML path '#{tag_path}' not found!\" if !target_tag\n\n #Get value from attribute, if exists\n attr_value = nil\n if target_tag.has_attributes?\n attr_obj = target_tag.attributes.get_attribute(attr_name)\n attr_value = attr_obj.value if attr_obj != nil\n end\n\n attr_value\n end", "def get_property(node, name)\n node.xpath(name).text\n end", "def attribute(name)\n return attributes[name]\n end", "def attribute_value\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n value = nil\n quoted_string29 = nil\n number30 = nil\n\n begin\n # at line 125:35: ( quoted_string | number )\n # at line 125:35: ( quoted_string | number )\n alt_43 = 2\n look_43_0 = @input.peek( 1 )\n\n if ( look_43_0 == QUOTE )\n alt_43 = 1\n elsif ( look_43_0 == DIGIT )\n alt_43 = 2\n else\n raise NoViableAlternative( \"\", 43, 0 )\n end\n case alt_43\n when 1\n # at line 125:37: quoted_string\n @state.following.push( TOKENS_FOLLOWING_quoted_string_IN_attribute_value_1234 )\n quoted_string29 = quoted_string\n @state.following.pop\n # --> action\n value = quoted_string29 \n # <-- action\n\n when 2\n # at line 125:85: number\n @state.following.push( TOKENS_FOLLOWING_number_IN_attribute_value_1240 )\n number30 = number\n @state.following.pop\n # --> action\n value = ( number30 && @input.to_s( number30.start, number30.stop ) ).to_i \n # <-- action\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return value\n end", "def attribute?\n node_type == ATTRIBUTE_NODE\n end", "def get(attribute)\n @attributes[attribute.to_s]\n end", "def get_attribute(name)\n @attributes[name]\n end", "def [](attr_name)\n @attributes.fetch_value(attr_name.to_s)\n end", "def attribute(name)\n attributes[name]\n end", "def node\n attributes['node']\n end", "def node\n attributes['node']\n end", "def attribute(name)\n read_attribute(name)\n end", "def get_attribute(attr_name)\n return nil unless @attributes.key? attr_name\n\n @attributes[attr_name]\n end", "def value_from_node_property\n ''\n end", "def get_attribute(name)\n @attributes[name.to_s]\n end", "def _read_attribute(attr_name, &block) # :nodoc:\n @attributes.fetch_value(attr_name, &block)\n end", "def attr attribute_name,value = nil\n string=\"$('##{@id}').attr('#{attribute_name}','#{value}')\"\n @app.dom_on_sockets.execute string\n end", "def attribute_get(attribute)\n check_attribute!(attribute)\n send(attribute.to_s)\n end", "def attribute_get(attribute)\n check_attribute!(attribute)\n send(attribute.to_s)\n end", "def get_value\n read_attribute('number_value')\n end", "def attribute(locator, attribute)\n find_element(locator).attribute(attribute)\n end", "def nodeType\n ATTRIBUTE_NODE\n end", "def get_value(attribute_id)\n get_custom_value_hash\n return @custom_value_hash[attribute_id]\n end", "def attribute_value\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n value = nil\n string30 = nil\n number31 = nil\n\n begin\n # at line 152:35: ( string | number )\n # at line 152:35: ( string | number )\n alt_38 = 2\n look_38_0 = @input.peek(1)\n\n if (look_38_0 == T__14)\n alt_38 = 1\n elsif (look_38_0 == EOF || look_38_0 == DIGIT || look_38_0 == T__11 || look_38_0 == T__33)\n alt_38 = 2\n else\n raise NoViableAlternative(\"\", 38, 0)\n end\n case alt_38\n when 1\n # at line 152:37: string\n @state.following.push(TOKENS_FOLLOWING_string_IN_attribute_value_1142)\n string30 = string\n @state.following.pop\n # --> action\n value = (string30 && @input.to_s(string30.start, string30.stop))\n # <-- action\n\n when 2\n # at line 152:71: number\n @state.following.push(TOKENS_FOLLOWING_number_IN_attribute_value_1148)\n number31 = number\n @state.following.pop\n # --> action\n value = (number31 && @input.to_s(number31.start, number31.stop)).to_i\n # <-- action\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n end\n\n return value\n end", "def get_attribute(root_element, key, type = nil, prefix = nil)\n key_parts = key.split('.')\n output_entry = key_parts[0...-1].inject(root_element.to_hash) { |element, k| element.nil? ? nil : element[k] }\n return nil unless output_entry\n value = output_entry[key_parts.last]\n return nil if value.nil?\n label = prefix ? \"#{prefix}.#{key}\" : key\n raise \"The value of attribute '#{label}' is '#{value.inspect}' and this is not of the expected type #{type.inspect}\" if type && !(type.is_a?(Array) ? type : [type]).any? { |t| value.is_a?(t) }\n value\n end", "def read_attribute name\n @attributes[name.to_s]\n end", "def [](name)\n `#{@el}.getAttribute(#{name})`\n end", "def read_attribute(key)\n @attributes[key]\n end", "def read_attribute(key)\n @attributes[key]\n end", "def get_attribute(name)\n return @attrs[name] if attrs.key?(name)\n end", "def max_attribute_value(xml_node, selector, attr_name, query_method: :xpath)\n xml_node.send(query_method, selector).map.inject(0) do |max, node|\n next max unless (match = node.attr(attr_name).match(/(\\d+)/))\n [max, match[1].to_i].max\n end\n end", "def value_for (attribute)\n unless current_values.key?(attribute)\n raise ArgumentError, \"No such attribute: #{attribute.inspect}\"\n end\n current_values[attribute]\n end", "def find_attribute_value(xml, component, attribute, search_comments=false)\n attr_node = xml.at_xpath(\"//Component[@FQDD='#{component}']//Attribute[@Name='#{attribute}']\")\n if attr_node.nil? && search_comments\n xml.xpath(\"//Component[@FQDD='#{component}']/comment()\").each do |comment|\n if comment.content.include?(attribute)\n node = Nokogiri::XML(comment.content)\n if node.at_xpath(\"/Attribute\")['Name'] == attribute\n attr_node = node.at_xpath(\"/Attribute\")\n break\n end\n end\n end\n end\n attr_node.nil? ? nil : attr_node.content\n end", "def fetch_xml_attr(path, xml, attribute = \"id\") # :doc:\n XML::Parser.parse(xml.body, \"/pairwise/#{path}\", attribute)\n end", "def attribute(vertex, name)\n vertex.is_a?(::Oga::XML::Element) ? vertex.get(name) : nil\n end", "def value\n return @children['value'][:value]\n end", "def attribute_get(name)\n @attributes[:current][name]\n end", "def [](val)\n @attributes[val]\n end", "def [](attrib)\n attributes[attrib]\n end", "def attribute(name)\n current_attributes[name]\n end", "def nodeValue\n ret = \"\"\n @children.each do |child|\n ret << child.nodeValue\n end if @children\n ret\n end", "def get_value(element)\n element.value\n end", "def content(element_or_attribute)\n case element_or_attribute\n when REXML::Attribute\n return element_or_attribute.value\n when REXML::Element\n return element_or_attribute.text\n end\n end", "def content(element_or_attribute)\n case element_or_attribute\n when REXML::Attribute\n return element_or_attribute.value\n when REXML::Element\n return element_or_attribute.text\n end\n end", "def get_property!(node, name)\n value = node.xpath(name).text\n raise \"missing property '#{name}' in node: #{node}\" if value.empty?\n value\n end", "def get_attribute(attribute)\n\t\t@attributes[attribute.intern]\n\tend", "def get_value(element)\n\t\t\tif ['input','select','textarea'].include? element.tag_name.downcase\n\t\t\t\telement.attribute('value')\n\t\t\telse\n\t\t\t\telement.text\n\t\t\tend\n\t\tend", "def value\n attributes['FieldValue']\n end", "def total_value(attribute = nil)\n per_unit = block_given? ? yield : @node.public_send(attribute)\n per_unit * @number_of_units\n end", "def max_attribute_value(xml_node, selector, attr_name, query_method: T.unsafe(nil)); end", "def get_attr(attribute)\n @top_level_object[attribute]\n end", "def [](attr_name)\n read_attribute(attr_name)\n end", "def val(document, attribute)\n document.public_send(attribute) ||\n raise(\"#{ document.inspect } has no #{ attribute.inspect } value\")\n end", "def attributes\n node[1]\n end", "def attribute(name)\n @attributes[name.to_sym]\n end", "def [](attr_name) \n read_attribute(attr_name)\n end" ]
[ "0.83067316", "0.8283919", "0.8283919", "0.7901861", "0.78216064", "0.7587308", "0.7465562", "0.74578124", "0.7332146", "0.7314536", "0.7304191", "0.7230568", "0.70928967", "0.7020404", "0.6947947", "0.69438", "0.69315314", "0.69215864", "0.68275833", "0.6819721", "0.6816775", "0.67981255", "0.6728914", "0.6673497", "0.6673497", "0.66603935", "0.6658225", "0.66431296", "0.66084015", "0.66076475", "0.65988845", "0.655527", "0.65341717", "0.6532705", "0.6492532", "0.647132", "0.6455515", "0.64550066", "0.64476717", "0.63683593", "0.6356524", "0.63558733", "0.6346141", "0.6341076", "0.63282996", "0.6323962", "0.6293594", "0.6266478", "0.6251918", "0.62505627", "0.62380606", "0.6223621", "0.62108845", "0.6195204", "0.6195204", "0.61934185", "0.61819875", "0.6173649", "0.61595607", "0.61310107", "0.6102437", "0.6098846", "0.6098846", "0.60913014", "0.6088396", "0.6085854", "0.60846704", "0.6050733", "0.6049827", "0.6042344", "0.60388625", "0.60237014", "0.60237014", "0.6018358", "0.60114896", "0.5996389", "0.5992272", "0.5980335", "0.59764886", "0.59747607", "0.5970714", "0.5966853", "0.59564376", "0.59452313", "0.59439963", "0.59331846", "0.5931737", "0.5931737", "0.59261316", "0.59135747", "0.5912406", "0.58968925", "0.5892167", "0.58824897", "0.58691025", "0.58628476", "0.5852304", "0.58513844", "0.58497155", "0.58432937" ]
0.7726517
5
Returns the parent of the current node
def parent return parent_of @current_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent\n unless @node.send(@parent).nil?\n @node = @node.send(@parent)\n end\n end", "def parent_node(node)\n return node.respond_to?(:parent) ? node.parent : node\n end", "def parent_of node\n\t\treturn is_valid(node) ? node.parent : nil\n\tend", "def parent\n tree.parent_for(parent_id).first\n end", "def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end", "def get_parent\n return nil\n end", "def parent\n return nil unless catalog\n\n unless defined?(@parent)\n if parents = catalog.adjacent(self, :direction => :in)\n # We should never have more than one parent, so let's just ignore\n # it if we happen to.\n @parent = parents.shift\n else\n @parent = nil\n end\n end\n @parent\n end", "def parent\n self.node && self.node.parent && self.node.parent.content\n end", "def parent(node)\n value = node.value\n parent_node = nil\n current_node = @root\n while (current_node)\n if value > current_node.value\n parent_node = current_node #always keep a pointer to the parent\n #before traversing down\n current_node = current_node.right\n elsif value < current_node.value\n parent_node = current_node\n current_node = current_node.left\n else\n return parent_node\n end\n end\n nil\n end", "def parent_node(node)\n node.find(:xpath, '..', wait: 0, visible: false)\n end", "def parentNode\n nil\n end", "def parent\n if parent_id.blank? then nil else unscoped_find(parent_id) end\n end", "def parent(node)\n parent = adjacent(node, :direction => :in)\n raise JumokuError, \"Inconsistent directed tree (more than one parent for the node!)\" if parent.size > 1\n parent.empty? ? nil : parent.first\n end", "def parent\n return @parent\n end", "def parent\n return @links[:parent]\n end", "def parent\n parents.empty? ? nil : parents[0]\n end", "def parent\n nil\n end", "def parent\n @parent\n end", "def parent\n @parent\n end", "def parent\n @parent\n end", "def parent\n @parent\n end", "def ultimate_parent # note: ultimate parent is self, not nil, if self has no parent...\n if parent_id.blank?\n self\n else\n parent.ultimate_parent\n end\n end", "def get_parent_tagname\n self.parent_tagname.present? ? self.parent_tagname : nil\n end", "def get_parent_tagname\n self.parent_tagname.present? ? self.parent_tagname : nil\n end", "def parent\n _parent\n end", "def parent\n ltree_scope.find_by \"#{self.class.table_name}.#{ltree_path_column} = SUBPATH(?, 0, NLEVEL(?) - 1)\", ltree_path,\n ltree_path\n end", "def parent_id\n\n h.parent_id ?\n Ruote::FlowExpressionId.new(h.parent_id) :\n nil\n end", "def parent(node_id)\n node_id >> 1 # node_id / 2\n end", "def parent(of_node, level = 1)\n ancestor = of_node\n until level.zero?\n ancestor = ancestor.parent\n level -= 1\n end\n return ancestor\n end", "def parent\n ancestors.last\n end", "def parent\n if self.rep_parent.nil?\n if self.parent_id.nil?\n return nil\n else\n return Activity.find(self.parent_id)\n end\n\n else\n return self.rep_parent.parent\n end\n end", "def get_parent\n note = self\n return Note.first(:id=>note.parent)\n end", "def parent\n \tif self.parent_id == -1\n \t\treturn nil\n \telse\n \t\treturn Category.find(self.parent_id)\n \tend\n end", "def parent\n self.parents.where('forestify_level = ?', self.forestify_level - 1).first\n end", "def parent\n self.class.find_by_id(self.parent_id) unless self.parent_id.nil?\n end", "def parent\n @parent ||= Object.module_eval(self.source_xml.parent.name).new(:source_xml => self.source_xml.parent)\n rescue\n nil\n end", "def parent parent\n @menu.parent parent\n end", "def parent(node, root = nil)\n root ||= @root\n raise IndexError, 'can not get parent for unrooted tree' unless root\n unless ret = _get_cached_parent(node, root) then\n ret = self.path(root, node)[-2]\n _cache_parent(node, ret, root)\n end\n ret\n end", "def parent\n @parent\n end", "def parent\n @parent\n end", "def get_parent\n\n get_expression_pool.fetch_expression(@parent_id)\n end", "def parent_notebook\n return @parent_notebook\n end", "def parent_notebook\n return @parent_notebook\n end", "def parent_notebook\n return @parent_notebook\n end", "def parent_of(post)\n posts.find { |t| t.id == post.parent_post }\n end", "def parent\n nil\n end", "def parent\n @parent ||= new_or_create? ? find_parent_by_id : lookup_parent_from_child\n end", "def parent\n has_parent? and history.first\n end", "def parent\n return @parent unless @parent.nil?\n return Message.find(parent_id) unless parent_id.nil?\n end", "def parent\n @parent ||= self.class.current_parent_block_helper\n end", "def parent_name\n parent_info && parent_info.name\n end", "def parent\n p = (@context.parent.nil? || (@context == @context.parent)) ? nil : R2Doc.all_references[parent_name]\n # guard against pollution of all_references with methods having conflicting names\n (p.respond_to?(:is_method_context?) && p.is_method_context?) ? nil : p\n end", "def current_parent\n\t Parent.where(id: session[\"parent_id\"]).first\n\tend", "def previous_node\n peer = nil\n if !parent.nil? and parent.respond_to?(:children)\n index = parent.children.index(self)\n peer = index > 0 ? parent.children[index - 1] : nil\n end\n peer\n end", "def tree_parent_node\n tree_parent + \".adoc\"\n end", "def TreeView_GetParent(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TreeViewGetNextItem[:PARENT]) end", "def parent(path)\n return nil if (path.strip.empty?) or (path == '/')\n p_path = File.dirname(path)\n nodes = lookup(p_path, nil, false, false, true)\n pair = nodes.select{ |p| p[0] == :document }.first\n pair ||= nodes.first\n pair.last\n end", "def parent_tag\n return nil unless within_open_tag?\n\n @tags_list.last\n end", "def the_parent(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.parent\n else\n \"<strong>Error:</strong> No parent information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end", "def parent\n @parent ||= resource.decorate.parent\n end", "def parent\n if @resource[:parent] =~ /^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/\n gindex = $ngs.index { |i| i['id'] == @resource[:parent] }\n $ngs[gindex]['id']\n else\n @property_hash[:parent]\n end\n end", "def parent\n o = Object.const_get(parent_model) rescue nil\n o && o.get(parent_id)\n end", "def parent\n\t\tpardn = self.parent_dn or return nil\n\t\treturn self.class.new( self.directory, pardn )\n\tend", "def parent\n @parent ||= begin\n parent_id = data[\"parentId\"]\n client.categories.find(parent_id) if parent_id\n end\n end", "def parent\n self\n end", "def parent\n\t\tself.residue_at_position(@parent_position)\n\tend", "def tree_parent\n return @tree_parent if @tree_parent\n @tree_parent = File.dirname tree\n @tree_parent = '' if @tree_parent == '.'\n tree_parent\n end", "def node\r\n\t\t\tparent\r\n\t\tend", "def parent\n return @parent if defined?(@parent)\n\n @parent = nil\n\n @parent = issue.parent if issue\n end", "def parent_id\n self.parent._id.to_s\n end", "def parent\n owner\n end", "def parent()\n bag.get(bag.parent(path))\n end", "def parent_id\n data[:parent_id]\n end", "def parent_id\n object[\"parent_id\"]\n end", "def parent\n dataset.nested.filter(self.primary_key => self.parent_id).first if self.parent_id\n end", "def parent_name\n @parent ? @parent.full_name : '(unknown)'\n end", "def parent\n if @obj.parent\n LazyEvaluator.new(@obj.parent)\n else\n nil\n end\n end", "def parent\n @parent ||= @parent_id ? @book.find_account_by_id(@parent_id) : nil\n end", "def get_parent(generation_level)\n return self if root? || generation_level <= 0\n parent.get_parent(generation_level-1)\n end", "def predecessor\n siblings.previous(self) || parent\n end", "def parent\n self\n end", "def get_pointer_from_parent(tree_node)\n parent = tree_node.parent\n return nil unless parent\n pointer = tree_node.value > parent.value ? :@right : :@left\n end", "def parent_id\n self[self.nested_set_options[:parent_column]]\n end", "def parent\n parent_path = @location.parent_path\n \n if parent_path.nil?\n nil\n else\n begin\n self.class.find(@conn_id, parent_path)\n rescue Errors::FolderNotFound, parent_path\n nil\n end\n end\n end", "def parent\n case\n when root? then nil\n else\n require 'pathname' unless defined?(Pathname)\n if path = Pathname.new(self.path).parent\n uri = self.dup\n uri.path = path.to_s\n uri.path << '/' unless uri.root?\n uri\n end\n end\n end", "def parent\n folder || @list\n end", "def parent_relative_left\n left - (parent.try(:left) || 0)\n end", "def root_parent\n if parent\n parent.root_parent\n else\n self\n end\n end", "def parent(node_index)\n return -1 if (node_index < 0) || (node_index > @count)\n return (node_index - 1)/2\n end", "def parent\n return nil if @path == '/'\n unless @path.to_s.empty?\n new_for_path ::File.split(@path).first\n end\n end", "def find_parent_node\n @parent_node ||= Node.find(params[:parent_node_id]) if params[:parent_node_id]\n end", "def parent\n self + '..'\n end", "def parent_menu_item_name\n menu_options[:parent]\n end", "def parent\n SideJob.find(SideJob.redis.get(\"#{redis_key}:parent\"))\n end", "def parent_list\n self.parent_lists[0]\n end", "def return_to_parent\n @current_node = @current_node.parent.parent\n # @current_node.depth = @current_node.depth - 1\n end", "def parent=(parent_node); end", "def parent=(parent_node); end", "def find_element_parent(el_depth, index, ordering)\n\t\ti = index - 1\n\t\twhile i >= 0 #until the beginning\n\t\t\tif ordering[i].model == \"Node\" #if it's a node, not just a note\n\t\t\t\tcurr_node = Node.find(ordering[i].id)\n\t\t\t\tif el_depth > curr_node.depth #if curr_node has a lesser depth, it's its parent\n\t\t\t\t\treturn curr_node\n\t\t\t\tend\n\t\t\tend\n\t\t\ti = i-1\n\t\tend\n\t\treturn nil #if no parent found\n\tend", "def parent\n @parent ||= Wayfinder.for(file_set).parent\n end" ]
[ "0.82663214", "0.8248503", "0.8191364", "0.81071085", "0.804401", "0.78610647", "0.77705085", "0.7767879", "0.7737364", "0.76905674", "0.7676077", "0.7650954", "0.7615633", "0.7582549", "0.7560485", "0.74919134", "0.7448836", "0.7413001", "0.7413001", "0.7413001", "0.7413001", "0.738639", "0.7374023", "0.7374023", "0.7365968", "0.7357052", "0.7345054", "0.7338793", "0.73166686", "0.7236034", "0.7235401", "0.72156644", "0.71971065", "0.71773344", "0.71698976", "0.7167744", "0.7161392", "0.71575546", "0.71443003", "0.71443003", "0.7129325", "0.71166617", "0.71166617", "0.71166617", "0.711015", "0.7107211", "0.71006453", "0.7100337", "0.70813054", "0.703216", "0.7031795", "0.7020861", "0.7010508", "0.69985366", "0.6988515", "0.6987808", "0.69771314", "0.6975759", "0.6971439", "0.6954456", "0.6954136", "0.6938803", "0.69313514", "0.6908713", "0.69076544", "0.68984854", "0.6896311", "0.6892933", "0.6887104", "0.6883877", "0.6878568", "0.68661755", "0.6859835", "0.68526995", "0.6847987", "0.6830407", "0.6825124", "0.6820739", "0.6816012", "0.6810365", "0.68103445", "0.6794697", "0.6769453", "0.67584616", "0.67566735", "0.6756339", "0.6740574", "0.6736414", "0.6726102", "0.67205745", "0.671951", "0.67130256", "0.6692349", "0.66840786", "0.6675423", "0.66747636", "0.66696286", "0.66696286", "0.66662663", "0.6666251" ]
0.8939264
0