query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
6eaaaadcbb7741a0f844fb5ba4332566
GET /sections/1 GET /sections/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "10d9d4f2c8964e30ebc2af07d1542af4", "score": "0.7490356", "text": "def sections\n title = params[:id]\n page = Page.new(title)\n sections = page.sections\n respond_with sections\n end", "title": "" }, { "docid": "79e79aacb0453d37f1a43e560e4bb6dc", "score": "0.74402905", "text": "def show\n @sections = Section.where(home_id: params[:id])\n puts \"\\n\\n\\tSECTIONS!!!!! : #{@sections}\\n\"\n @sections\n # render json: @sections\n render \"show.json.jbuilder\"\n end", "title": "" }, { "docid": "e2f253039f4b92c531dfc5cad4fefb42", "score": "0.7426184", "text": "def index\n \n @sections = @day.sections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "title": "" }, { "docid": "d9a9b1dab7c654d223eec7195ad33e6b", "score": "0.74187773", "text": "def show\n @section = @day.sections.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end", "title": "" }, { "docid": "5bc5f53a7a3fd4224977f4370a2aa008", "score": "0.7353803", "text": "def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end", "title": "" }, { "docid": "5bc5f53a7a3fd4224977f4370a2aa008", "score": "0.7353803", "text": "def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end", "title": "" }, { "docid": "36384fb7bdda6e1dae2a0fa38bc56c70", "score": "0.7333986", "text": "def index\n @sections = current_user.sections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "title": "" }, { "docid": "f494a6e3c2b65224a113b3c1df9942ac", "score": "0.73283696", "text": "def show\n \n @section = Section.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n \n end", "title": "" }, { "docid": "781996d84998f0d9f95898991cf0b39c", "score": "0.71119857", "text": "def index\n @sections = @survey.sections\n respond_with( @sections )\n end", "title": "" }, { "docid": "4f70ef8fa0d502170ff504fd22fb79d6", "score": "0.7099356", "text": "def get_section\n #@section = Section.find(params[:section_id])\n @section = Section.all\n end", "title": "" }, { "docid": "e8e5862631de57ad3a53a4fbcbcf8e00", "score": "0.7086875", "text": "def index\n @sections = Section.find(:all)\n end", "title": "" }, { "docid": "5addf047d8e0049ffe5ec568e12c139e", "score": "0.70714724", "text": "def index\n @sections = Section.all\n end", "title": "" }, { "docid": "5addf047d8e0049ffe5ec568e12c139e", "score": "0.70714724", "text": "def index\n @sections = Section.all\n end", "title": "" }, { "docid": "5addf047d8e0049ffe5ec568e12c139e", "score": "0.70714724", "text": "def index\n @sections = Section.all\n end", "title": "" }, { "docid": "5addf047d8e0049ffe5ec568e12c139e", "score": "0.70714724", "text": "def index\n @sections = Section.all\n end", "title": "" }, { "docid": "7f2f16506de88f09b104625a86678752", "score": "0.7016443", "text": "def sections\n respond_with @page.sections\n end", "title": "" }, { "docid": "13060032601435c1293c8a44bf7bfe46", "score": "0.69888407", "text": "def show\n @section = Section.find(params[:id])\n\n render json: @section\n\n rescue ActiveRecord::RecordNotFound\n render json: {message: 'Resource not found'}, status: 404\n\n end", "title": "" }, { "docid": "166d45ca89fcb93d66c9070e644c0223", "score": "0.6985394", "text": "def index\n @sections = Section.all\n end", "title": "" }, { "docid": "8230158cd356c4b7f728be40e9611e3c", "score": "0.69100994", "text": "def show\n @section_view = SectionView.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_view }\n end\n end", "title": "" }, { "docid": "91432d83549ffe6892597021a7c78a5b", "score": "0.6904205", "text": "def index\n @section = Section.first\n end", "title": "" }, { "docid": "c2572c8d9d0723d95756351dfc935d7d", "score": "0.6853733", "text": "def index\n @sections = @course.sections.all\n end", "title": "" }, { "docid": "cb995b2e3714e166063980f59bb6b88f", "score": "0.6849034", "text": "def show\n @researchsection = Researchsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @researchsection }\n end\n end", "title": "" }, { "docid": "4e69b322a232d79e787ae842c5631dc5", "score": "0.6839324", "text": "def index\n @course_sections = CourseSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @course_sections }\n end\n end", "title": "" }, { "docid": "33e3b6c5949d9a45e672e4c655cec6ab", "score": "0.68364656", "text": "def show\n @section_title = SectionTitle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_title }\n end\n end", "title": "" }, { "docid": "5d81976d32c0ae3d9b4e61ab496ccda3", "score": "0.6803275", "text": "def find_course_sections\n department = params[:department]\n number = params[:number]\n courses = Course.find_all_by_department_long_and_number(department, number)\n @sections = []\n courses.each do |course|\n @sections << course.section unless course.section == \"\" or @sections.include?(course.section)\n end\n respond_to do |format|\n format.json { render :json => @sections }\n end\n end", "title": "" }, { "docid": "d66c8aa8c8405facb3232c23b22ea00f", "score": "0.6792925", "text": "def show\n @about_section = AboutSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @about_section }\n end\n end", "title": "" }, { "docid": "06c5cf0dde67e79a259121adc3f8b9e0", "score": "0.67882466", "text": "def index\n @about_sections = AboutSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_sections }\n end\n end", "title": "" }, { "docid": "4bf1d45e4235a453f9618210d347acf9", "score": "0.67870533", "text": "def sections\n @sections ||= {id: 'SECTION_1'}\n end", "title": "" }, { "docid": "f6845581ac13cc98fd6bccb89d9cea91", "score": "0.6779759", "text": "def show\n @section_type = SectionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_type }\n end\n end", "title": "" }, { "docid": "0ccaf1b153ca9099f0e78aebdb94785a", "score": "0.6773533", "text": "def show\n @page_section = Admin::PageSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_section }\n end\n end", "title": "" }, { "docid": "cc17ea145c40c947af333ecd7ee8c309", "score": "0.6771969", "text": "def get_org_unit_sections(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/#{org_unit_id}/sections/\"\n _get(path)\n # returns a JSON array of SectionData blocks in the Fetch form\nend", "title": "" }, { "docid": "e9ec05828b11a2eae8a9068f8cb0b5ea", "score": "0.67667615", "text": "def index\n @sections = @semester.sections.find(:all)\n end", "title": "" }, { "docid": "8f4394ad3b71b91ee0a3051e7c96f74f", "score": "0.67548627", "text": "def index\n @api_v2_dashboard_sections = Api::V2::Dashboard::Section.all\n end", "title": "" }, { "docid": "cea6207564e5c3ca68a1aae55cab4ca9", "score": "0.67535585", "text": "def get_sections\n @academic_class = AcademicClass.find(params[:id]) unless params[:id].blank?\n list = @academic_class.sections.includes(:profile).map {|u| Hash[value: u.id, name: u.profile.firstname]}\n render json: list\n end", "title": "" }, { "docid": "3243ba64e018b4ea8de8caf832b316df", "score": "0.67522585", "text": "def index\n \n load_quiz\n load_sections\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "title": "" }, { "docid": "065187a5122dde3d18b478a0335f4ed6", "score": "0.6749637", "text": "def for_sectionid\n @sections = Section.find( :all, :conditions => [\" schoolyear_id = ?\", params[:id]] ).sort_by{ |k| k['name'] }\n respond_to do |format|\n format.json { render :json => @sections }\n end\n end", "title": "" }, { "docid": "cf1efbc537dff8c242ae04bd61126e36", "score": "0.67446774", "text": "def index\n @section = Section.new\n @sections = Section.all\n end", "title": "" }, { "docid": "10edaf3186932f8c48877a2b8eb9dc33", "score": "0.6744181", "text": "def show\n @sub_section = SubSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sub_section }\n end\n end", "title": "" }, { "docid": "ab38f45ad01b4b9cd27df4a89d9973fb", "score": "0.6741432", "text": "def program_index\n @sections = Section.where(program_id: params[:program_id])\n render \"api/sections/_index\"\n end", "title": "" }, { "docid": "4d7dc49aa3d640a34399d1d8c867e10f", "score": "0.67157316", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_type }\n end\n end", "title": "" }, { "docid": "9c8099f0ea93db4d985acd1f65cd7cac", "score": "0.6687042", "text": "def show\n @section = Section.find(params[:id])\n end", "title": "" }, { "docid": "3488176c0be696c671cfc09002decbf3", "score": "0.6673473", "text": "def show\n @top_section = TopSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @top_section }\n end\n end", "title": "" }, { "docid": "4fb480b81b6c4d3a2397b03b08893544", "score": "0.6670049", "text": "def get_sections(opts = {})\n data, _status_code, _headers = get_sections_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "e34043d7588f8640e8f5ffcb7468bbe0", "score": "0.6660689", "text": "def get_sections_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DataApi.get_sections ...\"\n end\n # resource path\n local_var_path = \"/sections\"\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?\n query_params[:'ending_before'] = opts[:'ending_before'] if !opts[:'ending_before'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth']\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 => 'SectionsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataApi#get_sections\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "1d44b54acace61c682d0ad527a96009a", "score": "0.66497153", "text": "def index\n @sections = Section.all\n if(params[:course_id])\n @sections = Section.where(:course_id => params[:course_id])\n end\n\n respond_to do |format|\n if !session[:user_id]\n format.html {redirect_to home_url, notice: 'You must be logged in to access that page!'}\n else \n format.html # index.html.erb\n # format.json { render json: @sections }\n end\n end\n end", "title": "" }, { "docid": "3090411a95316e1aff9800dd4467579e", "score": "0.6611869", "text": "def sections\n @sections = current_user.company.pages.find_by(id: params[:page_id]).sections()\n render\n end", "title": "" }, { "docid": "13accd735fb6147f6a22ede69a2a52e9", "score": "0.6600566", "text": "def show\n @sections=Section.all\n @paragraph = Paragraph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @paragraph }\n end\n end", "title": "" }, { "docid": "9ef9c00bc22fc3bc23ebdae5d9771749", "score": "0.65955967", "text": "def show\n @user_section = UserSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_section }\n end\n end", "title": "" }, { "docid": "46d5e8749b2a41785232f678c30197c9", "score": "0.65875727", "text": "def index\n @resume_sections = ResumeSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resume_sections }\n end\n end", "title": "" }, { "docid": "7e9c2518444f619f39e56a5c621968f6", "score": "0.65663147", "text": "def index\n if params[:book_id].blank? && params[:id].blank?\n @sections = Section.all\n else\n book_id = params[:id] ? params[:id] : params[:book_id]\n @sections = Section.find_all_by_book_id(book_id)\n @book = Book.find(book_id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "title": "" }, { "docid": "89619665585ea5e2c7df767dd92a2a3a", "score": "0.655559", "text": "def index\n if params[:section_id]\n @exercise_texts = ExerciseText.find_all_by_section_id(params[:section_id])\n @section = Section.find(params[:section_id])\n else\n @exercise_texts = ExerciseText.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_texts }\n end\n end", "title": "" }, { "docid": "f6b66d377efdde9343d0de1f42051268", "score": "0.65516984", "text": "def sections\n @sections\n end", "title": "" }, { "docid": "aa6e431a88733b70e14a4f83f0210868", "score": "0.6550827", "text": "def index\n # @stories = Story.find(:all)\n # I want to allow accessing stories both directly and through the section, like so:\n # milancommunity.com/sports/local-athletes-playing-in-ncaa\n # milancommunity.com/local-athletes-playing-in-ncaa\n # but I'm not sure how to do that here, so I'll just go with doing it through sections for now\n # maybe just: if there's no section, then @stories = Story.find(:all).... ok later I'll try that\n @stories = @section.stories.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end", "title": "" }, { "docid": "d97b2992d8cfd067a7cce973712892c6", "score": "0.65429205", "text": "def show\n @course = Course.find(params[:course_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_section }\n end\n end", "title": "" }, { "docid": "89dffebdca0b389cd5c41fc0bab5de9a", "score": "0.6533336", "text": "def index\n @sections = @test_paper.sections # Section.all\n end", "title": "" }, { "docid": "503a545f8111d2b37a86f5b57c1f4fd0", "score": "0.65196514", "text": "def index\n @service_sections = ServiceSection.all\n end", "title": "" }, { "docid": "cb81b8ec46daeef692bee1130f48bfa1", "score": "0.6508178", "text": "def view_section\n id = Integer(params[:id])\n @section = Section.find(id)\n end", "title": "" }, { "docid": "8058b6df1ebafff96c6965454e2b9965", "score": "0.6499912", "text": "def section\n @section = Section.find_by_guid(params[:guid])\n render :action => 'index'\n end", "title": "" }, { "docid": "74644843efbd6f043c18db9a798575cd", "score": "0.6455793", "text": "def show\n @section = @encyclopaedia.sections.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end", "title": "" }, { "docid": "7670a69a5f5f57a461760cebd05e1317", "score": "0.6454842", "text": "def overview\n @section = @current_user.project.sections.find params[:id]\n render :layout => false\n end", "title": "" }, { "docid": "dd5453117d82109fdee899066ac2ac0c", "score": "0.6453952", "text": "def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end", "title": "" }, { "docid": "e09486ac81301bf6075c0497804c3aed", "score": "0.6444761", "text": "def index\n @user_sections = UserSection.order('user_id ASC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_sections }\n end\n end", "title": "" }, { "docid": "70ecc3c9601b740dda4262edcf9416a0", "score": "0.64380014", "text": "def show\n @section = @learning_module.sections.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end", "title": "" }, { "docid": "8451e8c3cb3be21fb92a5bb9bcdaed1a", "score": "0.6428042", "text": "def show\n @photo = Photo.find(params[:id])\n\t@sections=Section.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @photo }\n end\n end", "title": "" }, { "docid": "dbfe6f460f6bb5ec0d9fbf65ddcd4425", "score": "0.642188", "text": "def show\n @yearbook = current_yearbook\n @sections = current_yearbook.sections.includes(:spreads => [:left_page, :right_page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yearbook }\n end\n end", "title": "" }, { "docid": "89de0dda47dcf9cbbd9758a1f45b721e", "score": "0.6421427", "text": "def show\n @resume_section = ResumeSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resume_section }\n end\n end", "title": "" }, { "docid": "41ed8b577253afe23bee5ec98da1ff7c", "score": "0.6419236", "text": "def index\n \t@guide = Guide.find(params[:guide_id])\n @guide_sections = GuideSection.find_all_by_guide_id(params[:guide_id], :order => \"display_order ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guide_sections }\n end\n end", "title": "" }, { "docid": "26e846c1cfca47671eeb03c9d57de085", "score": "0.6416699", "text": "def get_sections_for_roadmap(id)\n url = \"#{@api_base_path}/roadmaps/#{id}/sections\"\n\n handle_timeouts do\n response = self.class.get(url, headers: auth_header)\n convert_response(response, \"section\")\n end\n end", "title": "" }, { "docid": "8543597ce0f4beb8bb590d5aff55733c", "score": "0.640454", "text": "def index\n @sections = current_course.sections.includes(:students)\n end", "title": "" }, { "docid": "b25909d40280aa7809b1db8c5ca92828", "score": "0.6400668", "text": "def index\n @sections = current_account.sections.scope_search(search).paginate(pagination_params)\n respond_with @sections\n end", "title": "" }, { "docid": "18c7ee079444b3d01efd3fe195964acf", "score": "0.6373047", "text": "def index\n\t\t@sections=Section.all\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.js {}\n\t\tend\n\tend", "title": "" }, { "docid": "f6709b9a132a5f612e1921483a83ba53", "score": "0.6372923", "text": "def find_sections section_coll, section_ids\n query = section_ids[0]\n query = { '$in' => section_ids } if section_ids.length > 1\n\n res = section_coll.find(\n { section_id: query },\n { fields: {_id: 0, 'meetings.start_seconds' => 0, 'meetings.end_seconds' => 0} }\n ).map { |e| e }\n\n # is returning the single object without [] weird? should we return the array without []?\n if section_ids.length == 1\n return res[0]\n end\n\n if !res\n halt 404, {\n error_code: 404,\n message: \"Section with section_id #{section_ids[0]} not found.\",\n available_sections: \"https://api.umd.io/v0/courses/sections\",\n docs: \"http://umd.io/courses\"\n }.to_json\n end\n\n return res\n end", "title": "" }, { "docid": "3db287eda70015a4b9052667b4038c83", "score": "0.6370212", "text": "def index\n @sections = []\n CatalogSection.all.each do |cs|\n @sections.push({:name => cs.name, :key => (cs.key.blank?) ? cs.id : cs.key, :items => Item.find_all_by_section_id(cs.id)})\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "title": "" }, { "docid": "e5cd6ce767f14d59980173e2933d2e50", "score": "0.6360377", "text": "def show\n @section = @semester.sections.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @section }\n end\n end", "title": "" }, { "docid": "54817214259b0b65e6e2bdf98f4e6462", "score": "0.6359871", "text": "def show\n @members_section = MembersSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @members_section }\n end\n end", "title": "" }, { "docid": "d4c3d0dc797b388b8d8a2cd8ea360a0c", "score": "0.63585687", "text": "def index\n @page = Page.friendly.find(\"141\")\n @sections = @page.sections.published.sorted\n end", "title": "" }, { "docid": "125411a9d2fc1d058955ca5fa6f6f5d8", "score": "0.63556314", "text": "def index\n @sections = @semester.sections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @sections }\n end\n end", "title": "" }, { "docid": "c58ae016df1cf09b0269cfa9b361f362", "score": "0.6353862", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guide_section.as_json(:root => true) }\n end\n end", "title": "" }, { "docid": "c58ae016df1cf09b0269cfa9b361f362", "score": "0.6353862", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guide_section.as_json(:root => true) }\n end\n end", "title": "" }, { "docid": "36b95c7b494552a1c6a7d629fddab5bf", "score": "0.6345247", "text": "def section(id)\n self.request_sections.find_by_section_id(id)\n end", "title": "" }, { "docid": "d4f09925d3e37c8f9594bfe77dc2c94e", "score": "0.63393986", "text": "def index\n @sections = filtered_sections\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end", "title": "" }, { "docid": "456a384b7d0df0853a6b4c6f4f2a4f50", "score": "0.6330429", "text": "def index\n @guide_sections = GuideSection.page(params[:page]).per_page(100)\n @guide_sections = @guide_sections.where(\"id IN (?)\", params[:ids]) unless params[:ids].blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => {:guide_sections => @guide_sections.as_json(:root => false)} }\n end\n end", "title": "" }, { "docid": "b406dde2eb59ff14d91a7b5465c2d0ed", "score": "0.6329155", "text": "def show\n \n load_quiz\n load_section\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end", "title": "" }, { "docid": "68b9e47b765a7a9e5e023fb88866452c", "score": "0.6324729", "text": "def index\n @section_types = SectionType.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_types }\n end\n end", "title": "" }, { "docid": "aac806251ab903a115daf4c831c90820", "score": "0.63204795", "text": "def get_section_data(org_unit_id, section_id)\n path = \"/d2l/api/lp/#{$lp_ver}/#{org_unit_id}/sections/#{section_id}\"\n _get(path)\n # returns a SectionData JSON block in the Fetch form.\nend", "title": "" }, { "docid": "900cc0a67840b107d0e554a79e85293a", "score": "0.632004", "text": "def show\n section = params[:section_id]\n end", "title": "" }, { "docid": "84b8a9d4897abec0feade0d6cc15360f", "score": "0.6308476", "text": "def get_sections_for_student_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DataApi.get_sections_for_student ...\"\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 DataApi.get_sections_for_student\"\n end\n # resource path\n local_var_path = \"/students/{id}/sections\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?\n query_params[:'ending_before'] = opts[:'ending_before'] if !opts[:'ending_before'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth']\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 => 'SectionsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataApi#get_sections_for_student\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a1754defc03e67636b845bb58d0120fb", "score": "0.630702", "text": "def sections\n @sections ||= site.sections.index_by(&:path)\n end", "title": "" }, { "docid": "74877616152351c385c363faa5c0db1f", "score": "0.6303199", "text": "def show\n @academic_class = AcademicClass.includes(:profile,:sections).find(params[:id])\n @sections = @academic_class.sections.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @academic_class }\n end\n end", "title": "" }, { "docid": "d326c9b59e689bc0e07d2e7bdfe95f65", "score": "0.6296897", "text": "def show\n @cvsection = Cvsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvsection }\n end\n end", "title": "" }, { "docid": "62fe7bf1b2e75c5a1708c56f3d5969f1", "score": "0.6290637", "text": "def show\n @section = Section.where(:slug => params[:section_slug]).first\n @exercise = @section.exercises.where(:slug => params[:exercise_slug]).first\n @course = @section.course\n @sections = Section.all\n\n unless @exercise && @section\n not_found\n end\n end", "title": "" }, { "docid": "bf6c295dfbad9282ce8e783f13221c09", "score": "0.62883925", "text": "def index\n @csas = Csa.all\n @csas = Csa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csas }\n end\n end", "title": "" }, { "docid": "767981b4cac91adf3d5e353e7c354ce2", "score": "0.626306", "text": "def get_section(section_id)\n self.sections.find { |s| s.id == section_id }\n end", "title": "" }, { "docid": "3c46047d55b5c648474baf2aaad19cd3", "score": "0.625404", "text": "def index\n @sections = Section.all.includes(:students)\n end", "title": "" }, { "docid": "8c4309939c7520c78bd0ace70e45d452", "score": "0.62475497", "text": "def index\n @cms_sections = CmsSection.all\n end", "title": "" }, { "docid": "0877c7c9617e412cdd3bbdf6931fcde8", "score": "0.6237269", "text": "def list_sections(opts = {})\n data, _status_code, _headers = list_sections_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "0877c7c9617e412cdd3bbdf6931fcde8", "score": "0.6237269", "text": "def list_sections(opts = {})\n data, _status_code, _headers = list_sections_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "e952ffed7e5bf15fa668ec190489899b", "score": "0.6234627", "text": "def new\n @section = Section.find(params[:section_id])\n @subsection = @section.subsections.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subsection }\n end\n end", "title": "" }, { "docid": "7f6097e7b781f6061cb2fb11297a8c8f", "score": "0.62110835", "text": "def get_sections_for_school_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DataApi.get_sections_for_school ...\"\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 DataApi.get_sections_for_school\"\n end\n # resource path\n local_var_path = \"/schools/{id}/sections\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?\n query_params[:'ending_before'] = opts[:'ending_before'] if !opts[:'ending_before'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth']\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 => 'SectionsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataApi#get_sections_for_school\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "0f807be364bd3db44d3a90d6894acac5", "score": "0.6200435", "text": "def show\n @catalog_section = CatalogSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @catalog_section }\n end\n end", "title": "" }, { "docid": "7f58ca091adac3f562c8b7368cd0a084", "score": "0.61992455", "text": "def index\n @subsections = Subsection.all\n end", "title": "" } ]
90712335c2493451d00ef2d0a91535a5
Get the count of matching documents in the database for the context.
[ { "docid": "b6d106a4cd9567cee1012e955849e4c4", "score": "0.0", "text": "def count(extras = false)\n if extras\n self.total\n else\n super()\n end\n end", "title": "" } ]
[ { "docid": "b59bb4eb758abe120fa52218357bce53", "score": "0.72153544", "text": "def count\n find().count\n end", "title": "" }, { "docid": "fcb525b871fad7d416b90cb495e301e9", "score": "0.71755373", "text": "def count\n documents.length\n end", "title": "" }, { "docid": "c03ff13b7212ec56a2e19dc1e9c49ad8", "score": "0.71739197", "text": "def count\n @count ||= collection.find(selector, find_options).count\n end", "title": "" }, { "docid": "d6ac127254035e0d3c8a0adb1cecade9", "score": "0.7137123", "text": "def count\n query.count\n end", "title": "" }, { "docid": "e3e6e6c1b97b301f03fcd2198aa6fa03", "score": "0.7106515", "text": "def count\n query.count\n end", "title": "" }, { "docid": "c1ab1fa28da3276a01756fc4e4653563", "score": "0.7067821", "text": "def count\n command = OrderedHash[\"count\", @collection.name,\n \"query\", @query.selector]\n response = @db.db_command(command)\n return response['n'].to_i if response['ok'] == 1\n return 0 if response['errmsg'] == \"ns missing\"\n raise OperationFailure, \"Count failed: #{response['errmsg']}\"\n end", "title": "" }, { "docid": "5b5546f20fc2ca6402614c5e5cf76d2f", "score": "0.7039623", "text": "def count\n find.count\n end", "title": "" }, { "docid": "a3d7989625adc6d659cc74df59e4eba8", "score": "0.7035411", "text": "def count\n @count ||= @query.count\n end", "title": "" }, { "docid": "36a7999b800b200aa7179ba367f2b8e6", "score": "0.702146", "text": "def count\n design_doc.view('by_subject_predicate_object_context', :key=>\"\\u9999\")['total_rows'] \n end", "title": "" }, { "docid": "951c218c011ec86610a93a27b9cb78e9", "score": "0.6968947", "text": "def count\n @resource.get[\"doc_count\"]\n end", "title": "" }, { "docid": "e3e348d62883d29facc4c20ab74b88f2", "score": "0.6962599", "text": "def num_hits\n if object.params[:q]&.!=('*:*') || object.params[:fq]\n I18n.t 'search.index.num_hits_found', count: object.num_hits\n else\n I18n.t 'search.index.num_documents_database', count: object.num_hits\n end\n end", "title": "" }, { "docid": "a0115e019d25ae5df5b22572a81e06d2", "score": "0.69350284", "text": "def document_count\n @document_count ||= Document.count(:conditions => {:organization_id => id})\n end", "title": "" }, { "docid": "fe35a53921b995449838aeaaa797a33b", "score": "0.6931397", "text": "def count\n document_store.count\n end", "title": "" }, { "docid": "97ad59bc51b3cfc3ca4890c042df21f7", "score": "0.6916849", "text": "def count\n find.count\n end", "title": "" }, { "docid": "f39b26fb2238c179123fe860882c5fe0", "score": "0.6914605", "text": "def count(options={})\n criteria = criteria_from(options[:conditions],options[:criteria]).merge!(where_func(options[:where]))\n begin\n collection.find(criteria).count()\n rescue => ex\n if ex.to_s =~ /Error with count command.*ns missing/\n # Return 0 because we will graciously assume that we are being\n # called from a subclass that has been initialized properly, and\n # is therefore mentioned in the schema.\n 0\n else\n raise ex\n end\n end\n end", "title": "" }, { "docid": "183476d0baaac46f1f099e3b46743926", "score": "0.6889712", "text": "def count\n @target.count_by @where_clauses, search_parameters\n end", "title": "" }, { "docid": "797301a3a4e207581e2082a36bcbe286", "score": "0.68886095", "text": "def documents_count\n Api::Web::V1::DocumentsQuery.new(scope, { contact_id: object.id, contact_type: object.class.to_s }).get_documents_count\n end", "title": "" }, { "docid": "34f89b8cc59ceca7f1871c94e2b6c658", "score": "0.6878897", "text": "def count_all\n result = connection.get(\"/#{database_name}\")\n JSON.parse(result)['doc_count'].to_i\n end", "title": "" }, { "docid": "f5bdb6e8059df54a12d2c3af5628b94b", "score": "0.6855004", "text": "def count\n @count ||= if with_default_scope.path_decision == :solr\n with_default_scope.count_via_solr\n else\n with_default_scope.count_via_cql\n end\n end", "title": "" }, { "docid": "6871e4507a527f8dadf268b4c5732e60", "score": "0.6814667", "text": "def count\n @count ||= @klass.collection.find(@selector, @options.dup).count\n end", "title": "" }, { "docid": "7ffefd0ed3b559e19ca7916d552098fa", "score": "0.67951983", "text": "def count\n connection.get(\"select\", params: { q: query })[\"response\"][\"numFound\"].to_s.to_i\n end", "title": "" }, { "docid": "b02162a18c1f82ab38ca4e7b5d1e4984", "score": "0.67615384", "text": "def document_count\n @document_count ||= self.documents.count\n end", "title": "" }, { "docid": "cc2c87ba4dadb4e476cb8c5623d9a59d", "score": "0.673041", "text": "def count(*args)\n find_by,options = build_options(args)\n return self.model.count(options)\n end", "title": "" }, { "docid": "ac4ba45e8fff9c2ac02b212f389c9e8e", "score": "0.6689499", "text": "def number_of_stored_documents(db_name, mapping)\n s = Tire.search db_name, :search_type => 'count' do\n query { term :_type, mapping }\n end\n s.results.total\nend", "title": "" }, { "docid": "79f7d7fdcfd797691d7c631f2b6c3741", "score": "0.6670211", "text": "def count\n raise(\"No context has been set. Probably need to run cdq.setup\") unless context\n with_error_object(0) do |error|\n context.countForFetchRequest(fetch_request, error:error)\n end\n end", "title": "" }, { "docid": "81f191c5fe61add4891351eb46ef3b9e", "score": "0.6600674", "text": "def matched_count\n return 0 unless acknowledged?\n if upsert?\n 0\n else\n n\n end\n end", "title": "" }, { "docid": "308fbe956b81e939bdac500964a2b5be", "score": "0.65889376", "text": "def count\r\n @query.count\r\n end", "title": "" }, { "docid": "e5655d365f1613e4a18f914c81b8e936", "score": "0.6583398", "text": "def count(*args)\n coll.count(*args)\n end", "title": "" }, { "docid": "957f2e43c5bd693ca749f69ba68ea5c2", "score": "0.65716183", "text": "def count(options={})\n query = Query.new(repository, self, options)\n repository.count(query)\n end", "title": "" }, { "docid": "5cb5915f6c5696a7a532dc6b7cee885a", "score": "0.6552414", "text": "def count\n target.select { |doc| doc.persisted? }.size\n end", "title": "" }, { "docid": "fa142840a3fbb2cb0de29aecc3a08f71", "score": "0.65522486", "text": "def count_matches\n query = <<-SQL\n SELECT COUNT(*) as count FROM #{analysis_table_name};\n SQL\n\n xact.exec(query) do |pg_results|\n return pg_results[0][\"count\"].to_i\n end\n end", "title": "" }, { "docid": "043cedf26da28300f734e7b056ecae33", "score": "0.6550661", "text": "def count\n collection.count\n end", "title": "" }, { "docid": "06e345ce7569dd3eaafadb7b99fbb994", "score": "0.65486884", "text": "def count(selector={})\n @db.count(@name, selector || {})\n end", "title": "" }, { "docid": "7e87ec4c386a20bdc9ce647f2fcb48de", "score": "0.65246934", "text": "def doc_count\n @docs.length\n end", "title": "" }, { "docid": "08101249b49bc428a7d7f16d7301256d", "score": "0.6524187", "text": "def get_count\n\n result = @connection.exec(\n %[\n SELECT count(#{pk_field})\n FROM \"#{@entity_config[:dst][:schema]}\".\"#{@entity_config[:dst][:table]}\"\n WHERE #{get_filter.join(' AND ')}\n ]\n ).to_a[0]\n\n if result.nil?\n 0\n else\n result['count'].to_i\n end\n\n end", "title": "" }, { "docid": "d68ad9008439f42f969165610f042a6e", "score": "0.64975756", "text": "def count_documents(index, query, *schemas)\n get_documents(index, query, {:fields => '@count'}, *schemas)\n end", "title": "" }, { "docid": "333fd8bbb4741435343c1c6c6a22ba8c", "score": "0.64932436", "text": "def query_7\n document_ids = Document.pluck(:id)\n return document_ids.size\nend", "title": "" }, { "docid": "ae97c3401aa64019465d9fbea96f2546", "score": "0.64725274", "text": "def num_hits_string\n if result.params[:q]&.!=('*:*') || result.params[:fq]\n I18n.t 'search.index.num_hits_found', count: result.num_hits\n else\n I18n.t 'search.index.num_documents_database', count: result.num_hits\n end\n end", "title": "" }, { "docid": "ec378f81edb1a1e7bc94b867190c85a8", "score": "0.64710927", "text": "def all_documents_count\n Api::Web::V1::DocumentsQuery.new(scope, { client_id: object.id }).get_all_documents_count\n end", "title": "" }, { "docid": "b6f93e9ca2d978cd20e5d72aca0716c4", "score": "0.64554346", "text": "def count(collection)\n @db_inst[collection].count()\n end", "title": "" }, { "docid": "beebc28639243694fc1e934a769e17e6", "score": "0.645459", "text": "def count\n hits.count\n end", "title": "" }, { "docid": "44cbaf4dc89cfc3c56bfd69baa42338e", "score": "0.64526784", "text": "def count(query)\n \n # Build the conditions\n conditions = build_conditions(query.conditions)\n \n num_of_docs = 0\n \n num_of_docs, duration_ms = execute_and_chrono do \n with_connection do |connection|\n begin\n database = connection.db(options[:database])\n num_of_docs = database[query.model.storage_name].count({:query => conditions})\n rescue\n Persistence.logger.fatal('Persistence') {\"ERROR COUNTING #{resource.model} #{conditions.inspect if conditions} #{$!}\"} if Persistence.logger\n raise \n end\n end\n end\n \n Persistence.logger.debug('Persistence') {\" (#{'%1.5f' % duration_ms}) COUNTING in #{query.model} #{conditions.inspect if conditions}\"} if Persistence.logger\n \n num_of_docs\n \n end", "title": "" }, { "docid": "6f6558861a45835aa51977bf68ca8ff7", "score": "0.6442931", "text": "def count(entity, query)\n super\n mongo[entity].count(:query => query)\n end", "title": "" }, { "docid": "ab14bb6c7a6a42fe6ce87125cb827bb9", "score": "0.6440716", "text": "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "title": "" }, { "docid": "cad9a0b815cbebae9592bbf496aafc12", "score": "0.6433667", "text": "def count(**constraints)\n query(constraints).count\n end", "title": "" }, { "docid": "290089bbb9aba09297ec52f729ebe1c1", "score": "0.64117414", "text": "def total_num_documents\n return UserDocument.find(:all, :conditions => [\"user_id = ?\", self.id]).size\n end", "title": "" }, { "docid": "900945032ae8c74bc02e2d9e2eb38531", "score": "0.6408093", "text": "def count(*args)\n compiled_query = self.class.compile_query(queries)\n compiled_query.any? ? layout.count(*compiled_query) : layout.total_count\n end", "title": "" }, { "docid": "b6edc8e1247c8a8ad6d887c9bf42b9be", "score": "0.6393004", "text": "def count(field=nil, options={})\n find(:all, options).size\n end", "title": "" }, { "docid": "41d895397ae4aeb8fe9be40505f19049", "score": "0.6387961", "text": "def num_docs\n @@client[:documents].count\n end", "title": "" }, { "docid": "41d895397ae4aeb8fe9be40505f19049", "score": "0.6387961", "text": "def num_docs\n @@client[:documents].count\n end", "title": "" }, { "docid": "8929b9c8bb979b33abd1447cef4839b0", "score": "0.63864255", "text": "def count(params={})\n self.adaptor.count(self, params)\n end", "title": "" }, { "docid": "49e4671dfb0a19e50833e4639d12662c", "score": "0.6383552", "text": "def count\n Ecore::db[table_name].count\n end", "title": "" }, { "docid": "e3dbc380c7c4e7762af3723e068b20fd", "score": "0.63725257", "text": "def count\n client.count(\n index: index_name,\n body: { query: generated_query[:query] }\n )['count']\n end", "title": "" }, { "docid": "ac4cca6498dd00b17253bed6f5e5009d", "score": "0.63593924", "text": "def record_count\n @db_index.size\n end", "title": "" }, { "docid": "9706e9276d65a773f6afdb2cff02fd28", "score": "0.6348105", "text": "def count\n @total_count || @collection.size\n end", "title": "" }, { "docid": "83297533d734df4843426234b6931bf2", "score": "0.6347658", "text": "def count **args\n orientdb.count_records from: self, **args\n end", "title": "" }, { "docid": "8a24bb27fbfa63134430488fea4167cc", "score": "0.6345926", "text": "def count\n url_chunk = \"#{entity_set.name}/$count?#{assemble_criteria}\" # TODO: escape GET params\n entity_set.service.execute(url_chunk).body.to_i\n end", "title": "" }, { "docid": "9f098972ac19d117b796f1df63ba441e", "score": "0.6333806", "text": "def count\n pquery.count\n end", "title": "" }, { "docid": "576ec466426edaff938e16c3ac0555b1", "score": "0.63326305", "text": "def count\n @collection.count\n end", "title": "" }, { "docid": "576ec466426edaff938e16c3ac0555b1", "score": "0.63326305", "text": "def count\n @collection.count\n end", "title": "" }, { "docid": "576ec466426edaff938e16c3ac0555b1", "score": "0.63326305", "text": "def count\n @collection.count\n end", "title": "" }, { "docid": "f10738eb5b87ac59bca027dabc9e1f36", "score": "0.6326414", "text": "def count_documents(opts = {})\n opts = @options.merge(opts) unless Mongo.broken_view_options\n pipeline = [:'$match' => filter]\n pipeline << { :'$skip' => opts[:skip] } if opts[:skip]\n pipeline << { :'$limit' => opts[:limit] } if opts[:limit]\n pipeline << { :'$group' => { _id: 1, n: { :'$sum' => 1 } } }\n\n opts = opts.slice(:hint, :max_time_ms, :read, :collation, :session, :comment)\n opts[:collation] ||= collation\n\n first = aggregate(pipeline, opts).first\n return 0 unless first\n first['n'].to_i\n end", "title": "" }, { "docid": "0ae09ea7e31ccefb483f1bbb81efb65e", "score": "0.63239014", "text": "def query_count (&block)\n\n prepare_query { |q|\n q.pk_only # improve efficiency, since we have to do the query\n }.count\n end", "title": "" }, { "docid": "d2c72087d6b71a319b09c470b799b080", "score": "0.63233614", "text": "def count_regs\n cve_colls = get_collections\n num = 0\n cve_colls.each do |coll|\n count = @db[\"#{coll}\"].count().to_i\n #puts coll + ' - ' + count.to_s\n num += count\n end\n #puts '[MongoCVE][count_regs] Total documents: ' + num.to_s\n end", "title": "" }, { "docid": "6d2a573802122796f0d91c880b28d38f", "score": "0.6314831", "text": "def count\n old_value = @count\n @count = 1\n res = client.find_objects(@table, compile.as_json, _opts).count\n @count = old_value\n res\n end", "title": "" }, { "docid": "d86942ceae416ff8751deec9779fc398", "score": "0.63138145", "text": "def recs(qry: {})\n @coll.find(qry).count\n end", "title": "" }, { "docid": "3ce14fcda6038209882ecf5baf1a93ae", "score": "0.6297725", "text": "def count\n records = self.all\n records.nil? ? 0 : records.length\n end", "title": "" }, { "docid": "0c83b173be61e8322b33babcee219926", "score": "0.6297334", "text": "def count\n\t\tall.count\n\tend", "title": "" }, { "docid": "fba6159aaa6a7564b1c0ad9254259883", "score": "0.6289018", "text": "def matched_count\n results.map(&:matched_count).reduce(&:+)\n end", "title": "" }, { "docid": "dca153d648010997aa0e55aa1f4c97fe", "score": "0.6288788", "text": "def length\n @collection.find.count.to_i\n end", "title": "" }, { "docid": "add98dac64c9c8bc5a93e7b26ff5eed5", "score": "0.62879723", "text": "def total_count\n @total_count ||= self.query.count\n end", "title": "" }, { "docid": "add98dac64c9c8bc5a93e7b26ff5eed5", "score": "0.62879723", "text": "def total_count\n @total_count ||= self.query.count\n end", "title": "" }, { "docid": "6ad3620eab8f94a3b1daeae664de6cb5", "score": "0.6279508", "text": "def count(*args, &block)\n if args || block\n @model.reactive_count(*args, &block)\n else\n cursor = add_query_part(:count)\n\n cursor.persistor.value\n end\n end", "title": "" }, { "docid": "87d0a1a26e7d14be693c9c12e937d5b3", "score": "0.6279205", "text": "def total_count\n query_results.total_count\n end", "title": "" }, { "docid": "9b3122c7fa4240b253cceb0841931b26", "score": "0.62779635", "text": "def count(options = {}, &block)\n return super(&block) if block_given?\n\n if valid_for_count_documents?\n view.count_documents(options)\n else\n view.count(options)\n end\n end", "title": "" }, { "docid": "ad4cecca0b0ea64843e6132c132b2102", "score": "0.6272451", "text": "def count\n \n return @objects.count\n \n end", "title": "" }, { "docid": "4e04239492cfb0101abd9a0d34ec678f", "score": "0.6264226", "text": "def count\n service.execute(\"#{name}/$count\").body.to_i\n end", "title": "" }, { "docid": "7e5e52ca1b6e31bca83918b9d2bcbbde", "score": "0.62636334", "text": "def n_matched\n return 0 unless acknowledged?\n @replies.reduce(0) do |n, reply|\n if upsert?(reply)\n reply.documents.first[N] - n_upserted\n else\n if reply.documents.first[N]\n n += reply.documents.first[N]\n else\n n\n end\n end\n end\n end", "title": "" }, { "docid": "978aed974bad870860216de64974b110", "score": "0.6259746", "text": "def count\n begin\n binding = client.query(\"SELECT COUNT(*) WHERE { ?s ?p ?o }\").first.to_hash\n binding[binding.keys.first].value.to_i\n rescue SPARQL::Client::MalformedQuery => e\n # SPARQL 1.0 does not include support for aggregate functions:\n count = 0\n each_statement { count += 1 } # TODO: optimize this\n count\n end\n end", "title": "" }, { "docid": "88e133a14f17a7935c542b2c6f16ea79", "score": "0.6258802", "text": "def count\n (field('count') || 0).to_i\n end", "title": "" }, { "docid": "b4728e54c8174f8d4d81004ff423850f", "score": "0.62454015", "text": "def count(*args)\n prepare_for_find_or_count(:count, args)\n super(*args)\n end", "title": "" }, { "docid": "d7a02fccf166ecc585acf4c10064a957", "score": "0.624385", "text": "def count(extras = false)\n if cached?\n @count ||= collection.find(selector, process_options).count(extras)\n else\n collection.find(selector, process_options).count(extras)\n end\n end", "title": "" }, { "docid": "3bfb5569e5a5d867cebcccdbaa2a4cbc", "score": "0.62426144", "text": "def count\n binding = client.query(\"SELECT (COUNT(*) AS ?no) { ?s ?p ?o }\").first.to_hash\n binding[binding.keys.first].value.to_i\n end", "title": "" }, { "docid": "252ed990b0eae673250d210c4f65744c", "score": "0.62293315", "text": "def count_for(resource)\n\t\tself.find(resource).count\n\tend", "title": "" }, { "docid": "30cf9cf9354239ca903498dbd160729e", "score": "0.6225803", "text": "def count\n self.records.objects.find { |o| o.name == \"count\" }.val\n end", "title": "" }, { "docid": "cb4ab4f0e61c74defe5283747dcd5ceb", "score": "0.62203807", "text": "def active_count\n collection.count(query: { 'state' => 'running' })\n end", "title": "" }, { "docid": "2dac9f103ecaef8e3d33c0f94061ce19", "score": "0.62191224", "text": "def get_full_count\n model.count(:id, @options)\n end", "title": "" }, { "docid": "68b0ac1047ac97ae3c2cc109d1318818", "score": "0.62168115", "text": "def count # must use self.all instead of @@all\n self.all.size\n end", "title": "" }, { "docid": "2239e86b02d5cf23714b47a19f9adcbe", "score": "0.6215317", "text": "def count(query)\n count_results(make_query(query)) \n end", "title": "" }, { "docid": "eebfd101e28b6bdfb4260aec199d765c", "score": "0.6213392", "text": "def count\n return @count\n end", "title": "" }, { "docid": "e148b91ef77a05d67829f311452ce6d0", "score": "0.62099934", "text": "def count\n @results.size\n end", "title": "" }, { "docid": "e9345290fbe7cac0b20973ef305a89d6", "score": "0.61999995", "text": "def count\n collection.length\n end", "title": "" }, { "docid": "459607b72e6ba108c05281a000d8c6cb", "score": "0.6195292", "text": "def count\n self.class.collection_builder_strategy.count(self)\n end", "title": "" }, { "docid": "48d502067953d564490034389c1dd67c", "score": "0.6187326", "text": "def count\n count = field('count')\n count.to_i\n end", "title": "" }, { "docid": "32de98464947c77c3d77f531a02f61c6", "score": "0.6186719", "text": "def count(params=nil)\n if params\n where(params).length\n else\n all.length\n end\n end", "title": "" }, { "docid": "d0f6810c20106836b8e7c77ad3735b08", "score": "0.6181568", "text": "def count\n\t\t\tself.all.size\n\t\tend", "title": "" }, { "docid": "9e9dc469df41ccb16fbf64cedfcbe2f4", "score": "0.61812705", "text": "def count(skip_and_limit = false)\n response = RequestResponse.new\n command = BSON::OrderedHash[\"count\", @collection.name, \"query\", @selector]\n\n if skip_and_limit\n command.merge!(BSON::OrderedHash[\"limit\", @limit]) if @limit != 0\n command.merge!(BSON::OrderedHash[\"skip\", @skip]) if @skip != 0\n end\n\n command.merge!(BSON::OrderedHash[\"fields\", @fields])\n\n cmd_resp = @db.command(command)\n\n cmd_resp.callback { |doc| response.succeed( doc['n'].to_i ) }\n cmd_resp.errback do |err|\n if err[1] =~ /ns missing/\n response.succeed(0)\n else\n response.fail([OperationFailure, \"Count failed: #{err[1]}\"])\n end\n end\n\n response\n end", "title": "" }, { "docid": "686eb8b4b11ac0fbe13818883106852d", "score": "0.61773247", "text": "def getCount\n r = @db.view('app/count')\n return 0 if r['rows'].size != 1\n r['rows'].first['value']\n rescue\n# pp $!\n nil\n end", "title": "" }, { "docid": "543a3d96978b9438da9621923063fcbb", "score": "0.6177026", "text": "def n_matched\n return 0 unless acknowledged?\n @replies.reduce(0) do |n, reply|\n if upsert?(reply)\n reply.documents.first[N] - n_upserted\n else\n if reply.documents.first[N]\n n += reply.documents.first[N]\n else\n n\n end\n end\n end\n end", "title": "" }, { "docid": "a2435dcf49811639814722ea577e3c33", "score": "0.6165157", "text": "def count **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n query.projection 'COUNT(*)'\n result = get_records raw: true, query: query\n result.first[\"COUNT(*)\"] rescue 0 # return_value\n end", "title": "" }, { "docid": "5fe309cafc789f56df41e61d7edb8fed", "score": "0.6163986", "text": "def query_count (&block)\n\n q = prepare_query { |q|\n q.pk_only # improve efficiency, since we have to do the query\n }\n q.count\n ensure\n q.free if q\n end", "title": "" } ]
1705fe103c6d864558b31bc635eb67ae
An object that will track the current size of the stack and the maximum size of the stack for this instruction sequence. source://syntax_tree//lib/syntax_tree/yarv/instruction_sequence.rb163
[ { "docid": "7b0c83a4d6a320271517b44bfe0ab629", "score": "0.6096078", "text": "def stack; end", "title": "" } ]
[ { "docid": "7c6784af8cc226f480eff779a8abebf7", "score": "0.7734198", "text": "def stack_size; end", "title": "" }, { "docid": "e130c2e31ccc29c818516136004d063e", "score": "0.7282221", "text": "def size\n @current_block.instance_eval { @stack }\n end", "title": "" }, { "docid": "e130c2e31ccc29c818516136004d063e", "score": "0.7282221", "text": "def size\n @current_block.instance_eval { @stack }\n end", "title": "" }, { "docid": "a93de5a67c6a800180fafdaea62de3ee", "score": "0.7272528", "text": "def size\n @stack.length\n end", "title": "" }, { "docid": "9ed19b42192ae6b24f06b8dc07097e8b", "score": "0.7254894", "text": "def size\n @stack.size\n end", "title": "" }, { "docid": "c9e2ad14633fd0e746013986e6512185", "score": "0.72429055", "text": "def size\n @stack.size\n end", "title": "" }, { "docid": "c9e2ad14633fd0e746013986e6512185", "score": "0.72429055", "text": "def size\n @stack.size\n end", "title": "" }, { "docid": "c9e2ad14633fd0e746013986e6512185", "score": "0.72429055", "text": "def size\n @stack.size\n end", "title": "" }, { "docid": "c68bf8ad2a359fc23e9289dcf23be39e", "score": "0.70816314", "text": "def size\n \t@stack.size\n end", "title": "" }, { "docid": "27ea6409d4524838735b55e1429892d0", "score": "0.6979647", "text": "def length\n @the_stack.length\n end", "title": "" }, { "docid": "12e04d85aa548dedef599e4f8fd3a2df", "score": "0.6911051", "text": "def length\n @stack.length\n end", "title": "" }, { "docid": "f3713a62ea68e7242ea22ea25f32d3a4", "score": "0.67865145", "text": "def size()\n @stack.count\n end", "title": "" }, { "docid": "50b0c3e0908c203b3ea652c76398533d", "score": "0.674389", "text": "def length\n return @stack.length\n end", "title": "" }, { "docid": "00d07cdcae71b2ccd6ddf8af87bc26e4", "score": "0.67127985", "text": "def op_size(stack)\n stack.push([stack.last.bytesize].pack('C*'))\n stack\n end", "title": "" }, { "docid": "89806ccd7106cc182f29db3e195e6296", "score": "0.6505462", "text": "def stack_produced\n @opcode_info[:stack].last\n end", "title": "" }, { "docid": "2fbbae7ecaae231ec085aa007f24ec43", "score": "0.63188404", "text": "def stack_consumed\n @opcode_info[:stack].first\n end", "title": "" }, { "docid": "0a42a483ef5a20860ec9f5a6d66d621a", "score": "0.6303381", "text": "def level\n @stack.size\n end", "title": "" }, { "docid": "4ca393aa83b624110eccf15dd3508080", "score": "0.6299828", "text": "def count\n return @stack.size\n end", "title": "" }, { "docid": "65a3b2d08f1920a9cc2b0f8b6e8897f0", "score": "0.6274778", "text": "def stack_index; end", "title": "" }, { "docid": "b8c5c3aa66b2b4c1c9489c9737a3a6a6", "score": "0.62546396", "text": "def count\n\t\t@stack.length\n\tend", "title": "" }, { "docid": "46ca35031b6b920f90ca8cdaaccb8244", "score": "0.62507397", "text": "def stack; @stack; end", "title": "" }, { "docid": "d385e639ceb4dc8260bf282f770038ee", "score": "0.6213927", "text": "def size\n instruction.size\n end", "title": "" }, { "docid": "9610feb45d9569c1a5eaf601e5a30091", "score": "0.62025845", "text": "def current_size; end", "title": "" }, { "docid": "ee2fec0e8c7ffa56b6b453b2d30b2f74", "score": "0.6190827", "text": "def stack_top_size(i=0)\n i += 1\n @next_stack_element ? @next_stack_element.stack_top_size(i) : i\n end", "title": "" }, { "docid": "ed15de7c851719370ba80bcdb00f79b5", "score": "0.6170307", "text": "def size\n instructions.size\n end", "title": "" }, { "docid": "146a29a3b875c4bba00946fa7d798bcc", "score": "0.61680317", "text": "def maximum_variable_inspect_size=(_arg0); end", "title": "" }, { "docid": "eba9207e0ba42fd5eff24f08bb4f724c", "score": "0.603456", "text": "def size\n @top\n end", "title": "" }, { "docid": "856cc480e4ea1d0b21fee2cf50f040c5", "score": "0.60333836", "text": "def stack_ll; end", "title": "" }, { "docid": "d959273c063c70f3a268816d33fe85b7", "score": "0.6025022", "text": "def maximum_variable_inspect_size; end", "title": "" }, { "docid": "bd175ad32b9a10dd473cb32f5b5a31ea", "score": "0.6008051", "text": "def - bytes\n Fisk::M64.new(REG_BP, (@stack.length * @sizeof_sp) - bytes)\n end", "title": "" }, { "docid": "cf6e550b14e4889e744ce663293de75c", "score": "0.59620154", "text": "def depth\n @stack.length\n end", "title": "" }, { "docid": "bece66cabf419b1cc8407ae92ea39bb8", "score": "0.5903966", "text": "def size\n @opcode_info[:args].size + 1\n end", "title": "" }, { "docid": "c2225e4770ee053259decee5b3d53caa", "score": "0.58787006", "text": "def test_size_stack\n @stack.push(7)\n @stack.push(8)\n assert_equal 2, @stack.size?\n end", "title": "" }, { "docid": "bde60855e0fd0170562d9a692593aa64", "score": "0.58553344", "text": "def stack_bottom_size(i=0)\n i += 1\n @prev_stack_element ? @prev_stack_element.stack_bottom_size(i) : i\n end", "title": "" }, { "docid": "305474c1124f61adbf58362daf18b1da", "score": "0.5813931", "text": "def stack\n @stack ||= Array.new\n end", "title": "" }, { "docid": "745a4241b439404a266f999b4f8cf29d", "score": "0.57985145", "text": "def initialize(max_size)\n @stack = []\n @max_size = max_size\n @values = []\n end", "title": "" }, { "docid": "b22abb388cab5ff73334924252d66a6a", "score": "0.5761753", "text": "def stack_contents\n (0...stack_pointer.value).map do |n|\n @stack_memory.read_word(n)\n end\n end", "title": "" }, { "docid": "d82e335f885022d50556f5c5c792a5aa", "score": "0.57591283", "text": "def initialize\n @stack = []\n end", "title": "" }, { "docid": "3a66efc4fb8df04e3b2ee03ae2bc8494", "score": "0.5723096", "text": "def stack_tail_version\n STACK_TAIL_VERSION\n end", "title": "" }, { "docid": "5081d18a44b2ea499e16726f001b3528", "score": "0.5717043", "text": "def width\n (@opcode_info[:args].size + 1) * InstructionSize\n end", "title": "" }, { "docid": "0b67faad23879f2ed59b393cdd972558", "score": "0.5708487", "text": "def return_stack\n initial_size = size\n dup_many initial_size\n make_array initial_size\n end", "title": "" }, { "docid": "351a0ac01f7d872a93d5b23aac25cd6e", "score": "0.5677652", "text": "def string_length\n\t\ta = @stack[@stack_index].pop\n\t\t@stack[@stack_index]<< a.to_s.length\n\tend", "title": "" }, { "docid": "a85b10a6120c7325596fdcb99e67bb47", "score": "0.5670309", "text": "def stack\n s = Thread.current.thread_variable_get(STACK_NAME)\n if s.nil?\n s = [{}]\n Thread.current.thread_variable_set(STACK_NAME, s)\n end\n return s\n end", "title": "" }, { "docid": "5a574e2bfb7dc6835a7837e21a4e4814", "score": "0.56693447", "text": "def stack_hh; end", "title": "" }, { "docid": "3619529a4c0e7a64f6acf18d5f380f35", "score": "0.56506056", "text": "def dead_size\n [10, 12][self.class.calls]\n end", "title": "" }, { "docid": "e2ce535e07e74bc3ed56449b5fd7741a", "score": "0.5634799", "text": "def size\n LLVM::Int64.from_ptr(C.LLVMSizeOf(self))\n end", "title": "" }, { "docid": "c8723c138c01d7b2531a75cab7b95f73", "score": "0.56259197", "text": "def instruction_size\n\t\t@ida.ua_mnem(@ea)\n\t\t@ida.cmd.size\n\tend", "title": "" }, { "docid": "ad70934a6c6618f419425a4d64b6cbc7", "score": "0.56121546", "text": "def stack; @stack ||= [] end", "title": "" }, { "docid": "6911965b360a4bca67eadc8338ef4a64", "score": "0.5595288", "text": "def get_max\n return @maxs_stack.peek\n end", "title": "" }, { "docid": "f86cd6c1981e870d512442519ab253d9", "score": "0.557532", "text": "def dead_size\n [10, 12][self.class.calls]\n end", "title": "" }, { "docid": "e6119b5d81f705b9429f92f2048c26d8", "score": "0.55577964", "text": "def stack; @stack ||= [{}]; end", "title": "" }, { "docid": "e6119b5d81f705b9429f92f2048c26d8", "score": "0.55577964", "text": "def stack; @stack ||= [{}]; end", "title": "" }, { "docid": "4bc959cf7ef749739579036a9552664b", "score": "0.5549075", "text": "def current_size\n @cached_size ||= [5.0, 5.0]\n end", "title": "" }, { "docid": "8b14163f240f05841daa6a734f45912a", "score": "0.5545846", "text": "def allocation_size=(value); end", "title": "" }, { "docid": "790312c3673d1c0925d25283fb3877fd", "score": "0.5535862", "text": "def stack(rsp, idx=-1)\n stk = rsp[-2 + idx].split\n raise \"no trace\" if stk[0] != 'TRACE'\n pstack = stk[8..-1].map { |n| @vc.vm.signed(n.to_i(16)) }\n if stk[7] =~ /\\[(\\d+)\\]/\n raise \"stack length mismatch\" if pstack.length != $1.to_i\n else\n raise \"could not parse stack length from #{stk.inspect}\"\n end\n pstack\n end", "title": "" }, { "docid": "f9b5abc0ac488c7025e2d5e60c1ddfe3", "score": "0.55352384", "text": "def stack\n @stack ||= []\n end", "title": "" }, { "docid": "f9b5abc0ac488c7025e2d5e60c1ddfe3", "score": "0.55352384", "text": "def stack\n @stack ||= []\n end", "title": "" }, { "docid": "80338cb0680373b0171e8d63db32c63c", "score": "0.55212647", "text": "def current_length; end", "title": "" }, { "docid": "09deba81073db37be13080dc99a20d07", "score": "0.55210924", "text": "def stack\n @stack ||= []\n end", "title": "" }, { "docid": "60d10e5f2e73f9e750416ba8745f3e02", "score": "0.5520396", "text": "def current_length=(_arg0); end", "title": "" }, { "docid": "7dc1bc8bcf73bf2d722c1f919e15e268", "score": "0.5509377", "text": "def size\n LLVM::Int64.from_ptr(C.size_of(self))\n end", "title": "" }, { "docid": "7dc1bc8bcf73bf2d722c1f919e15e268", "score": "0.5509377", "text": "def size\n LLVM::Int64.from_ptr(C.size_of(self))\n end", "title": "" }, { "docid": "24a8671155cf857d47cc5175f511919b", "score": "0.55037814", "text": "def + bytes\n Fisk::M64.new(REG_BP, (@stack.length * @sizeof_sp) + bytes)\n end", "title": "" }, { "docid": "fef4640a9727d86401fcd64cbe5a0d70", "score": "0.5488559", "text": "def info_stack\n @queue << \"i s\"\n end", "title": "" }, { "docid": "b914173a1d6f4ec3e8789626ef3f171a", "score": "0.5485354", "text": "def argument_size; end", "title": "" }, { "docid": "f9597eadcdac1ad66a1352cf8d47e83a", "score": "0.5479741", "text": "def spacing_stack; end", "title": "" }, { "docid": "f9597eadcdac1ad66a1352cf8d47e83a", "score": "0.5479741", "text": "def spacing_stack; end", "title": "" }, { "docid": "f9597eadcdac1ad66a1352cf8d47e83a", "score": "0.5479741", "text": "def spacing_stack; end", "title": "" }, { "docid": "cecdc69bf2697a6237d18418a36f2a8b", "score": "0.5477838", "text": "def size\n end_of_sequence - start_of_sequence\n end", "title": "" }, { "docid": "ab9f765fc3f5934beef15567dd0365c8", "score": "0.5476397", "text": "def spacing_stack=(_arg0); end", "title": "" }, { "docid": "ab9f765fc3f5934beef15567dd0365c8", "score": "0.5476397", "text": "def spacing_stack=(_arg0); end", "title": "" }, { "docid": "ab9f765fc3f5934beef15567dd0365c8", "score": "0.5476397", "text": "def spacing_stack=(_arg0); end", "title": "" }, { "docid": "7f1d8034250ad498b5f89816d45e2e1a", "score": "0.5476276", "text": "def on_stack_limit\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n\n return_value = OnStackLimitReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n string_literal35 = nil\n __NUMBER36__ = nil\n\n\n tree_for_string_literal35 = nil\n tree_for_NUMBER36 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 112:18: 'OnStackLimit' ! NUMBER\n string_literal35 = match( T__69, TOKENS_FOLLOWING_T__69_IN_on_stack_limit_302 )\n __NUMBER36__ = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_on_stack_limit_305 )\n tree_for_NUMBER36 = @adaptor.create_with_payload( __NUMBER36__ )\n @adaptor.add_child( root_0, tree_for_NUMBER36 )\n\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n\n end\n\n return return_value\n end", "title": "" }, { "docid": "0a494d5db13ddaf51fee4e948b4255e8", "score": "0.5470394", "text": "def initialize()\n @stack = []\n @min_stack = []\n end", "title": "" }, { "docid": "ea5fa07ec3ddbe52dc476ef436ceef29", "score": "0.54667896", "text": "def instruction_count\n @instruction_count\n end", "title": "" }, { "docid": "f98d3cf8abfca2d10c9364b211b2c41c", "score": "0.5464822", "text": "def instruction_width\n return self.class::InstructionWidth \n end", "title": "" }, { "docid": "65649b76498dbe01012840aa73fef954", "score": "0.54555976", "text": "def initialize()\n @stack = []\n end", "title": "" }, { "docid": "65649b76498dbe01012840aa73fef954", "score": "0.54555976", "text": "def initialize()\n @stack = []\n end", "title": "" }, { "docid": "f29fc5f0abeeb6f2a6a5b28370b5f01b", "score": "0.54538274", "text": "def frame_size\n end", "title": "" }, { "docid": "c33727d297ea423ac3ecc5a953b899b1", "score": "0.54433805", "text": "def current_size\n self.data.size\n end", "title": "" }, { "docid": "f079f201504570af9c0545ebd14a52c9", "score": "0.54401773", "text": "def size\n\t\t\t@sequence.size + @queue.size\n\t\tend", "title": "" }, { "docid": "33b40e81a1c8858d5715b5596d9e3a0d", "score": "0.54375553", "text": "def stack_next\n @next_stack_element\n end", "title": "" }, { "docid": "d186b905fa945b9a3aadfd07cfd72f82", "score": "0.54368764", "text": "def op_stack\n @op_stack ||= []\n end", "title": "" }, { "docid": "d1d4836e5924b32f8836427c6a05b1d0", "score": "0.5430521", "text": "def depth\n @sepstack ? @pstack.length : @sp - @sp0\n end", "title": "" }, { "docid": "5e1ddee17fcb10ad3939506735a4b410", "score": "0.5424729", "text": "def frame_size\n outer_dim_arr[0].to_i * outer_dim_arr[1].to_i if dim_type.outer_target == \"frame\" && outer_dim_arr.present? && outer_dim_arr.count == 2\n end", "title": "" }, { "docid": "bb375f5e800c1ba072750d851f7935be", "score": "0.54233575", "text": "def initialize\n @register = [0] * 16 # V0..VF\n @stack = Array.new\n end", "title": "" }, { "docid": "472a8012264f13a877e408826f53d7bf", "score": "0.53951204", "text": "def stack=(value)\n @stack = value\n end", "title": "" }, { "docid": "2312e401a8c94701975ebb0e5a480613", "score": "0.5387827", "text": "def original_size; end", "title": "" }, { "docid": "de61776bc2feb9342fff36386948939e", "score": "0.5381792", "text": "def raw_stack\n stack # Force cache refresh\n end", "title": "" }, { "docid": "21c140ac4bf10c86dcb277b5d819ac43", "score": "0.5379266", "text": "def length(&block)\n length = @stack.length\n yield length if not block.nil?\n return length\n end", "title": "" }, { "docid": "8fa5cac5af6a196c14cf348fec36d8d5", "score": "0.537225", "text": "def arg_size; end", "title": "" }, { "docid": "7340f0996db41230805c895c051e3c41", "score": "0.53675807", "text": "def size\n original_size * 2 - 1\n end", "title": "" }, { "docid": "6e098313f1be2d6cfdfd0e4b8fe9209e", "score": "0.5366724", "text": "def get_stack_arg(n)\n\t\t\t# FIXME: Win64\n\t\t\tself.utils.ptr_at(self.get_reg_value(:esp) + (n * 4))\n\t\tend", "title": "" }, { "docid": "e5ededbd2f77ebaaac53d556433750fb", "score": "0.5365792", "text": "def getSize\n\t\treturn @popSize\n\tend", "title": "" } ]
ce3e390338516b3995d000251e174485
Transaction request enables caller to execute public methods on this object provider.transaction_request(self) do |prov| prov.provider_method(params) prov.special_provider_method_that_needs_a_callback(callback, params) end
[ { "docid": "36ef337a83f001600955cdb0c4c652a5", "score": "0.60759556", "text": "def transaction_request(callback, &block)\n block.call(self)\n Rails.logger.debug \"transaction_request(Complete) for #{callback.class.name}\"\n true\n rescue Exception => e\n Rails.logger.debug \"transaction_request(EXCEPTION) #{e.class.name.to_s} #{e.message} #{e.backtrace[0..3].join(\"\\n\")}\"\n false\n end", "title": "" } ]
[ { "docid": "20092424c3c910b6e8285fa26f174d5f", "score": "0.5769548", "text": "def get_transaction(*params); raise('Stub or mock required.') end", "title": "" }, { "docid": "278f7a95f6f58d266bbd840858c3ea10", "score": "0.5696927", "text": "def transaction(&block)\n @fb_txns << Rubyfb::Transaction.new(@fb_cxn)\n super &block\n end", "title": "" }, { "docid": "e55dd37358a7c6d378736c16c723a641", "score": "0.56089026", "text": "def in_transaction(opts = {})\n yield\n end", "title": "" }, { "docid": "e2b95a9bae8be681521ed151f1e90ebc", "score": "0.56059664", "text": "def within_transaction; end", "title": "" }, { "docid": "e2b95a9bae8be681521ed151f1e90ebc", "score": "0.56059664", "text": "def within_transaction; end", "title": "" }, { "docid": "a4d4e970633925c32b3fe754d1ad2ced", "score": "0.55461746", "text": "def pre_c(callback)\n return unless Moguro.enabled?\n contract_handler.contract_arguments(callback)\n end", "title": "" }, { "docid": "9a9ec0588f01d2744c49e0f4b34dfb3e", "score": "0.5491471", "text": "def paypal_callback\n binding.pry\n\n # @user = User.find(params[:invoice]) rescue \"\"\n # if @user.present?\n # @transaction_detail = @user.transaction_details.new(\n # plan_id: params[:custom],\n # payer_id: params[:payer_id],\n # payer_email: params[:payer_email],\n # payment_date: params[:payment_date],\n # payment_status: params[:payment_status],\n # payment_fee: params[:payment_fee],\n # payment: params[:payment_gross],\n # payment_type: params[:payment_type],\n # mc_currency: params[:mc_currency],\n # first_name: params[:first_name],\n # last_name: params[:last_name],\n # txn_id: params[:txn_id],\n # receiver_id: params[:receiver_id],\n # receiver_email: params[:receiver_email],\n # address_name: params[:address_name],\n # address_street: params[:address_street],\n # address_city: params[:address_city],\n # address_state: params[:address_state],\n # address_country: params[:address_country],\n # address_country_code: params[:address_country_code],\n # address_zip: params[:address_zip]\n # )\n end", "title": "" }, { "docid": "a40385f5952135b56bb8d228efee43df", "score": "0.5437501", "text": "def gateway_callback(params,&block)\n\t\t## if its a new_record we don't do any callback, because the payment doesnt exist to check it .\n\t\t## if the user has passed in is_verify_payment, we still don;t do this callback, because \n\t\treturn if (self.new_record? || self.is_verify_payment == \"true\") \n\n\t\tyield if block_given?\n\tend", "title": "" }, { "docid": "accf7e4f9ff404ada98bb310ec78b61a", "score": "0.54301494", "text": "def get_transactions(*params); raise('Stub or mock required.') end", "title": "" }, { "docid": "198ff663562070ae200c990fe2d34b77", "score": "0.54202443", "text": "def authorize(transaction)\n raise \"implement #authorize in your class\"\n end", "title": "" }, { "docid": "260cf39704a5ea7094bc51eebcb8113e", "score": "0.5414457", "text": "def method_missing(*args)\n @real_txn.send(*args)\n end", "title": "" }, { "docid": "6dfa1ca8147d5582eeedc1a48049dfa3", "score": "0.5359353", "text": "def on_prepare_transaction_commit(unit, transaction); end", "title": "" }, { "docid": "a276fee6c11a1e150e7954277b7826bf", "score": "0.53386307", "text": "def authorize(money, e_wallet_source, payment_method_options = {})\n Spree::PAYONE::Logger.info \"Authorize process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.preauthorization_request\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, payment_method_options)\n set_e_wallet_request_parameters(request, e_wallet_source)\n set_amount_request_parameters(request, money, payment_method_options)\n set_order_request_parameters(request, payment_method_options)\n set_personal_data_request_parameters(request, payment_method_options)\n set_billing_request_parameters(request, payment_method_options)\n set_shipping_request_parameters(request, payment_method_options)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end", "title": "" }, { "docid": "e3cc0cb6e7209c646e1e65cf0b9cc9cb", "score": "0.5309499", "text": "def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end", "title": "" }, { "docid": "3068ffd2a2281410f16965a547042da3", "score": "0.53035456", "text": "def within_transaction(object); end", "title": "" }, { "docid": "11f830af7a28e3a91fcf2311c1d4f679", "score": "0.5297317", "text": "def callback\n\n end", "title": "" }, { "docid": "01f326f372aeacdc2b680e9c728586fb", "score": "0.52789223", "text": "def do_post_pre_auth_http(txn,merchant_id, merchant_key)\n # after a pre_auth you have to post the payment.\n sage_host = \"www.sagepayments.net\"\n sage_webservice_access_point = \"/cgi-bin/eftBankcard.dll?retail_transaction\"\n\n payload = {\n\n :M_id => merchant_id,\n :M_key => merchant_key,\n :T_amt => txn[:amount].to_i / 100.0 + txn[:tax].to_i / 100.0,\n :T_tax => txn[:tax].to_i / 100.0,\n :T_shipping => \"\",\n #:T_auth => txn[:auth_code],\n :T_reference => txn[:reference],\n :T_uti => txn[:ton],\n :T_device_id => @t_device_id,\n :T_application_id => @t_application_id,\n :T_code => '11'\n }\n resp = \"\"\n resp = do_webservice(sage_host, sage_webservice_access_point, payload)\n txn = create_credit_response_hash(resp)\n txn[:state] = case txn[:approval_indicator]\n when 'A' then :approved\n else :declined # TODO: Need some error checking here.\n end\n\n return txn\n end", "title": "" }, { "docid": "00c5e4ac764091a88c958cd4891ba822", "score": "0.5273812", "text": "def transaction(&block); end", "title": "" }, { "docid": "fb330afd23aa179326634130e8c58771", "score": "0.5247845", "text": "def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end", "title": "" }, { "docid": "20c0a1fb73120fd9051a812b9e8ad967", "score": "0.5247751", "text": "def use_transactions; end", "title": "" }, { "docid": "20c0a1fb73120fd9051a812b9e8ad967", "score": "0.5247751", "text": "def use_transactions; end", "title": "" }, { "docid": "83bd5a04fc146e509a1025dfd75a9899", "score": "0.52467376", "text": "def method_missing(name, *args, &block)\n if self.provider && provider.respond_to?(name)\n self.provider.send(name, *args, &block)\n else\n super(name, *args, &block)\n end\n end", "title": "" }, { "docid": "cafbd67e0f7c584b63bdd5fa2ad6085a", "score": "0.52324677", "text": "def register_request_callback(&block)\n request_callbacks << block\n end", "title": "" }, { "docid": "b4660ee164b5db9d7f39e6f38fa48e1b", "score": "0.52124727", "text": "def transaction(&block)\n yield\n end", "title": "" }, { "docid": "b4660ee164b5db9d7f39e6f38fa48e1b", "score": "0.52124727", "text": "def transaction(&block)\n yield\n end", "title": "" }, { "docid": "61eac54fe7f744dd61208134a07cf5e3", "score": "0.521199", "text": "def before_gateways(kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context = nil)\n end", "title": "" }, { "docid": "bce3e1d1089bf6d6722900bd3cac0f36", "score": "0.51810527", "text": "def callback\n end", "title": "" }, { "docid": "39180c387303b4c3643bade153141af8", "score": "0.5174916", "text": "def transaction(&block)\n block.call\n end", "title": "" }, { "docid": "8f4bd88da32a611457bfac8f90b5ab47", "score": "0.5170784", "text": "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", "title": "" }, { "docid": "dbbdb16f63771cbacdc411f846658f61", "score": "0.5151748", "text": "def call_provider(_value); end", "title": "" }, { "docid": "4ae611b5fdca2882a74f68b6f6edad70", "score": "0.5147363", "text": "def post_c(callback)\n return unless Moguro.enabled?\n contract_handler.contract_return_value(callback)\n end", "title": "" }, { "docid": "b04e39b9140b570da9946d488574bfe0", "score": "0.51449794", "text": "def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end", "title": "" }, { "docid": "bad80a375620730b43fe1b7ff6ab8219", "score": "0.51430815", "text": "def transaction_inject_with_http_info(rawtx, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction_inject ...'\n end\n # verify the required parameter 'rawtx' is set\n if @api_client.config.client_side_validation && rawtx.nil?\n fail ArgumentError, \"Missing the required parameter 'rawtx' when calling DefaultApi.transaction_inject\"\n end\n # resource path\n local_var_path = '/api/v1/injectTransaction'\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(['text/plain', 'application/json', 'application/xml'])\n header_params[:'rawtx'] = rawtx\n header_params[:'no_broadcast'] = opts[:'no_broadcast'] if !opts[:'no_broadcast'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'String' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction_inject\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ff98b6d9682cc8022e085b21caeadcf7", "score": "0.5141559", "text": "def transaction(model_class)\n raise \"you must override #transaction in an adapter subclass, it must yield\"\n end", "title": "" }, { "docid": "a2e96b65a310ae37b4c352a7384cd5f9", "score": "0.5136901", "text": "def delegate( txn, chain, *args )\n\t\t\tself.log.debug \"Delegating to chain: %p\" % [ chain ]\n\n\t\t\twith_authorization( txn, chain ) do\n\t\t\t\tyield( chain )\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "0d4efea218f2ecbba5a3ff05f9731744", "score": "0.5136342", "text": "def transaction(&blk)\n tap(&blk)\n end", "title": "" }, { "docid": "8e92176d2bf5def3d9826a35c5880e0f", "score": "0.51177907", "text": "def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "8e92176d2bf5def3d9826a35c5880e0f", "score": "0.51177907", "text": "def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "a60ba27ead23e31d07276274c717cd42", "score": "0.50843966", "text": "def callback\n\tend", "title": "" }, { "docid": "46f503bec1b99ada9d1b389f46184709", "score": "0.5057998", "text": "def pay_callback\n\t \torder = params[:order]\n\t \tif (order.present? and order[:status] != \"expired\")\n\t \t\tpayment = Payment.new({\n \t\t\t\tdocument_id: order[:custom],\n\t \t\t\tsigner_id: current_user.id,\n\t \t\t\tpayment_amount: order[:total_native][:cents],\n\t \t\t\tbitcoin_total_btc: order[:total_btc][:cents],\n\t \t\t\tbitcoin_total_native: order[:total_native][:cents],\n\t \t\t\tbitcoin_total_payout: order[:total_payout][:cents],\n\t \t\t\tbitcoin_transaction_id: order[:transaction][:id],\n\t \t\t\tbitcoint_receive_address: order[:receive_address],\n\t \t\t\tbitcoin_order_id: order[:id],\n\t \t\t\tbitcoin_status_order: order[:status]\n\t \t\t})\n\t \t\tpayment.save\n\t \tend\t\n\t \trender :text => \"OK\"\n\t end", "title": "" }, { "docid": "527cb082d64d9186d9affccbc65ee64f", "score": "0.50552523", "text": "def request_setup(method, path, params)\n Proc.new do |request|\n end\n end", "title": "" }, { "docid": "8ef77128fc49522abca134ca94bc1258", "score": "0.50423265", "text": "def send_global_request(type, *extra, &callback); end", "title": "" }, { "docid": "a42d0f23209acacc3da81c07c9ec99ac", "score": "0.5039165", "text": "def hook_pending_request(request) #THREAD_LOCAL_ACCESS\n wrapped_request, wrapped_response = wrap_request(request)\n state = TingYun::Agent::TransactionState.tl_get\n t0 = Time.now.to_f\n node = TingYun::Agent::CrossAppTracing.start_trace(state, t0, wrapped_request)\n\n unless request._ty_instrumented\n install_header_callback( request, wrapped_response )\n install_completion_callback( request, t0, node, wrapped_request, wrapped_response )\n request._ty_instrumented = true\n end\n rescue => err\n TingYun::Agent.logger.error(\"Untrapped exception\", err)\n end", "title": "" }, { "docid": "fc228425c4ddf3aa52134863bccc7f81", "score": "0.50383824", "text": "def within_transaction\n if use_transaction\n first.within_transaction do\n yield\n success?\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "0b2886dec79a1856d5cc2c32e6196605", "score": "0.50149345", "text": "def call(request_hash)\r\n req_data = request_post_data(request_hash)\r\n \r\n if (@profile.use_proxy?)\r\n if( @pi[\"USER\"].nil? || @pi[\"PASSWORD\"].nil? )\r\n http = Net::HTTP::Proxy(@pi[\"ADDRESS\"],@pi[\"PORT\"]).new(@ep[\"SERVER\"], 443)\r\n else \r\n http = Net::HTTP::Proxy(@pi[\"ADDRESS\"],@pi[\"PORT\"],@pi[\"USER\"], @pi[\"PASSWORD\"]).new(@ep[\"SERVER\"], 443)\r\n end \r\n else \r\n http = Net::HTTP.new(@ep[\"SERVER\"], 443) \r\n end \r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE #unless ssl_strict\r\n http.use_ssl = true; \r\n \r\n contents, unparseddata = http.post2(@ep[\"SERVICE\"], req_data, @headers) \r\n data = CGI::parse(unparseddata) \r\n transaction = Transaction.new(data) \r\n end", "title": "" }, { "docid": "68194ecb8567ad0223e1d6a37ec44ecb", "score": "0.50144684", "text": "def merchant_end_point; end", "title": "" }, { "docid": "945c931550c1b2497f5b21a0f02b44be", "score": "0.50143987", "text": "def method_missing(*args, &block)\n transaction do |y|\n y.send(*args, &block)\n end\n end", "title": "" }, { "docid": "5900e9aba7664f4e8f16e2092c1885da", "score": "0.50041914", "text": "def transaction(options = {}, &block)\n if connection = (options.delete(:on) || Postamt.transaction_connection)\n Postamt.on(connection) { super }\n else\n super\n end\n end", "title": "" }, { "docid": "7da77d8beb99d8be384abc2ce24525e6", "score": "0.49994162", "text": "def receive_transaction\n end", "title": "" }, { "docid": "7da77d8beb99d8be384abc2ce24525e6", "score": "0.49994162", "text": "def receive_transaction\n end", "title": "" }, { "docid": "9f891732bb5a8a2f0dbc8a9a58fdf20e", "score": "0.49993217", "text": "def send_http_callback(callback_method)\n send(callback_method, response, extras)\n end", "title": "" }, { "docid": "9a8912e20778334e8f1577518cdbdd25", "score": "0.49943987", "text": "def send_request(method, params, &block); end", "title": "" }, { "docid": "a064967ffb616f00c17d9ebee7a6c3f3", "score": "0.49864727", "text": "def delegate( txn, chain, *args )\n\t\tyield( chain )\n\tend", "title": "" }, { "docid": "155554b695c16cb6d75e0253dda5b8f2", "score": "0.49789244", "text": "def transaction_inject(rawtx, opts = {})\n data, _status_code, _headers = transaction_inject_with_http_info(rawtx, opts)\n data\n end", "title": "" }, { "docid": "9fcf0080c429d91678e3bbb071a09d86", "score": "0.49650693", "text": "def _invoke_persistent_callbacks\n method(self.class.before_save_callback).call\n method(self.class.after_commit_callback).call\n end", "title": "" }, { "docid": "4dc8bf31895c8e324baa155f11d81369", "score": "0.49433652", "text": "def transaction(holder,order,payment_method,return_url,authorize,capture: true)\n return Cielo::Transaction.new(@merchant, holder, order, payment_method, return_url, authorize, capture:capture)\n end", "title": "" }, { "docid": "147dc88a58a6da727f735caace4ed895", "score": "0.49406278", "text": "def transaction(&block)\n raise ArgumentError, 'no block given' unless block\n\n `#@native.transaction(#{->(t) { block.call(Transaction.new(self, t)) }})`\n end", "title": "" }, { "docid": "8a77c1770835602bded28e5b727a44de", "score": "0.4939244", "text": "def provider; end", "title": "" }, { "docid": "510b60ed7c416664ec4c34ba209ba980", "score": "0.49313566", "text": "def method_missing(name, *args, &blk)\n provider.send(name, *args)\n end", "title": "" }, { "docid": "d2df7ee9f7ec7d5df8d415285abdcf3c", "score": "0.4914475", "text": "def callback\n self.class.callback\n end", "title": "" }, { "docid": "d2df7ee9f7ec7d5df8d415285abdcf3c", "score": "0.4914475", "text": "def callback\n self.class.callback\n end", "title": "" }, { "docid": "732f080078fe42cbd1f1d4eaff5496f1", "score": "0.49125567", "text": "def initialize(rpc_provider, api_provider)\n super(api_provider)\n @rpc_provider = rpc_provider\n session = nil\n end", "title": "" }, { "docid": "e47c4410507d909064952b6301b90042", "score": "0.49114934", "text": "def merchant_end_point=(_arg0); end", "title": "" }, { "docid": "90e2dc86ebabd8599ff7698b1f51ee9e", "score": "0.49103662", "text": "def facebook\n callback\n end", "title": "" }, { "docid": "bb5d8b0e1716e8db70560270bc40c81b", "score": "0.49081856", "text": "def omniauth(provider, *args); end", "title": "" }, { "docid": "e21095589b2ef7011ea0624bbe61b7fb", "score": "0.49017113", "text": "def provider\n\tend", "title": "" }, { "docid": "4c68f62527420fc8228226a5d2643ae3", "score": "0.49014676", "text": "def transactions(options = {})\n raise MethodNotImplemented\n end", "title": "" }, { "docid": "80b9e4933d042fc1e0554f66ed47b897", "score": "0.48840335", "text": "def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end", "title": "" }, { "docid": "80b9e4933d042fc1e0554f66ed47b897", "score": "0.48840335", "text": "def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end", "title": "" }, { "docid": "134a268f2ba01c807d0b14d96c986ee5", "score": "0.4880215", "text": "def transact_with( *available_schemas )\n workspace = build_workspace(available_schemas)\n @adapter.transact do |connection|\n yield(Transaction.new(workspace, connection))\n warn_todo(\"validate transaction\")\n end\n end", "title": "" }, { "docid": "8c6bb49a321008a81e06934671fa6df6", "score": "0.48731664", "text": "def _call_in_transaction\n aliquot_updater = UpdateAliquotsHandler.new(db, bus, log, metadata, s2_resource, settings)\n\n begin \n s2_resource[:plates].each do |plate|\n aliquot_updater.send(:update_aliquots, plate) if plate[:plate].size == SupportedPlateSize\n end\n\n db.transaction(:savepoint => true) do\n begin\n date = s2_resource[:plates].first[:date]\n add_asset_links(s2_resource[:transfer_map], date)\n set_transfer_requests(s2_resource[:transfer_map], date)\n rescue PlateNotFoundInSequencescape => e\n log.info(\"The asset_link and the transfer request has not been set: #{e.message}\")\n end\n end\n rescue Sequel::Rollback, PlateNotFoundInSequencescape, UnknownSample => e\n metadata.reject(:requeue => true)\n log.info(\"Error updating plate aliquots in Sequencescape: #{e}\")\n raise Sequel::Rollback\n else\n metadata.ack\n log.info(\"Plate transfer message processed and acknowledged\")\n end\n end", "title": "" }, { "docid": "2aff4f561e391d1225c1db2e2408cf1e", "score": "0.48646703", "text": "def send_transaction(tx)\n sendrawtransaction(tx)\n end", "title": "" }, { "docid": "4ed328a7dec4f7df5bdf7f42579967c1", "score": "0.48597533", "text": "def spy_transaction!\n @within_transaction = nil\n allow(TestSqlCaller).to receive(:transaction).and_wrap_original do |meth, *args, &block|\n @within_transaction = true\n meth.call(*args, &block)\n ensure\n @within_transaction = false\n end\n end", "title": "" }, { "docid": "014e4ddbc6a4957749be5612fe1daa84", "score": "0.48555055", "text": "def callback &block\n super\n end", "title": "" }, { "docid": "014e4ddbc6a4957749be5612fe1daa84", "score": "0.48555055", "text": "def callback &block\n super\n end", "title": "" }, { "docid": "6197489a93a1cb8527fec419e673b332", "score": "0.48530552", "text": "def get_transaction \n instruction_params = {\n id: @payment.token,\n payment_reason: 'Pagamento de Anuidade' ,\n values: [@payment.amount],\n payer: build_payer\n }\n\n instruction = MyMoip::Instruction.new(instruction_params)\n request = MyMoip::TransparentRequest.new(@payment.id)\n request.api_call(instruction, timeout: TIMEOUT)\n request\n end", "title": "" }, { "docid": "9b5222f9713b8a3723052976bd5727aa", "score": "0.48463783", "text": "def new_or_current_transaction(session, access_mode, tx, &block)\n if tx && tx.access_mode == access_mode\n yield(tx)\n else\n transaction(session, access_mode, &block)\n end\n end", "title": "" }, { "docid": "17e1059576ae1c9bb3fe6abb4dfeafcb", "score": "0.48428962", "text": "def with_transaction(&block)\n base_model.transaction(&block)\n end", "title": "" }, { "docid": "be42961e05f42095a41af6b272dbdf39", "score": "0.48322028", "text": "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", "title": "" }, { "docid": "491d264aeaae91cbe27b9af14d2be5d0", "score": "0.48272732", "text": "def send_request para\n raise NotImplementedError.new(\"method not overriden\")\n end", "title": "" }, { "docid": "896c55adb641c0e7526329e5afce2e6c", "score": "0.48264164", "text": "def send_request; end", "title": "" }, { "docid": "3c282cf899631fccd19bd467338ed40e", "score": "0.48130566", "text": "def request_setup(method, path, params, signature_params)\n Proc.new do |request|\n request.headers[:authorization] = bearer_auth_header\n end\n end", "title": "" }, { "docid": "cecacc28b567093306a44cf649c91e24", "score": "0.4803217", "text": "def on_request &b\n @request_proc = b\n self\n end", "title": "" }, { "docid": "16bfbee0c8635c88afe1602512226053", "score": "0.47988406", "text": "def start(&block)\n transaction.start do\n run_callbacks(:transaction, &block)\n end\n end", "title": "" }, { "docid": "abf5e8f1e5be5bcb5569918bdc24ed1c", "score": "0.4796017", "text": "def handle_request( request, &block )\n\t\tself.log.debug \"[:auth] Wrapping request in auth with a %p\" % [ self.auth_provider ]\n\n\t\trequest.auth_provider = self.auth_provider\n\t\tself.authenticate_and_authorize( request )\n\n\t\tsuper\n\tend", "title": "" }, { "docid": "3f216830ac5c7de3e2e8bc6e47047106", "score": "0.4779886", "text": "def invoke(source, &block)\n if source.parent\n block.()\n else\n ActiveRecord::Base.transaction(&block)\n end\n end", "title": "" }, { "docid": "259858f296ba4779ebf0d8d6bcede9d8", "score": "0.4767881", "text": "def process_custom_method\n # da implementare per eventuali estensioni\n end", "title": "" }, { "docid": "a1ed4377cfead9e4cd29e290f0a78827", "score": "0.47677055", "text": "def commit_transaction\n\t super\n\n\t arguments.dup.each do |key, value|\n if value.respond_to?(:transaction_proxy?) && value.transaction_proxy?\n\t\t arguments.update!(key, value.__getobj__)\n\t\tend\n\t end\n\tend", "title": "" }, { "docid": "a940b73021b400dbd39dcdf0ce38eec3", "score": "0.47594965", "text": "def transaction(start_db_transaction=true)\n yield\n end", "title": "" }, { "docid": "9277100c25555d9bd13f048e32f27649", "score": "0.47520924", "text": "def commit_transaction\n\t super\n\t \n\t # Update the task arguments. The original\n\t # Roby::Task#commit_transaction has already translated the proxy\n\t # objects into real objects\n\t arguments.each do |key, value|\n\t\t__getobj__.arguments.update!(key, value)\n\t end\n\n execute_handlers.each do |h|\n __getobj__.execute(h.as_options, &h.block)\n end\n poll_handlers.each do |h|\n __getobj__.poll(h.as_options, &h.block)\n end\n\n __getobj__.abstract = self.abstract?\n if @fullfilled_model\n __getobj__.fullfilled_model = @fullfilled_model.dup\n end\n __getobj__.do_not_reuse if !@reusable\n\tend", "title": "" }, { "docid": "b07d773f664400138f4b53358706d05e", "score": "0.47477913", "text": "def wallet_transaction_with_http_info(wallet_transaction_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.wallet_transaction ...'\n end\n # verify the required parameter 'wallet_transaction_request' is set\n if @api_client.config.client_side_validation && wallet_transaction_request.nil?\n fail ArgumentError, \"Missing the required parameter 'wallet_transaction_request' when calling DefaultApi.wallet_transaction\"\n end\n # resource path\n local_var_path = '/api/v1/wallet/transaction'\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', ])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(wallet_transaction_request) \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#wallet_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "09585655e78ff412177ea2f0a7b53cd1", "score": "0.47446913", "text": "def card_callback(params,&block)\n\t\t\n\tend", "title": "" }, { "docid": "4a7ce4dd43e9f01f33fcbf8b05b05a4f", "score": "0.47445738", "text": "def begin_db_transaction() end", "title": "" }, { "docid": "4a7ce4dd43e9f01f33fcbf8b05b05a4f", "score": "0.47445738", "text": "def begin_db_transaction() end", "title": "" }, { "docid": "7c3901c57cb0f560f09745850112473f", "score": "0.4739919", "text": "def callback_phase\n @auth_token = get_auth_token(request.params[\"username\"], request.params[\"sid\"])\n @user_info = get_user_info(request.params[\"username\"], @auth_token)\n ap @user_info\n super\n rescue => ex\n fail!(\"Failed to retrieve user info from ebay\", ex)\n end", "title": "" }, { "docid": "755599bda53843a155a5eda4f6d0c34f", "score": "0.4738527", "text": "def ar_default_transaction_handler\n ar_model.transaction do\n yield\n end\n end", "title": "" }, { "docid": "30e2f0abd4a5cd27a73eeac3036a2890", "score": "0.47350156", "text": "def apply_to_transaction(transaction)\n transaction.apply_pattern(self)\n end", "title": "" }, { "docid": "dae0fef174e3aa7c968c0ae6e581b894", "score": "0.47326922", "text": "def show\n @transaction = MonzoTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transaction, callback: params[:callback] }\n format.xml { render xml: @transaction }\n end\n end", "title": "" }, { "docid": "cfa7bbbda56c4280af1a586a16969082", "score": "0.4730653", "text": "def send_request(pub_key, username, next_service, alg, signature = T.unsafe(nil)); end", "title": "" }, { "docid": "abc7eb14ec183cf89ef7dfe7ae440b2d", "score": "0.47290626", "text": "def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n #create wepay account\n self.create_wepay_account\n end\nend", "title": "" } ]
4a15f1f4de015a0d02097cc2ab890421
generates the return url for file submissions
[ { "docid": "7c482c1021c5dd35499611c3886300b2", "score": "0.659824", "text": "def file_content_return_url(url, text, content_type = nil)\n url = CGI::escape(url)\n text = CGI::escape(text)\n content_type = CGI::escape(content_type) if content_type\n\n return_url = \"#{content_return_url}?return_type=file&url=#{url}&text=#{text}\"\n return_url = \"#{return_url}&content_type=#{content_type}\" if content_type\n\n return return_url\n end", "title": "" } ]
[ { "docid": "66a9aa7bce36ec88b027f47c7d5eb5ad", "score": "0.68675643", "text": "def file_url\n end", "title": "" }, { "docid": "d32709e5c1ffe2520d0683f75c0cfc1a", "score": "0.6592359", "text": "def file_link\n return \"#{SITE_URL}system/ufiles/#{id}/original/#{ufile_file_name}\"\n end", "title": "" }, { "docid": "fe84cfcc7545b27e758b2453629a5aee", "score": "0.65856814", "text": "def generated_url; end", "title": "" }, { "docid": "c982bc0a56c88e4f2422a9cf289de9e2", "score": "0.6461677", "text": "def b2_generate_file_url(file, *folder)\n\n subdir = \"#{folder[0]}/\" if folder[0] != nil\n\n return \"#{ENV['download_url']}#{subdir}#{file}\"\n\nend", "title": "" }, { "docid": "bb4401cb23658adfec49d0cf31d73e02", "score": "0.64517206", "text": "def file_url(attachment_name, style=nil); file_path(attachment_name, style); end", "title": "" }, { "docid": "c61485eb1d4d0b5e48606a83c95031a0", "score": "0.64241207", "text": "def url; \"file:#{@root}\"; end", "title": "" }, { "docid": "f2e096a547a3289ecdaac844e3266c81", "score": "0.6419897", "text": "def file_url(context, inline, generate_event = true)\n if challenge_file?\n token = CHALLENGE_BOT_TOKEN\n result = DNAnexusAPI.new(CHALLENGE_BOT_TOKEN).call(\n \"system\",\n \"describeDataObjects\",\n objects: [dxid],\n )[\"results\"][0]\n project = result[\"describe\"][\"project\"]\n else\n token = context.token\n project = self.project\n end\n\n opts = {\n project: project,\n preauthenticated: true,\n filename: name,\n duration: 86_400,\n }\n inline_attribute = inline.present? ? \"?inline\" : \"\"\n\n api = DNAnexusAPI.new(token)\n url = api.file_download(dxid, opts)[\"url\"] + inline_attribute\n Event::FileDownloaded.create_for(self, context.user) if generate_event\n\n url\n end", "title": "" }, { "docid": "bfc204f965131abd21f45858b0f8ee8a", "score": "0.63847536", "text": "def url_for_file(filename, anchor = T.unsafe(nil)); end", "title": "" }, { "docid": "eaef681a85dbd6662839d9abbcbf3baf", "score": "0.6375561", "text": "def generate_url(template); end", "title": "" }, { "docid": "6bb4d512e1568bff9abd22aa53387cac", "score": "0.62672424", "text": "def url\n make_file_name('html', name)\n end", "title": "" }, { "docid": "ccfcc6ec40a4460fd3db86a50519806c", "score": "0.6264251", "text": "def file_to_uri(file); end", "title": "" }, { "docid": "ccfcc6ec40a4460fd3db86a50519806c", "score": "0.6264251", "text": "def file_to_uri(file); end", "title": "" }, { "docid": "245fbd351e8e9637fb44e564c92a330a", "score": "0.62552696", "text": "def upload_file_url\n \"file://#{upload_full_path}\"\n end", "title": "" }, { "docid": "28d2b57ac4558b084de77f2b974b46ad", "score": "0.6216636", "text": "def filename\n File.join(%w{public finished-jobs},Digest::SHA1.hexdigest(url)+\".txt\")\n end", "title": "" }, { "docid": "2a1f70480a9c04f32d46f40764ab60bb", "score": "0.61319953", "text": "def generate_link(failure_file_details, file_path)\n \"<strong><a href='xdoclet/#{failure_file_details[0].gsub(/\\//, \"_\").gsub(/\\.rb/, \".rb.html\")}' target='_blank'>#{file_path}</a></strong><br/>\"\n end", "title": "" }, { "docid": "6c2e01aa1e2463d9f998d375f09c8a0d", "score": "0.612652", "text": "def url_for_userfile(userfile)\n File.join(url_for_browsing,userfile.name)\n end", "title": "" }, { "docid": "31a54d5b5f8c0909cf69bab7ee4cedcd", "score": "0.6118946", "text": "def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end", "title": "" }, { "docid": "959bd9439ec9981c73794b4a4ce774c8", "score": "0.6117789", "text": "def file_url\n file.attached? ? url_for(file) : ''\n end", "title": "" }, { "docid": "940478ec061bf26fd950cb7fa1ae548a", "score": "0.6095154", "text": "def path\n http_url @store.rdoc.generator.file_dir\n end", "title": "" }, { "docid": "7a1a0e5ef9578e92021850a03a28d2b5", "score": "0.6093953", "text": "def file_url(uid, info = {}, content_type: nil, content_disposition: nil, **options)\n options[:response_content_type] ||= content_type\n options[:response_content_disposition] ||= content_disposition\n\n object(uid).presigned_url(:get, **options)\n end", "title": "" }, { "docid": "c3b90ddda4deabc2a7f665a617445bd6", "score": "0.60684615", "text": "def url(options = {})\n file.path\n end", "title": "" }, { "docid": "c2618931df16939b139679a16708238f", "score": "0.6067061", "text": "def public_url(*args)\n add_filename_to(:public_tmp_url, *args)\n end", "title": "" }, { "docid": "2c9df50ecc9f6863fb97635fcfcf1e5f", "score": "0.60547364", "text": "def output_path\n File.join(Musako.destination_path, @url)\n end", "title": "" }, { "docid": "479ad2726bf0afc368651a2a39edcdb8", "score": "0.6051775", "text": "def getPOSTurl(url_productstring, post_urls_hash, testing_value_file, bookmaker_project, relative_destpath)\n # get url\n post_url = post_urls_hash[url_productstring]\n if File.file?(testing_value_file)\n post_url = post_urls_hash[\"#{url_productstring}_stg\"]\n end\n # add bookmaker project name\n post_url += \"/#{bookmaker_project.downcase}\"\n # add dest_folder\n post_url += \"?folder=#{relative_destpath}\"\n return post_url\nrescue => e\n p e\nend", "title": "" }, { "docid": "0f841f0f62b7d374dfadb1a8b6d79cc7", "score": "0.6043353", "text": "def get_create_url(document_type)\n\n get_server_url(false) + '/sample?fileExt=' + get_internal_extension(document_type).delete('.')\n\n end", "title": "" }, { "docid": "a6a37a52f2e45fbca95d4d9bda1ed574", "score": "0.6038532", "text": "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "title": "" }, { "docid": "a6a37a52f2e45fbca95d4d9bda1ed574", "score": "0.6038532", "text": "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "title": "" }, { "docid": "807b57ca39d236c4046eb203069dc732", "score": "0.6037452", "text": "def presigned_link_uri(object, version, file)\n url_for controller: :file,\n action: :presign,\n object: object,\n version: version,\n file: file\n end", "title": "" }, { "docid": "71fa9b2e813f3f5b1158a8bdc680240f", "score": "0.602842", "text": "def raw_url(file_name)\n fail('Requires implementation')\n end", "title": "" }, { "docid": "fce4d3167d8268b3fa8ae985590c9db8", "score": "0.6024993", "text": "def url_content\n\t file.url\n\tend", "title": "" }, { "docid": "20eeedb26c5c5183bf4f11e41d0642fe", "score": "0.6018374", "text": "def get_file(url); end", "title": "" }, { "docid": "354b2437fbb5161174535800175909c4", "score": "0.6018055", "text": "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename\n File.join(dest, CGI.unescape(full_url))\n end", "title": "" }, { "docid": "66dbac09e1e1267889a6ccac6de40838", "score": "0.6013334", "text": "def gen_file\n\t\t#\"./tmp/#{Date.today.strftime(\"%Y%m%d\")}.#{gen_process_number}.webform.file\"\n\t\tFile.join(Rails.root, 'tmp', \"#{Date.today.strftime(\"%Y%m%d\")}.#{gen_process_number}.webform.file\")\n\tend", "title": "" }, { "docid": "70da78910dee6b36b6c608b785e9a4b1", "score": "0.60034347", "text": "def download_file(f)\n run(\"curl -O http://github.com/meskyanichi/rails-templates/raw/master/files/#{f}\")\nend", "title": "" }, { "docid": "03811c839c000e585c658c9c5de3c7e1", "score": "0.6002975", "text": "def url\n ::File.join \"/\", path.to_s\n end", "title": "" }, { "docid": "7831ba0661be45c2543cf0e8ff15c3e9", "score": "0.60009897", "text": "def original_fullpath; end", "title": "" }, { "docid": "f422a07e0ce1b49a7b43d10f58fe87df", "score": "0.5999388", "text": "def relative_url(input); end", "title": "" }, { "docid": "feea7ce6a0c2ee39e24c14b023ea28be", "score": "0.5995157", "text": "def form_file\n raise URI::InvalidURIError, 'No URI or invalid URI supplied.' if @uri.nil? || @uri.to_s.length <= 0 \n raise URI::InvalidURIError, \"Invalid URI: #{@uri} supplied.\" unless @uri.kind_of? URI::HTTP or @uri.kind_of? URI::HTTPS\n\n # raise Gerridae::MissingContentError, 'No content available.' if @content.nil? || @content.length?\n # @todo Convert URI implementation to using URI::Generic.build\n\n filename = Helpers.create_filename(@uri)\n outfile = File.expand_path( \"../../out/\" + filename, __FILE__ )\n @file = filename\n\n # Ensures there are no files created with precisely the same tags.\n # Helpers.rename_duplicate(parameter)\n dupcount = 0\n loop do \n dupcount += 1\n break unless File.exist?(outfile + dupcount.to_s) \n end\n\n outfile = outfile + dupcount.to_s if dupcount > 0\n\n File.new(outfile, \"a\") \n\n File.open(outfile, \"w\") do |file|\n file.write @content\n end\n\n \n # @todo Encapsulate within try rescue block.\n # @todo Return nil if file write fails?\n filename\n end", "title": "" }, { "docid": "babb588a22903ad93aaebe6c6f6c5175", "score": "0.5992558", "text": "def generate_file_name()\n fragment_holder = nil\n domain_name = URI::split(Jekyll::JekyllRdf::Helper::RdfHelper::domainiri)[2].to_s\n baseurl = Jekyll::JekyllRdf::Helper::RdfHelper::pathiri.to_s\n ((\"/\".eql? baseurl[-1]) || (baseurl.empty? && (\"/\".eql? domain_name[-1]))) ? rdfsites=\"rdfsites/\": rdfsites=\"/rdfsites/\"\n if(term.to_s[0..1].eql? \"_:\")\n file_name = \"#{rdfsites}blanknode/#{term.to_s.gsub('_:','blanknode_')}/\" # ':' can not be used on windows\n else\n begin\n uri = Addressable::URI.parse(term.to_s).to_hash\n file_name = rdfsites # in this directory all external RDF sites are stored\n if((uri[:host].eql? domain_name) || (\"#{uri[:scheme]}://#{uri[:host]}\".eql? domain_name))\n if((baseurl.length == 0)) #Special cases like baseurl == path or non-existent baseurl\n uri[:scheme] = nil\n uri[:host] = nil\n file_name = \"\"\n elsif(uri[:path].eql?(baseurl))\n uri[:path] = nil\n uri[:scheme] = nil\n uri[:host] = nil\n file_name = \"\"\n elsif(uri[:path].length > baseurl.length) #baseurl might be the first part of :path\n if(uri[:path][0..(baseurl.length - 1)].eql? baseurl)\n uri[:path] = uri[:path][(baseurl.length)..-1]\n uri[:scheme] = nil\n uri[:host] = nil\n file_name = \"\"\n end\n end\n end\n #An URI consists of these fields [:scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment]\n file_name << \"#{uri[:scheme]}/\" unless uri[:scheme].nil?\n file_name << \"#{uri[:userinfo]}@\" unless uri[:userinfo].nil?\n file_name << \"#{uri[:host]}/\" unless uri[:host].nil?\n file_name << \"#{uri[:port]}/\" unless uri[:port].nil?\n # registry purpose unknown\n file_name << \"#{uri[:path][0..-1]}\" unless uri[:path].nil?\n fragment_holder = \"##{uri[:fragment]}\" unless uri[:fragment].nil?\n # opaque jekyll produces static pages, so we do not dereferencing\n # query queries do not address resources\n # file_name << \"#/#{uri[:fragment]}\" unless uri[:fragment].nil? fragments are not evaluated by browsers, only by clients\n rescue Addressable::URI::InvalidURIError => x\n file_name = \"invalids/#{term.to_s}\"\n Jekyll.logger.error(\"Invalid resource found: #{term.to_s} is not a proper uri\")\n Jekyll.logger.error(\"URI parser exited with message: #{x.message}\")\n end\n end\n file_name = file_name.gsub('//','/') # needs a better regex to include /// ////...\n file_name = file_name.strip\n if(file_name[-2..-1] == \"#/\")\n file_name = file_name[0..-3]\n end\n if(file_name[-1] == '/' || (file_name.eql? \"\"))\n file_name << \"index.html\"\n else\n last_slash = file_name.rindex('/')\n last_slash = 0 if last_slash.nil?\n ending = \"\"\n if(file_name[-5..-1].eql? \".html\")\n ending = \".html\" #in case .html is already contained by the term.url\n else\n file_name[last_slash..-1] = \"#{file_name[last_slash..-1]}.html\"\n end\n end\n @render_path = file_name\n @page_url = \"#{file_name.chomp('index.html').chomp('.html')}#{ending}#{fragment_holder}\"\n identify_name_from_path(file_name)\n @filename\n end", "title": "" }, { "docid": "1dee7e6709050ab0bfb00352d556e551", "score": "0.5980689", "text": "def path\n http_url RDoc::RDoc.current.generator.file_dir\n end", "title": "" }, { "docid": "ae76863d6e4adfcb12dc4501a78ada91", "score": "0.5966504", "text": "def filename(options = {})\n\n if file_url = url(options)\n file_url.gsub(/.*\\/(.*?$)/, '\\1')\n end\n end", "title": "" }, { "docid": "9ff9cd60a84d9d36ad6541761d80e1a4", "score": "0.59629977", "text": "def create_temp_url(file, expires = Time.now.to_i + 600, account_meta_key = @account_meta_key)\n \n # Generate tempURL\n method = 'GET'\n \n public_url = URI(file.public_url)\n base = \"#{public_url.scheme}://#{public_url.host}/\"\n path = public_url.path\n\n hmac_body = \"#{method}\\n#{expires}\\n#{path}\"\n sig = Digest::HMAC.hexdigest(hmac_body, account_meta_key, Digest::SHA1)\n\n \"#{file.public_url}?temp_url_sig=#{sig}&temp_url_expires=#{expires}\"\n end", "title": "" }, { "docid": "6f30e4f8fa6091e98dd743ae40db8d2c", "score": "0.59619963", "text": "def url_for(entry)\n build_url(@requested_entry, entry)\n end", "title": "" }, { "docid": "f8e9f2518cd0e0512966da9dcbf70898", "score": "0.59604615", "text": "def web_file_path \n afilePath = building.web_path + SAVE_PATH + id.to_s\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix \n end\n\n afilePath\n end", "title": "" }, { "docid": "765f99e0335a2cc89261a4fa13e3535f", "score": "0.5959841", "text": "def get_file_html_url(args_hash)\n attachment = args_hash[:attachment]\n image_name = args_hash.has_key?(:image_name) ? args_hash[:image_name] : 'myself'\n get_file_url(attachment, image_name) if attachment\n end", "title": "" }, { "docid": "8e608c65239ee5e07437ca7531d75161", "score": "0.5934052", "text": "def url_for_me(action)\n if action == 'show'\n \"/projects/#{project.to_param}/documents/#{to_param}\"\n else\n \"/projects/#{project.to_param}/documents/#{to_param}/#{action}\"\n end\n end", "title": "" }, { "docid": "8d722e9075f3cae72d059ebbad7704d2", "score": "0.5933861", "text": "def raw_url(file_name)\n \"ftp://#{user}@#{host}#{folder}#{file_name}\"\n end", "title": "" }, { "docid": "06571147abcb44a690f7ddbf47bd289b", "score": "0.592872", "text": "def gen_rel_path(file)\n file = \"/secure/news/#{@folder}/#{file}\"\n end", "title": "" }, { "docid": "29a7d3660234c7ac006e7da92d7b7c46", "score": "0.592557", "text": "def getPOSTurl(url_productstring, post_urls_hash, testing_value_file, relative_destpath)\n # get url\n post_url = post_urls_hash[url_productstring]\n if File.file?(testing_value_file)\n post_url = post_urls_hash[\"#{url_productstring}_stg\"]\n end\n # add dest_folder\n post_url += \"?folder=#{relative_destpath}\"\n return post_url\nrescue => e\n p e\nend", "title": "" }, { "docid": "fe5ee954ac9f4dfd287527c9f8a57d5a", "score": "0.59181637", "text": "def download_url(filename)\n url(response_content_disposition: %Q{attachment; filename=\"#{filename}\"})\n end", "title": "" }, { "docid": "4d1db1a2cf16b1bbf3b158b872e7da1e", "score": "0.58885616", "text": "def generate_api_url(workspace_bucket_id, filename)\n file = self.get_workspace_file(workspace_bucket_id, filename)\n if file\n file.api_url + '?alt=media'\n else\n ''\n end\n end", "title": "" }, { "docid": "1320f7ce74d3957ede27a041b86876e5", "score": "0.58871925", "text": "def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend", "title": "" }, { "docid": "ccb6af1ba43d6e9bd9e7ef759f5f7e03", "score": "0.58871603", "text": "def url_template; end", "title": "" }, { "docid": "ccb6af1ba43d6e9bd9e7ef759f5f7e03", "score": "0.58871603", "text": "def url_template; end", "title": "" }, { "docid": "c912de816506b5826ec83a7fe053834c", "score": "0.5883902", "text": "def create_resultfile_link(report, job)\n \"http://s3.amazonaws.com/#{report[:bucket_name]}/resultfiles/#{job.resultfile_name}.zip\"\n end", "title": "" }, { "docid": "80d142ec8f56e06e4164712d9ae88d03", "score": "0.587878", "text": "def file_url\n resource.send(mount_point).url\n end", "title": "" }, { "docid": "91c236b298f2bf407d201195bdbcb3da", "score": "0.5876569", "text": "def generate_preview_url\n GlobalConstant::Base.root_url + @params['path'] + '?ts=' + @params['ts'].to_s\n end", "title": "" }, { "docid": "9d4232717e36669e5d16cf1e1f56befb", "score": "0.5876355", "text": "def fileUri(f)\n \"file://\" + f.gsub(\" \", \"%20\")\nend", "title": "" }, { "docid": "73875652f3d9fc61b7a55516019ba352", "score": "0.5869936", "text": "def url\n make_file_name('html', @chapter.name, name)\n end", "title": "" }, { "docid": "78fa788cf10a42fdee90bb68174d9e61", "score": "0.5867326", "text": "def generate_file_name(domain_name, baseurl)\n if(term.to_s[0..1].eql? \"_:\")\n file_name = \"rdfsites/blanknode/#{term.to_s}/\"\n else\n begin\n uri = Addressable::URI.parse(term.to_s).to_hash\n file_name = \"rdfsites/\" # in this directory all external RDF sites are stored\n if((uri[:host].eql? domain_name) || (\"#{uri[:scheme]}://#{uri[:host]}\".eql? domain_name))\n file_name = \"\"\n uri[:scheme] = nil\n uri[:host] = nil\n if(uri[:path].length > baseurl.length)\n if(uri[:path][0..(baseurl.length)].eql? (baseurl + \"/\"))\n uri[:path] = uri[:path][(baseurl.length)..-1]\n end\n elsif(uri[:path].eql?(baseurl))\n uri[:path] = nil\n end\n end\n key_field = [:scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment]\n key_field.each do |index|\n if !(uri[index].nil?)\n case index\n when :path\n file_name += \"#{uri[index][1..-1]}/\"\n when :fragment\n file_name += \"#/#{uri[index]}\"\n else\n file_name += \"#{uri[index]}/\"\n end\n end\n end\n unless file_name[-1] == '/'\n file_name += '/'\n end\n rescue URI::InvalidURIError => x #unclean coding: blanknodes are recognized through errors\n file_name = \"invalids/#{term.to_s}\"\n Jekyll.logger.error(\"Invalid resource found: #{term.to_s} is not a proper uri\")\n Jekyll.logger.error(\"URI parser exited with message: #{x.message}\")\n end\n end\n file_name = file_name.gsub('_','_u')\n file_name = file_name.gsub('//','/') # needs a better regex to include /// ////...\n file_name = file_name.gsub(':','_D')\n file_name = file_name.strip\n if(file_name[-2..-1] == \"#/\")\n file_name = file_name[0..-3]\n end\n file_name += 'index.html'\n @render_path = file_name\n @page_url = file_name.chomp('index.html').chomp('.html')\n file_name\n end", "title": "" }, { "docid": "7f8ae252d047aa0576f40a88686b6306", "score": "0.5861401", "text": "def filename_to_url(filename)\n # Remove the cache path\n f = strip_prefix(filename, path)\n # Remove the leading . from the base filename\n f = strip_filename_prefix(f, '.')\n # Remove the leading / from the path\n f.slice!(0) if f.start_with?('/')\n # Return the full Aspire linked data URL\n ld_api.api_url(f)\n end", "title": "" }, { "docid": "e640f75a33ac15940320fa1c1dd3ff4d", "score": "0.58598953", "text": "def github_filepath(fname)\n \"http://github.com/TK/#{File.basename fname}\"\nend", "title": "" }, { "docid": "e51e22ad04837dcbf22a59be734ee436", "score": "0.5847867", "text": "def link\n file = XFile.first(id: params[:id], uploaded: true)\n\n raise RequestError.new(:file_not_found, \"File not found or not public\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not get the download link of the root folder\") if file.id == session[:user].root_folder.id\n raise RequestError.new(:bad_param, \"Can't get the link of a folder\") if file.folder\n\n file.generate_link\n @result = { link: file.link, uuid: file.uuid, success: true }\n end", "title": "" }, { "docid": "a6eae00a4eaf1c37e1f9b511170275e8", "score": "0.5847036", "text": "def neofiles_file_url(*args)\n neofiles_cdn_prefix(*args) + neofiles_file_path(*args)\n end", "title": "" }, { "docid": "0b60ee31e41279c1dbb6eb58abb991e7", "score": "0.58365023", "text": "def original_url; end", "title": "" }, { "docid": "1e0ca308d2cc3ee162de15a5f5b96e43", "score": "0.5832301", "text": "def make_retrieval_link(rid, base_url = nil)\n return if rid.blank?\n base_url = base_url[:base_url] if base_url.is_a?(Hash)\n base_url ||= Upload::BULK_BASE_URL\n # noinspection RubyMismatchedArgumentType\n File.join(base_url, 'download', rid).to_s\n end", "title": "" }, { "docid": "ad90fecfad12a9b7e49ee4c6c9a31adb", "score": "0.583172", "text": "def file_url(title, download: false)\n uri = URI.parse(\"#{stacks_url}/#{ERB::Util.url_encode(title)}\")\n uri.query = URI.encode_www_form(download: true) if download\n uri.to_s\n end", "title": "" }, { "docid": "c34b106a3b2db2d201fcf584df460f1c", "score": "0.5828464", "text": "def file_path; end", "title": "" }, { "docid": "32e842d45cc2b47fe911c0e855878e46", "score": "0.582204", "text": "def path\n file.url\n end", "title": "" }, { "docid": "c2416126bf3941b5fdb6de9990130779", "score": "0.5815682", "text": "def link_path\n File.join(\"/f/#{@page_name}\", name) # /foo/bar_files/file.jpg\n end", "title": "" }, { "docid": "2854d77782dc577b0c672b7693c584de", "score": "0.58139485", "text": "def url_of_file(filename)\n raw_file_url = 'https://raw.githubusercontent.com/david942j/one_gadget/@tag/@file'\n raw_file_url.sub('@tag', latest_tag).sub('@file', filename)\n end", "title": "" }, { "docid": "84348856bc27515c3fff0d3e09672b49", "score": "0.5806672", "text": "def send\n generate_url\n end", "title": "" }, { "docid": "84348856bc27515c3fff0d3e09672b49", "score": "0.5806672", "text": "def send\n generate_url\n end", "title": "" }, { "docid": "1c72e8eebce9feab3173da90b95256f0", "score": "0.5797123", "text": "def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end", "title": "" }, { "docid": "0e7aec6898b029e00f2c1902b0c3320e", "score": "0.57946646", "text": "def generated_permalink; end", "title": "" }, { "docid": "7f495e4b9c74550774a3a49b85b2731a", "score": "0.57913357", "text": "def gen_rel_path(file)\n file = \"/secure/video/#{@folder}/#{file}\"\n end", "title": "" }, { "docid": "b183be1eca2cf9f9b2c4cd5fa2629194", "score": "0.57621896", "text": "def download_link\n download_params = { :sub => 'download', :fileid => @fileid, :filename => @remote_filename, :cookie => @api.cookie }\n DOWNLOAD_URL % [ @server_id, @short_host, download_params.to_query ]\n end", "title": "" }, { "docid": "e4702e9da13dcb7bcbf879bb7cafc192", "score": "0.57495356", "text": "def url\n return @url unless @url.nil?\n @url = destination.sub(::Webby.site.output_dir, '')\n end", "title": "" }, { "docid": "73a5b6795d44b8e33bd6a06841a6e06d", "score": "0.5747665", "text": "def web_url(filename, version=nil)\n fail NotImplementedError\n end", "title": "" }, { "docid": "c69859fc8db076682dd9d2c3df70d1e3", "score": "0.57385653", "text": "def page_url\n return @page_url.dup unless @page_url.nil?\n generate_file_name()\n #duplicate so outside sources do not edit this property\n @page_url.dup\n end", "title": "" }, { "docid": "e377f33a86760df87d263aca254d5a33", "score": "0.57339406", "text": "def submission_url(submission_id)\n self.google_bucket_url + \"/#{submission_id}\"\n end", "title": "" }, { "docid": "ed910a5cfc99243b76a6bd57bfb30267", "score": "0.5729663", "text": "def response_uri(file)\n file.base_uri\n end", "title": "" }, { "docid": "3dd654e77ab77967a4e5f37a4aa6961d", "score": "0.57191086", "text": "def file_set_url(file_set_id)\n \"https://#{ENV['SERVER_NAME']}/downloads/#{file_set_id}\"\n end", "title": "" }, { "docid": "b6ef772299c5bd9ef119765932ba48d5", "score": "0.57185024", "text": "def show\n\t\tsend_file(params[:path])\n end", "title": "" }, { "docid": "d8672841bfa5ba3764884ec214bdf22a", "score": "0.5708272", "text": "def file_path\n end", "title": "" }, { "docid": "663dd1e8c58217f3e52c11c43434ad04", "score": "0.5700415", "text": "def link_path\n File.join('/_attachment', @page_name, name)\n end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" }, { "docid": "15a930000a91cfa2bb4c72c1ce35b35a", "score": "0.5700281", "text": "def filename; end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fc71bd823f6bf7664991934d568a7866", "score": "0.0", "text": "def set_listing\n @listing = Listing.find(params[:id])\n @amenities = Amenity.all\n @rules = Rule.all\n @pictures = @listing.pictures\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5946146", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.591683", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58349305", "text": "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", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.5776858", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.5652805", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.5621621", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54210985", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53402257", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.53394014", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53321576", "text": "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", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.53124547", "text": "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", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.529654", "text": "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", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.5296262", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52952296", "text": "def setup_handler\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.52600986", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52442724", "text": "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", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.5232394", "text": "def workflow\n end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.523231", "text": "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", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5227454", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.52201617", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.5212327", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.52079266", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.52050185", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.51754695", "text": "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", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.51726824", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5166172", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5159343", "text": "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", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51578903", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.51522785", "text": "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", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152022", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.51518047", "text": "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", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.51456624", "text": "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", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.5133759", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.5112076", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5106169", "text": "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", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.509231", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.50873137", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081088", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.508059", "text": "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", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50677156", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.50562143", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5050554", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5036181", "text": "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", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5026331", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5022976", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5015441", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.50121695", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.5000944", "text": "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", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.5000019", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.4996878", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "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", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "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", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49864885", "text": "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", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.49797225", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49785787", "text": "def after_set_callback; end", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.4976161", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49683493", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.4965126", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4958034", "text": "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", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49559742", "text": "def release_actions; end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4954353", "text": "def around_hooks; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.49535993", "text": "def save_action; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.4952725", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49467874", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.49423352", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.49325448", "text": "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", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49282882", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49269363", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49269104", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49252945", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4923091", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49194667", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49174926", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49173003", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.49171105", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.4915879", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49155936", "text": "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", "title": "" } ]
d0df87b1bea9b55706b1c7c4184cdaba
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
[ { "docid": "0fef7c5e43b365c7d4cb09d256bb46ae", "score": "0.0", "text": "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "34c10c4557f689baa30ce671828a8692", "score": "0.7019827", "text": "def update\n @api_v1_post = Post.find(params[:id])\n params[:post].delete :created_at\n params[:post].delete :updated_at\n respond_to do |format|\n if @api_v1_post.update_attributes(params[:post])\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dcf0e2d221c4230634f608d7d00af266", "score": "0.6999747", "text": "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "779a91b90c7e731678971b5689ec9b70", "score": "0.6911965", "text": "def update\n @post = Post.find(params[:id])\n @post.update(post_params)\n render json: @post \n end", "title": "" }, { "docid": "7599b6acda033b21082c7a67a2516d88", "score": "0.68499815", "text": "def update\n json_update_and_sanitize(post,post_params, Post)\n end", "title": "" }, { "docid": "268a8837ab76129f50aa6c9a2c5e73c3", "score": "0.68159676", "text": "def update\n @post.update!(post_params)\n render json: {status: :ok}\n end", "title": "" }, { "docid": "fef606243741752603cf8b7a9b458009", "score": "0.67714703", "text": "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n post = user.posts.find(params[:id])\n post.update(post_params)\n render json: post\n\n end", "title": "" }, { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.6728356", "text": "def patch *args\n make_request :patch, *args\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6675816", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6675816", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "248bd87e1d19021d8624efcda2373ffd", "score": "0.6625453", "text": "def update\n \t\n \tif @post.update_attributes(post_params)\n \t\trender json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n \n end", "title": "" }, { "docid": "a726e122c8039fa5cc7048e89925751f", "score": "0.660294", "text": "def update\n if @post.update(post_params)\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "482dc30a623c3a8d02b386b9544a849a", "score": "0.65934557", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to root_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5fd5f00640bdb0c785bcac4689a46f3c", "score": "0.6539655", "text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6532984", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6532984", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "6b0bee4be8c65a81341bbb3bad1b8dab", "score": "0.6531287", "text": "def update\n if post_params\n @post = do_update(post_params) # do individual update\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :ok }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n else\n mass_create_update\n end\n end", "title": "" }, { "docid": "851451646e53ec13fbef6921d333442a", "score": "0.6520809", "text": "def update\n post = Post.find(params[:id])\n if post.update_attributes(post_params)\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => post.errors}, :status => :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a2c832ae3d71ecb3f78b96b6475de120", "score": "0.65200937", "text": "def update\n if @post.update(post_params)\n render json: @post, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "title": "" }, { "docid": "d75bc1b99f134fe45bc5d2848ffae265", "score": "0.6472437", "text": "def update\n if @post.update(post_params)\n render json: @post, status: 200\n else\n render :json => @post.errors, :status => 422\n end\n end", "title": "" }, { "docid": "67987b36f9d627752ee5cdb5bcd6f7a3", "score": "0.6469172", "text": "def patch(body: nil, path: nil, headers: nil, id: nil)\n post(body: body, path: path, headers: headers, http_method: :patch, id: id)\n end", "title": "" }, { "docid": "f50152818f34096c115d0dc8a8cedf78", "score": "0.64599144", "text": "def update\n@post = Post.find(params[:id])\nrespond_to do |format|\nif @post.update_attributes(params[:post])\nformat.html { redirect_to @post, notice: 'post was successfully updated.' }\nformat.json { head :no_content }\nelse\nformat.html { render action: \"edit\" }\nformat.json { render json: @post.errors, status: :unprocessable_entity }\nend\nend\nend", "title": "" }, { "docid": "dce0a6e721f096c679bdd9aa00e3596c", "score": "0.6437895", "text": "def update\n @post = Post.find(params[:id])\n @post.update_attributes(params[:post])\n respond_with(@post)\n end", "title": "" }, { "docid": "67d24b8fd779df7c81cdb4b9c1d522a4", "score": "0.64299524", "text": "def update\n @post.update(post_params)\n if @post.save\n render json: @post, status: :accepted\n else\n render json: { errors: @post.errors.full_messages }, status: :unprocessible_entity\n end\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.6429923", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.6429923", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.6429923", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.6429923", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1e2ec02328989bb93a1c434fc649691a", "score": "0.6429346", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "842c744b226d4f82eef317112a15172d", "score": "0.6427228", "text": "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to '/posts', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b731f472a9b1deeb1e059fa098e8049b", "score": "0.6414919", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to root_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2a6392bf5c092bc2a69ba14e0e08226", "score": "0.6412873", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2a6392bf5c092bc2a69ba14e0e08226", "score": "0.6412443", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2a6392bf5c092bc2a69ba14e0e08226", "score": "0.6412342", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25192d7966c43b7613ce1b2f18f7d1c6", "score": "0.63997054", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25192d7966c43b7613ce1b2f18f7d1c6", "score": "0.63997054", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0bca949b96828d0f137484de4066ae8", "score": "0.6397036", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce96d318052b256737d59d465afd971e", "score": "0.6396097", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to manage_posts_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42c655873cc874969c482b0587b109c2", "score": "0.6389614", "text": "def update\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2aca442d6a9eba292d6804cd57e4da1f", "score": "0.63873565", "text": "def update\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6b1590b8283bd37a342385f0161e67d", "score": "0.63795894", "text": "def update\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59c755f666b408374803da7d5878cc21", "score": "0.6379051", "text": "def update\n @post.update(post_params)\n respond_with @post\n end", "title": "" }, { "docid": "249d4fdfb1fc0c681eca504cd930f289", "score": "0.6378583", "text": "def update\n @api_v1_post_flag = PostFlag.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_flag.update_attributes(params[:api_v1_post_flag])\n format.html { redirect_to @api_v1_post_flag, notice: 'Post flag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_flag.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81ef3155a13698aaded9bb0a4c89c26e", "score": "0.6372555", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :back, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93505fe39c6cac6e6192cc4119651da2", "score": "0.6370979", "text": "def update\n respond_to do |format|\n if @post.update(post_params)\n Rails.cache.delete('posts')\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffb039fa9832bc86d7bf589be55157e1", "score": "0.6370462", "text": "def update\n if @post.update_attributes(params[:post])\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369382", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6369306", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8c2766c209fd33f90019f1df7d7ab66", "score": "0.63663787", "text": "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2741eecb9c72ebef4416b16eb9c4c4c6", "score": "0.63641906", "text": "def update\n if update_post\n render json: { status: :ok }\n else\n render json: { errors: @post.errors }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "f52312228fdbe4ea48278b0a60ae88bf", "score": "0.6357994", "text": "def update\n @post = Post.find(params[:id])\n \n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { respond_with_bip(@post) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@post) }\n end\n end\n end", "title": "" }, { "docid": "cbfc487a82eba0dce5a22881effa57d0", "score": "0.63569593", "text": "def update\n #@post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7b58399279447dc95c67bde66a62949", "score": "0.6355867", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355458", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6355368", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc20f08bcc7d7808cfb170b1c319b096", "score": "0.6352549", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "609b5c9f098fa2ecfbfc6d725ced2f75", "score": "0.6346723", "text": "def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "717cdc03b787b02b12763af0c22d7d83", "score": "0.63338244", "text": "def update\n @post = Post.find(params[:id])\n @post.published = true\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e7d9a7b6e30d22ccf748745453576e4", "score": "0.63248384", "text": "def update\n @post = Post.find(params[:id])\n @posts = Post.all\n @tags = Tag.all\n \n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6844b0fdf6a46dd958e14307e53ede94", "score": "0.6291795", "text": "def update\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
65de64c2e5f966a63452daaaa1d6fbe6
Download a locale in a specific file format. API Path: /api/v2/projects/:project_id/locales/:id/download == Parameters: project_id:: project_id id:: id params:: Parameters of type PhraseApp::RequestParams::LocaleDownloadParams == Returns: err
[ { "docid": "6e19b64f158d63008f39096e7557d5d5", "score": "0.8295837", "text": "def locale_download(project_id, id, params)\n path = sprintf(\"/api/v2/projects/%s/locales/%s/download\", project_id, id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.kind_of?(PhraseApp::RequestParams::LocaleDownloadParams)\n raise PhraseApp::ParamsHelpers::ParamsError.new(\"Expects params to be kind_of PhraseApp::RequestParams::LocaleDownloadParams\")\n end\n end\n \n data_hash = params.to_h\n err = params.validate\n if err != nil\n return nil, err\n end\n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200)\n if err != nil\n return nil, err\n end\n return rc.body\n return err\n end", "title": "" } ]
[ { "docid": "3fa1dc58c192ffbebea9b857338a0e30", "score": "0.76761", "text": "def locale_download(project_id, id, opts = {})\n data, _status_code, _headers = locale_download_with_http_info(project_id, id, opts)\n data\n end", "title": "" }, { "docid": "de9098689b9b5f225c8a3fdb1c05227d", "score": "0.75290275", "text": "def locale_download_with_http_info(project_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LocalesApi.locale_download ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling LocalesApi.locale_download\"\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 LocalesApi.locale_download\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/locales/{id}/download'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?\n query_params[:'file_format'] = opts[:'file_format'] if !opts[:'file_format'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?\n query_params[:'include_empty_translations'] = opts[:'include_empty_translations'] if !opts[:'include_empty_translations'].nil?\n query_params[:'exclude_empty_zero_forms'] = opts[:'exclude_empty_zero_forms'] if !opts[:'exclude_empty_zero_forms'].nil?\n query_params[:'include_translated_keys'] = opts[:'include_translated_keys'] if !opts[:'include_translated_keys'].nil?\n query_params[:'keep_notranslate_tags'] = opts[:'keep_notranslate_tags'] if !opts[:'keep_notranslate_tags'].nil?\n query_params[:'convert_emoji'] = opts[:'convert_emoji'] if !opts[:'convert_emoji'].nil?\n query_params[:'format_options'] = opts[:'format_options'] if !opts[:'format_options'].nil?\n query_params[:'encoding'] = opts[:'encoding'] if !opts[:'encoding'].nil?\n query_params[:'skip_unverified_translations'] = opts[:'skip_unverified_translations'] if !opts[:'skip_unverified_translations'].nil?\n query_params[:'include_unverified_translations'] = opts[:'include_unverified_translations'] if !opts[:'include_unverified_translations'].nil?\n query_params[:'use_last_reviewed_version'] = opts[:'use_last_reviewed_version'] if !opts[:'use_last_reviewed_version'].nil?\n query_params[:'fallback_locale_id'] = opts[:'fallback_locale_id'] if !opts[:'fallback_locale_id'].nil?\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(['*'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'File' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LocalesApi#locale_download\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "0763bd1c8d98557238e0b33d63532bb9", "score": "0.7401442", "text": "def download_po(locale, options ={})\n download_file(options.merge(:locale => locale, :format => PO_FORMAT))\n end", "title": "" }, { "docid": "a2c4751334ed220580361dc152703283", "score": "0.6746576", "text": "def download_translations(path=nil, download_base_locale=false, use_active_record=false)\n if defined?(Rails)\n path ||= [Rails.root.to_s, \"config\", \"locales\"].join(\"/\")\n else\n raise ArgumentError, \"Please supply the path where locales are to be downloaded.\" unless path\n path = path.chop if path =~ /\\/$/\n end\n\n output = @project.output\n\n # Let's ignore other hash nodes from the API and just rely on the string keys we sent during upload. Prefix with locale.\n @translations = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) }\n output.map do |k0,v0| # Page level\n v0.map do |k1, v1| # Locale level\n v1.map do |k2, v2| # string key level\n @translations[k1][[k1, k2].join('.')] = v2 \n end\n end \n end\n\n if use_active_record\n @translations.map { |k,v| save_locale(k, v) unless (k.to_s == @one_sky_locale and !download_base_locale)}\n else \n # Delete all existing one_sky translation files before downloading a new set.\n File.delete(*Dir.glob(\"#{path}/*_one_sky.yml\"))\n \n # Process each locale and save to file\n @translations.map { |k,v| save_locale(k, v, :filename => \"#{path}/#{k}_one_sky.yml\") unless (k.to_s == @one_sky_locale and !download_base_locale)}\n end\n end", "title": "" }, { "docid": "5476128989d9f4966ef8526dffc8f09c", "score": "0.67251927", "text": "def download(string_path, options = {})\n verify_languages!\n\n files = get_default_locale_files(string_path).map {|path| File.basename(path)}\n\n locales = if options[:base_only]\n [@base_locale]\n elsif options[:all]\n [@base_locale] + @onesky_locales\n else\n @onesky_locales\n end\n\n locales.each do |locale|\n locale = locale.to_s\n puts \"#{locale_dir(locale)}/\"\n onesky_locale = locale.gsub('_', '-')\n files.each do |file|\n response = @project.export_translation(source_file_name: file, locale: onesky_locale)\n if response.code == 200\n saved_file = save_translation(response, string_path, locale, file)\n puts \" #{saved_file}\"\n end\n end\n end\n end", "title": "" }, { "docid": "6c9152562124b4ed87fc5df62b8dd7e5", "score": "0.67065704", "text": "def pull_locale(id)\n params = OpenStruct.new({\n :encoding => 'UTF-8',\n :fallback_locale_id => @phraseapp_fallback_locale,\n :file_format => 'simple_json',\n :include_empty_translations => true,\n :include_translated_keys => true,\n :include_unverified_translations => true,\n :tags => @phraseapp_tag,\n })\n\n @log.info(\"Downloading locale files for #{id}...\".bright)\n file_basename = \"#{@locale_specific_map[id.to_sym] || id}\"\n\n json, err = @phraseapp.locale_download(@phraseapp_id, id, params)\n if err.nil?\n File.write(File.join(@plugin_i18n_dir, \"#{file_basename}.json\"), json)\n else\n @log.error(\"An error occurred while downloading locale #{id}.json from PhraseApp.\".red.bright)\n @log.debug(err)\n exit(1)\n end\n end", "title": "" }, { "docid": "4e00189c2c41a21a7e8d9ff887df544b", "score": "0.6143709", "text": "def get_po_file\r\n\r\n if AppLocale.app_locales.include?(params[:id])\r\n path = Rails.root.join('po', params[:id], APP_SID + '.po')\r\n send_data File.open(path, 'r').read, :filename => \"#{APP_SID}_#{params[:id]}.po\", :disposition => 'attachment'\r\n else\r\n render :nothing => true\r\n end\r\n end", "title": "" }, { "docid": "d6197c5e2a419d25d3a6b0cd6a2877b1", "score": "0.61256224", "text": "def download\n puts \"ENTERED DOWNLOAD FUNCTION\"\n dl_type = params[:dl_type]\n cache_path = nil\n return_file = nil\n\n case dl_type\n when \"ef\" \n format = params[:format]\n extraction_form_id = params[:extraction_form_id]\n cache_path = \"/public/cache/projects\"\n if current_user.is_assigned_to_project(params[:project_id])\n return_file = \"project-#{params[:project_id]}-#{extraction_form_id}.#{format}\"\n else\n project = Project.find(params[:project_id])\n return_file = project.get_download_filename(current_user.id, extraction_form_id, format)\n end\n when \"supplement\" \n return_file = params[:filename]\n cache_path = \"/public/reports/#{params[:project_id]}/publish/downloads\"\n if !current_user.is_assigned_to_project(params[:project_id])\n project = Project.find(params[:project_id])\n return_file = project.get_download_filename(current_user.id, nil, nil, return_file)\n if return_file != params[:filename]\n cache_path = \"/public/cache/projects\"\n end\n end\n end\n send_file \"#{Rails.root}/#{cache_path}/#{return_file}\",:x_sendfile=>true \n end", "title": "" }, { "docid": "e603d025fb922a9335206a27b4c91d10", "score": "0.6061143", "text": "def download_yaml(locale, options={})\n download_file(options.merge(:locale => locale, :format => YAML_FORMAT))\n end", "title": "" }, { "docid": "088bdc4069511851b2e61a186b9ccae4", "score": "0.60479015", "text": "def download(yaml_path)\n puts \"Downloading translations for I18n Simple Backend:\"\n\n platform_locales.each do |locale|\n locale_code = locale[\"locale\"]\n local_name = locale[\"name\"][\"local\"]\n english_name = locale[\"name\"][\"eng\"]\n\n if locale_code == platform_base_locale\n # We skip the base locale.\n next\n else\n yaml = platform.translation.download_yaml(locale_code)\n yaml_file_name = \"#{locale_code}_one_sky.yml\"\n yaml.force_encoding('utf-8')\n\n if yaml.empty?\n puts \" locale: #{locale_code} - not downloading because it is empty (the old one would be deleted)\"\n File.delete(yaml_file_name) if File.exist?(yaml_file_name)\n else\n puts \" locale: #{locale_code}, file: #{yaml_file_name}\"\n\n File.open(File.join(yaml_path, yaml_file_name), \"w\") do |f|\n f.puts \"# PLEASE DO NOT EDIT THIS FILE.\"\n f.puts \"# This was downloaded from OneSky. Log in to your OneSky account to manage translations on their website.\"\n f.puts \"# Language code: #{locale_code}\"\n f.puts \"# Language name: #{local_name}\"\n f.puts \"# Language English name: #{english_name}\"\n f.write yaml\n end\n end\n end\n end\n end", "title": "" }, { "docid": "d81c3b8ddd002b4a28d3418a5603ded3", "score": "0.60353935", "text": "def export(locale, extension)\n\n optional_query_params = {}\n if !@format.to_s.empty?\n optional_query_params[\"format\"] = @format \n end\n if @filter != nil && !filter.empty?\n optional_query_params[\"filter\"] = @filter.join(',') \n end\n if !@index.to_s.empty?\n optional_query_params[\"index\"] = @index \n end\n if !@source.to_s.empty?\n optional_query_params[\"source\"] = @source \n end\n if !@namespace.to_s.empty?\n optional_query_params[\"namespace\"] = @namespace \n end\n if !@fallback.to_s.empty?\n optional_query_params[\"fallback\"] = @fallback \n end\n if !@order.to_s.empty?\n optional_query_params[\"order\"] = @order \n end\n if !@status.to_s.empty?\n optional_query_params[\"status\"] = @status \n end\n if !@printf.to_s.empty?\n optional_query_params[\"printf\"] = @printf \n end\n if !@charset.to_s.empty?\n optional_query_params[\"charset\"] = @charset \n end\n if !@breaks.to_s.empty?\n optional_query_params[\"breaks\"] = @breaks \n end\n if !@no_comments.to_s.empty?\n optional_query_params[\"no-comments\"] = @no_comments \n end\n if !@no_folding.to_s.empty?\n optional_query_params[\"no-folding\"] = @no_folding \n end\n\n uri = URI::HTTPS.build(scheme: 'https',\n host: 'localise.biz',\n path: \"/api/export/locale/#{locale}#{extension}\",\n query: URI.encode_www_form(optional_query_params)\n )\n\n res = Net::HTTP.start(uri.host, uri.port,\n :use_ssl => uri.scheme == 'https') do |http|\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = \"Loco #{@key}\"\n http.request req\n end\n \n if res.code == '200'\n body = res.body\n \n # Extracting charset because Net does not do it\n content_type = res['Content-Type']\n charset = /charset=([^ ;]*)/.match content_type\n unless charset.nil?\n body = body.force_encoding(charset.captures[0])\n .encode('utf-8')\n end\n \n return body\n end\n \n warn 'URL failed: ' + uri.to_s\n nil\n end", "title": "" }, { "docid": "8d13887223c5a1694716f8e36f34f392", "score": "0.6017851", "text": "def export_file\n \"#{Language.locales_dir}/#{locale}.txt\"\n end", "title": "" }, { "docid": "88da67c18f2e95e855291f38466e60ed", "score": "0.594875", "text": "def download_files(project_id, params)\n c_r Lokalise::Resources::File, :download, [project_id, 'download'], params\n end", "title": "" }, { "docid": "4dd95c19bb3a5b68ca46428b1a3a8946", "score": "0.59365493", "text": "def export_download(emails, export_id, file_format)\n @export_file = Export.find export_id\n @file_format = file_format.to_s.upcase\n @download_url = exports_download_url(:id => @export_file.access_token, host: ENV['APP_ADMIN_HOST_PORT'], protocol: :https)\n\n mail to: emails, subject: \"VOC Tool - Export Download - #{@export_file.survey_version.survey_name}\"\n end", "title": "" }, { "docid": "492c64f7ab7456cdf03f776f674e26dd", "score": "0.58356637", "text": "def export\n if params[:offset].present?\n if params[:untranslated].present?\n @translations = CouchI18n::Translation.unstranslated_with_offset(params[:offset])\n else\n @translations = CouchI18n::Translation.with_offset(params[:offset])\n end\n else\n if params[:untranslated].present?\n @translations = CouchI18n::Translation.untranslated\n else\n @translations = CouchI18n::Translation.all\n end\n end\n base_filename = \"export#{Time.now.strftime('%Y%m%d%H%M')}\"\n if params[:exportformat] == 'csv'\n response.headers['Content-Type'] = 'text/csv'\n response.headers['Content-Disposition'] = %{attachment; filename=\"#{base_filename}.csv\"}\n render :text => @translations.map{|s| [s.translation_key, s.translation_value.to_json].join(',')}.join(\"\\n\")\n elsif params[:exportformat] == 'json'\n response.headers['Content-Type'] = 'application/json'\n response.headers['Content-Disposition'] = %{attachment; filename=\"#{base_filename}.json\"}\n # render :text => CouchI18n.indent_keys(@translations).to_json # for indented json\n render :json => @translations.map{|s| {s.translation_key => s.translation_value}}.to_json\n else #yaml\n response.headers['Content-Type'] = 'application/x-yaml'\n response.headers['Content-Disposition'] = %{attachment; filename=\"#{base_filename}.yml\"}\n render :text => CouchI18n.indent_keys(@translations).to_yaml\n end\n end", "title": "" }, { "docid": "ff2bdfcfd055eeec42898cb1586ca066", "score": "0.5783277", "text": "def get_file\r\n\r\n @app_locale = AppLocale.find_by_id(params[:id])\r\n filename = nil\r\n filepath = nil\r\n document = nil\r\n case params[:sid].to_s\r\n when \"po\"\r\n filename = @app_locale.po__name\r\n filepath = @app_locale.po__path\r\n document = @app_locale.po\r\n end\r\n if document && File.exist?(filepath)\r\n mime = MIME::Types.type_for(filename)\r\n file_type\t= mime.first ? mime.first.content_type : 'application/octet-stream'\r\n disposition\t= 'inline' if mime.first && ['text', 'image'].include?(mime.first.media_type)\r\n disposition ||= 'attachment'\r\n send_data(document, :filename => filename, :type => file_type, :disposition => disposition)\r\n else\r\n render :nothing => true\r\n end\r\n end", "title": "" }, { "docid": "de9bf456d220ba56d62c2d5791a21e6d", "score": "0.57788205", "text": "def download_po(file)\n link_to \"#{file}.po\", send_po_file_agent_translation_path(file), :method => :put\n end", "title": "" }, { "docid": "ea609d221be2904e93551c508fd5c0d3", "score": "0.55994785", "text": "def download\n @reporte_marca = ReporteMarca.find(params[:id])\n if @reporte_marca\n nombre_archivo = @reporte_marca.crear_nombre_archivo\n respond_to do |format|\n format.html do\n reporte = Reporte.crear_reporte(@reporte_marca)\n send_data reporte, :filename => \"#{nombre_archivo}.pdf\"\n end\n format.xls do\n I18n.locale = @reporte_marca.idioma\n if @reporte_marca.importacion_id\n reporte = render_to_string(:partial => \"tabla_cruce\", :locals => {:show_titulares => true})\n else\n reporte = render_to_string(:partial => \"tabla_busqueda\", :locals => {:show_titulares => true})\n end\n I18n.locale = \"es\"\n send_data reporte.encode('ISO-8859-1'), :filename => \"#{nombre_archivo}.xls\", :type => 'application/vnd.ms-excel;', :encoding => 'utf-8'\n end\n end\n else\n raise \"Error el reporte que solicito no existe\"\n end\n end", "title": "" }, { "docid": "bcfcf3cc715449d4c850852ec60604bd", "score": "0.5529435", "text": "def download_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.download ...'\n end\n # resource path\n local_var_path = '/download.jsp'\n\n # query parameters\n query_params = {}\n query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?\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', 'application/zip'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basic']\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 => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#download\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "cba6868c0e7dddb32eed90f34d250b66", "score": "0.5457154", "text": "def download\n @orders = Order.find(params[:ids])\n\n case params[:format]\n when 'xml'\n content = Order.get_xml_for(@orders)\n content_type = 'application/xml; charset=utf-8'\n when 'csv'\n content = Order.get_csv_for(@orders)\n content_type = 'text/csv'\n end\n \n directory = File.join(Rails.root, \"public/system/order_files\")\n file_name = Time.now.strftime(\"%m_%d_%Y_%H-%M\")\n file = \"#{file_name}.#{params[:format]}\"\n save_to = \"#{directory}/#{file}\"\n \n # make sure we have the directory to write these files to\n if Dir[directory].empty?\n FileUtils.mkdir_p(directory)\n end \n \n # write the file\n File.open(save_to, \"w\") { |f| f.write(content) }\n \n send_file(save_to, :type => content_type)\n end", "title": "" }, { "docid": "51a6b7151ab42168d57a95814ef212bc", "score": "0.5385611", "text": "def job_locale_delete_with_http_info(project_id, job_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locale_delete ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling JobLocalesApi.job_locale_delete\"\n end\n # verify the required parameter 'job_id' is set\n if @api_client.config.client_side_validation && job_id.nil?\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling JobLocalesApi.job_locale_delete\"\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 JobLocalesApi.job_locale_delete\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/jobs/{job_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: JobLocalesApi#job_locale_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "0514396f8d4bd630c8261fa83ee74137", "score": "0.5381888", "text": "def download\n problem = Problem.find(params[:id])\n unless @current_user.can_view_problem? problem\n flash[:error] = 'You are not authorized to access this file'\n redirect_to list_main_path\n return\n end\n\n base_name = params[:file]\n base_filename = File.basename(\"#{base_name}.#{params[:ext]}\")\n filename = \"#{Problem.download_file_basedir}/#{params[:id]}/#{base_filename}\"\n\n if !FileTest.exists?(filename)\n flash[:notice] = 'File does not exists'\n redirect_to list_main_path\n return\n end\n\n send_file_to_user(filename, base_filename)\n end", "title": "" }, { "docid": "d8ca0b718e87a24bccab92ec5f318573", "score": "0.53625757", "text": "def download\n data = cache(id: params[:id],format: params[:format],bundle_id: params[:bundle_id]) do\n file = nil\n if params[:id]\n file = Cypress::CreateDownloadZip.create_patient_zip(Record.find(params[:id]),params[:format])\n else\n file = Cypress::CreateDownloadZip.create_zip(@bundle.records, params[:format])\n end\n file.read\n end\n\n send_data data, :type => 'application/zip', :disposition => 'attachment', :filename => \"patient_#{params[:id]}_#{params[:format]}.zip\"\n end", "title": "" }, { "docid": "311b7f93b4266282f3c0253b81ec959b", "score": "0.5353989", "text": "def locale_delete_with_http_info(project_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LocalesApi.locale_delete ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling LocalesApi.locale_delete\"\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 LocalesApi.locale_delete\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LocalesApi#locale_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "3c65dc7cdc51c183f05ad02833bc302e", "score": "0.5349882", "text": "def download\n @export_file = Export.active.find_by_access_token params[:id]\n\n if @export_file\n path = @export_file.document.path\n mime_type = Mime::Type.lookup_by_extension(path.split('.').last).to_s\n\n data = open(@export_file.document.expiring_url(DOWNLOAD_AVAILABLE_FOR_IN_SECONDS))\n send_data(data.read,\n filename: File.basename(path),\n type: mime_type,\n disposition: 'attachment')\n else\n raise ActiveRecord::RecordNotFound\n end\n end", "title": "" }, { "docid": "3ed50dc55c3d6d07c6bd167bdb30a2d3", "score": "0.5349407", "text": "def download\n @subscription = Subscription.find_by!(guid: params[:guid])\n resp = HTTParty.get(@subscription.plan.product.file.url)\n filename = @subscription.plan.product.file.url\n send_data resp.body,\n :filename => File.basename(filename),\n :content_type => resp.headers['Content-Type']\n end", "title": "" }, { "docid": "831dba3ab00da083bb0b34e96ffc4c8e", "score": "0.53483886", "text": "def download_file(file, dl_format = 'application/vnd.google-apps.script+json')\n file_data = file.to_hash\n if file_data['exportLinks'][dl_format]\n result = google_client.execute(\n :uri => file_data['exportLinks'][dl_format]\n )\n if result.status == 200\n return result.body\n else\n puts 'An error occurred:'\n puts result.body\n return nil\n end\n else\n puts 'An error occurred: No download url available'\n return nil\n end\n end", "title": "" }, { "docid": "a7da0113513924c69f6e3ee3354dce21", "score": "0.53170055", "text": "def download\n #check if project-release-file is match\n check_download_consistancy\n unless @error_msg.empty?\n render :text => @error_msg\n return\n end\n add_one_to_download_counter\n\n download_path_saved = URI::escape( \"#{@project.name}/#{@release.version}/#{@file.path}\" )\n\n #chech if file has a mandatory survey\n #TODO login user?\n if( survey_available? \n #and (session[:saved_download_path] != download_path_saved )\n )\n #save directly download link to tmp session\n #session[:saved_download_path] = download_path_saved\n session[:tmp_path] = download_path_saved\n\n survey = @file.survey\n\n #go to fill downloader form\n redirect_to downloader_path(@project.name, @release.version, @file.path, survey.id) \n\n return\n end\n\n redirect_to \"#{request.protocol}#{OPENFOUNDRY_HOST}#{root_path}/download/#{download_path_saved}\"\n end", "title": "" }, { "docid": "e2f74d246fc5b6e9f8ec8a065de07163", "score": "0.5290878", "text": "def download\n if params[:file]\n @directory_path = APP_CONFIG['conversion_report_path']\n @file_name = params[:file]\n elsif params[:report]\n @directory_path = APP_CONFIG['conversion_report_path']\n if params[:report] == \"custfo\"\n if can?(:>=,\"2\")\n @file_name = Report.get_file_name(params[:report], current_user)\n @display_name = @file_name.split(\"_\").last\n else\n redirect_to unauthorized_url\n end\n else\n @file_name = Report.get_file_name(params[:report], current_user)\n @display_name = @file_name.split(\"_\").last\n end\n end\n if params[:type] == \"manual\"\n send_file @file_name,:filename => @display_name, :disposition => \"attachment\"\n else\n send_file \"#{@directory_path}#{@file_name}\",:filename => @display_name, :disposition => \"attachment\"\n end\n end", "title": "" }, { "docid": "bce03cbc162cfc994ae2c98f6a06a37c", "score": "0.52704734", "text": "def download\n format = params[:format] || 'qrda'\n\n file = if format == 'qrda' && @product_test.patient_archive.file\n @product_test.patient_archive.file\n else\n Cypress::CreateDownloadZip.create_test_zip(@product_test.id, format)\n end\n file_name = \"#{@product_test.cms_id}_#{@product_test.id}.#{format}.zip\".tr(' ', '_')\n send_data file.read, type: 'application/zip', disposition: 'attachment', filename: file_name\n end", "title": "" }, { "docid": "cc30e38bac49a44052bd55cf7bf5f5a0", "score": "0.5254704", "text": "def download_file(options)\n get(\"string/download\", options)\n end", "title": "" }, { "docid": "10a9e8bd5f59439ae0ea2b0b7b214ad7", "score": "0.52542055", "text": "def getGlossaryFile(params = {})\n params[:is_download] = true\n self.get_from_gengo('translate/glossary/download/:id'.gsub(':id', params.delete(:id).to_s), params)\n end", "title": "" }, { "docid": "648aa4da59463a27ae3409c421319948", "score": "0.5234725", "text": "def download_to_file(path, params = {})\n @session.drive.get_file(id, {download_dest: path}.merge(params))\n end", "title": "" }, { "docid": "c835798771264f158c45a0ef000103ca", "score": "0.5219921", "text": "def download\n file = UserFile.exist_refresh_state(@context, params[:uid])\n\n if file.state != UserFile::STATE_CLOSED\n raise ApiError, \"Files can only be downloaded if they are in the 'closed' state\"\n end\n\n if file.license.present? && !file.licensed_by?(@context)\n raise ApiError, \"You must accept the license before you can download this\"\n end\n\n file_url = file.file_url(@context, params[:inline])\n\n redirect_to URI.parse(file_url).to_s\n end", "title": "" }, { "docid": "1e81ef49ede07c49458ffaef52cab415", "score": "0.52154505", "text": "def download\n ids = params[:ids].split(',')\n @files = Ckeditor::Asset.find(ids)\n t = Tempfile.new(\"tmp-zip-#{Time.now.to_i}\")\n Zip::OutputStream.open(t.path) do |zos|\n @files.each do |file|\n filename = file.filename\n zos.put_next_entry(filename)\n tmp_file = Tempfile.new(filename)\n open(file.url) do |data|\n tmp_file.write data.read.force_encoding('UTF-8')\n end\n zos.print IO.read(tmp_file)\n tmp_file.close\n end\n end\n filename = \"#{Georgia.title.try(:parameterize) || 'georgia'}_assets_#{Time.now.strftime('%Y%m%d%H%M%S')}.zip\"\n t.close\n\n send_file t.path, type: \"application/zip\", disposition: 'attachment', filename: filename\n end", "title": "" }, { "docid": "2bc44e540a6b63a6c0d46cf6c4dae8bb", "score": "0.5186788", "text": "def file_download\n file_set = geo_file_set\n return unless file_set\n id = file_set.primary_file.id.to_s\n path = url_helpers.download_path(resource_id: file_set.id.to_s, id: id)\n \"#{protocol}://#{host}#{path}\"\n end", "title": "" }, { "docid": "335cabbd9350c00a3e0e14ff2f841cb5", "score": "0.5180451", "text": "def download\n if can?(:>=, \"2\")\n if params[:file]\n @directory_path = APP_CONFIG['agusta_report_path']\n @file_name = params[:file]\n elsif params[:report]\n @directory_path = APP_CONFIG['agusta_report_path']\n @file_name = Report.get_file_name(params[:report], current_user)\n @display_name = @file_name.split(\"_\").last\n end\n send_file \"#{@directory_path}#{@file_name}\", :filename => @display_name, :disposition => \"attachment\"\n else\n redirect_to unauthorized_url\n end\n end", "title": "" }, { "docid": "dd6933ebe19c4a07d6acb74db4d1c1d6", "score": "0.5178693", "text": "def download!(args = {})\n if args[:to].nil?\n dir = \"/tmp\"\n file_name = \"#{dir}/#{generate_file_name}\"\n else\n dir = generate_custom_file_path(args)\n file_name = \"#{dir}/#{generate_file_name}\"\n end\n \n data = RestClient.get(self.url, :timeout => 10)\n file = File.new(file_name, 'w')\n file.write(data)\n file.close\n \n type = Mimer.identify(file_name)\n \n if type.zip?\n file_ending = \".zip\"\n elsif type.rar?\n file_ending = \".rar\"\n else\n file_ending = \"\"\n end\n \n new_file_name = \"#{dir}/#{title.gsub(/\\s+/, '.')}#{file_ending}\"\n \n # Changing the name on the file\n FileUtils.mv(file_name, new_file_name)\n \n # I like return :)\n return new_file_name\n end", "title": "" }, { "docid": "c311e02be03208d079ae018458804a25", "score": "0.51686835", "text": "def download\n get '/download', params: { 'id' => @id }\n end", "title": "" }, { "docid": "f20d97c736c9990bac1ab86834935229", "score": "0.51640457", "text": "def get_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/reference/locales/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Locale.new(r)\n end", "title": "" }, { "docid": "f20d97c736c9990bac1ab86834935229", "score": "0.51640457", "text": "def get_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/reference/locales/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Locale.new(r)\n end", "title": "" }, { "docid": "36a44b0fed6b0d2ea27297689d240218", "score": "0.51494765", "text": "def download\n @file = UserFile.exist_refresh_state(@context, params[:id])\n if @file.state != \"closed\"\n flash[:error] = \"Files can only be downloaded if they are in the 'closed' state\"\n redirect_to file_path(@file)\n elsif @file.license.present? && !@file.licensed_by?(@context)\n flash[:error] = \"You must accept the license before you can download this\"\n redirect_to @file.parent_type == \"Asset\" ? asset_path(@file) : file_path(@file)\n else\n file_url = @file.file_url(@context, params[:inline])\n redirect_to URI.parse(file_url).to_s\n end\n end", "title": "" }, { "docid": "eab6c998fe18d6d94a67b123c9e2bd2d", "score": "0.5146519", "text": "def download\n @project = get_project\n @project.increment_downloads\n redirect_to @project.download_url\n end", "title": "" }, { "docid": "02a0750685607ba17d7991ad162c45a2", "score": "0.5136088", "text": "def download\n filename = [params[:file_name], '.', params[:format]].join\n base, suffix = filename.split(\".\")\n send_file(Rails.root.join(\"private\", filename), filename: \"#{base}_#{Time.zone.now.strftime('%Y%m%d')}.#{suffix}\")\n end", "title": "" }, { "docid": "11024054ab5a7d3926272d96eb6d316d", "score": "0.513113", "text": "def download\n URI.open(download_url, \"rb\")\n end", "title": "" }, { "docid": "0a3381df4bbfbfe4b97fa6c3ec8d56b6", "score": "0.51260096", "text": "def download(path=nil)\n data = @api.download([id, nil])\n return data.body if path == nil\n ::File.open(path, 'wb') do |file|\n file << data\n end\n end", "title": "" }, { "docid": "6da16915892addff8f7fde5fbe300503", "score": "0.5118164", "text": "def project_download_path(project, path = nil, options = {})\n options.delete(:rev) if options.key?(:rev) and options[:rev].blank?\n super(project, path, options)\n end", "title": "" }, { "docid": "626883f358f1fea1261ecb68102f25bd", "score": "0.5087998", "text": "def download\n test = current_user.product_tests.find(params[:id])\n format = params[:format]\n file = Cypress::CreateDownloadZip.create_test_zip(test.id,format)\n\n if format == 'csv'\n send_file file.path, :type => 'text/csv', :disposition => 'attachment', :filename => \"Test_#{test.id}.csv\"\n else\n send_file file.path, :type => 'application/zip', :disposition => 'attachment', :filename => \"Test_#{test.id}._#{format}.zip\"\n end\n \n file.close\n end", "title": "" }, { "docid": "371d084cc77bf0a9d01226bde140e5c2", "score": "0.50597936", "text": "def export_as_file(project)\n params = {project_id: project.id}\n @client.api_helper.get_response(Config::TODOIST_TEMPLATES_EXPORT_AS_FILE_COMMAND, params)\n end", "title": "" }, { "docid": "eabc838222a267e9843e31820b285725", "score": "0.5055199", "text": "def token_download(export_uuid)\n request.get({ path: \"/tokens/#{export_uuid}/download\", headers: headers })\n end", "title": "" }, { "docid": "14bec6dfada23415de239851ed40b6d5", "score": "0.50444484", "text": "def locales_list_with_http_info(project_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LocalesApi.locales_list ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling LocalesApi.locales_list\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/locales'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Locale>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LocalesApi#locales_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "ca21cfa59311f834b6a1c6bbd05bdd32", "score": "0.50307256", "text": "def download(format, variables = [], case_subset = nil)\n path = \"study/#{@id}/download\"\n\n query_string = [\"format=\" + format]\n query_string += collect_list(variables, \"var\", :id)\n query_string.push(\"caseSubset=\" + case_subset) unless case_subset.nil?\n\n path += \"?\" + query_string.join('&')\n\n get_binary(path) do | data |\n if block_given?\n yield(data)\n else\n file = Tempfile.new(\"#{@name}.#{format}\")\n file.write(data)\n file.close\n return file\n end\n end\n end", "title": "" }, { "docid": "9938663a7c945257cd2c695b0f94041f", "score": "0.50267446", "text": "def download\n @workflow_port = WorkflowPort.find(params[:id])\n path = @workflow_port.sample_file_actual_path\n filetype = MIME::Types.type_for(path)\n send_file path, :type=> filetype, :name => @workflow_port.sample_file\n end", "title": "" }, { "docid": "0250299a9a257b6cf0c578ef713d5f11", "score": "0.5020455", "text": "def locale_delete(project_id, id, params)\n path = sprintf(\"/api/v2/projects/%s/locales/%s\", project_id, id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.kind_of?(PhraseApp::RequestParams::LocaleDeleteParams)\n raise PhraseApp::ParamsHelpers::ParamsError.new(\"Expects params to be kind_of PhraseApp::RequestParams::LocaleDeleteParams\")\n end\n end\n \n data_hash = params.to_h\n err = params.validate\n if err != nil\n return nil, err\n end\n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"DELETE\", path, reqHelper.ctype, reqHelper.body, 204)\n if err != nil\n return nil, err\n end\n \n return err\n end", "title": "" }, { "docid": "252d261bfade3dbf48c5e67033ecf697", "score": "0.5018758", "text": "def get()\n path = '/locale'\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Locale\n )\n end", "title": "" }, { "docid": "6255aa2119410d62fde38404976985b0", "score": "0.5008222", "text": "def bridge_download_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CartApi.bridge_download ...\"\n end\n # resource path\n local_var_path = \"/bridge.download.file\"\n\n # query parameters\n query_params = {}\n query_params[:'whitelabel'] = opts[:'whitelabel'] if !opts[:'whitelabel'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/zip'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key', 'store_key']\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 => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CartApi#bridge_download\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ce30dd93805f5900d5241571ff3e2e21", "score": "0.5006169", "text": "def upload_catalog_translation_with_http_info(locale, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: InvoicesApi.upload_catalog_translation ...\"\n end\n # verify the required parameter 'locale' is set\n if @api_client.config.client_side_validation && locale.nil?\n fail ArgumentError, \"Missing the required parameter 'locale' when calling InvoicesApi.upload_catalog_translation\"\n end\n if @api_client.config.client_side_validation && locale !~ Regexp.new(/.*/)\n fail ArgumentError, \"invalid value for 'locale' when calling InvoicesApi.upload_catalog_translation, must conform to the pattern /.*/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/invoices/catalogTranslation/{locale}\".sub('{' + 'locale' + '}', locale.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'deleteIfExists'] = opts[:'delete_if_exists'] if !opts[:'delete_if_exists'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/plain'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvoicesApi#upload_catalog_translation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "0d4a298e8c1c80712240f39cb590dbe4", "score": "0.5002124", "text": "def export_format_label(format)\n t(\"geoblacklight.download.export_#{format.to_s.parameterize(separator: \"_\")}_link\")\n end", "title": "" }, { "docid": "5b4788bc97b52268c4539371a56344a2", "score": "0.5001764", "text": "def download(id, optional = {})\n call(:post, \"#{path(id)}actions/download/\", :payload => { :optional => optional })\n end", "title": "" }, { "docid": "96fd02b43c72d262af83af64529897b9", "score": "0.49961683", "text": "def export_files\n unless request.headers['Accept'].nil? || request.headers['Accept'] == 'application/fhir+ndjson'\n status_not_acceptable_with_custom_errors([\"'Accept' header must have a value of 'application/fhir+ndjson'\"]) && return\n end\n\n id = params.require(:id)\n resource_type = params.require(:resource_type)&.downcase\n authorize_resource_type_read(resource_type)\n\n download = current_client_application&.api_downloads&.find_by(id: id)\n status_not_found_with_custom_errors(['No file found at this URL']) && return if download.nil?\n\n # Find and return the specific attachment associated with the given filename\n attachment = download.files.blobs.where(filename: \"#{resource_type}.ndjson\").first\n status_not_found_with_custom_errors(['No file found at this URL']) && return if attachment.nil?\n\n # Set the headers before streaming the returned content\n response.headers['Content-Type'] = 'application/fhir+ndjson'\n\n attachment.download do |chunk|\n response.stream.write chunk\n end\n ensure\n response.stream.close\n end", "title": "" }, { "docid": "9eb759ebecbe3f6285b4c14aff10b714", "score": "0.49955785", "text": "def download\n __log_activity\n __debug_route\n @item = get_record\n link = @item.download_url\n respond_to do |format|\n format.html { redirect_to(link, allow_other_host: true) }\n format.json { render_json download_values(link) }\n format.xml { render_xml download_values(link) }\n end\n rescue => error\n post_response(error, xhr: true)\n end", "title": "" }, { "docid": "fe8e241d951db4f9c471eeaca8e4e81c", "score": "0.49937895", "text": "def download_text(format)\n download_format = proper_case_format(format)\n value = t(\"geoblacklight.download.download_link\", download_format: download_format)\n value.html_safe\n end", "title": "" }, { "docid": "7f06b09a181a006fb650c5de87222188", "score": "0.4989185", "text": "def download_file\n source_file = Item.new(Path.new(params[:source_file]))\n response = {}\n response[:source_file] = source_file\n\n if !source_file.path.exist?\n response[:msg] = \"Fail\"\n render json: response, status: 404\n return\n end\n\n respond_to do |format|\n format.json { render json: response }\n format.file { send_file source_file.path.to_path }\n end\n \n end", "title": "" }, { "docid": "8612383bca6b1bcab3d5b85a257164df", "score": "0.49886727", "text": "def download_asset(id) #FIXME: File not found at path, error in result but method works\n return @client.raw(\"get\", \"/content/assets/download/#{id}\")\n end", "title": "" }, { "docid": "3dbd78f02e9e9a8548c74e32bac2f69e", "score": "0.49744368", "text": "def download\n\t\n\trequire 'open-uri'\n\n \tfile = open(params[:download_url])\n \tbasename = File.basename(params[:download_url])\n \ttune_id = params[:tune_id]\n \t\n \tcreate_with_attachment(file, basename, tune_id)\n\tparams.has_key?(:redirect) ? (redirect_to params[:redirect]) : (render :json => @resource)\n \t\n end", "title": "" }, { "docid": "4342d69aacb66c9e2ed632ee91c44031", "score": "0.49736652", "text": "def download(id)\n _get(\"/file-collection/#{id}/files/download\") { |json| json }\n end", "title": "" }, { "docid": "2f5b208ccd06708cae91ec0d1b0551ab", "score": "0.49719658", "text": "def download_file\n return send_file_to_browser if params[:doc_refno]\n\n Rails.logger.error('file parameter is missing:')\n raise Error::AppError.new('download file', 'file not found')\n end", "title": "" }, { "docid": "0b554363239f5dd89349b5edaa27b5a5", "score": "0.4964071", "text": "def download_asset(id)\n # FIXME: File not found at path, error in result but method works\n @client.raw('get', \"/content/assets/download/#{id}\")\n end", "title": "" }, { "docid": "7541bdaa3ee2717b9359cd0fbc70ee0f", "score": "0.49589312", "text": "def download(hash)\n header = { 'User-Agent' => 'SubDB/1.0 (MejorSub /1.0;\n https://github.com/mejorf/mejorsub)' }\n http = Net::HTTP.new 'api.thesubdb.com'\n begin\n download = http.send_request('GET', '/?action=download&hash=' + hash +\n \"&language=#{@language}\", nil, header)\n out = @files_and_hashes.key(hash).gsub(/\\.[^.]*$/, '.srt')\n unless download.body.empty?\n File.open(out, 'wb') { |f| f.write(download.body) }\n puts out + 'successfully downloaded'\n @count_sucess += 1\n else\n puts out + 'failed'\n @count_fail += 1\n end\n rescue Exception => e\n puts e\n end\n end", "title": "" }, { "docid": "ca15c7d715313fd937c4fc96da772a47", "score": "0.4957926", "text": "def translations_by_locale(project_id, locale_id, page, per_page, params)\n path = sprintf(\"/api/v2/projects/%s/locales/%s/translations\", project_id, locale_id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.kind_of?(PhraseApp::RequestParams::TranslationsByLocaleParams)\n raise PhraseApp::ParamsHelpers::ParamsError.new(\"Expects params to be kind_of PhraseApp::RequestParams::TranslationsByLocaleParams\")\n end\n end\n \n data_hash = params.to_h\n err = params.validate\n if err != nil\n return nil, err\n end\n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request_paginated(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)\n if err != nil\n return nil, err\n end\n \n return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Translation.new(item) }, err\n end", "title": "" }, { "docid": "d0b31282ea111426ae69024fc3dd8cbd", "score": "0.49566785", "text": "def download\n ids = params[:ids].split(',')\n @files = Ckeditor::Asset.where(id: ids)\n authorize @files\n zip_file = Georgia::CompressFiles.new(@files).file\n send_file zip_file.path, type: \"application/zip\", disposition: 'attachment', filename: zip_file.filename\n end", "title": "" }, { "docid": "c81bf39e8056607492f4d05a57d7764b", "score": "0.4954871", "text": "def download(api_params)\n File.open(File.basename(api_params[:download_location]), 'wb') do |file|\n file.write(api_params[\"data\"])\n end\n end", "title": "" }, { "docid": "da9d1d97c030a749d9b52ca32e175327", "score": "0.49536344", "text": "def locale_show_with_http_info(project_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LocalesApi.locale_show ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling LocalesApi.locale_show\"\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 LocalesApi.locale_show\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'LocaleDetails' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LocalesApi#locale_show\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "685132dc9524613926c1eaaf267cef58", "score": "0.49530712", "text": "def translations\n session[:translation_option] = params[:translation_option] if params[:translation_option]\n session[:show_keys] = params[:show_keys] if params[:show_keys]\n @translation_option = TranslationOption.find(session[:translation_option])\n case @translation_option\n when TranslationOption.translated\n @translations = @locale.translations.translated\n when TranslationOption.unsourced\n @translations = @locale.translations.unsourced\n else\n @translations = @locale.translations.untranslated\n end\n if params[:export] == 'csv'\n csv_string = CSV.generate do |csv|\n csv << ['Original','Translation','Plural','Key']\n @translations.each do |translation|\n next unless default_value = translation.default_locale_value\n line = []\n line << default_value\n line << translation.value\n line << translation.pluralization_index\n line << translation.raw_key if translation.raw_key != default_value\n csv << line\n end\n end\n send_data csv_string, :type => 'text/plain', :filename=>\"#{@locale.code}_#{@translation_option ? @translation_option.code : 'untranslated'}_#{Time.now.strftime('%Y%m%d%H%M%S')}.csv\", :disposition => 'attachment'\n else\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @translations }\n end\n end\n end", "title": "" }, { "docid": "b461539de3b4b531581574366c0a76cd", "score": "0.4946855", "text": "def download\n require 'active_support/core_ext/hash/deep_merge'\n\n @downloaded_datum = DownloadedDatum.find(params[:id])\n\n prov = {\"has_provenance\"=>\"#{ENV['PROV_SERVER']}/store/bundles/#{@downloaded_datum.prov_id}\"}\n\n data = ActiveSupport::JSON.decode(@downloaded_datum.data).deep_merge(prov)\n\n send_data data.to_json,\n :type => 'text',\n :disposition => \"attachment; filename=#{@downloaded_datum.data_provider_user.data_provider.name+Time.now.to_s}.txt\"\n end", "title": "" }, { "docid": "e068fc3f02c3b13a81368819da6fca02", "score": "0.49442753", "text": "def pull_locales()\n @log.info('Downloading locales...'.cyan.bright)\n\n get_locale_ids.each do |id|\n pull_locale(id)\n TranslationBuilder.build(\"#{@locale_specific_map[id.to_sym] || id}\")\n end\n end", "title": "" }, { "docid": "e7c6e96aae54ad24470e28a8bbdf6a18", "score": "0.4940601", "text": "def download\n @queja = Queja.find(params[:id])\n send_file(@queja.evidencia.path)\n end", "title": "" }, { "docid": "6f838422bd9774bce63c6a8c852ff47d", "score": "0.4936167", "text": "def export(api_key:, project_id:, language:, type:, tags:nil, filters:nil)\n options = {\n \"id\" => project_id,\n \"language\" => convert_to_poeditor_language(language),\n \"type\" => type,\n \"tags\" => (tags || []).join(\",\"),\n \"filters\" => (filters || []).join(\",\"),\n }\n response = self.api(\"projects/export\", api_key, options)\n data = JSON(response.body)\n unless data[\"response\"][\"status\"] == \"success\"\n code = data[\"response\"][\"code\"]\n message = data[\"response\"][\"message\"]\n raise POEditor::Exception.new \"#{message} (#{code})\"\n end\n\n download_uri = URI(data[\"result\"][\"url\"])\n content = Net::HTTP.get(download_uri)\n\n case type\n when \"apple_strings\"\n content.gsub!(/(%(\\d+\\$)?)s/, '\\1@') # %s -> %@\n when \"android_strings\"\n content.gsub!(/(%(\\d+\\$)?)@/, '\\1s') # %@ -> %s\n end\n\n unless content.end_with? \"\\n\"\n content += \"\\n\"\n end\n return content\n end", "title": "" }, { "docid": "6211db57aad09f20e6131e3e296adb38", "score": "0.49349314", "text": "def download(path)\n resp = self.class.conn.get(download_url)\n path.open('wb') { |fh| fh.write(resp.body) }\n rescue Faraday::ResourceNotFound => e\n raise PuppetForge::ReleaseNotFound, \"The module release #{slug} does not exist on #{self.class.conn.url_prefix}.\", e.backtrace\n rescue Faraday::ClientError => e\n if e.response && e.response[:status] == 403\n raise PuppetForge::ReleaseForbidden.from_response(e.response)\n else\n raise e\n end\n end", "title": "" }, { "docid": "7432f5bd1f6dc313614ee9962714153e", "score": "0.49341315", "text": "def upload_invoice_translation_with_http_info(locale, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: InvoicesApi.upload_invoice_translation ...\"\n end\n # verify the required parameter 'locale' is set\n if @api_client.config.client_side_validation && locale.nil?\n fail ArgumentError, \"Missing the required parameter 'locale' when calling InvoicesApi.upload_invoice_translation\"\n end\n if @api_client.config.client_side_validation && locale !~ Regexp.new(/.*/)\n fail ArgumentError, \"invalid value for 'locale' when calling InvoicesApi.upload_invoice_translation, must conform to the pattern /.*/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/invoices/translation/{locale}\".sub('{' + 'locale' + '}', locale.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'deleteIfExists'] = opts[:'delete_if_exists'] if !opts[:'delete_if_exists'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/plain'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvoicesApi#upload_invoice_translation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d72248904274576de3fc39bfc9a4542b", "score": "0.49315387", "text": "def download org, file_path\n assert_org_is_configured org\n assert_dl_dir_is_configured\n assert_dir_exists file_path\n\n loan_entry_page\n .load_org(org_string(org))\n .download\n\n file_path = Pathname(file_path)\n file_path = file_path + DL_FILENAME if file_path.directory?\n\n dl_file = download_dir + DL_FILENAME\n wait_for_file(dl_file, PortalModule.configuration.download_timeout)\n assert_file_exists dl_file\n\n FileUtils.mv dl_file, file_path\n\n rescue Exception => e\n if e.message.include? 'No such file or directory'\n raise IOError, \"No such directory - #{file_path}\"\n else\n raise e\n end\n end", "title": "" }, { "docid": "d875dfecedb849ea7abf3cd153f5c70f", "score": "0.4915956", "text": "def translate\n params = {\n key: @key,\n text: @text,\n lang: \"#{@from}-#{@to}\"\n }\n response = RestClient.get(\"https://translate.yandex.net/api/v1.5/tr.json/translate\", {params: params})\n json = JSON.parse(response.body)\n file = DataFile::open(@text, json)\n json['text'][0]\n end", "title": "" }, { "docid": "bf2fb9ab6d04a32c2b7f3ccc3a397a91", "score": "0.49149218", "text": "def download(repo, id, options={})\n get \"#{Repository.path repo}/downloads/#{id}\", options\n end", "title": "" }, { "docid": "45b78fbd497439d1e2abe9a9c7977a5d", "score": "0.49049157", "text": "def download(id)\n res, url = self.class.fetch(DOWNLOAD + id)\n filename = File.basename(url)\n if File.exist? filename\n return unless yield filename\n end\n File.open(File.join(@dl_dir, filename), 'w') { |f| f.write(res.body) }\n end", "title": "" }, { "docid": "4f9cd03461880501c908e9271f2812ed", "score": "0.49045873", "text": "def download(opts = {})\n data, _status_code, _headers = download_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "5c972381e78d6fcb59c9b37997191ff8", "score": "0.49024394", "text": "def download\n @ctsa_report = CtsaReport.find(params[:id])\n @ctsa_report_xml_file_path = @ctsa_report.create_xml_report(\"#{Rails.root}/tmp/ctsa_reports/\")\n zip_file = @ctsa_report.create_zip_file\n send_data(zip_file.data, :type => \"application/zip\", :filename => \"ctsa_annual_report.zip\")\n end", "title": "" }, { "docid": "ae8c92cd2c0927833c3198cb6f0e6eb3", "score": "0.48955923", "text": "def download\n Log.add_info(request, '') # Not to show passwords.\n\n attach = Attachment.find(params[:id])\n\n post_item = ZeptairPostHelper.get_item_for(@login_user)\n\n if post_item.id != attach.item_id\n render(:text => 'ERROR:' + t('msg.system_error'))\n return\n end\n\n if attach.location == Attachment::LOCATION_DIR\n\n filepath = AttachmentsHelper.get_path(attach)\n\n send_file(filepath, :filename => attach.name, :stream => true, :disposition => 'attachment')\n else\n send_data(attach.content, :type => (attach.content_type || 'application/octet-stream')+';charset=UTF-8', :disposition => 'attachment;filename=\"'+attach.name+'\"')\n end\n end", "title": "" }, { "docid": "e755e4ff7ad5a6400d97fa8873a39680", "score": "0.4892794", "text": "def download\n if @files.size > 1 or (@files.size == 1 and @files.first.is_directory)\n files_by_name = get_files_by_name(@files).sort{|x,y| x <=> y}\n\n zip = Zip::OutputStream.write_buffer do |zip_stream|\n files_by_name.each do |name, file|\n zip_stream.put_next_entry name\n zip_stream.print file.content\n end\n end\n\n zip.rewind\n send_data zip.read, filename: \"project.zip\", type: \"application/zip\"\n\n elsif @files.size == 1\n file = @files.shift\n send_data file.content, filename: file.name, type: \"text/plain\"\n else\n render_error \"No files specified.\"\n end\n end", "title": "" }, { "docid": "4279f6b2c02ae05a89a6f233f8818707", "score": "0.4890654", "text": "def account_locales_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LocalesApi.account_locales ...'\n end\n # resource path\n local_var_path = '/accounts/{account_id}/locales'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<LocalePreview1>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LocalesApi#account_locales\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "461c63792fdec879f5507fc432f437a0", "score": "0.48873043", "text": "def download_iso\n @resume_book = ResumeBook.find(params[:id])\n send_file @resume_book.iso_file, type: 'application/octet-stream', x_sendfile: true\n end", "title": "" }, { "docid": "f2ed7b4f653e08e8204ad052a5600054", "score": "0.4886835", "text": "def export_bundle\n export_id=Time.now.to_i\n export_data = []\n\n Locale.all.each do |locale|\n locale_data = Message.export(export_id, locale).\n concat(Page.export(export_id, locale))\n\n export_data.concat(locale_data) unless locale_data.empty?\n end\n\n bundler = ZipBundler.new(export_data, export_id)\n bundle_path = bundler.bundle!\n file = File.open(bundle_path, 'r')\n file_content = file.read\n file.close()\n\n send_data file_content, :type => 'application/zip',\n :filename => File.basename(bundle_path),\n :disposition => 'attachment'\n end", "title": "" }, { "docid": "b5f6c83bc6cf56a969cf77237c1d416d", "score": "0.48850462", "text": "def get_download_with_http_info(download_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DownloadsApi.get_download ...\"\n end\n # verify the required parameter 'download_id' is set\n fail ArgumentError, \"Missing the required parameter 'download_id' when calling DownloadsApi.get_download\" if download_id.nil?\n # resource path\n local_var_path = \"/downloads/{downloadId}\".sub('{format}','json').sub('{' + 'downloadId' + '}', download_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\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 auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DownloadEntry')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DownloadsApi#get_download\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "8f0e73709285b9e71a634673b9fd51b7", "score": "0.48845682", "text": "def download_job_artifact_file(project_id, job_id, artifact_path)\n get(\"/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/#{artifact_path}\",\n format: nil,\n headers: { Accept: 'application/octet-stream' },\n parser: proc { |body, _|\n if body.encoding == Encoding::ASCII_8BIT # binary response\n ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')\n else # error with json response\n ::Gitlab::Request.parse(body)\n end\n })\n end", "title": "" }, { "docid": "bc333424988c575fdc383e6fcba7be1c", "score": "0.48832652", "text": "def download_file(uri, http)\n if @info.options.key?(:download_path)\n download_to_path(uri, http, @info.options[:download_path])\n else\n http.request(Net::HTTP::Get.new(uri))\n end\n end", "title": "" }, { "docid": "227f73ea3b33512368f9b407a9fae5c0", "score": "0.4879046", "text": "def update_export_file\n lines = format_export_file(localization_strings, translated_strings)\n write_export_file_lines(lines)\n end", "title": "" }, { "docid": "8f13b8afc523a5e20d448f5c2c00bf01", "score": "0.48709157", "text": "def download\n @cms_file = CmsFile.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"+@cms_file.cmsfile.url.split(\"?\")[0], :disposition => 'inline', :stream => false)\n end", "title": "" }, { "docid": "ffe7c89ffd0f81c100a2d42e9ebf5381", "score": "0.4868552", "text": "def get_download(path, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: StorageApi#get_download ...\"\n end\n \n # verify the required parameter 'path' is set\n fail \"Missing the required parameter 'path' when calling get_download\" if path.nil?\n \n # resource path\n path = \"/storage/file/{path}\".sub('{format}','json').sub('{' + 'path' + '}', path.to_s)\n \n # query parameters\n query_params = {}\n query_params[:'versionId'] = opts[:'version_id'] if opts[:'version_id']\n query_params[:'storage'] = opts[:'storage'] if opts[:'storage']\n \n # header parameters\n header_params = {}\n \n # HTTP header 'Accept' (if needed)\n _header_accept = ['multipart/form-data']\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 = []\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 = nil\n \n \n auth_names = []\n result = @api_client.call_api(:GET, 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 => 'File')\n if Configuration.debugging\n Configuration.logger.debug \"API called: StorageApi#get_download. Result: #{result.inspect}\"\n end\n return result\n end", "title": "" }, { "docid": "dab0336dd629e4f5bcbbcdcbf678ebe6", "score": "0.48676604", "text": "def download(file_path)\n ensure_client && ensure_uri\n client.download_file(\"#{BASE_URI}/download/#{@data['uri'].split('/').last}\", file_path)\n end", "title": "" }, { "docid": "3b7b190a5863c9a10dbd0ae1cbedcfa8", "score": "0.48673314", "text": "def job_locale_complete_with_http_info(project_id, job_id, id, job_locale_complete_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locale_complete ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling JobLocalesApi.job_locale_complete\"\n end\n # verify the required parameter 'job_id' is set\n if @api_client.config.client_side_validation && job_id.nil?\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling JobLocalesApi.job_locale_complete\"\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 JobLocalesApi.job_locale_complete\"\n end\n # verify the required parameter 'job_locale_complete_parameters' is set\n if @api_client.config.client_side_validation && job_locale_complete_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'job_locale_complete_parameters' when calling JobLocalesApi.job_locale_complete\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/jobs/{job_id}/locales/{id}/complete'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.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 header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(job_locale_complete_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'JobLocale' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: JobLocalesApi#job_locale_complete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "b119a11585ed68a852df8bdfce0b7971", "score": "0.48613742", "text": "def download_files\n with_exp_backoff(LokaliseRails.max_retries_import) do\n api_client.download_files project_id_with_branch, LokaliseRails.import_opts\n end\n rescue StandardError => e\n raise e.class, \"There was an error when trying to download files: #{e.message}\"\n end", "title": "" } ]
5fb0b11ae7f77ae76636d19472e6f968
GET /cities/1 GET /cities/1.json
[ { "docid": "f7ff3088411c11b4d7c60701c938c300", "score": "0.0", "text": "def show\n # @city = City.find(params[:id])\n @city = City.friendly.find(params[:id])\n end", "title": "" } ]
[ { "docid": "03992d4cf22850c18ff973fb98dd09e6", "score": "0.7298952", "text": "def index\n @cities = City.all\n\n render json: @cities\n end", "title": "" }, { "docid": "e985ae83b9e7b9086fb4ba42e6ceb68a", "score": "0.72530884", "text": "def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end", "title": "" }, { "docid": "a79ca8c6072a3ea44acc343ec2e43d80", "score": "0.7168866", "text": "def show_cities\n\n @cities = City.where(\"country_id = ?\", params[:country_id])\n\n render json: @cities\n \n end", "title": "" }, { "docid": "aa40c4adba53227f45533773b8f4b1b7", "score": "0.6876525", "text": "def show\n @city = City.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @city }\n end\n end", "title": "" }, { "docid": "09c28f337980de9fc7e4e4e001b8a9b0", "score": "0.6864428", "text": "def index\n if params[:country]\n country = Country.find_by_id(params[:country])\n if !country.nil?\n @cities = country.cities\n else\n flash[:error] = t(:country_not_found)\n @cities = nil\n end\n else\n return redirect_to countries_path\n end\n\n respond_to do |format|\n# format.html # index.html.erb\n format.json { render json: @cities }\n end\n end", "title": "" }, { "docid": "b34beff8e519ee64e265f989785a0da2", "score": "0.6851983", "text": "def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cities }\n format.js\n end\n end", "title": "" }, { "docid": "088865e870655f9b1e433cb13ecdb269", "score": "0.68275726", "text": "def show\n @city = City.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @city }\n end\n end", "title": "" }, { "docid": "52c41dee5932a5b5c0c0763bad89147f", "score": "0.6825104", "text": "def cities\n cities = CS.cities(params[:id], :GB)\n if cities.blank?\n country = ISO3166::Country.find_country_by_alpha3(params[:id])\n cities = country_cites(country)\n return(render json: { message: I18n.t(:invalid_country) }) if cities.blank?\n end\n render json: cities\n end", "title": "" }, { "docid": "7dba29c72184dcb4e3957614ee77e550", "score": "0.6811574", "text": "def show\n render json: @city\n end", "title": "" }, { "docid": "80c7eb45f91bf2a02ffb28e174d0faee", "score": "0.6811519", "text": "def getCity\n @city_id=ReceiverAddress.where(id: params[:address_id]).first.city_id\n @city=City.where(id: @city_id).first\n respond_to do |format|\n format.html\n format.json {render json: @city}\n end\n end", "title": "" }, { "docid": "fae5df013747f4dfecb8d1b662b62851", "score": "0.67788744", "text": "def cities\n CS.get :us, :ca\n end", "title": "" }, { "docid": "4d75a4b1f8d85f8f2b3b9aba3d85c94c", "score": "0.6727149", "text": "def index\n @state = State.find(params[:state_id])\n @cities = City.where(:state_id => params[:state_id]).paginate(:page => params[:page], :per_page => 10, :order => 'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cities }\n end\n end", "title": "" }, { "docid": "5ade727e380e0be86d7290b8e25cf312", "score": "0.67045456", "text": "def show\n @sitecity = Sitecity.find_by_url(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitecity }\n end\n end", "title": "" }, { "docid": "de7b306b7ffb81047e92c8b3271b24fd", "score": "0.6668797", "text": "def index\n @cities = CITIES\n end", "title": "" }, { "docid": "89b9b0eb4c28e208d06d6341edb2ce9c", "score": "0.6644394", "text": "def index\n @user = User.find(params[:id])\n @cities = @user.cities\n render :index\n end", "title": "" }, { "docid": "1ebcbf9208b778e681f3be1d60d059d7", "score": "0.65875024", "text": "def index\n city_list = City.all\n puts city_list.inspect\n\n render json: city_list.to_json\n end", "title": "" }, { "docid": "dc9b30e07c6002b3eb782b318254bf98", "score": "0.6582801", "text": "def index\n\n if params[:region_id]\n\n @regions = Region.where(id: params[:region_id])\n render json: @regions, include: [:cities], show_children: true\n\n elsif params[:ip]\n\n @iprange = Iprange.find_by_ip params[:ip]\n\n if @iprange\n\n render json: @iprange.city, include: [:region], show_parent: true\n\n else\n throw ActiveRecord::RecordNotFound\n end\n\n else\n\n @cities = City.all\n\n render json: @cities\n\n end\n end", "title": "" }, { "docid": "4c506543270fc95c3425eac28b5357c8", "score": "0.6560298", "text": "def index\n get_paginated_cities\n if @cities.to_json \n History.create(:name => 'Kota', :status => 'Completed')\n render json: @cities.to_json\n else\n History.create(:name => 'Kota', :status => 'Failed')\n end\n end", "title": "" }, { "docid": "f734cf7c1d0553e48ab213f031696882", "score": "0.6514726", "text": "def index\n @cities = City.all\n end", "title": "" }, { "docid": "f734cf7c1d0553e48ab213f031696882", "score": "0.6514726", "text": "def index\n @cities = City.all\n end", "title": "" }, { "docid": "f734cf7c1d0553e48ab213f031696882", "score": "0.6514726", "text": "def index\n @cities = City.all\n end", "title": "" }, { "docid": "f734cf7c1d0553e48ab213f031696882", "score": "0.6514726", "text": "def index\n @cities = City.all\n end", "title": "" }, { "docid": "f734cf7c1d0553e48ab213f031696882", "score": "0.6514726", "text": "def index\n @cities = City.all\n end", "title": "" }, { "docid": "3f862a7a96ab8c591b8d1f1c2ce61eb8", "score": "0.6500772", "text": "def new\n @cities=State.find_by_id(params[:body][:id]).cities.select(\"id, name\")\n render :json=>success1(:cities=>@cities)\n end", "title": "" }, { "docid": "343562d2387f598c71881d3ba1952171", "score": "0.64650774", "text": "def index\n @cities = City.all\n if @cities.present?\n render :index, status: :ok\n else\n @message = \"no city found\"\n render :error, status: :not_found\n end\n end", "title": "" }, { "docid": "8e2e474a08938d40b8d57891db90ae30", "score": "0.64420855", "text": "def index\n all_cities = City.all\n return json_response([]) unless newest_city = all_cities.sort_by(&:updated_at).last\n Rails.logger.info \"newest_city is #{newest_city.inspect}\"\n render_if_stale(all_cities, last_modified: newest_city.updated_at.utc, etag: newest_city) do |city_presenters|\n city_presenters.map(&:hash)\n end\n # explicitly setting the Cache-Control response header to public and max-age, to make the response cachable by proxy caches\n expires_in caching_time, public: true\n end", "title": "" }, { "docid": "dd31438bee2543f62591db37a6bd8fae", "score": "0.64375865", "text": "def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end", "title": "" }, { "docid": "c7c8887d8a467e89da0310c3b6e7a72c", "score": "0.64087737", "text": "def get_city_by_id\n city = (!params['id'].nil?) ? City.find_by(id: params['id']) : nil\n if (!city.nil?)\n render json: {status: 'SUCCESS', message:'City found', data:city},status: :ok\n else\n render json: {status: 'ERROR', message:'City not found', data:city},status: :not_found\n end \n end", "title": "" }, { "docid": "3a2455826f972c71846432b0997f3ec1", "score": "0.63741726", "text": "def index\n\n@cities = City.all\n\nend", "title": "" }, { "docid": "b9ee7b22c4fa5e24bf0bf0e1af4b7580", "score": "0.63463706", "text": "def get_list_cities\n City.get_all_cities\n end", "title": "" }, { "docid": "9814db0a3aed9e2283a56e5d27ba1cde", "score": "0.63181853", "text": "def city\n fetch('dune.cities')\n end", "title": "" }, { "docid": "87b5336d90ece11ee51bd922d28f6c6a", "score": "0.62894297", "text": "def cities_in_state\n cities = State.find(params[:id]).cities.order(name: :asc)\n\n render json: cities.to_json(), status: :ok\n end", "title": "" }, { "docid": "0b169d3ec97303ac4e2ad07cb101a806", "score": "0.6205416", "text": "def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend", "title": "" }, { "docid": "1fb14b52deeb565512e3fb282b1d4496", "score": "0.62041014", "text": "def index\n @cities = current_user.cities\n \n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "9e086dd8bb04de25d2c4c84432af3d7e", "score": "0.6202316", "text": "def index\n @companies = Company.all\n @cities = City.all\n #render json: @companies\n render json: { :companies => @companies, :cities => @cities }\n end", "title": "" }, { "docid": "4295bdabac52bf0a53007aea953c97b6", "score": "0.6200545", "text": "def index\n @m_cities = MCity.all\n end", "title": "" }, { "docid": "948f01c2332a3db61132550da594cae8", "score": "0.6198308", "text": "def show\n @city = City.find(params[:id])\n end", "title": "" }, { "docid": "79ea446a9de3cd6f76e2f1766e23f332", "score": "0.6185639", "text": "def new\n @country = Country.find(params[:country_id])\n @state = State.find(params[:state_id])\n @city = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @city }\n end\n end", "title": "" }, { "docid": "fbc0f0c1dea0ffcf701fcbc6c72446b9", "score": "0.6174553", "text": "def index\n @sitecities = Sitecity.includes(:events).order(\"name asc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sitecities }\n end\n end", "title": "" }, { "docid": "8ae19dc243061efb39fb9a3439e78a44", "score": "0.614692", "text": "def show\n @city = City.find(params[:id])\n\n end", "title": "" }, { "docid": "83da38c48b99cbc07528287007de7b9d", "score": "0.61348623", "text": "def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end", "title": "" }, { "docid": "a1f9025cee516e74aae33efb339ddd26", "score": "0.6127854", "text": "def geo\n\t\tciudad = params[:id]\n\t\t@ubication = City.where(id: ciudad)\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @ubication }\n\t\tend\n\tend", "title": "" }, { "docid": "bc453518cb4679c3af9f95e72c380155", "score": "0.61244226", "text": "def show\n @city_district = CityDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @city_district }\n end\n end", "title": "" }, { "docid": "25e115523aba0ecff2c0d3abc5bc9b63", "score": "0.61197925", "text": "def new\n @cities = City.order 'name'\n @college = College.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @college }\n end\n end", "title": "" }, { "docid": "dbd46ed94139fcbfcf0780fcd899e550", "score": "0.61147344", "text": "def index\n @city = City.first\n end", "title": "" }, { "docid": "53e3c5cff94fede52f6417d85bcad4c1", "score": "0.61127573", "text": "def searchByCity\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\n\t\t\tresults = Doctor.where(\"city LIKE ?\", \"%#{prms['city'][0]}%\")\n\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend", "title": "" }, { "docid": "3b5771efc221c3822fc6a77322bca229", "score": "0.60970974", "text": "def show\n @city = City.find(params[:city_id])\n @city101 = @city.city101\n @ads = @city.ads.city101_125x125\n\n add_breadcrumb \"City 101\", city_101_path(@city)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @city101 }\n end\n end", "title": "" }, { "docid": "0577019408334f5545d47b0cfc91812b", "score": "0.6080083", "text": "def new\n @city = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @city }\n end\n end", "title": "" }, { "docid": "159fcb2f503f16d45d95ee9e92d031dd", "score": "0.6077178", "text": "def choose_city(city_query)\n response_string = RestClient.get(\"https://api.teleport.org/api/cities/?search=#{city_query}&embed=city%3Asearch-results%2Fcity%3Aitem%2Fcity%3Aurban_area%2Fua%3Ascores\")\n response_hash = JSON.parse(response_string)\n if response_hash['_embedded']['city:search-results'].empty?\n puts \"No matches found!\n \\nBringing you back to the main menu!\\n \".cyan\n return nil\n elsif response_hash['_embedded']['city:search-results'].length == 1\n return response_hash['_embedded']['city:search-results'][0]\n else\n puts ''\n response_hash['_embedded']['city:search-results'].each_with_index do |city_hash, index|\n puts \"#{index + 1}. #{city_hash['_embedded']['city:item']['full_name']}\"\n end\n puts ''\n puts 'Please enter the number of the city you would like to view.'.green\n # #fix for invalid inputs\n input = gets.chomp.to_i\n return response_hash['_embedded']['city:search-results'][input - 1]\n end\nend", "title": "" }, { "docid": "94f5f0e8e71c4fa8041d0788961cdac0", "score": "0.606539", "text": "def by_state\n \tdata = City.where('state_id = ?', params[:state_id]).order(:name)\n \trespond_to do |format|\n \t\tformat.json {render :json => data, :status => 200}\n \tend\n end", "title": "" }, { "docid": "34f7bc4fa9bd7d4ae0ad9b0d6b959b63", "score": "0.6025865", "text": "def api_request(city)\n url = \"https://jobs.github.com/positions.json?utf8=%E2%9C%93&description=&location=\"+city\n #Escape and parse URL for proper formatting.\n escaped_url = URI.escape(url)\n parsed_url = URI.parse(escaped_url)\n #Make the HTTP request.\n request = Net::HTTP.get(parsed_url)\n #Parse the JSON response.\n response = JSON.parse(request)\n #Returns all listings for the given city.\n return response\n end", "title": "" }, { "docid": "ea1944f19d88d4dd5c8b906afbf44669", "score": "0.60075617", "text": "def index\n @graphium_cities = Graphium::City.all\n end", "title": "" }, { "docid": "d2a98b86660ffcd1c1bb065959eb78a8", "score": "0.5981503", "text": "def index\n neo = Neography::Rest.new\n r = neo.execute_query(\"START n=node(*) RETURN n;\")\n r[\"data\"].shift # first node is wacky\n @cities = r[\"data\"].map { |node|\n OpenStruct.new(node[0][\"data\"].merge(id: node[0][\"self\"].match(/node\\/(\\d+)$/)[1].to_i))\n }\n end", "title": "" }, { "docid": "5d813bdf2ffe09b19c2e12d29f03a482", "score": "0.59780514", "text": "def city\n fetch('dnd.cities')\n end", "title": "" }, { "docid": "73f4adb584abb2a369211336267fd6a2", "score": "0.59651107", "text": "def city\n fetch('world_cup.cities')\n end", "title": "" }, { "docid": "f3c205efaea019e4416e3ad17a59fb07", "score": "0.5960334", "text": "def index\n @localities = Locality.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @localities }\n end\n end", "title": "" }, { "docid": "6ad0033b47c881e582761be5692ce1f4", "score": "0.59540784", "text": "def situations_arrivals_countries_three\n @situations_arrivals_countries = SituationsArrivalsCountry.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations_arrivals_countries}\n end\n end", "title": "" }, { "docid": "9babe4783c89a5874d0fe8f240781649", "score": "0.59517115", "text": "def index\n @world_cities = PhillyCrime.paginate(page: params[:page])\n end", "title": "" }, { "docid": "eb696f9044f9610f32d815f227764680", "score": "0.5951644", "text": "def index\n @citations = Citation.all\n\n render json: @citations\n end", "title": "" }, { "docid": "6277a5352387a47a8e2f4aa282566363", "score": "0.5938727", "text": "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", "title": "" }, { "docid": "6a18e7cf51bf1d322ede0f1a3ebbb91c", "score": "0.59335226", "text": "def city\r\n\t\t\t@city ||= json[\"cit\"].to_s.capitalize\r\n\t\tend", "title": "" }, { "docid": "afb089831805ae728b8134deb5f15e78", "score": "0.59234643", "text": "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", "title": "" }, { "docid": "2cd7590eb30d1fdc5f0bf6199ce051b7", "score": "0.5907289", "text": "def show\n render json: Company.find(params[\"id\"])\n end", "title": "" }, { "docid": "2aa941df720f9391b47ee517858f1a93", "score": "0.59071726", "text": "def get_weather_json(city)\n api_url = \"http://api.openweathermap.org/data/2.5/weather?q=#{city}\"\n RestClient.get(api_url).to_str\nend", "title": "" }, { "docid": "c1da4f639685429ffe394c30c8edef57", "score": "0.5904338", "text": "def index\n @ezii_cities = EziiCity.all\n end", "title": "" }, { "docid": "a63851d1332ab30b3f9b1d29be866066", "score": "0.58942705", "text": "def show\n @locality = Locality.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @locality }\n end\n end", "title": "" }, { "docid": "970091a3c393f6c565d16aa17d99e55d", "score": "0.588736", "text": "def index\n @countries = Country.all\n\n render json: @countries\n end", "title": "" }, { "docid": "46f06901ffeac7337daf401ca97c8e77", "score": "0.5872044", "text": "def index\n @streets = City.friendly.find(params[:city_id]).streets\n end", "title": "" }, { "docid": "54095224a09b8b0aa0a8d83e87f8af60", "score": "0.58524495", "text": "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "title": "" }, { "docid": "e9693817eb35068866081cd919f51c69", "score": "0.58456653", "text": "def city(params={})\n address.cities(params).select { |city| city.ref == self.city_ref }.first.result\n end", "title": "" }, { "docid": "3b214dc75cb0b4c75551b84e77c14344", "score": "0.5840236", "text": "def new\n @store = Store.new\n @cities = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @store }\n end\n end", "title": "" }, { "docid": "a5afbcd8dc2ede0905432a17e5bc2cba", "score": "0.5839394", "text": "def show\n @locations_city = Locations::City.find(params[:id])\n respond_to do |format|\n format.js # show.html.erb\n end\n end", "title": "" }, { "docid": "1d28398b4d22577c8ebb4806d1c4f2fd", "score": "0.58337265", "text": "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end", "title": "" }, { "docid": "7a467949575b8557f4daf055adbf98ca", "score": "0.58256805", "text": "def index\n @city = city\n @districts = city.districts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @districts }\n end\n end", "title": "" }, { "docid": "ce6d48a1e022b8e694854ba2c209c3ab", "score": "0.5811404", "text": "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "title": "" }, { "docid": "f93ebf6374e8ead0e2bb83f477dc6bbe", "score": "0.58103", "text": "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "title": "" }, { "docid": "aacd80ef1b99f894abe11adad2ac9ca8", "score": "0.58004206", "text": "def get_weather\n weather_forecast = WeatherForecast.new(params[:location_id])\n response = weather_forecast.city_weather\n puts body = JSON.parse(response.body)\n \t@city = body['city']['name']\n \t@main_temperature_parameters = body['list'][0]['main']\n \trespond_to do |format|\n format.js\n format.json { render json: @main_temperature_parameters }\n \tend\n end", "title": "" }, { "docid": "0471bb161ca5f973a12781dcb3adda46", "score": "0.5787294", "text": "def edit\n @countries = Countr.all\n @states = []\n @cities = []\n if params[:country].present? or params[:state].present?\n @states = Stat.where(:countr_id => params[:country] )\n @cities = City.where(:stat_id => params[:state] )\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {states: @states} if params[:country].present?\n render json: {cities: @cities} if params[:state].present?\n }\n end\n end\n end", "title": "" }, { "docid": "eaa6325f5bf866f9edf80b64d6c51e86", "score": "0.57715416", "text": "def show\n Rails.logger.debug \"City with id #{@city.id} is #{@city.id}\"\n\n render_if_stale(@city, last_modified: @city.updated_at.utc, etag: @city) do |city_presenter|\n city_presenter.hash\n end\n # explicitly setting the Cache-Control response header to public and max-age, to make the response cachable by proxy caches\n expires_in caching_time, public: true\n end", "title": "" }, { "docid": "a775ae01ed342b90a3a5c70b005f1cc3", "score": "0.576678", "text": "def show\n\n@city = City.find params[:id]\n\nend", "title": "" }, { "docid": "af7baf1994d58c11546d4c2b9428b142", "score": "0.57628584", "text": "def geo(id)\n get \"/geo/id/#{id}.json\"\n end", "title": "" }, { "docid": "f11fcdf497aab24ddda616f8e76ebf74", "score": "0.57608247", "text": "def new\n @sitecity = Sitecity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitecity }\n end\n end", "title": "" }, { "docid": "de758dd971289ad5caba783d96be06ae", "score": "0.5754985", "text": "def get_city\n @single_city_data[\"name\"]\n end", "title": "" }, { "docid": "6e23186297c787e7321af7572dbac106", "score": "0.57460725", "text": "def show\n @city_measurement = CityMeasurement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @city_measurement }\n end\n end", "title": "" }, { "docid": "d3c68b8129fed8e3b5f383cbed37a226", "score": "0.5745363", "text": "def new\n @locality = Locality.new\n @provinces = Province.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @locality }\n end\n end", "title": "" }, { "docid": "72073c923efb751cc39dd0051ed04621", "score": "0.57376546", "text": "def index\n @student_cities = StudentCity.all\n end", "title": "" }, { "docid": "3931c9f1981826f4aa0abe652efe8f4f", "score": "0.5736876", "text": "def new\n @country = Country.find_by_id(params[:country])\n if !@country.nil?\n @city = City.new\n\n else\n flash[:error] = \"Country not found\"\n redirect_to countries_path\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @city }\n end\n end", "title": "" }, { "docid": "efe8109f4731df19c1fbbccae440066d", "score": "0.57349426", "text": "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end", "title": "" }, { "docid": "5e57af4c3eefbc94cf3b26579f38ec2a", "score": "0.5729526", "text": "def index\n @previous_cities = PreviousCity.all\n end", "title": "" }, { "docid": "9cd9398efc9984c5282f40d8a5d31d61", "score": "0.5709803", "text": "def index\n render json: @places\n end", "title": "" }, { "docid": "6d9b93ec77c244d8294a537338c15686", "score": "0.57060647", "text": "def index\n require 'geoip'\n @projects = Department.all_projects\n rip = request.remote_ip\n ip = rip == '127.0.0.1' ? '24.90.88.129' : rip\n geo = GeoIP.new('lib/GeoLiteCity.dat').city(ip) || GeoIP.new('lib/GeoLiteCity.dat').city('24.90.88.129')\n @my_place = geo.latitude.to_s + \", \" + geo.longitude.to_s\n redirect_to action: :list\n #respond_to do |format|\n #format.html # index.html.erb\n #format.json { render json: @projects }\n #end\n end", "title": "" }, { "docid": "70cf9cebc5e1aa8bb0dd43f543e626d6", "score": "0.5704939", "text": "def get_cities\n cities = {}\n doc = nil\n retry_if_exception do\n doc = Nokogiri::HTML( easy_curl(@host_url) )\n end\n return [] if not doc\n a_cities = doc.css(\"ul[class='s-dropdown afh-dd-city'] li a\")\n a_cities.each do |city|\n city_name = city.text\n city_code = city['href'].scan(/\\w+(?=\\/changecity)/).pop\n next if not city_code\n cities[city_code] = city_name\n end\n cities\nend", "title": "" }, { "docid": "d860ac0ccb7feb9897ec4c92fc0d3505", "score": "0.5698705", "text": "def index\n @cities = City.select(:id, :name, :locked, :stone, :wood, :win, :lose, :population).order(population: :desc).limit(30)\n @city_hash = cookies[:city_hash]\n end", "title": "" }, { "docid": "629ef99d24b5c616214bce11502bc811", "score": "0.56979835", "text": "def index\n @cities = City.find(:all, :conditions => {:lang =>params[:lang]})\n @cities = City.find(:all, :conditions => {:lang =>@lang.to_s}) if @cities.empty? \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cities }\n format.js { render :json => @cities.to_json }\n end\n end", "title": "" }, { "docid": "a1feff012fd22ebe06bd67ad8f4376fd", "score": "0.5697908", "text": "def index\n @schools = @city.schools\n end", "title": "" }, { "docid": "0534a6c9336fa4796a9c39b662eae036", "score": "0.56977075", "text": "def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @countries }\n format.js\n end\n end", "title": "" }, { "docid": "22c1a620478ed821c54898b7e715d9e6", "score": "0.5689", "text": "def index\n @countries = Country.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @countries }\n end\n end", "title": "" }, { "docid": "988778c6f9c9270122b6778ce3ef04b2", "score": "0.5686892", "text": "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end", "title": "" }, { "docid": "988778c6f9c9270122b6778ce3ef04b2", "score": "0.5686892", "text": "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end", "title": "" }, { "docid": "41f590c2079afe580ef9547c9451a25c", "score": "0.56866866", "text": "def in_country\n return json_response([]) if (country_cities = City.where(params.slice(:country))).blank?\n newest_city = country_cities.sort_by(&:updated_at).last\n Rails.logger.info \"newest_city is #{newest_city.inspect}\"\n render_if_stale(country_cities, last_modified: newest_city.updated_at.utc, etag: newest_city) do |city_presenters|\n city_presenters.map(&:hash)\n end\n # explicitly setting the Cache-Control response header to public and max-age, to make the response cachable by proxy caches\n expires_in caching_time, public: true\n end", "title": "" }, { "docid": "a2fa564d8e917a978063ffb253e8b2e7", "score": "0.5685261", "text": "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "title": "" } ]
928cf8a4556dc0459b497c01bb333949
sort the array by week
[ { "docid": "f4b7d0c88e1863d8b393f8936cb5a7bd", "score": "0.7751466", "text": "def sort_array_by_week(date_and_snippet_array)\n\treturn date_and_snippet_array if date_and_snippet_array.size <= 1\n\tswapped = true\n\twhile swapped do\n\t\tswapped = false\n\t\t0.upto(date_and_snippet_array.size-2) do |i|\n\t\t\tif date_and_snippet_array[i].date > date_and_snippet_array[i+1].date\n\t\t\t\tdate_and_snippet_array[i], date_and_snippet_array[i+1] = date_and_snippet_array[i+1], date_and_snippet_array[i+1]\n\t\t\t\tswapped = true\n\t\t\tend\n\t\tend\n\tend\n\treturn date_and_snippet_array\nend", "title": "" } ]
[ { "docid": "380d8942538c5b4975e1486fdca63fe6", "score": "0.7208512", "text": "def sorted_commits_by_week\n sort_array = create_active_date_array(@began.date, @latest_commit.date)\n mapped_commits_array = Array.new(sort_array.size).map {|a| a = []}\n for commit in @commits.reverse\n index = sort_array.index(commit.date.strftime(\"%U %Y\"))\n mapped_commits_array[index] << commit\n end\n mapped_commits_array\n end", "title": "" }, { "docid": "0874e2528b5c25080d37de424f40a982", "score": "0.6650037", "text": "def stories_by_week(by_week)\n sorted = by_week.sort { |k1, k2| k1[0].start <=> k2[0].start }.reverse \n story_tables(sorted) { |w, stories| \"#{w.start.strftime('%b %d')} to #{w.finish.strftime('%b %d')}\" }\n end", "title": "" }, { "docid": "7f606e5d6c7714ef062dedf792f4a7e7", "score": "0.6611397", "text": "def weeks_array\n \tWeek.all.map { |w| [w.week_number.to_s + \" - \" + w.name.to_s, w.week_number] }\n end", "title": "" }, { "docid": "38dd6147eb40b8a053d8947b038bc3e6", "score": "0.64244545", "text": "def uniq_week_array\n\t\tp \"XXXXXXXX uniq_week_array HELPER XXXXX\"\n\t\t@weeks_array = []\n\t\t@weeks_uniq = Pickchart.where($created_after, $timestamp).pluck(:week).uniq\n\n\t\tif @weeks_uniq.nil?\n\t\t\t@weeks_array = [\"Week 0 - DEMO TEST\"]\n\t\telse\n\t\t\t@weeks_uniq.each do |week|\n\t\t\t\tif week === nil || week <= 0 || week >= 23\n\t\t\t\t\t@weeks_array = @weeks_array.unshift([\"Week \" + week.to_s + \" invalid\", 0])\n\t\t\t\telse\n\t\t\t\t\t@weeks_array = @weeks_array << [\"Results --- \" + select_week(week, 0) , week]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn @weeks_array\n\tend", "title": "" }, { "docid": "a47f4252717d20a44d46490853650bd6", "score": "0.6302229", "text": "def reorder_weeks\n weeks.each_with_index do |week, i|\n week.update(order: i + 1)\n end\n end", "title": "" }, { "docid": "df8ebbc1c591323cd85c50328186462e", "score": "0.62717265", "text": "def sort_array", "title": "" }, { "docid": "ea338135de0fdc01e5948647b071c04b", "score": "0.62274504", "text": "def ordered_employees(week, day)\n fetch_employees.sort_by { |employee| [has_time_off?(employee.id, week, day) ? 1 : 0, employee.id] }\n end", "title": "" }, { "docid": "e27da7cc36ded7a8f04a8ea7feea7110", "score": "0.61689866", "text": "def dispatch_weeks weeks\n if @gamedays.size < weeks.size\n weeks = remove_weeks weeks, @gamedays.size\n elsif @gamedays.size > weeks.size\n weeks = add_weeks weeks, @gamedays.size\n end\n @gamedays.each.with_index { |gd, i| gd.date = weeks[i] }\n end", "title": "" }, { "docid": "cd7683c8d8ce53b4000a061b4a6f7e17", "score": "0.6167191", "text": "def build__weekly_array_values(array_weekly,activity,feature)\n arr = []\n for i in 0..6\n arr[i] = array_weekly[i.to_s][activity][feature]\n end\n \n return arr\n end", "title": "" }, { "docid": "0d619f2ab26e5fae40e10aac56aeefd2", "score": "0.6163988", "text": "def weekdays\n days.sort_by{ |day| day.date }\n end", "title": "" }, { "docid": "1023980409de3ddbb220316e96416f24", "score": "0.6152965", "text": "def organize_talks(talks)\n h = Hash.new\n h[:past] = []\n h[:today] = []\n h[:later_this_week] = []\n (0..6).each { |wday| h[:later_this_week][wday] = [] }\n h[:next_week] = []\n (0..6).each { |wday| h[:next_week][wday] = [] }\n h[:beyond] = []\n\n h[:now] = Time.now\n\n the_past = (h[:now] - 1.day).end_of_day\n today = h[:now].beginning_of_day..h[:now].end_of_day\n later_this_week = (h[:now].beginning_of_day + 1.day)..((h[:now] + 1.day).end_of_week - 1.day)\n next_week = ((h[:now] + 1.day).beginning_of_week + 6.day)..((h[:now] + 1.day).end_of_week + 6.day)\n beyond = (h[:now] + 1.day).beginning_of_week + 13.day\n\n talks.each do |t|\n if t.start_time <= the_past\n h[:past] << t\n elsif today.cover? t.start_time\n h[:today] << t\n elsif later_this_week.cover? t.start_time\n h[:later_this_week][t.start_time.wday] << t\n elsif next_week.cover? t.start_time\n h[:next_week][t.start_time.wday] << t\n else\n h[:beyond] << t\n end\n end\n\n h[:past].sort! { |a,b| a.start_time <=> b.start_time }\n h[:today].sort! { |a,b| a.start_time <=> b.start_time }\n h[:later_this_week].each { |ts| ts.sort! { |a,b| a.start_time <=> b.start_time } }\n h[:next_week].each { |ts| ts.sort! { |a,b| a.start_time <=> b.start_time } }\n h[:beyond].sort! { |a,b| a.start_time <=> b.start_time }\n\n return h\n end", "title": "" }, { "docid": "9b97b0c658b8d01c92a2ff62c5f53130", "score": "0.6076727", "text": "def course_weeks\n index_dom.css(\"week\").sort.map do |week_node|\n week_lessons = week_lessons_sort_by_day(week_node)\n week_lessons.map do |lesson_node|\n lesson_node[\"name\"]\n end\n end\n end", "title": "" }, { "docid": "a9bc0e4e9d782e324be8ec3f4e5f97df", "score": "0.60679275", "text": "def week_scores(week)\n dates_of_week = Array.new(0)\n scores_of_week = Array.new(0)\n for day in 1..7 do dates_of_week.push(Date.commercial(2015, week, day)) end\n dates_of_week.each {|date|\n # score = (daily_total_score(date)==0) ? 0 : daily_total_score(date)\n scores_of_week.push(daily_total_score(date)) \n }\n scores_of_week\n end", "title": "" }, { "docid": "7861444163254905ddb34748ad2bd624", "score": "0.6061586", "text": "def sort_events!\n position = 0\n @events.sort_by {|e| e.nodoiw }.reverse.each do |event|\n\t\t\t\t(0..position).each do |pos|\n\t\t\t\t\tif positions_for_days_are_available?(event,pos)\n\t\t\t\t\t\tassign_events_to_days(event,pos)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n position += 1\n end\n end", "title": "" }, { "docid": "b3307240f162861571b2132d556b549e", "score": "0.6049625", "text": "def index\n\t\tdef diff a\n\t\t\tweek = {\"Monday\" =>0, \"Tuesday\" => 1, \"Wednesday\" => 2, \"Thursday\" => 3, \"Friday\" => 4, \"Saturday\" => 5, \"Sunday\" => 6}\n\t\t\ttoday = Time.now.wday\n\t\t\t((week[a]+1-today)%7)\n\t\tend\n\t\t@events = Event.all.sort_by{ |e| diff(e.day)}\n\t\tend", "title": "" }, { "docid": "e72a14a7de121c4b3cee3f1749265cd5", "score": "0.6012741", "text": "def weekly\n @weekly ||= loop_weeks.map do |number, year_week, start, stop|\n # Myyntisaamiset menee myyntiin sellaisenaan.\n # Factoring myynnistä 70% kuuluu laittaa viikolle tapahtumapäivän (+ 1pv) mukaan\n # ja loput 30% eräpäivän mukaan.\n sales = myyntisaamiset(start, stop)\n sales += factoring_myyntisaamiset_sum(start, stop)\n\n # Ostovelat sellaisenaan\n # Mukaan lisätään extrakulut, jota voi syöttää oman käyttöliittymän kautta viikkotasolla\n purchases = ostovelat(start, stop)\n purchases += revenue_expenditures(year_week)\n\n {\n week: number,\n sales: sales,\n purchases: purchases,\n concern_accounts_receivable: konserni_myyntisaamiset(start, stop),\n concern_accounts_payable: konserni_ostovelat(start, stop),\n alternative_expenditures: revenue_expenditures_details(year_week),\n }\n end\n end", "title": "" }, { "docid": "7818de290c20fb1f28e33b7d51724830", "score": "0.6006445", "text": "def week_days\n\t\t[['Monday','Monday'],['Tuesday','Tuesday'],['Wednesday','Wednesday'],['Thursday','Thursday'],['Friday','Friday'],['Saturday','Saturday']]\n\tend", "title": "" }, { "docid": "4ddec5b8507fb5f59d6b4ff53a64e953", "score": "0.6002255", "text": "def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend", "title": "" }, { "docid": "0a7d0ecb7ae54a893c7e840a79acd56c", "score": "0.59665793", "text": "def week\n [Time.new(year, month, week_start), Time.new(year, month, week_end)]\n end", "title": "" }, { "docid": "6bbbf0a2760f86a90b5cef447c02c5c4", "score": "0.5927626", "text": "def popular_week_day(hash)\n # Array for selecting day of the week\n week_days = %w{Sunday Monday Tuesday Wednesday Thursday Friday Saturday}\n wday_arr = hash.max_by {|k,v| v}\n wday_arr[0] = week_days[wday_arr[0].to_i]\n return wday_arr\nend", "title": "" }, { "docid": "a7f108f5176f73497fe796e69d83fa99", "score": "0.5908586", "text": "def start_new_array_for_week?(arr, date)\n !arr.last || date.monday?\n end", "title": "" }, { "docid": "e7f0997fb2530b40578afbe187ee9525", "score": "0.5902667", "text": "def getWeekData()\n weeks = [[\"Week Number\", \"Start Date\", \"End Date\",\"startIndex\",\"endIndex\"]]\n weeks.append([\"1\",\"2018-10-03\",\"2018-10-14\",\"1\",\"12\"])\n weeks.append([\"2\",\"2018-10-15\",\"2018-10-21\",\"13\",\"19\"])\n weeks.append([\"3\",\"2018-10-22\",\"2018-10-28\",\"20\",\"26\"])\n weeks.append([\"4\",\"2018-10-29\",\"2018-11-04\",\"27\",\"33\"])\n weeks.append([\"5\",\"2018-11-05\",\"2018-11-11\",\"34\",\"40\"])\n weeks.append([\"6\",\"2018-11-12\",\"2018-11-18\",\"41\",\"47\"])\n weeks.append([\"7\",\"2018-11-19\",\"2018-11-25\",\"48\",\"54\"])\n weeks.append([\"8\",\"2018-11-26\",\"2018-12-02\",\"55\",\"61\"])\n weeks.append([\"9\",\"2018-12-03\",\"2018-12-09\",\"62\",\"68\"])\n weeks.append([\"10\",\"2018-12-10\",\"2018-12-16\",\"69\",\"75\"])\n weeks.append([\"11\",\"2018-12-17\",\"2018-12-23\",\"76\",\"82\"])\n weeks.append([\"12\",\"2018-12-24\",\"2018-12-30\",\"83\",\"89\"])\n weeks.append([\"13\",\"2018-12-31\",\"2019-01-06\",\"90\",\"96\"])\n weeks.append([\"14\",\"2019-01-07\",\"2019-01-13\",\"97\",\"103\"])\n weeks.append([\"15\",\"2019-01-14\",\"2019-01-20\",\"104\",\"110\"])\n weeks.append([\"16\",\"2019-01-21\",\"2019-02-03\",\"111\",\"124\"])\n weeks.append([\"17\",\"2019-02-04\",\"2019-02-10\",\"125\",\"131\"])\n weeks.append([\"18\",\"2019-02-11\",\"2019-02-17\",\"132\",\"138\"])\n weeks.append([\"19\",\"2019-02-18\",\"2019-02-24\",\"139\",\"145\"])\n weeks.append([\"20\",\"2019-02-25\",\"2019-03-03\",\"146\",\"152\"])\n weeks.append([\"21\",\"2019-03-04\",\"2019-03-10\",\"153\",\"159\"])\n weeks.append([\"22\",\"2019-03-11\",\"2019-03-17\",\"160\",\"166\"])\n weeks.append([\"23\",\"2019-03-18\",\"2019-03-24\",\"167\",\"173\"])\n weeks.append([\"24\",\"2019-03-25\",\"2019-04-06\",\"174\",\"186\"])\n CSV.open(\"WeeksData.csv\", \"w\") do |csvFile|\n for row in weeks\n csvFile << row\n end\n end\nend", "title": "" }, { "docid": "8cf6404ef9b4554e18d9586ef47ef7e2", "score": "0.58671796", "text": "def parse_weeks(weeks)\n weeks.split(',').flat_map { |interval|\n if interval.include?('-')\n from, to = interval.split('-', 2)\n (Integer(from)..Integer(to)).to_a\n else\n Integer(interval)\n end\n }.sort.uniq\n end", "title": "" }, { "docid": "2bdbf4f61980115a828ca718a990ae23", "score": "0.58101434", "text": "def consolidate_week \n \t#grab last 7 days\n \trefDay = self.energy_data.select(\"day\").last\n \trefDay = refDay.day\n \trefMonth = self.energy_data.select(\"month\").last\n \trefMonth = refMonth.month\n \tcount = (0..6).to_a\n \t@dateCount = Array.new\n \t@daySum = Array.new\n \tsubCount = 0\n\n \tcount.each do |var|\n \t\tif (refDay - subCount) > 0\n \t\t\t@dateCount << [refDay - subCount, refMonth]\n \t\telse\n \t\t\trefDay = 31\n \t\t\trefMonth = refMonth - 1\n \t\t\tsubCount = 0\n \t\t\t@dateCount << [refDay - subCount, refMonth]\n \t\tend\n \t\tsubCount = subCount + 1\n \tend\n\n \tarrayCount = 0\n\n \t@dateCount.each do |day, month|\n \t\t@daySum[arrayCount] = [arrayCount, self.energy_data.where(\"day=#{day} AND month=#{month}\").sum(\"power\")]\n \t\tarrayCount = arrayCount + 1\n \tend\n\n \treturn @dateCount, @daySum\n end", "title": "" }, { "docid": "c058c58cb8a663d1769464e42584075c", "score": "0.5809469", "text": "def map_commits_to_diff_state_by_week\n sorted_commits_by_week.map {|array_of_commits| array_of_commits.map(&:stats).map(&:to_diffstat).flatten }\n end", "title": "" }, { "docid": "f30002f1c2479613c0185d687c633510", "score": "0.5806146", "text": "def init_week\n Array.new(7, '')\nend", "title": "" }, { "docid": "7826cc5ad370280d52137fe5a134d9d6", "score": "0.58042556", "text": "def weekify(stat, measurements)\n\t\tdays = daily_summaries(stat, measurements, week_range)\n\t\tweeks = days.in_groups_of(7).map do |week|\n\t\t\t[week[0][0], week.map {|d| d[1]}]\n\t\tend\n\t\tActiveSupport::OrderedHash.new(weeks)\n\tend", "title": "" }, { "docid": "ea87e21f9182a961a090c0b1e31b5f45", "score": "0.5787879", "text": "def build_daily_kcal_burned_values(array_weekly,feature)\n\n arr_looking = []\n arr_walking = []\n arr_cycling = []\n arr_standing = []\n arr_sitting = []\n arr_tilting = []\n arr_notusing = []\n arr_laying = []\n arr_running = []\n arr = []\n \n unless array_weekly.nil?\n for i in 0..6\n arr_looking[i] = array_weekly[i.to_s]['lookingAtPhone'][feature]\n arr_walking[i] = array_weekly[i.to_s]['walking'][feature]\n arr_cycling[i] = array_weekly[i.to_s]['cycling'][feature]\n arr_standing[i] = array_weekly[i.to_s]['standing'][feature]\n arr_sitting[i] = array_weekly[i.to_s]['sitting'][feature]\n arr_tilting[i] = array_weekly[i.to_s]['tilting'][feature]\n arr_notusing[i] = array_weekly[i.to_s]['notUsingPhone'][feature]\n arr_laying[i] = array_weekly[i.to_s]['laying'][feature]\n arr_running[i] = array_weekly[i.to_s]['running'][feature]\n\n end\n end\n \n arr.push(arr_looking)\n arr.push(arr_walking)\n arr.push(arr_cycling)\n arr.push(arr_standing)\n arr.push(arr_sitting)\n arr.push(arr_tilting)\n arr.push(arr_laying)\n arr.push(arr_standing)\n arr.push(arr_running)\n\n return arr\n end", "title": "" }, { "docid": "e83246cd1ee334f14b90a2f17a4a65c3", "score": "0.57616276", "text": "def index\n @matches = Match.all\n @weeks = []\n @matches.each do |match|\n unless @weeks.include?(match.week)\n @weeks.push(match.week)\n end\n end\n end", "title": "" }, { "docid": "254261025b546910e1f3c7e55f1d7cd1", "score": "0.5736068", "text": "def split_weeks(week)\n a = []\n split = week.split(\", \")\n split.each do |n|\n if n.include?(\"-\") then\n interval = n.split(\"-\")\n for i in interval[0]..interval[1]\n a.push(i)\n end\n else\n a.push(n)\n end\n end\n a\nend", "title": "" }, { "docid": "b6562ec4d41d6a94c3d95d16a563ca5f", "score": "0.5714551", "text": "def day_of_the_week_targeting(contents)\n contents.rewind\n week_day_array = []\n\n contents.each do |row|\n reg_date_string = row[:regdate]\n reg_date = Time.strptime(reg_date_string, '%m/%d/%y %R')\n reg_date_week_day = reg_date.strftime('%A')\n week_day_array.push(reg_date_week_day)\n end\n\n week_day_count_hash = week_day_array.tally.sort_by { |_k, v| -v }.to_h\n\n puts \"Day of the Week Targeting: #{week_day_count_hash}\"\nend", "title": "" }, { "docid": "5c6584c38506f22a65f21fb5e6b3f852", "score": "0.56873804", "text": "def hs_sort_alls()\n\t$alls.each { |k, v|\n\t\tresult = v.sort {|left, right| (@items[left])[:created] <=> (@items[right])[:created]}\n\t\tv = result\n\t}\nend", "title": "" }, { "docid": "51ddbd866b299cbf9b18a9cfe21fd899", "score": "0.5683341", "text": "def week_entries\n entries = goal.progresses.where('entry_date > ?', Date.today - 1.week)\n Array.new(7) do |i|\n entry = entries.find { |e| e[:entry_date] == Date.today - i.days }\n entry&.points\n end\n end", "title": "" }, { "docid": "a75ec96d3a550083d3ca761c222b609b", "score": "0.5678765", "text": "def cycles(weeks, wdays)\n _dates = []\n cycle_weeks_filter(weeks).each do |n|\n [wdays].flatten.each do |w|\n begin\n a_date = self.nth_wday!(n, w)\n rescue Koyomi::WrongRangeError => e\n next\n else\n _dates << a_date\n end\n end\n end\n _dates.sort\n end", "title": "" }, { "docid": "ed2c62da96d0e3aa18c83a772c950e63", "score": "0.56755835", "text": "def betweenDates(index,week)\n if (index <= week[4].to_i)\n return week\n end\n return []\nend", "title": "" }, { "docid": "a781c2aa57c264413458d328f471222d", "score": "0.56530726", "text": "def call_sorter(call_array)\n\t\tsorted_array = call_array.sort do |a,b| \n [ b.call_starttime.strftime(\"%m\").to_i, \n b.call_starttime.strftime(\"%d\").to_i,\n a.call_starttime\n ] <=> \n [ a.call_starttime.strftime(\"%m\").to_i, \n a.call_starttime.strftime(\"%d\").to_i,\n b.call_starttime \n ]\n end \n\tend", "title": "" }, { "docid": "9050bcb603c7876e93cc3f749dd48ce4", "score": "0.56519806", "text": "def upcoming_by_week_and_day(visits)\n visits = visits.select {|visit|\n visit.scheduled_for >= Date.today.beginning_of_week }\n\n data = {}.tap do |skeleton|\n weeks = (0..1).map {|x| Date.today.beginning_of_week + x.weeks }\n weeks.each do |start_of_week|\n skeleton[start_of_week] = {}\n\n days = (1..4).map {|x| start_of_week + x.days }\n days.each do |day|\n skeleton[start_of_week][day] = []\n end\n end\n\n visits.each do |visit|\n day = visit.scheduled_for\n week = day.beginning_of_week\n\n skeleton[week] ||= {}\n skeleton[week][day] ||= []\n skeleton[week][day] << visit\n end\n end\n\n data = data.to_a.sort_by {|week, day| week }\n data.collect do |week, days|\n [week, days.to_a.sort_by {|day, visits| day }]\n end\n end", "title": "" }, { "docid": "7ec928984920be1796988c858ddab35e", "score": "0.5641624", "text": "def daily_appearances_by_week(month,year)\n daily_appearance_dates(month,year).group_by { |a| a.strftime(\"%W\") }\n end", "title": "" }, { "docid": "11f890ae146534da3f90b1d4323c7834", "score": "0.5637983", "text": "def appts_booked_this_week # collection is AR collection of appointments\n return [] if @collection.empty?\n appts = @collection\n appts_this_week = []\n appts.each do |appt|\n if appt.created_at.to_time >= Time.now - 1.week\n appts_this_week << appt\n end\n end\n return appts_this_week\n end", "title": "" }, { "docid": "8f5a9d74d5a44b01152687a04577c881", "score": "0.56206954", "text": "def weeks_on_list\n @data['weeks_on_list']\n end", "title": "" }, { "docid": "0074b5f4bf82ff82074779dd528b09f5", "score": "0.5620214", "text": "def week\n for_date = Date.new(@selected_date[:year], @selected_date[:month], @selected_date[:day])\n\n @first_day_of_week = for_date.beginning_of_week\n\n conditions = [\"(starts_at <= :end_hour) and (ends_at >= :beginning)\", {:beginning => for_date.beginning_of_week.to_time, :end_hour => for_date.end_of_week.to_time.end_of_day}]\n\n @events = Event.where(conditions).reorder(\"starts_at\")\n\n #@title = t(\"documents.#{@t.titleize}\")\n @subtitle = \"#{I18n.localize(for_date.beginning_of_week, :format => :long)} - #{I18n.localize(for_date.end_of_week, :format => :long)}\"\n end", "title": "" }, { "docid": "659ee1c0acbe09a6268be033107bc347", "score": "0.5620106", "text": "def events\n appeals.flat_map(&:events).uniq.sort_by(&:date)\n end", "title": "" }, { "docid": "659ee1c0acbe09a6268be033107bc347", "score": "0.5620106", "text": "def events\n appeals.flat_map(&:events).uniq.sort_by(&:date)\n end", "title": "" }, { "docid": "a291291be26d3f08053967dc6060f971", "score": "0.56173784", "text": "def weekstats\n stats = []\n\n curr_week = nil\n curr_log = nil\n start_datetime_for_curr_week = nil # important that we keep the exact start date of each day's first log\n total_spent_time_for_curr_week = 0\n\n self.logs.each_with_index do |log, i|\n curr_log = log # save log for outside the loop. when loop ends, should contain last log of all\n log_start_week = log.start.strftime(\"%Y-%V\")\n\n if i == 0\n curr_week = log_start_week\n start_datetime_for_curr_week = log.start\n end\n\n #\n # If day-change, add the previously fully-calculated day-stats to the\n # `stats` array, before starting with the new-day stats calculations\n #\n if log_start_week != curr_week\n _log = Log.new\n _log.start = start_datetime_for_curr_week\n _log.finish = _log.start + total_spent_time_for_curr_week\n\n stats << _log\n\n #\n # Init new day calculations\n #\n curr_week = log_start_week\n start_datetime_for_curr_week = log.start\n total_spent_time_for_curr_week = 0\n end\n\n #if date != log.finish.to_date #logs spanning more than 1 day\n # _time = 0\n # start_datetime = log.start\n # finish_datetime = log.start.to_date.to_time\n # while finish_datetime != log.finish\n # _time = finish_datetime - start_datetime\n #\n # _log = Log.new\n # _log.start = start_datetime\n # _log.finish = finish_datetime\n #\n # stats << _log\n #\n # start_datetime = finish_datetime\n # finish_datetime = finish_datetime + 1.days\n # if finish_datetime > log.finish\n # finish_datetime = log.finish\n # end\n # end\n #else\n total_spent_time_for_curr_week += log.spent\n #end\n end\n\n last_log = curr_log\n\n #\n # Add the last day-stats to the `stats` array\n #\n if last_log\n _log = Log.new\n if last_log.finish\n _log.start = start_datetime_for_curr_week\n _log.finish = _log.start + total_spent_time_for_curr_week\n else # hack if last log is still not finished so we can know the last day is still open\n now = Time.now.change(:usec => 0)\n _log.start = now - total_spent_time_for_curr_week\n end\n stats << _log\n end\n\n stats\n end", "title": "" }, { "docid": "2ceec58ad110dbd7182d71df2d1df7d0", "score": "0.5608634", "text": "def index\n @week_percentages = WeekPercentage.order(first_date: :asc)\n end", "title": "" }, { "docid": "3497aae547db9b373adff71f78f1d8c9", "score": "0.55811554", "text": "def index\n @days = Day.belongs_to_week(params[:week_id]).order_by_date\n end", "title": "" }, { "docid": "fd463523e2d68f2091a0fe465ab91d0e", "score": "0.55521166", "text": "def entries_for_week\n d = self.weekof.to_date\n TimeEntry.foruser(self.user).from_date(d).until_date(d + 7.days)\n end", "title": "" }, { "docid": "ccc45ba41804d6f0950a40600d62cd56", "score": "0.5544931", "text": "def this_week\n @tasks = []\n @all_tasks.each do |task|\n @tasks << task if task.due_date > Time.now && task.due_date < Time.now+7.days\n end\n end", "title": "" }, { "docid": "145765fd5f8df6be31af0873fa69632c", "score": "0.55382097", "text": "def convert_lines_to_weeks_hash(lines)\n # 'raise' without specifying exception type raises RuntimeError\n # NOTE: to_a.empty? checks if nil or empty in one statement\n if lines.to_a.empty? then raise \"Lines collection to be changed to weeks is not defined\" end\n\n # Structure\n # hash keys are weeks\n # hash values are arrays of days with actions for this week\n weeks = Hash.new\n current_week = nil\n\n #TODO: Can be moved later to a new class with parsing algorithm\n # Parsing algorithm\n lines.each do |line|\n if WeeksParser.is_line_with_week(line.data) \n current_week = line.data\n weeks[current_week] = Array.new\n else\n next if current_week.nil? # if any week hasn't been found yet then continue until any found\n\n weeks[current_week].push line # TODO: in this way week contains mixed days with actions, so in fact week still has lines\n end\n end\n\n weeks # weeks hash, key: week title, value: all lines for the week\n end", "title": "" }, { "docid": "f77fc975af0de84aad2bc4af94f993f3", "score": "0.5510376", "text": "def loop_weeks\n date_start = Time.zone.today.beginning_of_week\n date_end = date_start + @period.months\n\n date_start.upto(date_end).map do |date|\n beginning_of_week = date.beginning_of_week\n beginning_of_week = Time.zone.today if beginning_of_week == date_start\n week = Week.new(date)\n\n [\n week.human,\n week.compact,\n beginning_of_week,\n date.end_of_week,\n ]\n end.uniq\n end", "title": "" }, { "docid": "9f1a04d8b57053ecc1bf1cddcb170ce8", "score": "0.5509975", "text": "def sorted_pours\n self.pours.sort_by {|pour| pour.created_at}\n end", "title": "" }, { "docid": "eae62ce964597c26d736ee9fcd052d23", "score": "0.5508433", "text": "def weekday_arrange employees\n n = employees.length\n ans = []\n # does not require this since there will be >= 5 at all times\n if n < 5\n ans = employees\n ans << 'FREE DAY'\n ans << 'FREE DAY'\n ans.shuffle\n elsif n > 5\n temp = employees.shuffle\n scheduled = temp[0..4]\n waiting = temp[5..n]\n n.times do |i|\n scheduled.unshift waiting.pop\n waiting.unshift scheduled.pop\n ans << scheduled.clone\n end\n else\n ans = employees.shuffle\n end\n ans\nend", "title": "" }, { "docid": "75207ccaa6b2e5e68f43b8a55e4aef39", "score": "0.55021083", "text": "def index\n @efforts = Effort.all\n @effort_array = @efforts.sort{|a,b| a.week_commencing <=> b.week_commencing } \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @efforts }\n end\n end", "title": "" }, { "docid": "90ff55d4ce8a8a21d0bf9c0984cd5a54", "score": "0.5499254", "text": "def popular_days(all_days)\n\tdays = { 0 => \"Sunday\", 1 => \"Monday\", 2 => \"Tuesday\", 3 => \"Wednesday\", 4 => \"Thursday\", 5 => \"Friday\", 6 => \"Saturday\" }\n\tprint target((0..6), all_days).map { |k, v| [days[k] || k, v] }.to_h.sort_by { |_key, value| value }.reverse\n\tputs \"\"\nend", "title": "" }, { "docid": "b2d25716c2da5b6a8cccbf3535a1540b", "score": "0.5489457", "text": "def week_analysis\n # Collect the data for each of the days in the past week in this array\n day_data = []\n (0..6).each do |day_displacement|\n # Calculate the time of today, yesterday, day before yesterday, etc, for the past week\n time = Time.now - (60*60*24) * day_displacement\n\n # Convert this time into our date format\n filename = time.strftime \"Log%d%b%Y.log\"\n data = daily_analysis filename\n\n # Add our data to the array\n day_data.push data\n end\n\n # Process the array to give us a single map\n time_spent = {}\n\n # For each day, for each activity\n day_data.each do |day_array|\n day_array.each do |activity|\n\n # If already counted, add the time, else, make new activity\n if time_spent.member? activity[0] then\n time_spent[activity[0]] += activity[1]\n else\n time_spent[activity[0]] = activity[1]\n end\n end\n end\n\n # Return this map\n time_spent.sort { |a, b| b[1] <=> a[1] }\nend", "title": "" }, { "docid": "4bb426fb760abfa75bcc35a0865c6a5a", "score": "0.5488242", "text": "def weeks_best_times(preftimes)\n best_times = []\n d = @today.wday\n while d < @today.wday + 7 do\n day = preftimes[d%7]\n #max returns the first object with the highest pref then get the pref to compair\n candidates = day.select{|p| p.pref == day.max.pref}\n # if night owl take latest of best times\n if !candidates.empty?\n if(@user_preference.profile_type == 'late')\n best_time = candidates.sort{|a,b| b.time<=>a.time}.shift\n else\n best_time = candidates.sort{|a,b| a.time<=>b.time}.shift\n end\n best_times << best_time\n end\n d+=1\n end\n return best_times\n end", "title": "" }, { "docid": "db969c9c3f3bcdbc7cf19afbbcf25b5c", "score": "0.5486973", "text": "def one_week_wonders(songs)\n consecutive_weeks = []\n multi_weeks = []\n\n songs.each_with_index do |song, idx|\n if songs[idx] != songs[idx + 1]\n consecutive_weeks << song\n else\n multi_weeks << song\n end\n end\n\n (consecutive_weeks - multi_weeks).uniq\nend", "title": "" }, { "docid": "520be8bdcb5ce91023dcd3b5619197a0", "score": "0.5483647", "text": "def sort!\n @events.sort!\n\n self\n end", "title": "" }, { "docid": "a9fc21ab8f4126c8142c8d485a5ea44e", "score": "0.54822737", "text": "def weeks(date)\n range = date.beginning_of_month..date.end_of_month\n result = range.chunk_while { |date| date.cwday < 7 }.to_a\n\n if result.first.length < 7 \n (7 - result.first.length).times do \n result.first.unshift(NullDay.new)\n end\n end\n\n if result.last.length < 7 \n (7 - result.last.length).times do \n result.last.push(NullDay.new)\n end\n end\n \n result\n end", "title": "" }, { "docid": "8ac9bc56aa2532757c963a62a9a37f50", "score": "0.5477848", "text": "def seasons_by_date\n\n seasons.sort { |x,y| x.from_month == y.from_month ? x.from_day <=> y.from_day : x.from_month <=> y.from_month }\n\n end", "title": "" }, { "docid": "7c7eba8c859a3b47d81b080b2b118868", "score": "0.5475311", "text": "def calc_dates( entries )\n entries.map{|e| e.creation_date}.sort\n end", "title": "" }, { "docid": "c5e520b1b3266a773ace2dbbe915e1e0", "score": "0.54732364", "text": "def remove_weeks weeks, gamedays\n x = (0...gamedays).map {\n |i| (1 + i * (weeks.size - 1) / (gamedays - 1.0)).round - 1\n }\n weeks.to_a.values_at(*x)\n end", "title": "" }, { "docid": "0090386f66bc33fb7c365914e49cfc9c", "score": "0.54725516", "text": "def weeks\n return @weeks if @weeks\n\n @weeks = []\n @weeks_to_show.times do |i|\n root = i.weeks.from_now(@start_date)\n @weeks << Week.new(\n root.beginning_of_week(:sunday).to_date,\n root.end_of_week(:sunday).to_date\n )\n end\n\n @weeks\n end", "title": "" }, { "docid": "b66eefef3423b43e3a85240c573376d9", "score": "0.5471944", "text": "def sort_entries; end", "title": "" }, { "docid": "7dcae951e2e9dc801fd737d2383fdd3f", "score": "0.5460365", "text": "def commits_by_week(max_count=nil)\n max_count = Rails.configuration.recent_weeks if max_count.nil?\n week = DateTime.now.utc.beginning_of_week\n weeks = []\n\n # keep collecting weeks until we have enough.\n while weeks.length < max_count && week > DateTime.new(2011)\n commits = commits_for_week(week)\n if commits.any?\n weeks << Week.new(week, commits)\n end\n week -= 1.week\n end\n\n weeks\n end", "title": "" }, { "docid": "5d3746773079fee858fd3d1da3fa0d73", "score": "0.5459806", "text": "def sort_by_date(posts)\n posts.sort { |p1, p2| p2.published <=> p1.published }\n end", "title": "" }, { "docid": "ce1b21a4fc81856b57d0c7764dc9a8fa", "score": "0.5450044", "text": "def weeks; end", "title": "" }, { "docid": "3f9439e2121fa83384672514d0c2ddee", "score": "0.54415095", "text": "def weekend_arrange employees\n ans = employees.each_slice(2).to_a\n if employees.length % 2 == 0\n ans\n else\n temp = ans.pop\n ans.last << temp[0]\n ans\n end\nend", "title": "" }, { "docid": "2f91a1b56d1d34e2f7ba2f749886a6df", "score": "0.54408765", "text": "def display_weekly(months:, nondiscuss:)\n weeks = Hash.new {|h, k| h[k] = {}}\n months.sort.each do |month|\n data = MailUtils.get_mails_month(mailroot: SRV_MAIL, yearmonth: month, nondiscuss: nondiscuss)\n next if data.empty?\n # accumulate all mails in order for weeks, through all months\n data[MailUtils::MAILS].each do |m|\n d = Date.parse(m['date'])\n wn = d.strftime('%G-W%V')\n if weeks.has_key?(wn)\n weeks[wn][m['who']] +=1\n else\n weeks[wn] = Hash.new{ 0 }\n weeks[wn][m['who']] = 1\n end\n end\n end\n _h1 \"#{LIST_ROOT}@ list non-tool emails weekly statistics\", id: \"top\"\n _div.row do\n _div.col.col_sm_offset_1.col_sm_9 do\n weeks.sort.reverse.each do |week, senders|\n total = 0\n senders.each do |sender, count|\n next if /@@/ =~ sender\n total += count\n end\n senders[WEEK_TOTAL] = total\n _ul.list_group do\n _li.list_group_item.active.list_group_item_info \"Week #{week} Top Senders (total mails: #{senders[WEEK_TOTAL]})\", id: week\n ctr = 0\n senders.sort_by {|k,v| -v}.to_h.each do |id, num|\n next if /@@/ =~ id\n if (num > 7) && (num > (senders[WEEK_TOTAL] / 5)) # Ignore less than one per day\n _li.list_group_item.list_group_item_danger \"#{id} wrote: #{num}\"\n elsif (num > 7) && (num > (senders[WEEK_TOTAL] / 10))\n _li.list_group_item.list_group_item_warning \"#{id} wrote: #{num}\"\n elsif (num > 7) && (num > (senders[WEEK_TOTAL] / 20))\n _li.list_group_item.list_group_item_info \"#{id} wrote: #{num}\"\n else\n _li.list_group_item \"#{id} wrote: #{num}\"\n end\n ctr += 1\n break if ctr >= 5\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "8aca55ca5d231a1d822fbf88d27c0567", "score": "0.5438929", "text": "def to_week(**options) = convert_to('week', **options)", "title": "" }, { "docid": "a14f1ac6f75a6798e004cb6eb55ca693", "score": "0.5433094", "text": "def week_moods(array)\n array.each do |day|\n date = day[0..4]\n puts \"#{date} #{analyze_mood(day)}\"\n end\nend", "title": "" }, { "docid": "106463ba002c8603d49d36d933afca65", "score": "0.5424581", "text": "def index\n @runs = Run.preload(:group_run, :user).where('beginning > ?', Time.now - 1.week).order(:beginning)\n @runs_by_date = @runs.group_by{ |run| run.beginning.to_date }\n end", "title": "" }, { "docid": "878ea4ffacad85af8d9c19d38e31b576", "score": "0.54162455", "text": "def parse_weekly_dates(value)\n # FIXME repeats data from monthweek. we should probably get a more\n # robust parser going here\n unless md = /^\\s*(?:Every )?\\s*(1st|2nd|3rd|4th|last|first|second|third|fourth)?(?:\\s*(?:and|&)\\s*(1st|2nd|3rd|4th|last|first|second|third|fourth))?\\s*((?:Sun|Mon|Tues|Wednes|Thurs|Fri|Satur)day)s?\\s*(?:of each month|of the month|every month)?\\s*$/i.match(value)\n return nil\n end\n weekday = Date::DAYNAMES.index(md[3].downcase.capitalize)\n if md[2]\n monthweek = [monthweek(md[1]), monthweek(md[2])]\n return [{:weekday => weekday, :monthweek => md[1]}, {:weekday => weekday, :monthweek => md[2]}]\n elsif md[1]\n monthweek = monthweek(md[1])\n else\n monthweek = nil\n end\n {:weekday => weekday, :monthweek => monthweek }\n end", "title": "" }, { "docid": "8a3230725b2281cb43186689d28b7a74", "score": "0.5415371", "text": "def today_analysis\n acts = daily_analysis Time.now.strftime(\"Log%d%b%Y.log\")\n acts.sort { |a, b| b[1] <=> a[1] }\nend", "title": "" }, { "docid": "9c354d7d16e7d4051dd72f69e8a6edc8", "score": "0.54145086", "text": "def all_week\n beginning_of_week..end_of_week\n end", "title": "" }, { "docid": "dbd0753febd3eeea44c491e8211fafa6", "score": "0.5413974", "text": "def sort_rankings(teams_array_w_record)\n rec_sort_rankings(teams_array_w_record, [])\nend", "title": "" }, { "docid": "2eb02fb9ac1ba1e108f54d18c89e034d", "score": "0.5409946", "text": "def week_summaries\n @number_of_weeks = 11\n weeks = (0..@number_of_weeks).to_a.map do |week|\n start_date = (@date - (7 * week)).beginning_of_week\n StandupReport.new(date: start_date).week_summary\n end\n @week_summaries = StandupReport::Weeks.new(weeks)\n end", "title": "" }, { "docid": "e93a57c23664279c36915f50b6383099", "score": "0.54048926", "text": "def weeks_map\n @weeks_map ||= (\n t1w = @t1.number_of_weeks\n [ (1..t1w) , (t1w+1 .. number_of_weeks) ]\n )\n end", "title": "" }, { "docid": "a707d70cba8f9211d3c9800e2f449a39", "score": "0.5387497", "text": "def add_weeks weeks, gamedays\n span_size = gamedays - weeks.size\n span_before = span_size / 2\n span_after = span_size - span_before\n if @start_week - span_before < 1\n span_after += (span_before - @start_week + 1)\n @start_week = 1\n else\n @start_week -= span_before\n end\n @end_week += span_after\n @span = true\n @start_week.upto(@end_week).to_a\n end", "title": "" }, { "docid": "3993d6803d2937dff20341397ace4515", "score": "0.53737324", "text": "def dates_to_display\n rows = []\n day1 = @first_day_cache\n sunday = day1 - first_wday\n end_of_month = last_day\n while sunday <= end_of_month\n week = (0..6).collect { |n| sunday + n }\n rows << week\n sunday += 7\n end\n return rows\n end", "title": "" }, { "docid": "a3081a9550769230c06b0406652f1639", "score": "0.5372282", "text": "def entries_for_week\n TimeEntry.foruser(self.user).on_tweek(self.weekof.to_date.cweek)\n end", "title": "" }, { "docid": "2e7601b6de0c1eb30733cf1149b52142", "score": "0.5364406", "text": "def display_weekly(months:, nondiscuss:)\n weeks = Hash.new {|h, k| h[k] = {}}\n months.sort.each do |month|\n data = MailUtils.get_mails_month(mailroot: SRV_MAIL, yearmonth: month, nondiscuss: nondiscuss)\n next if data.empty?\n # accumulate all mails in order for weeks, through all months\n data[MailUtils::MAILS].each do |m|\n d = Date.parse(m['date'])\n wn = d.strftime('%G-W%V')\n if weeks.has_key?(wn)\n weeks[wn][m['who']] +=1\n else\n weeks[wn] = Hash.new{ 0 }\n weeks[wn][m['who']] = 1\n end\n end\n end\n _h1 \"#{LIST_ROOT}@ list emails weekly statistics\", id: \"top\"\n _div.row do\n _div.col.col_sm_offset_1.col_sm_9 do\n weeks.sort.reverse.each do |week, senders|\n total = 0\n senders.each do |sender, count|\n next if /@@/ =~ sender\n total += count\n end\n senders[WEEK_TOTAL] = total\n _ul.list_group do\n _li.list_group_item.active.list_group_item_info \"Week #{week} Top Senders (total mails: #{senders[WEEK_TOTAL]})\", id: week\n ctr = 0\n senders.sort_by {|k,v| -v}.to_h.each do |id, num|\n next if /@@/ =~ id\n if (num > 7) && (num > (senders[WEEK_TOTAL] / 5)) # Ignore less than one per day\n _li.list_group_item.list_group_item_danger \"#{id} wrote: #{num}\"\n elsif (num > 7) && (num > (senders[WEEK_TOTAL] / 10))\n _li.list_group_item.list_group_item_warning \"#{id} wrote: #{num}\"\n elsif (num > 7) && (num > (senders[WEEK_TOTAL] / 20))\n _li.list_group_item.list_group_item_info \"#{id} wrote: #{num}\"\n else\n _li.list_group_item \"#{id} wrote: #{num}\"\n end\n ctr += 1\n break if ctr >= 5\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "2b031c8e947727d633baa32244e19372", "score": "0.53607094", "text": "def week_ord\n ((day - wday) / 7) + 1\n end", "title": "" }, { "docid": "54f5c244b729713312644322cdcf0a27", "score": "0.5356476", "text": "def week() @week end", "title": "" }, { "docid": "fc072929abfc468a0eb9770c5caf1523", "score": "0.53468484", "text": "def week_dates_beginning_with(date)\n (date..date + 6).to_a\n end", "title": "" }, { "docid": "ba93838f1f50be0243febeb6ceb8097d", "score": "0.53464323", "text": "def events_sort()\n $new_events = $new_events.sort {|left, right| (@items[left])[:event] <=> (@items[right])[:event]}\n $old_events = $old_events.sort {|left, right| (@items[left])[:event] <=> (@items[right])[:event]}\n $old_events = $old_events.reverse\nend", "title": "" }, { "docid": "ba93838f1f50be0243febeb6ceb8097d", "score": "0.53464323", "text": "def events_sort()\n $new_events = $new_events.sort {|left, right| (@items[left])[:event] <=> (@items[right])[:event]}\n $old_events = $old_events.sort {|left, right| (@items[left])[:event] <=> (@items[right])[:event]}\n $old_events = $old_events.reverse\nend", "title": "" }, { "docid": "df87ad3eeda57250d6c57ca64fa8100f", "score": "0.5341587", "text": "def week_days\n 7.times.map{ |i|\n days[i] > 0 ?\n i :\n nil\n }.compact\n end", "title": "" }, { "docid": "11d49c1fc6855cd284306c6008c11c25", "score": "0.5340065", "text": "def save_as_week(tmpl, year, week)\n\n if tmpl.length != 7\n puts \"ERROR missing template items! Must be exactly 7\"\n return\n end\n\n wkBegin = Date.commercial(year, week, 1)\n wkEnd = Date.commercial(year, week, 7)\n\n index=0\n for d in wkBegin..wkEnd do\n tmpl_day = tmpl[index]\n BookingItem.create(tmpl_day)\n index = index + 1\n end\n end", "title": "" }, { "docid": "9ffcafea67523c7f0d4714d5659f066a", "score": "0.5326793", "text": "def dates\n ([date] + event_dates.pluck(:date)).compact.sort\n end", "title": "" }, { "docid": "21e18e794170f152e5c072ac3757f151", "score": "0.5325407", "text": "def calculate_for_week(data)\n beer_days = data.count('2')\n dry_days = data.count('1')\n nondry_days = beer_days + data.count('0')\n display_score = [\n beer_days * BEER_DAY_PENALTY + dry_days * DRY_DAY_POINTS, MAXIMUM_WEEK\n ].min\n official_score = [\n nondry_days * BEER_DAY_PENALTY + dry_days * DRY_DAY_POINTS, MAXIMUM_WEEK\n ].min\n { display: display_score, official: official_score }\n end", "title": "" }, { "docid": "1d1f1458e60640ed514cee5615603da1", "score": "0.53241074", "text": "def events_day_of_week(events)\n events_day_of_week = []\n Date::DAYNAMES.each_with_index.to_a.rotate(1).each do |_, index|\n events_day_of_week[index] = []\n events.each do |event|\n next if event.start_time.wday != index\n events_day_of_week[index] << event\n end\n end\n events_day_of_week\n end", "title": "" }, { "docid": "9d13ce3209c62ebd4c547ed52cb0f2e4", "score": "0.53115284", "text": "def this_weeks_schedule\r\n schedule = []\r\n [0,1,2,3,4,5,6].each do |i|\r\n schedule << self.get_schedule(Date.today + i.days)\r\n end\r\n schedule\r\n end", "title": "" }, { "docid": "514899eced8a8017a59b9e238ffcf490", "score": "0.5300325", "text": "def week(date) = date(date).cweek", "title": "" }, { "docid": "7c1a67262580c1ef97c7007c32275684", "score": "0.5300264", "text": "def sort_games_by_venue\n venues = []\n @games.each do |game|\n venues << game[1].venue\n end\n venues\n end", "title": "" }, { "docid": "952929b0d63094563a31d61bfbe88cee", "score": "0.52990234", "text": "def reservations_by_weekday(year)\n data = query_strategy.reservations_by_weekday(year)\n result = data.inject({}) do |result, value|\n result.store(value.day.to_i.to_s, value.count)\n result\n end\n (0..6).each do |item|\n result.store(item.to_s, 0) unless result.has_key?(item.to_s)\n end\n result\n end", "title": "" }, { "docid": "1d737a7150688ef990068872780c7cdb", "score": "0.52989393", "text": "def sort arr \n\trec_sort arr, []\nend", "title": "" }, { "docid": "feafc67bb74bc4dfbc0b495e212b7ae7", "score": "0.5292508", "text": "def pages_by_date\n # page.config[\"title\"] avoids the warning\n html_pages.select {|page| page.config[\"title\"] }.\n sort_by { |page| [-page.date.to_i, page.title] }\n end", "title": "" }, { "docid": "e54a39d1bd93cce10b48f68bc7d8722b", "score": "0.5289838", "text": "def pad_array_left_not_kumulative(start_week, hash)\n hash = assert_keys_are_continuously(hash)\n\n first_week = hash.keys[0]\n left = pad_left(first_week, start_week)\n left + hash.values\n end", "title": "" }, { "docid": "522fc78dda868c29da777cd3e426e72c", "score": "0.5289346", "text": "def sort_tags_by_date(tags); end", "title": "" } ]
bb52a8065eb63aa4f57745df153ce2fc
Identify and describe the Ruby method(s) you implemented. Person 3
[ { "docid": "e95da42dbcdd0b1cb1a96f72d2b592e5", "score": "0.0", "text": "def my_array_sorting_method(source)\n source.sort {|x,y| x.to_s <=> y.to_s }\nend", "title": "" } ]
[ { "docid": "f4ad13bf5fa71b1e7bc47220336ffdbf", "score": "0.7190859", "text": "def methods() end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "899adc855f2a606df210adeb4dc5a66e", "score": "0.70302373", "text": "def extract_method_details; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.69476235", "text": "def methods; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.69476235", "text": "def methods; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.69476235", "text": "def methods; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.69476235", "text": "def methods; end", "title": "" }, { "docid": "6e80e36c0465d79f594ff02c379ac53f", "score": "0.6914426", "text": "def describeMethod(cname, type, mname)\n \n # If the class name part is ambiguous, then we have a join to\n # do\n \n method_list = methods_matching(cname, type, mname)\n\n case method_list.size\n \n when 0\n @op.error(\"Cannot find method `#{cname}#{type}#{mname}'\")\n throw :exit, 3\n \n when 1\n meth = method_list[0]\n @op.putMethodDescription do\n @op.putMethodHeader(meth.class_name, meth.typeAsSeparator, meth.name, meth.callseq)\n printFragments(meth) unless @synopsis\n end\n \n else\n\n @op.putListOfMethodsMatchingName(mname) do\n @op.putMethodList(method_list.collect { |m| \n \"#{m.class_name}#{m.typeAsSeparator}#{m.name}\" \n })\n end\n end\n end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.6885498", "text": "def method; end", "title": "" }, { "docid": "70f46f89dae30c347c6e8535f7ab7187", "score": "0.6822947", "text": "def method_name\n\n end", "title": "" }, { "docid": "70f46f89dae30c347c6e8535f7ab7187", "score": "0.6822947", "text": "def method_name\n\n end", "title": "" }, { "docid": "70f46f89dae30c347c6e8535f7ab7187", "score": "0.6822947", "text": "def method_name\n\n end", "title": "" }, { "docid": "c48f716c42f9842f906468893376e18f", "score": "0.68222916", "text": "def method_symbol; end", "title": "" }, { "docid": "d944361b92d1074b1b5bcd4abb9f2cf0", "score": "0.68077403", "text": "def method_name\n end", "title": "" }, { "docid": "251c45fdc731d4a4731cfd648226acf7", "score": "0.6792002", "text": "def display_method_info\n end", "title": "" }, { "docid": "f0aaf2abe0346997bae8db93c93db627", "score": "0.67568535", "text": "def method_information(bound_method); end", "title": "" }, { "docid": "359921beed653b90c1015a06cdee15d2", "score": "0.67523015", "text": "def name_of_method\n # method body goes here\nend", "title": "" }, { "docid": "853950d9ecf8458fc1bea260fc12c6bd", "score": "0.6742483", "text": "def expected_method; end", "title": "" }, { "docid": "902c9907e232dc678e6efade656d3899", "score": "0.6713484", "text": "def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end", "title": "" }, { "docid": "410acce3aabbb7b9adf35f889c493a83", "score": "0.6713088", "text": "def method\r\nend", "title": "" }, { "docid": "733e81100aaa55749ec0c3d8a978ffed", "score": "0.6698017", "text": "def signature\n raise NotImplementedError, _(\"%{class} has not implemented method %{method}\") %{class: self.class, method: __method__}\n end", "title": "" }, { "docid": "0e9078e41a7f60a86840ab66a7e04c2a", "score": "0.66795576", "text": "def print_method(*) end", "title": "" }, { "docid": "d657b79205705cb7434bda5caecb465d", "score": "0.66427284", "text": "def findAndDescribe(name)\n methods = MethodIndex.findMethods(name)\n \n if methods.size.zero?\n @op.error(\"Don't know anything about a method called `#{name}'.\")\n throw :exit, 4\n end\n \n if methods.size == 1\n methods[0] =~ /^(#{CN_PATTERN})(\\.|\\#|::)(.+)/\n describeMethod($1, $2, $3)\n else\n @op.putListOfMethodsMatchingName(name) do\n @op.putMethodList(methods)\n end\n end\n end", "title": "" }, { "docid": "e941311c5dd0231db4b43f929d866687", "score": "0.6585802", "text": "def yet_another_method\n puts \"I'm a method\"\nend", "title": "" }, { "docid": "2289b2901ed39822b2b1f5181934dcbf", "score": "0.658216", "text": "def firstMethod()\n p \"hey this is first method ok\"\n p \"here i show how can create method in ruby\"\n p \" know time end \"\nend", "title": "" }, { "docid": "e70cf8787c016705a1c1c8934a0990d6", "score": "0.6534139", "text": "def method1; end", "title": "" }, { "docid": "82a6993f872d81116473fcdbf9823895", "score": "0.6503166", "text": "def signature\n \"#{klass_name}#{method_name}\"\n end", "title": "" }, { "docid": "3048a66c9676b0f0d0ec6b686566daed", "score": "0.64772403", "text": "def my_method_param(name) #Define method \"my_method_param\"\n print \"Hello #{name}!\"\nend", "title": "" }, { "docid": "2f7be3b962093c375ff81e3180ec43e8", "score": "0.6474072", "text": "def method_missing(meth, *args, &block)\n __describe_and_send__(meth, *args, &block)\n end", "title": "" }, { "docid": "1f50da93e529067322b72a7973a7436c", "score": "0.6438776", "text": "def display_method_list\n end", "title": "" }, { "docid": "f1a47fd61a8f77fc0850a7d15d12197b", "score": "0.64362913", "text": "def method(arg1 = default_value, arg2, etc.) # Defines a method with the name method and arguments.\n # Code goes here, for example:\n puts \"Hello, #{arg1} #{arg2}!\"\nend", "title": "" }, { "docid": "5cce320d20daf511c3eb1c01fa7f949e", "score": "0.6431125", "text": "def type\n 'Method'\n end", "title": "" }, { "docid": "581805b38e28f361b59b1773c249c198", "score": "0.64208823", "text": "def describe\n raise NotImplementedError\n end", "title": "" }, { "docid": "99f6d94f766456f0220cc9aaa6b69f54", "score": "0.64166486", "text": "def methodname\n # contents of method\nend", "title": "" }, { "docid": "3f3cf952c9adbe3c9437a82f00914d26", "score": "0.63965696", "text": "def demoMethod\n\t\traise \"Ceci est une methode abstraite. This is an abstact method.\";\n\tend", "title": "" }, { "docid": "e1d06a0f63fc539141f3812254afdefc", "score": "0.6376872", "text": "def report_method_stuff(requested_method_name, methods)\n entries = methods.find_all {|m| m.name == requested_method_name and (\n !@onlyLoadedClasses or \n Object.class_eval \"defined? #{m.nameSpace.full_name}\" ) }\n case entries.size\n when 1\n method = @ri_reader.get_method(entries.first)\n @display.display_method_info(method)\n when 0\n puts \"No loaded methods matched your request\"\n else\n @display.display_method_list(entries)\n end\n end", "title": "" }, { "docid": "416f08f203300794506abd7ed803d8a6", "score": "0.63686895", "text": "def simple_method\n puts \"I am a simple method!\"\nend", "title": "" }, { "docid": "9db2b088f7cf5862558375465fc72ca0", "score": "0.6358185", "text": "def method_description(method)\n call(\"System.methodDescription\", method)\n end", "title": "" }, { "docid": "67f15327461160b3d334dc95e7e22a94", "score": "0.6356888", "text": "def my_method\nend", "title": "" }, { "docid": "0a68ae978bc66c1317a082771cc28056", "score": "0.6356238", "text": "def display_method name\n found = load_methods_matching name\n raise NotFoundError, name if found.empty?\n filtered = filter_methods found, name\n out = RDoc::Markup::Document.new\n out << RDoc::Markup::Heading.new(1, name)\n out << RDoc::Markup::BlankLine.new\n filtered.each do |store, methods|\n methods.each do |method|\n out << RDoc::Markup::Paragraph.new(\"(from #{store.friendly_path})\")\n unless name =~ /^#{Regexp.escape method.parent_name}/ then\n out << RDoc::Markup::Heading.new(3, \"Implementation from #{method.parent_name}\")\n end\n out << RDoc::Markup::Rule.new(1)\n if method.arglists then\n arglists = method.arglists.chomp.split \"\\n\"\n arglists = arglists.map { |line| line + \"\\n\" }\n out << RDoc::Markup::Verbatim.new(*arglists)\n out << RDoc::Markup::Rule.new(1)\n end\n out << RDoc::Markup::BlankLine.new\n out << method.comment\n out << RDoc::Markup::BlankLine.new\n end\n end\n display out\n end", "title": "" }, { "docid": "354b871ba537bc4c121913f6f7e13a0c", "score": "0.63434535", "text": "def method\n @method\n end", "title": "" }, { "docid": "1660b067e8d003c663081a5ec9a7804e", "score": "0.6343024", "text": "def defined_method()\n p \"success\"\nend", "title": "" }, { "docid": "3c551aa33154a4e082b13d2608cceafa", "score": "0.6342484", "text": "def my_method\n end", "title": "" }, { "docid": "8f986f90ee323a4d8249ddbb885b5c98", "score": "0.6316625", "text": "def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend", "title": "" }, { "docid": "ed338e69efb2ef1da5ab0b8c88038cdb", "score": "0.6299635", "text": "def meth(arg1)\nend", "title": "" }, { "docid": "8c90e95afc0af22c342505f3d4825262", "score": "0.6290259", "text": "def hey_hey; end", "title": "" }, { "docid": "3dcbcd0906883368b25c171fb0eb7940", "score": "0.62693167", "text": "def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6260108", "text": "def signature; end", "title": "" }, { "docid": "fe98f2920438e84034b8d08c9daa6035", "score": "0.62548584", "text": "def example_method\n # code\n end", "title": "" }, { "docid": "ff998ac155d0da883c8b7b6237b1b8fd", "score": "0.62494916", "text": "def meth(arg1,arg2)\nend", "title": "" }, { "docid": "ff998ac155d0da883c8b7b6237b1b8fd", "score": "0.62494916", "text": "def meth(arg1,arg2)\nend", "title": "" }, { "docid": "6b22c1887e254fb2397556f5f1904282", "score": "0.6235406", "text": "def how_it_works\r\n end", "title": "" }, { "docid": "1e1b26911df86936c247c464bf10be4f", "score": "0.6234566", "text": "def report_methods cm\n return if cm.method_list.empty?\n\n report = []\n\n cm.each_method do |method|\n next if method.documented? and @coverage_level.zero?\n\n if @coverage_level > 0 then\n params, undoc = undoc_params method\n\n @num_params += params\n\n unless undoc.empty? then\n @undoc_params += undoc.length\n\n undoc = undoc.map do |param| \"+#{param}+\" end\n param_report = \" # #{undoc.join ', '} is not documented\\n\"\n end\n end\n\n next if method.documented? and not param_report\n\n line = method.line ? \":#{method.line}\" : nil\n scope = method.singleton ? 'self.' : nil\n\n report << \" # in file #{method.file.full_name}#{line}\\n\"\n report << param_report if param_report\n report << \" def #{scope}#{method.name}#{method.params}; end\\n\"\n report << \"\\n\"\n end\n\n report\n end", "title": "" }, { "docid": "78715c96fa1cf2097657613c494e2cc6", "score": "0.6195668", "text": "def internal_methods; end", "title": "" }, { "docid": "51d18e01dc1a61349562ef4028ff4408", "score": "0.6191331", "text": "def method\n @method\n end", "title": "" }, { "docid": "51d18e01dc1a61349562ef4028ff4408", "score": "0.6191331", "text": "def method\n @method\n end", "title": "" }, { "docid": "48e456a7ad3c9fec028a6602567a00e8", "score": "0.61726916", "text": "def calls_by_method_name; end", "title": "" }, { "docid": "863e92a91a49d256f208a4c90d4aa861", "score": "0.61649156", "text": "def display_method name\n found = load_methods_matching name\n\n raise NotFoundError, name if found.empty?\n\n filtered = filter_methods found, name\n\n out = method_document name, filtered\n\n @history.go name, out, nil\n\n display out\n end", "title": "" }, { "docid": "f16500b766929607ddae7f5b5f4c0042", "score": "0.61566335", "text": "def method\r\n\t1\r\nend", "title": "" }, { "docid": "4dbd194be34393c8db0e58723d0d62cb", "score": "0.61522245", "text": "def methods_accepting_symbol; end", "title": "" }, { "docid": "8adbbc90f606d272eccc5b190fb92892", "score": "0.6138363", "text": "def name\n 'method 2'\n end", "title": "" }, { "docid": "090340f133a276ae736a0a0be0c46d0f", "score": "0.6123219", "text": "def whatever\n end", "title": "" }, { "docid": "7cf9288c23c3a23c5b00687a55039ef8", "score": "0.6107706", "text": "def do_methods\n @content.scan(%r%rb_define_\n (\n singleton_method |\n method |\n module_function |\n private_method\n )\n \\s*\\(\\s*([\\w\\.]+),\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\(|\\(METHOD\\))?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.(?:cpp|c|y)))?\n %xm) do |type, var_name, meth_name, function, param_count, source_file|\n\n # Ignore top-object and weird struct.c dynamic stuff\n next if var_name == \"ruby_top_self\"\n next if var_name == \"nstr\"\n\n var_name = \"rb_cObject\" if var_name == \"rb_mKernel\"\n handle_method(type, var_name, meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(%r%rb_define_global_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.[cy]))?\n %xm) do |meth_name, function, param_count, source_file|\n handle_method(\"method\", \"rb_mKernel\", meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(/define_filetest_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)/xm) do |meth_name, function, param_count|\n\n handle_method(\"method\", \"rb_mFileTest\", meth_name, function, param_count)\n handle_method(\"singleton_method\", \"rb_cFile\", meth_name, function,\n param_count)\n end\n end", "title": "" }, { "docid": "70ad010c54c0925a6561e17c05ca07e5", "score": "0.61001015", "text": "def required_operations1\n raise NotImplementedError, \"#{self.class} has not implemented method '#{__method__}'\"\n end", "title": "" }, { "docid": "0a556b1952ad83e39c4a887f1f85e9bc", "score": "0.60956687", "text": "def method\n\t\t# code code\n\tend", "title": "" }, { "docid": "2edb3ad52d97b2547ac6056369a8a49e", "score": "0.6085038", "text": "def add_method_documentation out, klass\n klass.method_list.each do |method|\n begin\n add_method out, method.full_name\n rescue NotFoundError\n next\n end\n end\n end", "title": "" }, { "docid": "2bba60a142dd8d47f42d764804ace941", "score": "0.60674393", "text": "def handle_method(type, var_name, meth_name, function, param_count,\n source_file = nil)\n class_name = @known_classes[var_name]\n singleton = @singleton_classes.key? var_name\n\n @methods[var_name][function] << meth_name\n\n return unless class_name\n\n class_obj = find_class var_name, class_name\n\n if existing_method = class_obj.method_list.find { |m| m.c_function == function }\n add_alias(var_name, class_obj, existing_method.name, meth_name, existing_method.comment)\n end\n\n if class_obj then\n if meth_name == 'initialize' then\n meth_name = 'new'\n singleton = true\n type = 'method' # force public\n end\n\n meth_obj = RDoc::AnyMethod.new '', meth_name\n meth_obj.c_function = function\n meth_obj.singleton =\n singleton || %w[singleton_method module_function].include?(type)\n\n p_count = Integer(param_count) rescue -1\n\n if source_file then\n file_name = File.join @file_dir, source_file\n\n if File.exist? file_name then\n file_content = File.read file_name\n else\n @options.warn \"unknown source #{source_file} for #{meth_name} in #{@file_name}\"\n end\n else\n file_content = @content\n end\n\n body = find_body class_name, function, meth_obj, file_content\n\n if body and meth_obj.document_self then\n meth_obj.params = if p_count < -1 then # -2 is Array\n '(*args)'\n elsif p_count == -1 then # argc, argv\n rb_scan_args body\n else\n args = (1..p_count).map { |i| \"p#{i}\" }\n \"(#{args.join ', '})\"\n end\n\n\n meth_obj.record_location @top_level\n\n if meth_obj.section_title\n class_obj.temporary_section = class_obj.add_section(meth_obj.section_title)\n end\n class_obj.add_method meth_obj\n\n @stats.add_method meth_obj\n meth_obj.visibility = :private if 'private_method' == type\n end\n end\n end", "title": "" }, { "docid": "73de1ba603c53649bf54d5b7e5e0d4c7", "score": "0.6066829", "text": "def walk_method(name); end", "title": "" }, { "docid": "c7b7d59db09d450ebff37527e0fbee91", "score": "0.606312", "text": "def what_is\n end", "title": "" }, { "docid": "795f3d547f3d27384fceb43b353f5ccf", "score": "0.60587573", "text": "def get_method_description(class_name, method_name = nil)\n ApipieDSL.debug(\"Getting #{class_name}##{method_name} documentation\")\n crumbs = class_name.split('#')\n method_name = crumbs.pop if method_name.nil?\n class_name = crumbs.join('#')\n class_description = get_class_description(class_name)\n raise ArgumentError, \"Class #{class_name} does not exists.\" if class_description.nil?\n\n class_description.method_description(method_name.to_sym)\n end", "title": "" } ]
86c345f1e164ba6e6d9468b1957b8841
can_capture?(pieces : ChessPiece[], destination: Position) Checks if a square contains a piece of opposite color
[ { "docid": "7794c698026cdb3c472620a69f1c29d1", "score": "0.8753309", "text": "def can_capture?(_pieces, _destination)\n destination_piece = _pieces.find { |p| p.position.equals?(_destination) }\n\n !destination_piece.nil? && destination_piece.color != color\n end", "title": "" } ]
[ { "docid": "662950d677b98a6ff22e87c773c8b2aa", "score": "0.7031691", "text": "def capture_piece(p_moves, opp_pieces, board)\n # check if opponent piece is in the square\n opp_piece = get_piece(p_moves[1], board)\n # capture and remove piece\n opp_index = opp_pieces.find_index { |piece| piece.history.last == opp_piece.history.last } if opp_piece\n opp_pieces.delete_at(opp_index) if opp_piece\n end", "title": "" }, { "docid": "7f32421c478d18c64afcdeea1a4365ed", "score": "0.68624735", "text": "def color_check(piece_at_origin,piece_at_destination)\n\t\tif piece_color(piece_at_origin) == piece_color(piece_at_destination)\n\t\t\tbol = false\n\t\telse\n\t\t\tbol = true\n\t\tend\n\t\tbol\n\tend", "title": "" }, { "docid": "99cc7085996802f04a6c27cdeaa51501", "score": "0.67761207", "text": "def can_be_captured_en_passant?(x,y)\n return false unless piece = self.game.find_piece(x,y)\n return (piece.type == \"Pawn\") && (piece.white? != white?) && (piece.just_moved_two_spaces?)\n end", "title": "" }, { "docid": "f4eb0853f721464f59cd8d9fa623420f", "score": "0.67657375", "text": "def available_captures?(board_dup, current_location, desired_location)\n x1, y1 = current_location\n x2, y2 = desired_location\n\n if board_dup.can_capture?(current_location, desired_location)\n\n #if board_dup.can_capture([x,y],[x2,y2])\n end\n \nend", "title": "" }, { "docid": "3979d9800352b60da6a2e36412020214", "score": "0.67556405", "text": "def white_moves(pieces)\n board = Chess_board.new.squares\n piece_positions = pieces.map { |piece| piece.position }\n row = @position[0]\n column = @position[1]\n \n all_checked = []\n [[row + 1,column - 1],[row + 1,column + 1]].each do |square| \n if piece_positions.include?(square)\n occupying_piece = pieces.find { |piece| piece.position == square }\n all_checked.push(square) if occupying_piece.color != @color\n end\n end\n if !piece_positions.include?([row + 1, column])\n all_checked.push([row + 1, column])\n all_checked.push([row + 2, column]) if !piece_positions.include?([row + 2, column]) && @moves == 0\n end\n all_checked\n end", "title": "" }, { "docid": "83d07fa2375f134e917897b4ff889a83", "score": "0.67518693", "text": "def secondary_move_tests(to_x:, to_y:)\n return true if move_tests(to_x: to_x, to_y: to_y) == true &&\n in_check?(game_of_piece.current_color) == false\n false\n end", "title": "" }, { "docid": "c4f8ff8f3515388c10e0c0140e158841", "score": "0.6732755", "text": "def can_capture_threat?(friendly_pieces, threatening_pieces, board)\r\n return false if threatening_pieces == false || threatening_pieces.length > 1\r\n enemy_row = threatening_pieces.first.row\r\n enemy_col = threatening_pieces.first.col\r\n\r\n friendly_pieces.each do |friend|\r\n if friend.legal_move?(enemy_row, enemy_col, board)\r\n puts \"#{friend.class.name} can capture at: [#{enemy_row},#{enemy_col}]\"\r\n return true\r\n end\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "f6d6f42225eea364c18ef39bf32ac754", "score": "0.6669681", "text": "def en_passant_capture?( from_coord, to_coord ) \n with ( self[from_coord] ) do |pawn|\n return false unless pawn.function == :pawn\n return false unless self.en_passant_square\n return (from_coord.file != to_coord.file) && (self[to_coord]==nil)\n end\n end", "title": "" }, { "docid": "815584558ea2b8c7783fa94162af1e51", "score": "0.6620105", "text": "def check?(color)\n opposing_pieces = []\n king_piece = nil\n @grid.each do |row|\n row.each do |piece|\n if piece\n king_piece = piece if piece.is_a?(King) && piece.color == color\n opposing_pieces << piece if piece.color != color\n end\n end\n end\n opposing_pieces.each do |piece|\n return true if piece.possible_moves.include?(king_piece.pos)\n end\n @message = nil\n false\n end", "title": "" }, { "docid": "23b1387c7ea7a6e5d22ff7cf89f78216", "score": "0.65929633", "text": "def capture_move?(x_new, y_new)\n target = game.pieces.where(\"x_pos = ? AND y_pos = ?\", x_new, y_new).first\n return false if target.nil?\n if move_type(x_new, y_new) == :diagonal && x_diff(x_new) == 1 && y_diff(y_new) == 1\n target.color != self.color && target.type != \"King\"\n end\n end", "title": "" }, { "docid": "d62398e3c267aa043e175337c4e014bf", "score": "0.6565967", "text": "def checkmoves(king, attacking_pieces, board )\n if self == king\n enemy_pieces = self.game.pieces.where('player_id != ?', king.player_id).where(captured_piece: false)\n king_moves = king.piece_can_move_to(board)\n enemy_pieces.each do |enemy_piece|\n if enemy_piece.type == \"Pawn\" #testing for if pawn is attacking square king could move to. wierd case since pawn cant move to this square unless an enemy piece is there to capture (take diagonal)\n pawn_test_spots = []\n if enemy_piece.game.black_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position - 1,enemy_piece.x_position - 1],[enemy_piece.y_position - 1,enemy_piece.x_position + 1]]\n\n elsif enemy_piece.game.white_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position + 1,enemy_piece.x_position - 1],[enemy_piece.y_position + 1,enemy_piece.x_position + 1]]\n end\n king_moves -= pawn_test_spots\n next\n end\n king_moves -= enemy_piece.piece_can_move_to(board)\n end\n return king_moves\n end\n\n return [] if attacking_pieces.length > 1 # can't defend from two attacking pieces unless king is moved\n\n current_piece = self\n current_piece_moves_avail = current_piece.piece_can_move_to(board)\n enemy_piece = attacking_pieces[0] # since only one piece is attacking, we should rename this\n current_piece_moves_avail = current_piece_moves_avail & (enemy_piece.piece_can_move_to(board) + [[enemy_piece.y_position,enemy_piece.x_position]])# finding the squares these pieces can both move to\n\n prevent_check_moves = []\n\n current_piece_moves_avail.each do |square|\n y = square[0]\n x = square[1]\n play_board = Marshal.load(Marshal.dump(board))\n play_board[self.y_position][self.x_position] = 0\n play_board[y][x] = self.player_id\n # enemy piece should have x,y such that board[y][x] should equal to enemy player.id\n if play_board[enemy_piece.y_position][enemy_piece.x_position] == self.player_id\n prevent_check_moves << square\n next\n end\n prevent_check_moves << square if !enemy_piece.piece_can_move_to(play_board).include?([king.y_position,king.x_position])\n end\n return prevent_check_moves\n\n end", "title": "" }, { "docid": "8226625b390f6f1f418e76b2270325f1", "score": "0.6552531", "text": "def isSquareAttackedBy?(coord,colour, board)\n board.pieces[colour].each do |pieceType, listOfCoord|\n listOfCoord.each do |fromCoord, piece| \n m = Move.new(board, piece, coord, fromCoord)\n return true if isLegalMove?(m)\n end\n end\n return false\n end", "title": "" }, { "docid": "a136c8218861fcd855e902a0d6f23c24", "score": "0.6540536", "text": "def get_possible_pawn_capture_moves(piece, position)\n position = board.chess_notation_to_coordinates(position)\n\n possible_moves = piece.capture_moves[0..-1] #duplicate piece move list\n possible_moves.map! { |y,x| [y+position[0], x+position[1]] }\n possible_moves.select! { |coordinates| valid_move?(coordinates) }\n\n possible_moves.map { |coordinates| board.coordinates_to_chess_notation(coordinates) }\n end", "title": "" }, { "docid": "fcd67e3625da77ac8e07a0bf40348b5d", "score": "0.6504438", "text": "def pawn_direction? piece, square\n if piece.color == 0\n if square.coordinate[0] > piece.square.coordinate[0]\n true\n else\n false\n end\n elsif piece.color == 1\n if square.coordinate[0] < piece.square.coordinate[0]\n true\n else\n false\n end\n end\n \n end", "title": "" }, { "docid": "027790615f4caf1424023ec8232ce26a", "score": "0.6494304", "text": "def enemy_pieces(color)\n chess_pieces.select { |piece| piece.color != color }\n end", "title": "" }, { "docid": "75b2c03a4c2b970a232964cfaa450929", "score": "0.6484574", "text": "def valid_squares(move_array, piece)\n new_move_array = []\n move_array.each do |direction_array|\n # check coords on board\n direction_array.select! { |coord| (coord[0].between?(0, 7) && coord[1].between?(0, 7)) }\n # valid moves blocked by pieces and add valid attack squares\n direction_array.each do |move_square|\n square = @board_obj.board[move_square[0]][move_square[1]]\n\n if piece.instance_of?(Pawn)\n # case for pawn side takes\n if piece.position[1] != move_square[1]\n if square != \" \"\n new_move_array << move_square if square.colour != piece.colour\n elsif enpassant_square(move_square)\n new_move_array << move_square\n end\n break\n # case if piece in way \n elsif square != \" \"\n break\n end\n\n elsif square != \" \"\n new_move_array << move_square if square.colour != piece.colour\n break\n end\n new_move_array << move_square\n end\n end\n new_move_array\n end", "title": "" }, { "docid": "96df973771d49df5c8e47228fcb77339", "score": "0.64799875", "text": "def on_board?( position )\n position[ 0 ].ord >= 97 && \n position[ 0 ].ord <= 104 && \n position[ 1 ].to_i >= 1 && \n position[ 1 ].to_i <= 8 && \n end\n\n # See if another piece of the opposing color occupies the space; bool\n def capture?( position )\n ( white? && ( get_space( position ).token ) =~ /[prnbqk]/ ) || \n ( !white? && ( get_space( position ).token ) =~ /[PRNBQK]/ )\n end\n\n # Check for B/W; bool true for white\n def white?\n @color == \"White\" ? true : false\n end\n\n # See if space is occupied by piece of same color; bool\n def empty?( *positions )\n positions.all? { | position | get_space( position ).token =~ /_/ }\n end\n\nend", "title": "" }, { "docid": "898b5da6757989239c7cf0932eb72de0", "score": "0.64202106", "text": "def can_attack?(target_piece)\n self.movable_squares.include? target_piece.pos\n end", "title": "" }, { "docid": "27bab5dc97e8467efa1aee24c94c46cb", "score": "0.641725", "text": "def permissible(start, stop, piece, player)\r\n $board[start[0]][start[1]].nil? ? start_color = nil : start_color = $board[start[0]][start[1]].color\r\n $board[stop[0]][stop[1]].nil? ? stop_color = nil : stop_color = $board[stop[0]][stop[1]].color \r\n # Ensures player moving own piece\r\n if start_color != player\r\n puts \"Invalid selection!\"; return false\r\n end\r\n temp_board = temporary_board(start, stop)\r\n check = in_check(player, temp_board)\r\n # Ensures King not currently in check, or move places King in check\r\n if check == true\r\n puts ''\r\n puts \"Invalid move. King in check.\" ; return false \r\n end\r\n # Ensures player doesn't capture own piece\r\n if stop_color == player\r\n puts ''\r\n puts \"You cannot capture your own piece!\"; return false\r\n end\r\n # Permits en passant\r\n if piece.class == Pawn && $board[@prev_coord[0]][@prev_coord[1]].class == Pawn\r\n if @prev_delta_y == 2 && @prev_coord[1] == start[1] && @prev_coord[0] == stop[0] \r\n if (player == 'white' && stop[1] == @prev_coord[1] + 1) or (player == 'black' && stop[1] == @prev_coord[1] -1 )\r\n print \"En passant\"\r\n $board[@prev_coord[0]][@prev_coord[1]] = nil\r\n return true\r\n end\r\n end\r\n end\r\n #King hasn't moved yet, rook hasn't moved yet\r\n if piece.class == King and start[1] == stop[1] and (start[0] - stop[0]).abs == 2 and piece.turn == 0 #first rank King,king hasn't moved, \r\n if castle_valid(start, stop, piece, player)\r\n print \"Castling...\"\r\n return true\r\n end\r\n end\r\n # Ensures move is a valid combination for piece type\r\n if piece.valid_move(start, stop, $board) == false\r\n puts ''\r\n puts \"Invalid move!\" ; return false\r\n end\r\n return true\r\n end", "title": "" }, { "docid": "45739792bf61803a858f24b7f3a170c7", "score": "0.6374173", "text": "def own_piece?(pos, board)\r\n board[pos].color == @color unless board[pos].nil?\r\n end", "title": "" }, { "docid": "89c58220eccfb6b8ef79dbccd9d0dede", "score": "0.6351141", "text": "def game_over?\n return false unless @previous_piece\n\n previous_color = @previous_piece.color == :white ? :black : :white\n no_legal_moves_captures?(previous_color)\n end", "title": "" }, { "docid": "70b954a7c55269f00fdd31846807b8cc", "score": "0.6328922", "text": "def check_side_square(piece)\n possible = false\n offset = @color == 'white' ? 1 : -1\n if piece.class.name == 'Pawn' && !my_piece?(piece) && piece.history.length == 2 && piece.ep_flag\n square = piece.history.last\n coord = parse_coord(square)\n possible = parse_square([coord[0] + offset, coord[1]])\n end\n possible\n end", "title": "" }, { "docid": "e26f7595e2b417a634cf4fe5b8e5c529", "score": "0.63287705", "text": "def valid_piece_movement?(coordinates)\n row = coordinates[:row]\n column = coordinates[:column]\n @active_piece.moves.any?([row, column]) || @active_piece.captures.any?([row, column])\n end", "title": "" }, { "docid": "61d3ed27142b5720702ef562b4be3029", "score": "0.63216865", "text": "def can_move?(cordx, cordy , x_dest, y_dest)\n\t\t\n\t\tif @pieces == nil \n\t\t\tputs \"No piece at.\"\n\t\telsif x_dest == cordx && y_dest == cordy\n\t\t\tputs \"no change\"\n\t\telsif x_dest > 8 || y_dest > 8\n\t\t\t puts \"Offboard.\"\n\t\telse \n\t\t\t@pieces[cordx][cordy].can_move?(x_dest, y_dest)\n\t\tend\n\tend", "title": "" }, { "docid": "f55b4ff06b092e2cfcdfb3f67f50453f", "score": "0.6296988", "text": "def has_valid_piece?\n piece_to_move && right_piece_type? && right_piece_color?\n end", "title": "" }, { "docid": "9f2927d68d411324cd77272a8ec8b1dc", "score": "0.62969047", "text": "def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end", "title": "" }, { "docid": "bdcc3a52c693a4cc158ae50fe0a1b2b1", "score": "0.6295227", "text": "def check?(player_color)\n all_pieces = pieces\n current_king = all_pieces.select { |piece| piece.is_a?(King) && piece.color_eql?(player_color) }.first\n enemy_pieces = all_pieces.select { |piece| piece.color_opposite?(player_color) }\n enemy_pieces.any? do |piece|\n piece.valid_moves.include?(current_king.pos)\n end\n end", "title": "" }, { "docid": "a3cd124111ef447440b118fb20499478", "score": "0.6265671", "text": "def own_piece?(pos)\n return false if @board.piece_at(pos).nil?\n @color == @board.piece_at(pos).color\n end", "title": "" }, { "docid": "ab3248e307dd9ef7185968fb65a8c0cd", "score": "0.62652355", "text": "def check? color\n pieces = select_all_pieces_of(other_color(color))\n king_position = find_king_position(color)\n\n pieces.any? do |piece|\n piece.possible_moves.any? do |move|\n movement_helper?(piece.position, move, piece.color) && move == king_position\n end\n end\n end", "title": "" }, { "docid": "a365d8341a69167d6b07356bb332f79b", "score": "0.62613964", "text": "def moves_pawn(color, a, b)\n \t_moves = []\n \tif color == :white\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b + 2] if @board[a][b + 2].piece == nil \t\t\n \t\tend\n\n \t\tx, y = up(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = up_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_left(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_left(a, b)\n \t\tend\n \t\t\n \t\tx, y = up_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_right(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_right(a, b)\n \t\tend\n\n \telse\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b - 2] if @board[a][b - 2].piece == nil\n \t\tend\n\n \t\tx, y = down(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = down_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_left(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_left(a, b)\n \t\tend\n\n \t\tx, y = down_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_right(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_right(a, b)\n \t\tend\n \tend\n \treturn _moves.compact\n end", "title": "" }, { "docid": "01419bd30414fcc969b88cd1b1a264ad", "score": "0.62463474", "text": "def move_piece(move, color) \n squares = find_start_and_end(move) # [start, end]\n\n return false if @display[squares[0][0]][squares[0][1]].guest == ' '\n\n start_piece = @display[squares[0][0]][squares[0][1]].guest\n\n return false if start_piece.color != color \n\n moves = get_legal_moves(squares[0], start_piece, start_piece.poss_moves(squares[0]))\n\n\n if moves.include?(squares[1])\n\n # castling\n if start_piece.id == 'king' && start_piece.color == 'white' && squares[1] == [7, 1] \n make_move(squares[0], squares[1], start_piece)\n make_move([7, 0], [7, 2], @display[0][0].guest)\n elsif start_piece.id == 'king' && start_piece.color == 'black' && squares[1] == []\n make_move(squares[0], squares[1], start_piece)\n make_move([0, 0], [0, 2], @display[7][0].guest)\n\n # pawn -> queen upgrade\n elsif start_piece.id == 'pawn' && start_piece.color == 'white' && squares[1][0].zero?\n make_move(squares[0], squares[1], Queen.new('white'))\n elsif start_piece.id == 'pawn' && start_piece.color == 'black' && squares[1][0] == 7\n make_move(squares[0], squares[1], Queen.new('black'))\n\n else\n make_move(squares[0], squares[1], start_piece)\n end\n else\n false\n end\n end", "title": "" }, { "docid": "c6c833cf1b3af4b551e24d41495ced26", "score": "0.6240866", "text": "def generate_capture_list\r\n capture_list = []\r\n @pieces.each do |piece|\r\n if (piece.valid_moves(true).count > 0) and piece.alive\r\n capture_list << piece\r\n end\r\n end\r\n capture_list.count > 0 ? capture_list : false\r\n end", "title": "" }, { "docid": "5abba4cb91d0175e170fc172cb33a33a", "score": "0.6235105", "text": "def filter_for_self_check(pieces, moves, color)\n\t\t\tcolor = (color == \"w\") ? \"white\" : \"black\"\n\t\t\topp_color = (color == \"white\") ? \"b\" : \"w\"\n splices = []\n king = pieces.find { |p| p.name == \"king\" && p.color == color }\n return [] if king.nil? \n\n # for each move we generated go through and see if any opponent moves put color king in check\n moves.each_index do | i |\n mover = pieces.index { |p| p.position == moves[i].from }\n next if mover.nil?\n\n # is the mover the king? update the king position\n if (pieces[mover].position == king.position)\n king.position = moves[i].to\n end\n\n\t\t\t\tboard = Board.new\n\t\t\t\tboard.game = self.game\n\t\t\t\tboard.set self.fen\n\t\t\t\tboard.do_move(moves[i])\n opp_moves = board.moves(opp_color)\n\n opp_moves.each do | omove |\n if (omove.to == king.position)\n # splice out the current move & break... only 1 needs to be found\n splices << moves[i]\n break\n end\n end\n\n if (pieces[mover].position == king.position)\n king.position = moves[i].from\n end\n\n end\n\n moves.delete_if { |i|\n splices.include?(i)\n }\n\n\t\t\treturn nil if moves.length == 0\n return moves\n end", "title": "" }, { "docid": "c6c86be61894ef0672f35f54f9a889af", "score": "0.6221373", "text": "def in_check?(king)\n opposite_pieces = pieces.where(color: !king.color)\n opposite_pieces.each do |piece|\n if piece.valid_move?(king.position_x, king.position_y)\n return true\n else\n return false\n end\n end\n end", "title": "" }, { "docid": "45da895554dd0c59d27007457befc8cd", "score": "0.6217512", "text": "def valid_move?(from, to, pieces)\n # check if move is forward for plain piece (not king)\n row = Game.index_to_row(from)\n if Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if (row + 1 != Game.index_to_row(to)) and (row - 1 != Game.index_to_row(to)) \n elsif Game.is_red?(pieces[from-1])\n return false if row + 1 != Game.index_to_row(to)\n elsif Game.is_white?(pieces[from-1]) and !Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if row - 1 != Game.index_to_row(to)\n end\n map = get_possible_moves_map\n map[from].include? to\n end", "title": "" }, { "docid": "39ed85d774a78548e4b18c73b6161078", "score": "0.62135863", "text": "def check_blocking_pieces(positions) # works fucking brilliantly love it and testing in pry is so fucking great fucking love your workflow\n positions.each_with_index do |move, index| # omg this is using each perfectly, because if it doesn't return inside this helper method it'll just return what was passed to it as is that's what .each is good for - either doing some random action for each enumeration or even more ideally just returning a different value if something inside is different or returning the whole thing if not fucking incredible\n piece = @board.grid[move[0]][move[1]]\n if !piece.is_a?(NullPiece) # only get the moves before the first blocking piece is found, immediately return once/if a non NullPiece is found in the path # if the current position is not a null piece, then return this with a truncated version of the array\n piece.color == self.color ? (return positions.slice(0...index)) : (return positions.slice(0..index)) # check if the piece is of the same color or not - if it is of the same color, then don't include it in possible moves, if not of the same color, include it in the possible moves since you can capture it. Normally you use @color vs self.color but in this case it does seem to be more readable and make more sense to run self.color since you already have an attr_getter for it why not. And perfect use case for a protected method if you didn't need the color anywhere else let's see :) you might not let's do it just because protected methods are so cool # GOD THIS SHIT WORKS SO FUCKING GOOD AHHHHHHH\n end\n end\nend", "title": "" }, { "docid": "52aedbc272dff11d61ef6ec88ee44822", "score": "0.61990637", "text": "def can_move_to?(position, color)\n @grid.each do |row|\n row.each do |square|\n if (square != nil && square.color == color &&\n square.moves.include?(position))\n return true\n end\n end\n end\n return false\n end", "title": "" }, { "docid": "347d75b5f4a3adabeb3ae941c5291c06", "score": "0.61895055", "text": "def in_check?(color)\n if color == :w\n players_pieces, opposing_pieces = white_pieces, black_pieces\n else\n players_pieces, opposing_pieces = black_pieces, white_pieces\n end\n\n opposing_pieces.each do |piece|\n return true if piece.moves.include?(king_position(players_pieces))\n end\n false\n end", "title": "" }, { "docid": "639bd054a44fdeec043bb6c079cf9c56", "score": "0.6183998", "text": "def valid_en_passant_move?(color, from_row, to_column)\n possible_pawn = @state[from_row][to_column]\n\n possible_pawn.class == Pawn && possible_pawn.color != color &&\n possible_pawn.allow_en_passant == true\n end", "title": "" }, { "docid": "0cedfeda6b0528a688a9c6fe6f031acf", "score": "0.6177431", "text": "def valid_black_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if black_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x-1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y+1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y-1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n return false\n end", "title": "" }, { "docid": "9fd839cd39bfe16c6109b86683242e5f", "score": "0.6171196", "text": "def en_passant?(x0, y0, x1, y1)\r\n # Check if player's pawn is at the correct vertical square (only possibilities are y = 4 for white, y = 5 for black).\r\n if self.color == \"white\" && y0 == 4\r\n # Check for an enemy pawn to either side of the player's pawn that has only made one move.\r\n black_pawn = Piece.all.where(:game_id => game.id, :type => \"Pawn\", :color => \"black\", :x_position => x0 + 1, :y_position => y0).first\r\n black_pawn2 = Piece.all.where(:game_id => game.id, :type => \"Pawn\", :color => \"black\", :x_position => x0 - 1, :y_position => y0).first\r\n # 1) Check if the enemy pawn has moved two vertical squares in its last turn.\r\n # 2) Check if the diagonal movement is 1 space.\r\n # 3) Check that there is no piece on the destination square.\r\n # 4) Check that the player's pawn's destination is in the same column as the enemy pawn.\r\n # ****=============****\r\n # 5) Check that the player's pawn was already in its current starting position in the turn before the enemy pawn has made its starting two square advance.\r\n # ****=============****\r\n # black_pawn.moves.move_count cannot always be used here, because in a valid case moves will have not been created yet for this piece (before the black pawn's first move, black_pawn.moves is an empty array).\r\n if !black_pawn.nil? && black_pawn.moves.count <= 1 && (y1 - y0).abs == (x1 - x0).abs && (y1 - y0).abs == 1 && destination_piece.nil? && x1 == black_pawn.x_position\r\n # && self.old_y == self.new_y\r\n Move.create(game_id: game.id, piece_id: black_pawn.id, old_x: @x0 + 1, old_y: @y0, captured_piece: true)\r\n black_pawn.update_attributes(captured: true)\r\n # binding.pry\r\n return true\r\n elsif !black_pawn2.nil? && black_pawn2.moves.count <= 1 && (y1 - y0).abs == (x1 - x0).abs && (y1 - y0).abs == 1 && destination_piece.nil? && x1 == black_pawn2.x_position\r\n Move.create(game_id: game.id, piece_id: black_pawn2.id, old_x: @x0 - 1, old_y: @y0, captured_piece: true)\r\n black_pawn2.update_attributes(captured: true)\r\n # binding.pry\r\n return true\r\n end\r\n elsif self.color == \"black\" && y0 == 5\r\n white_pawn = Piece.all.where(:game_id => game.id, :type => \"Pawn\", :color => \"white\", :x_position => x0 + 1, :y_position => y0).first\r\n white_pawn2 = Piece.all.where(:game_id => game.id, :type => \"Pawn\", :color => \"white\", :x_position => x0 - 1, :y_position => y0).first\r\n if !white_pawn.nil? && white_pawn.moves.count <= 1 && (y1 - y0).abs == (x1 - x0).abs && (y1 - y0).abs == 1 && destination_piece.nil? && x1 == white_pawn.x_position\r\n Move.create(game_id: game.id, piece_id: white_pawn.id, old_x: @x0 + 1, old_y: @y0, captured_piece: true)\r\n white_pawn.update_attributes(captured: true)\r\n # binding.pry\r\n return true\r\n elsif !white_pawn2.nil? && white_pawn2.moves.count <= 1 && (y1 - y0).abs == (x1 - x0).abs && (y1 - y0).abs == 1 && destination_piece.nil? && x1 == white_pawn2.x_position\r\n Move.create(game_id: game.id, piece_id: white_pawn2.id, old_x: @x0 - 1, old_y: @y0, captured_piece: true)\r\n white_pawn2.update_attributes(captured: true)\r\n # binding.pry\r\n return true\r\n end\r\n else\r\n return false\r\n end\r\n\r\n # *** ALTERNATIVELY, we could have the player whose pawn is capturable with the en passant move have a flag set on their own pawn after a check for an adjacent pawn. ***\r\n end", "title": "" }, { "docid": "a240bb672b7382495786e099303f5fff", "score": "0.61635655", "text": "def test_single_capture\n\t\tmygame=CheckersGame.new\n\t\tmygame.move('c3','d4').move('f6','e5')\n\t\t# +---+---+---+---+---+---+---+---+\n\t\t#\th | | r | | r | | r | | r | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\tg | r | | r | | r | | r | | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\tf | | r | | r | | . | | r | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\te | . | | . | | r | | . | | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\td | | . | | b | | . | | . | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\tc | b | | . | | b | | b | | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\tb | | b | | b | | b | | b | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\ta | b | | b | | b | | b | | \n\t\t#\t +---+---+---+---+---+---+---+---+\n\t\t#\t\t1 2 3 4 5 6 7 8 \n\t\tmygame.move('d4','f6')\n\t\t#assert_equal(CheckersGame.new.remove('c','3').place('f','6',CheckersGame::Square::BLACK,false).toggle_turn,mygame)\n\t\t\n\tend", "title": "" }, { "docid": "477c85f31d2016d29826621f528e79db", "score": "0.6157054", "text": "def update_capture_coord\n return true unless @piece_moving and @piece_moving.kind_of?(Pawn)\n if @piece_moving.is_en_passant_capture( from_coord, to_coord - from_coord , @board)\n self[:capture_coord] = (Position.new(to_coord) + [ - Sides[@piece_moving.side].advance_direction, 0]).to_s\n end\n end", "title": "" }, { "docid": "ac96f2fc628ef9b26d734495daa1abe9", "score": "0.6151614", "text": "def any_possible_moves?(color, check)\n \tsame_team_spaces = (color == :white ? team_pieces(:white) : team_pieces(:black))\n \tsame_team_spaces.each do |space|\n \t\tmoves = piece_possible_moves(space.piece.color, x = nil, y = nil, space.value, check)\n \t\tnext if moves.nil?\n \t\tmoves.compact!\n \t\tmoves.map! do |move|\n \t\t\tnext if move.all?{|x| x.nil?}\n \t\t\tx, y = move\n \t\t\tif can_move_piece(space.value, x, y, space.piece.color, check)\n \t\t\t\treturn true\n \t\t\tend\n \t\tend\n \tend\n \treturn false\n end", "title": "" }, { "docid": "fc65fd3fb0a14f0996aaebcd15ea1ba8", "score": "0.6144595", "text": "def opposing_piece?(rank, file, data)\n return unless valid_location?(rank, file)\n\n piece = data[rank][file]\n piece && piece.color != color\n end", "title": "" }, { "docid": "d72c02927e91010a4b5e5b6f65742007", "score": "0.61420184", "text": "def black_turn\n #starting coord\n stacoord = \"\"\n #destination coord\n descoord = \"\"\n #boolean coordinate format\n cordform = false\n #coordinate array\n crarr = []\n #dest coordinate array\n dsarr = []\n x = y = 0\n\n #CHOOSE STARTING PIECE\n until cordform\n puts \"Choose a valid black starting piece, format: 'Letter','Number' - no quotes or commas\"\n stacoord = gets.chomp\n stacoord.upcase!\n if val_coord(stacoord)\n crarr = convert_coord(stacoord)\n x = crarr[0]; y = crarr[1]\n if !black_owned(x,y)\n puts \"Please choose one of your pieces\"\n else\n cordform = true\n end\n end\n end\n\n #If pawn is chosen\n if @b[x][y] == @BP\n puts \"This is a black pawn!\"\n puts \"Enter the target destination, or type 'B' to go back to coordinate selection\"\n descoord = gets.chomp\n descoord.upcase!\n if descoord == \"B\"\n black_turn\n return\n end\n if !val_coord(descoord)\n black_turn\n return\n else\n dsarr = convert_coord(descoord)\n if valid_black_pawn(crarr,dsarr)\n draw_board\n else\n puts \"Move is invalid\"\n black_turn\n return\n end\n end\n end\n\n #If Bishop is chosen\n if @b[x][y] == @BB\n puts \"This is a black bishop!\"\n puts \"Enter the target destination, or type 'B' to go back to coordinate selection\"\n descoord = gets.chomp\n descoord.upcase!\n if descoord == \"B\"\n black_turn\n return\n end\n if !val_coord(descoord)\n black_turn\n return\n else\n dsarr = convert_coord(descoord)\n if valid_black_bishop(crarr,dsarr)\n draw_board\n puts \"Bishop moved!\"\n else\n puts \"Move is invalid\"\n black_turn\n return\n end\n end\n end\n\n #If Rook is chosen\n if @b[x][y] == @BR\n puts \"This is a black rook!\"\n puts \"Enter the target destination, or type 'B' to go back to coordinate selection\"\n descoord = gets.chomp\n descoord.upcase!\n if descoord == \"B\"\n black_turn\n return\n end\n if !val_coord(descoord)\n black_turn\n return\n else\n dsarr = convert_coord(descoord)\n if valid_black_rook(crarr,dsarr)\n draw_board\n puts \"Rook moved!\"\n else\n puts \"Move is invalid\"\n black_turn\n return\n end\n end\n end\n\n #If Knight is chosen\n if @b[x][y] == @BK\n puts \"This is a black knight!\"\n puts \"Enter the target destination, or type 'B' to go back to coordinate selection\"\n descoord = gets.chomp\n descoord.upcase!\n if descoord == \"B\"\n black_turn\n return\n end\n if !val_coord(descoord)\n black_turn\n return\n else\n dsarr = convert_coord(descoord)\n if valid_black_knight(crarr,dsarr)\n draw_board\n puts \"Knight moved!\"\n else\n puts \"Move is invalid\"\n black_turn\n return\n end\n end\n end\n\n #If Queen is chosen\n if @b[x][y] == @BQ\n puts \"This is a black queen!\"\n puts \"Enter the target destination, or type 'B' to go back to coordinate selection\"\n descoord = gets.chomp\n descoord.upcase!\n if descoord == \"B\"\n black_turn\n return\n end\n if !val_coord(descoord)\n black_turn\n return\n else\n dsarr = convert_coord(descoord)\n if valid_black_queen(crarr,dsarr)\n draw_board\n puts \"Queen moved!\"\n else\n puts \"Move is invalid\"\n black_turn\n return\n end\n end\n end\n\n #If King is chosen\n if @b[x][y] == @BKg\n puts \"This is the black king!\"\n puts \"Enter the target destination, or type 'B' to go back to coordinate selection\"\n descoord = gets.chomp\n descoord.upcase!\n if descoord == \"B\"\n black_turn\n return\n end\n if !val_coord(descoord)\n black_turn\n return\n else\n dsarr = convert_coord(descoord)\n if valid_black_king(crarr,dsarr)\n draw_board\n puts \"King moved!\"\n else\n puts \"Move is invalid\"\n black_turn\n return\n end\n end\n end\n\n end", "title": "" }, { "docid": "77fe6f252b24a13eb45c40b9912d8445", "score": "0.6136019", "text": "def over?\n @board.pieces_coords(@current_color).all? do |coords|\n safe_moves(coords).empty?\n end\n end", "title": "" }, { "docid": "5c96868cb9c345d0cfd6af1d3d99e018", "score": "0.613152", "text": "def in_check?(board)\r\n\t\tenemy_color = @color == \"white\" ? \"black\" : \"white\"\r\n\t\tenemy_pieces = get_pieces(enemy_color, board) \r\n\r\n threatening_pieces = enemy_pieces.find_all {|enemy| enemy.legal_move?(@row, @col, board)}\r\n\r\n threatening_pieces.each do |piece|\r\n puts \"Enemy: #{piece.class.name} [#{piece.row},#{piece.col}]\"\r\n end\r\n\r\n threatening_pieces.empty? ? false : threatening_pieces\r\n\tend", "title": "" }, { "docid": "7339aa775766cde66392dfb55a7b3e75", "score": "0.61279124", "text": "def inedible?(x,y) # self and another piece share same color\n #p \"#{self.color} #{self.board.grid[x][y].color}\"\n self.color == self.board.grid[x][y].color\n end", "title": "" }, { "docid": "14bebbab4d1e19510337e0db26e57384", "score": "0.61268526", "text": "def can_move_piece(start, x, y, color, check)\n\t\ta, b = start\n\t\tif @board[x][y].piece != nil\n\t\t\torgin = @board[x][y].piece\n\t\telse \n\t\t\torgin = nil\n\t\tend\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\tif cause_check(color, check) == true\n\t\t\t@board[a][b].piece = @board[x][y].piece\n\t\t\t@board[x][y].piece = orgin\n\t\t\treturn false\n\t\telse\n\t\t\t@board[a][b].piece = @board[x][y].piece\n\t\t\t@board[x][y].piece = orgin\n\t\t\treturn true\n\t\tend\n\tend", "title": "" }, { "docid": "4b518c6e2f33d74f42161d450b36505a", "score": "0.61098343", "text": "def capture_moves\n direction = get_direction\n moves = []\n x, y = @pos\n x += direction\n y += 1\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end \n y -= 2\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end\n moves\n end", "title": "" }, { "docid": "f49ed6da195930a551ffca71b5d4acf4", "score": "0.60833573", "text": "def en_passant_capture\n return nil if move.castle\n\n move.destination[0] + origin[1] if !board.at(move.destination) && move.capture\n end", "title": "" }, { "docid": "fa14bef2766ebce2c6452a8f9adfcc46", "score": "0.60786784", "text": "def valid_white_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if white_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x-1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y+1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y-1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n return false\n end", "title": "" }, { "docid": "34ece800c211116d205ae73a2442636c", "score": "0.6064279", "text": "def check?(from, to, player)\n\t\tpiece = @grid[from[0]][from[1]]\n\t\treturn true if piece.nil?\n\t\treturn true if piece.color != player\n\n\t\tvalid_moves = piece.get_available_moves\n\n\t\treturn true unless valid_moves.include? to \n\n\t\tfalse\n\tend", "title": "" }, { "docid": "29ef787584efe6954801871a644101e8", "score": "0.60631025", "text": "def gen_bishop_moves(color, piece=:bishop)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north-east\n if (dirs & 0x1) != 0x1\n to = from+k*9\n if i+k>7 || j+k>7 || comrades.set?(to)\n # no further north-east moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south-west\n if (dirs & 0x2) != 0x2\n to = from-k*9\n if i<k || j<k || comrades.set?(to)\n # no further south-west moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further south-west moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving north-west\n if (dirs & 0x4) != 0x4\n to = from+k*7\n if i+k>7 || j<k || comrades.set?(to)\n # no further north-west moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north-west moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end \n \n # try moving south-east\n if (dirs & 0x8) != 0x8\n to = from-k*7\n if i<k || j+k>7 || comrades.set?(to)\n # no further south-east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further south-east moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end\n \n end\n end \n moves\n end", "title": "" }, { "docid": "f516dab521a766c3664a035718c0a143", "score": "0.60555285", "text": "def in_check?(color)\n enemy_color = color == :white ? :black : :white\n enemy_pieces = @grid.flatten.select { |piece| piece.color == enemy_color }\n enemy_next_avail_moves = []\n enemy_pieces.each { |piece| enemy_next_avail_moves += piece.avail_moves }\n\n my_king = find_king(color)\n enemy_next_avail_moves.include?(my_king)\n end", "title": "" }, { "docid": "401a1a25d8029bb4fbbda6b06351b5c4", "score": "0.6051776", "text": "def is_my_piece?(pos, color)\n find_piece(pos).color == color\n end", "title": "" }, { "docid": "b131c9491386001074a86cf054df54cd", "score": "0.6043995", "text": "def legal_move?(input)\n return false if @board.pieces[input[0]].nil?\n return false if @board.pieces[input[0]].color == other_player.color\n\n # return false if @board.pieces.include?(input[1])\n # return false if @board.pieces[input[1]].color == player.color\n true\n end", "title": "" }, { "docid": "d1c11a6ef7d302b05f3075b7a407f815", "score": "0.60343724", "text": "def normal_moves\n direction = NORMAL_MOVES[self.color]\n \n [check_validity(direction)]\n \n if pos_valid \n item_at_pos = @board.get_piece(current_row,current_col)\n \n if item_at_pos.nil? || item_at_pos.color != self.color\n [current_row, current_col]\n end\n end\n \nend", "title": "" }, { "docid": "01960c4273c2e77e0810a36f964eb8d0", "score": "0.60291547", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "title": "" }, { "docid": "c39d1c4accb534edd93c9707fcc34dae", "score": "0.6025878", "text": "def castling_check_squares(checks)\n i = 0\n index = colour == 'White' ? 4 : 60\n checks.times do\n index -= 1 if checks == 3\n index += 1 if checks == 2\n break if board[index].current_piece != ' '\n\n i += 1\n end\n i == checks ? castling_move(checks) : false\n end", "title": "" }, { "docid": "79e9f6ad0db2f7aeda97ff9cd99c1c0d", "score": "0.6008545", "text": "def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end", "title": "" }, { "docid": "b03a5b0cdd9c117bb05a5b8f6d886f32", "score": "0.60072094", "text": "def in_check?(color)\n own_king_pos = []\n (0...grid.length).each do |row|\n (0...grid.length).each do |col|\n if grid[row][col].color == :color && grid[row][col].is_a?(King)\n own_king_pos = grid[row][col].pos\n puts \"King is at #{own_king_pos}\"\n break\n end\n end\n end\n opponent_pieces = []\n (0...grid.length).each do |row|\n (0...grid.length).each do |col|\n if color == :white \n if grid[row][col].color == :black\n opponent_pieces << grid[row][col]\n end\n elsif color == :black\n if grid[row][col].color == :white\n opponent_pieces << grid[row][col]\n end\n end\n end\n end\n opponent_pieces.any? { |piece| piece.valid_moves.include?(own_king_pos) }\n end", "title": "" }, { "docid": "56d21c452dfa85e561506cedc6d778f5", "score": "0.60040367", "text": "def in_check?(current_color)\n check = []\n king = pieces.find_by(type: 'King', color: current_color)\n opponent_pieces = pieces.where.not(color: current_color)\n\n opponent_pieces.each do |opponent_piece|\n if opponent_piece.type != \"King\" && opponent_piece.status == 'active'\n if opponent_piece.valid_move?(king.x_coordinates, king.y_coordinates)\n check << opponent_piece\n end\n # A new valid_move method for king (king_valid_move_for_in_check?) is used in this iteration\n # in order to prevent executing can_castle?, which would lead\n # to executing obstructed?, which would throw a runtime error\n # when checking the path between two opposite kings\n elsif opponent_piece.type == \"King\"\n if opponent_piece.king_valid_move_for_in_check?(king.x_coordinates, king.y_coordinates)\n check << opponent_piece\n end\n end # End opponent_piece valid_move! check\n end # End opponent_pieces block for determining if game is in_check\n\n # If check variable has more than 0 items the game is in check otherwise is not in check\n if check.count > 0\n true\n else\n false\n end\n\n end", "title": "" }, { "docid": "5a224751744b0043837bb33ff529ccf9", "score": "0.59989226", "text": "def possible_moves(starting_position, actual_piece, turn = @turn, board = @board)\n row = starting_position[0]\n column = starting_position[1]\n potential_moves = []\n\n active_pieces = []\n enemy_pieces = []\n\n if turn == 1\n active_pieces = @w_pieces\n enemy_pieces = @b_pieces\n else\n active_pieces = @b_pieces\n enemy_pieces = @w_pieces\n end\n\n # moves available for white pawns\n if actual_piece == $w_pawn\n # if the white pawn is in its original spot, then it can move two spots or one spot\n return if row == 7\n\n if row == 1\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n potential_moves << [row+2, column] if board[row+2][column] == ' '\n else\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n end\n\n # can take black pieces, but only if they are available diagonally\n potential_moves << [row+1, column+1] if @b_pieces.include?(board[row+1][column+1])\n potential_moves << [row+1, column-1] if @b_pieces.include?(board[row+1][column-1])\n\n # can take black pawns under special en-passant rule\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n # it must be empty in order for us to do en-passant (otherwise the pawn can just take)\n if @board[passant_row+1][passant_col] = ' '\n potential_moves << [passant_row+1, passant_col]\n end\n end\n end\n end \n\n # moves available for black pawns\n if actual_piece == $b_pawn\n # if the black pawn is in its original spot, then it can move two spots or one spot\n return if row == 0\n\n if row == 6\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n potential_moves << [row-2, column] if board[row-2][column] == ' '\n else\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n end\n\n # can take white pieces\n potential_moves << [row-1, column+1] if @b_pieces.include?(board[row-1][column+1])\n potential_moves << [row-1, column-1] if @b_pieces.include?(board[row-1][column-1])\n\n # can take white pawns under special en-passant rule\n\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n if @board[passant_row-1][passant_col] = ' '\n potential_moves << [passant_row-1, passant_col]\n end\n end\n end\n end\n\n # moves available for rooks\n if actual_piece == $w_rook || actual_piece == $b_rook\n\n i_row = row\n i_col = column\n\n # returns all potential moves north of the starting position\n until i_row+1 == 8 || active_pieces.include?(board[i_row+1][i_col])\n if enemy_pieces.include?(board[i_row+1][i_col])\n potential_moves << [i_row+1,i_col]\n break\n else\n potential_moves << [i_row+1,i_col]\n end\n i_row += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moves south of the starting position\n until active_pieces.include?(board[i_row-1][i_col]) || i_row-1 == -1\n if enemy_pieces.include?(board[i_row-1][i_col])\n potential_moves << [i_row-1,i_col]\n break\n else\n potential_moves << [i_row-1,i_col]\n end\n i_row -= 1\n end\n\n i_row = row\n i_col = column\n \n\n # returns all potential moves right of the starting position\n until active_pieces.include?(board[i_row][i_col+1]) || i_col+1 == 8\n if enemy_pieces.include?(board[i_row][i_col+1])\n potential_moves << [i_row,i_col+1]\n break\n else\n potential_moves << [i_row,i_col+1]\n end\n i_col += 1\n end\n\n i_row = row\n i_col = column\n \n # returns all potential moves left of the starting position\n until active_pieces.include?(board[i_row][i_col-1]) || i_col-1 == -1\n if enemy_pieces.include?(board[i_row][i_col-1])\n potential_moves << [i_row,i_col-1]\n break\n else\n potential_moves << [i_row,i_col-1]\n end\n i_col -= 1\n end\n\n i_row = row\n i_col = column\n\n end\n\n # moves available for knights\n if actual_piece == $w_knig || actual_piece == $b_knig\n\n # returns all potential moves\n potential_moves << [row+2, column+1]\n potential_moves << [row+1, column+2]\n potential_moves << [row-1, column+2]\n potential_moves << [row-2, column+1]\n potential_moves << [row-2, column-1]\n potential_moves << [row-1, column-2]\n potential_moves << [row+1, column-2]\n potential_moves << [row+2, column-1]\n\n end\n\n # moves available for bishops\n if actual_piece == $w_bish || actual_piece == $b_bish\n\n i_row = row\n i_col = column\n\n # returns all potential moving north-east of the starting position\n\n until i_row+1 == 8 || i_col+1 == 8 || active_pieces.include?(board[i_row+1][i_col+1])\n if enemy_pieces.include?(board[i_row+1][i_col+1])\n potential_moves << [i_row+1,i_col+1]\n break\n else\n potential_moves << [i_row+1,i_col+1]\n end\n i_row += 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-east of the starting position\n until i_row-1 == -1 || i_col+1 ==8 || active_pieces.include?(board[i_row-1][i_col+1])\n if enemy_pieces.include?(board[i_row-1][i_col+1])\n potential_moves << [i_row-1,i_col+1]\n break\n else\n potential_moves << [i_row-1,i_col+1]\n end\n i_row -= 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-west of the starting position\n until i_row-1 == -1 || i_col-1 == -1 || active_pieces.include?(board[i_row-1][i_col-1])\n if enemy_pieces.include?(board[i_row-1][i_col-1])\n potential_moves << [i_row-1,i_col-1]\n break\n else\n potential_moves << [i_row-1,i_col-1]\n end\n i_row -= 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n \n # returns all potential moving north-east of the starting position\n until i_row+1 == 8 || i_col-1 == -1 || active_pieces.include?(board[i_row+1][i_col-1])\n if enemy_pieces.include?(board[i_row+1][i_col-1])\n potential_moves << [i_row+1,i_col-1]\n break\n else\n potential_moves << [i_row+1,i_col-1]\n end\n i_row += 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n\n end\n\n # moves available for queens\n if actual_piece == $w_quee || actual_piece == $b_quee\n if actual_piece == $w_quee\n potential_moves.concat(possible_moves(starting_position, $w_rook, turn = 1))\n potential_moves.concat(possible_moves(starting_position, $w_bish, turn = 1))\n end\n if actual_piece == $b_quee\n potential_moves.concat(possible_moves(starting_position, $b_rook, turn = 2))\n potential_moves.concat(possible_moves(starting_position, $b_bish, turn = 2))\n end\n end\n\n # moves available for kings\n if actual_piece == $w_king || actual_piece == $b_king\n i_row = row\n i_col = column\n\n potential_moves << [i_row+1, i_col]\n potential_moves << [i_row+1, i_col+1]\n potential_moves << [i_row, i_col+1]\n potential_moves << [i_row-1, i_col-1]\n potential_moves << [i_row-1, i_col]\n potential_moves << [i_row-1, i_col+1]\n potential_moves << [i_row, i_col-1]\n potential_moves << [i_row+1, i_col-1]\n\n # castling conditions\n # The king does not move over a square that is attacked by an enemy piece during the castling move, i.e., when castling, there may not be an enemy piece that can move (in case of pawns: by diagonal movement) to a square that is moved over by the king.\n\n # The king cannot be in check if they are trying to castle\n if !@check_condition\n if actual_piece == $w_king\n # checks for left rook potential\n if board[0][1] == ' ' && board[0][2] == ' ' && board[0][3] == ' '\n binding.pry\n if @w_king_move == \"not moved\" && @w_rook_left == \"not moved\"\n if !enemy_positions.include?([0, 3])\n potential_moves << [0, 2]\n end\n end\n #checks for right rook potential\n elsif board[0][5] == ' ' && board[0][6] == ' '\n if @w_king_move == \"not moved\" && @w_rook_right == \"not moved\"\n if !enemy_positions.include?([0, 5])\n potential_moves << [0, 6]\n end\n end\n end\n end\n if actual_piece == $b_king\n # checks for left rook potential\n if board[7][1] == ' ' && board[7][2] == ' ' && board[7][3] == ' '\n if @b_king_move == \"not moved\" && @b_rook_left == \"not moved\"\n if !enemy_positions.include?([7, 3])\n potential_moves << [7, 2]\n end \n end\n #checks for right rook potential\n elsif board[7][5] == ' ' && board[7][6] == ' '\n if @b_king_move == \"not moved\" && @b_rook_right == \"not moved\"\n if !enemy_positions.include?([7, 5])\n potential_moves << [7, 6] \n end\n end\n end\n end\n end\n\n end\n\n potential_moves = potential_moves.select { |pos| valid_move?(pos, turn)}\n\n potential_moves\n\n end", "title": "" }, { "docid": "ef282679ef4603614d4c7d32187c04bb", "score": "0.5985088", "text": "def direction_of_white_and_black_pawns(to_y)\n return true if color == 'white' && to_y > y_position\n return true if color == 'black' && to_y < y_position\n false\n end", "title": "" }, { "docid": "faec33385640ec259e9b506db9cdb62b", "score": "0.59761894", "text": "def can_block_threat?(friendly_pieces, threatening_pieces, board)\r\n return false if threatening_pieces == false || threatening_pieces.length > 1\r\n enemy_piece = threatening_pieces.first\r\n enemy_row = enemy_piece.row\r\n enemy_col = enemy_piece.col\r\n\r\n if in_between = enemy_piece.get_in_between(@row, @col, board)\r\n puts \"__inside can_block_threat__\"\r\n p in_between\r\n\r\n friendly_pieces.each do |friend|\r\n in_between.each do |square|\r\n to_row, to_col = square[0], square[1]\r\n if friend.valid_move?(to_row, to_col, board, @color)\r\n puts \"#{friend.class.name} can block at: [#{to_row},#{to_col}]\"\r\n return true\r\n end\r\n end\r\n end\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "b1228f7baa23f0d7fe477d8f6cc30b28", "score": "0.59745944", "text": "def valid_move?(to_row, to_col, board, color)\r\n return false if super == false\r\n return legal_move?(to_row, to_col, board) && move_not_in_check?(@row, @col, to_row, to_col, board)\r\n\tend", "title": "" }, { "docid": "9c010f8715ffaaee05116571bc9f9ec0", "score": "0.59635985", "text": "def black_king_capturable?\n black_king = black_pieces.select{|p| p.is_a?(King)}.first\n if black_king\n capturable = false\n black_king_coords = find_piece(black_king)\n white_pieces.each{|p| capturable ||= p.baseline_moves_for_board(self).include?(black_king_coords)}\n return capturable\n else\n return false\n end\n end", "title": "" }, { "docid": "af9442e0f1f289e224a5454f1142c93e", "score": "0.5958877", "text": "def check_colour(move_index)\n sum = colour == 'White' ? 4 : 60\n sum -= move_index\n sum = sum.abs\n return true if sum == 2\n\n false\n end", "title": "" }, { "docid": "915ff942bb92bd9d03f83339d63bf978", "score": "0.5954469", "text": "def valid_black_pawn(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n pawncross = \"\"\n\n return false if black_owned(x1,y1)\n\n if x1 == x && y1 == y-1 && @b[x1][y1] == \" \"\n @b[x][y] = \" \"\n @b[x1][y1] = @BP\n if y1 == 0\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @BK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @BQ\n end\n end\n return true\n elsif x1 == x && y1 == y-2 && y == 6 && @b[x1][y1] == \" \" && @b[x][y-1] == \" \"\n @b[x][y] = \" \"\n @b[x1][y1] = @BP\n return true\n elsif x1 == x-1 && y1 == y-1 && white_owned(x1,y1)\n @white_piece.push(@b[x1][y1])\n @b[x1][y1] = @WP\n @b[x][y] = \" \"\n if y1 == 0\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @BK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @BQ\n end\n end\n return true\n elsif x1 == x+1 && y1 == y-1 && white_owned(x1,y1)\n @white_piece.push(@b[x1][y1])\n @b[x1][y1] = @BP\n @b[x][y] = \" \"\n if y1 == 0\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @BK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @BQ\n end\n end\n return true\n end\n return false\n end", "title": "" }, { "docid": "bef95700d60bbbe704fa59ea6e34dd87", "score": "0.5947006", "text": "def special_pawn_rules(moved_piece, from_row, to_column)\n if en_passant_allowed?(moved_piece, from_row)\n moved_piece.allow_en_passant = true\n end\n\n if valid_en_passant_move?(moved_piece.color, from_row, to_column)\n @state[from_row][to_column] = nil\n end\n\n if promotion?(moved_piece)\n moved_piece.can_promote = true\n end\n\n moved_piece.moved = true\n end", "title": "" }, { "docid": "922a53cf74bef161308af56c78a71a42", "score": "0.5944807", "text": "def check_move? piece, origin, dest\n real_nodes = stub_nodes\n\n apply_move(piece, origin, dest)\n dest_node = node_at(dest)\n check = king_in_check?(piece.color)\n @nodes = real_nodes\n return check\n end", "title": "" }, { "docid": "0e364cb1427a29e911180d0b5b4ba871", "score": "0.5941212", "text": "def opponent_in_check(attacking_colour)\n attack_pieces = []\n if attacking_colour == \"BLACK\"\n king_under_attack = @W_K\n attack_pieces = @black_pieces\n elsif attacking_colour == \"WHITE\"\n king_under_attack = @B_K\n attack_pieces = @white_pieces\n else\n print \"ERROR\"\n end\n\n attack_pieces.each do |piece|\n moves = allowed_moves(piece)\n moves.select! { |move| move[1] != piece.position[1] } if piece.instance_of?(Pawn)\n if moves&.length.positive? && moves.include?(king_under_attack.position)\n king_under_attack.now_in_check\n return true\n end\n end\n king_under_attack.out_of_check\n false\n end", "title": "" }, { "docid": "3bda42a2da3def82a34dda64602d2bf3", "score": "0.59404784", "text": "def piece_sensing\n # iterate through each piece on the board\n board.each do |origin_piece|\n\n # Only consider origin pieces which exist\n if !!origin_piece\n\n # clear the piece's sensing data before populating\n origin_piece.clear_possible_moves\n origin_piece.clear_pieces_in_range\n\n # iterate through each potential direction of movement\n origin_piece.controlled_squares.each do |direction_of_movement|\n\n # iterate through coordinates moving away from the piece\n direction_of_movement.each do |test_coords|\n if ( test_coords &&\n board.in_bounds?(test_coords[0],test_coords[1]) )\n\n # set row and column variables for convenience and clarity\n test_row = test_coords[0]\n test_col = test_coords[1]\n\n # Call the possible move detection method\n if possible_move?(origin_piece,test_row,test_col)\n move_string = indices_to_chess_coords(test_row,test_col)\n origin_piece.add_possible_move(move_string)\n end\n\n # Call the piece detection method and break if it succeeds;\n # Once a piece is found, no more moves in that direction are valid\n if piece_in_range?(origin_piece, test_row, test_col)\n # The string to add to pieces in range\n piece_string = find_piece_string(test_row,test_col)\n\n # Add the piece to the origin_pieces pieces in range\n origin_piece.add_piece_in_range(piece_string)\n break\n end\n end\n end\n end\n end\n end\n check_for_check(current_player)\n end", "title": "" }, { "docid": "e4d22d48c5152d5afae6e65d5af20ad1", "score": "0.59345293", "text": "def move_into_check?(end_pos)\n dup_board = board.dup\n\n dup_board.move_piece(pos, end_pos)\n\n if dup_board.in_check?(color)\n true\n else\n false\n end\n end", "title": "" }, { "docid": "f38b3db117128d753d7a8f6d48935ae8", "score": "0.5933228", "text": "def place(piece, x, y, options = {})\n if piece.on_board && !piece.x.nil? && !piece.y.nil?\n puts \"Piece #{piece} is already on the board\"\n return true\n end\n\n if options[:orientation]\n until piece.orientation == options[:orientation] do\n piece.rotate!\n end\n end\n\n if (piece.width-1) + x > DEFAULT_WIDTH || (piece.height-1) + y > DEFAULT_WIDTH\n puts \"Can't place piece #{piece} at #{x}, #{y} over the edge\"\n\n return false\n end\n\n covered_cells = []\n piece.shape.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n if !cell(col_i+x, row_i+y).empty? && !col.nil? && !col == \" \"\n covered_cells << cell(col_i+x, row_i+y)\n end\n end\n end\n\n if covered_cells.any?\n puts \"Can't place piece #{piece} at #{x}, #{y} on another piece\"\n pp covered_cells\n return false\n end\n\n piece.x = x\n piece.y = y\n piece.on_board = true\n\n piece.shape.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n cell(col_i+x, row_i+y).content = col if col != ' '\n cell(col_i+x, row_i+y).piece = piece if col != ' '\n end\n end\n\n true\n end", "title": "" }, { "docid": "47fee53ae20fec75d0c0b6612cde874b", "score": "0.5930535", "text": "def viable_finish(color, x, y, start, check)\n\t\treturn false if (0..7).include?(x) == false\n\t\treturn false if (0..7).include?(y) == false\n\t\tif piece_possible_moves(color, x, y, start, check).include?([x, y]) != true && piece_possible_moves(color, x, y, start, check).include?([[x, y]]) != true\n\t\t\treturn false\n\t\tend\n\t\tcan_move_piece(start, x, y, color, check) == true ? true : (print \"This would cause CHECK! \"; return false)\n\tend", "title": "" }, { "docid": "b63481056603c8ffed91fa24969b77d6", "score": "0.5929926", "text": "def board_status_legal(square, capture)\r\n if check?(square, capture)\r\n return :illegal_causes_check \r\n end\r\n true\r\n end", "title": "" }, { "docid": "a989dbc7c147d16d7e1f80431d54b06e", "score": "0.5928567", "text": "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "title": "" }, { "docid": "c1778ea428a364e74515af2a14bd20c3", "score": "0.59019727", "text": "def move_into_check?(end_pos)\n dup = board.dup\n dup.move_piece(pos, end_pos)\n dup.in_check?(color)\n end", "title": "" }, { "docid": "8d25c946af742fd13dee4ef43550754a", "score": "0.59017086", "text": "def check?(color)\n # Find the position of that player's king.\n king_pos = @board.grid.flatten.find{|square| square.piece.class == King && square.piece.color == color}\n # Find the positions of all of the opponent's pieces.\n current_positions = @board.grid.flatten.select { |square| !square.piece.nil? && square.piece.color != color }\n # Create a move list that contains all possible moves of the current player.\n total_move_list = []\n current_positions.each do |square|\n curr_piece = square.piece\n move_list = curr_piece.list_moves(square)\n total_move_list += move_list\n end\n # Check whether the position of the king is in the total move list.\n return total_move_list.include?(king_pos)\n end", "title": "" }, { "docid": "0862587de46b08162eeb771797a67373", "score": "0.5901304", "text": "def end_conditions?(color)\n color_pieces = @all_pieces.select { |piece| piece.color == color }\n #keep this line for debugging purposes, prints current color's piece list and move list\n #color_pieces.each { |piece| puts \"#{piece.class}:#{piece.non_check_moves.inspect}\" }\n puts \"CHECK!\" if in_check?(color)\n return false if color_pieces.any? { |piece| !piece.non_check_moves.empty? }\n return checkmate?(color) || stalemate?(color)\n end", "title": "" }, { "docid": "af5d43a4d9e190f794896dd1290c4289", "score": "0.5894838", "text": "def check?(color)\n king_pos = pieces.find do |piece|\n piece.is_a?(King) && piece.color == color\n end.position\n\n pieces.any? do |piece|\n piece.moves.include?(king_pos)\n end\n end", "title": "" }, { "docid": "61cfc8c58233ae0458b0168575b26218", "score": "0.5888922", "text": "def is_move_allowed(to_x,to_y) #Checks to see if the move is allowed based on the pieces 'rule'\n allowed=false\n \n x_diff=(to_x-@x).abs\n y_diff=(to_y-@y).abs\n \n if x_diff <=1 && y_diff <=1\n allowed= true\n end\n if x==to_x && y==to_y\n allowed = false\n end\n\n return allowed\n end", "title": "" }, { "docid": "9a1b3e59495e7e653c38a10bd1a57e15", "score": "0.58804107", "text": "def is_obstructed?(_pieces, _destination)\n raise NotImplementedError, \"Must be able to detect obstruction!\"\n end", "title": "" }, { "docid": "67e47fb9ca9d8ccd03a2a417617e05a8", "score": "0.58788514", "text": "def any_converted_pieces?(move)\n\t\t right\t\t=\t[\"right\", check_right(move)]\n\t\t left\t\t=\t[\"left\", check_left(move)]\n\t\t up\t\t\t=\t[\"up\", check_up(move)]\n\t\t down\t\t=\t[\"down\", check_down(move)]\n\t\t rud\t\t=\t[\"RUD\", check_RUpDiag(move)]\n\t\t rdd\t\t=\t[\"RDD\", check_RDownDiag(move)]\n\t\t lud\t\t=\t[\"LUD\", check_LUpDiag(move)]\n\t\t ldd\t\t=\t[\"LDD\", check_LDownDiag(move)]\n\t\t directions\t= \t[right, left, up, down, rud, rdd, lud, ldd]\n\t\t valid_move\t= \tfalse\n\t\t directions.each do |dir, arr|\n\t\t\tif conversion?(dir, arr)\n\t\t\t\tconvert_pieces(arr)\n\t\t\t\tvalid_move= true\n\t\t\tend \n\t\t end\n\t\treturn valid_move\n\tend", "title": "" }, { "docid": "d8b34d9a8aeaf8a25ab0ad9c17721845", "score": "0.587729", "text": "def gen_rook_moves(color, piece=:rook)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north\n if (dirs & 0x1) != 0x1\n to = from+k*8\n if i+k>7 || comrades.set?(to)\n # no further north moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south\n if (dirs & 0x2) != 0x2\n to = from-k*8\n if i<k || comrades.set?(to)\n # no further south moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving east\n if (dirs & 0x4) != 0x4\n to = from+k\n if j+k>7 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further east moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end\n \n # try moving west\n if (dirs & 0x8) != 0x8\n to = from-k\n if j-k<0 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further west moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end \n end\n end \n moves\n end", "title": "" }, { "docid": "bc84fa871c8f25a3bb4aa890260da16c", "score": "0.58685124", "text": "def attacked?(attacker_color, coordinate)\n piece_chars = attacker_color == ChessRules::WHITE ? ChessRules::BLACK_PIECES : ChessRules::WHITE_PIECES\n piece_chars.each do |char|\n piece = Piece.from_char(char, coordinate, board_2d)\n piece.moves.each do |move|\n if piece.color == ChessRules::WHITE\n return true if piece.char.downcase == piece_at(move)\n elsif piece.color == ChessRules::BLACK\n return true if piece.char.upcase == piece_at(move)\n end\n end\n end\n\n false\n end", "title": "" }, { "docid": "9cb4e992be4f2734e98787f0d3244353", "score": "0.5868115", "text": "def scan_moves\n @white_moves = []\n @black_moves = []\n\n r = 0\n while r <= 7\n c = 1\n while c <= 8\n if selected_piece_type(r, c) != 'Piece' && selected_piece_type(r, c) != 'King'\n if selected_piece_colour(r, c) == Board::B\n @black_moves << possible_moves(r, c)\n elsif selected_piece_colour(r, c) == Board::W\n @white_moves << possible_moves(r, c)\n end\n end\n c += 1\n end\n r += 1\n end\n end", "title": "" }, { "docid": "96c0c7946489e1d7dcc51aed726c57ab", "score": "0.58664227", "text": "def gen_pawn_moves(color)\n moves = []\n all = @position.all_pieces\n \n if color == :white\n position = @position.white \n enemy = @position.black_pieces\n #white pawn moves up the board (increasing bit index order)\n delta = 8\n else\n position = @position.black\n enemy = @position.white_pieces\n #white pawn moves down the board (decreasing bit index order)\n delta = -8\n end\n # no work to do when there are no pawns \n return moves if position[:pawn].nil?\n \n # for each pawn\n position[:pawn].set_bits.each do |from| \n # valid moves are those moves to a free square...\n to = from + delta\n if all.clear?(to) \n moves << [Square.index(from), Square.index(to)]\n to += delta\n moves << [Square.index(from), Square.index(to)] if not_moved_yet(color, from) && all.clear?(to)\n end\n \n # ...plus attacks on the enemies pieces\n move_to = (Move::Attacks[:pawn][color][from] & enemy)\n move_to.set_bits.each { |to_move| moves << [Square.index(from), Square.index(to_move)] }\n end\n moves\n end", "title": "" }, { "docid": "5b91231409a0ab6a596c61cfeed28aec", "score": "0.58654916", "text": "def place_piece(move, color)\n square = pieces_at(*move.origin)\n\n return false unless square.empty? && @piece_sets[color].remove(move.piece_type)\n\n square.push(move.piece)\n\n true\n end", "title": "" }, { "docid": "4bf16b106b88e8c642e4f759a52c0016", "score": "0.5865004", "text": "def force_check_filter(board, moves)\n force_check_moves = Hash.new { |hash, key| hash[key] = [] }\n\n moves.each do |start_pos, end_positions|\n end_positions.each do |end_pos|\n new_board = DeepClone.clone(board)\n new_board.move_piece(start_pos, end_pos)\n if new_board.in_checkmate?(opponent_color)\n @end_pos = end_pos\n return start_pos\n elsif new_board.in_check?(opponent_color)\n force_check_moves[start_pos] << end_pos\n end\n end\n end\n\n new_moves = force_check_moves.empty? ? moves : force_check_moves\n highest_value_capture_filter(board, new_moves)\n end", "title": "" }, { "docid": "29dacafa6c02180ab8ca558d38ed5ea6", "score": "0.58621424", "text": "def move_piece(org,dest)\n # remove catured piece if capture move\n if (dest[0] - org[0]).abs == 2\n captured_box = [org[0] + (dest[0]-org[0])/2 , org[1] + (dest[1]-org[1])/2]\n @pieces[captured_box[0]][captured_box[1]].remove\n end\n\n @pieces[org[0]][org[1]].remove\n @pieces[dest[0]][dest[1]] = draw_piece(dest[0],dest[1],@board.state[dest[0]][dest[1]])\nend", "title": "" }, { "docid": "27d7d9304d749993c8f5e93bc26e5f3e", "score": "0.58612907", "text": "def test_chk_mv_pawn\n e = RulesEngine.new\n\n # cannot move a \"pawn\" from an empty square\n assert_equal(e.chk_mv(Coord.from_alg('e3'), Coord.from_alg('e4')), false)\n\n # can move one square forward\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('e3')), true)\n\n # cannot move one square forward if blocked\n e.place_piece(Coord.from_alg('e3'), Chess::Piece.new(Colour::WHITE, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('e3')), false)\n\n # cannot move two squares forward if blocked\n assert(!e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('e4')))\n\n # cannot move diagonally if not a capture\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('d3')), false)\n\n # can move diagonally if a capture\n e.place_piece(Coord.from_alg('d3'), Chess::Piece.new(Colour::BLACK, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('d3')), true)\n\n # cannot capture the same colored piece\n e.place_piece(Coord.from_alg('d3'), Chess::Piece.new(Colour::WHITE, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e2'), Coord.from_alg('d3')), false)\n\n # make sure it works both ways\n e.place_piece(Coord.from_alg('d6'), Chess::Piece.new(Colour::BLACK, Chess::Piece::BISHOP))\n assert_equal(e.chk_mv(Coord.from_alg('e7'), Coord.from_alg('f6')), false)\n end", "title": "" }, { "docid": "d5f2d1fe99df7ac6b9b1a1901e38d496", "score": "0.5846949", "text": "def move_piece_in_square(from_square, to_square)\n to_square.checker_piece = from_square.checker_piece\n from_square.checker_piece = nil\n end", "title": "" }, { "docid": "d5f2d1fe99df7ac6b9b1a1901e38d496", "score": "0.5846949", "text": "def move_piece_in_square(from_square, to_square)\n to_square.checker_piece = from_square.checker_piece\n from_square.checker_piece = nil\n end", "title": "" }, { "docid": "4b61a79599c8188733eee2a498eaa1dc", "score": "0.5839584", "text": "def threat?(piece)\n return true if piece.color != self.color\n return false\n end", "title": "" }, { "docid": "196ee04e8fc81e2a2684551c80b6e5ac", "score": "0.5839536", "text": "def over?(board)\n if draw?(board) || full?(board)\n true\n elsif won?(board) != false && won?(board) != []\n true\n else\n false\n end\nend", "title": "" }, { "docid": "927b897747d122c434b09ea0c12e9708", "score": "0.5839334", "text": "def invalid_moves(moves, board)\n invalid = []\n moves.each do |y, x|\n unless board[y][x].nil?\n invalid << [y,x] if board[y][x].color == @color\n end\n end\n invalid\n end", "title": "" } ]
3010abe96a4bcbbadf221a8965fd92f6
Print entries of a table with labels from the mask. The column specified as special_pos is printed underneath the label from the mask.
[ { "docid": "c1e32d7d6776ff7146a02fbc3f9e0487", "score": "0.78829527", "text": "def pretty_print(mask, table, special_pos)\n for i in 0..table.size-1 do\n for j in 0..mask.size-1 do\n puts(mask[j] + \": \" + (if j==special_pos then \"\\n\" else \"\" end) + table[i][j].to_s)\n end\n puts(\"----------------------------\")\n end\nend", "title": "" } ]
[ { "docid": "5b4074ec96215749eaf471ec9df68e1d", "score": "0.7094334", "text": "def pretty_strings(mask, table, special_pos)\n pretty_strings = [];\n for i in 0..table.size-1 do\n string = \"\";\n for j in 0..mask.size-1 do\n string = string + mask[j] + \": \" + (if j==special_pos then \"\\n\" else \"\" end) + table[i][j] +\"\\n\";\n end;\n string = string + \"----------------------------\";\n pretty_strings = pretty_strings + [string];\n end;\n return pretty_strings;\nend", "title": "" }, { "docid": "212b449dcc6d18c7e855d9e8fa0c842b", "score": "0.6181554", "text": "def column_labels\n print \" \"\n ('a'..'h').each do |col|\n print \" #{col} \"\n end\n end", "title": "" }, { "docid": "ec3e47f6a0900be81323b9a80137f946", "score": "0.59971654", "text": "def print_board\n col_separator, row_separator = \" | \", \"--+---+--\"\n\n label_for_position = lambda do |col|\n mark = @marks_array[col].mark\n mark.nil? ? col : mark\n end\n \n row_for_display = lambda do |row|\n row.map(&label_for_position).join(col_separator)\n end\n\n row_positions = [[7,8,9], [4,5,6], [1,2,3]]\n\n rows_for_display = row_positions.map(&row_for_display)\n\n puts\n puts rows_for_display.join(\"\\n\" + row_separator + \"\\n\")\n end", "title": "" }, { "docid": "98748e042fb65b25ef6dfdf57045c511", "score": "0.5698206", "text": "def display\n puts \" | \" + COLS.keys.sort.collect{|p| p.to_s }.join(\" | \")\n puts \"----------------------------------\"\n @tiles.each_with_index do | row, r |\n puts \"#{r + 1} | \" + row.collect {|p| p.nil? ? \" \" : p.name }.join(\" | \")\n end\n end", "title": "" }, { "docid": "c79e0cec0da323afe07069ef583b8832", "score": "0.56822723", "text": "def print_table_row(row_label, label_width, cells)\n print row_label ? (row_label.rjust(label_width) + \" |\") :\n (\" \" * (label_width + 2))\n cells.each {|cell| print cell.to_s.rjust(7) }\n print \"\\n\"\nend", "title": "" }, { "docid": "e9125db754ebe11632c9a0fe6bfc136a", "score": "0.56671834", "text": "def display_table\n mot_str = \"*#{mot}*\".ljust(20)\n count_str = \" #{count}\".ljust(8)\n # offset_str = \"#{offsets_disp.ljust(38)}\"\n presence_str = \"#{presence} ‰\".ljust(12)\n dist_str = \" #{distance_min}\".ljust(9)\n trait_str = \"#{traitable? ? ' oui' : raison_non_traitable}\".ljust(20)\n traitable? || trait_str = trait_str.gris\n puts mot_str + count_str + presence_str + dist_str + trait_str\n\n end", "title": "" }, { "docid": "81caef883f9ecde3906fe139586f1f59", "score": "0.5640146", "text": "def print_map\n\t\t@array.each do |row|\n\t\t\trow.each do |cell|\n\t\t\t\tif cell < 0\n\t\t\t\t\tprint 5\n\t\t\t\telsif cell > 0\n\t\t\t\t\tprint 1\n\t\t\t\telse\n\t\t\t\t\tprint 0\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs\n\t\tend\n\tend", "title": "" }, { "docid": "ce72b3160ab30d01f80098cb2c252e15", "score": "0.5603127", "text": "def print_grid\n (0...@grid.length).each do |row|\n row_s = \"\"\n (0...@grid.length).each do |col|\n if @grid[row][col].revealed == true\n if col != @grid.length - 1 #if @grid[blah].reveal == true\n row_s += @grid[row][col].value + \" . \"\n else\n row_s += @grid[row][col].value\n end\n else\n if col != @grid.length - 1 #if @grid[blah].reveal == true\n row_s += \"_ . \"\n else\n row_s += \"_\"\n end\n end\n end\n puts row_s\n end\n end", "title": "" }, { "docid": "53554932e471cc8d273a682aba7e65bb", "score": "0.55913377", "text": "def print_data\n\n puts \"\"\n -1.upto(8) do |y|\n -1.upto(8) do |x|\n\n # print row numbers\n if x == -1\n print (0..7).include?(y) ? \"#{8 - y} | \".green.bold : \"\".ljust(3); next\n elsif x == 8\n print (0..7).include?(y) ? \" | #{8 - y}\".green.bold : \"\".ljust(3); next\n end\n \n # print column letters\n if (0..7).include?(y) == false\n print \" \" + %w[a b c d e f g h][x].to_s.green.bold; next\n end\n\n # print piece symbol\n pos = [y, x]\n print self[pos].nil? ? \"- \" : \"#{self[pos].symbol} \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "title": "" }, { "docid": "6fa1907420cb8ddcd852c8c04dd7a8f4", "score": "0.55637175", "text": "def print_map\n\n puts \"\\nYou're in \" + @map.name + \"!\\n\\n\"\n row_count = 0\n @map.tiles.each do |sub|\n #centers each row under the \"welcome\" sign\n for i in 1..(@map.name.length/2)\n print \" \"\n end\n col_count = 0\n sub.each do |tile|\n if tile.seen\n if tile.passable\n if row_count == @location.first && col_count == @location.second\n print \"¶\"\n else\n print \"·\"\n end\n else\n print \"■\"\n end\n else\n print \" \"\n end\n col_count += 1\n end\n row_count += 1\n puts \"\"\n end\n puts \"\\n· - passable space\" +\n \"\\n■ - impassable space\" +\n \"\\n¶ - your location\\n\\n\"\n end", "title": "" }, { "docid": "e9187ed8c2dc5ffe0be40568471203ff", "score": "0.55525106", "text": "def print_labels input_ops, c, input_name\n i = 0\n show do\n title \"Print out labels\"\n note \"On the computer near the label printer, open Excel document titled 'Glycerol stock label template'.\" \n note \"Copy and paste the table below to the document and save.\"\n unless c\n table input_ops.start_table \n .output_item(input_name) \n .custom_column(heading: \"Sample ID\") { |op| op.input(input_name).sample.id } \n .custom_column(heading: \"Sample Name\") { |op| op.input(input_name).sample.name[0,16] }\n .end_table\n end\n\n \n if c\n table input_ops.start_table.custom_column(heading: \"thing\") { i = i + 1 }\n .custom_column(heading: \"Item ID\") { \"\" }\n .end_table\n # .custom_column(heading: \"Sample ID\") { input[i].sample.id i = i + 1 } \n # .custom_column(heading: \"Sample Name\") { input[(i = i + 1)].sample.name[0,16] } \n \n \n end\n \n note \"Ensure that the correct label type is loaded in the printer: B33-181-492 should show up on the display. \n If not, get help from a lab manager to load the correct label type.\"\n note \"Open the LabelMark 6 software and select 'Open' --> 'File' --> 'Glycerol stocks.l6f'\"\n note \"Click on the number in the top row of the horizontal side label and select 'Edit External Data'. A window should pop up. Select 'Finish'.\"\n note \"Ensure the correct data is displayed on the labels.\"\n note \"Select 'File' --> 'Print' and set the printer to 'BBP33'.\"\n note \"Collect labels.\"\n end\n end", "title": "" }, { "docid": "834890ba977a140902b257f9c9d8ee2a", "score": "0.55223405", "text": "def display\n if !self.lose?\n print \" 0 1 2 3 4 5 6 7 8\"\n puts\n puts\n @rows.each_with_index do |row,row_idx|\n print \"#{row_idx} \"\n row.each_with_index do |col,col_idx|\n if !self.[]([row_idx,col_idx]).revealed && !self.[]([row_idx,col_idx]).flagged\n print \"* \"\n elsif !self.[]([row_idx,col_idx]).revealed && self.[]([row_idx,col_idx]).flagged\n print \"F \"\n elsif self.[]([row_idx,col_idx]).revealed && !self.[]([row_idx,col_idx]).bomb\n print \"#{self.[]([row_idx,col_idx]).neighbors_bomb_count} \"\n else\n print \"B \"\n end\n end\n puts\n end\n else\n print \" 0 1 2 3 4 5 6 7 8\"\n puts\n puts\n @rows.each_with_index do |row,row_idx|\n print \"#{row_idx} \"\n row.each_with_index do |col,col_idx|\n if self[[row_idx,col_idx]].flagged && self[[row_idx,col_idx]].bomb\n print \"b \"\n elsif !self[[row_idx,col_idx]].flagged && self[[row_idx,col_idx]].bomb\n print \"B \"\n elsif !self[[row_idx,col_idx]].bomb\n print \"#{self.[]([row_idx,col_idx]).neighbors_bomb_count} \"\n end\n end\n puts\n\n end\n end\n nil\n end", "title": "" }, { "docid": "17ccf4bf83ed0e15e3916bb3b832f5ab", "score": "0.55047655", "text": "def display_position_table\n new_table = to_array\n row_count.times do |rr|\n column_count.times do |cc|\n rr_well = 'A'.ord.to_i + rr # ascii value for A-H, use .chr to convert to ascii character\n cc_well = cc + 1 # number\n if yield(self[rr, cc])\n new_table[rr][cc] = { content: \"#{rr_well.chr}#{cc_well}\", style: { background: '#e6e6ff' } } # purple\n else\n new_table[rr][cc] = { content: \"#{rr_well.chr}#{cc_well}\", style: { background: '#000000' } } # black\n end\n end\n end\n new_table\n end", "title": "" }, { "docid": "133cb900dd01f87618b71d6c90a383d9", "score": "0.5498517", "text": "def display_row(row)\n row.each do |tile|\n print (tile.value == 0 ? \" \" : tile.value)\n print \" | \"\n end\n end", "title": "" }, { "docid": "807daf1598ef60c9a8a849977d0e344f", "score": "0.5476995", "text": "def print_data_pseudo_matrix_to_file(outfile,data,labels,seperator=\" \")\n\n label_str=\"%\" + labels.join(seperator)\n outfile.print(label_str)\n\n outfile.print(\"\\n\")\n\n\n\n for i in 0...data[0].size\n for j in 0...data.size\n outfile.print(data[j][i])\n if (j != data.size-1)\n outfile.print(seperator)\n end\n end\n\n outfile.print(\"\\n\")\n end\n\nend", "title": "" }, { "docid": "1fcb6d871ad96edfb5d99911b6c586e8", "score": "0.5471256", "text": "def print\n s = ''\n @size.times do |r|\n # Top off each row\n s << \"-\" * (@size * 2 + 1)\n s << \"\\n|\"\n @size.times do |c|\n if self.get_cell(r,c).is_alive?\n s << 'x|'\n else\n s << ' |'\n end\n end\n s << \"\\n\"\n end\n\n # Cap it and print\n s << \"-\" * (@size * 2 + 1)\n puts s\n end", "title": "" }, { "docid": "d93ae623b856f7d94ca6e0c52e6de614", "score": "0.544594", "text": "def print_puzz(puzz)\n puzz.each do |row|\n row.each do |tile|\n print \"#{(!tile.value.nil? && tile.value > 0) ? tile.value : '.'} \"\n end\n puts \"\"\n end\nend", "title": "" }, { "docid": "7f45b790c6ff23897780cab34df39efc", "score": "0.5442361", "text": "def dump\n @index.sort.each do |term, docs|\n puts \"#{term}:\"\n @docs.sort.each do |name, mask|\n puts \" #{name}\" if mask & docs != 0\n end\n end\n end", "title": "" }, { "docid": "fed3830e27740522be4acefcf7e79071", "score": "0.54398394", "text": "def print_cell_coordinates\n return unless state.debug\n state.dungeon.each do |d|\n outputs.labels << [grid_x(d.x) + 2,\n grid_y(d.y) - 2,\n \"#{d.x},#{d.y}\",\n -2, 0, *white]\n end\n end", "title": "" }, { "docid": "d97e9fbf7c84d155dce3094016b5772c", "score": "0.5438519", "text": "def print_map\n \n # Provide some spacing to center the name.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n \n print @map.name + \"\\n\\n\"\n \n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n (0..(@map.name.length/2)).each do\n print \" \"\n end\n row.each_with_index do |tile, t|\n if ((@location.first == r) && (@location.second == t))\n print \"¶ \"\n elsif (!tile.seen)\n print \" \"\n else\n print tile.graphic + \" \"\n end\n end\n\t\t\tprint \"\\n\"\n end\n \n print \"\\n\"\n \n # Provide some spacing to center the legend.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n \n # Prints the legend.\n puts \"¶ - #{@name}'s \\n location\\n\\n\"\n end", "title": "" }, { "docid": "180d78042d8bb0bdb0f20a55fda043b2", "score": "0.54331416", "text": "def display\n c = self.cells\n puts \" #{c[0]} | #{c[1]} | #{c[2]} \"\n puts \"-----------\"\n puts \" #{c[3]} | #{c[4]} | #{c[5]} \"\n puts \"-----------\"\n puts \" #{c[6]} | #{c[7]} | #{c[8]} \"\n end", "title": "" }, { "docid": "36f0a9eff093f559a93290260b2dc8fc", "score": "0.54088527", "text": "def inspect\n render_top_rule\n @rows.each_with_index do |array_rows, index|\n print \"#{index} \"\n array_rows.each do |cell|\n print (cell.nil? ? \" \" : cell.symbol )\n end\n print \"\\n\"\n end\n \n nil\n end", "title": "" }, { "docid": "02083a0830ad326eb344dcbbaec8c521", "score": "0.5408392", "text": "def print_row(offset_length, row_length, position, symbol)\n\tfor i in 0..row_length do\n\t\tif i > offset_length then\n\t\t\tprint \"#\"\n\t\telsif i==position then\n\t\t\tprint symbol\t\n\t\telse\n\t\t\tprint \" \"\n\t\tend\n\tend\n\tputs\nend", "title": "" }, { "docid": "f5a7755292e4a45e199877db8b91952e", "score": "0.54075885", "text": "def print_row(row)\n puts '#' + @state[true, row].each.map { |e| e > 0 ? '*' : ' ' }.join + '#'\n end", "title": "" }, { "docid": "d5e9698aa54d7e7552e38f79997d062d", "score": "0.53989923", "text": "def pretty_print\n @table.each_with_index do |column, x_index|\n column.each_with_index do |row, y_index|\n if row\n # Padding\n print ' '\n print ' ' * (@max_character_length - row.to_s.length)\n print row\n print ' '\n else\n print ' ' * (@max_character_length + 2)\n end\n\n print '|' if y_index == 0 # Handles separator after row header\n end\n\n print \"\\n\"\n\n # Separator after column header\n if x_index == 0\n puts '-' * ((@max_character_length + 2) * @table.length)\n end\n end\n\n end", "title": "" }, { "docid": "ee849497caa8b708047e2a230d7fdbe4", "score": "0.53750795", "text": "def print_grid grid = @grid\n puts (('+-' * grid.first.length) + '+').black\n grid.each do |row|\n row.each_with_index do |cell, index|\n if index == @index\n print '|'.black\n print cell ? '#'.blue : ' '\n else\n print '|'.black\n print cell ? '#' : ' '\n end\n end\n print '|'.black\n puts (\"\\n\" + ('+-' * row.length) + '+').black\n end\n end", "title": "" }, { "docid": "63c8e47a9f5220e05541b0edc84129a5", "score": "0.5374197", "text": "def print_key_labels(posy, posx, arr)\n ## paint so-called key bindings from key_labels\n posx = 0\n even = []\n odd = []\n arr.each_index { |i| \n if i % 2 == 0\n even << arr[i]\n else\n odd << arr[i]\n end\n }\n posy = LINEONE+1\n print_key_labels_row(posy, posx, even)\n posy = LINEONE+2\n print_key_labels_row(posy, posx, odd)\n # 2008-09-29 21:58 \n @footer_win.wrefresh # needed else secod row not shown after askchoice XXX\n end", "title": "" }, { "docid": "2600e749d2da8b0f035f0c67818340a3", "score": "0.5371941", "text": "def printtable\n output = \"\"\n @table.each do |r|\n # maps to a table, adding extra spaces to make each width the same\n output += r.map { |p| p.to_s+\" \"*(@table.last.last.to_s.length-p.to_s.length)}.join(\" | \")+\"\\n\"\n end\n $stdout.write output\n \n end", "title": "" }, { "docid": "b6acbbe636dcd8b887d69b8f6153e019", "score": "0.5359735", "text": "def cells_for_display\n self.mask? ? cells_for_display_as_masked : cells_for_display_as_not_masked\n end", "title": "" }, { "docid": "63790195409156aef9eddbd2088af6d7", "score": "0.53503036", "text": "def print_board\n print_alphabet\n (0..@row_count).each do |row|\n print_this_letter(row)\n (0..@col_count).each do |col|\n if @board[[row, col]].hidden\n print '_ '\n elsif @board[[row, col]].count_of_mines_around.zero?\n print ' '\n else\n print(@board[[row, col]].count_of_mines_around.to_s + ' ')\n end\n end\n print(\"\\n\")\n end\n end", "title": "" }, { "docid": "99959efdab8d894039e9935c88934da4", "score": "0.5344163", "text": "def dibujar_tablero\n fil = 0\n self.tablero.each do |l|\n col = 0\n l.each do |c| \n print \" \"\n case c\n when 1\n print \"X\"\n when 2 \n print \"O\"\n else\n print \" \"\n end\n print \" \"\n col += 1\n print \"|\" unless col == self.tablero[fil].length\n end\n fil += 1\n print \"\\n\"\n print \"-----------\\n\" unless fil == self.tablero.length\n if fil == self.tablero.length\n print \"\\n\"\n end\n end\n end", "title": "" }, { "docid": "2abc46c06253ee24faaea2dbe89ad0da", "score": "0.53434145", "text": "def display\n puts\n (0..max_row).each do |y|\n print Array.new(y, ' ').join\n (0..max_col).each do |x|\n print \"#{cells[x][y]} \"\n end\n puts\n end\n end", "title": "" }, { "docid": "721c4a9efd2cb15985001a692f175a63", "score": "0.53385127", "text": "def debug\n\t\tprint \"Current mask:\\n\"\n\t\tfor y in 0...@height\n\t\t\tprint \"#{(@mask[y] || 0).to_s(2).reverse}\\n\"\n\t\tend\n\tend", "title": "" }, { "docid": "e4c86e5b594d6169c63b5e09d023750d", "score": "0.53308123", "text": "def print_annotated_matrix matrix, io=$stdout\n labels = self.stations.map {|s| s.label}\n\n # clear diagonal\n (0...(matrix.size)).each do |i| matrix[i][i] = \"\"; end\n\n io.puts <<OD\n\\t#{labels.join(\"\\t\")}\n#{labels.zip(matrix).map {|row| row.flatten.join(\"\\t\")}.join(\"\\n\")}\nOD\n end", "title": "" }, { "docid": "5e6ab486a2989eec00c592a299e34ca9", "score": "0.5329752", "text": "def print_masked\n @letters.each do |l|\n print @guessed.member?(l) ? l : \"-\"\n end\n puts \n end", "title": "" }, { "docid": "91c55542313b76f4f100f2b8e3555a44", "score": "0.53270596", "text": "def print_field\n # Print top border\n print '+'\n (1..Field.size).each { print '-' }\n print \"+\\n\"\n\n # Print each field row\n @field.each do |row|\n print '|'\n row.each { |x| print(!x ? ' ' : x.to_s) }\n print \"|\\n\"\n end\n\n # Print bottom border\n print '+'\n (1..Field.size).each { print '-' }\n print \"+\\n\"\n nil\n end", "title": "" }, { "docid": "c5eaa9764cd8a69d42b977e31a73bdc0", "score": "0.5325137", "text": "def display\r\n vcells = @cells.map { |c| c.nil? ? ' ' : c }\r\n puts \"#{vcells[0]} | #{vcells[1]} | #{vcells[2]}\"\r\n puts \"-----------\"\r\n puts \"#{vcells[3]} | #{vcells[4]} | #{vcells[5]}\"\r\n puts \"-----------\"\r\n puts \"#{vcells[6]} | #{vcells[7]} | #{vcells[8]}\"\r\n end", "title": "" }, { "docid": "ecdd3517c1d03437211a067a18b03228", "score": "0.5315343", "text": "def print_secret_board\n\n @board.each do |row|\n row.each do |cell|\n if cell.mine\n print \"* \"\n elsif cell.neighboring_mines == 0\n print \"- \"\n else\n print \"#{cell.neighboring_mines} \"\n end\n end\n puts\n end\n end", "title": "" }, { "docid": "32d3321a035cb0d04ce2c7e3a4a06a6c", "score": "0.5314632", "text": "def print_screen_labels(my_form_win, labelarr)\n table_width = @table_width || Ncurses.LINES-1\n return if labelarr.nil?\n labelarr.each{ |lhash|\n posy, posx = lhash[\"position\"]\n posy = table_width + posy if posy < 0\n posx = Ncurses.COLS + posy if posx < 0\n\n text = lhash[\"text\"]\n color_pair = lhash[\"color_pair\"] || 6\n my_form_win.attron(Ncurses.COLOR_PAIR(color_pair))\n my_form_win.mvprintw(posy, posx, \"%-s\" % text );\n my_form_win.attroff(Ncurses.COLOR_PAIR(color_pair))\n }\n end", "title": "" }, { "docid": "eff0818facebbcf33b847979ed65ee8c", "score": "0.5310999", "text": "def print\n Terminal::Table.new do |table|\n # Print each rank number with each piece from rank 8\n # down to rank 1.\n rank_names.reverse.each do |rank|\n table << [rank] + file_names.map do |file|\n icon(board.at_square(\"#{file}#{rank}\"))\n end\n \n table << :separator\n end\n \n # Print an row with an empty square and the file names.\n table << [nil] + Board.file_names\n end\n end", "title": "" }, { "docid": "80bf3af11c2ff2ded1c924362339e6d2", "score": "0.5306947", "text": "def printTable\n\t\t@table.each_with_index {|card, index| printf(\"%-4i\", index); card.printCard; puts \"\"}\n\tend", "title": "" }, { "docid": "84c85947e462ab1960bff5ce3e46b89e", "score": "0.5287384", "text": "def print\n puts \"-\" * LINE_WIDTH\n puts \" \" * 13 + @label.upcase\n puts \"-\" * LINE_WIDTH\n puts \"#{'Index'.ljust(INDEX_COL_WIDTH)} | #{'Item'.ljust(ITEM_COL_WIDTH)} | #{'Deadline'.ljust(DEADLINE_COL_WIDTH)}\"\n puts \"-\" * LINE_WIDTH\n @items.each_with_index do |item, i|\n puts \"#{i.to_s.ljust(INDEX_COL_WIDTH)} | #{item.title.ljust(ITEM_COL_WIDTH)} | #{item.deadline.ljust(DEADLINE_COL_WIDTH)}\"\n end\n puts \"-\" * LINE_WIDTH\n end", "title": "" }, { "docid": "c54b14d2bfefa6c6d8cf146965ad5b48", "score": "0.5281832", "text": "def print_board\n\t\t# Column label\n\t\tprint_column_label\n\t\tprint_row_border\n\t\tprint_row\n\tend", "title": "" }, { "docid": "0ea58f32c8efa00b22f52be069ed8db5", "score": "0.52803254", "text": "def print\n table = calculate_table\n\n # A few vars for pretty printing\n cell_width = 5 + (table.last.last.to_s.length)\n row_width = cell_width * (@row_values.length + 1)\n\n # Print the first cell\n print_cell(\"x |\", cell_width)\n\n # Print the Column Headings\n @row_values.each { |x| print_cell(x, cell_width) }\n puts \"\\n\" + (\"-\" * row_width)\n \n # Print Rows\n table.each_index do |i|\n # Row Heading\n print_cell(\"#{@column_values[i]} |\", cell_width)\n\n # Row Content\n table[i].each { |x| print_cell(x, cell_width) }\n puts \"\\n\"\n end\n end", "title": "" }, { "docid": "f5350fc0f05b25a89c3b23aaac5d6a45", "score": "0.5278701", "text": "def print_grid\n grid.each do |row|\n row.each do |cell|\n if cell.alive?\n print '0'\n else\n print '.'\n end\n end\n print \"\\n\"\n end\n end", "title": "" }, { "docid": "24b0969379f0d44b42eb0c8b2357c474", "score": "0.5278051", "text": "def display\n nums = []\n 8.downto(1).each {|n| nums.push n}\n print \"\\n\"\n @fields.each_with_index do |row,i|\n if i == 0\n print \" \" + black(\"†\")\n \"a\".upto(\"h\").each { |l| print brown(black_f(l)) }\n print black(\"⚖\") + \"\\n\"\n end\n row.each_with_index do |f,j|\n print \" \" + brown(black_f(nums[i].to_s)) if j == 0\n s = f.figure.nil? ? \" \" : black_f(f.figure.sign)\n if i.modulo(2) == 0\n print white(s) if j.modulo(2) == 0\n print black(s) if j.modulo(2) == 1\n else\n print black(s) if j.modulo(2) == 0\n print white(s) if j.modulo(2) == 1\n end\n print brown(black_f(nums[i].to_s)) if j == 7\n end\n print \"\\n\"\n end\n print \" \" + black(\"⚜\")\n \"a\".upto(\"h\").each { |l| print brown(black_f(l)) }\n print black(\"⚔\") + \"\\n\\n\"\n end", "title": "" }, { "docid": "f901acd386db647c4b183087b7bbd508", "score": "0.5265597", "text": "def print\n print_board = Array.new(@size) { Array.new(@size, '*') }\n @board.each_with_index do |row, r_i|\n row.each_with_index do |element, c_i|\n if @board_reveal[r_i][c_i]\n print_board[r_i][c_i] = element\n print_board[r_i][c_i] = 'F' if @board_flag.include?([[r_i],[c_i]])\n print_board[r_i][c_i] = '_' if @board[r_i][c_i] == 0\n end\n end\n end\n puts (\" \" * 20) + ( \"_\" * (10+@size) )\n print_board.each do |line|\n puts (\" \" * 20) + \"|\" + line.join(\" \") + \"|\"\n end\n puts (\" \" * 20 ) + \"_\" * (10+@size)\n end", "title": "" }, { "docid": "124f0bb49c8cc92fd136e32b0e295602", "score": "0.5258381", "text": "def render\n labels = (0...@col_num).map { |n| n.to_s.center(4) }.join(\"\")\n puts \" #{labels}\"\n puts \" #{ \"-\" * (@col_num * 4 - 1) }\"\n\n rows = @board.grid.map.with_index do |row, i|\n \"#{i.to_s.rjust(2)} |#{row.map(&:to_s).join(\"|\")}|\\n\" +\n \" #{ \"-\" * (@col_num * 4 - 1) }\"\n end\n puts rows.join(\"\\n\")\n end", "title": "" }, { "docid": "50438dce98dd1f7ff1eab66086480ea2", "score": "0.5249739", "text": "def print_lost_board(cell)\n print_alphabet\n (0..@row_count).each do |row|\n print_this_letter(row)\n (0..@col_count).each do |col|\n if row == cell[0] && col == cell[1]\n print('X ')\n elsif @board[[row, col]].has_mine?\n print('* ')\n elsif @board[[row, col]].hidden?\n print('_ ')\n elsif @board[[row, col]].count_of_mines_around.zero?\n print ' '\n else\n print(@board[[row, col]].count_of_mines_around.to_s + ' ')\n end\n end\n print(\"\\n\")\n end\n end", "title": "" }, { "docid": "52e28953961f94456ead845ea1ded44e", "score": "0.5248834", "text": "def display_midi_table\n\t\t\t# write the column names\n\t\t\t@midi_table['A'].each do |key, value|\n\t\t\t\tprint \" #{key}\"\n\t\t\tend\n\n\t\t\tputs # just for a newline\n\n\t\t\t@midi_table.each do |na, aa_hash|\n\t\t\t\tprint na \n\t\t\t\taa_hash.each do |aa, midi|\n\t\t\t\t\t#print \" #{'%02X' % midi}\"\n\t\t\t\t\tprint \" #{midi}\"\n\t\t\t\tend\n\t\t\t\tputs\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "be90b605ca092a7515380e74faae45dd", "score": "0.5242123", "text": "def print_label(win, row, col, format, value, _color, _attr)\n win.printstring row, col, format % [value], _color, _attr\n end", "title": "" }, { "docid": "bf36dead70951447147d7653943c95b2", "score": "0.5240151", "text": "def print_rods\n puts \"\\033[H\\033[2J#{col_headers}\"\n \n (0..n).each do |col|\n grid_row = []\n rods.each{|rod| rod.each_with_index {|disc, disc_idx| grid_row << disc if disc_idx == col }}\n puts grid_row.join\n end\n end", "title": "" }, { "docid": "47c01d2fea714a95c773f2d0e398a15a", "score": "0.5222338", "text": "def display\n display_column_order\n @board.each_index do |row|\n print (8-row).abs\n print \"|\"\n @board[row].each do |column|\n print column.symbol if !column.nil?\n print \" |\" if !column.nil?\n print \" |\" if column.nil?\n end\n print (8-row).abs\n puts \"\\n--------------------------\"\n end\n display_column_order\n end", "title": "" }, { "docid": "a905b12cce8cfeae23466e5ee6b9b6aa", "score": "0.5205078", "text": "def print_map\n # work out how long our horizontal line should be, create a string with that many minus signs\n horizontal_line = '-' * (($world[:width] * 6) + 7)\n # work out what a separator line looks like (based on how many columns the map has)\n spacing_line = '| ' + (' | ' * $world[:width]) + ' |'\n\n puts horizontal_line\n\n # print each row's data\n for y in 0..$world[:height] do\n row = $world[:height] - y # print highest to lowest rows, as x=0 y=0 is the bottom row to be shown\n puts '| ' + $world[:map][row].join(' | ') + ' |'\n puts spacing_line\n end\n\n puts horizontal_line\n puts\n puts\nend", "title": "" }, { "docid": "6c9567f71251e3541efdbad13228ff9d", "score": "0.51761806", "text": "def print(level = 0)\n pad = String.new\n\n level.times { pad += \"\\t\" }\n if @left\n @left.print(level + 1)\n end\n puts \"#{pad}#{label}\"\n if @right\n @right.print(level + 1)\n end\n end", "title": "" }, { "docid": "d4eacdb0df875189b82e97d75f18f61e", "score": "0.5172213", "text": "def cells_to_print\r\n @cells[(@cells.index(@current_cell)-DISPLAY_BUFFER_CELLS..@cells.index(@current_cell)+DISPLAY_BUFFER_CELLS)]\r\n end", "title": "" }, { "docid": "bdbc7d003b4263ff84b4ea89ce80dbe4", "score": "0.5171335", "text": "def formatted_grid\n grid.each do |row|\n puts row.map { |cell| cell.value.empty? ? \"_\" : cell.value }.join(\" \")\n end\n end", "title": "" }, { "docid": "b55390cb14c06fde7671306daf7600ad", "score": "0.5162993", "text": "def print_labels\n show do\n title \"Print out labels\"\n \n note \"On the computer near the label printer, open Excel document titled 'Glycerol stock label template'.\" \n note \"Copy and paste the table below to the document and save.\"\n \n table operations.start_table \n .output_item(\"Stock\") \n .custom_column(heading: \"Sample ID\") { |op| op.output(\"Stock\").sample.id } \n .custom_column(heading: \"Sample Name\") { |op| op.output(\"Stock\").sample.name[0,16] }\n .end_table\n\n note \"Ensure that the correct label type is loaded in the printer: B33-181-492 should show up on the display. \n If not, get help from a lab manager to load the correct label type.\"\n note \"Open the LabelMark 6 software and select 'Open' --> 'File' --> 'Glycerol stocks.l6f'\"\n note \"A window should pop up. Under 'Start' enter #{operations.first.output(\"Stock\").item.id} and set 'Total' to #{operations.length}. Select 'Finish.'\"\n note \"Click on the number in the top row of the horizontal side label and select 'Edit External Data'. A window should pop up. Select 'Finish'.\"\n note \"Select 'File' --> 'Print' and set the printer to 'BBP33'.\"\n note \"Collect labels.\"\n end\n end", "title": "" }, { "docid": "2e01c798bc9ac834674844927d5c36ff", "score": "0.5160458", "text": "def print\n # Special handling: print the top line.\n puts @width.times.inject(\"+\") {|str, x| str << (x == @start_x ? \" +\" : \"---+\")}\n \n # For each cell, print the right and bottom wall, if it exists.\n @height.times do |y|\n line = @width.times.inject(\"|\") do |str, x|\n str << (@path[x][y] ? \" * \" : \" \") << (@vertical_walls[x][y] ? \"|\" : \" \")\n end\n puts line\n \n puts @width.times.inject(\"+\") {|str, x| str << (@horizontal_walls[x][y] ? \"---+\" : \" +\")}\n end\n end", "title": "" }, { "docid": "7becc9283c00f277f9429a9a77056311", "score": "0.51590484", "text": "def printmap\n\t\t@map.each { |row|\n\t\t\tprintf \"%d to %d is a range of %d, translating to %d / %s to %s\\n\",row[0],row[1],row[1]-row[0],row[2],\n\t\t\t\tip(row[2].to_i),ip(row[3].to_i)\n\t\t}\n\tend", "title": "" }, { "docid": "3a15e91e1842761f8ebd0d3e18607252", "score": "0.5131117", "text": "def temp_print_world\n puts \"=======================================\"\n @tiles.each do |row|\n row.each do |tile|\n print \"#{tile.to_s}\\t\"\n end\n puts\n end\n puts \"=======================================\"\n end", "title": "" }, { "docid": "7d6a09d81675c8c1c8f604d9808ffac9", "score": "0.5127258", "text": "def nested_print_helper(columns, row_cells, table)\n col = columns.first\n\n if col.nil?\n table << row_cells\n return table\n end\n\n cells = col.cells\n oc = row_cells.last\n cells = cells.select{ |x| oc.contains(x) } unless oc.nil?\n\n if cells.empty?\n table << row_cells\n return table\n end\n\n cells.each do |cell|\n table = nested_print_helper(columns[1..-1], row_cells + [cell], table)\n end\n\n return table\nend", "title": "" }, { "docid": "f83521b8d19b6a57091aadbe99036de2", "score": "0.51245415", "text": "def full_reprint\n\t\tfor row in (min_row...max_row)\n\t\t\tfor col in (min_col...max_col)\n\t\t\t\treprint_object_at([0, row, col], SUB_NONE, false)\n\t\t\tend\n\t\tend\n\t\t\n\t\treprint\n\tend", "title": "" }, { "docid": "a9fd70d289a7ea718fbf3ab414529f88", "score": "0.5123913", "text": "def display()\n\t\t@shape.each_index do |r| \n\t\t\t@shape[r].each_index do |c|\n\t\t\t\tif r%2 == 0 # it is an even numbered rows \n\t\t\t\t\tif c%2 == 0 #\n\t\t\t\t\t\tprint '+'\n\t\t\t\t\telsif @shape [r][c] == 1 \n\t\t\t\t\t\tprint '-'\n\t\t\t\t\telse \n\t\t\t\t\t\tprint ' '\n\t\t\t\t\tend \n\t\t\t\telse \n\t\t\t\t\tif @shape [r][c] == 1\n\t\t\t\t\t\tprint '|'\n\t\t\t\t\telse \n\t\t\t\t\t\tprint ' '\n\t\t\t\t\tend \n\t\t\t\tend \n\t\t\tend \n\t\t\tputs ' '\n\t\tend \n\tend", "title": "" }, { "docid": "5a548db48e5d98e4c793a0ba82d41bb1", "score": "0.5123822", "text": "def print_sol_grid\n\t\ts = \"\"\n\t\t@grid.each_with_index do |row, r_ind|\n\t\t\trow.each_with_index do |cell, c_ind|\n\t\t\t\tif @points.include?([r_ind, c_ind])\n\t\t\t\t\ts += \"|%02i|\" % cell\n\t\t\t\telse\n\t\t\t\t\ts += \" %02i \" % cell\n\t\t\t\tend\n\t\t\tend\n\t\t\ts += \"\\n\"\n\t\tend\n\t\tputs s\n\tend", "title": "" }, { "docid": "3d586e74a9cb7fafdb7902aea282df83", "score": "0.5119974", "text": "def print\n\t\t@table.each do |e|\n\t\t\tif e\n\t\t\t\tputs \"#{e.key}: #{e.value}\"\n\t\t\telse\n\t\t\t\tputs \"empty\"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "1f4f7ccd9f425eac83775eca15123a33", "score": "0.5119758", "text": "def display\n puts \" #{self.cells[0]} \" + \"|\" + \" #{self.cells[1]} \" + \"|\" + \" #{self.cells[2]} \"\n puts \"-----------\"\n puts \" #{self.cells[3]} \" + \"|\" + \" #{self.cells[4]} \" + \"|\" + \" #{self.cells[5]} \"\n puts \"-----------\"\n puts \" #{self.cells[6]} \" + \"|\" + \" #{self.cells[7]} \" + \"|\" + \" #{self.cells[8]} \"\n end", "title": "" }, { "docid": "b56aea89cc4199235ae7635bbb8e4f7d", "score": "0.51189905", "text": "def print_answer\n @ysize.times do |y|\n @xsize.times do |x|\n if hint_cell?(x,y)\n print hint_data(x,y)\n # print \"O \"\n else\n c = @model[cvar(x,y)].to_b\n if c\n print \"* \"\n else\n print \"# \"\n end\n end\n\n next if x == @xsize - 1\n if @model[hvar(x,y)].to_b\n print \"-\"\n else\n print \" \"\n end\n end\n print \"\\n\"\n\n next if y == @ysize-1\n @xsize.times do |x|\n if @model[vvar(x,y)].to_b\n print \"| \"\n else\n print \" \"\n end\n end\n\n print \"\\n\"\n end\n end", "title": "" }, { "docid": "f26f5e10c16199d8120edb40ade58ee8", "score": "0.51136255", "text": "def render\n border = \" = = = = = = = = = = =\"\n\n print \" \"\n (0..8).each do |col|\n print \" \" if (col % 3 == 0) && (col != 0)\n print \" #{col}\"\n end\n puts\n \n (0..8).each do |row| \n puts border if (row % 3 == 0) && (row != 0)\n print \"#{row}\"\n\n (0..8).each do |col|\n print (col % 3 == 0) && (col != 0) ? \" | \" : \" \"\n print @grid[row][col].value\n end\n puts\n end\n end", "title": "" }, { "docid": "e2170a8efcf2eedc09af5fc74da8c6b7", "score": "0.51085645", "text": "def show\n self.row_size.times do |row|\n self.column_size.times do |col|\n print \"#{self.table.element(row, col)} \"\n end\n print \"\\n\"\n end\n end", "title": "" }, { "docid": "63692ed0c8ca080d50c11fc45d727872", "score": "0.51002747", "text": "def print_board \n\t\tcount = 1\n\t\trow=''\n\t\t@cells.each do |id,parameters|\n\t\t\trow+= \"| # |\" if @cells[id].content=='ship'\n\t\t\trow+= \"| ~ |\" if @cells[id].content=='water'\t\n\t\t\tif count % @width == 0 \n\t\t\t\tputs row.squeeze('|')\n\t\t\t\trow.clear\n\t\t\tend\n\t\t\tcount+=1\n\t\tend\n\tend", "title": "" }, { "docid": "c4a6d576063c14dc5852a9ae90f8cf6f", "score": "0.5098469", "text": "def display\n\t\tputs\n\t\t@cols .each do |header|\n\t\t\tprint \" #{header.to_s.upcase} \"\n\t\tend\n\t\tputs\n\t\t(0..@height - 1).each do |row|\n\t\t\t(0..@width - 1).each do |col|\n\t\t\t\tprint \"| #{token_colour(col,@height-row-1)} \"\n\t\t\tend\n\t\t\tputs \"|\"\n\t\t\tprint \" \"\n\t\t\t(@width-1).times {print \"-----+\"}\n\t\t\tputs \"----- \"\n\t\tend\n\t\tputs\n\tend", "title": "" }, { "docid": "a3af4e4a539323ffd2645e8c71656ffc", "score": "0.50939393", "text": "def inspect spacing=20, threshold=15\n row_headers = index.is_a?(MultiIndex) ? index.sparse_tuples : index.to_a\n\n \"#<#{self.class}(#{size})#{':category' if category?}>\\n\" +\n Formatters::Table.format(\n to_a.lazy.map { |v| [v] },\n headers: @name && [@name],\n row_headers: row_headers,\n threshold: threshold,\n spacing: spacing\n )\n end", "title": "" }, { "docid": "518746b2e56b1c2360a33631faafa68e", "score": "0.50910825", "text": "def print_row(*vals)\n print '| ', vals.each_with_index.map { |s, i| s.send((i!=1) ? :ljust : :rjust, $cols[i]) }.join(' | '), \" |\\n\"\n end", "title": "" }, { "docid": "3acefe9dae50813b4b93a6e7533a3f4b", "score": "0.5087062", "text": "def print_row(grid_size, dist_from_cen)\n pat_size = grid_size - 2 * dist_from_cen\n pattern = if pat_size == 1\n '*'\n else\n '*' + ' ' * (pat_size - 2) + '*'\n end\n puts pattern.center(grid_size)\nend", "title": "" }, { "docid": "f7783a3d72ad09a21c2cf136cdd01126", "score": "0.5081978", "text": "def print_grid\n\t\ts = \"\"\n\t\t@grid.each do |row|\n\t\t\trow.each do |cell|\n\t\t\t\ts += \"%02i \" % cell\n\t\t\tend\n\t\t\ts += \"\\n\"\n\t\tend\n\t\tputs s\n\tend", "title": "" }, { "docid": "f2a54038f56675de225132dbe55d5330", "score": "0.50652575", "text": "def printRow(rowIndex)\n\n\t\t# left padding\n\t\tprint \" \"\n\n\t\t(0..10).each { |columnIndex|\n\t\t\t# each column index ...\n\t\t\t\n\t\t\t# output horizontal line at rows 3 and 7\n\t\t\tif rowIndex == 3 || rowIndex == 7 then print \"-\"\n\t\t\t\n\t\t\t# output vertical lines at columns 3 and 7\n\t\t\telsif columnIndex == 3 || columnIndex == 7 then print \"|\" \n\t\t\t\n\t\t\t\n\t\t\telsif [1, 5, 9].include? columnIndex and [1, 5, 9].include? rowIndex then\n\t\t\t\t# we are at a X, O, or # location ...\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t# output the value from @mappings at the current spot (will be X, O or a number)\n\t\t\t\tcurrSpot = @mappings.key \"#{columnIndex},#{rowIndex}\"\n\t\t\t\tprint @spotsOnBoard[currSpot]\n\t\t\t\t\n\t\t\t# all other spots on the grid are just a blank space\n\t\t\telse print \" \"\n\t\t\tend\n\t\t}\n\n\t\tputs\n\tend", "title": "" }, { "docid": "e721d2a36662ff56198ef39036867339", "score": "0.5060922", "text": "def df(flag, label=nil)\n s = ''\n if label\n s << label << ':'\n end\n s << (flag ? \"T\" : \"F\")\n s << ' '\n s\nend", "title": "" }, { "docid": "4f07e804993a7083a65311cc65efee6b", "score": "0.5056823", "text": "def print_board\n # Print top number row\n print \"\\n \"\n (1..@n).each { |x| print \"#{x} \"}\n print \"\\n\\n\"\n\n # Print letter column and board\n (0..@n - 1).each do |y|\n letter = (97 + y).chr\n print \" #{letter} \"\n\n (0..@n - 1).each do |x|\n if @cells_grid[y][x] == 0\n print \" \"\n else\n print \"#{@cells_grid[y][x] == 1 ? 'X' : 'O'} \"\n end\n end\n\n print \"\\n\"\n end\n\n print \"\\n\"\n end", "title": "" }, { "docid": "0e7506cb47b08a5e81f98d959f711fa2", "score": "0.50566745", "text": "def qc_head_cols()\r\n s = \"\"\r\n for j in (0..(@@cols-1))\r\n if (j%5 == 0)\r\n s = s + texts2_col(\"\")\r\n end\r\n s = s + texts2b_col((j+1).to_s)\r\n s = s + texts2b_col(\"Bad\") + texts2b_col(\"Pos\") + texts2b_col(\"Neg\") + texts2b_col(\"Desc\")\r\n s = s + texts2b_col(\"\")\r\n end\r\n s\r\nend", "title": "" }, { "docid": "07354a4cd05caa4a1ab878c7ae02f4d1", "score": "0.5056542", "text": "def print_stat_row(label_text, column_data)\n # print label\n printf(\"%-#{@label_width}s\", label_text + \":\")\n\n # print columns of data\n @cached_wrapped_lines = []\n column_data.each {|column| yield column}\n print \"\\n\"\n\n # print wrapped lines if there are any\n num_wrapped_lines = 0\n @cached_wrapped_lines.each do |wrapped_lines|\n num_wrapped_lines += 1 if (!wrapped_lines.nil? && !wrapped_lines.empty?)\n end\n while num_wrapped_lines > 0\n print(\" \" * @label_width)\n next_num_wrapped_lines = 0\n @cached_wrapped_lines.each do |wrapped_lines|\n if wrapped_lines.nil? || wrapped_lines.empty?\n printf(\" \" * @value_width)\n else\n printf(\" %#{@value_width}s\", wrapped_lines.shift)\n next_num_wrapped_lines += 1 if !wrapped_lines.empty?\n end\n end\n print \"\\n\"\n num_wrapped_lines = next_num_wrapped_lines\n end\n @cached_wrapped_lines = nil\n end", "title": "" }, { "docid": "555a0443ee1c86630e2fbe5c29323b3d", "score": "0.50534415", "text": "def display\n num_columns = @map.length\n num_rows = @map[0].length\n for r in (0...num_rows)\n str = \"\"\n for c in (0...num_columns)\n str += @map[c][r]\n end\n puts str\n end\n end", "title": "" }, { "docid": "c4752d905a88bbec67adcd4ec6377484", "score": "0.5052577", "text": "def show\n puts \" 0 1 2 3 4 5 6 7\"\n (0..7).each do |row|\n print row.to_s + \" \"\n (0..7).each do |col|\n position = [row, col]\n checker = at(position)\n unless checker.nil?\n if checker.color == :black\n unless checker.royalty\n print \"\\u2B24 \".colorize(:background => :cyan, :color => :black) # circle\n else\n print \"\\u265B \".colorize(:background => :cyan, :color => :black) # crown\n end\n elsif at([row, col]).color == :red\n unless checker.royalty\n print \"\\u2B24 \".colorize(:background => :cyan, :color => :light_red) # circle\n else\n print \"\\u265B \".colorize(:background => :cyan, :color => :light_red) # crown\n end\n end\n else\n if (row + col) % 2 == 1\n print \" \".colorize(:background => :cyan)\n else\n print \" \".colorize(:background => :white)\n end\n end\n end\n print \"\\n\"\n end\n end", "title": "" }, { "docid": "a56b26eb1688cbe99e89a7ad864ba09f", "score": "0.50412965", "text": "def display\n\t\tputs \" #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} \"\n\tend", "title": "" }, { "docid": "0ab5f15d4cec30a248f80a9377ddd071", "score": "0.5037942", "text": "def print_row row\n\t@checkers_state[row].split(\"\").each do |num|\n\t\tif num == \"0\"\n\t\t\tprint \" |\"\n\t\telsif num == \"1\"\n\t\t\tprint \"\\u2B24 |\"\n\t\telsif num == \"2\"\n\t\t\tprint \"\\u25EF |\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "0ab5f15d4cec30a248f80a9377ddd071", "score": "0.5037942", "text": "def print_row row\n\t@checkers_state[row].split(\"\").each do |num|\n\t\tif num == \"0\"\n\t\t\tprint \" |\"\n\t\telsif num == \"1\"\n\t\t\tprint \"\\u2B24 |\"\n\t\telsif num == \"2\"\n\t\t\tprint \"\\u25EF |\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "58f52012f10b5e1ee386e134b344aa8b", "score": "0.5033114", "text": "def display_table lines, headers\n lines.unshift headers if headers\n #col widths\n col_widths = lines.first.each_with_index.map do |_, col_ind|\n lines.reduce(0){|acc, line| ((line[col_ind].length > acc) ? line[col_ind].length : acc)} + 1\n end\n width = col_widths.reduce(1){|acc, col_length| acc + col_length + 2}\n #display\n lines.each do |line|\n puts '-'*width\n line.each_with_index do |content, ind|\n print '|'\n print ' ' + \"%-#{col_widths[ind]}.#{col_widths[ind]}s\" % content\n end\n puts '|'\n end\n puts '-'*width\nend", "title": "" }, { "docid": "a5b1acb149d143585b38a6492f9ffc0c", "score": "0.50288844", "text": "def displayPositionTable(tab)\n # deep copy of array before we change it (dup and clone give pointer to the same array)\n newTab= Marshal.load Marshal.dump(tab)\n tab.each_with_index { |row, rr|\n tab[rr].each_with_index { |well, cc|\n #show {note \"tab rr=#{rr}, cc=#{cc}, well=#{well}\"}\n rrWell=\"A\".ord.to_i + rr # asscii value for A-H, use .chr to convert to asscii character\n ccWell=cc+1 # number\n if(well>0)\n newTab[rr][cc]={ content: \"#{rrWell.chr}#{ccWell}\", style: {background: \"#e6e6ff\" } } # light purple, white is \"#ffffff\" \n else(well==-1)\n newTab[rr][cc]={ content: \"#{rrWell.chr}#{ccWell}\", style: {background: \"#000000\" } } # black\n #else # not sure if default for unpopulated matrix is -1 or 0, so making both black\n # newTab[rr][cc]={ content: \"#{rrWell.chr}#{ccWell}\", style: {background: \"#ff0000\" } } # red\n end\n }\n }\n return newTab\n end", "title": "" }, { "docid": "77247a3e984e7841637ade33a84aca04", "score": "0.5027355", "text": "def print_layout_row_suffix\n [{ code: :nda_ex_yes_no, lookup: true, when: :exempt_breakdown_needed?, is: [true] },\n { code: :nda_ex_tonnage, when: :nda_ex_details_needed?, is: [true] },\n { code: :restoration_ex_yes_no, lookup: true, when: :exempt_breakdown_needed?, is: [true] },\n { code: :restoration_ex_tonnage, when: :restoration_ex_details_needed, is: [true] },\n { code: :other_ex_yes_no, lookup: true, when: :exempt_breakdown_needed?, is: [true] },\n { code: :other_ex_tonnage, when: :other_ex_details_needed?, is: [true] },\n { code: :other_ex_description, when: :other_ex_details_needed?, is: [true] }]\n end", "title": "" }, { "docid": "20c16d6244e5510c116d0a3c1a7cc170", "score": "0.50254345", "text": "def pretty_print\n\t\tdim = @orientation == :row ? 1 : 0\n\t\t\n\t\tputs (0...shape[dim]).inject(Array.new) { |a, i| a << self[i] }.join(' ')\n\tend", "title": "" }, { "docid": "558f9c6c0bc4d9b7b41bd7c0988b6ad2", "score": "0.50245184", "text": "def display_grid(size)\n (1..size**2).each do |i|\n (i % size).zero? ? ((puts \"| #{cells.flatten[i - 1]} |\") or puts) : (print \"| #{cells.flatten[i - 1]} \")\n end\n end", "title": "" }, { "docid": "93b8ea8d71977b7c910d99c724612660", "score": "0.5023352", "text": "def print_grid(data)\n chr_id = 97 # => 'a'\n\n puts \"#{' ' * (INDENT + 5)}#{[*1..10].join(' ')}\"\n puts div = \"#{' ' * (INDENT + 3)}#{'+---' * 10}+\"\n\n data.each do |row|\n puts \"#{' ' * INDENT}#{chr_id.chr} | #{row.map { |x| x || ' ' }.join(' | ')} |\\n#{div}\"\n chr_id += 1\n end\nend", "title": "" }, { "docid": "78b6555309dc920b2df155bfaa8909ec", "score": "0.50225633", "text": "def print_row(row)\n column = 1\n\t\ti= 0\n\n while i< 8 do \n # Printing each field from the row\n \n\t \tprint @nha[i][column]\n print \" | \" unless column ==8\n column += 1\n\t \ti+=1\n\t\tend\n end", "title": "" }, { "docid": "edc9266e9dcacc0eeb2a184876ab6e23", "score": "0.5012184", "text": "def display\n puts \" #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} \"\n puts \"-----------\"\n puts \" #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} \"\n puts \"-----------\"\n puts \" #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} \"\n end", "title": "" }, { "docid": "d8ac81ee8d3e9a462fca09f6eaf4606d", "score": "0.501215", "text": "def to_html(threshold=50)\n html = \"<html><table><tr><td></td>\"\n html += @labels.map{|label| \"<th>\" + label.to_s + \"</th>\"}.join\n html += \"</tr>\"\n self.each_row.with_index do |row, pos|\n next if pos > threshold && pos != self.length-1\n html += \"<tr><th>\" + @index[pos].to_s + \"</th>\"\n html += @labels.map{|label| \"<td>\" + row[label].to_s + \"</td>\"}.join\n html += \"</tr>\"\n html += \"<tr><th>...</th>\" + \"<td>...</td>\"*@labels.length + \"</tr>\" if pos == threshold\n end\n html += \"</table>\"\n end", "title": "" }, { "docid": "60663c13c46bf0bf1fc2d35c15ebfc9e", "score": "0.50101435", "text": "def print_grid(game_board)\n game_board.each_with_index do |row, index|\n row.map!{|gamespot| gamespot.nil? ? \" \": gamespot}\n puts row.join(\"|\")\n puts \"------\"\n end\n end", "title": "" }, { "docid": "10a6800cc6e18dcbedd80dc0e801b232", "score": "0.500978", "text": "def print_table\n if @list.size == 0 \n puts \"empty list\"\n else\n calculate_format_string\n print_header\n \n @list.each do |column_num|\n print_row(column_num)\n end\n end\n end", "title": "" }, { "docid": "8975d2d5cb5b549ade6f89094e611684", "score": "0.5007241", "text": "def d_lbl_pos; end", "title": "" }, { "docid": "22a8fe9b68e2c8cbf7adad5a7fdedb6f", "score": "0.500565", "text": "def display\n puts \"GENERATION:#{@generation}\\tPOPULATION:#{@population}\"\n puts \"INVALID!\"if @invalid\n\n @counter.each do |row|\n puts row.map { |cell| ((cell == 0 || cell == 2) ? ' ' : 'X') }.join('')\n end\n end", "title": "" }, { "docid": "9c2ef52788a670565dcda27a4adc89b7", "score": "0.49859256", "text": "def display_position\n # Turn the tableau vertically\n tableau = @current_state[:position].transpose\n first_row = true\n # Print each row, with line after top row\n tableau.each do |row|\n row_icons = row.map { |card| self.class::CARD_ICON[card] }\n puts row_icons.join(\" \")\n if first_row\n puts \"-----\"\n first_row = false\n end\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b5d9bbd023c34828d5aac75c564af296", "score": "0.0", "text": "def answer_params\n params.permit(:answer, :question_id , :user_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
b0e47890c314358020c16adc54fca4de
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Menu OPTION 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ { "docid": "7224f2e2ec754e2a654be7b85fb94829", "score": "0.0", "text": "def create_story\n puts ''\n puts 'What is the name of your new story?'\n input = gets.chomp\n s = Story.find_or_create_by(story_name: input, user_id: @user.id)\n @user = User.find(@user.id)\n puts ''\n puts \"You have created the story #{s.story_name}\"\n sleep(1)\nend", "title": "" } ]
[ { "docid": "50cfa32bd4075d190ea1f7160719068d", "score": "0.72473437", "text": "def second_case_menu(selection)\n case selection\n when 'Export To File'\n export_to_file\n when 'Back'\n menu = Menu.new(@user)\n menu.menu_router\n end\n end", "title": "" }, { "docid": "8f6acaa58d44b67d9da2775a91c16a21", "score": "0.7051575", "text": "def main_menu\n @ui.input_1_change\n @ui.user_input1.downcase\n unless %w[trains routes stations cars].include? @ui.user_input1\n puts 'There is no such option in the main menu.'\n end\n main_menu_choose_option(@ui.user_input1)\n end", "title": "" }, { "docid": "9e9add48da4bade38852c8859ca8eb8b", "score": "0.6908256", "text": "def menu_selection \nend", "title": "" }, { "docid": "9184e9583f1031d4833c95163542dd60", "score": "0.6903974", "text": "def printMenu\n\t\tself.report(\"\n\t\tEscolha uma opção\n\t\t1 - Trocar palavra-chave.\n\t\t2 - Ver palavra-chave.\n\t\t3 - Ver arquivo.\n\t\t4 - Sair.\n\t\t? \", 1)\t\t\n\tend", "title": "" }, { "docid": "ed85fc4ab766fc550d37bb39a9898117", "score": "0.6868016", "text": "def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end", "title": "" }, { "docid": "9f3589337957424feca52f0ac079c4c9", "score": "0.6867956", "text": "def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend", "title": "" }, { "docid": "02e4f4e8e5b43883e006676f1eb35f19", "score": "0.6846791", "text": "def main_menu\n selection = input(@menu) {|o| (1..2) === o.to_i }.to_i\n \n if 1 == selection\n :continue\n elsif 2 == selection\n :quit\n end\n end", "title": "" }, { "docid": "6238d3147a27802a86129cb6d4cea176", "score": "0.67471045", "text": "def sub_menu(choise)\n case choise\n when '1'\n make_route\n when '2'\n make_station\n when '3'\n make_train\n when '4'\n list_routes\n when '5'\n list_stations\n when '6'\n list_trains\n when '7'\n list_station_trains\n when '8'\n attach_station\n when '9'\n dettach_station\n when '10'\n attach_train\n when '11'\n attach_wagon\n when '12'\n dettach_wagon\n when '13'\n list_train_wagons\n when '14'\n occupy_train_wagon\n when '15'\n move_train\n else\n puts \"Введено некорректное значение меню\\n\\n\"\n end\n end", "title": "" }, { "docid": "95d2217e0ad588bb79eb0d1a47e1a63d", "score": "0.6744857", "text": "def action_A_menu\n case @intern_mode\n when :choose_move_pokemon\n action_move_current_pokemon\n when :choose_move_item\n return $game_system.se_play($data_system.buzzer_se) if @team_buttons[@index].data.item_holding == 0\n @team_buttons[@move = @index].selected = true\n @intern_mode = :move_item\n @base_ui.show_win_text(text_get(23, 22))\n when :move_pokemon\n process_switch\n when :move_item\n process_item_switch\n else\n $game_system.se_play($data_system.decision_se)\n return show_choice\n end\n $game_system.se_play($data_system.decision_se)\n end", "title": "" }, { "docid": "fe61ed11f9a72e6c5a87080d6d7a7a50", "score": "0.673575", "text": "def menuAOption\n\t\tmenu = @menuStack.pop\n\t\t@menuStack.push(menu)\n\t\toption = menu.getOption\n\t\tcase option\n\t\twhen \"Magic\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@selectMagicBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextMagicSublist, @screen)\n\t\t\t@menuStack.push(@selectMagicBox)\n\t\twhen \"Attack\"\n\t\t\t@hero.nextCommand.push(option) \n\t\t\tif @enemyUnits.length > 1\n\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\telse\n\t\t\t\tsetCombat\n\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\n\t\t\tend\n\t\twhen \"Run\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\tsetCombat\n\t\twhen \"Item\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@subMenuIndex = 0\n\t\t\t@selectItemBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextItemSublist, @screen)\n\t\t\t@menuStack.push(@selectItemBox)\n\t\telse\n\t\t\tif (option != \"\")\n\t\t\t\tif (option.class < Unit)\n\t\t\t\t\t@hero.nextCommand.push([option])\n\t\t\t\t\tsetCombat\n\t\t\t\telse\n\t\t\t\t\ttargetType = option.getTargetType\n\t\t\t\t\tcase targetType\n\t\t\t\t\twhen \"self\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\t@hero.nextCommand.push([@hero])\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"all\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\ttargets = []\n\t\t\t\t\t\t@enemyUnits.each { |unit| targets.push(unit) }\n\t\t\t\t\t\t@hero.nextCommand.push(targets)\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"enemy\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\tif @enemyUnits.length > 1\n\t\t\t\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsetCombat\n\t\t\t\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\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\tend", "title": "" }, { "docid": "d0c32e656ebd8e52d30a4352e03fd20f", "score": "0.6676113", "text": "def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\n end", "title": "" }, { "docid": "1bf5c45c3217cf6e499ad37ca7f8ae93", "score": "0.6658178", "text": "def main_menu\n\t\tputs '################################'\n\t\tputs '######### Tic Tac Toe ##########'\n\t\tputs '################################'\n\t\tputs '================================'\n\t\tputs '== Choose your weapon warrior =='\n\t\tputs '================================'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '^^^^^^ Type Your Choice: ^^^^^^^'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '$$$$$$$$$$$ 1. \"X\" $$$$$$$$$$$$$'\n\t\tputs '$$$$$$$$$$$ 2. \"O\" $$$$$$$$$$$$$'\n\t\tputs '--------------------------------'\n\tend", "title": "" }, { "docid": "1f86b2d4a4ded52ee41937e34e4039e4", "score": "0.6648297", "text": "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "title": "" }, { "docid": "aeb008e5d92336a52f67d205ecf1d3d2", "score": "0.664251", "text": "def manage_account_menu\n choice = @prompt.select(\"Please choose from the following options:\") do |menu|\n menu.choice 'Change my name'\n menu.choice 'Change my password'\n menu.choice 'Delete my account'.blue\n menu.choice \"Back to Main Menu\"\n end\n\n if choice == \"Change my name\"\n change_name\n elsif choice == \"Change my password\"\n change_password\n elsif choice == \"Delete my account\".blue\n delete_account\n elsif choice == \"Back to Main Menu\"\n start_menu\n end\nend", "title": "" }, { "docid": "b20e24343192e94ef9dea41de101e993", "score": "0.6638833", "text": "def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # Give option\n giv_check = proc { $pokemon_party.pokemon_alive <= 0 || !GameData::Item[item_id].holdable }\n # Unregister / register\n if $bag.shortcuts.include?(item_id)\n reg_id = 14\n reg_meth = method(:unregister_item)\n else\n reg_id = 2\n reg_meth = method(:register_item)\n reg_check = map_usable\n end\n # Throw option\n thr_check = proc { !GameData::Item[item_id].limited }\n # Create the choice\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 0), on_validate: method(:use_item), disable_detect: map_usable)\n .register_choice(text_get(22, 3), on_validate: method(:give_item), disable_detect: giv_check)\n .register_choice(text_get(22, reg_id), on_validate: reg_meth, disable_detect: reg_check)\n .register_choice(text_get(22, 1), on_validate: method(:throw_item), disable_detect: thr_check)\n .register_choice(text_get(22, 7))\n # Show selection : item_name\n @base_ui.show_win_text(parse_text(22, 35, PFM::Text::ITEM2[0] => GameData::Item[item_id].exact_name))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text\n hide_shadow_frame\n end", "title": "" }, { "docid": "d764e9d9dbb3c46625e0a6081a257fae", "score": "0.6632805", "text": "def case_menu(selection)\n case selection\n when 'Playlist'\n @playlist.menu\n when 'Account Details'\n account_details\n when 'Exit'\n p \"Is this exiting?\"\n end\n end", "title": "" }, { "docid": "0aa8e560b5141402e1cfc63d5c425d6e", "score": "0.6594498", "text": "def toggle_menu menu_text=nil\n unless menu_text\n h = { \n # :h => :toggle_hidden, \n :c => :toggle_case, :l => :toggle_long_list , \"1\" => :toggle_columns, \n :g => :use_gui_browser, :t => :use_text_browser}\n ch, menu_text = menu \"Toggle Menu\", h\n end\n case menu_text\n when :toggle_hidden\n $hidden = $hidden ? nil : \"D\"\n refresh\n when :toggle_case\n #$ignorecase = $ignorecase ? \"\" : \"i\"\n $ignorecase = !$ignorecase\n refresh\n when :toggle_columns\n $gviscols = 3 if $gviscols == 1\n $long_listing = false if $gviscols > 1 \n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n when :use_gui_browser\n $open_command = $browser_gui || \"open\"\n when :use_text_browser \n $open_command = $browser_text || \"elinks\"\n\n when :toggle_long_list\n $long_listing = !$long_listing\n if $long_listing\n $gviscols = 1\n $pagesize = $grows\n else\n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n end\n refresh\n end\nend", "title": "" }, { "docid": "5327b8c1154e785abb75a2fd786e5371", "score": "0.65807927", "text": "def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend", "title": "" }, { "docid": "1cbf7368fd02edb24e99d39f8bf9900a", "score": "0.6573065", "text": "def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end", "title": "" }, { "docid": "d009c11013b1eda9e4b19a22ec169df2", "score": "0.6569419", "text": "def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\n puts \"s = Save Recipe to My Favorites\".colorize(:blue)\n puts \"r = Rate Recipe\".colorize(:blue)\n puts \"a = See Average Recipe Rating\".colorize(:blue)\n puts \"o = Open Link to See the Steps for This Recipe\".colorize(:blue)\n puts \"m = Back to Main Menu\".colorize(:blue)\n puts \"***********************************************\\n \".colorize(:magenta).blink\n end", "title": "" }, { "docid": "d5d9833897b63609f1a974dccd3b2a11", "score": "0.65542775", "text": "def menu\n system('clear')\n selection = @prompt.select('》 PLAYLIST 《', ['Display', 'Add', 'Remove', 'Export To File', 'Back'])\n case selection\n when 'Display'\n list\n else\n case_menu(selection)\n end\n end", "title": "" }, { "docid": "ac1e3dd2e00a70ffa454b5d44f722c96", "score": "0.65381587", "text": "def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend", "title": "" }, { "docid": "e4015b56d0b5c0c4c7c6ee216f379d89", "score": "0.6536058", "text": "def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end", "title": "" }, { "docid": "cf1fe88cbedca0403e9010081dc1124b", "score": "0.65145236", "text": "def choice_y_menu\n play_decision_se\n show_shadow_frame\n @base_ui.show_win_text(text_get(22, 79))\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 81), on_validate: method(:sort_name))\n .register_choice(text_get(22, 84), on_validate: method(:sort_number))\n .register_choice(ext_text(9000, 151), on_validate: method(:sort_favorites))\n .register_choice(text_get(33, 130), on_validate: method(:search_item))\n .register_choice(text_get(22, 7))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choice = choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text if choice != SEARCH_CHOICE_INDEX\n hide_shadow_frame\n end", "title": "" }, { "docid": "779ea312c2af306f8c65f19627af098c", "score": "0.65059197", "text": "def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend", "title": "" }, { "docid": "265d7bbb0a395bec4fc3b2c635639b06", "score": "0.64883", "text": "def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end", "title": "" }, { "docid": "c44e92f70ee80f7128582bad5dc93b24", "score": "0.64862394", "text": "def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend", "title": "" }, { "docid": "6fe35894f5728699b7de0fd5110003d4", "score": "0.6483572", "text": "def action_menu(choice,phonebook)\n case choice\n when \"1\"\n show_cities(phonebook)\n when \"2\"\n show_area_code(phonebook)\n else\n puts \"Invalid choice! Example: Type \\\"1\\\" to list all cities available. \\n\\n\"\n end\nend", "title": "" }, { "docid": "e63870ed0d19b6378805dd7942696b16", "score": "0.64817035", "text": "def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend", "title": "" }, { "docid": "4ef1948cdba81bd113345e70d33d25b2", "score": "0.6457344", "text": "def menu # can do custom methods within a method/class\n end", "title": "" }, { "docid": "d55ceebb54b04882bed77ddb64ef0988", "score": "0.64463955", "text": "def assigned_menu\n\n end", "title": "" }, { "docid": "d619abd924ce6ef8da6a7f63ce830689", "score": "0.6444059", "text": "def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend", "title": "" }, { "docid": "2742a69196c963c221048283df575ccd", "score": "0.64359087", "text": "def start_menu\n printf \"\\nPrograma para a disciplina de LPD\\n\"\n printf \"Choose one option\\n\"\n printf \"------------------------------------\\n\"\n printf \"1) Insert user\\n\"\n printf \"2) Login user\\n\"\n printf \"3) Delete user\\n\"\n printf \"0) Exit\\n\"\nend", "title": "" }, { "docid": "7d07cc04b783e40e317fcebf601c202d", "score": "0.6431549", "text": "def display_action_menu(player1, player2)\n puts \"\\nQuelle action veux-tu effectuer ?\"\n puts \"a - chercher une meilleure arme\"\n puts \"s - chercher à se soigner\"\n puts \"\\nattaquer un joueur en vue :\"\n print \"0 \"\n player1.show_state if player1.life_points > 0\n print \"1 \"\n player2.show_state if player2.life_points > 0\n end", "title": "" }, { "docid": "7f4fabb72d86fee5977c151b68e661e4", "score": "0.6429104", "text": "def menu_options()\n print_message 'Select operation to perform'\n print_message '1. Add'\n print_message '2. Substract'\n print_message '3. Multiply'\n print_message '4. Divide'\n print_message \"Or press 'q' to exit calculator app\"\n end", "title": "" }, { "docid": "e23e3ad4256aa7f632c5434605eee06c", "score": "0.6428962", "text": "def main_menu\n main_menu_options = {'Interact with Existing Kits' => :list_and_select_kit,\n 'Create a new Kit' => :prompt_kit_params, \n 'Quit' => :quit}\n \n op = @io.select_from_options(\"What would you like to do?\", main_menu_options)\n @operation_stack.unshift op\n \n # return nil, because there's nothing to pass onto the next method\n return\n end", "title": "" }, { "docid": "983d7fa2a4e10183a98d74e7c16cbc8f", "score": "0.6415456", "text": "def case_menu(selection)\n case selection\n when 'Add'\n add\n when 'Remove'\n remove\n else\n second_case_menu(selection)\n end\n end", "title": "" }, { "docid": "85e613a607e6d7cd56d946a52e452834", "score": "0.64001286", "text": "def main_menu\n\tputs \"\\n1 Library\\n2 Staff Members\\n3 Books\\n4 Patrons\\n0 Exit\\n\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tlibrary_choice = \"9\"\n\t\twhile library_choice != \"0\"\n\t\t\tlibrary_choice = select_choice_library\n\t\tend\n\n \telsif select == \"2\"\n\t\tstaff_member_choice = \"9\"\n\t\twhile staff_member_choice != \"0\"\n\t\t\tstaff_member_choice = select_choice_staff_member\n\t\tend\n\n\n\telsif select == \"3\"\n\t\tbook_choice = \"9\"\n\t\twhile book_choice != \"0\"\n\t\t\tbook_choice = select_choice_book\n\t\tend\n\n\n\telsif select == \"4\"\n\t\tpatron_choice = \"9\"\n\t\twhile patron_choice != \"0\"\n\t\t\tpatron_choice = select_choice_patron\n\t\tend\n\n\n\telsif select == \"0\"\n\t\tputs \"\\nGoodbye\"\t\t \t\t\n\tend\n\tselect \nend", "title": "" }, { "docid": "5d8e3304c42ffc8d3f144cd27193957d", "score": "0.63761187", "text": "def action_A\n case @mode\n when :menu\n action_A_menu\n else\n $game_system.se_play($data_system.decision_se)\n show_choice\n end\n end", "title": "" }, { "docid": "a8a087277130cc9de85873c784a082ea", "score": "0.6373212", "text": "def options(choice)\n\t\tif choice == 1\n\t\t\trename_submenu\n\t\telsif choice == 2\n\t\t\tadd_task_submenu\n\t\telsif choice == 3\n\t\t\tcomplete_submenu\n\t\telsif choice == 4\n\t\t\tuncomplete_submenu\n\t\telsif choice == 5\n\t\t\tprioritize_submenu\n\t\telsif choice == 6\n\t\t\tnormalize_submenu\n\t\telsif choice == 7\n\t\t\tdue_date_submenu\n\t\telsif choice == 8\n\t\t\tremove_date_submenu\n\t\telsif choice == 9\n\t\t\tdelete_task_submenu\n\t\telse\n\t\t\tputs \"Enjoy your day\"\n\t\tend\n\tend", "title": "" }, { "docid": "8b0564e4e6aaeecc2ee71704ec1b439b", "score": "0.63687134", "text": "def print_menu_options\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"1) Rename List | 2) Add task \"\n\t\tputs \"3) Complete task | 4) Uncomplete task\"\n\t\tputs \"5) Prioritize task | 6) Normalize task \"\n \t\tputs \"7) Add due date | 8) Remove due date\"\n\t\tputs \"9) Delete task | 0) Exit\"\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"Enter choice: \"\n\t\tchoice = get_choice.to_i\n\t\toptions choice\n\tend", "title": "" }, { "docid": "352333eb05843b3dc9b562cd3dffd4b9", "score": "0.63543546", "text": "def menu\n # This uses a HEREDOC for multiline listing\n puts \"-------------------------\".colorize(:green) \n puts <<-MENU\n\nChoose a how you would like to see a card. You can view by name, creature, enchantment or sorcery:\n1. See cards by Name \n2. See cards by Creature \n3. See cards by Enchantment \n4. See cards by Sorcery\n\nOr type 'exit' at any time to leave the program. Type 'menu' to return to the main menu.\n MENU\n end", "title": "" }, { "docid": "c692ecde39b368084d72e7e3819705bc", "score": "0.6351302", "text": "def print_menu\n print <<MENU\n \\nPlease choose one of the following options:\n 1. Encrypt\n 2. Decrypt\n 3. Exit\nMENU\nend", "title": "" }, { "docid": "251cf76ab141a72f0320f3f7b1c240e8", "score": "0.6338758", "text": "def options_menu(noteboard)\n @start_prompt = TTY::Prompt.new\n @start_prompt.select(\"What do you want to do now?\") do |menu|\n menu.choice \"Load existing noteboards\", -> {noteboard_menu}\n menu.choice \"Add new note\", -> {Noteboard.noteboard_add(add_note)}\n menu.choice \"Delete note\", -> {Noteboard.noteboard_delete(delete_note)}\n menu.choice \"Back\", -> {StartMenu.new}\n end\nend", "title": "" }, { "docid": "c5634d200d475d21438f611c45083814", "score": "0.6317217", "text": "def main_menu\n menu_options = [\"Start exploring\", \"Check Inventory\", \"Check Your Score\", \"Go to Pokemon Center\", \"Quit\"]\n menu_prompt = Interactivity.mainMenu \n \n if user.pokemon == nil\n menu_options.shift()\n menu_options.unshift(\"Choose a Pokemon and start exploring\")\n elsif self.user_current_location\n menu_options.shift()\n menu_options.unshift(\"Keep Exploring\")\n end\n \n choice = prompt.select(menu_prompt, menu_options) \n if choice == \"Start exploring\" || choice == \"Choose a Pokemon and start exploring\" || choice == \"Keep Exploring\"\n self.trainer_chooses_pokemon if user.pokemon == nil \n self.trainer_chooses_town\n self.exploring_town\n elsif choice == \"Check Inventory\"\n puts \"MANAGE INVENTORY - CHANGE POKEMONS AROUND\"\n elsif choice == \"Go to Pokemon Center\"\n self.pokemon_center\n elsif choice == \"Check Your Score\"\n puts \"CHECK YOUR SCORE\"\n else\n Interactivity.quit\n end\n end", "title": "" }, { "docid": "21b67567e93ab3cdf87a1626beee6759", "score": "0.6310728", "text": "def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend", "title": "" }, { "docid": "fda1b3ee490ad78d3076d1d08375a312", "score": "0.6309034", "text": "def getMenu(menu)\n end", "title": "" }, { "docid": "a0cf348001eb9b459e839647ca1d8bd3", "score": "0.63058275", "text": "def menu_list \n puts \"Please select from the following options: \"\n puts \" Enter '1' to create a new donation!\"\n puts \" Enter '2' to see a list of the organizations accepting donations\"\n puts \" Enter 'exit' if you changed your mind and wish to leave the app\"\n puts \" To see the menu options again, please enter 'menu'\"\nend", "title": "" }, { "docid": "769afb038e3fc3f62a3302d54a8f4ad5", "score": "0.63048047", "text": "def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend", "title": "" }, { "docid": "e6340183af183062ff1edc665441ade2", "score": "0.6296924", "text": "def menuScreen\n @levelNo=1\n clearScreen\n puts \"You are at the menu for Sokoban\"\n puts \"To quick play: Press 'p'\"\n puts \"To choose a level: Press 'c'\"\n puts \"To stop: Press 'q'\"\n charPressedInMenu\nend", "title": "" }, { "docid": "0cd1e46c88e655e8146a9cd38971635b", "score": "0.6296862", "text": "def main_menu\n choice = true\n while choice\n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, or (E)xit \"\n options = gets.chomp.downcase\n\n case options\n when \"c\"\n # runs method create line 101\n create\n when \"l\"\n #runs method list line 144\n list\n when \"u\"\n #runs method update line 161\n update\n when \"d\"\n #runs method delete line 229\n delete\n when \"e\"\n choice = false #exits world\n else\n puts \"Wrong Input. Please input C, L, U, D or E\"\n end\n end\n end", "title": "" }, { "docid": "6add033baf29829a4d7c60921b504622", "score": "0.6295363", "text": "def menu\n \n \n\nend", "title": "" }, { "docid": "a71a3cb6ce66129b39a6bc2874b7f623", "score": "0.62881744", "text": "def menu_options\n puts \"Good morning, you have two options; you can either\"\n puts \"1. Add students to the directory\\n 2. View a list of students enrolled at Makers Academy\\n 3. Save the list of students to a file\\n 9. Exit the programme.\"\n puts \"Please type the option you would like?\"\nend", "title": "" }, { "docid": "7639a06a05bd657b07045552f06f7aaa", "score": "0.6287903", "text": "def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend", "title": "" }, { "docid": "46ead55d057965a969241ff15b5ab78f", "score": "0.62681514", "text": "def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend", "title": "" }, { "docid": "1949baf0bbb8605a1ad5ae9bb897d8d2", "score": "0.62634367", "text": "def action\n (@current_level = 'X' ; return) if ( @user_choice == 'X' || @user_choice == 'x')\n\n (menu_level_left ; return) if @user_choice == \"\\e[D\"\n\n tmp_lvl = @current_level + '.' + @user_choice\n cmd = @menu_map[tmp_lvl][1]\n cmd ? execute_action(cmd) : @current_level = tmp_lvl\n end", "title": "" }, { "docid": "113b2f538dcbc54054112e975065ad3a", "score": "0.62621886", "text": "def menu\n \nend", "title": "" }, { "docid": "1ed144225c5f194b52c5b0c23c4cc3d1", "score": "0.6261635", "text": "def setMenu\n\t\t@phase = \"menu\"\n\t\t@dialogueText.setText([\"What will you do?\"])\n\t\t@menuStack.push(@battleOptions)\n\t\t@enemyUnits = @battleManager.enemyUnits\n\t\t@hero.nextCommand = []\n\tend", "title": "" }, { "docid": "16582ced848f265b03cdaec6aacf1b10", "score": "0.62518615", "text": "def set_menu _menu_name\n send_cmd(\"set_menu #{_menu_name}\")\n end", "title": "" }, { "docid": "88a146ca9e785f4d4fe786e1e544aeed", "score": "0.6251805", "text": "def main_menu\n @active = 0\n @prompt.select(\"\\nWhat would you like to do?\\n\".blue) do |menu|\n menu.choice \"Check out what's on today\", -> {today_menu} \n menu.choice \"Check out things to do on the weekend\", -> {weekend_menu}\n menu.choice \"Look at my favourites\", -> {display_favorites}\n menu.choice \"Exit\".red, -> {leave_app} \n end \n end", "title": "" }, { "docid": "5698ab004c0a2b578f39dd3862562742", "score": "0.6240497", "text": "def menu\n\tputs \"Quelle action veux-tu effectuer?\"\n\tputs \"\\n\"\n\tputs \"a - chercher une meilleure arme\"\n\tputs \"s - chercher à se soigner\"\n\tputs \"\\n\"\n\tputs \"attaquer un joueur en vue :\"\n\ti = 0\n\tenemies_in_sight.each do |enemy|\n\t\ti +=1\n\t\tputs \"#{i} - #{enemy.name} a #{enemy.life_points} points de vie.\"\n\tend\n\tputs \"Fais ton choix\"\n\tprint \">\"\n\tend", "title": "" }, { "docid": "8f92955920e98d03b92ab6a42f10a069", "score": "0.62395805", "text": "def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend", "title": "" }, { "docid": "5cf91af6bcbabf2baba81cb9d281c00c", "score": "0.6236597", "text": "def show_com_menu\n TactBattleManager.selecting(true)\n show_tb_command_window_tb\n end", "title": "" }, { "docid": "a9c9ea86a71fcf4c02c23db9019aee9b", "score": "0.623553", "text": "def display_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Add Code'\n menu.choice 'Edit Code'\n menu.choice 'Remove Code'\n menu.choice 'Search'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend", "title": "" }, { "docid": "ed818e66b93122d482cb4a364e5755cc", "score": "0.6233021", "text": "def create_menu\n h = { f: :create_a_file,\n d: :create_a_dir,\n s: :create_dir_with_selection,\n b: :create_bookmark }\n _, menu_text = menu 'Create Menu', h\nend", "title": "" }, { "docid": "99b8653363969354627838158c6d20f0", "score": "0.62282014", "text": "def init_menu\n @menus.set_selected(\"about\")\n end", "title": "" }, { "docid": "139942d761c2b6ca255b3aba1a23cb91", "score": "0.62279093", "text": "def display_main_menu_choice\n #The disabled choice will be displayed with a cross ✘ character next to it and followed by an explanation:\n menu_choices = [\n 'First Time User, Want To Register',\n 'Already A Registered User, Want To Login',\n # { name: 'Goro', disabled: '(injury)' },\n 'Do Not Wish To Register, Just Browsing',\n 'Looking For Info About The App',\n 'Nothing Really, Spare Me Your @?%#&?|%!'\n ]\n choice_msg = 'What Will It Be, We Offer A Great Many Choices!'\n # system \"say #{choice_msg}\"\n main_menu_choice = prompt.select('What Will It Be, We Offer A Great Many Choices!'.colorize(:color => :light_blue), menu_choices)\nend", "title": "" }, { "docid": "22a3c817dec68037cc50038c64a6caf4", "score": "0.6227487", "text": "def show_admin_menu\n puts \"-\"*80\n puts \"¿Que deseas hacer?\"\n puts \"-\"*80\n puts \"1) Mostrar todos los vuelos\"\n puts \"2) Mostrar todas las reservaciones\"\n puts \"3) Agrega un vuelo\"\n puts \"4) Salir\"\n # puts \"5) Borrar vuelos\"\n # puts \"6) Borrar reservaciones\"\n\n puts \n puts \"Selecciona opción:\"\n input = gets.chomp\n input\n end", "title": "" }, { "docid": "a9ede551a4dc3258fa7e3f554e79f39b", "score": "0.62253714", "text": "def main_menu\n menu = [\n \"My Stats\",\n \"My Hikes\",\n \"Trails\",\n \"Quit\"]\n choice = nil\n while choice != \"Quit\"\n system 'clear'\n puts \"------MAIN MENU------\"\n choice = @prompt.select(\"What would you like to do #{@current_user.name}?\", menu)\n\n case choice\n when \"My Stats\"\n user_stats\n when \"My Hikes\"\n hike_options\n when \"Trails\"\n trail_options\n end\n end\n end", "title": "" }, { "docid": "1f7df6b2bc465f9157c35643c129f640", "score": "0.62249255", "text": "def op_menu\n loop do\n case Prompts.op_selection\n when '1'\n user = User.new_user_input\n main_menu(user)\n when '2'\n User.user_login\n when '3'\n quit\n end\n end\n end", "title": "" }, { "docid": "9388adf671c071b9bff4181cb8d574a5", "score": "0.6224653", "text": "def option\n\t\t\tprint \"__________________________________\"\n\t\t\tputs \"****MENU****\"\n\t\t\tputs \"1) Generar archivo con promedios\"\n\t\t\tputs \"2) Inasistencias totales\"\n\t\t\tputs \"3) Alumnos que aprobaron\"\n\t\t\tputs \"4) Salir\"\n\t\t\tprint \"___________________________________\\n\\n\"\n\t\t\tputs \"Debe ingresar una opcion: \"\n\n\t\t\topcion = gets.chomp.to_i\n\t\t\treturn opcion\n\t\t\tend", "title": "" }, { "docid": "644092176d1ffdf22de238d93079be6f", "score": "0.62217134", "text": "def secret_menu\n puts \"\"\n options = [\"View Character Dictionary\", \"View Spellbook\", \"View House\", \"View Classmates\", \"Quit\"]\n choice = PROMPT.select(\"Welcome to Hogwarts. Feel free to explore the following:\", options)\n case choice\n when options[0]\n character_dictionary\n when options[1]\n which_user_spellbook_and_path?\n secret_menu_or_quit\n when options[2]\n house_info\n secret_menu_or_quit\n when options[3]\n user_classmates\n when options[4]\n goodbye\n end\n end", "title": "" }, { "docid": "90f311ac61422e03a6f2dbdf17495432", "score": "0.6207743", "text": "def menu\n puts \"#{dashes}\\n\n Choose from the following options - using the numbers (1-6) as your input:\\n\n - 1 - Create your user profile\n - 2 - Search for doctors by region\n - 3 - Search for doctors by specialty\n - 4 - Search for the doctors the user has visited\n - 5 - Does something else\n - 6 - Quit the application\n \"\n end", "title": "" }, { "docid": "a6721bea81a684ba0834207be6946fc9", "score": "0.6202213", "text": "def booth_main_menu\n prompt.select(\"Welcome Booth Operator, what would you like to do today?\" ) do |menu|\n menu.choice \"View Merchandise\", -> {self.user.check_merchandise}\n menu.choice \"Update Inventory\", -> {self.user.add_to_inventory}\n menu.choice \"List of Customers\", -> {self.user.list_of_attendees}\n menu.choice \"Number of Sales\", -> {self.user.number_of_sales}\n menu.choice \"Items Sold\", -> {self.user.sales_made}\n menu.choice \"Sales Revenue\", -> {self.user.sales_revenue}\n menu.choice \"Exit\", -> {exit!}\n end\n end", "title": "" }, { "docid": "6b66eb5fac8011a23764ce8eff6c7d07", "score": "0.6199204", "text": "def on_create_options_menu(menu)\n\t\t\tm1 = menu.add('Dashboard')\n\t\t m1.set_icon Ruboto::R::drawable::info\n\t\t m1.set_show_as_action 2\n\t\t m1.set_on_menu_item_click_listener do |menu_item|\n\t\t\t toast menu_item.title\n\t\t\t true # Prevent other listeners from executing.\n\t\t end\n\n\t\t m2 = menu.add('Properties')\n\t\t m2.set_icon Ruboto::R::drawable::prop\n\t\t m2.set_show_as_action 2\n\t\t m2.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m3 = menu.add('Settings')\n\t\t m3.set_icon Ruboto::R::drawable::settings\n\t\t m3.set_show_as_action 2\n\t\t m3.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m4 = menu.add('More')\n\t\t m4.set_icon Ruboto::R::drawable::more\n\t\t m4.set_show_as_action 2\n\t\t m4.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\t\t true # Display the menu.\n\tend", "title": "" }, { "docid": "267bd90735634139b0890d6670aa714d", "score": "0.619766", "text": "def main_menu_choose_option(user_input)\n case user_input\n when 'trains'\n manage_trains\n when 'routes'\n manage_routes\n when 'stations'\n manage_stations\n when 'cars'\n manage_cars\n else\n @ui.wrong_input_msg\n end\n end", "title": "" }, { "docid": "09c513d96a5c75091580dbf1169cc527", "score": "0.61937815", "text": "def main_menu\n @@prompt.select(\"What would you like to do today?\".colorize(:yellow)) do |menu|\n menu.choice \"Read Reviews\", -> {self.read_reviews}\n menu.choice \"Write a review\", -> { self.writing }\n menu.choice \"Update a review\", -> { self.update_reviews }\n menu.choice \"Delete a review\", -> { self.deleting }\n menu.choice \"Log Out\", -> { self.log_out }\n end\n end", "title": "" }, { "docid": "17d1fe73f8a5a4df8686f72f9a38c746", "score": "0.6182915", "text": "def menu\nend", "title": "" }, { "docid": "0dfdee0eb567f367255da44e07e26a3d", "score": "0.61801946", "text": "def settings_menu\n display_settings\n\n case user_input(caps: true)\n when interface[:home] then clear_and_home_navigation\n when interface[:difficulty] then clear_and_set_difficulty\n when interface[:interface] then clear_and_set_interface\n when interface[:markers] then set_markers\n when interface[:names] then set_names\n when interface[:help] then toggle_helper_and_settings_menu\n when interface[:reset]\n if default_settings?\n invalid\n else\n reset_default_settings\n end\n else\n invalid\n end\n end", "title": "" }, { "docid": "a0a7fe809fdcc0f3ed4825ece7c9aaa1", "score": "0.61638445", "text": "def tableau_menu\n player_name_list = @mk.players.collect { |p| p.name }\n @@cli.choose do |menu|\n menu.prompt = \"Whose situation do you want information on? \"\n menu.choices(*player_name_list) do |chosen|\n @@cli.say \"You have chosen <%= color('#{chosen}', BOLD) %>. \"\n @mk.players.find { |p| p.name==chosen }.tableau.console_output\n end\n menu.choice(:none) { @@cli.say \"OK, leaving tableau menu\"}\n end\n end", "title": "" }, { "docid": "3dcc6b7e6b3d149c6db261b47e784f3d", "score": "0.6163008", "text": "def login_menu\n system(\"clear\")\n prompt = prompt_instance\n prompt.select(\"Select option!\".colorize(:magenta)) do |menu|\n menu.choice \"LOGIN\", -> {login}\n menu.choice \"SIGN UP\", -> {sign_up}\n menu.choice \"BACK\".colorize(:red), -> {start_menu}\n end\nend", "title": "" }, { "docid": "dd05364cab0f4231d33eec418b8a04b7", "score": "0.6162043", "text": "def build_menu(application_name, method_names)\n #take array of method names and turn into menu\n puts \"#{application_name.humanize}\"\n method_names.each_with_index {|method_name, index| puts \"#{index + 1}: #{method_name.to_s.humanize}\"}\n puts \"\\nPlease enter your selection:\"\nend", "title": "" }, { "docid": "b5fdcc81a418fecfd773a0d5f785d655", "score": "0.61608636", "text": "def main_menu\n prompt.select(\"What would you like to do today #{user.name}?\") do |menu|\n menu.choice \"Choose Protein\", -> {choose_protein}\n menu.choice \"Exit!\", -> {exit_helper}\n menu.choice \"Delete Account!?!?\", -> {delete_account_helper}\n end\n end", "title": "" }, { "docid": "7cc94fafb19ef4cea996070748e4d8ef", "score": "0.6157897", "text": "def menu_type\n\t\t\"secondary\" if controller_name == \"users\"\n\tend", "title": "" }, { "docid": "b9ebbda481e5d349453e029ac4e55f4f", "score": "0.6157367", "text": "def type\n \"mymenu\"\n end", "title": "" }, { "docid": "dae7ec840d6b3fac526b993d73d7f8bf", "score": "0.61564505", "text": "def main_menu\n choice = self.prompt.select(\"Hi there, #{self.user.name}! What would you like to do today?\", [\"Create a new post\", \"Find a book\", \"View or edit my posts\", \"Delete my account\", \"Logout\"])\n\n case choice\n when \"Create a new post\"\n self.new_post\n when \"Find a book\"\n self.find_book\n when \"View or edit my posts\"\n self.view_edit_posts\n when \"Delete my account\"\n self.delete_account\n when \"Logout\"\n self.spinner(\" ✌️✌️✌️ \")\n self.greet\n end\n end", "title": "" }, { "docid": "80f693abd017383cd839929ada1b91af", "score": "0.6141675", "text": "def menu\n selection = gets.chomp.to_i\n case selection\n when 1\n all_tickets = Tickets.new(@zendesk_tickets)\n all_tickets.view_all\n when 2\n single_ticket = Ticket.new(@zendesk_tickets)\n single_ticket.view_all\n when 3\n system 'clear'\n puts \"Goodbye!\"\n exit\n else\n system 'clear'\n puts \"Invalid choice, select between 1, 2 or 3\"\n welcome_message \n menu\n end\n end", "title": "" }, { "docid": "5ef82d03391e30d5c61c73b48f05cedc", "score": "0.6135478", "text": "def main_menu\n\n\tputs \"***Ruby Cheatsheet***\"\n\tputs \"1. Command Line\"\n\tputs \"2. IDE\" \n\tputs \"3. Search\"\n\tputs \"4. Quit\"\n\tputs \"Make a selection 1 - 4:\"\n\nend", "title": "" }, { "docid": "fb6092819073570d765612c2d238e8d6", "score": "0.61268896", "text": "def menu\n\t\tputs \"\\nQuelle action veux-tu effectuer ?\"\n\t\tputs \"a - chercher une meilleure arme\"\n\t\tputs \"s - chercher à se soigner\\n\"\n\n\t\tputs \"\\nattaquer un joueur en vue :\"\n\t\tif player1.life_points > 0 \n\t\t\tputs \"0 - Josiane a #{player1.life_points} points de vie\"\n\t\tend\n\t\tif player2.life_points > 0\n\t\t\tputs \"1 - José a #{player2.life_points} points de vie\"\n\t\tend\n\t\tif player3.life_points > 0\n\t\t\tputs \"2 - José a #{player3.life_points} points de vie\"\n\t\tend\n\t\tif player4.life_points > 0\n\t\t\tputs \"3 - José a #{player4.life_points} points de vie\"\n\t\tend\n\tend", "title": "" }, { "docid": "1dcefcb08f43740c969970850da024bb", "score": "0.6124734", "text": "def menu\n\toption = gets.chomp.downcase\nend", "title": "" }, { "docid": "06264362844fa5772f4a022d9e382dea", "score": "0.6120003", "text": "def ide_menu\n\t\tputs \"***IDE Menu***\"\n\t\tputs \"1. Comment a selection \"\n\t\tputs \"2. Save a file\"\n\t\tputs \"3. Create new file\"\nend", "title": "" }, { "docid": "05d9991f5634827a2faebe031bc71ebc", "score": "0.6119008", "text": "def main_menu\n options = [\"View recipe book\", \"Search by ingredient\", \"Quit app\"]\n answer = @prompt.select(\"Choose an option:\".colorize(:color => :blue), (options))\n if answer == options[0]\n select_recipe_from_book(@user.view_recipe_book)\n elsif answer == options[1]\n find_recipe\n elsif answer == options[2]\n puts ''\n puts \"Thanks for using Feed. See you next time!\".colorize(:color => :blue)\n system exit\n end\nend", "title": "" }, { "docid": "348a4a48abfc927f62bfe54c72023b0d", "score": "0.61168003", "text": "def menu\n\tputs \"(b)asic, (a)dvanced, or (q)uit\"\n\t$menu_choice = gets.chomp.downcase\nend", "title": "" }, { "docid": "f3aa9df1841d1170140785edd6a14ea9", "score": "0.6115969", "text": "def menu_selection\n PROMPT.select('Please make a selection!'.colorize(:magenta)) do |menu|\n menu.choice({ name: \"Track Today's Mood\", value: '1' })\n menu.choice({ name: 'View Tracked Moods', value: '2' })\n menu.choice({ name: 'Good Vibes Please', value: '3' })\n menu.choice({ name: 'Exit', value: '4' })\n end\n end", "title": "" }, { "docid": "9c4483f3730f940188e676f73f63a946", "score": "0.6114496", "text": "def call_menu\n return if $game_system.menu_disabled\n Sound.play_open_menu\n @spriteset.clear_banners\n#~ if @spriteset.banners?\n#~ bs = @spriteset.title_banners ? @spriteset.title_banners : []\n#~ pb = @spriteset.party_banners ? @spriteset.party_banners : []\n#~ rb = @spriteset.red_banners ? @spriteset.red_banners : []\n#~ $game_temp.remember_banners = [[bs],[pb],[rb]]\n#~ $game_temp.remember_banner_phase = [@spriteset.tickdown,@spriteset.banner_phase]\n#~ $game_temp.remember_joiners = @spriteset.joiners\n#~ $game_temp.remember_leavers = @spriteset.leavers\n#~ $game_temp.remember_removed = @spriteset.removed\n#~ $game_temp.remember_header = @spriteset.header_banner\n#~ $game_temp.remember_posx = @spriteset.posx\n#~ end\n SceneManager.call(Scene_Menu)\n Window_MenuCommand::init_command_position\n end", "title": "" }, { "docid": "d3475ace7b311163c68fcc54e472efbd", "score": "0.6113882", "text": "def menu\n puts \"Quelle action veux-tu effectuer ?\" #Presentation menu\n puts \"\"\n puts \"a - chercher une meilleure arme\"\n puts \"s - chercher à se soigner\"\n puts \"\"\n puts \"Attaquer un joueur en vue\"\n print \"0 - \"\n puts @human_player.show_state\n counter_of_ennemies = 0\n @enemies.each do |mechant|\n print \"#{counter_of_ennemies} - \" \n puts mechant.show_state\n counter_of_ennemies += 1\n end\n end", "title": "" }, { "docid": "e2d3556335732a1d58b068e4cd357054", "score": "0.61108005", "text": "def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(bmi) - BMI calculator\"\n puts \"(m) - mortgage calculator\"\n puts \"(t) - trip calculator\"\n puts \"(q) - quit\"\nend", "title": "" }, { "docid": "e6145565adce31979457c7d732692537", "score": "0.61069006", "text": "def weekend_menu\n active = 2\n if @alive == true\n weekend_header\n else\n offline_header\n end\n @selected_activity = []\n chosen_weekend_activity = @prompt.select(\"\\nSelect an activity to find out more\\n\".blue, @processed_weekend.push({name: \"--Back to Menu--\", value: 11}).uniq) \n weekend_selection(chosen_weekend_activity) \n end", "title": "" }, { "docid": "2216745e0399ef3c0ccca834eb335712", "score": "0.6101562", "text": "def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end", "title": "" }, { "docid": "ac0b427385e7e480fc6a6bbbb3f9b4b7", "score": "0.6101368", "text": "def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end", "title": "" }, { "docid": "73296c02e8740558116e01ea890c6017", "score": "0.6097695", "text": "def choose(choices, title)\n @dialog.title = \"\\\"#{title}\\\"\"\n res = @dialog.menu(title, choices)\n \n raise CancelPressed.new unless res\n \n res\n end", "title": "" } ]
aced2b55d3403f055eacd9726e8a5a32
def obj.one_arg(x) puts "I can take zero or more arguments!" end puts obj.one_arg(1,2,3) dealing with at least two but potentially more arguments
[ { "docid": "b8490ff769c7409d493f8ea6505731dc", "score": "0.7136377", "text": "def two_or_more(a,b,*c)\n puts \"I require two or more arguments!\"\n puts \"And sure enough, I got: \"\n p a, b, c\nend", "title": "" } ]
[ { "docid": "0ad0a3b8bb932b87e60b23d92e979eb3", "score": "0.74152863", "text": "def func4(*args)\n if args.length==0\n puts \"no arguments\\n\"\n elsif args.length==1\n puts (\"one arguemnet = \"+args[0]+\"\\n\")\n elsif args.length>1\n puts (\"more than arguments\")\n puts args\n end\nend", "title": "" }, { "docid": "6405eb53ebdce597eb9e4be43397ef0d", "score": "0.73106915", "text": "def method (*args)\n\t\tif args.length > 2\n\t\t\tputs \"More than two\"\n\t\tend\n\tend", "title": "" }, { "docid": "fdc362c8da83050dcd0ff957d85b46f9", "score": "0.7062468", "text": "def one_thing(arg1)\n puts \"arg1:#{arg1}\"\nend", "title": "" }, { "docid": "257bad03bd645d4ef5f4f9fc93e435d9", "score": "0.70584637", "text": "def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend", "title": "" }, { "docid": "f2978c131cc300c9d90f4c85a7540f97", "score": "0.69738555", "text": "def test_arg_check_oneArg\n \t@args = ArgumentCheck.new\n \tassert_equal(true, @args.arg_check([1]))\n end", "title": "" }, { "docid": "0d452e032e22a9ddfbe86dbfda83a061", "score": "0.6908283", "text": "def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end", "title": "" }, { "docid": "1d5e71f745458925d2260aecff0c1d69", "score": "0.68948394", "text": "def function(argument1, argument2, *splat)\n puts argument1\n puts argument2\n #Is there a better way to detect an empty splat argument?\n if splat == []\n puts \"empty splat!\"\n else\n #Iterate over a variable number of arguments.\n splat.each { |splat_n| puts splat_n }\n end\nend", "title": "" }, { "docid": "1142dcba97861181d98de3fc46996e45", "score": "0.6887812", "text": "def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # []\nend", "title": "" }, { "docid": "fe31c752315621e4a2c98696c618d7ce", "score": "0.6845113", "text": "def foo(a, b)\n :two_args\n end", "title": "" }, { "docid": "f718020ba1071c74ce1a1264355c5d3c", "score": "0.68222207", "text": "def method(arg1, arg2, *other_args)\n p arg1 # 'a'\n p arg2 # 'b'\n p other_args # []\nend", "title": "" }, { "docid": "7bc35a080fcdc835753528f9e006c486", "score": "0.6815593", "text": "def two_more_things (arg1, arg2)\n puts \"arg1:#{arg1}, arg2:#{arg2}\"\nend", "title": "" }, { "docid": "9e0046a2db019037ceee9e2704f229ef", "score": "0.67872024", "text": "def arguments_valid?\n true if @arguments.size >= 1 \n end", "title": "" }, { "docid": "e51bf389a675900574f4cadeaeceafec", "score": "0.6779501", "text": "def echo_at_least_two( first_arg, *middle_args, last_arg)\r\n pp \"The first argument is #{first_arg}\"\r\n middle_args.each { |arg| pp \"A middle argument is #{arg}\" }\r\n pp \"The last argument is #{last_arg}\"\r\nend", "title": "" }, { "docid": "decb80020eac476107c29061b0a62a80", "score": "0.67791265", "text": "def myMethod1(arg0,*arg1)\n print arg0\n print arg1\nend", "title": "" }, { "docid": "13243a07cfe5fdbc87cc0068062ba1e5", "score": "0.67767125", "text": "def what_am_i arg arg2\n \nend", "title": "" }, { "docid": "80d8f3c1048c92e53ae143bedd8593fc", "score": "0.6763114", "text": "def args(*) end", "title": "" }, { "docid": "513102de597dd7a00846167d774cccca", "score": "0.676037", "text": "def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend", "title": "" }, { "docid": "e016ac9e3216bbaa69cb15514e419ec5", "score": "0.67496365", "text": "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "title": "" }, { "docid": "e016ac9e3216bbaa69cb15514e419ec5", "score": "0.67482084", "text": "def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "4b450084622d0409897e898e30e7b8fb", "score": "0.67290294", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "33f187317f837b86e72bc6e8ad728820", "score": "0.6723072", "text": "def any_args(first_arg, *mid_args, last_arg)\n puts \"First Argument: #{first_arg}, Last Argument: #{last_arg}\"\n end", "title": "" }, { "docid": "bd649762d0a1d62a843c594d8594229d", "score": "0.67220974", "text": "def method_name_with_different_number_of_arguments(*arguments)\n puts(arguments)\nend", "title": "" }, { "docid": "c4fe51ad60c10f6d9e1fbf6d8e2f26fe", "score": "0.6717052", "text": "def print_one(arg)\r\n puts \"arg: #{arg}\"\r\nend", "title": "" }, { "docid": "8ce4ce742f65a4e7ce2e345b9d99aedc", "score": "0.6710103", "text": "def print_one(arg1)\n puts \"arg1:#{arg1}\"\nend", "title": "" }, { "docid": "6ff24a6ca1bb318744f4a39a9ca7fd76", "score": "0.67007107", "text": "def test_two_valid_arguments\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1])\n\tend", "title": "" }, { "docid": "f19a870ec23f43768a54261ee3375016", "score": "0.66973394", "text": "def any_args?\n @any_args\n end", "title": "" }, { "docid": "f19a870ec23f43768a54261ee3375016", "score": "0.66973394", "text": "def any_args?\n @any_args\n end", "title": "" }, { "docid": "c0ab52749a5fd8354de51baf97c05bc9", "score": "0.6693597", "text": "def method(*other_args, required_arg)\n p other_args # [\"a\", \"b\"]\n p required_arg # \"c\"\nend", "title": "" }, { "docid": "c536e7d8405c1ea6265642254ef5d551", "score": "0.6693018", "text": "def test_positive\n args = Arguments.new\n assert_equal false, args.check_args(5)\n end", "title": "" }, { "docid": "5507a279e4dc1e6936f55b47fd671139", "score": "0.6687481", "text": "def too_few_args(arg1)\n yield(arg1)\nend", "title": "" }, { "docid": "04ecd2b9190c8d6d031371e7c14f8828", "score": "0.6678966", "text": "def method(*other_args, required_arg)\n p other_args # ['a', 'b']\n p required_arg # 'c'\nend", "title": "" }, { "docid": "1fe88ee96ef50be0ab6cc1aa970d6539", "score": "0.66690296", "text": "def print_one(arg1)\r\n puts \"arg1: #{arg1}\"\r\nend", "title": "" }, { "docid": "5dc0ad070a9fc6cb576733be237a857e", "score": "0.6660688", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "5dc0ad070a9fc6cb576733be237a857e", "score": "0.6660688", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "5dc0ad070a9fc6cb576733be237a857e", "score": "0.6660688", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "5dc0ad070a9fc6cb576733be237a857e", "score": "0.6660688", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "c533bd28c884a7d9fb31aa23733a9749", "score": "0.66597885", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\n end", "title": "" }, { "docid": "832d697f119a96f44e411fcd8f65b063", "score": "0.66538066", "text": "def print_one(arg1)\n puts \"arg1 #{arg1}\"\nend", "title": "" }, { "docid": "a02da12b3889e59698555058492549ff", "score": "0.6650444", "text": "def varargs(arg1, *rest)\n puts \"Got #{arg1} and #{rest.join(', ')}\"\nend", "title": "" }, { "docid": "18a5b9e5435097d419f23b2ac11db5de", "score": "0.66495657", "text": "def first_object(arg1, arg2, arg3)\n \nend", "title": "" }, { "docid": "af4fb650a7bb62bcbbceb0f1d1747c1e", "score": "0.66333634", "text": "def print_one(arg1)\r\n puts \"arg1: #{arg1}\" \r\n end", "title": "" }, { "docid": "35d90f83ef6c2f73f939483f69b7cb80", "score": "0.66213256", "text": "def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # [\"c\", \"d\", \"e\"]\nend", "title": "" }, { "docid": "11870419127d3989bacb69cdd2dbc6b6", "score": "0.66168904", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "11870419127d3989bacb69cdd2dbc6b6", "score": "0.66168904", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "11870419127d3989bacb69cdd2dbc6b6", "score": "0.66168904", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "11870419127d3989bacb69cdd2dbc6b6", "score": "0.66168904", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "11870419127d3989bacb69cdd2dbc6b6", "score": "0.66168904", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "11870419127d3989bacb69cdd2dbc6b6", "score": "0.66168904", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "1710e37c2cb5cca6c9637a144fef9f01", "score": "0.66146475", "text": "def print_one arg1\n\tputs \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "3a96f3ae2793af935d95e08e612fc607", "score": "0.66143274", "text": "def two_arg_method(arg1, arg2)\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend", "title": "" }, { "docid": "b9fb454b19e966daf8f0445d84afa3c4", "score": "0.660492", "text": "def print_one(arg1)\n puts \"arg1 :#{arg1}\"\n end", "title": "" }, { "docid": "35ef6e0d46f53342bea9b95b741000f1", "score": "0.66029346", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\n end", "title": "" }, { "docid": "5b9049e00bce7d5c7e2b22a98101653d", "score": "0.6600655", "text": "def print_one(arg1)\n puts \"arg1: #{arg1}\"\n end", "title": "" }, { "docid": "f5440b9da771d4a6f121c42258ff180c", "score": "0.6595965", "text": "def print_one(arg1)\n\tputs \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "f5440b9da771d4a6f121c42258ff180c", "score": "0.6595965", "text": "def print_one(arg1)\n\tputs \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "f5440b9da771d4a6f121c42258ff180c", "score": "0.6595965", "text": "def print_one(arg1)\n\tputs \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "f5440b9da771d4a6f121c42258ff180c", "score": "0.6595965", "text": "def print_one(arg1)\n\tputs \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "f5440b9da771d4a6f121c42258ff180c", "score": "0.6595965", "text": "def print_one(arg1)\n\tputs \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "715d54bd9176681e57a85f6f24160d0a", "score": "0.6593204", "text": "def third_method(*my_args)\n puts \"I have benn passed #{my_args.length} arguments in #{my_args}\"\n for arg in my_args\n puts \"Argument: #{arg}\"\n end\nend", "title": "" }, { "docid": "a608d687a6e368ecda29f31c49bac973", "score": "0.6584899", "text": "def print_one(arg1)\n puts (\"arg1: #{arg1}\")\nend", "title": "" }, { "docid": "d23c65d6b7a8d2288c0b208d9dbe973f", "score": "0.65662575", "text": "def test_two_ints\n args = Arguments.new\n assert_equal false, args.check_args([1, 2])\n end", "title": "" }, { "docid": "456506c60acceabe41ba9a12fde732ff", "score": "0.65557194", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\n end", "title": "" }, { "docid": "b0efc62831a2e8093715d8a0e0f76af6", "score": "0.6550888", "text": "def puts_one(arg1)\r\n puts \"arg1: #{arg1}\"\r\nend", "title": "" }, { "docid": "b0efc62831a2e8093715d8a0e0f76af6", "score": "0.6550888", "text": "def puts_one(arg1)\r\n puts \"arg1: #{arg1}\"\r\nend", "title": "" }, { "docid": "7429e68ff06f0ada4181831883d25079", "score": "0.65420014", "text": "def validate_args (args)\n\t# todo\nend", "title": "" }, { "docid": "0f4085e6255d04577afbf4823be26367", "score": "0.65291804", "text": "def puts_one(arg1)\n puts \"arg1: #{arg1}\"\nend", "title": "" }, { "docid": "71948ac31775a34465d6b2710e4883bb", "score": "0.65120846", "text": "def first_arg\n expect :call, :attrasgn, :safe_call, :safe_attrasgn\n self[3]\n end", "title": "" }, { "docid": "cc86cce2612893481992fe736ffabbd7", "score": "0.65052676", "text": "def print_two_again(arg1, arg2) # Non-variable list of inputs it will accept\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "title": "" }, { "docid": "28047cf7a656cd5043696e60d151a854", "score": "0.65026146", "text": "def method(a, *b)\r\n\tb\r\nend", "title": "" }, { "docid": "4338caebacd6a097572e75acb9edc29c", "score": "0.648951", "text": "def test_three_ints\n args = Arguments.new\n assert_equal true, args.check_args([1, 2, 3])\n end", "title": "" }, { "docid": "45c47c6e70979f07aa3fd6a32486784d", "score": "0.6488002", "text": "def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end", "title": "" } ]
ac7459fa7ff2dcdbfec9206d58931cff
Deletes recent rows based on timestamp, but also allows filtering by an auxilary timestamp column for the case where the primary one is not indexed on the target (such as the DFR reports, where imported_at is not indexed, but reporting date is).
[ { "docid": "965d8d2b9fca35a09a4b426912881edb", "score": "0.632187", "text": "def delete_recent(plan, since)\n ensure_connection\n query = db[plan.table_name].\n filter(\"#{plan.timestamp} > ?\", since)\n\n if plan.aux_timestamp_column\n query = query.filter(\n \"#{plan.aux_timestamp_column} > ?\",\n since - AUX_TIME_BUFFER\n )\n end\n\n query.delete\n end", "title": "" } ]
[ { "docid": "785e09a61ddfd84445c08adb0dea9af8", "score": "0.5907368", "text": "def filter_timestamps(schema)\n schema.reject { |item| ['created_at', 'updated_at'].include?(item[0]) }\n end", "title": "" }, { "docid": "23a1cabeecb9f9b68ea4378d64f1b076", "score": "0.58840424", "text": "def delete_outdated_record(original_record)\n ETL::Engine.logger.debug \"deleting old row\"\n \n q = \"DELETE FROM #{dimension_table} WHERE #{primary_key} = #{original_record[primary_key]}\"\n connection.delete(q)\n end", "title": "" }, { "docid": "7b4223702ce060602cdac64f89b2d885", "score": "0.5818382", "text": "def delete_oldies(diff)\n @log_entries.synchronize do\n @log_entries.each_pair do |key, value|\n value.delete_if { |e| ((Time.now - e[:time_local].to_time) > diff) }\n end\n @log_entries.delete_if { |key, value| value==[] } #jak zostanie pusta tablica, chyba ze dla historii chcemy przechowywac puste worker_addr'y (?)\n end\n end", "title": "" }, { "docid": "61f6eaea022b06397a9b3678519b5939", "score": "0.5658127", "text": "def filter_old_retweets\n\t@tweet_db.each do |tweet_id, tweet_data|\n\t\ttweet_data[:retweets].delete_if do |id, retweet| \n\t\t\t#if the time now in minutes is greater than or equal to the user defined\n\t\t\t#window, then remove that retweet.\n\t\t\t(Time.now - retweet.created_at).to_i / 60 >= @user_defined_window\n\t\tend\n\tend\nend", "title": "" }, { "docid": "8184cbeb6b7e2a632143c101e7053738", "score": "0.5587995", "text": "def purge\n limit = Time.now.to_i - (@conf[:obsolete] * 60) # conf in minutes\n\n @db.execute(\"DELETE FROM #{@dataset} WHERE timestamp < #{limit}\")\n end", "title": "" }, { "docid": "d67de8ebf2b7543669be07a24f6c4a17", "score": "0.5566594", "text": "def prune\n if Event.count > 60\n cutoff = Event.limit(60).last.created_at\n Event.where([\"created_at < ?\", cutoff]).delete_all\n end\n end", "title": "" }, { "docid": "1b268ca6af3288d12e31ed155e10b329", "score": "0.5367402", "text": "def filter_listings(listings)\n cutoff_timestamp = self.last_run_at\n listings.reject { |ll| ll.updated_at < cutoff_timestamp }.sort_by(&:updated_at)\n end", "title": "" }, { "docid": "81abe9ee27374a40509b0358e0180f4d", "score": "0.5334664", "text": "def delete(table_name, row, timestamp = nil)\n safe_exec do\n table = connect_table(table_name)\n timestamp ? table.deleteAll(row.to_bytes, timestamp) : table.deleteAll(row.to_bytes)\n end\n end", "title": "" }, { "docid": "8577adc9efb00b465ad27f6238dd1db8", "score": "0.53298265", "text": "def drop_older(table, end_time)\n query = \"DELETE FROM #{table} WHERE dtime <= FROM_UNIXTIME(#{end_time})\"\n return query\n end", "title": "" }, { "docid": "27a6afafc8e14e4223ae0e18e2f67071", "score": "0.5285832", "text": "def index\n ReaderEvent.where(\"created_at < :time\", {:time => 3.minutes.ago}).each{|event| event.destroy}\n @reader_events = ReaderEvent.all.order(flow_number: :asc, id: :asc)\n end", "title": "" }, { "docid": "d2115bcd34b81e950369cf05a9b81540", "score": "0.527302", "text": "def remove_last_alive_log\n AmqpAuditLog.where(routing_key: '-.-.-.alive.-.-.-.-').order(id: :desc)\n .offset(20).destroy_all\n end", "title": "" }, { "docid": "99311278daf76f7734b0146a826ea15f", "score": "0.51833034", "text": "def stamp_new_rows\n db.query(\"UPDATE #{audit} SET `_copied_at` = NOW() WHERE `_copied_at` IS NULL\")\n end", "title": "" }, { "docid": "7ed5ebe3cdcf5857163ef39db3337a34", "score": "0.51687795", "text": "def update_oldest_records\n old_records = @bq_writer.query('SELECT table_name, attr FROM '\\\n \"[#{project_id}:#{@bq_writer.dataset}.#{bq_table_name}] \"\\\n 'GROUP BY table_name, attr')\n if old_records['rows']\n old_records['rows'].each do |r|\n table = r['f'][0]['v']\n trait = r['f'][1]['v']\n\n next unless trait && bq_attributes[table] \n\n if bq_attributes[table].include?(trait.to_sym) \n OldestRecord.find_or_create_by(table_name: table, attr: trait)\n else\n log(:info, \"#{Time.now}: No longer tracking: #{table}: #{trait}\")\n end\n end\n end\n end", "title": "" }, { "docid": "62f65f57ac5ea34dc44907060b371c98", "score": "0.515253", "text": "def move_and_delete oldt,newt,timestamp\n ins = \"INSERT INTO #{newt} SELECT * FROM #{oldt} \" +\n \" WHERE #{Conf::database.timestamp} < #{timestamp}\";\n del = \"DELETE FROM #{oldt} WHERE \" +\n \" #{App.database.timestamp} < #{timestamp}\"\n db = Mysql.default\n db.connect do\n db.query(ins)\n db.query(del)\n end\n TableUtil::compress_table newt\n end", "title": "" }, { "docid": "c6cc50e89c03d8e51f41db560cb434f1", "score": "0.5148569", "text": "def delete_dates(data) \n ['created_at', 'updated_at', 'timestamp', 'location'].each do |key|\n data.delete key if data[key]\n end\n data\nend", "title": "" }, { "docid": "3dc224ee4ac5075cee5f9dd95cfeee31", "score": "0.513192", "text": "def trim(timestamp)\n dropped = lines.take_while do |ts, _|\n timestamp - ts > expiry\n end\n dropped.length.tap do |numdropped|\n # actually drop the lines\n lines.slice!(0, numdropped)\n # keep running statistics of methods\n dropped.each do |_, logline|\n stats[logline.method] -= 1\n end\n stats[:requests] -= numdropped\n end\n end", "title": "" }, { "docid": "fa1ec5526c6209a0f4d3235c4a8028af", "score": "0.5122776", "text": "def no_timestamps\n @conn.tables - timestamps\n end", "title": "" }, { "docid": "8cfb3140132e49e0661727086febbaa0", "score": "0.5119667", "text": "def records_modified_since(time)\n condition = []\n %w(updated_at created_at).each do |col|\n condition << \"#{col} >= ?\" if column_names.include? col\n end\n if condition.empty?\n logger.warn \"#{self.name}: Override records_modified_since(time) to keep the index up to date with records changed during rebuild.\"\n []\n else\n find :all, :conditions => [ condition.join(' AND '), *([time]*condition.size) ]\n end\n end", "title": "" }, { "docid": "34aa65b62f50c16bf1ede7e590716340", "score": "0.5059042", "text": "def delete_safe_times(volumes)\n volumes.keys.each do |volume_id|\n command = \"delete from results where volume_id=?\"\n options = [volume_id]\n volumes[volume_id].each do |time_window|\n command += \"\\n and access_date not between datetime(?) and datetime(?)\"\n options += [time_window[\"start\"].iso8601, time_window[\"end\"].iso8601]\n end\n command += \";\"\n command_literal = command\n options.each { |opt| command_literal.sub!(opt)} # Don't ever do this.\n puts \"Executing: #{command_literal}\\n\"\n @db.execute(command, *options)\n end\n end", "title": "" }, { "docid": "bf30ee43c35640ed55c88939a29338ea", "score": "0.5019429", "text": "def delete!\n update_attribute(:dateSuppression, Time.now)\n end", "title": "" }, { "docid": "ec411302785304ee96536ffc63f837f9", "score": "0.50160223", "text": "def drop_partitions_older_than(timestamp, dry_run = false)\n partitions = Partition.all(adapter, table_name).older_than_timestamp(timestamp)\n partition_names = partitions.map(&:name)\n\n if partition_names.empty?\n msg = \"Drop: No-Op - No partitions older than #{timestamp}, i.e. #{Time.at(@tuc.to_seconds(timestamp))} to drop\"\n else\n msg = \"Drop: Dropped partitions: #{partition_names.inspect}\"\n drop_partitions(partition_names, dry_run)\n end\n\n log(msg)\n\n partition_names\n end", "title": "" }, { "docid": "f40ee12b44a4780d2475a51459c1bf6d", "score": "0.4991909", "text": "def purge_old\n @db.execute \"DELETE FROM requests WHERE first_seen < ?\", $config.periodic['purge'].minutes.ago.to_i\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "4717b15e4d270ee0d4e2eae373c334f4", "score": "0.4990162", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "d48d2fe7bda5fc613c8a52fe48b3fe01", "score": "0.49874154", "text": "def remove_old_results\n CustomReportsResult.where(custom_report_id: custom_report_id)\n .order('created_at DESC')\n .offset(5)\n .destroy_all\n end", "title": "" }, { "docid": "85bb6c3f17098353176f7cbee539ce2f", "score": "0.4984964", "text": "def remove_distribution_hours_for_user(project_job)\n puts \"coming to remove_distribution_hours_for_user ..........................\"\n past_dates = project_job.job_time_logs.where(\"user_id = ? and log_start_time < ?\",project_job.assigned_to, Date.today).all.map(&:log_start_time).map(&:to_date)\n p past_dates\n if(past_dates.present?)\n ResourceDistribution.where(:project_job_id=>project_job.id, :user_id=>project_job.assigned_to).where(\"allotted_date not in (?)\",past_dates).delete_all\n else\n ResourceDistribution.where(:project_job_id=>project_job.id, :user_id=>project_job.assigned_to).delete_all\n end\n end", "title": "" }, { "docid": "3eb2ed9f4adfbeb7952a11a994d5b43a", "score": "0.4984703", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "226e03021eac43e84ad37dd925aa96b5", "score": "0.49845", "text": "def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?\n super\n end", "title": "" }, { "docid": "226e03021eac43e84ad37dd925aa96b5", "score": "0.49845", "text": "def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?\n super\n end", "title": "" }, { "docid": "e3e25aa99d4c9bab9f78c8e85f5ae0a8", "score": "0.49531075", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "1c367e64c60a3c9240b0b1a95e944e20", "score": "0.49469453", "text": "def without_touching(record)\n if record.class.respond_to?(:without_timestamps)\n record.class.without_timestamps { yield }\n else\n yield\n end\n end", "title": "" }, { "docid": "018a80b445bf4ffec7266595f3e23205", "score": "0.49455416", "text": "def flush_records!(filter)\n raise ArgumentError, \"filter cannot be empty\" if filter.blank?\n\n where(filter).delete_all\n end", "title": "" }, { "docid": "a25c82aee1606ed7a40933c51089cfce", "score": "0.49408734", "text": "def truncate_test_record(tester: V1_TESTER, sell_time: Time.now, trim_time: 1.hour)\n self.send(tester.to_sym).delete_if {|t| t < (sell_time - trim_time).to_i }\n end", "title": "" }, { "docid": "e93f6d9a75e66a719815e1ab4a7398cd", "score": "0.4935055", "text": "def delete_history_older_than_30_days\n HistoryOlderThan30Days.delete_all; nil\nend", "title": "" }, { "docid": "1210a09854d7164cecb2b02441763939", "score": "0.49201736", "text": "def prune_index\n# missing_files=index_time_dbm_file.reject{|filename,itime| File.exists?(filename) && Picolena::IndexedDirectories.any?{|dir,alias_path| filename.starts_with?(dir)}}\n# missing_files.each{|filename, itime|\n# index.writer.delete(:complete_path, filename)\n# index_time_dbm_file.delete(filename)\n# logger.debug \"Removed : #{filename}\"\n# }\n# index.optimize\n end", "title": "" }, { "docid": "5679800101586b42ae5c856419db2ffe", "score": "0.49009743", "text": "def soft_delete\n\t\tupdate_attribute(:deleted_at, Time.current)\n\tend", "title": "" }, { "docid": "d9bbed7474a6ea7881a45093f5b57695", "score": "0.48973697", "text": "def prune_old_values(current_time)\n pruning_time = current_time - @time_interval\n @logger.info(\"Pruning time: #{Time.at(pruning_time).to_s}\")\n # iterate over the queue and remove values that are older than 2 minutes\n @queue.delete_if {|ts| ts < pruning_time} \n end", "title": "" }, { "docid": "f0cd4c115946c4b18f101e5ba686dbf3", "score": "0.48959646", "text": "def touch_index_timestamp\n self.index_timestamp = Time.now\n end", "title": "" }, { "docid": "3d5cf19a167b8abfe28a4421e21ad764", "score": "0.48945588", "text": "def delete\n self.update_column(:deleted_at, object_zone_time)\n end", "title": "" }, { "docid": "b1f87d57af83f260dc80ac93a542d0b9", "score": "0.4885182", "text": "def prune_index\n missing_files=index_time_dbm_file.reject{|filename,itime| File.exists?(filename) && Picolena::IndexedDirectories.any?{|dir,alias_path| filename.starts_with?(dir)}}\n missing_files.each{|filename, itime|\n index.writer.delete(:complete_path, filename)\n index_time_dbm_file.delete(filename)\n logger.debug \"Removed : #{filename}\"\n }\n index.optimize\n end", "title": "" }, { "docid": "e079f9d21ec52801f8cf08f0fc7eaed2", "score": "0.48810157", "text": "def on_timelog_delete(timelog)\n #Stop tracking if the active timelog is being deleted.\n if @timelog_active and @timelog_active.id.to_i == timelog.id.to_i\n @log.debug(\"Tracked timelog is being deleted - stopping tracking before deletion.\")\n self.timelog_stop_tracking\n end\n end", "title": "" }, { "docid": "a075ff1e6a678e68cdbba60531ff3918", "score": "0.4871736", "text": "def soft_delete\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "5a17396ba6cfbdced994bbfb21231fa4", "score": "0.4845302", "text": "def delete_old_requests\n Request.where('created_at < ?', Time.now - 15.minutes).delete_all\n end", "title": "" }, { "docid": "1398d108c6542fbb6ce9b01fa53ae5bd", "score": "0.48260638", "text": "def filterby_timestamp(which_q, subreddit, results)\n if results.first.nil? || results.empty?#obvious screwy logic is screwy\n results = results\n else\n time_to_filter = subreddit.timestamps[\"#{which_q}_last\"]\n top_time = results.first.timestamp\n results = results.select { |r| r.timestamp > time_to_filter }\n subreddit.timestamps[\"#{which_q}_last\"] = top_time\n @l.info \"#{subreddit.name}::#{which_q} results filtered against most recent time of check, new timestamp #{subreddit.timestamps[\"#{which_q}_last\"]}\"\n results\n end\n end", "title": "" }, { "docid": "86c66ee7ccea62e119da07101be46529", "score": "0.48254052", "text": "def delete_current\n @deleted_entries.set(@record_index)\n end", "title": "" }, { "docid": "bcb2c61c4514996bc6213026b78d786d", "score": "0.48191237", "text": "def soft_delete(at = Time.zone.now)\n update_attribute(:deleted_at, at)\n end", "title": "" }, { "docid": "93f0fe3ea80becbba8a2babe189ef012", "score": "0.48153535", "text": "def no_created_at_transient_registrations_to_remove\n WasteCarriersEngine::TransientRegistration.where(\n \"created_at\" => nil,\n \"metaData.lastModified\" => { \"$lt\" => oldest_possible_date },\n \"workflow_state\" => { \"$nin\" => WasteCarriersEngine::RenewingRegistration::SUBMITTED_STATES }\n )\n end", "title": "" }, { "docid": "0f42d3cdb4d150fde33cf1b3689a4b39", "score": "0.48086205", "text": "def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records'\n end", "title": "" }, { "docid": "db3022b9ec0101a73ffc47be82f35071", "score": "0.48077086", "text": "def without_timestamping\n class << self\n def record_timestamps; false; end\n end\n yield\n ensure\n class << self\n remove_method :record_timestamps\n end\n end", "title": "" }, { "docid": "419a1e35855d6ccedeac4731462c682a", "score": "0.48011276", "text": "def deleted_query(records)\n keys = records.\n map { |m| record_key(m.key)[@klass.primary_key] }.\n reject(&:nil?)\n\n @klass.unscoped.where(@klass.primary_key => keys)\n end", "title": "" }, { "docid": "510222c90e48b6be0efa583fcc316188", "score": "0.4797038", "text": "def remove_marker(marker)\n updated = Time.now-10.seconds\n marker.updated_at >= updated ? true : false\n end", "title": "" }, { "docid": "3a317af9d5b9e77fdfeafa28c7942d3f", "score": "0.4795214", "text": "def trim_logs!(threshold = 1000)\n m = [last_analyzed_log_entry, last_broadcasted_log_entry].min\n l = last_trimmed_log_entry\n entries = []\n\n if m - last_trimmed_log_entry >= threshold\n entries = redis.zrangebyscore(log_key, l, m, :with_scores => true)\n redis.zremrangebyscore(log_key, l, m)\n redis.hset(ident, 'last_trimmed_log_entry', m)\n end\n\n entries\n end", "title": "" }, { "docid": "37c4b89e45529604e8fb8a4e3b90a173", "score": "0.47752583", "text": "def delete\n # mark each version of the history as deleted, not just the most recent one\n @patient.histories\n .where(original_comment_id: @history.original_comment_id)\n .update_all({ deleted_by: current_user.email, delete_reason: params.permit(:delete_reason)[:delete_reason], updated_at: DateTime.now })\n end", "title": "" }, { "docid": "18e49a8a7acebd9bc55976a5a19aa91b", "score": "0.47698498", "text": "def remove_all_retrievals\n rs = retrieval_statuses.where(:retrieved_at == '1970-01-01').delete_all\n retrieval_statuses.count == 0\n end", "title": "" }, { "docid": "18e49a8a7acebd9bc55976a5a19aa91b", "score": "0.47698498", "text": "def remove_all_retrievals\n rs = retrieval_statuses.where(:retrieved_at == '1970-01-01').delete_all\n retrieval_statuses.count == 0\n end", "title": "" }, { "docid": "c0c5109058f5fea32daeebc84bed8351", "score": "0.47616425", "text": "def destroy\n update(deleted_at: Time.current)\n end", "title": "" }, { "docid": "81be2cc1e83042ba5627c2d20ab84ff1", "score": "0.47598034", "text": "def soft_delete \n update_attribute(:deleted_at, Time.current) \n end", "title": "" }, { "docid": "81be2cc1e83042ba5627c2d20ab84ff1", "score": "0.47598034", "text": "def soft_delete \n update_attribute(:deleted_at, Time.current) \n end", "title": "" }, { "docid": "109b73ceb047f6d9f79e7bc28792660a", "score": "0.47467434", "text": "def delete_unmarked_entries(&block)\n deleted_ids = []\n # First remove the entry from the hash table.\n @entries_by_id.delete_if do |id, e|\n if e[MARKED] == 0\n yield(id) if block_given?\n deleted_ids << id\n true\n else\n false\n end\n end\n # Then delete the entry itself.\n @entries.delete_if { |e| e[MARKED] == 0 }\n write_index\n\n deleted_ids\n end", "title": "" }, { "docid": "fca04124a68b8c7dd7672c7eff648215", "score": "0.47455314", "text": "def unimported_records\n imported_records.where(success: false)\n end", "title": "" }, { "docid": "8f2a4c2aed758ff9d0f5c3c511ec959e", "score": "0.47430745", "text": "def clean_update_log\n \t\tif ::Update.count > 50\n\t \tbatch = ::Update.limit(25).order('created_at ASC')\n\t \tbatch.destroy_all\n\t end\n \tend", "title": "" }, { "docid": "891d72ab7feb1867fd4b935829e5b8cf", "score": "0.47396028", "text": "def remove_depricated\n self.articles.each do |a|\n unless ((a.created_at + 3.days) > Date.today) \n self.articles.delete(a)\n end\n end\n\tend", "title": "" }, { "docid": "18b6b3882a37a95b6571aba6780a89cb", "score": "0.47394523", "text": "def unflag_row_deltas\n logger.debug \"Resetting row delta flags for #{name}\"\n q = \"UPDATE #{audit} SET `_has_delta` = 0\"\n db.query(q)\n end", "title": "" }, { "docid": "14b8e8c2dc180801c0e8a9904d471c0b", "score": "0.47278777", "text": "def filter_transactions\n @transactions.delete_if do |t_data|\n fp = Transaction.fingerprint(t_data)\n Transaction.where(fingerprint: fp).count > 0\n end\n end", "title": "" }, { "docid": "8c3e407248d4966fcdb1dde495496794", "score": "0.472646", "text": "def without_timestamps\n class << self\n def record_timestamps; false; end\n end\n\n yield\n\n ensure\n class << self\n remove_method :record_timestamps\n end\n end", "title": "" }, { "docid": "0b15affec6312a851d536eb8d68468ba", "score": "0.47229484", "text": "def outdated_delete\n outdated.delete_all\n end", "title": "" }, { "docid": "c322fc3ce9e84bc4cb2ea7967fa46de0", "score": "0.4722745", "text": "def delete_at_without_hooks( index )\n\n @without_hooks = true\n\n object = delete_at( index )\n \n @without_hooks = false\n\n return object\n \n end", "title": "" }, { "docid": "3a53218c79ac88f62e0ec93bf875bfb6", "score": "0.47217554", "text": "def unsafe_forget_past!\n slices.values.map(&:history).each{|h| h.recent(memory_size)}\n\n if multi_slices?\n to_delete = slices.values.reject{|s| keep_slice?(s)}\n to_delete.map(&:rack_id).map do |rack_id| \n slices.delete(rack_id)\n end\n end\n end", "title": "" }, { "docid": "e7f81ce262607131a567358fd4361ccf", "score": "0.47189352", "text": "def soft_delete\n ActiveRecord::Base.record_timestamps = false\n self.deleted_at = Time.now\n self.save\n ActiveRecord::Base.record_timestamps = true\n end", "title": "" }, { "docid": "385147c5f6de4ce563da32ee288b9fea", "score": "0.47184512", "text": "def clear_timeless_option\n self.class.timestamping = true\n end", "title": "" }, { "docid": "21a74e67af7704e8d9fba519cf6a3c4e", "score": "0.47102773", "text": "def set_deleted_timestamp(time=nil)\n field = model.deleted_timestamp_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.deleted_timestamp_overwrite? || send(field).nil?)\n self.send(meth, time||=Sequel.datetime_class.now)\n self.save\n end\n end", "title": "" }, { "docid": "c7fd1cd93aa9694303a2ed4b02aebfb8", "score": "0.47020295", "text": "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "title": "" }, { "docid": "c7fd1cd93aa9694303a2ed4b02aebfb8", "score": "0.47020295", "text": "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "title": "" }, { "docid": "c7fd1cd93aa9694303a2ed4b02aebfb8", "score": "0.47020295", "text": "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "title": "" }, { "docid": "7a0c0a9fbc379e0604595c4b07b05b7b", "score": "0.46878627", "text": "def cleanup_expired_snapshots(pool, datasets, interval, keep, should_destroy_zero_sized_snapshots)\n ### Find all snapshots matching this interval\n snapshots = Zfs::Snapshot.list(pool, {'recursive' => true}).select { |snapshot| snapshot.name.include?(snapshot_prefix_interval(interval)) }\n dataset_snapshots = group_snapshots_into_datasets(snapshots, datasets['included'] + datasets['excluded'])\n ### Filter out datasets not included\n dataset_snapshots.select! { |dataset, snapshots| datasets['included'].include?(dataset) }\n\n if should_destroy_zero_sized_snapshots\n dataset_snapshots = datasets_destroy_zero_sized_snapshots(dataset_snapshots)\n end\n\n ### Now that zero-sized are removed, remove expired snapshots\n dataset_snapshots.each do |dataset, snapshots|\n # Want to keep the first 'keep' entries, so slice them off ...\n dataset_snapshots[dataset].shift(keep)\n # ... Now the list only contains snapshots eligible to be destroyed.\n end\n threads = []\n dataset_snapshots.values.flatten.each do |snapshot|\n threads << Thread.new do\n snapshot.destroy\n end\n threads.last.join unless $use_threads\n end\n threads.each { |th| th.join }\nend", "title": "" }, { "docid": "b3378c895a8016ca9c630760e9efead8", "score": "0.46863097", "text": "def restore\n self.update_column(:deleted_at, nil)\n end", "title": "" }, { "docid": "3324200862526034d74a5b7bed80ddff", "score": "0.4684513", "text": "def archive\n update_attribute(:deleted_at, Time.current)\n end", "title": "" }, { "docid": "5081e4f18ef89d5e13dbceadde87b32b", "score": "0.468329", "text": "def clean_activity!\n $redis.zremrangebyscore(activity_key, '-inf', Time.now.to_i - 1.minute)\n end", "title": "" }, { "docid": "1021b9385f9bc4c1407e9049b5d121e2", "score": "0.4681165", "text": "def filter_search_result(data, start_seconds, end_seconds)\n data.reject! do |row|\n timestamp = row.to_s.split(\" \")[0].split(\":\")[1].to_i\n timestamp.to_i < start_seconds.to_i || timestamp.to_i > end_seconds.to_i\n end\n end", "title": "" }, { "docid": "72c482420733edc328683001f56155d7", "score": "0.4663505", "text": "def prune_daily(snapshot)\n catch :found do\n (0..rotation.daily - 1).each do |count|\n day = in_days(count)\n if day_key(snapshot.created_at) == day_key(day)\n save_newest_snapshot(snapshot, day)\n throw :found, true\n end\n end\n false\n end\n end", "title": "" }, { "docid": "922f7d8769bb2552fb75fed8099a24e3", "score": "0.46625355", "text": "def deleted_since_last_ingest?\n last_ingest = self.premis_events.where(event_type: Pharos::Application::PHAROS_EVENT_TYPES['ingest']).order(date_time: :desc).limit(1).first\n last_deletion = self.premis_events.where(event_type: Pharos::Application::PHAROS_EVENT_TYPES['delete']).order(date_time: :desc).limit(1).first\n if !last_ingest.nil? && !last_deletion.nil? && last_deletion.date_time > last_ingest.date_time\n return true\n end\n return false\n end", "title": "" }, { "docid": "925446892b956a244a0245adf06ac0e8", "score": "0.46622136", "text": "def without_timestamps\n self.record_timestamps = false\n yield\n self.record_timestamps = true\n end", "title": "" }, { "docid": "ee98b27fbb40e049e878ea56700698e1", "score": "0.46535346", "text": "def remove_previous_if_same_as(current, time_diff=nil)\n time_diff ||= Doers::Config.activity_remove_at\n keys = %w(id created_at updated_at data)\n timing = (Time.current - time_diff)..Time.current\n current_attrs = current.attributes.except(*keys)\n self.activity_owner.activities.where(\n :created_at => timing, :slug => current.slug).each do |act|\n if act.attributes.except(*keys) == current_attrs\n act.destroy\n end\n end\n end", "title": "" }, { "docid": "013344ddc5f739a91495ae01f6afb578", "score": "0.46410212", "text": "def delete_most_recent_occurrence!\n self.occurrences.first.try(:destroy).try(:destroyed?)\n end", "title": "" }, { "docid": "0594b1b0b4a806075e9cef6c3a2b2a6e", "score": "0.46399006", "text": "def clear_prior_rows(key: nil, existing_entries: nil)\n # TODO: store a reference to those, and delete only after the new ones were imported successfully\n # And support multiple per run\n raise \"No data provided\" if key.nil? && existing_entries.nil?\n existing_entries ||= raw_data.where(key: key)\n\n if existing_entries.count > 0\n puts \"Using database #{ENV['DATABASE_URL'][0...30]}...\"\n puts \"Already #{existing_entries.count} entries for #{key}, are you sure you want to replace all of those entries? (y/n)\"\n raise \"user cancelled\" unless gets.strip == 'y'\n existing_entries.delete\n puts \"Deleted...\"\n end\n end", "title": "" }, { "docid": "128de23ad8f63c509b5c70d8b305985c", "score": "0.46273527", "text": "def delete_from_index\n case self.class.update_index_policy\n when :immediate_with_refresh\n self.class.delete_id_from_index(self.id, :refresh => true)\n # As of Oct 25 2010, :refresh => true is not working\n self.class.refresh_index()\n when :enqueue\n DistributedIndexing::RemoveDocuments.perform_async(self.class.to_s, [self.id.to_s])\n else\n self.class.delete_id_from_index(self.id)\n end\n end", "title": "" }, { "docid": "8a2fd50ed0c47faea87abf7c03660afa", "score": "0.46212497", "text": "def trash!\n self.update_column(self.class.trashed_at_attribute_name, Time.now)\n end", "title": "" }, { "docid": "a425bc968b2ad507f4066661d40a1428", "score": "0.46080256", "text": "def delete_rows_by_prefix prefix, timeout: nil\n drop_row_range row_key_prefix: prefix, timeout: timeout\n end", "title": "" }, { "docid": "7d85d3c19dbdc5e483654fa216106912", "score": "0.4606853", "text": "def _delete_without_checking\n if sql = (m = model).fast_instance_delete_sql\n sql = sql.dup\n ds = use_server(m.dataset)\n ds.literal_append(sql, pk)\n ds.with_sql_delete(sql)\n else\n _delete_dataset.delete \n end\n end", "title": "" }, { "docid": "7d85d3c19dbdc5e483654fa216106912", "score": "0.4606853", "text": "def _delete_without_checking\n if sql = (m = model).fast_instance_delete_sql\n sql = sql.dup\n ds = use_server(m.dataset)\n ds.literal_append(sql, pk)\n ds.with_sql_delete(sql)\n else\n _delete_dataset.delete \n end\n end", "title": "" }, { "docid": "7aaa76dffd4b07ca79a16625f7d26da8", "score": "0.4605053", "text": "def _delete_mutation(cf, column, subcolumn, timestamp, options={})\n deletion_hash = {:timestamp => timestamp}\n if is_super(cf)\n deletion_hash[:super_column] = column if column\n deletion_hash[:predicate] = CassandraThrift::SlicePredicate.new(:column_names => [subcolumn]) if subcolumn\n else\n deletion_hash[:predicate] = CassandraThrift::SlicePredicate.new(:column_names => [column]) if column\n end\n CassandraThrift::Mutation.new(\n :deletion => CassandraThrift::Deletion.new(deletion_hash)\n )\n end", "title": "" }, { "docid": "4daa7fb4e93da882af2b2612ea49baab", "score": "0.46029818", "text": "def disable_timestamp_callback\n if self.respond_to?(\"updated_at\")\n self.class.skip_callback(:save, :before, :update_timestamps ) if @@_disable_timestamp_count == 0\n @@_disable_timestamp_count += 1\n end\n end", "title": "" }, { "docid": "740c834f079b50811508643f0467e05a", "score": "0.45964018", "text": "def newer_than_timestamp(timestamp)\n non_future_partitions.select do |p|\n timestamp <= p.timestamp\n end\n end", "title": "" }, { "docid": "628adfbb841b8fe5c352b3ae43769771", "score": "0.4586934", "text": "def destroy_row\n if self.is_passthrough\n super\n else\n results = []\n relation_for_destroy.each do |x|\n if x.dfrom == self.dfrom\n @dto ||= ActiveRecord::Base.connection.execute(\"SELECT NOW() AS now;\").first[\"now\"]\n x.is_passthrough = true\n x.update(dto: @dto)\n self.dto = @dto\n end\n end\n end\n end", "title": "" } ]
a7570219973eb3a6c6162310a472aee5
GET /serie_cronologicas/1 GET /serie_cronologicas/1.xml
[ { "docid": "ad9ce7644b240a2f609e4aa6f319b212", "score": "0.6666567", "text": "def show\n @serie_cronologica = SerieCronologica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @serie_cronologica }\n end\n end", "title": "" } ]
[ { "docid": "cf95e9fa4dbd86d822b58edc9f6426bf", "score": "0.6492539", "text": "def show\n @cronjob = Cronjob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cronjob }\n end\n end", "title": "" }, { "docid": "796140ee1215d76a3765656386f79a34", "score": "0.62899834", "text": "def live_schedule\n get('sports/en/schedules/live/schedule.xml')\n end", "title": "" }, { "docid": "4cfe75af93ffed112772cbece9877aa0", "score": "0.6138894", "text": "def new\n @serie_cronologica = SerieCronologica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => admin_serie_cronologica_path }\n end\n end", "title": "" }, { "docid": "006dd730e81564ebdcbc4985a23e2fa2", "score": "0.6094252", "text": "def rss # :nologin:\n headers[\"Content-Type\"] = \"application/xml\"\n @logs = RssLog.all(:conditions => \"datediff(now(), updated_at) <= 31\",\n :order => \"updated_at desc\", :limit => 100, :include => [\n :name, :species_list, { :observation => :name },\n ])\n render(:action => \"rss\", :layout => false)\n end", "title": "" }, { "docid": "9d61486fb3e420d80e24eadd51a453b0", "score": "0.6093381", "text": "def show\n @cronjob_mode = CronjobMode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cronjob_mode }\n end\n end", "title": "" }, { "docid": "a378256ce3d6338af7180ff544f22b3c", "score": "0.6065197", "text": "def xml_report\n RestClient::get \"#{@base}/OTHER/core/other/xmlreport/\"\n end", "title": "" }, { "docid": "5287660ffc1da7d33d5de8abe3f2ebbf", "score": "0.6030942", "text": "def xml_report\n RestClient::get \"#{base}/OTHER/core/other/xmlreport/\"\n end", "title": "" }, { "docid": "7dec13c5b1510bfe4d94367f2e6d82e3", "score": "0.59914094", "text": "def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(updated_at: ..31.days.ago).\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end", "title": "" }, { "docid": "d47d3d95b6457ef1dda77e9872ae02d4", "score": "0.5966038", "text": "def index\n @calendario_recursos = CalendarioRecurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendario_recursos }\n end\n end", "title": "" }, { "docid": "2220c5a2cfd894d054f0a0b6154d1d27", "score": "0.5942354", "text": "def index\n @cronogramas = Cronograma.all\n end", "title": "" }, { "docid": "647cf7df3e7fd81e8dabf5dec6a60cd1", "score": "0.59228307", "text": "def cron_get(type)\n request({id: 13,method: 'cron_get', params: [type]})\n end", "title": "" }, { "docid": "adcbc83a0d97ca3ec626d253be044b41", "score": "0.58733267", "text": "def index\n @crons = Cron.all\n end", "title": "" }, { "docid": "8e73a476c88f4911daac2fb0d7e8bf01", "score": "0.58384204", "text": "def index\n @chronologies = Chronology.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @chronologies }\n end\n end", "title": "" }, { "docid": "6742025144f0db4aff9e81cf4fb122a4", "score": "0.58110267", "text": "def new\n @cronjob = Cronjob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cronjob }\n end\n end", "title": "" }, { "docid": "c74c3555a124a8c573daf8d4951d8dc1", "score": "0.57476693", "text": "def crons\n\t\trespond_to do |format|\n\t\t\tformat.json do \n\t\t\t\trender :json => {crons: Logs::Log.get_crons, status: 200}\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "4c8540e6cafed83f776226a858849669", "score": "0.5742037", "text": "def index\n @crontabs = Crontab.all\n\n @crontabs_nonpaginated = Crontab.all\n @crontabs = @crontabs_nonpaginated.paginate(:page => params[:page], :per_page => crontabs_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @crontabs }\n format.json { render :json => @crontabs_nonpaginated }\n format.yaml { send_data @crontabs_nonpaginated.to_yaml }\n end\n end", "title": "" }, { "docid": "4b6f51815b56ae9df2ad7c4ea9be7ebb", "score": "0.5719723", "text": "def index\n @stops = @schedule.stops.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stops }\n end\n end", "title": "" }, { "docid": "ed20fec853110d898f793e665ec14b0f", "score": "0.5710643", "text": "def index\n @cronogramas = Cronograma.search(params[:search], params[:page]) \n end", "title": "" }, { "docid": "e3f98e1c9d2d67219227a92af8f8c9eb", "score": "0.5700307", "text": "def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end", "title": "" }, { "docid": "83f23fba3f6f4e50762e20091e924589", "score": "0.5686913", "text": "def index\n @feria2010calificacionrecursos = Feria2010calificacionrecurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010calificacionrecursos }\n end\n end", "title": "" }, { "docid": "04bd20c70643489c2bec7bd8d24bc764", "score": "0.56551975", "text": "def historico\n @record = Aluno.find(params[:id])\n #id_etiquetas = @record.etiquetas.map {|i| i.codigo.to_s}\n #etiqueta_query = Registro.select(\"id\").where(\"etiqueta_id in (?)\", id_etiquetas)\n #@registros_historico = Registro.where(etiqueta_query.where_values).order(dia: :desc, hora: :asc)\n @registros_historico = Registro.where(aluno: @record).order(dia: :desc, hora: :asc)\n\n #logger.info @registros_historico.inspect\n respond_to do |format| \n format.xml\n end\n end", "title": "" }, { "docid": "cc6d259b92c009f777e32815b9fdfac5", "score": "0.56484044", "text": "def show\n @scheduler = Scheduler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scheduler }\n end\n end", "title": "" }, { "docid": "5fd6d2bf4ef7c9dfe3a4ac8afee442e2", "score": "0.5644173", "text": "def get\n @xml = @paths.map { |path|\n puts \"GET\\t#{@host + path}\"\n RestClient.get(@host + path) { |response, request, result|\n puts \"RESPONSE #{response.code}\"\n response.body\n }\n }.map { |response|\n Nokogiri::XML(response).xpath(\"/*\").to_s\n }\n self\n end", "title": "" }, { "docid": "962a71e9974bf1fbcaaed6655ce8da6d", "score": "0.5637718", "text": "def get_cron_job(nid)\n @conn.get(\"/api/v1/cronjobs/#{nid}\")\n end", "title": "" }, { "docid": "58e2efe08d2cc5ee9cde299b560c5736", "score": "0.5635035", "text": "def schedules(schedule_date = nil)\n schedule_date ||= Time.zone.today\n schedule_date = Time.zone.parse(schedule_date.to_s).to_date.to_s\n get(\"sports/en/schedules/#{schedule_date}/schedule.xml\")\n end", "title": "" }, { "docid": "b31ebdd2aa125cd99c485a714644270a", "score": "0.56326026", "text": "def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss # index.rss.builder \n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "b6faac29a0c794bd57f0710a19b48663", "score": "0.56301546", "text": "def show\n @sheduler = Sheduler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sheduler }\n end\n end", "title": "" }, { "docid": "1d13f784183cb0418908916b6fabeca1", "score": "0.56265455", "text": "def index\n fini = Date.new(params[:anio].to_i,params[:mes].to_i,1)\n ffin = fini.next_month-1\n\n cadena = getturnos(fini,ffin)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => cadena }\n end\n end", "title": "" }, { "docid": "2c102204b0601ab67cc8d29fae5775ff", "score": "0.56148016", "text": "def index\n @tipo_consultas = TipoConsulta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_consultas }\n end\n end", "title": "" }, { "docid": "27519824b67207bccfba0de28d5b2919", "score": "0.5602831", "text": "def url; \"http://localhost:3000/sdn.xml\"; end", "title": "" }, { "docid": "7134362b8e80b2914cb648fd8aa23fc5", "score": "0.56013775", "text": "def index\r\n @uejecutoras = Uejecutora.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @uejecutoras }\r\n end\r\n end", "title": "" }, { "docid": "94e2805054d6e3944df67e1ef04e32dc", "score": "0.55951875", "text": "def index\r\n @schedules = Schedule.find(:all)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @schedules }\r\n end\r\n end", "title": "" }, { "docid": "2ba39ff63872e5b3b09fb31a36a7fb47", "score": "0.55910313", "text": "def index\n @chronology = Chronology.find(params[:chronology_id])\n @chronology_items = @chronology.chronology_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @chronology_items }\n end\n end", "title": "" }, { "docid": "8f290c02ab0fcc4ccb8e91873dfb8ad4", "score": "0.5588405", "text": "def index\n @simeasts = Simeast.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @simeasts }\n end\n end", "title": "" }, { "docid": "3d1ba71c11785178577131cbb4060ccd", "score": "0.5587947", "text": "def index\n @scheduled_tasks = ScheduledTask.where(\"perform_at > ?\", Time.now).order(\"perform_at ASC\")\n @recent_tasks = ScheduledTask.where(\"perform_at < ? \", Time.now).order(\"perform_at DESC\").limit(50)\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @scheduled_tasks }\n end\n end", "title": "" }, { "docid": "d670ea9902efbbad0bcdb79cd6223c04", "score": "0.5559737", "text": "def show\n @chronology = Chronology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chronology }\n end\n end", "title": "" }, { "docid": "232eebb07a9c6793ff4ebc88805b43b0", "score": "0.5554557", "text": "def index\n @discipline = Discipline[params[\"discipline\"]]\n @discipline_names = Discipline.names\n @calculations = Calculations::V3::Calculation.with_results(@year)\n\n respond_to do |format|\n format.html\n format.xml do\n fresh_when RacingAssociation.current, public: true\n all_events\n end\n end\n end", "title": "" }, { "docid": "b1b8216fee8f527f689d9ec97018ba69", "score": "0.55538744", "text": "def index\n @rescats = Rescat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rescats }\n end\n end", "title": "" }, { "docid": "6e32a3c20e28c556c334bcf5cc829af8", "score": "0.55527776", "text": "def show\n @observacao_historico = ObservacaoHistorico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @observacao_historico }\n end\n end", "title": "" }, { "docid": "098b500fe7a3731951a4ae7a47f5359c", "score": "0.55494934", "text": "def show\n @schedulerun = Schedulerun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedulerun }\n end\n end", "title": "" }, { "docid": "6e045f506cd9bbccc3243400fd62e78c", "score": "0.55458826", "text": "def show\n @simple_schedule = SimpleSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @simple_schedule }\n end\n end", "title": "" }, { "docid": "17688de12bdb357a0bee95b613eeb00c", "score": "0.5544341", "text": "def show\n @ordem_servicos_executado = OrdemServicosExecutado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordem_servicos_executado }\n end\n end", "title": "" }, { "docid": "0d06868790f67c0b9af173f7a51323e2", "score": "0.55270797", "text": "def index\n @cst_pis = CstPis.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_pis }\n end\n end", "title": "" }, { "docid": "7f55ab152fad7456da42dac94ce2e6bf", "score": "0.55264616", "text": "def index\n retrieve_vtodos\n\n respond_to do |format|\n format.html # index.html.erb\n format.rdf { render :xml => ICAL::Vtodo.to_xml }\n end\n end", "title": "" }, { "docid": "5b1e979362a770475b24264e5b94cd90", "score": "0.5509918", "text": "def tournament_schedule(tournament_uid)\n get(\"sports/en/tournaments/#{tournament_uid}/schedule.xml\")\n end", "title": "" }, { "docid": "3f1691e3f406716bcb72e675e33593cd", "score": "0.5509221", "text": "def get_xml_data(startat_value)\n puts \"getting xml data\"\n url = \"#{BASE_URL}?#{SEARCH_CONDITIONS}#{startat_value}\"\n Net::HTTP.get_response(URI.parse(url)).body\nend", "title": "" }, { "docid": "909d6d062abbfae97792e79583bd3b9c", "score": "0.5504582", "text": "def index\n @timelines = Timeline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @timelines }\n end\n end", "title": "" }, { "docid": "040ac2aee1c1e46decd04282d3229a41", "score": "0.55038315", "text": "def index\n nextday = future_date(params[:period]) \n @events = Event.fetch_for_period(Date.today, nextday)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "title": "" }, { "docid": "e6fc80767fc03ee31232eb402094caa6", "score": "0.54959995", "text": "def index\n @jira_countdowns = JiraCountdown.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jira_countdowns }\n end\n end", "title": "" }, { "docid": "b61ae47fe9e7a26de08415c2920b5857", "score": "0.54912806", "text": "def tonnerre \n \n @rr =params['id']\n @arret = params['sobriquet']\n ll = []\n if @rr \n repu = \"http://pt.data.tisseo.fr/departureBoard?stopPointId=\"+@rr+\"&key=a11d95b1a1e8ff54095e3d368bc6bc6ba\"\n asset1 = \"app/assets/xml/departs.xml\"\n selecteur = \"departure\"\n retourTrio = connecte(repu)\n xmlcompose = compose(asset1,retourTrio)\n ll = liste_finale(asset1,selecteur)\n @li = ll\n @xmlret = retard(\"19:12:03\",\"15:07:01\")\n else @xmlret = \"Station non desservie\"\n \n end \nend", "title": "" }, { "docid": "328084144e8eb954067fad34e3ce77f6", "score": "0.5487056", "text": "def index\n services = (\"Service::\" + params[:type]).constantize.get_available(:all)\n render :xml => services.to_xml(:root => :services, :except => :config)\n end", "title": "" }, { "docid": "29f6534ae5e6c580f12ad9c6b4a2ee1c", "score": "0.5479332", "text": "def index\n @observacao_notas = ObservacaoNota.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @observacao_notas }\n end\n end", "title": "" }, { "docid": "e13f770f71bd62cedd0691a4ce0a5054", "score": "0.5468985", "text": "def index\n @calendar_tab = \"Calendar\"\n\n respond_to do |format|\n format.html do\n render_page\n end\n format.rss do\n redirect_to schedule_path(format: :atom), status: :moved_permanently\n end\n format.atom\n format.json do\n events = []\n @events.each do |event|\n events << {\n id: event.id,\n title: event.full_name,\n description: event.full_name,\n start: event.date.to_s,\n end: event.end_date.to_s,\n allDay: true,\n url: event.flyer.to_s\n }\n end\n render json: events.to_json\n end\n format.ics { render_ics }\n format.xlsx { headers[\"Content-Disposition\"] = 'filename=\"schedule.xlsx\"' }\n end\n end", "title": "" }, { "docid": "055d11fc0ab10299436f6825b39c53a7", "score": "0.5467821", "text": "def index\n @soaplab_servers = SoaplabServer.paginate(:page => @page,\n :per_page => @per_page, \n :order => 'id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @soaplab_servers }\n end\n end", "title": "" }, { "docid": "e8cb74188e06680984a8d2c28f022a8d", "score": "0.54657054", "text": "def index\n @traffic_alarms = TrafficAlarm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffic_alarms }\n end\n end", "title": "" }, { "docid": "e8a54733135a5869c1200fb2b0812b1b", "score": "0.5462007", "text": "def index\n @historic_costs = HistoricCost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @historic_costs }\n end\n end", "title": "" }, { "docid": "3a65b51a54a3de182d04bf64d8548235", "score": "0.54590565", "text": "def index\n @calendars = Calendar.find(:all)\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendars }\n end\n end", "title": "" }, { "docid": "c2b02dc1ff2bde43970b336118d8df28", "score": "0.54471487", "text": "def index\n @tipo_processos = TipoProcesso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_processos }\n end\n end", "title": "" }, { "docid": "ba92a5b77af8f665b6c8765d5353b21b", "score": "0.5444653", "text": "def show\n @calendario_recurso = CalendarioRecurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendario_recurso }\n end\n end", "title": "" }, { "docid": "fb8a6dfffd8e0b2ae4000b1b435c85c7", "score": "0.5441633", "text": "def index\n @seguimientos = @institucion.seguimientos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @seguimientos }\n end\n end", "title": "" }, { "docid": "b98e7be4956f6a4a14d23a783f974302", "score": "0.5437054", "text": "def index\r\n if params[:period]\r\n Usage.switch_data(params[:connection], params[:period])\r\n else\r\n Usage.switch_data(params[:connection], \"daily\")\r\n end\r\n from_date = params[:startdate] ? params[:startdate] : 1.months.ago.utc.strftime(\"%Y-%m-%d\")\r\n to_date = params[:enddate] ? params[:enddate] : Time.now.utc.strftime(\"%Y-%m-%d\")\r\n @usages = Usage.find(:all, :select => \"server_date,server_usage,G4,G3\", :group => \"server_usage\", :order => \"id\", :conditions => [\"server_date >= ? and server_date <= ?\",\r\n from_date,to_date]) \r\n respond_to do |format|\r\n format.html #index.html.erb\r\n format.xml { render :xml => @usages.to_xml(:root => 'records', :children => 'record', :dasherize => false, :skip_types => true) }\r\n end\r\n end", "title": "" }, { "docid": "0a871438e5c199d5408681dc90d73337", "score": "0.5430824", "text": "def schedule(schedule, options={})\n params = { :klass => Invoicexpress::Models::Schedule }\n get(\"schedules/#{id_from_schedule(schedule)}.xml\", params.merge(options))\n end", "title": "" }, { "docid": "aaefe73cc79ae30696dba728c9ae3e53", "score": "0.5424208", "text": "def index\n add_breadcrumb Schedule.find(params[:schedule_id]).title, schedule_path(params[:schedule_id])\n\t add_breadcrumb \"Logs\", schedule_logs_path(params[:schedule_id])\n\n @logs =Log.where(:schedule_id => params[:schedule_id]).page(params[:page]).per(10).order(sort_column + \" \" + sort_direction)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @logs }\n end\n end", "title": "" }, { "docid": "909f327203eaecf3fb0eeb3cc45e2d22", "score": "0.5419454", "text": "def index\n @agenda_reservations = Agenda::Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @agenda_reservations }\n end\n end", "title": "" }, { "docid": "0a6c6c87b12ba75303b0ea9313493763", "score": "0.54184556", "text": "def index\n @tasks = @sprint.tasks.find(:all, :order => \"backlog_item_id, description\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "235f7d2009e5684dee587db233ad19a5", "score": "0.54171914", "text": "def index\n @sitios = Sitio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sitios }\n end\n end", "title": "" }, { "docid": "c75d09920fe63d313b6403c105b3b7ff", "score": "0.5414291", "text": "def fetch_sitemap\n $LOG.verbose 'Calling Drupal cron and sitemap' if $LOG.verbose?\n cron_request = @faraday.get('/cron/rhd') do |req|\n req.options['timeout'] = 600;\n end\n\n unless cron_request.success?\n $LOG.error \"Error invoking drupal cron. Status: #{cron_request.status}.\" if $LOG.error?\n exit(1)\n end\n\n sitemap_request = @faraday.get('/sitemap.xml')\n unless sitemap_request.success?\n $LOG.error \"Error retreiving drupal sitemap. Status: #{sitemap_request.status}\" if $LOG.error?\n exit(1)\n end\n\n parse_sitemap(sitemap_request)\n end", "title": "" }, { "docid": "626275611ae72828343c4a97d678cca0", "score": "0.5410131", "text": "def index\n @runs = Run.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @runs }\n end\n end", "title": "" }, { "docid": "0ec813eb738da033ad47841810b2700a", "score": "0.5406067", "text": "def show\n @weekly_rota = WeeklyRota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weekly_rota }\n end\n end", "title": "" }, { "docid": "d8f9caf44b69389ba0a1dd0a109b5f07", "score": "0.5404359", "text": "def index\n @calendars = Calendar.for_company_id(params[:company_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendars }\n end\n end", "title": "" }, { "docid": "ef15f8b52a70683ccde16a0d2c91b51b", "score": "0.5395478", "text": "def index\n @schedulers = Scheduler.all\n end", "title": "" }, { "docid": "e2515eb7c208fd217ed0ea36ff3c048f", "score": "0.53939646", "text": "def index\n @sitios = Sitio.all\n logger.info 'informational message'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sitios }\n end\n end", "title": "" }, { "docid": "1af3b7b81a1badbc7d9ff32eba2a3030", "score": "0.5392418", "text": "def download_xml\r\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/alojamientos_v1_es.xml\")\r\n\t\tresponse = Net::HTTP.get_response(uri)\r\n\t\tcontent = response.body\r\n\r\n\t\txml = REXML::Document.new(content)\r\n\r\n\t\treturn xml\r\n\tend", "title": "" }, { "docid": "85727c4643f9e341ef75359db6399040", "score": "0.5383575", "text": "def index\n @operacoes = Operacao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @operacoes }\n end\n end", "title": "" }, { "docid": "d3381cba600c14084602b7374e4de141", "score": "0.5383028", "text": "def index\n @processos = Processo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @processos }\n end\n end", "title": "" }, { "docid": "b9d1993bb61a5e8af903bcc1b9342f69", "score": "0.5380103", "text": "def index\n @result = headers(\"/live_events\")\n\n @xml_response = RestClient::Request.execute(\n :method => :get,\n :url => \"http://nqm7e3lvuev71.cloud.elementaltechnologies.com/live_events\",\n :headers => { \"X-Auth-User\" => @result[\"X-Auth-User\"],\n \"X-Auth-Expires\" => @result['X-Auth-Expires'],\n \"X-Auth-Key\" => @result['X-Auth-Key'],\n \"Accept\" => \"application/xml\",\n \"Content-Type\" => \"application/xml\"\n }\n )\n \n @doc = Nokogiri::XML(@xml_response)\n \n @live_events = @doc.xpath(\"//live_event\")\n\n end", "title": "" }, { "docid": "6f25c524718beb246a76112d2c3b0c71", "score": "0.53760153", "text": "def show\n @default_schedule = DefaultSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @default_schedule }\n end\n end", "title": "" }, { "docid": "00147d21e8e41f3af165b65850902f49", "score": "0.5366687", "text": "def index\n @lifecycles = Lifecycle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lifecycles }\n end\n end", "title": "" }, { "docid": "00147d21e8e41f3af165b65850902f49", "score": "0.5366687", "text": "def index\n @lifecycles = Lifecycle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lifecycles }\n end\n end", "title": "" }, { "docid": "78f48c2e76d3046a51da570b622d8d9b", "score": "0.53647995", "text": "def load_events_xml(param)\n request = new_request Net::HTTP::Report do |request|\n request.body = CalendarQuery.new.event(param).to_xml\n end\n @response = perform_request request\n end", "title": "" }, { "docid": "4cdad6e46fbb6994fbbc113f64b1add9", "score": "0.5363595", "text": "def index\n\t\tapi_key = params[:api_key]\n\t\tservice_id = params[:service_id]\n\t\tsource_id = params[:source_id]\n\n\t\tj = JSON.parse(open(\"#{@@uri_prefix}#{@@service}#{service_id}/info?locale=en-US&sourceid=#{source_id}&inprogress=true&apikey=#{api_key}&sig=sig\").read)\n\t\t@airings = j[\"LinearScheduleResult\"][\"Schedule\"][\"Airings\"].map { |a| \n\t\t\to = Airing.new(a.symbolize_keys) \n\t\t}\n\t\tfeed = Atom::Feed.new do |f|\n\t\t f.title = \"Whats on #{@airings.first.SourceDisplayName}\"\n\t\t f.authors << Atom::Person.new(:name => 'Rovi')\n\t\t f.updated = Time.now\n\t\t @airings.each do |airing|\n\t\t\t f.entries << Atom::Entry.new do |e|\n\t\t\t\t e.title = airing.Title\n\t\t\t\t e.updated = airing.AiringTime \n\t\t\t\t e.summary = airing.EpisodeTitle\n\t\t\t\t e.content = Atom::Content::Html.new(airing.Copy) if airing.Copy\n\t\t\t end\n\t\t end\n\t\tend \n\t\trespond_to do |format|\n\t\t\tformat.atom { render :xml => feed.to_xml }\n\t\tend\n\tend", "title": "" }, { "docid": "4f43e02e30e7d31c86521550a6c2264f", "score": "0.5359658", "text": "def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "1e179b96077bf73cd22f07c8e2e307ee", "score": "0.53553516", "text": "def index\n\n params[:fini] = Date.new(2011,1,1)\n params[:ffin] = params[:fini].next_year-1\n\n if (params[:tdato] == nil)\n params[:tdato] = 'Tareas Avance'\n end\n if (params[:id] == nil)\n params[:id] = 1\n end\n\n @tasks = gettasksbymes(Account.find(1), Account.find(params[:id].to_i),Array.new,'>',params[:fini],params[:ffin],params[:tdato])\n @tdato = params[:tdato]\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "d319e1e35450bb5130bece409749d2ea", "score": "0.53537613", "text": "def all\n location_id = params[:id]\n location_id ||= \"1\"\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n # TODO Uncomment when implemented\n create_feed(location_id) unless feed_exists?(location_id)\n res = r[\"exist/atom/content/4302Collection/\"+location_id].get\n #res = r[\"exist/atom/content/4302Collection/root-trends\"].get\n render :xml => res\n end", "title": "" }, { "docid": "6017273ee6acec3bf973990de8428de9", "score": "0.53529024", "text": "def index\n @feria2010calificaciones = Feria2010calificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010calificaciones }\n end\n end", "title": "" }, { "docid": "3d1a03c748fcd5fc149256f4c3dbbe5d", "score": "0.53514636", "text": "def index\n collect_schedule_data\n end", "title": "" }, { "docid": "e80b09bc7d8e426776f0117a7a899c8b", "score": "0.5351371", "text": "def index\n unless params[:busqueda].blank? \n @serie_cronologicas = SerieCronologica.paginate(:per_page => 20, :page => params[:page], :order => 'fechaYear DESC', :conditions => ['fechaYear like ? OR hecho like ? OR contexto like ? OR gobierno like ? OR fuentes like ?', '%'+params[:busqueda]+'%', '%'+params[:busqueda]+'%', '%'+params[:busqueda]+'%', '%'+params[:busqueda]+'%', '%'+params[:busqueda]+'%'])\n else\n @serie_cronologicas = SerieCronologica.paginate(:per_page => 20, :page => params[:page], :order => 'fechaYear DESC')\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @serie_cronologicas }\n end\n end", "title": "" }, { "docid": "1486b0d2d6a1a3fc4dfda5124d443bed", "score": "0.53512555", "text": "def show\n @periodicity = Periodicity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @periodicity }\n end\n end", "title": "" }, { "docid": "fdd60cd13e6cb9ba64e9a8dcd125649d", "score": "0.5334911", "text": "def index\r\n @systems = System.find :all \r\n respond_to do |format|\r\n format.html #index.html.erb\r\n format.xml { render :xml => @systems.to_xml(:dasherize => false) }\r\n end\r\n end", "title": "" }, { "docid": "12bbad59a7863efd247436e7d48aeba4", "score": "0.53306407", "text": "def get_elink_today\n set_home_menu\n get_config\n \n #request=\"http://#{@ip}:#{@port}/QueryByAccessionNO/A11R4C02738\"\n #request=\"http://#{@ip}:#{@port}/QueryByChartNO/8006154\"\n #request=\"http://#{@ip}:#{@port}/QueryByExamDate/2012/10/25\"\n #request=\"http://#{@ip}:#{@port}/test\"\n dt=Time.now().strftime(\"%Y/%m/%d\")\n request=\"http://#{@ip}:#{@port}/QueryByExamDate/#{dt}\"\n res = Rho::AsyncHttp.get(\n :url => request\n )\n \n @elinks = Rho::JSON.parse(res[\"body\"])\n \n render :action => :home\n end", "title": "" }, { "docid": "4e62254ba55e697d45e97b83017c5062", "score": "0.532796", "text": "def index\n @tasks = Task.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "4e62254ba55e697d45e97b83017c5062", "score": "0.532796", "text": "def index\n @tasks = Task.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "bd6f3510f7facce06625c90fb77dafc0", "score": "0.53227764", "text": "def destroy\n @serie_cronologica = SerieCronologica.find(params[:id])\n @serie_cronologica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_serie_cronologicas_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9f562e4f5cb8dfd69b724fe98612282b", "score": "0.53224844", "text": "def index\n @monthly_details = MonthlyDetail.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @monthly_details }\n end\n end", "title": "" }, { "docid": "e2ffb93146d25d4e587c540597f308aa", "score": "0.53220165", "text": "def index\n @movils = Movil.all\n \n cadena = getmovils(@movils)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => cadena }\n end\n end", "title": "" }, { "docid": "18e414375f55174b9b9edcdc527b8a6e", "score": "0.53196603", "text": "def download_xml\r\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/turismo_v1_es.xml\")\r\n\t\tresponse = Net::HTTP.get_response(uri)\r\n\t\tcontent = response.body\r\n\r\n\t\txml = REXML::Document.new(content)\r\n\r\n\t\treturn xml\r\n\tend", "title": "" }, { "docid": "45265ba73f1c7e43f0fccbe7576a80f0", "score": "0.5313354", "text": "def index\n cadena = getactividades(params[:id].to_i)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => cadena }\n end\n end", "title": "" }, { "docid": "b5ec2592c1bd02a0114cca086e1f3aef", "score": "0.5312499", "text": "def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "b5ec2592c1bd02a0114cca086e1f3aef", "score": "0.5312499", "text": "def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "title": "" }, { "docid": "3e97b54d62735f0c711d85b7574187c7", "score": "0.53075486", "text": "def show\r\n Usage.switch_data(params[:Usage], \"daily\")\r\n @usages = Usage.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @usages.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end", "title": "" } ]
889a4c97bdbfaf1e5853d07274725387
Parses the options Hash and returns an array of [SSH_PORT, WINRM_PORT] used to attempt to connect to.
[ { "docid": "d25687db6a987b469d39f8189ddddd29", "score": "0.78055066", "text": "def parse_port_options(options)\n ssh_port = options[:ssh][:port] if options[:ssh]\n winrm_port = options[:winrm][:port] if options[:winrm]\n [ssh_port || DEFAULT_SSH_PORT, winrm_port || DEFAULT_WINRM_PORT]\n end", "title": "" } ]
[ { "docid": "bbbc34ae00075e100b21593570ffecc3", "score": "0.6795421", "text": "def ssh_options(options)\n mapped_options = options.map do |key, value|\n next if value.nil?\n\n case key\n when :auth_methods then opt_auth_methods(value)\n when :bind_address then opt('BindAddress', value)\n when :compression then opt('Compression', value ? 'yes' : 'no')\n when :compression_level then opt('CompressionLevel', value.to_i)\n when :config then value ? \"-F '#{value}'\" : nil\n when :encryption then opt('Ciphers', [value].flatten.join(','))\n when :forward_agent then opt('ForwardAgent', value)\n when :global_known_hosts_file then opt('GlobalKnownHostsFile', value)\n when :hmac then opt('MACs', [value].flatten.join(','))\n when :host_key then opt('HostKeyAlgorithms', [value].flatten.join(','))\n when :host_key_alias then opt('HostKeyAlias', value)\n when :host_name then opt('HostName', value)\n when :kex then opt('KexAlgorithms', [value].flatten.join(','))\n when :key_data then nil # not supported\n when :keys then [value].flatten.select { |k| File.exist?(k) }.map { |k| \"-i '#{k}'\" }\n when :keys_only then opt('IdentitiesOnly', value ? 'yes' : 'no')\n when :languages then nil # not applicable\n when :logger then nil # not applicable\n when :paranoid then opt('StrictHostKeyChecking', value ? 'yes' : 'no')\n when :passphrase then nil # not supported\n when :password then nil # not supported\n when :port then \"-p #{value.to_i}\"\n when :properties then nil # not applicable\n when :proxy then opt('ProxyCommand', value.command_line)\n when :rekey_blocks_limit then nil # not supported\n when :rekey_limit then opt('RekeyLimit', reverse_interpret_size(value))\n when :rekey_packet_limit then nil # not supported\n when :timeout then opt('ConnectTimeout', value.to_i)\n when :user then \"-l #{value}\"\n when :user_known_hosts_file then multi_opt('UserKnownHostsFile', value)\n when :verbose then opt('LogLevel', interpret_log_level(value))\n end\n end.compact\n\n mapped_options.empty? ? mapped_options : %[-e \"ssh #{mapped_options.join(' ')}\"]\n end", "title": "" }, { "docid": "36ddd2de2d1c41e8c26f4f81d430f282", "score": "0.6734954", "text": "def connect_options(options)\n connect_options = {:ssh_options=>{}}\n if options[:port]\n connect_options[:ssh_options][:port] = options[:port]\n end\n if options[:ip]\n connect_options[:ssh_options][:host_name] = options[:ip]\n end\n return connect_options\n end", "title": "" }, { "docid": "36ddd2de2d1c41e8c26f4f81d430f282", "score": "0.6734954", "text": "def connect_options(options)\n connect_options = {:ssh_options=>{}}\n if options[:port]\n connect_options[:ssh_options][:port] = options[:port]\n end\n if options[:ip]\n connect_options[:ssh_options][:host_name] = options[:ip]\n end\n return connect_options\n end", "title": "" }, { "docid": "152f725683d2d773577d6694a0e17c28", "score": "0.6435304", "text": "def option_values_target_ports\n\t\tres = [ ]\n\t\treturn res if not framework.db.active\n\t\treturn res if not self.active_module.datastore['RHOST']\n\t\thost = framework.db.has_host?(self.active_module.datastore['RHOST'])\n\t\treturn res if not host\n\n\t\tframework.db.each_service do |service|\n\t\t\tif (service.host_id == host.id)\n\t\t\t\tres << service.port.to_s\n\t\t\tend\n\t\tend\n\n\t\treturn res\n\tend", "title": "" }, { "docid": "77cce6cfa4402d54cbb1030f3418ade4", "score": "0.64212596", "text": "def split_options(options)\n # merge in default values to fill in any missing options with default values\n options = default_options.merge(options)\n # then extract the various configuration options used when connecting to the Cassandra\n # cluster (hosts, username, password, port, timeout, keyspace, repl_strategy, and repl_factor)\n hosts = options['hosts']\n username = options['username']\n password = options['password']\n port = options['port']\n timeout = options['timeout']\n keyspace = options['keyspace']\n repl_strategy = options['repl_strategy']\n repl_factor = options['repl_factor']\n [hosts, username, password, port, timeout, keyspace, repl_strategy, repl_factor]\n end", "title": "" }, { "docid": "41ad6f1a6a71614f051a79f9a538dc2c", "score": "0.63085204", "text": "def split_options(options)\n # merge in default values to fill in any missing options with default values\n options = default_options.merge(options)\n # then extract the various configuration options used when connecting to the Cassandra\n # cluster (host, username, password, port, timeout)\n host = options['host']\n username = options['username']\n password = options['password']\n port = options['port']\n timeout = options['timeout']\n dbname = options['dbname']\n [host, username, password, port, timeout, dbname]\n end", "title": "" }, { "docid": "c9768484d43c3bb1b650bdafecfd00c7", "score": "0.6243095", "text": "def host_and_port\n [roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22]\n end", "title": "" }, { "docid": "46615e97ae404f257af8d994db157fdb", "score": "0.62346745", "text": "def ssh_port\n ssh_options[:port]\n end", "title": "" }, { "docid": "41ef68ac3313abe8379966fb5400ea22", "score": "0.62186724", "text": "def parse_options\n opts = GetoptLong.new(\n [ '--help', '-h', GetoptLong::NO_ARGUMENT ],\n [ '--port', '-p', GetoptLong::REQUIRED_ARGUMENT ],\n [ '--type', '-t', GetoptLong::REQUIRED_ARGUMENT ]\n )\n key_types = [ 'ssh-rsa', 'ssh-dss' ]\n port = DEFAULT_SSH_PORT\n begin\n opts.each do |opt, arg|\n case opt\n when '--help'\n usage\n when '--port'\n error(\"Invalid port number `#{arg}'\", 2) unless arg =~ /\\A\\d+\\Z/\n port = arg.to_i\n when '--type'\n case arg\n when 'rsa'\n key_types = [ 'ssh-rsa' ]\n when 'dsa'\n key_types = [ 'ssh-dss' ]\n else\n error(\"Unknown key type `#{arg}'\", 2)\n usage(2)\n end\n end\n end\n rescue GetoptLong::MissingArgument, GetoptLong::InvalidOption\n usage(2)\n end\n error('No host given', 2) if ARGV.empty?\n [ key_types, ARGV, port ]\nend", "title": "" }, { "docid": "e718eceb8141e5fdf66f030cefbfd25e", "score": "0.62177867", "text": "def get_remote_options\n opts = { :port => config[:port] }\n opts[:password] = config[:password] if config.include?(:password)\n opts\n end", "title": "" }, { "docid": "f3eeea9668f35fad9615f332e8092e03", "score": "0.61173534", "text": "def get_net_ssh_options\n rOptions = {}\n\n if (@SSHOptions[:ask_for_password])\n rOptions[:password] = get_password(\"login #{@SSHLogin}\")\n end\n if (@SSHOptions[:ask_for_key_passphrase])\n rOptions[:passphrase] = get_password(\"key passphrase of #{@SSHLogin}\")\n end\n\n return rOptions\n end", "title": "" }, { "docid": "367df0c85f48440fbb91b52dbbd3531e", "score": "0.59040225", "text": "def ssh_options\n keys_option + host_key_check_options\n end", "title": "" }, { "docid": "93e21bd4c6729ee31dbcdde3635ee836", "score": "0.58984405", "text": "def connectivity_options\n %w[host port socket].map do |option|\n next if send(option).to_s.empty?\n \"--#{option}='#{send(option)}'\"\n end.compact.join(' ')\n end", "title": "" }, { "docid": "c66156f33e4c78e8779d20e47940fd93", "score": "0.58531713", "text": "def options\n options = Array.new\n options << \"-a #{self.address}\"\n options << \"-p #{self.port}\"\n options << \"-S #{self.socket}\" if self.socket\n options << \"-e #{self.env}\"\n options << \"-d\" if self.daemonize\n options << \"-l #{self.log}\" if self.log\n #options << \"-P #{self.pid}\" if self.pid\n options << \"-u #{self.duser}\" if self.duser\n options << \"-g #{self.dgroup}\" if self.dgroup\n options << \"-s #{self.servers}\"\n options << \"-D\" if self.debug\n return options.join(\" \")\n end", "title": "" }, { "docid": "f7e619f3964d95021781f9d106dc188a", "score": "0.5851226", "text": "def ssh_config_options(host)\n return Net::SSH::Config.for(host)\n end", "title": "" }, { "docid": "6ccbff849dd335a4edfde964cd0c6bf0", "score": "0.5813956", "text": "def connectivity_options\n %w[host port socket].map do |option|\n next if send(option).nil?; \"-#{option[0,1]} '#{send(option)}'\"\n end.compact.join(\"\\s\")\n end", "title": "" }, { "docid": "b12169903ae1a68729b623df38c34b9d", "score": "0.5806147", "text": "def connection_options(data)\n opts = {\n logger: logger,\n user_known_hosts_file: \"/dev/null\",\n hostname: data[:hostname],\n port: data[:port],\n username: data[:username],\n compression: data[:compression],\n compression_level: data[:compression_level],\n keepalive: data[:keepalive],\n keepalive_interval: data[:keepalive_interval],\n timeout: data[:connection_timeout],\n connection_retries: data[:connection_retries],\n connection_retry_sleep: data[:connection_retry_sleep],\n max_ssh_sessions: data[:max_ssh_sessions],\n max_wait_until_ready: data[:max_wait_until_ready],\n ssh_gateway: data[:ssh_gateway],\n ssh_gateway_username: data[:ssh_gateway_username],\n\t auth_methods: %w[gssapi-with-mic]\n }\n\n opts[verify_host_key_option] = false\n\n opts[:forward_agent] = data[:forward_agent] if data.key?(:forward_agent)\n opts[:verbose] = data[:verbose].to_sym if data.key?(:verbose)\n\n opts\n end", "title": "" }, { "docid": "4121e99cb86aa2f71d8e7cb7a578bf54", "score": "0.5783029", "text": "def connectivity_options\n %w[host port socket].map do |option|\n next if send(option).to_s.empty?\n \"--#{option}='#{send(option)}'\".gsub('--socket=', '--host=')\n end.compact.join(' ')\n end", "title": "" }, { "docid": "67e5b208cca203fcb631c6a0bb713b54", "score": "0.57654244", "text": "def host_and_port\n return roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22\n end", "title": "" }, { "docid": "67e5b208cca203fcb631c6a0bb713b54", "score": "0.57654244", "text": "def host_and_port\n return roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22\n end", "title": "" }, { "docid": "67e5b208cca203fcb631c6a0bb713b54", "score": "0.57654244", "text": "def host_and_port\n return roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22\n end", "title": "" }, { "docid": "b275a82472d2004e7286bbc141fb5f47", "score": "0.57608855", "text": "def base_opts\n port = config_for_protocol(:port)\n user = config_for_protocol(:user)\n {}.tap do |opts|\n opts[:logger] = Chef::Log\n opts[:password] = config[:connection_password] if config.key?(:connection_password)\n opts[:user] = user if user\n opts[:max_wait_until_ready] = config[:max_wait].to_i unless config[:max_wait].nil?\n # TODO - when would we need to provide rdp_port vs port? Or are they not mutually exclusive?\n opts[:port] = port if port\n end\n end", "title": "" }, { "docid": "3ac9b3a078224d344103c9f47ad18102", "score": "0.57594204", "text": "def port(opts={})\n # Check if port was specified in options hash\n return opts[:port] if opts[:port]\n\n # Check if a port was specified in the config\n return env.config.ssh.port if env.config.ssh.port\n\n # Check if we have an SSH forwarded port\n pnum_by_name = nil\n pnum_by_destination = nil\n env.vm.vm.network_adapters.each do |na|\n # Look for the port number by name...\n pnum_by_name = na.nat_driver.forwarded_ports.detect do |fp|\n fp.name == env.config.ssh.forwarded_port_key\n end\n\n # Look for the port number by destination...\n pnum_by_destination = na.nat_driver.forwarded_ports.detect do |fp|\n fp.guestport == env.config.ssh.forwarded_port_destination\n end\n\n # pnum_by_name is what we're looking for here, so break early\n # if we have it.\n break if pnum_by_name\n end\n\n return pnum_by_name.hostport if pnum_by_name\n return pnum_by_destination.hostport if pnum_by_destination\n\n # This should NEVER happen.\n raise Errors::SSHPortNotDetected\n end", "title": "" }, { "docid": "442ec5e114f19eb94e029034226b70f0", "score": "0.5730856", "text": "def host_and_port\n return roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22\n end", "title": "" }, { "docid": "442ec5e114f19eb94e029034226b70f0", "score": "0.5730856", "text": "def host_and_port\n return roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22\n end", "title": "" }, { "docid": "bd4f74d6062186f1273f42fc20082729", "score": "0.5727543", "text": "def ssh_options\n {\n :port => Forward.ssh_port,\n :keys_only => true,\n :keys => [],\n :key_data => [ @config.private_key ],\n :encryption => 'blowfish-cbc'\n }\n end", "title": "" }, { "docid": "1b13397b8578bf556701738a7b5f67c7", "score": "0.5726515", "text": "def connectivity_options\n %w[host port socket].map do |option|\n next if send(option).to_s.empty?\n \"-#{option[0,1]} '#{send(option)}'\"\n end.compact.join(' ')\n end", "title": "" }, { "docid": "2fabc235321b6d6378b622fcd2ea60f8", "score": "0.5716863", "text": "def connectivity_options\n %w[host port socket].map do |option|\n next if send(option).nil? or (send(option).respond_to?(:empty?) and send(option).empty?)\n \"--#{option}='#{send(option)}'\".gsub('--socket=', '--host=')\n end.compact.join(\"\\s\")\n end", "title": "" }, { "docid": "0ceac0dbd28e4d0e14acd4a3fd60a9e0", "score": "0.5713366", "text": "def options_parse(options_parser)\n options_parser.on('-g', '--ssh-gateway-user USER', \"Name of the gateway user to be used by the gateways. Can also be set from environment variable hpc_ssh_gateway_user. Defaults to #{@ssh_gateway_user}.\") do |user|\n @ssh_gateway_user = user\n end\n options_parser.on('-j', '--ssh-no-control-master', 'If used, don\\'t create SSH control masters for connections.') do\n @ssh_use_control_master = false\n end\n options_parser.on('-q', '--ssh-no-host-key-checking', 'If used, don\\'t check for SSH host keys.') do\n @ssh_strict_host_key_checking = false\n end\n options_parser.on('-u', '--ssh-user USER', 'Name of user to be used in SSH connections (defaults to hpc_ssh_user or USER environment variables)') do |user|\n @ssh_user = user\n end\n options_parser.on('-w', '--password', 'If used, then expect SSH connections to ask for a password.') do\n @auth_password = true\n end\n options_parser.on('-y', '--ssh-gateways-conf GATEWAYS_CONF', 'Name of the gateways configuration to be used. Can also be set from environment variable hpc_ssh_gateways_conf.') do |gateway|\n @ssh_gateways_conf = gateway.to_sym\n end\n end", "title": "" }, { "docid": "ce8a7fe9c4c4db14e4ca34834bfae82a", "score": "0.5712435", "text": "def required_ports\n [22, 80, 443, 4222]\n end", "title": "" }, { "docid": "af42eee9c050e8604cdfac4598e59532", "score": "0.5675335", "text": "def getOpenPorts\n puts \"Running command: \"+@ports_cmd if @debug\n out=`#{@ports_cmd}`.split(\"\\n\")\n ports=Array.new\n out.each do |line|\n line.chomp!\n next if line =~ /^COMMAND|->|127.0.0.1:|192.168.122.1:|\\[.+\\]:/\n puts line if @debug\n entry=Hash.new\n column=line.split(/\\s+/)\n entry[:proc]=column[0]\n if column[column.length-1] =~ /LISTEN/\n entry[:port]=column[column.length-2].split(/:/)[1]\n entry[:proto]=column[column.length-3]\n else\n entry[:port]=column[column.length-1].split(/:/)[1]\n entry[:proto]=column[column.length-2]\n end\n ports.push(entry)\n end\n puts \"Open ports: \" if @debug\n puts YAML.dump(ports) if @debug\n @openPorts=ports\n end", "title": "" }, { "docid": "e071ba7e1bae38148928331bc84136a6", "score": "0.5662729", "text": "def port\n @options[:port]\n end", "title": "" }, { "docid": "c2397282e2c2251c54a069dbfbefd0a8", "score": "0.56531996", "text": "def ssh_options\n {\n user: SSH_USER,\n # Net::SSH::Simple modifies it in case of an exception, workaround to\n # avoid unexpected constant modifications\n password: SSH_PASSWORD.dup,\n port: SSH_PORT\n }\n end", "title": "" }, { "docid": "075c87561ccede52a19e00d8483a7363", "score": "0.5652247", "text": "def option_values_target_addrs\n\t\tres = [ ]\n\t\tres << Rex::Socket.source_address()\n\t\treturn res if not framework.db.active\n\n\t\t# List only those hosts with matching open ports?\n\t\tmport = self.active_module.datastore['RPORT']\n\t\tif (mport)\n\t\t\tmport = mport.to_i\n\t\t\thosts = {}\n\t\t\tframework.db.each_service do |service|\n\t\t\t\tif (service.port == mport)\n\t\t\t\t\thosts[ service.host.address ] = true\n\t\t\t\tend\n\t\t\tend\n\n\t\t\thosts.keys.each do |host|\n\t\t\t\tres << host\n\t\t\tend\n\n\t\t# List all hosts in the database\n\t\telse\n\t\t\tframework.db.each_host do |host|\n\t\t\t\tres << host.address\n\t\t\tend\n\t\tend\n\n\t\treturn res\n\tend", "title": "" }, { "docid": "29726daa937029eb351d1110ea2717a0", "score": "0.5650788", "text": "def find_port?(vm, options)\n @port = options[:ssh][:port]\n customization_spec = options[:customization_spec]\n if vm.config.guestId.start_with?('win')\n if customization_spec.is_a?(Hash)\n winrm_transport =\n customization_spec[:winrm_transport].nil? ? :negotiate : customization_spec[:winrm_transport].to_sym\n end\n winrm_transport ||= :negotiate\n default_win_port = winrm_transport == :ssl ? '5986' : '5985'\n @port = default_win_port if @port.nil?\n elsif port.nil?\n @port = '22'\n end\n true\n end", "title": "" }, { "docid": "4cb34eed296342f246c90a061237efe6", "score": "0.5650365", "text": "def parse_options\n options = {}\n\n CloudFlock::App.parse_options(options) do |opts|\n opts.separator 'Generate a report for a host'\n opts.separator ''\n\n opts.on('-h', '--host HOST', 'Target host to profile') do |host|\n options[:hostname] = host\n end\n\n opts.on('-p', '--port PORT', 'Port SSH is listening on') do |port|\n options[:port] = port\n end\n\n opts.on('-u', '--user USER', 'Username to log in') do |user|\n options[:username] = user\n end\n\n opts.on('-a', '--password [PASSWORD]', 'Password to log in') do |pass|\n options[:password] = pass\n end\n\n opts.on('-s', '--sudo', 'Use sudo to gain root') do\n options[:sudo] = true\n end\n\n opts.on('-n', '--no-sudo', 'Use su to gain root') do\n options[:sudo] = false\n end\n\n opts.on('-r', '--root-pass PASS', 'Password for root user') do |root|\n options[:root_password] = root\n end\n\n opts.on('-i', '--identity IDENTITY', 'SSH identity to use') do |key|\n options[:ssh_key] = key\n end\n end\n end", "title": "" }, { "docid": "ff8c8066301a4427c7bed32361865935", "score": "0.5636141", "text": "def host_and_port\n return roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22\nend", "title": "" }, { "docid": "e1e4aa5319202158ccf37c8ee51346da", "score": "0.55960274", "text": "def ssh_options(host)\n if not host.is_a? SSHPM::Host\n raise TypeError(\"host #{host} is not a #{SSHPM::Host}\")\n end\n\n options = host.password.fmap do |password|\n { password: password, port: host.port, paranoid: false }\n end\n\n options = options || host.identity.fmap do |identity|\n {\n keys: [],\n key_data: [identity],\n keys_only: true,\n non_interactive: true,\n paranoid: false\n }\n end\n\n options.value\n end", "title": "" }, { "docid": "8e095b196cc06576084d77e851798450", "score": "0.5581803", "text": "def setting_map\n {\n 'ssh': [\n 'user',\n 'password',\n 'run_as',\n 'port',\n 'private_key',\n 'connect_timeout',\n 'host_key_check',\n 'sudo_password',\n 'tmpdir',\n ],\n 'winrm': [\n 'user',\n 'password',\n 'ssl',\n 'ssl_verify',\n 'port',\n 'tmpdir',\n ],\n }\n end", "title": "" }, { "docid": "beb2e53e61b90a394f0e16a32fc1a916", "score": "0.5575062", "text": "def port\n options[:port] || 22\n end", "title": "" }, { "docid": "1acd4427ecf6bd7658f072fdfcb9c53f", "score": "0.557246", "text": "def run_options\n {\n :Port => config.server.port,\n :Host => config.server.host,\n :server => config.server.handler.to_sym,\n :daemonize => false,\n :quiet => false,\n :warn => true,\n :debug => false,\n }\n end", "title": "" }, { "docid": "f5ebfb05b490c7b696d2548ea7129cc5", "score": "0.55718005", "text": "def port(opts={})\n # Check if port was specified in options hash\n return opts[:port] if opts[:port]\n\n # Check if a port was specified in the config\n return @env.config.winrm.port if @env.config.winrm.port\n\n # Check if we have an SSH forwarded port\n pnum_by_name = nil\n pnum_by_destination = nil\n @logger.info(\"Looking for winrm port: #{opts}\")\n @logger.info(\"Looking for winrm port: #{env.config.winrm.inspect}\")\n\n env.vm.vm.network_adapters.each do |na| \n # Look for the port number by destination...\n pnum_by_destination = na.nat_driver.forwarded_ports.detect do |fp|\n fp.guestport == env.config.winrm.guest_port\n end\n end\n\n return pnum_by_destination.hostport if pnum_by_destination\n\n # This should NEVER happen.\n raise Errors::WinRMPortNotDetected\n end", "title": "" }, { "docid": "3f134e20f0939b155b76bd556f39a0af", "score": "0.557098", "text": "def ssh_port\n self.nearest_field \"ssh_port\"\n end", "title": "" }, { "docid": "23a2f09c6f7e6bebb5188921aa43a2d2", "score": "0.556731", "text": "def parse_options\n @options = {\n :port => 9173,\n :environment => 'production',\n :config_path => ENV['CLOUD_CROWD_CONFIG'] || '.'\n }\n @option_parser = OptionParser.new do |opts|\n opts.on('-c', '--config PATH', 'path to configuration directory') do |conf_path|\n @options[:config_path] = conf_path\n end\n opts.on('-n', '--num-workers NUM', OptionParser::DecimalInteger, 'number of worker processes') do |num|\n @options[:num_workers] = num\n end\n opts.on('-p', '--port PORT', 'central server port number') do |port_num|\n @options[:port] = port_num\n end\n opts.on('-e', '--environment ENV', 'server environment (sinatra)') do |env|\n @options[:environment] = env\n end\n opts.on_tail('-v', '--version', 'show version') do\n load_code\n puts \"CloudCrowd version #{VERSION}\"\n exit\n end\n end\n @option_parser.banner = BANNER\n @option_parser.parse!(ARGV)\n end", "title": "" }, { "docid": "c344762f19c52a674ba1413b724b777e", "score": "0.55633456", "text": "def options\n hash = {}\n hash[:p] = ENV[\"FASTLANE_PATH\"] if ENV[\"FASTLANE_PATH\"]\n hash[:P] = ENV[\"FASTLANE_PORT\"] if ENV[\"FASTLANE_PORT\"]\n hash[:r] = ENV[\"FASTLANE_PROTOCOL\"] if ENV[\"FASTLANE_PROTOCOL\"]\n hash.empty? ? nil : hash\n end", "title": "" }, { "docid": "df2b42be2d69f64c493bf2bfec328e71", "score": "0.5555384", "text": "def port\n @options[:port]\n end", "title": "" }, { "docid": "64cf1234d06c1182a26e60d75ea4c429", "score": "0.54940933", "text": "def hosts\n host_port.split(\",\")\n end", "title": "" }, { "docid": "acbe059b45bcc905b57c654e95b7582a", "score": "0.5490994", "text": "def session_options(host, port, user = nil, gateway: false)\n ssh_config = Net::SSH.configuration_for(host, true)\n {}.tap do |opts|\n opts[:user] = user || config[:ssh_user] || ssh_config[:user]\n if !gateway && config[:ssh_identity_file]\n opts[:keys] = File.expand_path(config[:ssh_identity_file])\n opts[:keys_only] = true\n elsif gateway && config[:ssh_gateway_identity]\n opts[:keys] = File.expand_path(config[:ssh_gateway_identity])\n opts[:keys_only] = true\n elsif config[:ssh_password]\n opts[:password] = config[:ssh_password]\n end\n # Don't set the keys to nil if we don't have them.\n forward_agent = config[:forward_agent] || ssh_config[:forward_agent]\n opts[:forward_agent] = forward_agent unless forward_agent.nil?\n port ||= ssh_config[:port]\n opts[:port] = port unless port.nil?\n opts[:logger] = Chef::Log.with_child(subsystem: \"net/ssh\") if Chef::Log.level == :trace\n unless config[:host_key_verify]\n opts[:verify_host_key] = :never\n opts[:user_known_hosts_file] = \"/dev/null\"\n end\n if ssh_config[:keepalive]\n opts[:keepalive] = true\n opts[:keepalive_interval] = ssh_config[:keepalive_interval]\n end\n # maintain support for legacy key types / ciphers / key exchange algorithms.\n # most importantly this adds back support for DSS host keys\n # See https://github.com/net-ssh/net-ssh/pull/709\n opts[:append_all_supported_algorithms] = true\n end\n end", "title": "" }, { "docid": "10b0b8ef3af3e6d126bb123893ab9041", "score": "0.54890305", "text": "def port_option\n \"-e 'ssh -p #{@port}'\"\n end", "title": "" }, { "docid": "0c4bb388de42db8ed205586b6bd1ddff", "score": "0.5483955", "text": "def parse_servers\n tuples = config.scan(SERVER_REGEXP)\n tuples.map do |(host, vrf, authp, acctp, tout, tries, keyfm, key)|\n hsh = {}\n hsh[:hostname] = host\n hsh[:vrf] = vrf\n hsh[:auth_port] = authp.to_i\n hsh[:acct_port] = acctp.to_i\n hsh[:timeout] = tout.to_i\n hsh[:retransmit] = tries.to_i\n hsh[:key_format] = keyfm.to_i\n hsh[:key] = key\n hsh\n end\n end", "title": "" }, { "docid": "1216714e6595657d04ea7e234b9a7c5a", "score": "0.5476213", "text": "def get_options(args)\n options = DEFAULT_OPTIONS\n status = 0\n\n parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} proxy [options]\"\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n opts.on(\"-h\",\"--host\", \"=IP_ADDRESS\", \"IP address to listen on. Default: binds to all IP addresses of the computer\") do |arg|\n options[:host] = arg\n end\n\n opts.on(\"-p\",\"--port\", \"=PORT_NUMBER\", Integer, \"TCP port to listen on. Default port: #{DatabaseProxy::DEFAULT_PORT}\") do |arg|\n options[:port] = arg\n end\n\n opts.on_tail(\"--help\", \"Show this message\") do\n $stderr.puts opts\n options = nil\n end\n end\n\n begin\n parser.parse!(args)\n rescue Exception => e\n $stderr.puts \"Command line parsing failed: #{e}\"\n $stderr.puts parser.help\n options = nil\n status = 1\n end\n \n return options, status\n end", "title": "" }, { "docid": "7e5e02dff46dd34b3b41d2b878ce2d73", "score": "0.5450809", "text": "def handle_options\n OptionParser.new do |opts|\n opts.on('-p', '--port PORT') {|p| options.port = p.to_i }\n opts.on('--install') { options.install = true }\n opts.on('--web') { } # ignore\n end.parse!\n end", "title": "" }, { "docid": "9c432b88b8c0bbca940c63441418c39e", "score": "0.5440109", "text": "def options\n options = String.new\n options += \" --port='#{port}' \" unless port.blank?\n options += \" --host='#{host}' \" unless host.blank?\n options += \" --host='#{socket}' \" unless socket.blank? unless options.include?('--host=')\n options\n end", "title": "" }, { "docid": "13479fff54e1d5670f443f6e7196e4b3", "score": "0.5433627", "text": "def services_options\n [\n [\"wukong.kafka.hosts\", settings[:kafka_hosts]],\n [\"wukong.zookeeper.hosts\", settings[:zookeeper_hosts]],\n ]\n end", "title": "" }, { "docid": "f5fbc26a4c109977c2c7edcdbb8eff15", "score": "0.54264206", "text": "def build_ssh_args(state)\n combined = config.to_hash.merge(state)\n\n opts = Hash.new\n opts[:user_known_hosts_file] = \"/dev/null\"\n opts[:verify_host_key] = false\n opts[:keys_only] = true if combined[:ssh_key]\n opts[:password] = combined[:password] if combined[:password]\n opts[:forward_agent] = combined[:forward_agent] if combined[:forward_agent] # if combined.key? :forward_agent\n opts[:port] = combined[:port] if combined[:port]\n opts[:keys] = Array(combined[:ssh_key]) if combined[:ssh_key]\n opts[:logger] = logger\n\n [combined[:hostname], combined[:username], opts]\n end", "title": "" }, { "docid": "668460d7ff18bbb25c7aaa3db311f091", "score": "0.5425533", "text": "def config_for_protocol(option)\n if option == :port\n config[:connection_port] || config[knife_key_for_protocol(option)]\n else\n config[:connection_user] || config[knife_key_for_protocol(option)]\n end\n end", "title": "" }, { "docid": "e9d7dc274620edadcba3a79a4405e1c1", "score": "0.54249", "text": "def ssh_port\n @ssh_port ||= 22\n end", "title": "" }, { "docid": "49078584c1d80f1eba310b481e8b5ce2", "score": "0.5423747", "text": "def allowed_ssh?\n ports_protocol_allowed(['22'])\n end", "title": "" }, { "docid": "c920a3acf6085a358d17e94e5cb133ec", "score": "0.5417851", "text": "def connection_options(opts)\n {\n logger: logger,\n transport: opts[:winrm_transport].to_sym,\n disable_sspi: opts[:winrm_disable_sspi],\n basic_auth_only: opts[:winrm_basic_auth_only],\n hostname: opts[:host],\n endpoint: opts[:endpoint],\n user: opts[:user],\n password: opts[:password],\n rdp_port: opts[:rdp_port],\n connection_retries: opts[:connection_retries],\n connection_retry_sleep: opts[:connection_retry_sleep],\n max_wait_until_ready: opts[:max_wait_until_ready],\n no_ssl_peer_verification: opts[:self_signed],\n realm: opts[:kerberos_realm],\n service: opts[:kerberos_service],\n ca_trust_path: opts[:ca_trust_path],\n ssl_peer_fingerprint: opts[:ssl_peer_fingerprint],\n }\n end", "title": "" }, { "docid": "256559df49741700393e27e84bda0365", "score": "0.5398574", "text": "def ssh_port(expected)\n end", "title": "" }, { "docid": "dfe0c56abd5f1020d4100eadc43d5e9f", "score": "0.53870046", "text": "def port; @options[:port] ||= secure? ? 6697 : 6667 end", "title": "" }, { "docid": "e4558317b7ff139de9c004d4ca5a850e", "score": "0.5381813", "text": "def ssh_options\n {} # override and do something appropriate.\n end", "title": "" }, { "docid": "244f0f5bc52b3ecc453db28daca067f9", "score": "0.53593665", "text": "def build_ssh_args(state)\n combined = config.to_hash.merge(state)\n\n opts = {}\n opts[:user_known_hosts_file] = \"/dev/null\"\n opts[:verify_host_key] = false\n opts[:keys_only] = true if combined[:ssh_key]\n opts[:password] = combined[:password] if combined[:password]\n opts[:forward_agent] = combined[:forward_agent] if combined.key? :forward_agent\n opts[:port] = combined[:port] if combined[:port]\n opts[:keys] = Array(combined[:ssh_key]) if combined[:ssh_key]\n opts[:logger] = logger\n\n [combined[:hostname], combined[:username], opts]\n end", "title": "" }, { "docid": "ae341bda0d69f1b71befc48f10180fee", "score": "0.5344723", "text": "def build_ssh_args(state)\n combined = config.to_hash.merge(state)\n\n opts = Hash.new\n opts[:user_known_hosts_file] = \"/dev/null\"\n opts[:paranoid] = false\n opts[:keys_only] = true if combined[:ssh_key]\n opts[:password] = combined[:password] if combined[:password]\n opts[:forward_agent] = combined[:forward_agent] if combined.key? :forward_agent\n opts[:port] = combined[:port] if combined[:port]\n opts[:keys] = Array(combined[:ssh_key]) if combined[:ssh_key]\n opts[:logger] = logger\n\n [combined[:hostname], combined[:username], opts]\n end", "title": "" }, { "docid": "2707292cb7df7b7cbb3997415b1a6288", "score": "0.53413194", "text": "def port\n @options['port'] ||= secure? ? 6697 : 6667\n end", "title": "" }, { "docid": "c4163a8f45f5654662211559183f1b44", "score": "0.53326166", "text": "def allowed_ssh?\n port_protocol_allowed('22')\n end", "title": "" }, { "docid": "b1196d2e69778aea0dde860bb452dc70", "score": "0.53280646", "text": "def populate_option_lookup\n # integer options\n [EVENTS, LINGER, RECONNECT_IVL, FD, TYPE, BACKLOG, KEEPALIVE, IPV4ONLY].each { |option| @option_lookup[option] = 0 }\n\n # long long options\n [RCVMORE, AFFINITY].each { |option| @option_lookup[option] = 1 }\n\n # string options\n [SUBSCRIBE, UNSUBSCRIBE].each { |option| @option_lookup[option] = 2 }\n end", "title": "" }, { "docid": "8975d7068eba8702368171598b62993f", "score": "0.5319181", "text": "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "title": "" }, { "docid": "8975d7068eba8702368171598b62993f", "score": "0.5319181", "text": "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "title": "" }, { "docid": "8c2d2b9e1666ab06e98c43e99ba76765", "score": "0.5317205", "text": "def ssh_options\n {\n :keys_only => false, # Don't you dare change this.\n :global_known_hosts_file => path(:known_hosts),\n :user_known_hosts_file => '/dev/null',\n :paranoid => true,\n :verbose => net_ssh_log_level\n }\n end", "title": "" }, { "docid": "a9bc441d2d53226f969a75ece18e79a4", "score": "0.53152126", "text": "def ports\n result = Array.new\n each_port do |port|\n result << port\n end\n result\n end", "title": "" }, { "docid": "7e6508afc73fbc7aed37853682615a46", "score": "0.5307782", "text": "def connection_options(opts)\n opts = {\n logger: logger,\n user_known_hosts_file: '/dev/null',\n hostname: opts[:host],\n port: opts[:port],\n username: opts[:user],\n compression: opts[:compression],\n compression_level: opts[:compression_level],\n keepalive: opts[:keepalive],\n keepalive_interval: opts[:keepalive_interval],\n timeout: opts[:connection_timeout],\n connection_retries: opts[:connection_retries],\n connection_retry_sleep: opts[:connection_retry_sleep],\n max_wait_until_ready: opts[:max_wait_until_ready],\n auth_methods: %w[gssapi-with-mic],\n keys_only: false,\n keys: opts[:key_files],\n password: opts[:password],\n forward_agent: opts[:forward_agent],\n transport_options: opts,\n }\n\n opts[verify_host_key_option] = false\n\n opts\n end", "title": "" }, { "docid": "ce7d7693e4871101c9633001897fd5e0", "score": "0.5305155", "text": "def build_connector()\n ssh_options = [:keys, :port, :config]\n connector = @connector\n if @options.keys.map{ |opt| ssh_options.include?(opt)}.any?\n connector += \" -p #{@options[:port]}\" if @options[:port]\n if @options[:keys]\n keys = @options[:keys].is_a?(Array) ? @options[:keys].first : @options[:keys]\n connector += \" -i #{keys}\"\n end\n connector += \" -F #{@options[:config]}\" if @options[:config]\n end\n return connector\n end", "title": "" }, { "docid": "91493c9b74f80b9dde95d151004b82e0", "score": "0.5303971", "text": "def command_line_options\n OPTIONS.collect { |lst| lst[0..-2] }\n end", "title": "" }, { "docid": "91493c9b74f80b9dde95d151004b82e0", "score": "0.5303971", "text": "def command_line_options\n OPTIONS.collect { |lst| lst[0..-2] }\n end", "title": "" }, { "docid": "737382f09893452d874409be77d4341d", "score": "0.52986044", "text": "def load_options\n options = OpenStruct.new\n options.max_app_tasks = MAX_APP_TASKS\n options.group = \"\"\n options.mode = :run\n options.hostname = Socket.gethostname\n options.running = true\n\n if config[\"servers\"]\n config[\"servers\"].each do |server|\n if server[\"hostname\"] == options.hostname\n options.max_app_tasks = server[\"max_app_tasks\"] || MAX_APP_TASKS\n options.group = server[\"group\"] || \"\"\n break\n end\n end\n end\n return options\n end", "title": "" }, { "docid": "0cd2ca97a26b3aeecda9db849f6b8fa2", "score": "0.5294626", "text": "def parse_options(options)\n @zk, @zkservers = options.values_at(:zk, :zkservers)\n if [@zk, @zkservers].all? || [@zk, @zkservers].none?\n raise ArgumentError, 'must specify :zk or :zkservers'\n end\n\n @root_znode = options.fetch(:znode_path, Util::DEFAULT_ROOT_ZNODE_PATH)\n @namespace = options[:namespace]\n @password = options[:password]\n @db = options[:db]\n @retry = options.fetch(:retry_failure, true)\n @max_retries = @retry ? options.fetch(:max_retries, 3) : 0\n @safe_mode = options.fetch(:safe_mode, true)\n @master_only = options.fetch(:master_only, false)\n @verify_role = options.fetch(:verify_role, true)\n\n @redis_client_options = Redis::Client::DEFAULTS.keys.each_with_object({}) do |key, hash| \n hash[key] = options[key]\n end\n end", "title": "" }, { "docid": "d94ce3927dd8379d94fcd9182efa11ed", "score": "0.52763754", "text": "def parse_options\n \n # Specify options\n opts = OptionParser.new \n opts.on('-v', '--version') { output_version; exit 0 }\n opts.on('--host HOST') { |host| @options.host = host; }\n opts.on('--port PORT') { |port| @options.port = port; }\n opts.on('--root ROOT') { |root| @options.root = root; }\n opts.on('--timeout TIMEOUT') { |timeout| @options.timeout = timeout; }\n \n opts.parse!(@arguments) rescue return false\n \n true \n end", "title": "" }, { "docid": "fb0a38064e7bde7f2818e88824a7f15f", "score": "0.52672756", "text": "def rsyncd_configured_ports\n port_config = \"/etc/rsyncd.conf\"\n port = port_config.scan(/^port ([0-9]+)/).flatten.map{|p| p.to_i}\n port = 873 unless port\n end", "title": "" }, { "docid": "e1bffa210d8df79a519b3e7c3f99dc1d", "score": "0.5265632", "text": "def port ; options[:port] || config.port ; end", "title": "" }, { "docid": "9b911e418e03ddfee1cb6bc672409880", "score": "0.5263004", "text": "def parse_init(host, port, opts)\n if host.nil? && port.nil? && ENV.has_key?('MONGODB_URI')\n parser = URIParser.new(ENV['MONGODB_URI'])\n if parser.replicaset?\n raise MongoArgumentError,\n 'ENV[\\'MONGODB_URI\\'] implies a replica set.'\n end\n opts.merge!(parser.connection_options)\n [parser.host, parser.port]\n else\n host = host[1...-1] if host && host[0,1] == '[' # ipv6 support\n [host || DEFAULT_HOST, port || DEFAULT_PORT]\n end\n end", "title": "" }, { "docid": "7dc56d0a7f4ae8ada0897640298ba61e", "score": "0.52469546", "text": "def ssh_options(_machine)\n raise 'Do not use the Driver class directly, it is intended that it '\\\n 'should be inherited from.'\n end", "title": "" }, { "docid": "a573b5c5da2a9eb36c86fb69b08a802d", "score": "0.52456784", "text": "def handshake(options = {})\n options = {\n }.merge(options)\n ::Pattern.split(options)\n end", "title": "" }, { "docid": "987632ad6cb4e7cc7670ac4f8a7dcfa1", "score": "0.5234598", "text": "def input_ports\n @osc_receiver.servers.keys\n end", "title": "" }, { "docid": "7e9676a7f543363587089c4dcd1a56be", "score": "0.5233704", "text": "def extract_port(options)\n @port = options[:port]\n @port = PORTS[@port] if @port.is_a?(Symbol)\n\n return if @port.is_a?(Integer) && @port.between?(1, 655_35)\n\n raise ArgumentError, 'The :port must be a number between 1 and 65535.'\n end", "title": "" }, { "docid": "d0033fce7d971d783a8561036c091d91", "score": "0.5230199", "text": "def ssh_opts\n\t\t# Don't prompt user to check host identity\n\t\t['-o', 'NoHostAuthenticationForLocalhost=yes', '-p', @port.to_s]\n\tend", "title": "" }, { "docid": "a32cece388a5e978a26bdae451c24c44", "score": "0.52158505", "text": "def miq_ssh_util_args\n host = hostname || ipaddress\n authentication = find_credentials\n case authentication.type\n when 'AuthPrivateKey', 'AuthToken'\n [host, authentication.userid, nil, nil, nil, { :key_data => authentication.auth_key, :passwordless_sudo => true }]\n when 'AuthUseridPassword'\n [host, authentication.userid, authentication.password, nil, nil]\n else\n raise \"Unsupported authentication type: #{authentication.type}\"\n end\n end", "title": "" }, { "docid": "52ca5eea4fc6e53a1571766d6af87810", "score": "0.5214555", "text": "def check_options(options)\n [:host, :port].each { |option| raise ArgumentError.new(\"option '#{option}' must be specified\") unless options.has_key? option }\nend", "title": "" }, { "docid": "52ca5eea4fc6e53a1571766d6af87810", "score": "0.5214555", "text": "def check_options(options)\n [:host, :port].each { |option| raise ArgumentError.new(\"option '#{option}' must be specified\") unless options.has_key? option }\nend", "title": "" }, { "docid": "9533424ec7dcea42d93db564b201c4a0", "score": "0.5206301", "text": "def options_parse(options_parser, parallel_switch: true, why_run_switch: false, timeout_options: true)\n options_parser.separator ''\n options_parser.separator 'Deployer options:'\n if parallel_switch\n options_parser.on('-p', '--parallel', 'Execute the commands in parallel (put the standard output in files <hybrid-platforms-dir>/run_logs/*.stdout)') do\n @concurrent_execution = true\n end\n end\n if timeout_options\n options_parser.on('-t', '--timeout SECS', \"Timeout in seconds to wait for each chef run. Only used in why-run mode. (defaults to #{@timeout.nil? ? 'no timeout' : @timeout})\") do |nbr_secs|\n @timeout = nbr_secs.to_i\n end\n end\n if why_run_switch\n options_parser.on('-W', '--why-run', 'Use the why-run mode to see what would be the result of the deploy instead of deploying it for real.') do\n @use_why_run = true\n end\n end\n options_parser.on('--retries-on-error NBR', \"Number of retries in case of non-deterministic errors (defaults to #{@nbr_retries_on_error})\") do |nbr_retries|\n @nbr_retries_on_error = nbr_retries.to_i\n end\n # Display options secrets readers might have\n @secrets_readers.each do |secret_reader_name, secret_reader|\n next unless secret_reader.respond_to?(:options_parse)\n\n options_parser.separator ''\n options_parser.separator \"Secrets reader #{secret_reader_name} options:\"\n secret_reader.options_parse(options_parser)\n end\n end", "title": "" }, { "docid": "3c4a7c9b6b930719be14549a30d427eb", "score": "0.5200077", "text": "def command_line_options\n OPTIONS.collect { |lst| lst[0..-2] }\n end", "title": "" }, { "docid": "f43790c7bb05e20de351cbffd05212cd", "score": "0.5199114", "text": "def options\n x = extra_vars.each_with_object('--extra-vars=\\'') { |kv, a| a << \"#{kv.first}=\\\"#{kv.last}\\\" \" }.strip+'\\'' if extra_vars unless extra_vars.empty?\n # can test with configure { |config| config.extra_vars.clear }\n\n [x, '--ssh-extra-args=\\'-o UserKnownHostsFile=/dev/null\\'']*' '\n end", "title": "" }, { "docid": "0af405b328c6c435cdcc335dc8aa2d46", "score": "0.5195445", "text": "def runner_options_for_ssh(config_data, backend = 'ssh')\n kitchen = instance.transport.send(:connection_options, config_data).dup\n opts = {\n \"backend\" => backend,\n \"logger\" => logger,\n # pass-in sudo config from kitchen verifier\n \"sudo\" => config[:sudo],\n \"sudo_command\" => config[:sudo_command],\n \"sudo_options\" => config[:sudo_options],\n \"host\" => config[:host] || kitchen[:hostname],\n \"port\" => config[:port] || kitchen[:port],\n \"user\" => kitchen[:username],\n \"keepalive\" => kitchen[:keepalive],\n \"keepalive_interval\" => kitchen[:keepalive_interval],\n \"connection_timeout\" => kitchen[:timeout],\n \"connection_retries\" => kitchen[:connection_retries],\n \"connection_retry_sleep\" => kitchen[:connection_retry_sleep],\n \"max_wait_until_ready\" => kitchen[:max_wait_until_ready],\n \"compression\" => kitchen[:compression],\n \"compression_level\" => kitchen[:compression_level],\n \"keys_only\" => true,\n }\n opts[\"key_files\"] = kitchen[:keys] unless kitchen[:keys].nil?\n opts[\"password\"] = kitchen[:password] unless kitchen[:password].nil?\n opts\n end", "title": "" }, { "docid": "c95ba14921ea1b702cf9e4f773a3daf1", "score": "0.5189291", "text": "def options_and_values\n array = []\n @option_parser.top.each_option do |opt|\n # TODO: I'm not sure this really finds all options but it's good enough for now\n if opt.is_a?(OptionParser::Switch::RequiredArgument) || opt.is_a?(OptionParser::Switch::NoArgument)\n key = opt.long.first[2..-1].tr('-', '_').to_sym\n val = @options[key]\n if (key != :processes) && val\n array << opt.long.first\n if val.is_a?(Array)\n array << val.join(',')\n elsif !%w(true false).member?(val.to_s)\n array << val\n end\n end\n end\n end\n array.join(' ')\n end", "title": "" }, { "docid": "1d73b808b95528103a3ecb1dbc35f592", "score": "0.5187322", "text": "def options_parser\n @options ||= {\n :address => Goliath::Server::DEFAULT_ADDRESS,\n :port => Goliath::Server::DEFAULT_PORT,\n\n :daemonize => false,\n :verbose => false,\n :log_stdout => false,\n :env => Goliath::DEFAULT_ENV\n }\n\n @options_parser ||= OptionParser.new do |opts|\n opts.banner = \"Usage: <server> [options]\"\n\n opts.separator \"\"\n opts.separator \"Server options:\"\n\n # The environment isn't set as part of this option parsing routine, but\n # we'll leave the flag here so a call to --help shows it correctly.\n opts.on('-e', '--environment NAME', \"Set the execution environment (default: #{@options[:env]})\") { |val| @options[:env] = val }\n\n opts.on('-a', '--address HOST', \"Bind to HOST address (default: #{@options[:address]})\") { |addr| @options[:address] = addr }\n opts.on('-p', '--port PORT', \"Use PORT (default: #{@options[:port]})\") { |port| @options[:port] = port.to_i }\n opts.on('-S', '--socket FILE', \"Bind to unix domain socket\") { |v| @options[:address] = v; @options[:port] = nil }\n opts.on('-E', '--einhorn', \"Use Einhorn socket manager\") { |v| @options[:einhorn] = true }\n\n opts.separator \"\"\n opts.separator \"Daemon options:\"\n\n opts.on('-u', '--user USER', \"Run as specified user\") {|v| @options[:user] = v }\n opts.on('-c', '--config FILE', \"Config file (default: ./config/<server>.rb)\") { |v| @options[:config] = v }\n opts.on('-d', '--daemonize', \"Run daemonized in the background (default: #{@options[:daemonize]})\") { |v| @options[:daemonize] = v }\n opts.on('-l', '--log FILE', \"Log to file (default: off)\") { |file| @options[:log_file] = file }\n opts.on('-s', '--stdout', \"Log to stdout (default: #{@options[:log_stdout]})\") { |v| @options[:log_stdout] = v }\n opts.on('-P', '--pid FILE', \"Pid file (default: off)\") { |file| @options[:pid_file] = file }\n\n opts.separator \"\"\n opts.separator \"SSL options:\"\n opts.on('--ssl', 'Enables SSL (default: off)') {|v| @options[:ssl] = v }\n opts.on('--ssl-key FILE', 'Path to private key') {|v| @options[:ssl_key] = v }\n opts.on('--ssl-cert FILE', 'Path to certificate') {|v| @options[:ssl_cert] = v }\n opts.on('--ssl-verify', 'Enables SSL certificate verification') {|v| @options[:ssl_verify] = v }\n\n opts.separator \"\"\n opts.separator \"Common options:\"\n\n opts.on('-C', '--console', 'Start a console') { @options[:console] = true }\n opts.on('-v', '--verbose', \"Enable verbose logging (default: #{@options[:verbose]})\") { |v| @options[:verbose] = v }\n opts.on('-h', '--help', 'Display help message') { show_options(opts) }\n end\n end", "title": "" }, { "docid": "3979647b3eee444b3271a335143a39ac", "score": "0.51806825", "text": "def get_opts\r\n\t\tbegin\r\n\t\t\t@@opts.each do |opt, arg|\r\n\t\t\t\tcase opt\r\n\t\t\t\t\twhen \"--config\" then @config = arg\r\n\t\t\t\t\twhen \"--server\" then @server = arg\r\n\t\t\t\t\twhen \"--login\" then @login = arg\r\n\t\t\t\t\twhen \"--password\" then @password = arg\r\n\t\t\t\t\twhen \"--to\" then @to = arg\r\n\t\t\t\t\twhen \"--subject\" then @subject = arg\r\n\t\t\t\t\twhen \"--body\" then @body = arg\r\n\t\t\t\t\twhen \"--help\" then XmppSender.printusage 0\r\n\t\t\t\t\twhen \"--usage\" then XmppSender.printusage 0\r\n\t\t\t\t\twhen \"--version\" then puts @@version; exit 0\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\trescue GetoptLong::InvalidOption => e\r\n\t\t\tputs \"ignored #{e.message}\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "644ef0fedae833056044e643e1d54c5f", "score": "0.51658225", "text": "def list_user_ssh_config(options)\n host_list = get_user_ssh_config(options)\n if not host_list == options['empty']\n handle_output(host_list)\n end\n return\nend", "title": "" }, { "docid": "f642969d04d99b464867ef870b56b6b8", "score": "0.51652557", "text": "def get_host_options(cfg_name, &block)\n opts = {}\n rubber_instances.each do |ic|\n env = rubber_cfg.environment.bind(ic.role_names, ic.name)\n cfg_value = env[cfg_name]\n\n if cfg_value\n if cfg_value.is_a?(Hash)\n cfg_value = cfg_value[ic.os_version]\n end\n\n if block\n cfg_value = block.call(cfg_value)\n end\n\n opts[\"hostvar_#{ic.full_name}\"] = cfg_value if cfg_value && cfg_value.strip.size > 0\n end\n end\n return opts\n end", "title": "" }, { "docid": "4194daa3fad9fb2a568ccd0152e343cc", "score": "0.5163542", "text": "def _parse_options(options)\n\n return [] unless options\n\n options_list = options.split(@delim).map do |option|\n { :name => option.split(\"=\").first, :value => option.split(\"=\").last }\n end\n options_list\n end", "title": "" } ]
31dd4556503218506aa1ddaf8a501de0
Returns a list of a user's favorite activities.
[ { "docid": "45b56233656b926ba2208ca727173d22", "score": "0.8642434", "text": "def favorite_activities(opts={})\n get(\"user/#{@user_id}/activities/favorite.json\", opts)\n end", "title": "" } ]
[ { "docid": "aca68311c9664a88804606000490aba3", "score": "0.8876303", "text": "def favorite_activities\n get(\"user/#{user_id}/activities/favorite.json\")\n end", "title": "" }, { "docid": "ffec7257638c56309a08704167824272", "score": "0.8655928", "text": "def favorite_activities(user_id: '-')\n return get(\"#{API_URI}/#{ACTIVITY_API_VERSION}/user/#{user_id}/activities/favorite.json\")\n end", "title": "" }, { "docid": "879fb37c40da99782ead99fd97c076ca", "score": "0.8435534", "text": "def favorite_activities\n get_json(path_user_version('/activities/favorite'))\n end", "title": "" }, { "docid": "43cbf762537a5466b62c8afb2de896be", "score": "0.73703575", "text": "def user_all_favorites\n output = []\n if params[:user_id].present? && params[:user_name].present?\n Favorite.where('user_id = ? and user_name = ?', params[:user_id], params[:user_name]).each do |f|\n output << [f.plan_id, f.day]\n end\n end\n output\n end", "title": "" }, { "docid": "0d8bdb10b314609fe29d995eaa4951f4", "score": "0.73292875", "text": "def favourites\n @favourite_tasks = current_user.favorited_by_type('Task')\n end", "title": "" }, { "docid": "177c153aec709d7f4bde3c462e47250f", "score": "0.7228238", "text": "def favorite_events\n favorite_events = []\n user_favorites.where(favorite_type: 'event').each do |favorite_event|\n favorite_events << Event.find(favorite_event.favorite_id)\n end\n favorite_events\n end", "title": "" }, { "docid": "36d50a9769b3dfad415e119b766ef14c", "score": "0.71703106", "text": "def get_favorites(user)\n favorites = Array.new(0)\n response = @esf.get_records_with_term(\"user\",user)\n response.each do |item|\n favorite = Favorites.new item\n favorites << favorite\n end\n end", "title": "" }, { "docid": "7767621ca52b3ed6bc18c9ae220f23b2", "score": "0.715059", "text": "def favorites(user=nil)\n self.class.visibility_filter(favorites_list.saved_items(user),'saved_items',user)\n end", "title": "" }, { "docid": "a5c17e9aacde4ac71a80fc8d07cdcd49", "score": "0.7119623", "text": "def favorites\n handle_error { sendsecure_connection.get(\"api/v2/enterprises/#{@enterprise_account}/users/#{@user_id}/favorites.json\") }\n end", "title": "" }, { "docid": "314818145028d9e31e1e755848776d4c", "score": "0.7003117", "text": "def get_favorites(user)\n @favorites = Favorite.where(user_id: user.id)\n unless @favorites.nil?\n item_ids = []\n @favorites.each do |favorite|\n item_ids << favorite.item_id\n end\n @favorite_items = Item.find(item_ids)\n end\n end", "title": "" }, { "docid": "84d96e617b924ef65f061b9d5a3dcdfc", "score": "0.6973468", "text": "def get_favourites\n\t\tFavourite.by_user(self.id)\n\tend", "title": "" }, { "docid": "4b28ce4d56a21120c4a65b062f91f196", "score": "0.6929494", "text": "def favorites\n Favorite.all.filter do |favorite|\n favorite.user_id === self.object.id\n end\n end", "title": "" }, { "docid": "d1fc3d913c437cef5a7853f8789c2f72", "score": "0.6924484", "text": "def add_favorite_activity(user_id: '-', activity_id:)\n return post(\"#{API_URI}/#{ACTIVITY_API_VERSION}/user/#{user_id}/activities/favorite/#{activity_id}.json\")\n end", "title": "" }, { "docid": "28a2a790bae6eaadfa59b13e0dad619b", "score": "0.6863909", "text": "def favorite(activity)\n self.act(activity, :favorite)\n end", "title": "" }, { "docid": "3a5624386966274372dfc23fdd77c714", "score": "0.6819769", "text": "def all_favorites\n favorites.collect{|favorite| favorite.favorable}\n end", "title": "" }, { "docid": "d1cf701c425ab227cd271d21e3f011b6", "score": "0.6795844", "text": "def user_favorites(user_id, options={})\n self.class.get(\"/users/#{user_id}/favorites\", options)\n end", "title": "" }, { "docid": "9859880406578e631ebb4c83dc44f0a2", "score": "0.676365", "text": "def favorites\n @json_client.favorites[\"favorites\"].map {|f| Favorite.new(f) }\n end", "title": "" }, { "docid": "c9d554606b859e168642ac34a979698b", "score": "0.67502517", "text": "def favorite_users\n array = []\n favorites = Favorite.where(code: self.code)\n favorites.each do |favorite|\n array << User.find_by(id: favorite.user_id)\n end\n return array\n end", "title": "" }, { "docid": "ce047bc3905a0a27c22b7fec918496c4", "score": "0.67302763", "text": "def frequent_activities\n get(\"user/#{user_id}/activities/frequent.json\")\n end", "title": "" }, { "docid": "ff683f4574bc41a595fc867ee621a49f", "score": "0.6722236", "text": "def get_all_with_user\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\").order(\"favourited_at desc\")\n\t\t\tend", "title": "" }, { "docid": "69a27cbdbf30fde73cf885e3a9212278", "score": "0.67045593", "text": "def index\n @favourites = current_user.favourites\n end", "title": "" }, { "docid": "8d32f29b9c015f107c5960621a057918", "score": "0.66545916", "text": "def frequent_activities(user_id: '-')\n return get(\"#{API_URI}/#{ACTIVITY_API_VERSION}/user/#{user_id}/activities/frequent.json\")\n end", "title": "" }, { "docid": "9390baf23adf088e1461355977a54631", "score": "0.66387886", "text": "def favorite_user(user_id)\n\t\tfavorites.find_by(user_id: user_id)\n\tend", "title": "" }, { "docid": "2b4962d1c442f90993abbc01dab7255b", "score": "0.6600367", "text": "def get_favorites\n @client.get_favorites(flickr_user_id) do |favorite|\n # TODO: something more interesting\n puts favorite.inspect\n end\n end", "title": "" }, { "docid": "570e0b4d8223c705a9eb434808c878e9", "score": "0.65605736", "text": "def index\n @favorite_lists = FavoriteList.where( user_id: view_context.get_current_user_id ).all\n end", "title": "" }, { "docid": "660683bc0b38170515619e6ec6340bb6", "score": "0.65597624", "text": "def recent_activities\n get(\"user/#{user_id}/activities/recent.json\")\n end", "title": "" }, { "docid": "296044726220b7658cf3d91663189c51", "score": "0.65295136", "text": "def index\n @users_favorites = UsersFavorite.all\n end", "title": "" }, { "docid": "2b7a34870d9c2eab3173a080fefde954", "score": "0.6526938", "text": "def my_favourites\n @tweets = current_user.tweets.order(\"twitter_created_at desc\")\n @page_title = \"Favourite tweets\"\n end", "title": "" }, { "docid": "08a4ed8e1bcfd791aa5bb32944a2f4f0", "score": "0.65000784", "text": "def following\n current_user.all_favorites\n end", "title": "" }, { "docid": "5cb54dc6855c35686a5aa4763af23466", "score": "0.6475762", "text": "def get_favorites\n favorite_list = FavoriteSource.all.where(\"user_id = #{self.id}\")\nend", "title": "" }, { "docid": "790e4d05ebd4b0b49c1562aa25179ce7", "score": "0.6456106", "text": "def my_favorites\n @favorites = current_user.films\n end", "title": "" }, { "docid": "c6d913e53d086df65ec5eed389101f80", "score": "0.6436192", "text": "def get_user_activities(user_id, params = {})\n get(\"users/#{user_id}/activities\", params)\n end", "title": "" }, { "docid": "97aebc29d06cc211c1b0359935749af4", "score": "0.6429043", "text": "def frequent_activities(opts={})\n get(\"user/#{@user_id}/activities/frequent.json\", opts)\n end", "title": "" }, { "docid": "680a00240b92c2095045b571a1d15731", "score": "0.64021826", "text": "def add_favorite_activity(activity_id)\n post(\"user/#{user_id}/activities/favorite/#{activity_id}.json\")\n end", "title": "" }, { "docid": "7ae2893e7c9e159fae2056e8cbbaec51", "score": "0.63948417", "text": "def visible_favorited_users(viewer)\n favorited_users.order(\"favorites.id DESC\").select do |fav_user|\n Pundit.policy!(viewer, fav_user).can_see_favorites?\n end\n end", "title": "" }, { "docid": "c21451f6d70c3ac623b50b2152c0419b", "score": "0.63882816", "text": "def favorite\n user= User.find(session[:user_id])\n\n @fteam= user.teams.order(created_at: :desc)\n end", "title": "" }, { "docid": "1c6713ab00c13eab95b569f2e17fc1d1", "score": "0.63786286", "text": "def index\n @user_favorite_lists = current_user.favorite_restaurants\n end", "title": "" }, { "docid": "f29b2f3e9536577a88a87d5b5c5bb51a", "score": "0.6375447", "text": "def recent_activities(user_id: '-')\n return get(\"#{API_URI}/#{ACTIVITY_API_VERSION}/user/#{user_id}/activities/recent.json\")\n end", "title": "" }, { "docid": "bf87948257cfe3c6fe6b93d9c5086d54", "score": "0.63715667", "text": "def get_favorites(user_id = nil, page = 1)\n retcode = 200\n begin\n res = submit_network_request(\"/favorites#{ user_id.nil? ? '' : '/' + user_id.to_s }.json?page=#{page}\")\n return JSON.parse(res.body) if res.code.to_i == 200\n retcode = res.code.to_i\n rescue Exception => e\n throw_general_exception(\"NCTwitter.get_favorites()\", e)\n else\n throw_nc_exception(\"NCTwitter.get_favorites()\", retcode) end\n end", "title": "" }, { "docid": "5ce66dbb4666990808da8420402596c2", "score": "0.636858", "text": "def favorites\n @favorites ||= Favorite.by_user_id.key(id).descending\n end", "title": "" }, { "docid": "907fa2bb1daceb9d55430134b57cc044", "score": "0.63623786", "text": "def favorites\n path = \"/view/favorites\"\n retrieve_stories(path,true)\n end", "title": "" }, { "docid": "e2da38996859b75f069f8a4fbe0ebc2f", "score": "0.63534623", "text": "def favorites\n return @favorites = FavoriteSong.select('songs.name, songs.id').joins(:song).where('favorite_songs.user_id' => current_user.id).order('songs.name')\n end", "title": "" }, { "docid": "bf09c962fd096540fc2dd9de53e280da", "score": "0.634784", "text": "def add_favorite_activity(activity_id)\n post(\"user/#{@user_id}/activities/favorite/#{activity_id}.json\")\n end", "title": "" }, { "docid": "ffdfa10c28fbd0ab83b58c4265518a39", "score": "0.634362", "text": "def show\n set_user\n @fav_events = @user.favorite_events\n @fav_teams = @user.favorite_teams\n @fav_players = @user.favorite_players\n end", "title": "" }, { "docid": "767f6c97f7b3911aa901f3690bd845db", "score": "0.6334237", "text": "def get_user_favorites(user_id, limit)\n return fetch_pages_for(limit) do |limit, offset|\n @client.get(\"/users/#{user_id}/favorites\", :limit => limit, :offset => offset).map(&:id)\n end\n end", "title": "" }, { "docid": "a26830cda295014f8795b355040f347d", "score": "0.63311523", "text": "def favorites( options )\n Photo.api_query( 'favorites.getPublicList', @client, options.merge(:user_id => id) )\n end", "title": "" }, { "docid": "36ceef01de87bc90489679091e0f5a6b", "score": "0.6286865", "text": "def get_favs\n beers = @user_beer.get_favs(@current_user)\n\n render json: {\n status: 200,\n beers: beers,\n errors: nil\n }\n end", "title": "" }, { "docid": "e50f72d3cfffdb59ba97801d1439906a", "score": "0.6277388", "text": "def toggle_favorite(user)\n scope = Activity.for_subject(self).for_owner(user).where(action: \"favorite\")\n\n if activity = scope.first\n activity.destroy\n false\n else\n scope.create\n true\n end\n end", "title": "" }, { "docid": "9f7765b1bf830e13473b6b57f5d33f0b", "score": "0.625866", "text": "def index\n user = User.find(params[:id])\n\n favorite_restaurants =\n user\n .favorite_restaurants\n .paginate(page: params[:page], per_page: params[:per_page])\n\n expose favorite_restaurants\n end", "title": "" }, { "docid": "48db88fe1aec073ffdee230543ba693f", "score": "0.6257707", "text": "def favs\n @favs ||= get_favs\n end", "title": "" }, { "docid": "badfecd5044200c37c96b4f3adfa6673", "score": "0.62321085", "text": "def favorites \n user = User.find(params[:id])\n favorites = user.favorites\n render json: favorites\n end", "title": "" }, { "docid": "25d825479b93c58e0701cefff1b22a1e", "score": "0.6222316", "text": "def favorites\n @client.favorites_getPublicList('user_id'=>@id)['photos']['photo'].collect { |photo| Photo.new(photo['id']) }\n #or\n end", "title": "" }, { "docid": "8556cf45ad6544a602fb078c5226c93f", "score": "0.6217139", "text": "def list\n @full_favs = current_user.favorites # Get the full list of favorites\n \n @favs = [] # Creates an empty array to put the data for each user favorite in\n # Instead of sending over a bunch of non-important infortmation, \n # like the id number and who owns it we just send the title, the type \n # (sport, club, whatever), and enough data to create a URL.\n \n @full_favs.each do |fav|\n if fav.favoritable_type == 'sport'\n hash = { \"title\" => Sport.find(fav.favoritable_id).title, 'url' => '/sports/' + Sport.find(fav.favoritable_id).slug, \"favoritable_type\" => \"sport\" }\n @favs.push(hash)\n elsif fav.favoritable_type == 'club'\n hash = { \"title\" => Club.find(fav.favoritable_id).name, \"url\" => \"/clubs/\" + Club.find(fav.favoritable_id).slug, \"favoritable_type\" => \"club\"}\n @favs.push(hash)\n end\n end\n \n respond_to do |format|\n format.json { render json: @favs }\n end\n end", "title": "" }, { "docid": "75971b402a8eb07c7bb83ad0b38179a4", "score": "0.6215474", "text": "def favorites(options={})\n statuses(request(build_path('favorites.xml', parse_options(options)), :auth => true))\n end", "title": "" }, { "docid": "9f661f813c0f989a409eba451f4c5fd0", "score": "0.620447", "text": "def favourite_show\n @favourites = current_user.favourites.pluck(:post_id)\n @posts = Post.where(id: @favourites)\n # TODO check it\n end", "title": "" }, { "docid": "1d2a8b8b2fcbdbaffbc8a5bb7f23239d", "score": "0.6197586", "text": "def favorites\n return @favorites if @favorites\n resp = @client.request('getFavorites', ofWhat: 'Songs', userID: @id)\n @favorites = resp.map { |s| Song.new(s) }\n end", "title": "" }, { "docid": "6cefbfe7be74258e23f14629efd56930", "score": "0.6178683", "text": "def index\n #create a favourites list for each user depending on their logged in id.\n @favourites = Favourite.where(\"user_id = '#{current_user.id}'\").order(created_at: :desc)\n end", "title": "" }, { "docid": "d54ad6c7f3eea15e62a91d2bdc64ea9e", "score": "0.61728346", "text": "def favorites\n return @favorites if @favorites\n resp = @client.request('getFavorites', :ofWhat => 'Songs', :userID => @id)\n @favorites = resp.map { |s| Song.new(s) }\n end", "title": "" }, { "docid": "61b2dd0ff309afbf18bfbb6e1908613e", "score": "0.61541665", "text": "def favorite\n type=params[:type]\n @project = Project.find(params[:id])\n\n if type==\"favorite\"\n if current_user.favorites.include?(@project) == false\n current_user.favorites << @project\n end\n @project.users.each do |user|\n @activity = @project.favorite_projects.last.create_activity :create, owner: current_user, recipient: user, primary: true\n # create email notification\n if user.settings(:email).favorited == true\n NotificationMailer.delay.notification_message(@activity, user)\n end\n\n end\n elsif type==\"unfavorite\"\n favorite_entry = FavoriteProject.where(:user_id=>current_user.id).where(:project_id => @project.id).first\n PublicActivity::Activity.where(\"trackable_type = ? AND trackable_id = ?\", \"FavoriteProject\", favorite_entry.id).destroy_all\n\n current_user.favorites.delete(@project)\n end\n redirect_to :back\n end", "title": "" }, { "docid": "1e27d1bfb4a132f421e8abf0eff7c067", "score": "0.6149265", "text": "def get_favorites\n\n if !current_user || current_user.anonymous?\n render json: {:message => \"Cannot retrieve favorites for non-logged in user.\"}, :status => 400\n return\n end\n\n favorites = current_user.favorites\n type_ids_map = {}\n materials = []\n\n #\n # Build sets of IDs for each type\n #\n favorites.each do |favorite|\n favoritable_type = favorite.favoritable_type\n favoritable_id = favorite.favoritable_id\n if !type_ids_map[favoritable_type]\n type_ids_map[favoritable_type] = []\n end\n type_ids_map[favoritable_type].append(favoritable_id)\n end\n\n if type_ids_map['ExternalActivity']\n materials += ExternalActivity.includes(:user, :subject_areas, :grade_levels).find(type_ids_map['ExternalActivity'])\n end\n\n if type_ids_map['Interactive']\n materials += Interactive.includes(:user, :subject_areas, :grade_levels).find(type_ids_map['Interactive'])\n end\n\n data = materials_data(materials)\n\n render json: data, :status => 200\n\n end", "title": "" }, { "docid": "cc63c88d3d2ac9d71d5ed2150bda1104", "score": "0.6112779", "text": "def list_venues users\n venues = []\n users.each do |u|\n u.favourites.each do |f|\n f.venues.each do |v|\n venues << v unless venues.include? v\n end\n end\n end\n return venues\n end", "title": "" }, { "docid": "0c6343626989ae0a4064e41628d104e9", "score": "0.6093869", "text": "def favorite_videos(username)\n response = users_list_favorite_videos(:user => username)\n _parse_video_response(response)\n end", "title": "" }, { "docid": "bf7b5696ae1468386533d34474d0fa2c", "score": "0.60884905", "text": "def show_fav\n if Favorite.select{|t| t.user_id == self.id} == []\n puts \"You don't have any favorites yet! Try adding some!\"\n puts \"\"\n self.display_choices\n else\n puts \"\"\n puts \"FAVORITES:\"\n puts Favorite.select{|t| t.user_id == self.id}.map{|t| t.location.address + \", \" + t.location.boro.name + \", \" + t.location.zip.name}.uniq\n puts \"\"\n self.display_choices\n end\n end", "title": "" }, { "docid": "fe3b26b87d831874b0b98fd3056e34ab", "score": "0.60882", "text": "def all_favorites\n which_user.orders.select {|order_instance| order_instance.favorite? == true}\nend", "title": "" }, { "docid": "ef9eb4b5be057960d5e4e70cda4d6211", "score": "0.60879207", "text": "def show\n\n user_favorites = Favorite.where(user_id: params[:id])\n\n #Set articles to an empty array so that we can push objects into it below\n @articles = []\n\n user_favorites.each do |favorite|\n @articles << Article.find(favorite.article_id)\n end\n\n end", "title": "" }, { "docid": "a638522fa29feb99c57684f81da69b40", "score": "0.6084305", "text": "def index\n @activities = @user.activities.all\n end", "title": "" }, { "docid": "b3e7e1d10632a08235abbd4c771f9794", "score": "0.6075408", "text": "def index\n # 管理者は全ユーザー、メンバーは自分の情報だけ見える\n if @current_user.role == 0\n @favorites = Favorite.all\n else\n @favorites = Favorite.where(user_id: @current_user.id)\n end\n end", "title": "" }, { "docid": "f7ae168cd277ec6c5f728c70e121d957", "score": "0.60683477", "text": "def list_favorite_friends\n list_favorite_things(:friend)\n end", "title": "" }, { "docid": "2fb8571236636ad0f45f86cc469ce5ec", "score": "0.6054679", "text": "def index\n @favroites = Favroite.all\n end", "title": "" }, { "docid": "f80c047c1df957070ac1768793f83b42", "score": "0.6052091", "text": "def favourites\n authorize current_user\n\n @locations = current_user.favourite_companies.uniq.pluck(:area)\n @companies = current_user.favourite_companies\n\n current_user.favourite_jobs.each do |job|\n @locations << job.company.area\n @companies << job.company\n end\n\n @locations = @locations.uniq\n @companies = @companies.uniq\n end", "title": "" }, { "docid": "34666766118af365dfff993b28c82f9f", "score": "0.6048438", "text": "def favorite\n type = params[:type]\n if type == \"favorite\"\n if \n current_user.favorites.include?(@item)\n else\n current_user.favorites << @item\n end\n elsif type == \"unfavorite\"\n current_user.favorites.delete(@item)\n end\n end", "title": "" }, { "docid": "70d6474c3796e0d2c88fd4d4dacd6db3", "score": "0.60484284", "text": "def add_favorite_activity(activity_id)\n post_call(\"user/#{user_id}/activities/log/favorite/#{activity_id}.json\")\n end", "title": "" }, { "docid": "eba38df3892e0f66a914beaf494d89a8", "score": "0.6045284", "text": "def user_activities\n @activities = UserActivity.includes(:user).order('created_at DESC').page(params[:page])\n end", "title": "" }, { "docid": "dddfac03b89761f17d4cce4f23b6b834", "score": "0.6038037", "text": "def all_activities\n if user.present?\n Activity.where('(activity_owner_id = :activity_owner_id and activity_owner_type = :activity_owner_type) or user_id = :user_id',\n activity_owner_id: id, activity_owner_type: self.class.name, user_id: user.id).order(created_at: :desc)\n else\n activities\n end\n end", "title": "" }, { "docid": "6ec6e047ad52e6ff8c65380dee444ab8", "score": "0.60364044", "text": "def find_all_favorites\n all_faves = Usergame.all.filter do |user_fav|\n user_fav.user == @user\n end\n named_faves = all_faves.map do |favorite|\n favorite.boardgame.name\n end\n\n end", "title": "" }, { "docid": "e5832bb0c2c0be03a9c9491a1939f806", "score": "0.6032644", "text": "def show_favorites\n @events = @favorites = current_user.favorites.order(\"start ASC\")\n respond_to do |format|\n format.html\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "4a4fa9ba421124421e377210cf0ff759", "score": "0.60311645", "text": "def delete_favorite_activity(user_id: '-', activity_id:)\n return delete(\"#{API_URI}/#{ACTIVITY_API_VERSION}/user/#{user_id}/activities/favorite/#{activity_id}.json\")\n end", "title": "" }, { "docid": "ae8dbf0e674c7bdbf0d1e35b1b3a727d", "score": "0.6025763", "text": "def favourites\n raise NotAuthenticatedError if @anonymous_mode\n Products.new(self,api_request(:listfavourites))\n end", "title": "" }, { "docid": "613caf89c7b23f5d7acac0094596f50c", "score": "0.60241103", "text": "def get_favorited_users\n user_ids = self.favorited\n if user_ids.empty?\n return \"None\"\n else\n users = \"\"\n\n user_ids.each do |user_id|\n user = User.find_by(id: user_id)\n\n if not user.nil?\n users += user.name + \", \"\n end\n end\n\n if users.size > 0\n users = users[0, users.size - 2]\n end\n\n return users\n end\n end", "title": "" }, { "docid": "46c4ee91554d6b1652ed2c4fa21bc000", "score": "0.6023901", "text": "def favorites\n params[:page] ||=1\n params[:per_page] ||=5\n @links = Link.where(\"Links.id IN (?) \", current_user.favorites).plusminus_tally.order('plusminus_tally ASC').page(params[:page].to_i).per_page(params[:per_page].to_i)\n render action: 'index'\n end", "title": "" }, { "docid": "881b8efd6c3269f2b7327922d08ff74d", "score": "0.601889", "text": "def favorites\n @links = current_user.links.where(:favorited => true).paginate(:page => params[:page], :per_page => 10).order('created_at DESC');\n end", "title": "" }, { "docid": "921737f8ce688976620327a88892d625", "score": "0.6017597", "text": "def show\n @favorite = current_user.favorites.find_by(ic_id: @ic.id)\n end", "title": "" }, { "docid": "65d66cf515a6e28f2e1e31dd42bd3a1d", "score": "0.60116976", "text": "def find_my_favorite(user)\n user && self.favorites.find_by_user_id( user.id )\n end", "title": "" }, { "docid": "249a674cd445f7819f8472c20f0b81de", "score": "0.60110563", "text": "def index\n @user_favourite_recipes = UserFavouriteRecipe.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "b721a453acc875d9ac4433a22712e06a", "score": "0.600964", "text": "def index\n @user = User.find(params[:user_id])\n @favorites = @user.favorites\n @favorite_pictures = @favorites.map(&:picture)\n end", "title": "" }, { "docid": "1288f9a03e06a5a80669926cddbec240", "score": "0.6000574", "text": "def users_favorites\n\tputs \"Creating Users and Favorites\"\n\tUser.delete_all\n\tFavorite.delete_all\n\talphabet = \"a\"\n\t20.times do \n\t\tu = User.create(email: \"#{alphabet}@#{alphabet}.com\", password: \"a\")\n\t\tputs \"USER: #{u.email}(#{u.id})\"\n\t\t20.times do\n\t\t\trandom_recipe = Recipe.all.sample.id\n\t\t\twhile !(Favorite.find_by(user_id: u.id, recipe_id: random_recipe)).nil?\n\t\t\t\trandom_recipe = Recipe.all.sample.id\n\t\t\tend\n\t\t\tf = Favorite.create(user_id: u.id, recipe_id: random_recipe)\n\t\t\tputs \"\\tFAVORITE: #{f.recipe.name}(#{f.id})\"\n\t\tend\n\t\talphabet.next!\n\tend\nend", "title": "" }, { "docid": "cca705555cf01629ab7e173e0c876ca6", "score": "0.59927595", "text": "def favorites\n return unless public?\n\n if @favorites.nil?\n favorites_data = @xml_data['stats']['favorites']\n\n @favorites = {\n :campaign => favorites_data['campaign'],\n :campaign_percentage => favorites_data['campaignpct'].to_i,\n :character => favorites_data['character'],\n :character_percentage => favorites_data['characterpct'].to_i,\n :level1_weapon => favorites_data['weapon1'],\n :level1_weapon_percentage => favorites_data['weapon1pct'].to_i,\n :level2_weapon => favorites_data['weapon2'],\n :level2_weapon_percentage => favorites_data['weapon2pct'].to_i\n }\n end\n\n @favorites\n end", "title": "" }, { "docid": "0fc698bee622b3976ae04c5735aeba64", "score": "0.59876156", "text": "def index\n # Store all of the events from the model in an instance variable so the view can access them\n @events = Event.all.order(\"attending_count DESC\")\n \n @favorite_events\n @favorite_event_ids\n if(logged_in?)\n @favorite_events = FavoriteEvent.where(\"user_id = #{session[:user_id]}\")\n @favorite_event_ids = @favorite_events.map{|event| event.event_id}\n end\n end", "title": "" }, { "docid": "9282cf1540d5999f0de66a2ccced8a8e", "score": "0.59855974", "text": "def index\n @favorites = Favorite.all\n end", "title": "" }, { "docid": "9282cf1540d5999f0de66a2ccced8a8e", "score": "0.59855974", "text": "def index\n @favorites = Favorite.all\n end", "title": "" }, { "docid": "9282cf1540d5999f0de66a2ccced8a8e", "score": "0.59855974", "text": "def index\n @favorites = Favorite.all\n end", "title": "" }, { "docid": "c805e8e7b4fb4368cf231cda28f40853", "score": "0.5970517", "text": "def show\n @favourite_exists = Favourite.where(idea: @idea, user: current_user) ==[] ? false : true\n end", "title": "" }, { "docid": "13d9afd7d9b866c6f09320b1ce2b7273", "score": "0.5970322", "text": "def activities\n\t viewed_user = User.find_by_username(params[:username])\n\t if (is_current_user(viewed_user.username))\n #TODO: Redirect to user's personal activities page\t\n\t elsif (are_friends(current_user.id, viewed_user.id))\n\t\t # Show friend-permissable view\n\t\t @activity_types = []\n\t\t activities = Activity.where(user_id:viewed_user.id)\n\t\t activities.each do |activity|\n @activity_types << ActivityType.where(id:activity.activity_type_id)\n\t end\n else\n\t #TODO: Render blank page\n\t\t render text:'Permission denied'\n\t end \n end", "title": "" }, { "docid": "6fb78b9dfa452706410e9a38eb788443", "score": "0.595842", "text": "def favorites\n @favorite_ids = []\n favorites = Provider.first\n end", "title": "" }, { "docid": "7f0b3261c6d87e2f99a51006e2c9c52d", "score": "0.5952668", "text": "def favorite?(user_id)\n user_recipe_favorites.exists?(user_id: user_id)\n end", "title": "" }, { "docid": "9b3de4c36774e4e12c974ab441d8e0bc", "score": "0.5952064", "text": "def index\n @favourites = Favourite.all\n end", "title": "" }, { "docid": "9b3de4c36774e4e12c974ab441d8e0bc", "score": "0.5952064", "text": "def index\n @favourites = Favourite.all\n end", "title": "" }, { "docid": "4de376824ca4ef3446a72da41886670a", "score": "0.59462917", "text": "def favorite_params\n params.permit( :activity_id, :visited)\n end", "title": "" }, { "docid": "9052503ad29f5c86cc36c550d4b1473e", "score": "0.5944272", "text": "def get_user_favorites(workspace: required(\"workspace\"), resource_type: required(\"resource_type\"), options: {})\n params = { workspace: workspace, resource_type: resource_type }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/users/#{gid}/favorites\", params: params, options: options)), type: Resource, client: client)\n end", "title": "" }, { "docid": "db6bca6baa03577f9ad6421f885b01fd", "score": "0.5939642", "text": "def favorites \n\t\t\tcustomer = Customer.find(params[:customer_id])\n\t\t\t@favorites = customer.favorites\n\t\tend", "title": "" } ]
5ca4ce846c0ff83d364495b838e4c93b
Build a method, team_names, that operates on the game hash to return an array of the team names.
[ { "docid": "42db1b7b422a362d02b25a1b64aa40ff", "score": "0.74263257", "text": "def team_names\n team_names = []\n for location in game_hash.keys\n team_names.push(game_hash[location][:team_name])\n end\n return team_names\nend", "title": "" } ]
[ { "docid": "b4c0ef94bea4cbab5501967a23aa7029", "score": "0.77298486", "text": "def team_names\n # built an empty array called teams\n teams = []\n # game_hash.each do |team, random| iterates over the hash to return all of the team_names\n game_hash.each do |team, random|\n teams.push(game_hash[team][:team_name])\n end\n return teams\nend", "title": "" }, { "docid": "2c3f91b119c051689c649392fcdf8d5e", "score": "0.7677087", "text": "def team_names\n names = []\n game_hash.each do | team, attributes|\n names << game_hash[team][:team_name]\n end\n return names\nend", "title": "" }, { "docid": "4455daea1a0058b00485931ab4dace79", "score": "0.7566298", "text": "def team_names\n team = []\n game_hash.values.each do |team_info|\n team << team_info[:team_name]\n end\n team\nend", "title": "" }, { "docid": "bc1472b549bb602f15ff46a54ad1e4c6", "score": "0.7562196", "text": "def team_names()\n result = []\n game_hash.each do |side,team|\n result.push(team[:team_name])\n end\n result\nend", "title": "" }, { "docid": "4ee9dcaafe346574bf0f4a0297a580f5", "score": "0.75465053", "text": "def team_names\n teams = []\n teams << game_hash[:home][:team_name]\n teams << game_hash[:away][:team_name]\n return teams\nend", "title": "" }, { "docid": "d0f411804c90d1e7d531d8a7ad2db87d", "score": "0.7492323", "text": "def team_names\n names = []\n game_hash.each do |k, team|\n names.push(team[:team_name])\n end\n names\nend", "title": "" }, { "docid": "ad2d79d83be553392c3e615ce95e8674", "score": "0.74803734", "text": "def team_names\n team_name = []\n game_hash.each do |team,info|\n team_name << info[:team_name]\n end\n team_name\nend", "title": "" }, { "docid": "c1d9b2812dccd571bcab4baa19c65d2d", "score": "0.7430724", "text": "def team_names\n [\n game_hash.dig(:home, :team_name),\n game_hash.dig(:away, :team_name)\n ]\nend", "title": "" }, { "docid": "045ccc12d175297c9b66e407f2d796b6", "score": "0.74262965", "text": "def team_names\n output =[]\n game_hash.each do |location, team_data|\n output.push(team_data[:team_name])\n end\n output\nend", "title": "" }, { "docid": "e19e83ef36be53d6579dc9ec07da1f28", "score": "0.7391359", "text": "def team_names\n names = []\n game_hash.each do |location, data|\n names << data[:team_name]\n end\n names\nend", "title": "" }, { "docid": "6764246e5f275d1179eaa5d0f79933c0", "score": "0.7371873", "text": "def team_names\n game_hash.map do |place, team|\n team[:team_name]\n end\nend", "title": "" }, { "docid": "4610a1673dcd3e3e46e05d4c7de4a090", "score": "0.73426056", "text": "def team_names\n team_names = []\n \n game_hash.each do |key, value|\n team_names << value[:team_name]\n end\n team_names\nend", "title": "" }, { "docid": "8eaac7d9f333dcedfc68f415ebf4c7c6", "score": "0.7324549", "text": "def team_names\n\tnew_hash = game_hash\n\tnew_hash.map{|key, value| new_hash[key][:team_name]}\nend", "title": "" }, { "docid": "a92e97893f7205ed392d6ff493d56c2f", "score": "0.7319804", "text": "def team_names\n hash = game_hash\n array = []\n hash.each do |location, attributes|\n attributes.each do |attribute, info|\n if attribute == :team_name\n array << info\n end\n end\n end\n return array\nend", "title": "" }, { "docid": "cc679fd56e901025645ed9d064e5f37a", "score": "0.72972006", "text": "def team_names\n game_hash.map do |location, team_data|\n team_data[:team_name]\n end\nend", "title": "" }, { "docid": "cc679fd56e901025645ed9d064e5f37a", "score": "0.72972006", "text": "def team_names\n game_hash.map do |location, team_data|\n team_data[:team_name]\n end\nend", "title": "" }, { "docid": "e3e9ead71891f8636885cfb67e60984f", "score": "0.7259303", "text": "def team_names\n teams = []\n teams << game_hash[:home][:team_name] << game_hash[:away][:team_name]\nend", "title": "" }, { "docid": "b93dacaba646ee3f44f8dd52f65a629e", "score": "0.7241417", "text": "def team_names\n array = [] \n game_hash.each do |team, attributes|\n attributes.each do |key, value|\n if key == :team_name\n array.push(value)\n \n end\n end\n end\n array\nend", "title": "" }, { "docid": "6e7c953198c85443ab2b013039e7e39d", "score": "0.72412807", "text": "def team_names\n game_hash.collect do |team_key, team_value|\n team_value[:team_name]\n end\nend", "title": "" }, { "docid": "79f19dd73dcaf553e7a64a594196ac1c", "score": "0.7229505", "text": "def team_names\n game_hash.map do |team, team_stats|\n team_stats[:team_name]\n end\nend", "title": "" }, { "docid": "eabbb5a983191c3605fae55578fd747f", "score": "0.72055495", "text": "def team_names\n team_names = []\n game_hash.each do |home_or_away, team_stats|\n team_names << team_stats[:team_name]\n end\n team_names\nend", "title": "" }, { "docid": "9c1b298386540da5cab89d911ddaefa9", "score": "0.71811897", "text": "def team_names\n fin_arr = []\n fin_arr << game_hash[:home][:team_name]\n fin_arr << game_hash[:away][:team_name]\n fin_arr\nend", "title": "" }, { "docid": "7190e4c4f9e1d1f72e6b676e74174256", "score": "0.71600014", "text": "def team_names\n game_hash.collect do |location, attributes|\n attributes[:team_name]\n end\nend", "title": "" }, { "docid": "06537e7903cc2f7a43aa940580dc2c1b", "score": "0.71493024", "text": "def team_names\n new_array = []\n new_array<< game_hash[:home][:team_name]\n new_array<< game_hash[:away][:team_name]\n return new_array\nend", "title": "" }, { "docid": "c772dd730ede9e9f18d5c42cfd1f9d64", "score": "0.7125194", "text": "def team_names()\n temp =[]\n game_hash.each do |location, team_data|\n #binding.pry\n temp << team_data[:team_name]\n end\n temp\nend", "title": "" }, { "docid": "01ca99b8aa74a17b0af69d0122433de4", "score": "0.7118698", "text": "def team_names\n game_hash.collect do |location, team_data|\n team_data[:team_name]\n end\nend", "title": "" }, { "docid": "e0a29933a5616d6e8c31c30dad26a248", "score": "0.70979893", "text": "def team_names\n game_hash.collect do |team, all_info_hash|\n all_info_hash[:team_name]\n end\nend", "title": "" }, { "docid": "a828a631bdafcfeb97990d2007ffe5f7", "score": "0.7018043", "text": "def team_names\n data = game_hash\n all_teams = []\n \n data.each_pair do |home_away, home_away_hash|\n home_away_hash.each_pair do |team_key, team_value|\n \n if team_key == :team_name\n all_teams << team_value\n end\n \n end\n end\n all_teams\nend", "title": "" }, { "docid": "f694455a8d7266b3a77cec350f8dbd3a", "score": "0.6970057", "text": "def team_names\n arrayOfTeamNames = [] #initialize new hash\n arrayOfTeamNames << game_hash[:home][:team_name]\n arrayOfTeamNames << game_hash[:away][:team_name] #shovel it with the data\nend", "title": "" }, { "docid": "f81a390140eb870bceccd46220e38eb0", "score": "0.69557554", "text": "def team_names\n new_array = []\n game_hash.each do |k,v|\n new_array.push(v[:team_name])\n end\nnew_array\nend", "title": "" }, { "docid": "696d2e00bac4693c7ab1de968f8337d5", "score": "0.6950587", "text": "def team_names\n teams.collect do|key|\n key[:team_name]\n end\nend", "title": "" }, { "docid": "4c38537ffd204e12a29363c56ae6d5a7", "score": "0.69245994", "text": "def team_names\n # team_array = []\n # team_array.push(game_hash[:home][:team_name])\n # team_array.push(game_hash[:away][:team_name])\n # team_array\n game_hash.map do |location, team_data|\n team_data[:team_name]\n end\nend", "title": "" }, { "docid": "bf543db5ac562e5afe83466d556c01c1", "score": "0.6903905", "text": "def team_names\n # team_array = []\n game_hash.map do |location, team_data|\n # p team_data[:team_name]\n team_data[:team_name]\n end\nend", "title": "" }, { "docid": "4e8ee8a4007b08547fda203ab4a7bd9f", "score": "0.6894634", "text": "def team_names\n names = []\n game_hash.each do |location, team_hash|\n names << team_hash.fetch_values(:team_name)\n end\n \n names.flatten # flatten is necessary because fetch was putting two arrays inside names\n\nend", "title": "" }, { "docid": "e3e7073face18324cc7543ccbd918c9b", "score": "0.68769044", "text": "def team_names\n game_hash.collect {|home_or_away, stats| team_name = stats[:team_name].to_s}\nend", "title": "" }, { "docid": "ef01498847fb44c737a024180810ffa2", "score": "0.67400837", "text": "def team_names \n # team_array = []\n # game_hash.each do |location, team_data|\n # team_array << team_data[:team_name]\n # end\n # team_array\n game_hash.collect do |location, team_data|\n team_data[:team_name]\n end\nend", "title": "" }, { "docid": "c5af32bbd404b44af5167a3de73e65a0", "score": "0.67164934", "text": "def team_names\n team_names = []\n #top level\n game_hash.each do |location, team_data|\n #2nd level\n team_data.each do |team_deets, values|\n #find team name pair\n if team_deets == :team_name\n team_names << team_data[team_deets]\n end\n end\n end\n team_names = team_names.flatten\nend", "title": "" }, { "docid": "e11132a3065e8c8503b3fe12bd385024", "score": "0.6672608", "text": "def both_team_names(game)\n both_teams = []\n both_teams << game[:home_team][:team_name]\n both_teams << game[:away_team][:team_name]\n both_teams\nend", "title": "" }, { "docid": "994adcfeb5ef0a3465da4e18012e30a8", "score": "0.65007323", "text": "def teams\n game_hash.values\n end", "title": "" }, { "docid": "e27124ba4da8720596c3a210d418d40f", "score": "0.64270383", "text": "def all_players_for_a_team(team_name, game)\n player_names = []\n game[:home_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:home_team][:team_name] == team_name\n end\n game[:away_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:away_team][:team_name] == team_name\n end\n player_names\nend", "title": "" }, { "docid": "4d7c48d2e7a24309754f5e010aa05cf6", "score": "0.6421641", "text": "def team_names\n game = Game.find(self.game_id)\n type = self.bet_type\n if over_under?\n return \"#{game.away_team} vs #{game.home_team}\"\n elsif type == \"lay\"\n if game.spread <= 0\n return game.home_team\n else\n return game.away_team\n end\n else\n if game.spread <= 0\n return game.away_team\n else\n return game.home_team\n end\n end\n end", "title": "" }, { "docid": "c2613f26584c9f8f9ae0fe37a07183c5", "score": "0.6383609", "text": "def players_names_array \n player_names = []\n game_hash.each do |place,team|\n team.each do |attribute, data|\n next unless attribute == :players\n data.each do |player| \n player_names.push(player[:player_name])\n end\n end\n end\n player_names\nend", "title": "" }, { "docid": "3cfccbac656d683208da5d759ae77633", "score": "0.6310511", "text": "def teams\ngame_hash.keys.reduce([]) do |memo, key|\n memo << game_hash[key]\n end\nend", "title": "" }, { "docid": "00b8052e713589b1c1f7ab730031d945", "score": "0.62887055", "text": "def team_names\n cala=[]\n game_hash.each do |status,information|\n # puts status\n # puts information[:team_name]\n cala<< information[:team_name]\n end\n p cala\nend", "title": "" }, { "docid": "3b1f8518de9138b9029235f102610c0d", "score": "0.6287775", "text": "def team_names(hashketball)\r\n puts \"The #{hashketball[:home][:team_name]} welcome the #{hashketball[:away][:team_name]}\"\r\n puts \r\nend", "title": "" }, { "docid": "8cb0f447591c254115fafa8c9641b3bd", "score": "0.6130934", "text": "def team_colors(team_name)\n game_hash.each do |home_away, keys|\n if keys[:team_name] == team_name\n return keys[:colors].map(&:capitalize)\n end\n end\nend", "title": "" }, { "docid": "8cb0f447591c254115fafa8c9641b3bd", "score": "0.6130934", "text": "def team_colors(team_name)\n game_hash.each do |home_away, keys|\n if keys[:team_name] == team_name\n return keys[:colors].map(&:capitalize)\n end\n end\nend", "title": "" }, { "docid": "11647272383ad3c0423f493a0cac6560", "score": "0.607983", "text": "def all_teams_in_league\n \treturnArray = []\n\t\tbase_uri = 'https://www.thesportsdb.com/api/v1/json/1/search_all_teams.php?l=' + @league_name.to_s\n\t\tresponse = RestClient.get(base_uri)\n\t\tjson_response = JSON.parse(response)\n\t\thashIds = json_response['teams'] \n\t\thashIds.length.times do |i|\n\t\t\treturnArray[i] = \"Team ID: #{hashIds[i]['idTeam']}, Name: #{hashIds[i]['strTeam']}, Short Name: #{hashIds[i]['strTeamShort']}, Formed Year: #{hashIds[i]['intFormedYear']}, Sport: #{hashIds[i]['strSport']}, Alternate Name: #{hashIds[i]['strAlternateName']}\"\n\t\tend\n\t\treturn returnArray\n\tend", "title": "" }, { "docid": "ab24bcb229ac7f567fc2d7fdc94630e9", "score": "0.607805", "text": "def getAllTeamNames\n return TestSuite.find_by_sql(\"select DISTINCT teamname from test_suite\");\n end", "title": "" }, { "docid": "a236f7264b175076d60d16995d2a4ea4", "score": "0.6076977", "text": "def getTeamNames\n #return TestSuite.\n end", "title": "" }, { "docid": "bee292a1dcf26b46b487acc667f65241", "score": "0.60614485", "text": "def create_team_list(game_matchups)\n home_team_list = game_matchups.map{|game_info| game_info[\"home_team\"]}\n away_team_list = game_matchups.map{|game_info| game_info[\"away_team\"]}\n duplicate_team_list = home_team_list.concat(away_team_list)\n #remove dupicate team names from team list\n duplicate_team_list.map{|team| team}.uniq\nend", "title": "" }, { "docid": "bee292a1dcf26b46b487acc667f65241", "score": "0.60614485", "text": "def create_team_list(game_matchups)\n home_team_list = game_matchups.map{|game_info| game_info[\"home_team\"]}\n away_team_list = game_matchups.map{|game_info| game_info[\"away_team\"]}\n duplicate_team_list = home_team_list.concat(away_team_list)\n #remove dupicate team names from team list\n duplicate_team_list.map{|team| team}.uniq\nend", "title": "" }, { "docid": "6d092b41943dd69b518014f7f0f53622", "score": "0.5957746", "text": "def player_data_by_team(team)\n players = []\n if team == game_hash[:home][:team_name]\n players << game_hash[:home][:players]\n else\n players << game_hash[:away][:players]\n end\n return players.flatten\nend", "title": "" }, { "docid": "e762ff6319722ecf34ba855b2d2c362c", "score": "0.59397995", "text": "def get_all_players\n ## Version 2.0 ##\n\n all_players = []\n\n # Same steps, but since we don't care about team, let's use .values to just\n # iterate over the team_data:\n game_hash.values.each do |team_data|\n team_data[:players].each do |player|\n all_players << player\n end\n end\n\n all_players\nend", "title": "" }, { "docid": "dd8d1fab1eeec3d01d7ecbec09361304", "score": "0.5877935", "text": "def player_numbers(team_name)\n new_Arr = []\n game_hash.each do |place, team|\n if team_name == team[:team_name]\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n new_Arr.push(player[:number])\n # binding.pry\n end\n end\n end\n end\n end\n new_Arr\nend", "title": "" }, { "docid": "d822783eda8fa5cb9996eb32a5135c94", "score": "0.5854507", "text": "def player_numbers(team_name)\n jersey_numbers = []\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if team_name == value[:team_name]\n jersey_numbers << element[:number]\n end\n end\n end\n jersey_numbers\nend", "title": "" }, { "docid": "bff7a0fdb885bc061664ecaf42601b17", "score": "0.5839904", "text": "def player_numbers(team_name)\n player_number = []\n game_hash.each do |place, team|\n if team[:team_name] == team_name \n team[:players].each do |player|\n player_number<< player[:number]\n end\n end\n end\n player_number\n end", "title": "" }, { "docid": "00aea36b505ec0887adbf088b23a7888", "score": "0.5830797", "text": "def player_numbers(name_of_team)\n #built an empty array called numbers\n numbers = []\n # game_hash.each do |team, random| iterates over the hash to return all player numbers\n game_hash.each do |team, random|\n if name_of_team == game_hash[team][:team_name]\n game_hash[team][:players].each do |name, stats|\n numbers.push(stats[:number])\n end\n end\n end\n return numbers\nend", "title": "" }, { "docid": "a618bfcfecc0f0ea30eff6716f99c688", "score": "0.58253074", "text": "def player_numbers(team_name)\n result = []\n game_hash.each do |team, about|\n if team_name == about[:team_name]\n about[:players].each do |name, stats|\n result << stats[:number]\n end\n end\n end\n result\nend", "title": "" }, { "docid": "5c977e7eb9e949c0f2b704e11bbc2077", "score": "0.58234286", "text": "def player_numbers(team_name)\n array_of_jerseys = []\n one_team_stats(team_name)[:players].each do |player, stats|\n array_of_jerseys << stats[:number]\n end\n array_of_jerseys\nend", "title": "" }, { "docid": "b29e8cefe8a865a29b523d7e690714ce", "score": "0.5819976", "text": "def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |place, team|\n if team[:team_name] == team_name\n team.each do |attribute, player_info|\n if attribute == :players\n player_info.each do |data|\n jersey_nums << data[:number]\n end\n end\n end\n end\n end\n jersey_nums\nend", "title": "" }, { "docid": "dff073066bda274806671d3dfcdd064a", "score": "0.58123535", "text": "def get_players\n players = []\n game_hash.each do |teams, team_data|\n # players.push(team_data[:players])\n players << team_data[:players]\n end\n players.flatten\nend", "title": "" }, { "docid": "72f2c2948b631cd989e7649c85ed4245", "score": "0.5801086", "text": "def player_numbers(team_name)\n #returning an array of all the player numbers for each team\n arr = [] \n game_hash.each do |location, team|\n if team[:team_name] == team_name\n team[:players].each do |player_name, player_info|\n arr << player_info[:number]\n end\n end\n end\n arr\nend", "title": "" }, { "docid": "ce45630773835058bfc6f39f91b568c3", "score": "0.5788207", "text": "def team_name_with_team_number_array(team_ids)\n team1_id, team2_id = team_ids.split(\"-\")\n team1_name, team2_name = create_game_title_from_team_ids(team_ids).split(\" vs \")\n [[team1_name, team1_id], [team2_name, team2_id]]\n end", "title": "" }, { "docid": "8e60e9e6d423a1982fdb22726067d8fc", "score": "0.5781572", "text": "def get_teams\n res = Array.new\n\n @games.each do |g|\n #check if home team is in the result array\n if !res.include?(g.home_team)\n res.push(g.home_team)\n end\n\n #check if away team is in the result array\n if !res.include?(g.away_team)\n res.push(g.away_team)\n end\n end\n\n return res\n end", "title": "" }, { "docid": "5842b1054180fd3e4741de8ad139d4d7", "score": "0.57638556", "text": "def teamName _args\n \"teamName _args;\" \n end", "title": "" }, { "docid": "a8b38cb55d2183fda35e6e91237c3af2", "score": "0.5743632", "text": "def get_all_players\n ## Version 4.0 ##\n\n all_players = []\n\n game_hash.values.each do |team_data|\n all_players << team_data[:players]\n end\n # This pattern of going through each value and then plucking out just a single\n # piece of the data is very, very common.\n # What we are doing is what .map was built for.\n\n ## Example of .map ##\n instructors = [\n { name: 'Lyn', cats: true },\n { name: 'Princeton', cats: false },\n { name: 'Maddie', cats: true }\n ]\n # Goal, get an array that looks like this:\n # ['Lyn', 'Princeton', 'Maddie']\n # This can be accomplished by .map:\n instructor_names = instructors.map do |instructor|\n instructor[:name]\n end\n # The result of map is the data you returned in each iteration.\n # Map is very cool in that you can do more than just pick data to return.\n # You can also transform the data!\n # For example, doubling the number in this array:\n x = [1, 2, 3, 4]\n doubled_x = x.map do |num|\n num * 2\n end\n # doubled_x == [2, 4, 6, 8]\n # Or even more fun, deciding what to return based on the data you are looping over:\n meow = instructors.map do |instructor|\n if instructor[:cats]\n instructor[:cats] = \"😸\"\n else\n instructor[:cats] = \"😿\"\n end\n instructor\n end\n # meow == [{ name: \"Lyn\", cats: \"😸\" }, { name: \"Princeton\", cats: \"😿\" }, { name: \"Maddie\", cats: \"😸\" }]\n\n # Knowing how map works, we can now rewrite our .each but with a map instead\n # and get rid of the initial empty array, all_players = [], because .map\n # will now return the same resulting value:\n all_players = game_hash.values.map do |team_data|\n # We can also get rid of the shovel as we don't need to put them into an array.\n team_data[:players]\n end\n\n all_players.flatten\nend", "title": "" }, { "docid": "775a2959d53f8d16b79bed7ebe80608e", "score": "0.57316697", "text": "def player_numbers (team_name)\n player_number_array = []\n game_hash.each do |team, all_info_hash|\n if all_info_hash[:team_name] == team_name\n all_info_hash[:players].each do |player|\n player.each do |key, value|\n if key == :number\n player_number_array << value\n end\n end\n end\n end\n end\n player_number_array\nend", "title": "" }, { "docid": "45f380020765eb970c388e9adcf274e1", "score": "0.5716541", "text": "def teams\n return [og, oo, cg, co];\n end", "title": "" }, { "docid": "f7b5c90f4b97b9f88fbf6fe935856120", "score": "0.57014805", "text": "def get_league_names\n res = []\n\n if @league_names\n # league names were downloaded before\n @league_names.each do |l|\n res.push(l.name)\n end\n\n else\n # league names were not downloaded, extract them from the league objects\n @leagues.each do |l|\n res.push(l.name)\n end\n end\n\n res\n end", "title": "" }, { "docid": "90263b98c220b7bde2dfdfd989d0b1c5", "score": "0.56995004", "text": "def player_numbers (name=\"Brooklyn Nets\")\n n = []\n game_hash.each do |location, team_data|\n if(team_data[:team_name] == name)\n team_data[:players].each do |key, data|\n n << data[:number]\n end\n end\n end\n\n n\nend", "title": "" }, { "docid": "f3fbe2ad8821fabbafb9dc7da22d1dfe", "score": "0.56900203", "text": "def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |location, data|\n if data[:team_name] == \"#{team_name}\" #found match\n data[:players].each do |player, value|\n jersey_nums << value[:number]\n end\n end\n end\n jersey_nums\nend", "title": "" }, { "docid": "26dbc430844ccbe8f024d8c9a73a588e", "score": "0.56841785", "text": "def print_out_volleyball_setter_name(team_hash)\n return team_hash[:Setter]\nend", "title": "" }, { "docid": "e8dc5c52d1d7ff7aa4a91b959a050bca", "score": "0.568239", "text": "def player_numbers(team_name)\n result = []\n game_hash.each do |side,team|\n if team[:team_name] == team_name\n team.each do |specs, info|\n next unless specs == :players\n\n info.each do |player|\n result.push(player[:number])\n end\n end\n end\n end\n result\nend", "title": "" }, { "docid": "badf52363f74a8a321f284c05bb245c5", "score": "0.56677324", "text": "def player_numbers(team)\n player_numbers = []\n game_hash.each do |location, attributes|\n if attributes[:team_name] == team\n attributes[:players].each do |player, stats|\n player_numbers << stats[:number]\n end\n end\n end\n player_numbers\nend", "title": "" }, { "docid": "e338a7ad95c27decd56f76077aed79b9", "score": "0.56465286", "text": "def player_numbers(team_name)\n jersey_numbers = []\n game_hash.keys.each do |location|\n next unless game_hash[location][:team_name] == team_name\n\n game_hash[location][:players].keys.each do |name|\n jersey_numbers.push(game_hash[location][:players][name][:number])\n end\n end\n jersey_numbers\nend", "title": "" }, { "docid": "32497e10c4e9dcf1bf0c6d13d912776a", "score": "0.5643275", "text": "def player_numbers(team_name)\n jersey_numbers = Array.new\n\n if !game_hash.keys.include?(:team_name)\n game_hash.each do |location, team_info|\n if team_info.keys.include?(:team_name)\n team_info.each do |attribute, quanity|\n if quanity == team_name\n team_info.each do |attribute, quanity|\n if attribute == :players\n # binding.pry\n quanity.each do |name, stats|\n if name.length > 0\n # binding.pry\n stats.each do |stat, stat_quanity|\n if stat == :number\n # binding.pry\n jersey_numbers << stat_quanity\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\nputs jersey_numbers\nreturn jersey_numbers\nend", "title": "" }, { "docid": "4d1e0b0f4d6a4b9f3ffa663a24aeb8a8", "score": "0.5630369", "text": "def get_all_players\n ## Version 5.0 ##\n\n # We can just chain .flatten onto the end of map.\n # By doing this, we can get rid of all_players.\n game_hash.values.map do |team_data|\n team_data[:players]\n end.flatten\nend", "title": "" }, { "docid": "ddaec8eac882167c952f916a28c9d026", "score": "0.5627523", "text": "def all_teams_hash_by_leagues(league_ids)\n teams = {}\n league_ids.each do |league_id|\n teams_in_league = parse_api_request(\"#{BASE_URL}teams/league/#{league_id}\")[\"teams\"]\n teams_in_league.each {|team_data|\n teams[team_data[1][\"team_id\"]] = team_data[1][\"name\"]}\n end\n teams\nend", "title": "" }, { "docid": "4c48929b35d34868f71aaf223924e5b0", "score": "0.56190115", "text": "def player_numbers(user_team_name)\n numbers = []\n game_hash.each do |k, team|\n if team[:team_name] == user_team_name\n team[:players].each do |player|\n numbers.push(player[:number])\n end\n end\n end\n numbers\nend", "title": "" }, { "docid": "6b177d933239eeef1c298647f2effcfb", "score": "0.56165236", "text": "def find_teams(league)\n teams = []\n league.each do |team|\n teams << team[:home_team]\n teams << team[:away_team]\n end\n uniq_teams = teams.uniq!\nend", "title": "" }, { "docid": "f64a7510127bce8c3f347d11e360ae87", "score": "0.56162727", "text": "def player_data\n players = []\n game_hash.each do |home_away, team_details|\n players << team_details[:players]\n end\n return players.flatten\nend", "title": "" }, { "docid": "7a6b4ebc1fb9d0af1ab22b9244492c8f", "score": "0.5615654", "text": "def formatted_teams(array)\n array.map { |team| team.name } * \", \"\n end", "title": "" }, { "docid": "a46646e84826e245c1bb43420c3374d1", "score": "0.56138945", "text": "def team_colors(team_name)\n team_colors =[]\n \n game_hash.each do |key, value|\n if team_name == value[:team_name]\n team_colors = value[:colors]\n end\n end\n team_colors\nend", "title": "" }, { "docid": "46ca4c83e09675ecc4f0cfd35c292e53", "score": "0.55923235", "text": "def players_hash(team_name)\n players1 = game_hash[:home][:players]\n players2 = game_hash[:away][:players]\n arr_players = players1 + players2\n all_players = arr_players[0].merge(arr_players[1])\n\n result = {\n \"Brooklyn Nets\" => players1[0],\n \"Charlotte Hornets\" => players2[0],\n \"All\" => all_players\n }\n\n # Lookup team_name passed in in above hash\n result[team_name]\nend", "title": "" }, { "docid": "ded3f1591c2d5e5a37683c80e150a258", "score": "0.5587568", "text": "def player_numbers (team_name)\n all_jersies = [];\n lookup_by_team(team_name)[:players].map { |player|\n all_jersies << player[:number];\n }\n all_jersies; \nend", "title": "" }, { "docid": "eb0bf9aaadd19931938a4821eda9b666", "score": "0.55739343", "text": "def method_people(names, number)\n names_array = names.shuffle.map\n teams = (names.length.to_f / number).ceil\n new_array = Array.new(teams) { Array.new }\n count = 0\n names_array.map do |name|\n new_array[count] << name\n count == (teams - 1) ? (count = 0) : (count += 1)\n end\n new_array\n end", "title": "" }, { "docid": "68b5434ea873b267212176027711b433", "score": "0.55575293", "text": "def player_numbers(team)\n numbers = []\n game_hash.each do |location, team_data|\n if team_data[:team_name] == team\n team_data[:players].each do |player_name, stat|\n numbers << stat[:number]\n end\n end\n end\n return numbers\nend", "title": "" }, { "docid": "ca03c359743b42f68b8626d280985822", "score": "0.55535984", "text": "def teams\n return @teams if @teams\n\n @teams ||= @team_abbreviation.split(\", \").map do |team_abbreviation|\n Team.new(team_abbreviation, season: @season)\n end\n\n end", "title": "" }, { "docid": "f3affc4bdbcce453cdb55387f3f1cc27", "score": "0.55525815", "text": "def users_by_team\n result = {}\n \n memberships.each do |membership|\n result[membership.team] ||= []\n result[membership.team] << membership.user.nickname\n end\n \n result\n end", "title": "" }, { "docid": "2d3cf86bb985c264af739723791e396d", "score": "0.55493546", "text": "def summon_captain_planet(planeteer_calls)\nplaneteer_calls.map { |string| \"#{string.capitalize}!\" }\nend", "title": "" }, { "docid": "10b7313777694a02f830fa80fd2c2506", "score": "0.55487156", "text": "def get_all_players\n ## Version 2.0 ##\n\n # Same steps, but with a slight tweak...\n all_players = {}\n\n # We don't need team. We only want to loop through the data.\n # So, why don't we use .values to and then just loop through the values\n # in the hash!\n game_hash.values.each do |team_data|\n all_players.merge! team_data[:players]\n end\n\n all_players\nend", "title": "" }, { "docid": "51ab2d3775945c6821eb9c923552eee8", "score": "0.5531755", "text": "def get_team_games(team)\n res = Array.new\n\n @games.each do |g|\n if team == g.home_team\n res.push(g)\n end\n\n if team == g.away_team\n res.push(g)\n end\n end\n\n return res\n end", "title": "" }, { "docid": "cdac3317842e86aba73ba7de6b3063b5", "score": "0.5527795", "text": "def player_stats(player_name)\n player_stats = []\n game_hash.collect do |team_key, team_value|\n team_value[:players].each do |stats|\n if stats[:name] == player_name\n stats.delete(:name)#deletes name to keep in same formart ask for in test.\n player_stats = stats\n end\n end\n end\n player_stats\nend", "title": "" }, { "docid": "a74c617d654b4345ac512bebea06168a", "score": "0.5514404", "text": "def get_champion_names\n Static.get_champion_list.keys\n end", "title": "" }, { "docid": "7c46b43011c7fc8c62b429446a978842", "score": "0.5505261", "text": "def player_numbers(teamname)\n outArray = []\n if game_hash[:home][:team_name] == teamname\n game_hash[:home][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\n\n elsif game_hash[:away][:team_name] == teamname\n game_hash[:away][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\nend\nend", "title": "" }, { "docid": "a81f4b97002c61728c7c6c10066b6e75", "score": "0.5496234", "text": "def player_numbers(team_name)\n nums = []\n \n tname = false\n game_hash.each do |location, team_hash|\n\n \n #the below is actually iterating through the keys of the hash containing the team info, because the value of game_hash is....another hash\n team_hash.each do |key, vals|\n \n #set flag to true if it's the right team\n if vals == team_name \n tname = true \n # this makes sure I'm only iterating through the right pair to begin with\n if key == :players && tname == true # might need to swap these two\n vals.each do |player, stat| # remember stat is a hash (the value of the player name)!\n \n #push the stat into the array if it's the jersey number, otherwise keep iterating. \n nums << stat.fetch_values(:number)\n end\n end\n end\n end\n end\n nums.flatten\nend", "title": "" }, { "docid": "4d833e1d1ffcc33615f0e272baa518ec", "score": "0.5483896", "text": "def player_numbers (team_name)\n player_numbers_list = [] #Empty array to hold lst of players numbers\n game_hash.each do |team_key, team_value|#iterate down 1 level\n if team_value[:team_name] == team_name\n team_value[:players].each do |player_stats|\n player_stats.each do |key, value|#iterate through each players stats\n if key == :number #set :number as the comparison ID\n player_numbers_list << value # push players numbers/\"value\" into the empty array\n end\n end\n end\n end\n end\n player_numbers_list\nend", "title": "" }, { "docid": "d7d2e05298b828185780378cc0ad5f1d", "score": "0.5482273", "text": "def player_nums(team, hashketball)\r\n sym = team.to_sym\r\n player_numbers = []\r\n \r\n hashketball[sym][:players].each_value do |x|\r\n player_numbers << x[:number]\r\n end\r\n player_numbers\r\nend", "title": "" }, { "docid": "73d2e0f8f526210705814ba2fa8f8203", "score": "0.5479199", "text": "def player_numbers(team_name)\n team_numbers = nil\n game_hash.map do |team, team_stats|\n if team_stats[:team_name] == team_name\n team_numbers = team_stats[:players].map do |player_stats|\n player_stats[:number]\n end\n end\n end\n team_numbers\nend", "title": "" } ]
9c9b1f5095bd727fafc8c8c88a540341
returns array of moves possible that wouldn't involve taking another piece
[ { "docid": "2e056fe9ec3ccc0bd9c90e5692413404", "score": "0.7494988", "text": "def get_moves(pieces)\n\t\tarrPos = []\n\t\tupRight, upLeft, downRight, downLeft = true, true, true, true\n\t\tfor i in 1..7\n\t\t\tupRight = false if square_is_taken?(pieces, [@xCord + i, @yCord + i])\n\t\t\tupLeft = false if square_is_taken?(pieces, [@xCord - i, @yCord + i])\n\t\t\tdownRight = false if square_is_taken?(pieces, [@xCord + i, @yCord - i])\n\t\t\tdownLeft = false if square_is_taken?(pieces, [@xCord - i, @yCord - i])\n\t\t\tarrPos << [@xCord + i, @yCord + i] if upRight\n\t\t\tarrPos << [@xCord - i, @yCord + i] if upLeft\n\t\t\tarrPos << [@xCord + i, @yCord - i] if downRight\n\t\t\tarrPos << [@xCord - i, @yCord - i] if downLeft\n\t\tend\n\t\tarrPos\n\tend", "title": "" } ]
[ { "docid": "a5259ad8fa9a3df5803fc756022c71b8", "score": "0.82944024", "text": "def possible_moves\r\n moves = []\r\n @reach.downto(-@reach) {|num| moves << num}\r\n moves = moves.repeated_permutation(2).to_a\r\n moves = apply_directions(moves)\r\n moves = apply_location(moves)\r\n moves = apply_board_limits(moves)\r\n moves = apply_relative_pieces(moves)\r\n moves.delete_if { |move| checkable_move?(move[0], move[1]) }\r\n end", "title": "" }, { "docid": "217531f62642fad3bbac428d003d2b1b", "score": "0.8028332", "text": "def possibles_moves(state)\n actions = []\n pieces(state).each do |piece|\n e = moves_by_piece(state, piece)\n actions.concat(e) unless e.empty?\n end\n actions\n end", "title": "" }, { "docid": "db8b05165e0b404253317651ff596071", "score": "0.8024468", "text": "def possible_moves\n []\n end", "title": "" }, { "docid": "98c9564d52e27b9271990bb8a84922bc", "score": "0.78804076", "text": "def possible_moves\n return @possible_moves if @possible_moves\n @possible_moves = []\n calculate_directions!(@possible_moves)\n calculate_captures!(@possible_moves)\n @possible_moves\n end", "title": "" }, { "docid": "3c4f422df2ee65b45a4e6314ae10ec0c", "score": "0.7876701", "text": "def possible_moves\n moves = []\n\n @directions.each do |direction|\n move = position\n loop do\n move = [direction[0] + move[0], direction[1] + move[1]]\n break if !@board.in_bounds?(move) || @board[move].color == color\n moves << move\n break unless @board.empty?(move)\n end\n end\n\n moves\n end", "title": "" }, { "docid": "5de9f0030c89592f17b82b7c98c70906", "score": "0.78471476", "text": "def moves\n one_step_ahead = [pos[0] + move_dir, pos[1]]\n two_steps_ahead = [pos[0] + (2 * move_dir), pos[1]]\n moves = [one_step_ahead, two_steps_ahead]\n moves.reject! { |move| Board.offboard?(move) || hits_piece?(move) }\n\n MOVES.each do |offset|\n current_pos = pos\n color_offset = [offset[0] * move_dir, offset[1]]\n current_pos = [current_pos[0] + color_offset[0], current_pos[1] + color_offset[1]]\n moves << current_pos unless Board.offboard?(current_pos) || cannot_take_piece?(current_pos)\n end\n\n moves\n end", "title": "" }, { "docid": "d6f077f738a4cf5c79c49124e0da757d", "score": "0.7786634", "text": "def possible_moves\r\n moves = [[-1, 2], [1, 2], [2, 1], [2, -1], [1, -2], [-1, -2], [-2, -1], [-2, 1]]\r\n moves = apply_location(moves)\r\n moves = apply_board_limits(moves)\r\n moves = apply_relative_pieces(moves)\r\n end", "title": "" }, { "docid": "5ebc7a18c513f116ca9c73358ce18d64", "score": "0.77689195", "text": "def all_moves\n @pieces.select{|p| p.color == turn and !p.taken?}\\\n .map{|p| p.moves(self)}\\\n .flatten(1)\n end", "title": "" }, { "docid": "006eb57dac7154d04cd2dd5a55b595b4", "score": "0.77448523", "text": "def all_moves(piece)\n moves = []\n moves = piece.walk + piece.hit\n if piece.name == \"Pawn\"\n moves = moves + piece.walk_first\n end\n return moves.uniq!\n end", "title": "" }, { "docid": "d1483626b6a7002abb578e0162e66ae9", "score": "0.77400386", "text": "def possible_moves(move)\n x, y = move.x, move.y\n\n [ [x+2, y-1], [x+2, y+1],\n [x-2, y-1], [x-2, y+1], \n [x+1, y+2], [x-1, y+2],\n [x+1, y-2], [x-1, y-2] ].select {|move| legal?(move)}\n end", "title": "" }, { "docid": "5d1d922cbd20879f797f97da030f6d11", "score": "0.7708322", "text": "def possible_moves\n moves = []\n [0,1,2].each do |row|\n [0,1,2].each do |col|\n moves << [row,col] if @board[row][col] == SPACE_EMPTY\n end\n end\n moves\n end", "title": "" }, { "docid": "24fefa99c0ba226f87eccff7e836039d", "score": "0.76856554", "text": "def moves\n #don't allow a piece to move into a square already\n #occupied by a piece of the same color\n # ||\n #or move a sliding piece past a piece that blocks it\n\n raise \"Cannot implement moves for a general Piece\"\n #should return an array of place this piece can move to\n end", "title": "" }, { "docid": "a967ecf07f341e7eca76f5edb182f8f8", "score": "0.7671824", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [ [@xCord+1, @yCord+1], [@xCord-1, @yCord-1], [@xCord-1, @yCord+1], [@xCord+1, @yCord-1], [@xCord, @yCord+1], [@xCord, @yCord-1], [@xCord+1, @yCord], [@xCord-1, @yCord] ]\n\t\t\tarrPos << coordinate_pair if square_taken_opponent?(pieces, coordinate_pair)\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "a967ecf07f341e7eca76f5edb182f8f8", "score": "0.76705295", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [ [@xCord+1, @yCord+1], [@xCord-1, @yCord-1], [@xCord-1, @yCord+1], [@xCord+1, @yCord-1], [@xCord, @yCord+1], [@xCord, @yCord-1], [@xCord+1, @yCord], [@xCord-1, @yCord] ]\n\t\t\tarrPos << coordinate_pair if square_taken_opponent?(pieces, coordinate_pair)\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "f622980a9c558a70c93b4e22b771c4c1", "score": "0.7664901", "text": "def valid_moves\n valid_moves_arr = []\n all_moves = get_moves\n all_moves.each do |move|\n unless move_into_check?(move)\n valid_moves_arr << move\n end\n end\n valid_moves_arr\n end", "title": "" }, { "docid": "b324abd7b18cbf817d260e4dc1417553", "score": "0.76578474", "text": "def possible_moves\n retr = []\n retr += forward(pos,motions[:forward]) if motions[:forward]\n retr += backward(pos,motions[:backward]) if motions[:backward]\n retr += diagonal(pos, motions[:diagonal]) if motions[:diagonal]\n retr += horizontal(pos, motions[:horizontal]) if motions[:horizontal]\n retr += ell(pos) if motions[:ell]\n\n retr\n end", "title": "" }, { "docid": "33e2e711ba5b6971ab92fdab85b18299", "score": "0.7655971", "text": "def possible_moves\n @possible_moves = []\n @possible_moves = @legal_moves + @capture_moves + en_passant?\n end", "title": "" }, { "docid": "72529babe2ed6afb1e65b0aefe15c851", "score": "0.76558805", "text": "def possible_moves\n\t\t\tmoves = []\n\n\t\t\t[ [ :next, :next ], [ :next, :prev ], [ :prev, :prev], [ :prev, :next ] ].each{ |axis|\n\t\t\t\tcur_col, cur_row = @col, @row\n\t\t\t\thit_piece = false\n\t\t\t\twhile ( !hit_piece )\n\t\t\t\t\tcur_col = cur_col.send( axis[0] )\n\t\t\t\t\tcur_row = cur_row.send( axis[1] )\n\t\t\t\t\thit_piece = board[ cur_col, cur_row ]\n\t\t\t\t\tif !hit_piece or hit_piece.color != self.color\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tmoves << Move.new( self, cur_col, cur_row, hit_piece )\n\t\t\t\t\t\trescue Board::OutOfBoundsError\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t}\n\t\t\t\n\t\t\tmoves\n\t\tend", "title": "" }, { "docid": "f4184549fa0bf8180deab2ec233f09ac", "score": "0.76504457", "text": "def possible_moves\n @rows.reduce([]) do |moves, row|\n moves.concat(row.reject { |value| @symbols.include?(value) })\n end\n end", "title": "" }, { "docid": "e810f39e8625e3d5f715470cd980be14", "score": "0.7648744", "text": "def possible_moves\n\t\t\t@board.cells.map.with_index {|cell, i| @board.taken?(i + 1) ? nil : i}.compact\n\t\tend", "title": "" }, { "docid": "85ca2ed479bb547548f43e864239a92f", "score": "0.7648435", "text": "def get_moves(pieces)\n\t\tarrPos = []\n\t\tarrPos << [xCord+2, yCord+1] if check_on_board?(xCord+2, yCord+1) && !pieces.fetch([xCord+2, yCord+1])\n\t\tarrPos << [xCord+2, yCord-1] if check_on_board?(xCord+2, yCord-1) && !pieces.fetch([xCord+2, yCord-1])\n\t\tarrPos << [xCord-2, yCord+1] if check_on_board?(xCord-2, yCord+1) && !pieces.fetch([xCord-2, yCord+1])\n\t\tarrPos << [xCord-2, yCord-1] if check_on_board?(xCord-2, yCord-1) && !pieces.fetch([xCord-2, yCord-1])\n\n\t\tarrPos << [xCord-1, yCord+2] if check_on_board?(xCord-1, yCord+2) && !pieces.fetch([xCord-1, yCord+2])\n\t\tarrPos << [xCord-1, yCord-2] if check_on_board?(xCord-1, yCord-2) && !pieces.fetch([xCord-1, yCord-2])\n\t\tarrPos << [xCord+1, yCord-2] if check_on_board?(xCord+1, yCord-2) && !pieces.fetch([xCord+1, yCord-2])\n\t\tarrPos << [xCord+1, yCord+2] if check_on_board?(xCord+1, yCord+2) && !pieces.fetch([xCord+1, yCord+2])\n\t\treturn arrPos\n\tend", "title": "" }, { "docid": "384635ed2c6093b4bf873c8a6dadb3e8", "score": "0.76482207", "text": "def possible_moves\n moves = []\n \n (1..7).each do |x|\n (@row + x > 7)? x_1 = nil : x_1 = @row + x\n (@row - x < 0)? x_2 = nil : x_2 = @row - x\n (@column + x > 7)? y_1 = nil : y_1 = @column + x\n (@column - x < 0)? y_2 = nil : y_2 = @column - x\n \n moves << [x_1, @column]\n moves << [x_2, @column]\n moves << [@row, y_1]\n moves << [@row, y_2]\n moves << [x_1, y_1]\n moves << [x_2, y_1]\n moves << [x_1, y_2]\n moves << [x_2, y_2]\n end\n moves.delete_if {|moves| moves.include?(nil)}\n return moves\n end", "title": "" }, { "docid": "6b83417d01aa44d3c570a93357dd9642", "score": "0.7645166", "text": "def legal_moves(state)\n # puts \"Generating moves for piece at #{@location}...\"\n position = state[:position]\n move_list = []\n # Check whether in the middle of a series of captures\n if state[:moving_piece]\n if state[:moving_piece] != @location\n return []\n end\n # Add captures only\n move_list += generate_captures(state)\n else\n # Add both normal moves and captures\n move_list += generate_moves(state)\n move_list += generate_captures(state)\n end\n # (En passant capture no yet implemented)\n # Return move list\n move_list\n end", "title": "" }, { "docid": "941d380a4ee455444a298efbe235a4b1", "score": "0.7621508", "text": "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [ [@xCord+1, @yCord+1], [@xCord-1, @yCord-1], [@xCord-1, @yCord+1], [@xCord+1, @yCord-1], [@xCord, @yCord+1], [@xCord, @yCord-1], [@xCord+1, @yCord], [@xCord-1, @yCord] ]\t\n\t\t\tarrPos << coordinate_pair if square_taken_opponent?(pieces, coordinate_pair)\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "941d380a4ee455444a298efbe235a4b1", "score": "0.7621508", "text": "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [ [@xCord+1, @yCord+1], [@xCord-1, @yCord-1], [@xCord-1, @yCord+1], [@xCord+1, @yCord-1], [@xCord, @yCord+1], [@xCord, @yCord-1], [@xCord+1, @yCord], [@xCord-1, @yCord] ]\t\n\t\t\tarrPos << coordinate_pair if square_taken_opponent?(pieces, coordinate_pair)\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "ba38daf042078b00f809a88caeda6bb2", "score": "0.7603487", "text": "def moves\n #don't allow a piece to move into a square already\n #occupied by a piece of the same color\n # ||\n #or move a sliding piece past a piece that blocks it\n\n raise \"Cannot implement moves for a general Pieces\"\n #should return an array of place this piece can move to\n end", "title": "" }, { "docid": "0a30581d9fca76ebd317aafd42c71d93", "score": "0.7602652", "text": "def get_all_possible_moves\n possible_moves = []\n @STRAIGHT_MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n @DIAGONAL_MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end", "title": "" }, { "docid": "3a142fe1454c9eb6466de73019d606d7", "score": "0.76021564", "text": "def protecting_moves(pieces)\n\t\tarrPieces = []\n\t\t# add to array of take_moves if the move is on the board, there is another piece on the board and that piece is on the same team\n\t\tfor coordinate_pair in [[@xCord + 2, @yCord + 1], [@xCord + 2, @yCord - 1], [@xCord - 2, @yCord + 1], [@xCord - 2, @yCord - 1], [@xCord - 1, @yCord + 2], [@xCord - 1, @yCord - 2], [@xCord + 1, @yCord - 2], [@xCord + 1, @yCord + 2]]\n\t\tarrPieces << coordinate_pair if square_taken_teammate?(pieces, coordinate_pair)\n\t\tend\n\t\treturn arrPieces\n\tend", "title": "" }, { "docid": "3a142fe1454c9eb6466de73019d606d7", "score": "0.76021564", "text": "def protecting_moves(pieces)\n\t\tarrPieces = []\n\t\t# add to array of take_moves if the move is on the board, there is another piece on the board and that piece is on the same team\n\t\tfor coordinate_pair in [[@xCord + 2, @yCord + 1], [@xCord + 2, @yCord - 1], [@xCord - 2, @yCord + 1], [@xCord - 2, @yCord - 1], [@xCord - 1, @yCord + 2], [@xCord - 1, @yCord - 2], [@xCord + 1, @yCord - 2], [@xCord + 1, @yCord + 2]]\n\t\tarrPieces << coordinate_pair if square_taken_teammate?(pieces, coordinate_pair)\n\t\tend\n\t\treturn arrPieces\n\tend", "title": "" }, { "docid": "6fa3b5968e5dfccc232993f0bacb1f05", "score": "0.7556014", "text": "def possible_moves(piece)\n\t\tmoves_hash = piece.possible_moves\n\t\tmoves_hash.each do |direction,moves|\n\t\t\tmoves.each do |move|\n\t\t\t\tif piece.type == :king || piece.type == :knight\n\t\t\t\t\tif @gameboard.occupied_spaces.include?(move)\n\t\t\t\t\t\toccupier = @pieces.find { |occupier| occupier.position == move }\n\t\t\t\t\t\tmoves.pop if occupier.color == piece.color\n\t\t\t\t\tend\n\t\t\t\telsif piece.type == :queen || piece.type == :bishop || piece.type == :rook\n\t\t\t\t\tif @gameboard.occupied_spaces.include?(move)\n\t\t\t\t\t\tmoves.pop until moves[-1] == move\n\t\t\t\t\t\toccupier = @pieces.find { |occupier| occupier.position == move }\n\t\t\t\t\t\tmoves.pop if occupier.color == piece.color\n\t\t\t\t\tend\n\t\t\t\telsif piece.type == :pawn\n\t\t\t\t\tif direction == :forward\n\t\t\t\t\t\tif @gameboard.occupied_spaces.include?(move)\n\t\t\t\t\t\t\tmoves.pop\n\t\t\t\t\t\t\tmoves_hash[:twiceforward].pop\n\t\t\t\t\t\tend\n\t\t\t\t\telsif direction == :twiceforward\n\t\t\t\t\t\tmoves.pop if @gameboard.occupied_spaces.include?(move)\n\t\t\t\t\telse\n\t\t\t\t\t\tif @gameboard.occupied_spaces.include?(move)\n\t\t\t\t\t\t\toccupier = @pieces.find { |occupier| occupier.position == move }\n\t\t\t\t\t\t\tmoves.pop if occupier.color == piece.color\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tmoves.pop\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\t\tmoves_hash.values.flatten(1)\n\tend", "title": "" }, { "docid": "e0e32e3fa42d21f003b6c2c91cc2feaa", "score": "0.7554361", "text": "def possible_moves\n moves = []\n\n @data.each_with_index do |row, y|\n row.each_with_index do |e, x|\n moves << [y, x] if e.nil?\n end\n end\n\n moves\n end", "title": "" }, { "docid": "48494acf6c13405e18343b73a9995913", "score": "0.7550356", "text": "def possible_moves\n moves = []\n row = location[0]\n column = location[1]\n moves += down_moves(row, column) + up_moves(row, column) +\n left_moves(row, column) + right_moves(row, column)\n end", "title": "" }, { "docid": "c7f3b2ea731b9576c19612f0d6277a02", "score": "0.75443107", "text": "def get_possible_moves(x, y)\n piece = get_board_coord(x, y)\n return get_pawn_possible_moves(x, y) if piece.is_a?(Pawn)\n lambs = piece.possible_moves.values\n arr = []\n lambs.each do |lamb|\n index = 1\n loop do\n new_coord_hash = lamb.call(x, y, index)\n new_arr = [new_coord_hash[:x], new_coord_hash[:y]]\n arr << new_arr if !new_arr.any? { |ele| ele < 0 || ele > 7 } && get_board_coord(new_arr[0], new_arr[1]).respond_to?(:color) && get_board_coord(new_coord_hash[:x], new_coord_hash[:y]).color != piece.color\n break if !(0..7).include?(new_arr[0]) || !(0..7).include?(new_arr[1]) || lamb.call(x, y, index)[:breaker] || get_board_coord(new_coord_hash[:x], new_coord_hash[:y]) != ' '\n arr << new_arr\n index += 1\n end\n end\n arr\n end", "title": "" }, { "docid": "866c260e70a1da9f85dde70c234f5bfc", "score": "0.7536646", "text": "def get_valid_moves\n moves = []\n (0...@grid.length).each do |i|\n (0...@grid.length).each do |j|\n moves << [i,j] unless @grid[i][j].face_up\n end\n end\n moves\n end", "title": "" }, { "docid": "bc3c7e62e9f8aa3519c60f3365f64157", "score": "0.7528185", "text": "def legal_moves(state)\n position = state[:position]\n move_list = []\n position.each_with_index do |square, index|\n if square == 0\n move_list << index\n end\n end\n move_list\n end", "title": "" }, { "docid": "bc3c7e62e9f8aa3519c60f3365f64157", "score": "0.7528185", "text": "def legal_moves(state)\n position = state[:position]\n move_list = []\n position.each_with_index do |square, index|\n if square == 0\n move_list << index\n end\n end\n move_list\n end", "title": "" }, { "docid": "791297210df3b5f5675e0bd5c205d2a7", "score": "0.7526584", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\t# add to array of take_moves if the move is on the board, there is another piece on the board and that piece is on the other team\n\t\tfor coordinate_pair in [[@xCord + 2, @yCord + 1], [@xCord + 2, @yCord - 1], [@xCord - 2, @yCord + 1], [@xCord - 2, @yCord - 1], [@xCord - 1, @yCord + 2], [@xCord - 1, @yCord - 2], [@xCord + 1, @yCord - 2], [@xCord + 1, @yCord + 2]]\n\t\tarrPos << coordinate_pair if square_taken_opponent?(pieces, coordinate_pair)\n\t\tend\n\t\treturn arrPos\n\tend", "title": "" }, { "docid": "791297210df3b5f5675e0bd5c205d2a7", "score": "0.7526584", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\t# add to array of take_moves if the move is on the board, there is another piece on the board and that piece is on the other team\n\t\tfor coordinate_pair in [[@xCord + 2, @yCord + 1], [@xCord + 2, @yCord - 1], [@xCord - 2, @yCord + 1], [@xCord - 2, @yCord - 1], [@xCord - 1, @yCord + 2], [@xCord - 1, @yCord - 2], [@xCord + 1, @yCord - 2], [@xCord + 1, @yCord + 2]]\n\t\tarrPos << coordinate_pair if square_taken_opponent?(pieces, coordinate_pair)\n\t\tend\n\t\treturn arrPos\n\tend", "title": "" }, { "docid": "a7482a5a2c37a3fb57f36913f2da538e", "score": "0.75227606", "text": "def possible_moves\n\t\t\tmoves = []\n\n\t\t\t[ :row, :col ].each{ |axis|\n\t\t\t\t[ :next, :prev ].each{ |dir|\n\t\t\t\t\tcur_col, cur_row = @col, @row\n\t\t\t\t\thit_piece = false\n\t\t\t\t\twhile ( !hit_piece )\n\t\t\t\t\t\tcase axis\n\t\t\t\t\t\t\twhen :col then cur_col = cur_col.send( dir )\n\t\t\t\t\t\t\twhen :row then cur_row = cur_row.send( dir )\n\t\t\t\t\t\tend\n\t\t\t\t\t\thit_piece = board[ cur_col, cur_row ]\n\t\t\t\t\t\tif !hit_piece or hit_piece.color != self.color\n\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\tmoves << Move.new( self, cur_col, cur_row, hit_piece )\n\t\t\t\t\t\t\trescue Board::OutOfBoundsError\n\t\t\t\t\t\t\t\tbreak\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\t}\n\t\t\t}\n\t\t\t\n\t\t\tmoves\n\t\tend", "title": "" }, { "docid": "7c752d70e737c915e8914369b38ab478", "score": "0.752247", "text": "def safe_moves\n moves = []\n available_moves.each do |move|\n new_board = board.dup\n new_board.make_move(position, move)\n\n moves << move unless new_board.in_check?(color)\n end\n moves\n end", "title": "" }, { "docid": "a92dfd10262b09158215f428bd08be34", "score": "0.7516531", "text": "def possible_moves\n possible_step_moves + possible_attack_moves\n end", "title": "" }, { "docid": "3358aa00c66aa5d4f5453af75896e465", "score": "0.7511235", "text": "def possible_moves\n row = @location[0]\n column = @location[1]\n moves = []\n unless row == 7\n if @color == \"white\"\n moves = white_pawn_moves(row, column)\n else\n moves = black_pawn_moves(row, column)\n end\n end\n moves.select do |position|\n position.all? { |value| value.between?(0,7) }\n end\n end", "title": "" }, { "docid": "bc9e241b2b357bbba879afeef4ef4d69", "score": "0.75068104", "text": "def possible_moves\n\t\t@board.map.with_index{|p,i| i if p == '-'}.compact\n\tend", "title": "" }, { "docid": "b4479fe0b6b1a2dd2022e3bd03b2a0fa", "score": "0.75065887", "text": "def possible_moves\n\t\t\tmoves = []\n\t\t\t\n\t\t\t# Move one up, unless a piece is in the way\n\t\t\tnext_row = ( color == WHITE ) ? @row.next : @row.prev\n\t\t\tbegin\tmoves << Move.new( self, @col, next_row ) unless board[ @col, next_row ]\n\t\t\trescue Board::OutOfBoundsError; end\n\n\t\t\t# Jump two ahead, if we could move one ahead\n\t\t\tif !moved? && moves.length > 0\n\t\t\t\tjump_row = ( color == WHITE ) ? next_row.next : next_row.prev\n\t\t\t\tbegin\tmoves << Move.new( self, @col, jump_row ) unless board[ @col, jump_row ]\n\t\t\t\trescue Board::OutOfBoundsError; end\n\t\t\tend\n\n\t\t\t# Capture diagonally one way...\t\t\t\n\t\t\tcol = @col.next\n\t\t\tdest_piece = board[ col, next_row ]\n\t\t\tif dest_piece && dest_piece.color != color\n\t\t\t\tbegin moves << Move.new( self, col, next_row, dest_piece ) \n\t\t\t\trescue Board::OutOfBoundsError; end\n\t\t\tend\n\n\t\t\t# ...and then the other\n\t\t\tcol = @col.prev\n\t\t\tdest_piece = board[ col, next_row ]\n\t\t\tif dest_piece && dest_piece.color != color\n\t\t\t\tbegin moves << Move.new( self, col, next_row, dest_piece ) \n\t\t\t\trescue Board::OutOfBoundsError; end\n\t\t\tend\n\t\t\t\n\t\t\t# todo - en-passant\n\t\t\t\n\t\t\tmoves\n\t\tend", "title": "" }, { "docid": "b5b6b0bd35b05cab5bc4dce2495a8e71", "score": "0.7500656", "text": "def pieces_with_moves(white_turn)\n pieces = (white_turn ? white_pieces : black_pieces)\n pieces.select { |piece| piece.valid_locations != [] }.map { |piece| [piece.row, piece.col] }\n end", "title": "" }, { "docid": "e1f8c96b3e428fd21f829b96cc4d65c5", "score": "0.74948823", "text": "def movable_pieces\n available_pieces.reject { |piece| piece.valid_moves.empty? }\n end", "title": "" }, { "docid": "518ca84c40ae31d2058fc3e2bcc550a0", "score": "0.7490923", "text": "def legal_moves(state)\n position = state[:position]\n player = state[:player]\n piece_list = state[:pieces][player]\n move_list = []\n # Loop over pieces\n piece_list.each do |piece|\n move_list += piece.legal_moves(state)\n end\n move_list\n end", "title": "" }, { "docid": "518ca84c40ae31d2058fc3e2bcc550a0", "score": "0.7490923", "text": "def legal_moves(state)\n position = state[:position]\n player = state[:player]\n piece_list = state[:pieces][player]\n move_list = []\n # Loop over pieces\n piece_list.each do |piece|\n move_list += piece.legal_moves(state)\n end\n move_list\n end", "title": "" }, { "docid": "ea797941993d634bfea3edba97310163", "score": "0.74888486", "text": "def possible_moves\n @state.each_index.select {|i| @state[i] == 0}\n end", "title": "" }, { "docid": "5ceba5162b83e8a95da7f8141a65ca78", "score": "0.74758816", "text": "def piece_moves\n all_moves = []\n dy = color == :B ? 1 : -1\n\n front_one_pos = [pos[0] + dy, pos[1]]\n front_two_pos = [pos[0] + dy + dy, pos[1]]\n cap_positions = [ [pos[0] + dy, pos[1] + 1], [pos[0] + dy, pos[1] - 1] ]\n\n\n all_moves << front_one_pos unless @board.square(front_one_pos)\n all_moves << front_two_pos unless @board.square(front_one_pos) ||\n @board.square(front_two_pos) ||\n has_moved\n\n cap_positions.each do |cap_pos|\n all_moves << cap_pos if @board.square(cap_pos) &&\n @board.square(cap_pos).color != color\n end\n\n all_moves\n end", "title": "" }, { "docid": "0fb09ea65ef32c0aafc84c5a05b360d9", "score": "0.7463618", "text": "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tupRight, upLeft, downRight, downLeft = true, true, true, true\n\t\tfor i in 1..7\n\t\t\tif upRight && square_taken_teammate?(pieces, [@xCord + i, @yCord + i])\n\t\t\t\tupRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord + i] \n\t\t\tend\n\t\t\tif upLeft && square_taken_teammate?(pieces, [@xCord - i, @yCord + i])\n\t\t\t\tupLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord + i] \n\t\t\tend\n\t\t\tif downRight && square_taken_teammate?(pieces, [@xCord + i, @yCord - i])\n\t\t\t\tdownRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord - i] \n\t\t\tend\n\t\t\tif downLeft && square_taken_teammate?(pieces, [@xCord - i, @yCord - i])\n\t\t\t\tdownLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord - i] \n\t\t\tend\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "0fb09ea65ef32c0aafc84c5a05b360d9", "score": "0.7463618", "text": "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tupRight, upLeft, downRight, downLeft = true, true, true, true\n\t\tfor i in 1..7\n\t\t\tif upRight && square_taken_teammate?(pieces, [@xCord + i, @yCord + i])\n\t\t\t\tupRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord + i] \n\t\t\tend\n\t\t\tif upLeft && square_taken_teammate?(pieces, [@xCord - i, @yCord + i])\n\t\t\t\tupLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord + i] \n\t\t\tend\n\t\t\tif downRight && square_taken_teammate?(pieces, [@xCord + i, @yCord - i])\n\t\t\t\tdownRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord - i] \n\t\t\tend\n\t\t\tif downLeft && square_taken_teammate?(pieces, [@xCord - i, @yCord - i])\n\t\t\t\tdownLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord - i] \n\t\t\tend\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "23b0de90af89cfb538f1acb432afd88c", "score": "0.7457443", "text": "def possible_moves(x, y, blocked_moves = nil)\n temp = []\n\n # For En Passant\n if @passantR\n temp.push([x + 1, y + 1]) if blocked_moves[x][y + 1].piece == \"\\u265f \".light_piece && @passantR\n @passantR = false\n end\n if @passantL\n temp.push([x + 1, y - 1]) if blocked_moves[x][y - 1].piece == \"\\u265f \".light_piece && @passantL\n @passantL = false\n end\n\n # To take enemy pieces diagonally\n if (x + 1).between?(0, 7) && (y + 1).between?(0, 7) && blocked_moves[x + 1][y + 1] != ' '\n temp.push([x + 1, y + 1]) if blocked_moves[x + 1][y + 1].identity == 'white'\n @moves.push([x + 1, y + 1]) if blocked_moves[x + 1][y + 1].identity == 'white'\n end\n if (x + 1).between?(0, 7) && (y - 1).between?(0, 7) && blocked_moves[x + 1][y - 1] != ' '\n temp.push([x + 1, y - 1]) if blocked_moves[x + 1][y - 1].identity == 'white'\n @moves.push([x + 1, y - 1]) if blocked_moves[x + 1][y - 1].identity == 'white'\n end\n\n if (x + 1).between?(0, 7)\n temp.push([x + 1, y]) if blocked_moves[x + 1][y] == ' '\n end\n temp.push([x + 2, y]) if @history.empty? && blocked_moves[x + 2][y] == ' ' && blocked_moves[x + 1][y] == ' '\n moves = temp\n end", "title": "" }, { "docid": "cc01a068115cadfea42afdf65611c0af", "score": "0.7455911", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\tupRight, upLeft, downRight, downLeft = true, true, true, true\n\t\tfor i in 1..7\n\t\t\tif upRight && square_taken_opponent?(pieces, [@xCord + i, @yCord + i])\n\t\t\t\tupRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord + i] \n\t\t\tend\n\t\t\tif upLeft && square_taken_opponent?(pieces, [@xCord - i, @yCord + i])\n\t\t\t\tupLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord + i] \n\t\t\tend\n\t\t\tif downRight && square_taken_opponent?(pieces, [@xCord + i, @yCord - i])\n\t\t\t\tdownRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord - i] \n\t\t\tend\n\t\t\tif downLeft && square_taken_opponent?(pieces, [@xCord - i, @yCord - i])\n\t\t\t\tdownLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord - i] \n\t\t\tend\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "cc01a068115cadfea42afdf65611c0af", "score": "0.7455911", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\tupRight, upLeft, downRight, downLeft = true, true, true, true\n\t\tfor i in 1..7\n\t\t\tif upRight && square_taken_opponent?(pieces, [@xCord + i, @yCord + i])\n\t\t\t\tupRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord + i] \n\t\t\tend\n\t\t\tif upLeft && square_taken_opponent?(pieces, [@xCord - i, @yCord + i])\n\t\t\t\tupLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord + i] \n\t\t\tend\n\t\t\tif downRight && square_taken_opponent?(pieces, [@xCord + i, @yCord - i])\n\t\t\t\tdownRight = false\n\t\t\t\tarrPos << [@xCord + i, @yCord - i] \n\t\t\tend\n\t\t\tif downLeft && square_taken_opponent?(pieces, [@xCord - i, @yCord - i])\n\t\t\t\tdownLeft = false\n\t\t\t\tarrPos << [@xCord - i, @yCord - i] \n\t\t\tend\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "fcf8e6533cf3fc8630e9418167d02ecd", "score": "0.74448717", "text": "def moves\n possible_moves = []\n deltas.each do |delta|\n new_pos = [\n position[0] + delta[0],\n position[1] + delta[1]\n ]\n if board.in_bounds?(new_pos)\n if board.piece_at?(new_pos)\n unless board[new_pos].color == color\n possible_moves << new_pos\n end\n else\n possible_moves << new_pos\n end\n end\n end\n possible_moves\n end", "title": "" }, { "docid": "67a15367bd4a7b2f2459443321c49365", "score": "0.74385816", "text": "def moves\n poss_moves = []\n\n all_dirs = diag_dirs + straight_dirs\n all_dirs.each_with_index do |dir, idx|\n new_pos = get_pos(pos, dir)\n next unless @board.in_bounds?(new_pos)\n other = @board[new_pos]\n\n if idx < diag_dirs.length\n next if other.is_a?(NullPiece) || other.same_team?(self)\n else\n break unless other.is_a?(NullPiece)\n end\n\n poss_moves << new_pos\n end\n\n poss_moves\n end", "title": "" }, { "docid": "7f71c531e19ec461cfede077978c4a4d", "score": "0.7436356", "text": "def possible_moves(x, y, blocked_moves = nil)\n temp = []\n\n # For En Passant\n if @passantR\n temp.push([x - 1, y + 1]) if blocked_moves[x][y + 1].piece == \"\\u265f \".dark_piece && @passantR\n @passantR = false\n end\n if @passantL\n temp.push([x - 1, y - 1]) if blocked_moves[x][y - 1].piece == \"\\u265f \".dark_piece && @passantL\n @passantL = false\n end\n\n # To take enemy pieces diagonally\n if (x - 1).between?(0, 7) && (y + 1).between?(0, 7) && blocked_moves[x - 1][y + 1] != ' '\n temp.push([x - 1, y + 1]) if blocked_moves[x - 1][y + 1].identity == 'black'\n end\n if (x - 1).between?(0, 7) && (y - 1).between?(0, 7) && blocked_moves[x - 1][y - 1] != ' '\n temp.push([x - 1, y - 1]) if blocked_moves[x - 1][y - 1].identity == 'black'\n end\n\n if (x - 1).between?(0, 7)\n temp.push([x - 1, y]) if blocked_moves[x - 1][y] == ' '\n end\n temp.push([x - 2, y]) if @history.empty? && blocked_moves[x - 2][y] == ' ' && blocked_moves[x - 1][y] == ' '\n @moves = temp\n end", "title": "" }, { "docid": "02b921cb259ebd32969e2a225888d377", "score": "0.7408566", "text": "def get_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [[@xCord + 2, @yCord + 1], [@xCord + 2, @yCord - 1], [@xCord - 2, @yCord + 1], [@xCord - 2, @yCord - 1], [@xCord - 1, @yCord + 2], [@xCord - 1, @yCord - 2], [@xCord + 1, @yCord - 2], [@xCord + 1, @yCord + 2]]\n\t\tarrPos << coordinate_pair if square_is_open?(pieces, coordinate_pair)\n\t\tend\n\t\treturn arrPos\n\tend", "title": "" }, { "docid": "02b921cb259ebd32969e2a225888d377", "score": "0.7408566", "text": "def get_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [[@xCord + 2, @yCord + 1], [@xCord + 2, @yCord - 1], [@xCord - 2, @yCord + 1], [@xCord - 2, @yCord - 1], [@xCord - 1, @yCord + 2], [@xCord - 1, @yCord - 2], [@xCord + 1, @yCord - 2], [@xCord + 1, @yCord + 2]]\n\t\tarrPos << coordinate_pair if square_is_open?(pieces, coordinate_pair)\n\t\tend\n\t\treturn arrPos\n\tend", "title": "" }, { "docid": "9dd1b38af8c48b78ed569b4d617d95f5", "score": "0.73973435", "text": "def potential_moves\n pos_x = @position.first\n pos_y = @position.last\n positions = []\n (0...pos_x).each do |x|\n positions << [x, pos_y]\n end\n (pos_x...8).each do |x|\n positions << [x, pos_y]\n end\n (0...pos_y).each do |y|\n positions << [pos_x, y]\n end\n (pos_y...8).each do |y|\n positions << [pos_x, y]\n end\n positions.delete([pos_x, pos_y])\n return positions\n end", "title": "" }, { "docid": "9dd1b38af8c48b78ed569b4d617d95f5", "score": "0.73973435", "text": "def potential_moves\n pos_x = @position.first\n pos_y = @position.last\n positions = []\n (0...pos_x).each do |x|\n positions << [x, pos_y]\n end\n (pos_x...8).each do |x|\n positions << [x, pos_y]\n end\n (0...pos_y).each do |y|\n positions << [pos_x, y]\n end\n (pos_y...8).each do |y|\n positions << [pos_x, y]\n end\n positions.delete([pos_x, pos_y])\n return positions\n end", "title": "" }, { "docid": "1e5882dd82886af244cab5e99215d670", "score": "0.7383418", "text": "def legal_moves\n legal_move_list = []\n @@MoveList.each do |move_set|\n moved_square = relative_square(move_set[0],move_set[1])\n legal_move_list << moved_square unless moved_square.nil? or friend_exists(moved_square)\n end\n return legal_move_list\n end", "title": "" }, { "docid": "9f0ec9be9da23c5305e327c126f1a430", "score": "0.7377739", "text": "def required_moves(team, from_coordinate = nil)\n board = state_of_piece\n moves = []\n board.each_with_index do |row, row_index|\n row.each_with_index do |piece, column_index|\n if team == \"red\" && piece == \"RK\"\n next_move = can_eat_down?(row_index, column_index, \"B\") ||\n can_eat_up?(row_index, column_index, \"B\")\n elsif team == \"black\" && piece == \"BK\"\n next_move = can_eat_up?(row_index, column_index, \"R\") ||\n can_eat_down?(row_index, column_index, \"R\")\n elsif team == \"red\" && piece == \"R\"\n next_move = can_eat_up?(row_index, column_index, \"B\")\n elsif team == \"black\" && piece == \"B\"\n next_move = can_eat_down?(row_index, column_index, \"R\")\n end\n unless next_move.blank?\n # discard the move if it would take the piece off the board\n move = [row_index, column_index].concat(next_move)\n if off_the_board(next_move[0], next_move[1])\n # do nothing\n elsif from_coordinate != nil && from_coordinate == [row_index, column_index]\n moves << move\n elsif from_coordinate == nil\n moves << move\n end\n end\n end\n end\n return moves\n end", "title": "" }, { "docid": "f98e169387e62043158ce9b9d09317d7", "score": "0.7372653", "text": "def enemy_possible_check_moves\n keep = []\n for_each_piece do |piece|\n unless piece == \" \" || piece.color == self.color\n if piece.class == Pawn\n keep << piece.possible_capture_moves\n else\n piece.capture_moves\n keep << piece.legal_moves << piece.check_move\n end\n end\n end\n return keep if keep.empty?\n keep.flatten!(1)\n end", "title": "" }, { "docid": "6b1ced85cf0c4a33d27187b40ab762c1", "score": "0.73695976", "text": "def get_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [ [@xCord+1, @yCord+1], [@xCord-1, @yCord-1], [@xCord-1, @yCord+1], [@xCord+1, @yCord-1], [@xCord, @yCord+1], [@xCord, @yCord-1], [@xCord+1, @yCord], [@xCord-1, @yCord] ]\n\t\t\tarrPos << coordinate_pair if square_is_open?(pieces, coordinate_pair)\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "6b1ced85cf0c4a33d27187b40ab762c1", "score": "0.73695976", "text": "def get_moves(pieces)\n\t\tarrPos = []\n\t\tfor coordinate_pair in [ [@xCord+1, @yCord+1], [@xCord-1, @yCord-1], [@xCord-1, @yCord+1], [@xCord+1, @yCord-1], [@xCord, @yCord+1], [@xCord, @yCord-1], [@xCord+1, @yCord], [@xCord-1, @yCord] ]\n\t\t\tarrPos << coordinate_pair if square_is_open?(pieces, coordinate_pair)\n\t\tend\n\t\tarrPos\n\tend", "title": "" }, { "docid": "97bf5926eba566cf84ce681158b7031a", "score": "0.73695225", "text": "def valid_moves(board)\n valids = []\n constant = JUMPINGMOVES[self.class.to_s.downcase + \"_moves\"]\n\n valids = constant.map do |coord|\n x = coord[0] + @coordinates[0]\n y = coord[1] + @coordinates[1]\n [x, y]\n end\n\n # Select only moves that are on the board \n valids.select! { |valid| (1..8).include?(valid[0]) && (1..8).include?(valid[1]) }\n\n # Remove any moves that kill friendly pieces\n valids = valids - valids.select{|v| board[v].piece && board[v].piece.color == self.color}\n\n valids\n end", "title": "" }, { "docid": "73fd06dbf83cc2b688a4d2b5b0ef63cc", "score": "0.7363591", "text": "def moves\n all_good_moves = []\n\n current_pos = self.pos\n all_unblocked_moves = []\n\n move_dirs.each do |dir| # for Rook: [ [1, 0], [-1, 0], [0, 1], [0, -1] ] \n dx, dy = dir\n all_unblocked_moves << grow_unblocked_moves_in_dir(dx, dy)\n end\n \n # For Rook:\n # ali unblocked moves = [ one_dir_set1, one_dir_set2..... one_dir_set4 ]\n # one_dir_set1 = [ [1,0], ..... [7,0] ]\n\n all_unblocked_moves.each_with_index do |one_dir_set, idx|\n \n one_dir_set.each do |pos|\n if @board[pos].is_a?(NullPiece)\n all_good_moves << pos\n elsif @board[pos].color == self.color\n break\n else # opposite color's piece\n all_good_moves << pos\n break\n end\n end\n end\n\n all_good_moves\n end", "title": "" }, { "docid": "c1e5db4e387cfd0e0c9307c44b791b28", "score": "0.7357247", "text": "def get_moves(pieces)\n\t\tcheck_up(\"open\", pieces) + check_down(\"open\", pieces) + check_right(\"open\", pieces) + check_left(\"open\", pieces)\t\n\tend", "title": "" }, { "docid": "c1e5db4e387cfd0e0c9307c44b791b28", "score": "0.7357247", "text": "def get_moves(pieces)\n\t\tcheck_up(\"open\", pieces) + check_down(\"open\", pieces) + check_right(\"open\", pieces) + check_left(\"open\", pieces)\t\n\tend", "title": "" }, { "docid": "90c34058691d35d1954027937a10879d", "score": "0.7337232", "text": "def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n\n loop do\n\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n if !next_pos[0].between?(0,7) || !next_pos[1].between?(0,7)\n break\n end #refactor with .all?\n\n # if there is something in the next_pos square\n unless self.board[next_pos[0], next_pos[1]].nil?\n other_piece_color = self.board[next_pos[0], next_pos[1]].color\n\n if self.color == other_piece_color\n break\n else\n possible_moves << next_pos\n break\n end\n\n else\n possible_moves << next_pos\n num_steps += 1\n end\n\n end\n end\n\n possible_moves\n end", "title": "" }, { "docid": "29754a89cf7d21d3c285852f960934cb", "score": "0.7327004", "text": "def legal_moves\n all_moves = [[0,0], [0,1], [0,2], [1,0], [1,1], [1,2], [2,0],\n [2,1], [2,2]]\n all_moves.select{|move| at(move[0], move[1]) == '_'}\n end", "title": "" }, { "docid": "c80686cd270c7373a48af866d51d35e4", "score": "0.7318352", "text": "def get_all_possible_moves\n possible_moves = []\n @MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end", "title": "" }, { "docid": "3ba8a2ebfaa0adc7a7bb7357e5e57337", "score": "0.7313116", "text": "def legal_moves(game)\n legal_moves = []\n (0..@@board.length).each do |x|\n (0..@@board.length).each do |y|\n legal_moves << [x, y] if piece.is_move_legal?(self, x, y) && game.is_result_legal?(Board.value(x,y))\n end\n end\n legal_moves\n end", "title": "" }, { "docid": "2465d28c29efd05ba98553eff9004225", "score": "0.7311365", "text": "def possible_moves\n moves = @translations.map do |translation|\n [translation[0] + position[0], translation[1] + position[1]]\n end\n moves.select do |move|\n @board.in_bounds?(move) &&\n @board[move].color != color\n end\n end", "title": "" }, { "docid": "a81d08fdccd7a0c9203591a90738b65c", "score": "0.7299327", "text": "def possible_moves\n moves = []\n row = location[0]\n column = location[1]\n moves += northwest_moves(row, column) + northeast_moves(row, column) +\n southwest_moves(row, column) + southeast_moves(row, column)\n end", "title": "" }, { "docid": "f6b5c3f54481474c41c385185967d488", "score": "0.72942483", "text": "def moves\n directions = self.move_diffs\n possible_moves = []\n\n directions.each do |direction|\n new_position = [self.position.first + direction.first, self.position.last + direction.last]\n \n if self.board.valid_position?(new_position)\n \n # Move is valid if the current position is a NullPiece\n if self.board[new_position].is_a?(NullPiece)\n possible_moves << new_position\n next\n end\n \n # Move is invalid, can't move onto a Piece of the same color\n next if self.board[new_position].color == self.color\n \n # Move is valid, can move onto a Piece of a different color\n possible_moves << new_position\n end\n end\n\n possible_moves\n end", "title": "" }, { "docid": "01a40abf375c1186b021a02e01d361e0", "score": "0.7294122", "text": "def moves\n @moves ||= move_pairs.flatten\n end", "title": "" }, { "docid": "eeef721365b612047531ea5ec03f57f8", "score": "0.72928625", "text": "def valid_moves # used by misstep for test moves.\n moves = []\n\n (0..7).each do |x|\n (0..7).each do |y|\n moves.push(Move.new(x, y)) if valid_move?(x, y)\n end\n end\n moves\n end", "title": "" }, { "docid": "78350a006cb6a7225ec690b300c3af4b", "score": "0.7286168", "text": "def get_valid_moves (state)\n cur_state = state\n if !state.present?\n cur_state = self.state\n end\n result = Array.new\n @@valid_moves.each do |f|\n f.each do |t|\n move = @@valid_moves.index(f).to_s + '.' + t.to_s\n jump = self.get_jump(move)\n move += '.' + jump.to_s\n if self.is_valid_move(move, cur_state)\n result.unshift(move)\n end\n end\n end\n return result\n end", "title": "" }, { "docid": "1d6698b67e185e2a991fb7079602702d", "score": "0.7284702", "text": "def moves # array of all possible moves\n all_moves = []\n move_dirs.each { |dir| all_moves += grow_unblocked_moves_in_dir(dir[0], dir[1]) }\n\n all_moves\n end", "title": "" }, { "docid": "b77f2c5b236a1ef3aceca0366d4d597e", "score": "0.72807986", "text": "def get_moves(x,y)\n\t\tresult = []\n\t\t@moveset.each do |move|\n\t\t\trow = x + move[0]\n\t\t\tcol = y + move[1]\n\n\t\t\tif unlimited_movement?() then\n\t\t\t\tif (0..7).cover?(col) && (0..7).cover?(row) then result << [row, col] end\n\t\t\t\twhile (0..7).cover?(col) && (0..7).cover?(row)\n\t\t\t\t\trow += move[0]\n\t\t\t\t\tcol += move[1]\n\t\t\t\t\tresult << [row, col]\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (0..7).cover?(col) && (0..7).cover?(row) then\n\t\t\t\t\tresult << [row, col]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn result\n\tend", "title": "" }, { "docid": "cc7cb615388aa83c36bd7b0aa5353f3c", "score": "0.72790223", "text": "def better_moves\n candidates = []\n available_moves.each do |i|\n row_index = @board.columns[i].index('-')\n candidates << i if @board.columns[i].join.include?(\"OOO\" || \"XXX\") || @board.rows(row_index).join.include?(\"OOO\" || \"XXX\")\n end\n candidates\n end", "title": "" }, { "docid": "60e71442cf97d23efa924a742d9ef663", "score": "0.727713", "text": "def moves\n # debugger\n # create array to collect moves\n valid_moves = []\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n # helper method produces the possible moves in that given direction\n self.move_dirs.each do |dir|\n valid_moves += grow_unblocked_moves_in_dir(*dir)\n end\n valid_moves\n # return the final array of moves (containing all possible moves in all directions)\n end", "title": "" }, { "docid": "ba211ffde289900e17f6ab434e00c78b", "score": "0.7261776", "text": "def moves()\n return DIRECTIONS.select {|d| not wall?(destination(d))}\n end", "title": "" }, { "docid": "bc08a0d7f2ba180f4e8b66604713d170", "score": "0.7252804", "text": "def all_moves\n inject([]) { |accum, track | accum << [:left, track[1], track[0]] << [:right, track[0], track[1]] }\n end", "title": "" }, { "docid": "b153dea1e316896691a9defea0c279c8", "score": "0.7246904", "text": "def available_moves(player, roll)\n moves = []\n\n # Start with all reachable holes given the die roll\n @board.marbles_for_player(player).each do |hole|\n reachable = @board.remote_reachable_holes(hole, roll, player)\n reachable.each do |finish|\n moves << [hole, finish]\n end\n end\n\n #puts \"pre-rejection moves are #{moves.inspect}\"\n to_reject = []\n\n # Reject moves that don't comply with the rules\n moves.count.times do |i|\n start = moves[i][0]\n finish = moves[i][1]\n\n # The path must not be obstructed\n if @board.obstructed_path?(start, finish, player, roll)\n $log.debug \"path between #{start} and #{finish} obstructed\"\n to_reject << i\n end\n\n # Reject moves that start at the bench unless roll is 1 or 6\n if (start.to_s =~ /bench/) && !([1,6].include? roll)\n $log.debug \"cannot leave #{start} unless roll is 1 or 6\"\n to_reject << i\n end\n\n # Can only leave yolo with a 1 #TODO probably not needed\n to_reject << i if (start =~ /yolo/ && !(roll == 1))\n end\n\n #puts \"rejecting #{to_reject.uniq}\"\n to_reject.uniq.reverse.each { |i| moves.delete_at(i) }\n\n moves\n end", "title": "" }, { "docid": "e63c46e508bc935ec78de5792fb9ae1a", "score": "0.72417724", "text": "def possible_moves\n Knight.possible_moves_from(@position)\n end", "title": "" }, { "docid": "c19b6b8e8efe43bf1a82dc855b6fc8e2", "score": "0.7238079", "text": "def moves\n # create array to collect moves\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method for each direction)\n\n # return the final array of moves (containing all possible moves in all directions)\n end", "title": "" }, { "docid": "e99bd58fb6fff8c90ffcacd1df6013a3", "score": "0.7235157", "text": "def valid_moves(board)\n valids = []\n constant = JUMPINGMOVES[self.class.to_s.downcase + \"_moves\"]\n\n valids = constant.map do |coord|\n x = coord[0] + @coordinates[0]\n y = coord[1] + @coordinates[1]\n [x, y]\n end\n\n valids.select! { |valid| (1..8).include?(valid[0]) && (1..8).include?(valid[1]) }\n\n valids\n end", "title": "" }, { "docid": "02da5fe643be2f57d3131f8c2cda8b94", "score": "0.72268075", "text": "def calculate_possible_moves(piece, row_index, column_index)\n moves = []\n unless (row_index > 6 && piece == \"B\") || (row_index < 1 && piece == \"R\")\n if (piece == \"R\" || piece == \"RK\" || piece == \"BK\") && column_index == 7\n if (piece == \"R\" || piece == \"RK\" || piece == \"BK\") &&\n state_of_piece[row_index - 1][column_index - 1] == nil\n moves << [row_index - 1, column_index - 1]\n end\n elsif (piece == \"R\" || piece == \"RK\" || piece == \"BK\") && column_index == 0\n if (piece == \"R\" || piece == \"RK\" || piece == \"BK\") &&\n state_of_piece[row_index - 1][column_index + 1] == nil\n moves << [row_index - 1, column_index + 1]\n end\n elsif (piece == \"B\" || piece == \"RK\" || piece == \"BK\" )&& column_index == 0\n if (piece == \"B\" || piece == \"RK\" || piece == \"BK\") &&\n state_of_piece[row_index + 1][column_index + 1] == nil\n moves << [row_index + 1, column_index + 1]\n end\n elsif (piece == \"B\" || piece == \"RK\" || piece == \"BK\" )&& column_index == 7\n if (piece == \"B\" || piece == \"RK\" || piece == \"BK\") &&\n state_of_piece[row_index + 1][column_index - 1] == nil\n moves << [row_index + 1, column_index - 1]\n end\n end\n if (piece == \"R\" || piece == \"RK\" || piece == \"BK\") && row_index != 0 &&\n state_of_piece[row_index - 1][column_index - 1] == nil\n moves << [row_index - 1, column_index - 1]\n end\n if (piece == \"R\" || piece == \"RK\" || piece == \"BK\") && row_index != 0 &&\n state_of_piece[row_index - 1][column_index + 1] == nil\n moves << [row_index - 1, column_index + 1]\n end\n if (piece == \"B\" || piece == \"RK\" || piece == \"BK\") && row_index != 7 &&\n state_of_piece[row_index + 1][column_index + 1] == nil\n moves << [row_index + 1, column_index + 1]\n end\n if (piece == \"B\" || piece == \"RK\" || piece == \"BK\") && row_index != 7 &&\n state_of_piece[row_index + 1][column_index - 1] == nil\n moves << [row_index + 1, column_index - 1]\n end\n end\n return moves\n end", "title": "" }, { "docid": "a963a031e6578856eed51d57aa7b3836", "score": "0.72225815", "text": "def legal_moves\n @check_move = []\n @capture_moves = []\n @legal_moves = []\n get_legal_move(-1, -2)\n get_legal_move(-1, 2)\n get_legal_move(1, -2)\n get_legal_move(1, 2)\n @legal_moves\n end", "title": "" }, { "docid": "2b8a29c6e277e77a4af76b374ce0744b", "score": "0.72121674", "text": "def legal_moves\n if @gamestate != :ongoing\n return []\n else\n return @empty_fields\n end\n end", "title": "" }, { "docid": "01960c4273c2e77e0810a36f964eb8d0", "score": "0.72085154", "text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "title": "" }, { "docid": "a989dbc7c147d16d7e1f80431d54b06e", "score": "0.7204469", "text": "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "title": "" }, { "docid": "d9f018eb4b2a340092cdfd41cf1e3041", "score": "0.719938", "text": "def get_moves_at(row, col)\n [\n [\n { :row => row + 2, :col => col }, \n { :row => row + 1, :col => col }\n ],\n [\n { :row => row + 2, :col => col + 2 }, \n { :row => row + 1, :col => col + 1 }\n ],\n [\n { :row => row - 2, :col => col - 2 }, \n { :row => row - 1, :col => col - 1 }\n ],\n [\n { :row => row - 2, :col => col }, \n { :row => row - 1, :col => col }\n ],\n [\n { :row => row, :col => col + 2 }, \n { :row => row, :col => col + 1 }\n ],\n [\n { :row => row, :col => col - 2 }, \n { :row => row, :col => col - 1 }\n ]\n ].inject([]) do |valid_moves, candidate|\n valid_moves << candidate if candidate.all? do |square| \n in_bounds?(square[:row], square[:col]) && \n @board[square[:row]][square[:col]] == \"x\"\n end\n valid_moves\n end\n end", "title": "" }, { "docid": "da4a29cd52f4b91f5ed6404049b4634a", "score": "0.7195329", "text": "def possible_moves(board,kill_only=false)\n current_loc = board.get_piece_loc(color,name)\n moves = []\n add_first_move_behaviour if first_move?(current_loc)\n add_kill_only_behaviour if kill_only\n @valid_moves.each do |move|\n move = [current_loc[0]+move[0], current_loc[1]+move[1]] # transposing pawn movement behaviour to current location\n next if out_of_board?(move)\n next if !kill_only && caused_check?(move, board)\n if moving_forward?(move, current_loc)\n next if pawn_blocked?(move, board)\n moves << move\n elsif kill?(move, board)\n moves << move\n end\n end\n # need to reset the valid moves each time otherwise #add_first_move_behaviour and #add_kill_only_behaviour keep adding onto the array\n @valid_moves= color == :black ? [[0, -1], [-1, -1], [1, -1]] : [[0, 1], [1, 1], [-1, 1]]\n moves\n end", "title": "" }, { "docid": "725f70fda0d4acd01f0a1a389338859c", "score": "0.7188047", "text": "def moves\n current_row, current_column = self.position\n possible_moves = []\n unless initial_move\n possible_moves << [current_row + 1, current_column]\n possible_moves << [current_row + 2, current_column]\n else\n #Move 2 times\n #is there a eatable piece diagonal from pawn? if so, move diagonally one square\n #otherwise\n possible_moves << [current_row + 1, current_column]\n end\n\n #initial_move = true\n possible_moves\n end", "title": "" } ]
b747c4c805af477cca85bd3dbbe15658
On converti les celsius en farenheits en utilisant des floats
[ { "docid": "04becc6d13472cae8a03a691170a6c38", "score": "0.59734887", "text": "def ctof(tempc)\n\ttempf = (tempc * 9 / 5.0) + 32\n\treturn tempf\nend", "title": "" } ]
[ { "docid": "c6026b3ac3a6831d85d9625d917a43ab", "score": "0.6894957", "text": "def convert(temp_in_fahrenheit)\n (temp_in_fahrenheit.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "fadab8148e623791e3bd60372eb7b655", "score": "0.6882309", "text": "def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * value) + 32\n\t\tend\t\t\n\t\treturn converted_value.round\n\tend", "title": "" }, { "docid": "2870b4ec739d7a985c62e2fc73e4bb72", "score": "0.686682", "text": "def convert(temperature_fahrenheit)\n (temperature_fahrenheit.to_f - 32) * 5 / 9\nend", "title": "" }, { "docid": "094d3be61b8e8830d547ac5a750b2146", "score": "0.6851", "text": "def convert (temp_f = 0)\n temp_c = (temp_f - 32.0) * 5/9\n temp_c = format(\"%.2f\", temp_c).to_s\n temp_f = format(\"%.2f\", temp_f).to_s\n puts \"#{temp_f} degrees Fahrenheit is #{temp_c} degrees Celsius\"\nend", "title": "" }, { "docid": "f2ba21bc32f65210880ef5b3e4a1b33b", "score": "0.68439716", "text": "def convert(degrees_fahrenheit)\n celsius = (degrees_fahrenheit.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "bbe863639477b8faf3a73df6e101ed76", "score": "0.68405217", "text": "def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend", "title": "" }, { "docid": "3d262d79d9635b54de3804d838adce56", "score": "0.6839929", "text": "def convert(fahrenheit_temp)\n @celsius_temp = (fahrenheit_temp - 32) * 5 / 9\nend", "title": "" }, { "docid": "f552fe1ddaf290d9e470d0ed73f1bef5", "score": "0.677397", "text": "def celsius_to_fahrenheit(temp)\n temp.to_f * 9/5 + 32\nend", "title": "" }, { "docid": "dc6afc1b503c90e791dfabdb0aca6e23", "score": "0.6753806", "text": "def ctof(c) # c celsius parameter/value to be converted to f fahrenheit\n return c * 9.0/5.0 + 32\nend", "title": "" }, { "docid": "4c0dc9e8264a76f27e21d77d00c2bb58", "score": "0.6742969", "text": "def celcius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend", "title": "" }, { "docid": "ad2bb51755cea86d66d001e3aededae9", "score": "0.67359984", "text": "def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "9023740a7ecb0d597a976252a00a376a", "score": "0.66777235", "text": "def convert_inches_to_feet( inches )\r\n inches.valid_float? ? (inches.to_f/12.0) : 0.0\r\nend", "title": "" }, { "docid": "7ca38f9aff0b92756b6549080668aead", "score": "0.66644573", "text": "def convert(f)\n (f - 32.0) * 5 / 9\nend", "title": "" }, { "docid": "2ce009f9d498ae754068509784680285", "score": "0.66633445", "text": "def c2f(c)\n c * 9.0 / 5 + 32\nend", "title": "" }, { "docid": "cc197b0008057c058a7941d5af945a9d", "score": "0.666121", "text": "def celscius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend", "title": "" }, { "docid": "619cee8b19cb191a5920e08868a0ca4d", "score": "0.6660704", "text": "def convertFahrenheit\r\n case self.myScale\r\n when 'K'\r\n self.myDegrees = (self.myDegrees * (9.0/5.0) - 459.67)\r\n self.myScale = 'F'\r\n when 'C'\r\n self.myDegrees = ((self.myDegrees * 1.8) + 32.0)\r\n self.myScale = 'F'\r\n end\r\n \r\n end", "title": "" }, { "docid": "aa754f2c158fe4bee85f07920b1afa2d", "score": "0.6648644", "text": "def converttemp (f)\n return (f-32) * (5/9.0)\nend", "title": "" }, { "docid": "42a2d0f7c479a075236becdd1fb29ca3", "score": "0.65879184", "text": "def convertCtoFandFtoC\n\t\tif @tempUnit == \"fahrenheit\"\n\t\t\tresult = ((@temperature - 32) * 5/9)\n\t\telsif @tempUnit == \"celsius\"\n\t\t\tresult = ((@temperature + 32) * 9/5)\n\t\tend\n\t\treturn (result).round(3)\n\tend", "title": "" }, { "docid": "02fea01cdfb8bd30c7eb2dabc2a3b02f", "score": "0.6567346", "text": "def convert(_Fahrenheit)\n (_Fahrenheit.to_f - 32) * 5 / 9\n end", "title": "" }, { "docid": "df4e34fe6bfb8e8224505d50c2d8d10b", "score": "0.656516", "text": "def fahrenheit_to_celsius(tempf)\n tempc = ((tempf.to_f()-32)*5)/9\n return tempc\nend", "title": "" }, { "docid": "068be04605401cb59a94483d8c4678cc", "score": "0.65648365", "text": "def test_fahrenheit_to_celsius()\n celcius_value1 = convert_f_to_c(0)\n celcius_value2 = convert_f_to_c(32)\n celcius_value3 = convert_f_to_c(60)\n celcius_value4 = convert_f_to_c(100)\n assert_equal(-17.77777777777778, celcius_value1)\n assert_equal(0, celcius_value2)\n assert_equal(15.555555555555557, celcius_value3)\n assert_equal(37.77777777777778, celcius_value4)\n end", "title": "" }, { "docid": "f37486fd285e59ad3488c32e24027956", "score": "0.6557043", "text": "def toF\n if @unit == 'C' then\n @unit = 'F'\n @value = 1.8 * @value + 32.0\n elsif @unit == 'R' then\n @unit = 'F'\n @value -= 459.67\n elsif @unit == 'K' then\n @unit = 'F'\n @value = 1.8 * @value - 459.67\n end\n self\n end", "title": "" }, { "docid": "4d6181ecc680ed8e35995f1ffa5dfa91", "score": "0.65525824", "text": "def convert(fahrenheit)\n celsius = (5 * (fahrenheit - 32))/9\nend", "title": "" }, { "docid": "5772a43f1323051b430aaaaa0d5c78cd", "score": "0.65048337", "text": "def convert_temp(f)\n return (f - 32) * 5/9\nend", "title": "" }, { "docid": "1da53270f114ee9b9252c404f2004132", "score": "0.64784586", "text": "def c_to_f(celsius)\n fahrenheit = (celsius * (9.0 / 5.0)) + 32\n puts fahrenheit\nend", "title": "" }, { "docid": "c330584941dd96be481c977503774007", "score": "0.64538014", "text": "def convertCelsius\r\n case self.myScale\r\n when 'K'\r\n self.myDegrees = (self.myDegrees - 273.15)\r\n self.myScale = 'C'\r\n when 'F'\r\n self.myDegrees = ((self.myDegrees - 32.0) * (5.0/9.0))\r\n self.myScale = 'C'\r\n end\r\n end", "title": "" }, { "docid": "bfc330264166b5d6d2fd43d6afa20508", "score": "0.6448474", "text": "def map_float (arr)\n flo = arr.map(& :to_f)\n puts \"El array como flotantes #{flo}\" \nend", "title": "" }, { "docid": "5bb83d3d5af26feb44e3cf8e47c86678", "score": "0.64427555", "text": "def fahrenheit_to_celsius(temp)\n (temp.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "d7fe52d632795d5b14a0b46c3633bf1e", "score": "0.64406", "text": "def to_f\n case @kind\n when :float_lit, :float_exp_lit,\n :integer_lit, :integer_exp_lit,\n :single_string_lit, :double_string_lit\n @value.to_f\n else\n self.to_i.to_f\n end\n end", "title": "" }, { "docid": "eebd24e7c7d161a84994920c07f51b85", "score": "0.6428994", "text": "def fahrenheit_to_celsius(f)\n\tc = (f - 32) / 1.8\nend", "title": "" }, { "docid": "bbb8af01aa785dbe6ea96c8946bf3b6d", "score": "0.6424514", "text": "def fahrenheit_to_kelvin(temp)\n (temp.to_f + 459.67) * 5/9\nend", "title": "" }, { "docid": "3df453256c96b91592ca9d292092f7af", "score": "0.6410568", "text": "def celsius_to_fahrenheit(celsius)\n (celsius.to_f * 9) / 5 + 32\nend", "title": "" }, { "docid": "61b4ac6ce4270c43003c2a852dbd0fd8", "score": "0.6395999", "text": "def convert( fahrenheit )\n puts format( \"%.2f\", ( fahrenheit.to_f - 32 )/ 1.8000 )\nend", "title": "" }, { "docid": "f8ef921af8577a0deb7f0777d0d2d1d4", "score": "0.6389219", "text": "def convert_fahrenheit(celsius)\n\tmyfahrenheit=((9 * celsius.to_f)/5 +32)\nend", "title": "" }, { "docid": "b9c90a47db9100978a636c2f339b1bdd", "score": "0.63720196", "text": "def numericize\n\t\tcollect(&:to_f)\n\tend", "title": "" }, { "docid": "d038b2cb13cb5369d856adc9951a932c", "score": "0.63598543", "text": "def to_f() end", "title": "" }, { "docid": "d038b2cb13cb5369d856adc9951a932c", "score": "0.63598543", "text": "def to_f() end", "title": "" }, { "docid": "d038b2cb13cb5369d856adc9951a932c", "score": "0.63598543", "text": "def to_f() end", "title": "" }, { "docid": "d038b2cb13cb5369d856adc9951a932c", "score": "0.63598543", "text": "def to_f() end", "title": "" }, { "docid": "fc84fa3a1171a391b7ba783cb8c9b5b8", "score": "0.63523626", "text": "def convert_to_celsius(fahrenheit)\n \"%.2f\" % ((fahrenheit.to_f-32) * 5 / 9 )\nend", "title": "" }, { "docid": "55f6d812e82dab82eef2cde8d526fe55", "score": "0.63497835", "text": "def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend", "title": "" }, { "docid": "55f6d812e82dab82eef2cde8d526fe55", "score": "0.6348761", "text": "def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend", "title": "" }, { "docid": "4cfc894ea17ca90225a349c2a244dde8", "score": "0.63485044", "text": "def fahrenheit_to_celsius(fartemp)\n return (fartemp - 32) * 5/9\nend", "title": "" }, { "docid": "3d56c955992f5dad4625917ab71d4478", "score": "0.6345879", "text": "def convert_to_celsius(fahrenheit)\n celsius = (5*(fahrenheit.to_f - 32))/9\n return celsius\nend", "title": "" }, { "docid": "50ff83fba4dcb2087b6c5f503d6db11e", "score": "0.63194156", "text": "def convert_tocelsius(fahrenheit)\n # return (fahrenheit - 32) * (5/9)\n return fahrenheit*5/9 - 32*5/9 \nend", "title": "" }, { "docid": "2a30b6871dd688e7624b7b816a38ebae", "score": "0.63086444", "text": "def fahrenheit_to_celsius(far_temp)\n return (far_temp -32) * (5/9)\nend", "title": "" }, { "docid": "53fb629a10bca0dc5d85e42333ac6ba8", "score": "0.6307378", "text": "def c2f(c)\n (c*9.0/5+32).to_f.round(2)\nend", "title": "" }, { "docid": "520ee03df9886d556cb667647aa8d0b3", "score": "0.6288028", "text": "def convert(fahrenheit)\n (fahrenheit - 32).to_f * 5/9\nend", "title": "" }, { "docid": "7a5896a74c00e479d26178b69cff8c2e", "score": "0.6287541", "text": "def to_f(general_votes_cell)\n general_votes_cell.gsub(/[^0-9]/, '').to_f\n end", "title": "" }, { "docid": "b59a0ef328c944a116c4890f964df14f", "score": "0.6265173", "text": "def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend", "title": "" }, { "docid": "842b30eb9b925bc2c89a63e608e8b5d7", "score": "0.62478834", "text": "def float\n little? ? read(4).unpack1('e') : read(4).unpack1('g')\n end", "title": "" }, { "docid": "23ab101556b7326edc26725e1486806c", "score": "0.62465894", "text": "def Float(p0) end", "title": "" }, { "docid": "a7befc27608aa9ceed94527b3708a53c", "score": "0.6236427", "text": "def farenheit_to_celsius(temp)\n return (temp - 32) * 5 / 9\nend", "title": "" }, { "docid": "8c7d3e5f4fe5bcdbb5e3b845b9f70c08", "score": "0.6231733", "text": "def to_float(a)\n floats = a.map {|x| x.to_f}\n print floats\n \nend", "title": "" }, { "docid": "0378b9f09052359975933e763c507612", "score": "0.622692", "text": "def celcius_calculation(fahrenheit_input) #Celcius calculation\n ((fahrenheit_input.to_f - 32) * 5) / 9\nend", "title": "" }, { "docid": "433eaae1459d31db4fdaae759040d1cd", "score": "0.6225507", "text": "def convert_to_celcius(temp)\n\t (temp - 32) * 5/9\nend", "title": "" }, { "docid": "a0842fb929c92ad97e7119f69bbef5fa", "score": "0.62238234", "text": "def ctof(celsius_degrees)\n fahrenheit = (celsius_degrees.to_i * 1.8 ) + 32\n if celsius_degrees == 37 \n \treturn fahrenheit.to_f\n else\n \treturn fahrenheit\n end \n \nend", "title": "" }, { "docid": "cc56b6c1e5e17c593b760ceb170da097", "score": "0.6217511", "text": "def celsius(f)\n #(f - 32) / 1.8 = c.to_i\n c = ((f.to_i) - 32) * 5 / 9\n \"The temperature in Celsius is #{c}.\"\nend", "title": "" }, { "docid": "43c213d58f8b09fdf6206eb85bf9274b", "score": "0.62126935", "text": "def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend", "title": "" }, { "docid": "d397357f2abf98325fa9271ace751e62", "score": "0.62110317", "text": "def in_fahrenheit\n if @type == :f\n @temp\n else\n ((@temp.to_f * 9.0)/5.0) + 32.0\n end\n end", "title": "" }, { "docid": "552fc4b2924a8ae8eac2f25cf998c5ef", "score": "0.6201779", "text": "def ctof(temp)\n temp = temp.to_f * 9 / 5 + 32\n return temp.to_f\nend", "title": "" }, { "docid": "c8baeba58dc1b2731c077d774b5a1c60", "score": "0.61855006", "text": "def __s2f(other)\n return other if other.is_a? Numeric\n if /^0[Xx][0-9a-fA-F]+$/ =~ other\n other.to_i(0).to_f\n else\n other.to_f\n end\n end", "title": "" }, { "docid": "72dc8d0fec4bb8ea5e4babab3412d189", "score": "0.6184468", "text": "def fahrenheit_to_celsius f\n 5.0 / 9.0 * (f - 32.0)\nend", "title": "" }, { "docid": "53e8a1c98e140f57acef5619457e304c", "score": "0.61678874", "text": "def hex_to_float(txt)\n # Numerals::Format[:hexbin].read(txt, type: Float)\n # txt.scanf(\"%A\").first\n Float(txt)\nend", "title": "" }, { "docid": "329f1847170ebf19db141a900e5a5755", "score": "0.61622536", "text": "def getFahrenheit()\n if scale =~ /f/ then\n Temperature.new(@degrees, @scale)\n elsif scale =~ /c/ then\n Temperature.new(@degrees * (9.0/5) + 32, \"f\")\n else\n Temperature.new((@degrees + 273.15) * (9.0/5) + 32, \"f\")\n end\n end", "title": "" }, { "docid": "26e38f496d6bb59d59cde0c3f4edf683", "score": "0.6157484", "text": "def convert(fahrenheit)\n (fahrenheit - 32) * 5 / 9 \nend", "title": "" }, { "docid": "b674fdc7f103b37cf23a678ad2fe1411", "score": "0.61333704", "text": "def convert(degree_fahrenheit)\n \n degree_celius = (degree_fahrenheit - 32)/1.8\n\nend", "title": "" }, { "docid": "c601c6b5bba6df8891cfe4350b1e8856", "score": "0.6130552", "text": "def toFahrenheit\n\t\t\tcase @scale\n\t\t\t\twhen 'C'\n\t\t\t\t\tTemperature.new(@degrees * 1.8 + 32.0, 'F')\n\t\t\t\twhen 'F'\n\t\t\t\t\tTemperature.new(@degrees, 'F')\n\t\t\t\twhen 'K'\n\t\t\t\t\tTemperature.new((@degrees - 273.15) * 1.8 + 32.0, 'F')\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "f23d791e3f3883c2043c26e67a2473a9", "score": "0.61302173", "text": "def kelvin_to_fahrenheit(temp)\n temp.to_f * 9/5 - 459.67\nend", "title": "" }, { "docid": "fce46ca73fe064204b7bbe6bb838dbe7", "score": "0.61249685", "text": "def ctof(temp)\n\treturn (temp.to_f * 9 / 5) + 32\nend", "title": "" }, { "docid": "414c0359adf8aaa583287b828e106c9b", "score": "0.6123444", "text": "def fconversion(vresult)\n\n\t#pick up temps from api body\n\tcelsius = vresult[\"data\"][\"current_condition\"][0][\"temp_C\"]\n\tfahrenheit = vresult[\"data\"][\"current_condition\"][0][\"temp_F\"]\n\n\t#define expected conversion formula\n\tconversion2F = celsius.to_i * 1.8 + 32\n\trounded_conversion = conversion2F.round\n\n\t#validate that convervion from celsius to fahrenheit is done correctly by api\n\tif rounded_conversion = fahrenheit.to_i then\n\t\tputs \"--------\"\n\t\tputs \"Test 2 (Pass): Conversion from Celsius to Fahrenheit is working correctly!\"\n\telse\n\t\tputs \"--------\"\n\t\tputs \"Test 2 (Pass): Conversion from Celsius to Fahrenheit is not working correctly!\"\n\tend\nend", "title": "" }, { "docid": "bf61c6f2a05c1f65dc475f239303706a", "score": "0.6123326", "text": "def to_f(aNum)\r\n# - - - - - - - - - - - - - - - - - -\r\n return 0.0 + aNum\r\nend", "title": "" }, { "docid": "c9a2e50cc312545d189c233a04f0bab0", "score": "0.6123229", "text": "def convert_to_fahrenheit(temp)\n temp * 9/5 + 32\nend", "title": "" }, { "docid": "0618ac3b39fa6c467fe9f6aebc91d080", "score": "0.61136544", "text": "def convert_to_fahrenheit(cel)\n fah = 1.8 * cel + 32\n puts fah.to_s + \" degrees Fahrenheit\"\nend", "title": "" }, { "docid": "8ad6d45531162978e63ad2b36bd25223", "score": "0.6104887", "text": "def fahr_to_cel(temp)\n c_temp = (temp - 32) * 5/9\n puts \"The converted temperature is #{c_temp} Celcius\"\nend", "title": "" }, { "docid": "af16feec525971e336a7e5b1808f414b", "score": "0.6086632", "text": "def floats cols\n decode_values :float, cols, true\n end", "title": "" }, { "docid": "9e4b23d1377d1e36d51ec60f0959a272", "score": "0.6082581", "text": "def float cols\n decode_values :float, cols\n end", "title": "" }, { "docid": "0fdd1f8d226f372df02530d9ffa9a608", "score": "0.60803396", "text": "def ctof(centigrade_temp)\n\tfahrenheit_temp = ((centigrade_temp * 1.8) + 32).to_f\nend", "title": "" }, { "docid": "6c7cd080bfac621ff188119d6af8c5b3", "score": "0.60546833", "text": "def to_f\n Float(value)\n end", "title": "" }, { "docid": "20a2374e90a9496c58472ce78a9d5f3e", "score": "0.6053601", "text": "def f_to_c(fahrenheit)\n celsius = (fahrenheit - 32.0) * (5.0 / 9.0)\n puts celsius\nend", "title": "" }, { "docid": "461f178a4d0dd7e67eba612e038a3408", "score": "0.60462785", "text": "def getInF()\n if @myScale == 'F' or @myScale == 'f'\n return self\n else\n degreeF = 0.0\n if @myScale == 'C' or @myScale == 'c'\n degreeF = ((9.0/5.0) * @myDegree) + 32.0\n else\n degreeF = (@myDegree - 273.15) * (9.0/5.0) + 32.0\n end\n myTemp = Temperature.new(degreeF, 'F')\n return myTemp\n end\n end", "title": "" }, { "docid": "7c5592cb3ca58b75c24f915f16f0fd42", "score": "0.6041848", "text": "def float_dec(x)\n Numerals::Format[:free, :exact_input].write(x)\nend", "title": "" }, { "docid": "fa4dd95112038b629071cb2fd48287d2", "score": "0.60356337", "text": "def test_fahrenheit_to_celsius()\n first_temp = fahrenheit_to_celsius(1)\n second_temp = fahrenheit_to_celsius(3)\n third_temp = fahrenheit_to_celsius(5)\n assert_equal(1 - 32 * 5 / 9, first_temp)\n assert_equal(3 - 32 * 5 / 9, second_temp)\n assert_equal(5 - 32 * 5 / 9, third_temp)\n end", "title": "" }, { "docid": "804403ed97ba0f97f779000443df5c32", "score": "0.60264045", "text": "def ctof(celsius)\n celsius * 1.8 + 32\nend", "title": "" }, { "docid": "d099c389c518e63b74938003d40eca3f", "score": "0.602186", "text": "def to_fahrenheit\n (@temperature * 1.8) + 32\n end", "title": "" }, { "docid": "d099c389c518e63b74938003d40eca3f", "score": "0.602186", "text": "def to_fahrenheit\n (@temperature * 1.8) + 32\n end", "title": "" }, { "docid": "d099c389c518e63b74938003d40eca3f", "score": "0.602186", "text": "def to_fahrenheit\n (@temperature * 1.8) + 32\n end", "title": "" }, { "docid": "3c4fc93b164a76671a4dd3725f8ceb00", "score": "0.60072273", "text": "def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend", "title": "" }, { "docid": "3c4fc93b164a76671a4dd3725f8ceb00", "score": "0.60072273", "text": "def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend", "title": "" }, { "docid": "02ae94697a28f1d7afd57c600412eb81", "score": "0.6001847", "text": "def float\n Util.from_bytes :float, value\n end", "title": "" }, { "docid": "a339b0d0cfee714d9e250a9a5aa1121f", "score": "0.6001106", "text": "def number_f\n return @number_f\n end", "title": "" }, { "docid": "7c422dcc829c467a6cbbde7460a37075", "score": "0.5997713", "text": "def fahrenheit(deg, convert_to)\n if convert_to == 'Celsius'\n (deg - 32) * 5 / 9\n elsif convert_to == 'Kelvin'\n (deg + 459.67) * 5 / 9\n elsif convert_to == 'Rankine'\n deg + 459.67\n elsif convert_to == 'Fahrenheit'\n deg\n end\nend", "title": "" }, { "docid": "190a00faaf74ac118b1d2a44532c6744", "score": "0.59961206", "text": "def fahrenheit_to_celsius(fahrenheit)\n\n celsius = 0.5556* (fahrenheit - 32)\n\n return celsius.to_i\n\nend", "title": "" }, { "docid": "cb5ca63cb3e3237e7ae6e517e728a273", "score": "0.5991188", "text": "def convert_to_fahrenheit(temp)\n return ((temp * 9) /5) + 32\nend", "title": "" }, { "docid": "b2cd5558c19d43499a46942190b45236", "score": "0.59822685", "text": "def ctof(cel)\n cel * 9.0 / 5.0 + 32\nend", "title": "" }, { "docid": "a3713888e4ff9bc6361a238e3ae3182f", "score": "0.59784794", "text": "def convertf args\n if SHOW_FFI \n MemoryPointer.new(:float, 4).put_array_of_float(0,args ) \n else\n args\n end\nend", "title": "" }, { "docid": "42769b8d30abfcb762818ee7d39383b5", "score": "0.5977328", "text": "def ctof celcius\n\tcelcius.to_f*(9.0/5.0)+32\nend", "title": "" }, { "docid": "3b7c19a3f7500398821142d80231110a", "score": "0.59721065", "text": "def fahrenheit_to_celsius(farenheit)\nreturn (farenheit - 32) * 5 / 9\n #add test code here\nend", "title": "" }, { "docid": "db41f95165f20b4373f170e45da907b9", "score": "0.5956574", "text": "def ctof(celsius)\n (celsius * 9/5.to_f) + 32\nend", "title": "" }, { "docid": "0a663e0c3dd8fd742be58e893d6d21c4", "score": "0.5951146", "text": "def in_celsius\n if @type == :c\n @temp\n else\n (@temp.to_f - 32.0) * (5.0/9.0)\n end\n end", "title": "" } ]
75ca3b14e56be1923daeb96c7032eba3
Cleans Certificate and enable autosign. This is run as a before_filter for provisioning templates. The host is requesting its build configuration so I guess we just send them some text so a post mortum can see what happened
[ { "docid": "5277790422a5f6c0be66a56229fa1992", "score": "0.6877576", "text": "def handle_ca\n # The reason we do it here is to minimize the amount of time it is possible to automatically get a certificate\n\n # We don't do anything if we are in spoof mode.\n return true if @spoof\n\n # This should terminate the before_filter and the action. We return a HTTP\n # error so the installer knows something is wrong. This is tested with\n # Anaconda, but maybe Suninstall will choke on it.\n render(:text => _(\"Failed to clean any old certificates or add the autosign entry. Terminating the build!\"), :status => 500) unless @host.handle_ca\n #TODO: Email the user who initiated this build operation.\n end", "title": "" } ]
[ { "docid": "5d15a7f45a7cc3ef0b24452427bb44ce", "score": "0.6563517", "text": "def autosign\n return unless auto = autosign?\n\n store = nil\n if auto != true\n store = autosign_store(auto)\n end\n\n Puppet::SSL::CertificateRequest.search(\"*\").each do |csr|\n sign(csr.name) if auto == true or store.allowed?(csr.name, \"127.1.1.1\")\n end\n end", "title": "" }, { "docid": "26427df5b325a513c5670e9c00eeb32e", "score": "0.63543504", "text": "def setup\n generate_ca_certificate unless @host.certificate\n end", "title": "" }, { "docid": "38c65a7419b5b7efcf7665a6369d543b", "score": "0.5923436", "text": "def cleanup_certificates(options)\n puts 'Cleaning up certificates...' if options[:verbose]\n AgentConfig.certs_files(\"*.{cert,key}\").each { |f| FileUtils.rm_f(f) } # requires that root_dir already known in AgentConfig\n end", "title": "" }, { "docid": "52fe35d022553a239ff964e5996037de", "score": "0.5726098", "text": "def run\n @type = (Cert.config[:development] ? DEVELOPMENT : DISTRIBUTION)\n file = find_existing_cert\n if file\n # We don't need to do anything :)\n ENV[\"CER_FILE_PATH\"] = file\n else\n create_certificate\n end\n rescue => ex\n error_occured(ex)\n end", "title": "" }, { "docid": "c29e5908a847b0209afa09f6569d1901", "score": "0.567115", "text": "def setup_autosigning\n <<-EOS\necho \"*\" > /etc/puppet/autosign.conf\n EOS\n end", "title": "" }, { "docid": "5aabb32e9bb1454a0c04fe324b8c8625", "score": "0.5593741", "text": "def test_autocertgeneration\n ca = nil\n\n # create our ca\n assert_nothing_raised {\n ca = Puppet::Network::Handler.ca.new(:autosign => true)\n }\n\n # create a cert with a fake name\n key = nil\n csr = nil\n cert = nil\n hostname = \"test.domain.com\"\n assert_nothing_raised {\n cert = Puppet::SSLCertificates::Certificate.new(\n :name => \"test.domain.com\"\n )\n }\n\n # make the request\n assert_nothing_raised {\n cert.mkcsr\n }\n\n # and get it signed\n certtext = nil\n cacerttext = nil\n assert_nothing_raised {\n certtext, cacerttext = ca.getcert(cert.csr.to_s)\n }\n\n # they should both be strings\n assert_instance_of(String, certtext)\n assert_instance_of(String, cacerttext)\n\n # and they should both be valid certs\n assert_nothing_raised {\n OpenSSL::X509::Certificate.new(certtext)\n }\n assert_nothing_raised {\n OpenSSL::X509::Certificate.new(cacerttext)\n }\n\n # and pull it again, just to make sure we're getting the same thing\n newtext = nil\n assert_nothing_raised {\n newtext, cacerttext = ca.getcert(\n cert.csr.to_s, \"test.reductivelabs.com\", \"127.0.0.1\"\n )\n }\n\n assert_equal(certtext,newtext)\n end", "title": "" }, { "docid": "6aca7b79d57bd1894da189a98538e458", "score": "0.5551908", "text": "def use_bundled_cert!; end", "title": "" }, { "docid": "bef65539c0caa06a28f01af791c0d328", "score": "0.5522251", "text": "def distrust_certs()\n process_certs(\"Explicitly distrusting certs\", CertTools.distrusted_certs_dir)\n end", "title": "" }, { "docid": "522512b72aaeeda3182e8bf796e658d7", "score": "0.5488941", "text": "def make\n AcmeManager.logger.info \"Purging certificate for '#{name}'\"\n response = self.class.superclass.make(PATH_PREFIX + name)\n\n if SUCCESSFUL_RESULTS.include?(response[\"result\"])\n AcmeManager.logger.info \"Certificate purge for '#{name}' successful\"\n @success = true\n else\n @error_type = response[\"reason\"][\"type\"]\n @error = response[\"reason\"][\"detail\"]\n AcmeManager.logger.warn \"Purging certificate for '#{name}' failed - #{error_type}, #{error}\"\n @success = false\n end\n\n self\n end", "title": "" }, { "docid": "50b3bd6c6ec360d0a638053f4dd3a6eb", "score": "0.5475512", "text": "def set_cert_contents\n @environment = :customertest if @environment == :test\n\n set_node @template, 'pkif|SenderId', @customer_id\n set_node @template, 'pkif|CustomerId', @customer_id\n set_node @template, 'pkif|RequestId', request_id\n set_node @template, 'pkif|Timestamp', iso_time\n set_node @template, 'pkif|InterfaceVersion', 1\n set_node @template, 'pkif|Environment', @environment\n end", "title": "" }, { "docid": "4b4066aa24488d7e0da0645d3041ab34", "score": "0.54537773", "text": "def prepare_azure_cert\n cycle_credential_artifact('well-known', 'api-cert', azure_properties['cert_file'], @seed_api_cert_path)\n end", "title": "" }, { "docid": "d7f72498b0b9a3377441b25ae3e9d640", "score": "0.5407765", "text": "def initialize\n @verify_certificates = true\n end", "title": "" }, { "docid": "8439a09157c20f2cddd1e7f2f2ff6fbb", "score": "0.5397735", "text": "def build_certificate_request\n set_body_contents\n end", "title": "" }, { "docid": "8439a09157c20f2cddd1e7f2f2ff6fbb", "score": "0.5397735", "text": "def build_certificate_request\n set_body_contents\n end", "title": "" }, { "docid": "d214314f5c09ba327645f0368981ad92", "score": "0.5378351", "text": "def test_caautosign\n server = nil\n Puppet.stubs(:master?).returns true\n assert_nothing_raised {\n\n server = Puppet::Network::HTTPServer::WEBrick.new(\n \n :Port => @@port,\n \n :Handlers => {\n :CA => {}, # so that certs autogenerate\n :Status => nil\n }\n )\n }\n end", "title": "" }, { "docid": "1f428f6334b63f41a016112b6beb6663", "score": "0.53650606", "text": "def run\n _log \"Enriching... SSL Certificate: #{_get_entity_name}\"\n\n not_before = _get_entity_detail(\"not_before\")\n # not before aug 31 \n # today aug 20\n if not_before && Time.parse(not_before) > Time.now\n _log \"Creating issue for certificate that is not yet valid\"\n _create_linked_issue \"invalid_certificate_premature\"\n end\n\n not_after = _get_entity_detail(\"not_after\")\n # not after aug 31 \n # today aug 20\n if not_after && Time.parse(not_after) < Time.now\n _log \"Creating issue for expired certificate\"\n _create_linked_issue \"invalid_certificate_expired\"\n end\n\n thirty_days = 2592000\n ## not afere Aug 31\n ## not afeer - 30 days = July 31\n ## Time.now = Aug 20\n ## Time.now - 30 days = July 20\n if not_after && \n !(Time.parse(not_after) < Time.now) && # expired\n (Time.parse(not_after) - thirty_days) < Time.now # expires in 30 days\n \n _log \"Creating issue for almost expired certificate\"\n _create_linked_issue \"invalid_certificate_almost_expired\"\n end\n\n # https://www.globalsign.com/en/blog/moving-from-sha-1-to-sha-256\n algo = _get_entity_detail(\"algorithm\")\n if algo && (algo == \"SHA1\" || algo == \"MD5\")\n _log \"Creating issue for certificate with invalid algorithm\"\n _create_linked_issue \"invalid_certificate_algorithm\"\n end\n\n end", "title": "" }, { "docid": "05e2a47fa0782fa6abdc2c48e87a64f6", "score": "0.5357095", "text": "def test_storeAndSign\n ca = nil\n caserv = nil\n\n # make our CA server\n assert_nothing_raised {\n caserv = Puppet::Network::Handler.ca.new(:autosign => false)\n }\n\n # retrieve the actual ca object\n assert_nothing_raised {\n ca = caserv.ca\n }\n\n # make our test cert again\n key = nil\n csr = nil\n cert = nil\n hostname = \"test.domain.com\"\n assert_nothing_raised {\n cert = Puppet::SSLCertificates::Certificate.new(\n :name => \"anothertest.domain.com\"\n )\n }\n # and the CSR\n assert_nothing_raised {\n cert.mkcsr\n }\n\n # retrieve them\n certtext = nil\n assert_nothing_raised {\n certtext, cacerttext = caserv.getcert(\n cert.csr.to_s, \"test.reductivelabs.com\", \"127.0.0.1\"\n )\n }\n\n # verify we got nothing back, since autosign is off\n assert_equal(\"\", certtext)\n\n # now sign it manually, with the CA object\n x509 = nil\n assert_nothing_raised {\n x509, cacert = ca.sign(cert.csr)\n }\n\n # and write it out\n cert.cert = x509\n assert_nothing_raised {\n cert.write\n }\n\n assert(File.exists?(cert.certfile))\n\n # now get them again, and verify that we actually get them\n newtext = nil\n assert_nothing_raised {\n newtext, cacerttext = caserv.getcert(cert.csr.to_s)\n }\n\n assert(newtext)\n assert_nothing_raised {\n OpenSSL::X509::Certificate.new(newtext)\n }\n\n # Now verify that we can clean a given host's certs\n assert_nothing_raised {\n ca.clean(\"anothertest.domain.com\")\n }\n\n assert(!File.exists?(cert.certfile), \"Cert still exists after clean\")\n end", "title": "" }, { "docid": "538f342c2dfaefe588d0bacf7575784a", "score": "0.53399104", "text": "def test_autosign\n autosign = File.join(tmpdir, \"autosigntesting\")\n @@tmpfiles << autosign\n File.open(autosign, \"w\") { |f|\n f.puts \"hostmatch.domain.com\"\n f.puts \"*.other.com\"\n }\n\n caserv = nil\n assert_nothing_raised {\n caserv = Puppet::Network::Handler.ca.new(:autosign => autosign)\n }\n\n # make sure we know what's going on\n assert(caserv.autosign?(\"hostmatch.domain.com\"))\n assert(caserv.autosign?(\"fakehost.other.com\"))\n assert(!caserv.autosign?(\"kirby.reductivelabs.com\"))\n assert(!caserv.autosign?(\"culain.domain.com\"))\n end", "title": "" }, { "docid": "ebec2f038e6896ece5ddfedbf827b2dd", "score": "0.5272214", "text": "def do_processing()\n CertTools.createKeychain(@cert_kc_path, @cert_kc_name)\n cert_path = CertTools.intermediate_certs_dir\n \n puts \"Adding intermediate cderts to #{@cert_kc_path}\" if @verbose \n puts \"Intermediates #{cert_path}\" if @verbose \n \n Dir.foreach(cert_path) do |f|\n next if f[0].chr == \".\"\n full_path = File.join(cert_path, f)\n puts \"Processing #{f}\" if @verbose\n cmd_str = CertTools.security_tool_path\n cmd_str += \" -q add-certificates \"\n cmd_str += \" -k \"\n cmd_str += Utilities.quote_str(@cert_kc_path)\n cmd_str += \" \"\n cmd_str += Utilities.quote_str(full_path)\n `#{cmd_str}`\n Utilities.bail(\"Security add-certificates returned an error for #{full_path}\") if $? != 0\n end\n \n FileUtils.chmod 0644, @cert_kc_path\n end", "title": "" }, { "docid": "8591437481f30e5e1706f9abf25286ac", "score": "0.5255809", "text": "def use_bundled_cert!\n config.delete(:ssl_ca_directory)\n config.delete(:ssl_ca_store)\n config[:ssl_ca_bundle] = File.expand_path(File.join(\n File.dirname(__FILE__),\n '..',\n 'ca-bundle.crt'\n ))\n end", "title": "" }, { "docid": "fef9d81e04e0bca2002fdd839f03b36f", "score": "0.5255671", "text": "def generate\n\n verify_cert_hash = get_ssl_cert_hash(datastore['StagerVerifySSLCert'],\n datastore['HandlerSSLCert'])\n\n super(\n ssl: true,\n verify_cert_hash: verify_cert_hash\n )\n end", "title": "" }, { "docid": "4aa4c05ec6d3ad0dccf3d9c9121ad23e", "score": "0.52056783", "text": "def distribute_certs(config)\n config.vm.provision 'distribute_certs', type: 'shell', inline: <<-SHELL\n mkdir -p /tmp/certs\n # Authority key and cert\n openssl genrsa -out /tmp/certs/authority.pem 2048 -sha256\n openssl req -new -sha256 -subj /C=AA/ST=AA/L=Location/O=Org/CN=x_local_authority -key /tmp/certs/authority.pem | openssl x509 -req -sha256 -signkey /tmp/certs/authority.pem -out /tmp/certs/authority.crt\n\n # Manager key and cert\n openssl genrsa -out /tmp/certs/manager.pem 2048 -sha256\n openssl req -new -sha256 -key /tmp/certs/manager.pem -subj /C=/ST=/L=/O=/CN=device-aggregator.local | openssl x509 -req -sha256 -CAkey /tmp/certs/authority.pem -CA /tmp/certs/authority.crt -CAcreateserial -out /tmp/certs/manager.crt\n\n # Send certs to aggregator\n pdsh -w device-aggregator.local rm -rf /var/lib/chroma\n pdsh -w device-aggregator.local mkdir -p /var/lib/chroma\n scp /tmp/certs/* root@device-aggregator.local:/var/lib/chroma\n\n pdsh -w device-scanner[1,2].local rm -rf /etc/iml/certificate.pfx\n\n # Device-scanner client-cert pfx\n openssl genrsa -out /tmp/certs/private.pem 2048\n openssl req -new -subj /C=/ST=/L=/O=/CN=device-scanner1.local -key /tmp/certs/private.pem | openssl x509 -req -CAkey /tmp/certs/authority.pem -CA /tmp/certs/authority.crt -CAcreateserial -sha256 -out /tmp/certs/self.crt\n openssl pkcs12 -export -out /tmp/certs/certificate.pfx -inkey /tmp/certs/private.pem -in /tmp/certs/self.crt -passout pass:\n\n scp /tmp/certs/certificate.pfx root@device-scanner1.local:/etc/iml\n\n rm -rf /tmp/certs/{private.pem, self.crt, certificate.pfx}\n\n # Device-scanner client-cert pfx\n openssl genrsa -out /tmp/certs/private.pem 2048\n openssl req -new -subj /C=/ST=/L=/O=/CN=device-scanner2.local -key /tmp/certs/private.pem | openssl x509 -req -CAkey /tmp/certs/authority.pem -CA /tmp/certs/authority.crt -CAcreateserial -sha256 -out /tmp/certs/self.crt\n openssl pkcs12 -export -out /tmp/certs/certificate.pfx -inkey /tmp/certs/private.pem -in /tmp/certs/self.crt -passout pass:\n\n scp /tmp/certs/certificate.pfx root@device-scanner2.local:/etc/iml\n SHELL\nend", "title": "" }, { "docid": "0b602f93d9bfb3622986bb419a0c922d", "score": "0.51937056", "text": "def save_certificate(certificate)\n if !ENV['DYNO'].nil?\n Rails.logger.info('You are running this script on Heroku, please copy-paste certificates to your local machine')\n Rails.logger.info('and then follow https://devcenter.heroku.com/articles/ssl-endpoint guide:')\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-cert.pem ======\")\n puts certificate.to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-key.pem ======\")\n puts certificate.request.private_key.to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-chain.pem ======\")\n puts certificate.chain_to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-fullchain.pem ======\")\n puts certificate.fullchain_to_pem\n\n elsif File.directory?(File.join(Rails.root, CONFIG[:output_cert_dir]))\n Rails.logger.info('Saving certificates and key...')\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-cert.pem\"), certificate.to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-key.pem\"), certificate.request.private_key.to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-chain.pem\"), certificate.chain_to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-fullchain.pem\"), certificate.fullchain_to_pem)\n else\n Rails.logger.error(\"Output directory: '#{File.join(Rails.root, CONFIG[:output_cert_dir])}' does not exist!\")\n end\n end", "title": "" }, { "docid": "57a5f25bd9df2f4ef96fb15d13c3c4ee", "score": "0.5181164", "text": "def generate_application_certs(master, hosts, domain, skip_master = true)\n togen = []\n hosts.each do |host|\n next if (host['roles'].include?('master') and skip_master)\n\n fqdn = pfact_on(host, 'fqdn')\n if fqdn.include?('.')\n togen << fqdn\n else\n togen << host.hostname + '.' + domain\n end\n end\n\n create_remote_file(master, '/var/simp/environments/production/FakeCA/togen', togen.join(\"\\n\"))\n on(master, 'cd /var/simp/environments/production/FakeCA; ./gencerts_nopass.sh')\n end", "title": "" }, { "docid": "9da674a451c46c9502f54d52a05168f9", "score": "0.515661", "text": "def certificate_ready(params)\n # validate these parameters. If this passes, we can safely import\n params = validate_certificate_ready_parameters(params)\n # since we may turn off displaying results for production server\n # in order to skip displaying base64 certificates in logs and\n # console, here we display a notification to make sure we\n # show what transaction we're processing\n puts \"Processing certificate for transaction #{params['id']}\"\n self.certificate_base64 = params[\"certificate_base64\"]\n # Generate the Certificate job:\n Store.db.rpush(queue_pending, job_generate_negative_certificate_data)\n end", "title": "" }, { "docid": "a53b63c50184c76b8e33aad6bb6c5973", "score": "0.515312", "text": "def initialize()\n \n @saved_kc_list = nil;\n @build_dir = ENV[\"BUILT_PRODUCTS_DIR\"]\n @project_dir = ENV[\"PROJECT_DIR\"]\n @certificate_dir = File.join(@project_dir, \"..\")\n \n @distrusted_certs_dir = File.join(certificate_dir, \"distrusted\")\n @revoked_certs_dir = File.join(certificate_dir, \"revoked\")\n @root_certs_dir = File.join(certificate_dir, \"roots\")\n @intermediate_certs_dir = File.join(certificate_dir, \"certs\")\n \n Utilities.check_path(@distrusted_certs_dir)\n Utilities.check_path(@revoked_certs_dir)\n Utilities.check_path(@root_certs_dir)\n Utilities.check_path(@intermediate_certs_dir)\n\n @security_tool_path = '/usr/bin/security'\n Utilities.check_path(@security_tool_path, false)\n\n @output_keychain_path = File.join(@build_dir , \"BuiltKeychains\")\n FileUtils.mkdir_p(@output_keychain_path) if !FileTest.exists? @output_keychain_path\n \n output_variables = false\n if output_variables\n puts \"=================================================\"\n puts \"CertTools variables\"\n puts \" \"\n puts \"@build_dir = #{@build_dir}\"\n puts \"@project_dir = #{@project_dir}\"\n puts \"@certificate_dir = #{@certificate_dir}\"\n puts \"@distrusted_certs_dir = #{@distrusted_certs_dir}\"\n puts \"@revoked_certs_dir = #{@revoked_certs_dir}\"\n puts \"@root_certs_dir = #{@root_certs_dir}\"\n puts \"@intermediate_certs_dir = #{@intermediate_certs_dir}\"\n puts \"@security_tool_path = #{@security_tool_path}\"\n puts \"@output_keychain_path = #{@output_keychain_path}\"\n puts \"=================================================\"\n puts \" \" \n end \n end", "title": "" }, { "docid": "eeb20f213cbf99ae8c20ffdfee12e93d", "score": "0.51527566", "text": "def sign_certificate(host)\n return if [master, dashboard, database].include? host\n \n hostname = Regexp.escape host.node_name\n \n last_sleep = 0\n next_sleep = 1\n (0..10).each do |i|\n fail_test(\"Failed to sign cert for #{hostname}\") if i == 10\n \n on master, puppet(\"cert --sign --all\"), :acceptable_exit_codes => [0,24]\n break if on(master, puppet(\"cert --list --all\")).stdout =~ /\\+ \"?#{hostname}\"?/\n sleep next_sleep\n (last_sleep, next_sleep) = next_sleep, last_sleep+next_sleep\n end\n end", "title": "" }, { "docid": "6deb5890ab0b393e6d517b1d1dde8bec", "score": "0.5152472", "text": "def clean_agent_certificate(agent_certname)\n step \"Teardown: (Master) Clean agent #{agent_certname} cert\" do\n on(master, \"puppetserver ca clean --certname #{agent_certname}\")\n end\n end", "title": "" }, { "docid": "43727abe471772207036f1546f04c2b9", "score": "0.51263463", "text": "def allow_additional_certificate_state\n super\n end", "title": "" }, { "docid": "0e441e8d4fe1df18c3660c261153acdf", "score": "0.5101711", "text": "def cert_content; end", "title": "" }, { "docid": "556f95815c2c2ce2fd1ce2dac1de6aa1", "score": "0.5084514", "text": "def sign_certificate\n sign_certificate_for(default)\n end", "title": "" }, { "docid": "81dab4a1fcbe0a86b4b335436e2d4ea4", "score": "0.50778127", "text": "def test_autosign_true_beats_file\n caserv = nil\n assert_nothing_raised {\n caserv = Puppet::Network::Handler.ca.new\n }\n\n host = \"hostname.domain.com\"\n\n # Create an autosign file\n file = tempfile\n Puppet[:autosign] = file\n\n File.open(file, \"w\") { |f|\n f.puts host\n }\n\n # Start with \"false\"\n Puppet[:autosign] = false\n\n assert(! caserv.autosign?(host), \"Host was incorrectly autosigned\")\n\n # Then set it to true\n Puppet[:autosign] = true\n assert(caserv.autosign?(host), \"Host was not autosigned\")\n # And try a different host\n assert(caserv.autosign?(\"other.yay.com\"), \"Host was not autosigned\")\n\n # And lastly the file\n Puppet[:autosign] = file\n assert(caserv.autosign?(host), \"Host was not autosigned\")\n\n # And try a different host\n assert(! caserv.autosign?(\"other.yay.com\"), \"Host was autosigned\")\n end", "title": "" }, { "docid": "cfbcde19c93fa41e051565ba1c07a35e", "score": "0.50479025", "text": "def test_nodefaultautosign\n caserv = nil\n assert_nothing_raised {\n caserv = Puppet::Network::Handler.ca.new\n }\n\n # make sure we know what's going on\n assert(!caserv.autosign?(\"hostmatch.domain.com\"))\n assert(!caserv.autosign?(\"fakehost.other.com\"))\n assert(!caserv.autosign?(\"kirby.reductivelabs.com\"))\n assert(!caserv.autosign?(\"culain.domain.com\"))\n end", "title": "" }, { "docid": "d53da42577b2a4d07a2532dfdae7a2cb", "score": "0.5044498", "text": "def puppetrun()\n puppet_results = %x(#{$_PUPPETD} -o --no-daemonize -v --certname=#{$mac_uid} --report 2>&1)\n if /Retrieved certificate does not match private key/ =~ puppet_results || /Certificate request does not match existing certificate/ =~ puppet_results\n cert_error = true\n end\n \n ## If a certificate error was found, then call the clean_certs method\n if cert_error\n puts \"A certificate error has been found - cleaning SSL and Vardir, then cleaning cert from server.\"\n clean_certs()\n end\n \n exit(0)\nend", "title": "" }, { "docid": "654666a1884f03996efd0e6ad883f48b", "score": "0.5044389", "text": "def configure(cert)\n req = signing_request\n cert.issuer = Billy.certificate_authority.cert.subject\n cert.not_before = days_ago(2)\n cert.not_after = days_from_now(2)\n cert.public_key = req.public_key\n cert.serial = serial\n cert.subject = req.subject\n cert.version = 2\n end", "title": "" }, { "docid": "978fd7cc6803779f017104f66f8e3878", "score": "0.50426453", "text": "def set_certificate_file(opts)\n opts = check_params(opts,[:certs])\n super(opts)\n end", "title": "" }, { "docid": "d72c6fec3d78cea1d84e6b2b93e0c7c0", "score": "0.5024451", "text": "def enable_puppet_autosign(master, domain)\n result = on(master, 'puppet config print --section master autosign')\n autosign_file = result.stdout.strip\n on(master, \"echo '*.#{domain}' >> #{autosign_file}\")\n on(master, \"chmod 644 #{autosign_file}\")\n on(master, \"grep #{domain} #{autosign_file}\")\n end", "title": "" }, { "docid": "2d08b722026c622d2ed06e100c015278", "score": "0.50069135", "text": "def build_create_certificate_request\n set_cert_contents\n add_encrypted_request_to_soap(encrypt_application_request)\n end", "title": "" }, { "docid": "f26f629f5b8b5b06ef62102c6ece4f3b", "score": "0.49879968", "text": "def do_processing()\n CertTools.saveKeychainList\n CertTools.createKeychain(@evroots_kc_path, @evroots_kc_name)\n pass_one \n puts \"Removing #{@evroots_plist_path}\" if @verbose \n FileUtils.rm_f @evroots_plist_path \n pass_two\n FileUtils.chmod 0644, @evroots_plist_path \n puts \"Built #{@evroots_plist_path} successfully\" if @verbose \n end", "title": "" }, { "docid": "29e92df4f26044f03e1aee61417b881f", "score": "0.49810895", "text": "def sign_certificate_for(host = [])\n hostnames = []\n hosts = host.is_a?(Array) ? host : [host]\n puppet_version = on(master, puppet('--version')).stdout.chomp\n hosts.each do |current_host|\n if [master, dashboard, database].include? current_host\n on current_host, puppet('agent -t'), acceptable_exit_codes: [0, 1, 2]\n\n if version_is_less(puppet_version, '5.99')\n on master, puppet(\"cert --allow-dns-alt-names sign #{current_host}\"), acceptable_exit_codes: [0, 24]\n else\n on master, \"puppetserver ca sign --certname #{current_host}\"\n end\n else\n hostnames << Regexp.escape(current_host.node_name)\n end\n end\n\n if hostnames.size < 1\n if version_is_less(puppet_version, '5.99')\n on master, puppet('cert --sign --all --allow-dns-alt-names'),\n acceptable_exit_codes: [0, 24]\n else\n on master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24]\n end\n return\n end\n\n while hostnames.size > 0\n last_sleep = 0\n next_sleep = 1\n 11.times do |i|\n if i == 10\n fail_test(\"Failed to sign cert for #{hostnames}\")\n hostnames.clear\n end\n\n if version_is_less(puppet_version, '5.99')\n on master, puppet('cert --sign --all --allow-dns-alt-names'), acceptable_exit_codes: [0, 24]\n out = on(master, puppet('cert --list --all')).stdout\n if hostnames.all? { |hostname| out =~ /\\+ \"?#{hostname}\"?/ }\n hostnames.clear\n break\n end\n else\n on master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24]\n out = on(master, 'puppetserver ca list --all').stdout\n if out !~ /.*Requested.*/ && hostnames.all? { |hostname| out =~ /\\b#{hostname}\\b/ }\n hostnames.clear\n break\n end\n end\n\n sleep next_sleep\n (last_sleep, next_sleep) = next_sleep, last_sleep + next_sleep\n end\n end\n host\n end", "title": "" }, { "docid": "7f030c41dbd9fccc65214965d76ef95c", "score": "0.49794757", "text": "def upload_bundle_command( bucket_name)\n super + ' --ec2certificate $EC2_CERT'\n end", "title": "" }, { "docid": "1de56d7486ead07e7a977751323ec626", "score": "0.4966854", "text": "def build_renew_certificate_request\n set_cert_contents\n add_encrypted_request_to_soap(encrypt_application_request, parent_node: 'pkif|RenewCertificateIn')\n process_header\n add_body_to_header\n end", "title": "" }, { "docid": "f97c862adea5fadc9fc47f8596e429c4", "score": "0.495457", "text": "def clean_silverware\n\t\t@clean = true\n\tend", "title": "" }, { "docid": "7ed6a8b2875efc9209ad9012fe201b51", "score": "0.49204293", "text": "def prepare_for_signature\n prepare\n end", "title": "" }, { "docid": "2edbf5ab935d31636c055ac25ede68e7", "score": "0.49026516", "text": "def cert; end", "title": "" }, { "docid": "2edbf5ab935d31636c055ac25ede68e7", "score": "0.49026516", "text": "def cert; end", "title": "" }, { "docid": "2edbf5ab935d31636c055ac25ede68e7", "score": "0.49026516", "text": "def cert; end", "title": "" }, { "docid": "2c2c9db3b92ee3b76933f5bd0b7be122", "score": "0.4901459", "text": "def create_certificate\n visit CREATE_CERT_URL\n wait_for_elements(\"form[name='certificateSave']\")\n\n Helper.log.info \"Creating a new code signing certificate\"\n\n # select certificate type\n if @type == DEVELOPMENT\n app_store_toggle = first(\"input#type-development\")\n else\n app_store_toggle = first(\"input#type-iosNoOCSP\") || first(\"input#type-iosOCSP\")\n end\n \n if !!app_store_toggle['disabled']\n # Limit of certificates already reached\n raise \"Could not create another certificate, reached the maximum number of available certificates.\".red\n end\n\n app_store_toggle.click\n\n click_next # submit the certificate type\n sleep 2\n click_next # information about how to upload the file (no action required on this step)\n\n cert_signing_request = Cert::SigningRequest.get_path\n Helper.log.info \"Uploading the cert signing request '#{cert_signing_request}'\"\n\n wait_for_elements(\"input[name='upload']\").first.set cert_signing_request # upload the cert signing request\n sleep 1\n click_next\n\n sleep 3\n\n while all(:css, '.loadingMessage').count > 0\n Helper.log.debug \"Waiting for iTC to generate the profile\"\n sleep 2\n end\n\n Helper.log.info \"Downloading newly generated certificate\"\n sleep 2\n\n # Now download the certificate\n download_button = wait_for_elements(\".button.small.blue\").first\n url = download_button['href']\n\n path = File.join(Cert.config[:output_path], \"certificate.cer\")\n download_url(url, path)\n\n certificate_id = url.match(/.*displayId=(.*)&type.*/)[1]\n\n ENV[\"CER_FILE_PATH\"] = path\n ENV[\"CER_CERTIFICATE_ID\"] = certificate_id\n Helper.log.info \"Successfully downloaded latest .cer file to '#{path}' (#{certificate_id})\".green\n\n Cert::KeychainImporter::import_file(path) unless Cert.config[:skip_keychain_import]\n rescue => ex\n error_occured(ex)\n end", "title": "" }, { "docid": "1a588306f04137d7dc9381ec0db52b6b", "score": "0.48905882", "text": "def generate_device_certificate!(csr)\n certificate = CertificateBuilder.build(csr)\n certificate.sign(RubyScep.configuration.ca_key, OpenSSL::Digest::SHA1.new)\n @device_certificate = certificate\n end", "title": "" }, { "docid": "054e002ea1ecf2c0092e779a899dd073", "score": "0.4882524", "text": "def certificate_check_state\n super\n end", "title": "" }, { "docid": "4e8907022d37a6b094a55103ff308b40", "score": "0.4881572", "text": "def ca_cert\n \n end", "title": "" }, { "docid": "9a8c42313697be14a61a2d34a4a0a2c3", "score": "0.4880698", "text": "def create_setting_file()\n puts \"Creating empty Setting file at #{@setting_file_path}\" if @verbose\n FileUtils.rm_rf(@setting_file_path) if FileTest.exists? @setting_file_path\n cmd_str = CertTools.security_tool_path + \" add-trusted-cert -o \" + Utilities.quote_str(@setting_file_path)\n `#{cmd_str}`\n $?\n end", "title": "" }, { "docid": "42aef61b9ee3e74b34f737603f9742a2", "score": "0.4877394", "text": "def generate_signed_cert\n unless @generated_signed_cert\n domains = %w(example.org www.example.org)\n\n key = OpenSSL::PKey::RSA.new(LetsCert::TEST::KEY_LENGTH)\n cert = OpenSSL::X509::Certificate.new\n cert.version = 2\n cert.serial = 2\n cert.issuer = OpenSSL::X509::Name.parse \"/DC=letscert/CN=CA\"\n cert.public_key = key.public_key\n cert.not_before = Time.now\n # 20 days validity\n cert.not_after = cert.not_before + 20 * 24 * 60 * 60\n ef = OpenSSL::X509::ExtensionFactory.new\n ef.subject_certificate = cert\n domains.each do |domain|\n cert.add_extension(ef.create_extension('subjectAltName',\n \"DNS:#{domain}\",\n false))\n end\n cert.sign(ca_root_key, OpenSSL::Digest::SHA256.new)\n\n @generated_signed_cert = [cert, domains]\n end\n\n @generated_signed_cert\n end", "title": "" }, { "docid": "a4b086a146aec96ea590ea7568026958", "score": "0.48704204", "text": "def other_certificate_file\n super\n end", "title": "" }, { "docid": "7f303e07655315f974700aeb0aa73d2f", "score": "0.48528564", "text": "def compile\n puts '-----> Creating TrustStore with container certificates'\n\n resolved_certificates = certificates\n with_timing(caption(resolved_certificates)) do\n unless use_jvm_trust_store?\n FileUtils.mkdir_p File.join(@app_dir, NEW_TRUST_STORE_DIRECTORY)\n end\n resolved_certificates.each_with_index { |certificate, index| add_certificate certificate, index }\n end\n end", "title": "" }, { "docid": "c9df92a3b35715b4e5775016624302be", "score": "0.48518127", "text": "def reset\n if File.exists?(@identity_dir) and File.directory?(@identity_dir)\n\n @files_to_clean.each do |f|\n FileUtils.rm_f(f)\n end\n \n FileUtils.mkdir_p(@identity_dir)\n\n @csr = EZSSL_CSR.new\n end\n end", "title": "" }, { "docid": "a01e5d215c0d4442629745965205eeff", "score": "0.48476753", "text": "def clean_cert(node)\n if Puppet::SSL::CertificateAuthority.ca?\n Puppet::Face[:ca, :current].revoke(node)\n Puppet::Face[:ca, :current].destroy(node)\n Puppet.info \"#{node} certificates removed from ca\"\n else\n Puppet.info \"Not managing #{node} certs as this host is not a CA\"\n end\n end", "title": "" }, { "docid": "82c487b9b7f1ec459dbd67ac28d02c83", "score": "0.48458132", "text": "def set_ssl_client_certificate(opts)\n opts = check_params(opts,[:certificates])\n super(opts)\n end", "title": "" }, { "docid": "2a703a8a4f92b6fa29b6f2faf903d523", "score": "0.48269987", "text": "def create\n Puppet.debug('creating')\n\n # don't check priv_key here because priv_key isnt looked up via facts\n if resource[:cert]\n Puppet.debug('creating from exising cert')\n # user passed in the certificate data for us, use this\n cert = resource[:cert]\n priv_key = resource[:priv_key]\n else\n # create a new cert via Vault API\n Puppet.debug('creating from new cert from vault')\n new_cert = create_cert\n cert = new_cert['data']['certificate']\n priv_key = new_cert['data']['private_key']\n end\n\n thumbprint = nil\n serial_number = nil\n if cert\n Puppet.debug(\"computed new cert serial: #{serial_number}\")\n details = PuppetX::Encore::Vault::Util.cert_details(cert)\n thumbprint = details[:thumbprint]\n serial_number = details[:serial_number]\n end\n\n # if there is an existing cert with this cert_name(friendly name) that doesn't match our\n # thumbprint/serial, then destroy the old one, remove from trust store and create a new one\n if certificate_list && !certificate_list.empty? &&\n (certificate_list.size > 1 ||\n (certificate_list.first['thumbprint'] != thumbprint ||\n certificate_list.first['serial_number'] != serial_number))\n Puppet.debug(\"A certificate with the same cert name (FriendlyName) exists, but doesn't match our thumbprint and serial number, we're going to delete these old one(s)\")\n # NOTE: we _could_ try to keep some certs here, but this adds a ton of additional\n # complexity, like... which ones should we keep, what if the ones we're trying to\n # keep is expired, revoked, etc. Easiest thing is to just revoke and remove all\n # of the certs and make a new one.\n destroy\n\n # if we just destroyed all of the certs on the system, we need to make a new one\n # unless the cert and priv_key were given above\n unless cert && priv_key\n new_cert = create_cert\n cert = new_cert['data']['certificate']\n priv_key = new_cert['data']['private_key']\n end\n end\n\n # can only save/import the certificate into the cert store if we have\n # the cert and priv_key\n # this is important on a puppet run where we've read the existing certificate from\n # facts, but not the private key (private key isn't exposed in facts)\n # this way we can check on exist certs without overwriting them\n if cert\n if priv_key\n Puppet.debug('saving client cert to cert store')\n client_cert_save(cert, priv_key)\n else\n Puppet.info('not saving client cert because only have cert and not priv key')\n end\n else\n Puppet.debug('not saving client cert because cert and priv_key are both nil')\n end\n end", "title": "" }, { "docid": "269e63bd47e81e58c35c684996f9fe68", "score": "0.48204964", "text": "def certificate; end", "title": "" }, { "docid": "269e63bd47e81e58c35c684996f9fe68", "score": "0.48204964", "text": "def certificate; end", "title": "" }, { "docid": "9343206cff29d7ea7bfdb2ec50add219", "score": "0.4815538", "text": "def certificate_file\n super\n end", "title": "" }, { "docid": "ba38c43043d0c46d79c6299e43a539e1", "score": "0.4810827", "text": "def create_certificate\n create_app_cert(params['app_identifier'], params['cert'], params['pkey'])\n redirect_to \"/\", flash: { error_message: @error_message }\n end", "title": "" }, { "docid": "39a44ba52c8517b3dfd8f7e6b2d34cd1", "score": "0.48002508", "text": "def set_bank_certificate_contents\n set_node(@template, 'pkif|SenderId', @customer_id)\n set_node(@template, 'pkif|CustomerId', @customer_id)\n set_node(@template, 'pkif|RequestId', request_id)\n set_node(@template, 'pkif|Timestamp', iso_time)\n set_node(@template, 'pkif|InterfaceVersion', 1)\n end", "title": "" }, { "docid": "f118f5255ccef407c0432df2f0fa3346", "score": "0.47912446", "text": "def filter_sensitive\n self.number = nil unless Spree::Config[:store_cc]\n self.verification_value = nil unless Spree::Config[:store_cvv]\n end", "title": "" }, { "docid": "98390360a9be76d33cff11f0b3a902ab", "score": "0.4780763", "text": "def cert=(cert); end", "title": "" }, { "docid": "3ece58f3944e0046de3ab2b9b5c3964c", "score": "0.47799113", "text": "def process_certs(message, dir)\n puts message if @verbose\n Dir.foreach(dir) do |f|\n next if f[0].chr == \".\"\n full_path = File.join(dir, f)\n #puts \"Processing #{f}\" if @verbose\n cmd_str = CertTools.security_tool_path\n #cmd_str += \" -q add-trusted-cert -i \"\n cmd_str += \" add-trusted-cert -i \"\n cmd_str += Utilities.quote_str(@setting_file_path)\n cmd_str += \" -o \"\n cmd_str += Utilities.quote_str(@setting_file_path)\n cmd_str += \" -k \"\n cmd_str += Utilities.quote_str(@temp_kc_path)\n cmd_str += \" -r deny \"\n cmd_str += Utilities.quote_str(full_path)\n `#{cmd_str}`\n Utilities.bail(\"Security add-trusted-cert returned an error for #{full_path}\") if $? != 0\n end\n end", "title": "" }, { "docid": "c39eb40c7c225a51ff0d8afda7c4bd2c", "score": "0.47718862", "text": "def allow_missing_certs?\n false\n end", "title": "" }, { "docid": "b0572993ae5da997f0110f4a5fb2aa3f", "score": "0.47715932", "text": "def certificate_verification_state\n super\n end", "title": "" }, { "docid": "b57e70cb80a5ae68ce87e03225d643be", "score": "0.47710827", "text": "def pass_one() \n lines = get_cert_lines\n lines.each do |line|\n items = line.split('\"')\n items.shift\n items.each do |cert_file|\n next if cert_file.empty? || cert_file == \" \"\n cert_file.gsub!(/\\\"/, '')\n puts \"Adding cert from file #{cert_file}\" if @verbose\n cert_to_add = File.join(CertTools.root_certs_dir, cert_file)\n Utilities.bail(\"#{cert_to_add} does not exist\") if !FileTest.exists?(cert_to_add)\n\n quoted_cert_to_add = Utilities.quote_str(cert_to_add)\n cmd_str = CertTools.security_tool_path + \" -q add-certificates -k \" + @evroots_kc_path + \" \" + quoted_cert_to_add\n `#{cmd_str}`\n Utilities.bail(\"#{cmd_str} failed\") if $? != 0 && $? != 256\n end # items.each do |cert_file| \n end # lines.each do |line| \n end", "title": "" }, { "docid": "d0cfad4b0c5926b3adc9b2e6ca99fdd9", "score": "0.4764114", "text": "def do_processing()\n result = create_root_keychain\n Utilities.bail(\"create_root_keychain failed\") if result != 0\n Utilities.bail(\"create_setting_file failed\") if create_setting_file != 0\n add_roots()\n Utilities.bail(\"create_temp_keychain failed\") if create_temp_keychain != 0\n distrust_certs()\n revoked_certs()\n delete_temp_keychain()\n Utilities.bail(\"check_all_roots_added failes\") if !check_all_roots_added\n set_file_priv()\n end", "title": "" }, { "docid": "59558ff0d35f5fb9021d35c6a098b765", "score": "0.47529104", "text": "def set_cleaning!(property)\n property.services_cleaning = false\n property.services_cleaning_required = nil\n property.services_cleaning_rate = nil\n end", "title": "" }, { "docid": "1661d53036a2b1db649d4e8c0fecfe44", "score": "0.4750731", "text": "def create\n if params[:app][:certificate] \n p12_cert_path = 'uploads/' + params[:app][:certificate].original_filename\n File.open(p12_cert_path, \"wb\") do |f|\n f.write(params['app']['certificate'].tempfile.read)\n end\n pem_cert_path = p12_cert_path.gsub(/.p12$/,'.pem')\n passwd = params['app'][:password]\n passwd ||= ''\n # Converts certificate using password in db or ''\n system(\"openssl pkcs12 -in #{p12_cert_path} -out #{pem_cert_path} -nodes -clcerts -password pass:#{passwd}\")\n # openssl pkcs12 -in altimeter.p12 -out altimeter.pem -nodes -clcerts -password pass:\n if File.exists?(pem_cert_path)\n certificate = File.open(pem_cert_path, 'rb').read\n if certificate\n info = certificate.match(/UID=(.+)\\/CN=/)\n if info\n key = info[0].gsub!(\"UID=\", \"\").gsub!(\"/CN=\", \"\") if info\n else \n \"Failed extracting informations\"\n redirect_to new_app_path\n return\n end\n else \n \"Failed converting Certificate\"\n redirect_to new_app_path\n return\n end\n else\n \"Failed uploading Certificate\"\n redirect_to new_app_path\n return\n end\n else\n redirect_to new_app_path\n return\n end\n identifier = Digest::SHA1.hexdigest('#acapulco' + Time.now.to_s + '$-lldfghsagsdwpa.K099123##')\n \n environment = \"production\"\n if params[:app][:sandbox] == \"1\"\n environment = \"sandbox\"\n end\n \n @app = App.new(:key => key, :certificate => certificate, :identifier => identifier[0..15], :environment => environment)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ecce74115c803c4f0392ad51b003522", "score": "0.4734133", "text": "def create\n # Revoke the old cert before creating a new one\n revoke_cert if certificate && private_key && check_cert_exists\n new_cert = create_cert\n client_cert_save(new_cert)\n end", "title": "" }, { "docid": "a6d0f833481d5f5e577124371e388f75", "score": "0.47320107", "text": "def ca_file\n super\n end", "title": "" }, { "docid": "a6d0f833481d5f5e577124371e388f75", "score": "0.47320107", "text": "def ca_file\n super\n end", "title": "" }, { "docid": "2eac007bbb7760262bb43da094687561", "score": "0.47206664", "text": "def allow_missing_certs?\n true\n end", "title": "" }, { "docid": "da39969a52fda0972257205358cee40a", "score": "0.4720577", "text": "def provision!; end", "title": "" }, { "docid": "f76d8537b96d28e73a5f88189ce24b98", "score": "0.47045368", "text": "def update_certificates(nodes, options={})\n assert_files_exist! :ca_cert, :ca_key, :msg => 'Run `leap cert ca` to create them'\n assert_config! 'provider.ca.server_certificates.bit_size'\n assert_config! 'provider.ca.server_certificates.digest'\n assert_config! 'provider.ca.server_certificates.life_span'\n assert_config! 'common.x509.use'\n\n nodes.each_node do |node|\n warn_if_commercial_cert_will_soon_expire(node)\n if !node.x509.use\n remove_file!([:node_x509_key, node.name])\n remove_file!([:node_x509_cert, node.name])\n elsif options[:force] || cert_needs_updating?(node)\n generate_cert_for_node(node)\n end\n end\n end", "title": "" }, { "docid": "2ab70d91da01c3b52a839bf9f6399138", "score": "0.47029352", "text": "def post_provision_configure\n add_stack_to_resource\n link_orchestration_template\n assign_vms_owner\n apply_provisioning_tags\n end", "title": "" }, { "docid": "051102c03c16568d53cd6ecd881a6f1b", "score": "0.46997502", "text": "def trust_other_certificate_state\n super\n end", "title": "" }, { "docid": "68f2097e255d1a5e029422fea469c56f", "score": "0.46684837", "text": "def create_sandbox\n policy_base = File.join(config[:kitchen_root], '.kitchen', 'poise_policy')\n # Copy all my halite-y stuff to a folder. This should probably use a\n # temp dir instead.\n FileUtils.rm_rf(policy_base)\n convert_halite_cookbooks(policy_base) unless poise_helper_instance.options['no_gem']\n copy_test_cookbook(policy_base)\n copy_test_cookbooks(policy_base)\n # Generate a modified policy to use the cookbooks we just made.\n policy_path = generate_poise_policy(policy_base)\n # Compile that policy because the base provider doesn't do that.\n compile_poise_policy(policy_path)\n # Tell the base provider code to use our new policy instead.\n if $use_policyfile_zero\n config[:policyfile] = \"#{config[:kitchen_root]}/#{policy_path}\"\n else\n config[:policyfile_path] = policy_path\n end\n super\n end", "title": "" }, { "docid": "4efe20e738ac7a5172dfc0e1e6fbafd6", "score": "0.46642274", "text": "def cert_store; end", "title": "" }, { "docid": "4efe20e738ac7a5172dfc0e1e6fbafd6", "score": "0.46642274", "text": "def cert_store; end", "title": "" }, { "docid": "9047569e8687bb5417d2074e5241d1b6", "score": "0.4663925", "text": "def process_cert_value(cert_value)\n cert = \"-----BEGIN CERTIFICATE-----\\n\"\n cert += cert_value.to_s.gsub(/\\s+/, \"\").scan(/.{1,64}/).join(\"\\n\")\n cert += \"\\n\"\n cert += \"-----END CERTIFICATE-----\"\n end", "title": "" }, { "docid": "c77c727b99f2954a643f6414df89b47d", "score": "0.46629143", "text": "def make_certificates\n # @contest is fetched by CanCan\n\n # Define params for PDF output\n prawnto filename: \"urkunden#{random_number}\", prawn: { page_size: 'A4', skip_page_creation: true }\n @performances = apply_scopes(Performance)\n .joins(:contest_category)\n .where(\"contest_categories.contest_id = ?\", @contest.id)\n .accessible_by(current_ability)\n .order(:stage_time)\n .paginate(page: params[:page], per_page: 15)\n end", "title": "" }, { "docid": "3aad2321e5c90b51bfce76eac64242fb", "score": "0.4662342", "text": "def certificate=(certificate); end", "title": "" }, { "docid": "65cb591db790aa3e73b16593686cb8c9", "score": "0.46449667", "text": "def initialize(verbose = true)\n @verbose = verbose\n \n @root_cert_file_name = \"SystemRootCertificates.keychain\"\n @root_cert_kc_path = File.join(CertTools.output_keychain_path, @root_cert_file_name)\n\n @settings_file_name = \"SystemTrustSettings.plist\"\n @setting_file_path = File.join(CertTools.output_keychain_path, @settings_file_name)\n\n @temp_kc_name = \"SystemTempCertificates.keychain\"\n @temp_kc_path = File.join(CertTools.build_dir, @temp_kc_name)\n\n end", "title": "" }, { "docid": "443203b208984e60e175988470ca6729", "score": "0.4640878", "text": "def cert?\n false\n end", "title": "" }, { "docid": "224d27d5a74f9cd73403f8e1b6eeeed4", "score": "0.4638464", "text": "def enable_cert_auth(public_key = '~/.ssh/id_rsa.pub')\r\n cert_regex = /^ssh-[rd]sa (?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)? \\S*$/m\r\n\r\n # get our cert unless the user provided a full cert for us.\r\n unless public_key =~ cert_regex\r\n public_key = File.expand_path(public_key)\r\n if File.exist?(public_key)\r\n public_key = File.read(public_key).to_s.strip\r\n else\r\n raise Shells::PfSenseCommon::PublicKeyNotFound\r\n end\r\n raise Shells::PfSenseCommon::PublicKeyInvalid unless public_key =~ cert_regex\r\n end\r\n\r\n cfg = get_config_section 'system'\r\n user_id = nil\r\n user_name = options[:user].downcase\r\n cfg['user'].each_with_index do |user,index|\r\n if user['name'].downcase == user_name\r\n user_id = index\r\n\r\n authkeys = Base64.decode64(user['authorizedkeys'].to_s).gsub(\"\\r\\n\", \"\\n\").strip\r\n unless authkeys == '' || authkeys =~ cert_regex\r\n warn \"Existing authorized keys for user #{options[:user]} are invalid and are being reset.\"\r\n authkeys = ''\r\n end\r\n\r\n if authkeys == ''\r\n user['authorizedkeys'] = Base64.strict_encode64(public_key)\r\n else\r\n authkeys = authkeys.split(\"\\n\")\r\n unless authkeys.include?(public_key)\r\n authkeys << public_key unless authkeys.include?(public_key)\r\n user['authorizedkeys'] = Base64.strict_encode64(authkeys.join(\"\\n\"))\r\n end\r\n end\r\n\r\n break\r\n end\r\n end\r\n\r\n\r\n raise Shells::PfSenseCommon::UserNotFound unless user_id\r\n\r\n set_config_section 'system', cfg, \"Enable certificate authentication for #{options[:user]}.\"\r\n\r\n apply_user_config user_id\r\n end", "title": "" }, { "docid": "35cfa302e8fd6c83751a5783365efef8", "score": "0.46264365", "text": "def release\n unless use_jvm_trust_store?\n # Hardcoded truststore location since @app_dir changes from staging to runtime and the java opts are set on staging.\n @java_opts << \"-Djavax.net.ssl.trustStore=/home/vcap/app/#{NEW_TRUST_STORE_DIRECTORY}#{NEW_TRUST_STORE_FILE}\"\n @java_opts << \"-Djavax.net.ssl.trustStorePassword=#{password}\"\n end\n end", "title": "" }, { "docid": "997e836bd79698ea0d36ad630fa03aa5", "score": "0.46244344", "text": "def certificate_params\n params.require(:certificate).permit(:cn, :last_crt, :csr, :key, :project_id, :revoked, :environment_id, :time_renewal, :auto_renewal)\n end", "title": "" }, { "docid": "07586c4ddb5bd94364f27643e2e300ea", "score": "0.46207958", "text": "def set_ssl_ca_certificate_file(opts)\n opts = check_params(opts,[:ca_cert_files])\n super(opts)\n end", "title": "" }, { "docid": "7ad656535669dc2983717ace46194280", "score": "0.46162727", "text": "def generate(name)\n raise ArgumentError, \"A Certificate already exists for %s\" % name if Puppet::SSL::Certificate.find(name)\n host = Puppet::SSL::Host.new(name)\n\n host.generate_certificate_request\n\n sign(name)\n end", "title": "" }, { "docid": "ffd9fef957bc13d3d79ebeee421c59b5", "score": "0.46126446", "text": "def needs_renewal?\n file_name = Gitlab['nginx']['ssl_certificate']\n return false unless File.exist? file_name\n\n cert = OpenSSL::X509::Certificate.new File.read(file_name)\n\n cert.issuer.to_s =~ LETSENCRYPT_ISSUER && cert.not_after < Time.now\n end", "title": "" }, { "docid": "d981aa651ff3fb17697cb374a6486411", "score": "0.4607337", "text": "def certificate_signing_request=(value)\n @certificate_signing_request = value\n end", "title": "" }, { "docid": "ccc615abb8c341edf86aacc8e53d76b8", "score": "0.4602809", "text": "def before_clean_source\n return :success\n end", "title": "" }, { "docid": "a2b73113e23dedd2feed310190f594e6", "score": "0.459781", "text": "def clean_silverware\n\t\tputs \"#{type} is clean!\"\n\t\t@clean = true\n\tend", "title": "" }, { "docid": "51d45f60765ac7ce34321cf05a90a6ff", "score": "0.45928606", "text": "def generate\n cert = OpenSSL::X509::Certificate.new\n configure(cert)\n add_extensions(cert)\n cert.sign(Billy.certificate_authority.key, OpenSSL::Digest::SHA256.new)\n end", "title": "" }, { "docid": "d511d280a016760d2da3985419b11a05", "score": "0.45921966", "text": "def to_dev_signed\n self.class.new(:handle => @handle + \"_dev\",\n :caps => dev_cert_caps(@component.caps),\n :component => @component,\n :target => @target,\n :devkit => @devkit,\n :sign => true,\n :sign_type => :dev_cert)\n end", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "de562848e5cfcea7e6be7a43c0aab754", "score": "0.0", "text": "def subject_params\n params.require(:subject).permit(:name, :summary, :user_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6887521", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.67666084", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6733912", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.671326", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6705381", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.66612333", "text": "def filtered_parameters; end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.66164786", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.66156906", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.65888846", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6575757", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6572969", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6572365", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f5e3a87909b3e5022047b4b0a64ca154", "score": "0.65321475", "text": "def parameter_params\n params.require(:parameter).permit(:name, :code, :description, :user_id, :value, :cargapp_model_id, :active)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.65129966", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "58d1451e57b0e767db2fc6721dfaa6be", "score": "0.65128386", "text": "def allowed_parameters\n parameters.keys\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.64990044", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "52d4c66cc205503f7ad6a4feaedab9b8", "score": "0.6491305", "text": "def parameter_params\n params.require(:parameter).permit(:name, :value, :description)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6489574", "text": "def need_params\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6476191", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "e64490ed35123aafa1b4627bd165517d", "score": "0.645836", "text": "def allowed_params\n [:title, :description, :is_template, :template_id, :user_id, :color]\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.64389294", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6431918", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.642512", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.63736504", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "cac0774e508766d2f487cbca3db95df0", "score": "0.6336598", "text": "def allow_params?\n definition[:param_tokens]\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6319846", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "55aa899fab0dfa44916f71c499998ca8", "score": "0.63113743", "text": "def parameter_params\n params.require(:parameter).permit(:key, :value)\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "64ea65f903dbe0c9c0cc0e9a20ed2e7f", "score": "0.6290657", "text": "def good_option_params\n permit_params\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.62724084", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6266407", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "572f75fa86537d103ddf7b5503f06515", "score": "0.6265082", "text": "def parameter_params\n params.require(:parameter).permit(:title)\n end", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6262119", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.6258491", "text": "def filtered_params_config; end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6243215", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "63944d10aa4cde014b8332874db87cb9", "score": "0.62372005", "text": "def excluded_from_filter_parameters=(_arg0); end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6228103", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "6fc2bac4c842e4285d685333ba68e5e9", "score": "0.6226018", "text": "def admin_parameter_params\n params.require(:admin_parameter).permit(:name, :inss_hour_price, :private_hour_price, :is_eval)\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.62250364", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "6008e8707eafce375988b3c7ccf098c3", "score": "0.62147176", "text": "def original_params; end", "title": "" }, { "docid": "4ba8f5cdb0399571d60b7242794ce47f", "score": "0.62035644", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "356c5fd5dcbe9214f1330792fa2e18b5", "score": "0.61931455", "text": "def param_whitelist\n whitelist = [\n :name,\n :details,\n :completed,\n :started_at, :finished_at,\n :team_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:team_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b977c2daceb28f26ee659336b2b98aa9", "score": "0.618889", "text": "def params\n raise \"Override protected method `params'.\"\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6180647", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "706df0e25391ed2b932f54a646bb0a10", "score": "0.6180104", "text": "def list_name_param opts={}\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6175616", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "d3732ff42abd0a618a006d1f24e31e38", "score": "0.61731255", "text": "def add_to_filter_parameters; end", "title": "" }, { "docid": "8e54eaded22dd280d836e96375fed9a4", "score": "0.61730814", "text": "def paramun_params\n params.require(:parametre).permit!\n end", "title": "" }, { "docid": "f8c05c05fb596260a51d3ab4fb42243d", "score": "0.6172509", "text": "def required_parameters\n [ ]\n end", "title": "" }, { "docid": "19080b9212dc7ba3727f80cc9430e426", "score": "0.6172386", "text": "def special_params\n params.require(:special).permit(:name, :description, :function)\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6163843", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "3da9117a80cdfd040f0f0ed9d3ffed55", "score": "0.6146083", "text": "def allowable_params(unfiltered_params)\n unfiltered_params.permit(:property_id, :branch_id, :client_name, :branch_name,\n :department, :reference_number, :address_name, :address_number, :address_street,\n :address2, :address3, :address4, :address_postcode, :country, :display_address,\n :property_bedrooms, :property_bathrooms, :property_ensuites, :property_reception_rooms,\n :property_kitchens, :display_property_type, :property_type, :property_style,\n :property_age, :floor_area, :floor_area_units, :property_feature1, :property_feature2,\n :property_feature3, :property_feature4, :property_feature5, :property_feature6,\n :property_feature7, :property_feature8, :property_feature9, :property_feature10,\n :price, :for_sale_poa, :price_qualifier, :property_tenure, :sale_by,\n :development_opportunity, :investment_opportunity, :estimated_rental_income,\n :availability, :main_summary, :full_description, :date_last_modified,\n :featured_property, :region_id, :latitude, :longitude,\n flags_attributes: [:title],\n images_attributes: [:url, :modified],\n floorplans_attributes: [:url, :modified],\n epc_graphs_attributes: [:url, :modified],\n epc_front_pages_attributes: [:url, :modified],\n brochures_attributes: [:url, :modified],\n virtual_tours_attributes: [:url, :modified],\n external_links_attributes: [:url, :description, :modified])\n end", "title": "" }, { "docid": "b9e34b5ac2955add85639f9ca0a07b7f", "score": "0.6145458", "text": "def resource_params\n permits = resource_whitelist\n params.require(model_symbol).permit(permits)\n end", "title": "" }, { "docid": "d646c7ba579499db9edadb606c8b9910", "score": "0.61444825", "text": "def permitted_params\n logger.warn \"#{self}: please override `permitted_params` method.\"\n params.require(resource_request_name).permit!\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.61364955", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "c4a951d3ba89c6d098a96d3d5a2b8643", "score": "0.61280644", "text": "def collection_permitted_params\n params.permit(:format, :page, :per_page, :sort, :include, :locale, fields: {}, filter: {})\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6113519", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "34fb76d8decc10cd29ada824ff70ae63", "score": "0.6112032", "text": "def permitted_resource_params\n p params[object_name].present? ? params.require(object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6106793", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "11f5f8959aba1f4022c60509f20e40af", "score": "0.61061025", "text": "def permit_params\n params[:permit]\n end", "title": "" }, { "docid": "45791845cef485d15b7014088dd0be8d", "score": "0.6105072", "text": "def allowed_params\n %i[title body]\n end", "title": "" }, { "docid": "4632c7949842c8534d66b50254032add", "score": "0.6092409", "text": "def parameterization_params\n params.permit(:name, :user_id, :number_value, :money_value)\n end", "title": "" }, { "docid": "bfa951108b69c8eed106b7ad8acbcbfd", "score": "0.60909486", "text": "def data_param\n params.permit(:value)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.60895824", "text": "def filter_params\n end", "title": "" }, { "docid": "63f5e4e9733f9e6b3f98d5e069440292", "score": "0.6083517", "text": "def black_list_params\r\n params.require(:black_list).permit(:user)\r\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.6081807", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6079226", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "44a1ec524e77d2a2c4b85e8341df27db", "score": "0.6077248", "text": "def product_params\n params.permit(:visible)\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.60767365", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "c31ef48e8fd467d94158d7ac7f405a3f", "score": "0.60746986", "text": "def list_params\n params.permit(:id, :public_id, :name, :list, :visibility, values: [])\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.60703695", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6070048", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.6069783", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "c1f13277dbc8ff3a9f65df027f9d915a", "score": "0.6063365", "text": "def permitted_params(unpermitted_params)\n unpermitted_params.permit(\n :controller,\n :action,\n :site_id,\n :format,\n :type,\n :path_contains,\n :new_url_contains,\n :tagged,\n )\n end", "title": "" }, { "docid": "cf963fb451b51d62fcc986deb020a044", "score": "0.6047726", "text": "def permit_params\n\t\t\t\teval(@configuration.get_params)\n\t\t\tend", "title": "" }, { "docid": "77b78ffc267fcf03379cf09c63ad361c", "score": "0.60399187", "text": "def gallery_params\n params.require(:gallery).permit(:name, :white_list)\n end", "title": "" }, { "docid": "be92e82ba93b35cac91b7c02d6a445f7", "score": "0.6033119", "text": "def get_params\r\n #params.require(:view_adm).permit(:name, :action_scope,:caps,:cols)\r\n params.require(:view_adm).permit!\r\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6029004", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "5b72cb3f5ae45681ff116df46f5da01b", "score": "0.6025425", "text": "def provider_params\n params.permit(:name)\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" } ]
69b9e297e2466431c75b6eaa35abbbbe
POST /teleproviders POST /teleproviders.json
[ { "docid": "6d8c123b038bbb58b603801818b18d8c", "score": "0.72191197", "text": "def create\n @teleprovider = Teleprovider.new(teleprovider_params)\n\n if @teleprovider.save\n respond_with(@teleprovider, location: teleproviders_url, notice: 'Teleprovider was successfully created.')\n else\n respond_with(@teleprovider)\n end\n end", "title": "" } ]
[ { "docid": "ca8f5f835be04ca58255e81c6673caf6", "score": "0.63530636", "text": "def teleprovider_params\n params.require(:teleprovider).permit(:name, :apn)\n end", "title": "" }, { "docid": "073235db8bb3af893538ccccf1cd298d", "score": "0.6065372", "text": "def create\n @telecredito = Telecredito.new(telecredito_params)\n\n respond_to do |format|\n if @telecredito.save\n format.html { redirect_to @telecredito, notice: 'Telecredito was successfully created.' }\n format.json { render :show, status: :created, location: @telecredito }\n else\n format.html { render :new }\n format.json { render json: @telecredito.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1227d6f66e430297cf289d5f9956c3c2", "score": "0.60404474", "text": "def create\n @telefone = Telefone.new(telefone_params)\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, notice: 'Telefone was successfully created.' }\n format.json { render :show, status: :created, location: @telefone }\n else\n format.html { render :new }\n format.json { render json: @telefone.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f771dc234720df9e14877aefe7801b67", "score": "0.59119844", "text": "def create\n @telefone = Telefone.new(params[:telefone])\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, :notice => 'Telefone foi salvo com sucesso.' }\n format.json { render :json => @telefone, :status => :created, :location => @telefone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @telefone.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9e316bf941c97869a27f1769024cd20", "score": "0.58419937", "text": "def new\n @telefone = Telefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @telefone }\n end\n end", "title": "" }, { "docid": "0671b8c38fbbf3783cd51e9c3c9e0b03", "score": "0.57958704", "text": "def set_teleprovider\n @teleprovider = Teleprovider.find(params[:id])\n end", "title": "" }, { "docid": "932c86fb82aad44188db2614114605eb", "score": "0.57618326", "text": "def create\n @telefon = Telefon.new(params[:telefon])\n @telefon.save\n respond_with(@telefon)\n end", "title": "" }, { "docid": "776312b1b5ec5246123002b232f0aa6d", "score": "0.565889", "text": "def create\n @teleoperation = Teleoperation.new(params[:teleoperation])\n\n respond_to do |format|\n if @teleoperation.save\n format.html { redirect_to @teleoperation, notice: 'Teleoperation was successfully created.' }\n format.json { render json: @teleoperation, status: :created, location: @teleoperation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teleoperation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "665bb716a9b846cffe2b68397a2a244e", "score": "0.560934", "text": "def create\n @telefone_fornecedor = TelefoneFornecedor.new(telefone_fornecedor_params)\n\n respond_to do |format|\n if @telefone_fornecedor.save\n format.html { redirect_to @telefone_fornecedor, notice: 'Telefone fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @telefone_fornecedor }\n else\n format.html { render :new }\n format.json { render json: @telefone_fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10678f18daa7e1e5adf77bb8fe5d305c", "score": "0.5600303", "text": "def create\n @tel = Tel.new(tel_params)\n\n respond_to do |format|\n if @tel.save\n format.html { redirect_to @tel, notice: 'Tel was successfully created.' }\n format.json { render :show, status: :created, location: @tel }\n else\n format.html { render :new }\n format.json { render json: @tel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e3a8234b72617fdb0656e8504665351", "score": "0.5561677", "text": "def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07843fe451268ba93fc2164a683e12b9", "score": "0.55398965", "text": "def create\n @tipo_tel = TipoTel.new(params[:tipo_tel])\n\n respond_to do |format|\n if @tipo_tel.save\n format.html { redirect_to @tipo_tel, notice: 'Tipo tel was successfully created.' }\n format.json { render json: @tipo_tel, status: :created, location: @tipo_tel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_tel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc59f86c608f412aa38702bbf8e72b83", "score": "0.5481992", "text": "def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "01d7fa75056efb81b6493d089fc9b5c3", "score": "0.5481009", "text": "def create\n @telefononegocio = Telefononegocio.new(params[:telefononegocio])\n\n respond_to do |format|\n if @telefononegocio.save\n format.html { redirect_to @telefononegocio, notice: 'Telefononegocio was successfully created.' }\n format.json { render json: @telefononegocio, status: :created, location: @telefononegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @telefononegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34251ec5e302c57e34e6b444e0a7e9ad", "score": "0.54453945", "text": "def create\n @modele_telephone = ModeleTelephone.new(modele_telephone_params)\n\n respond_to do |format|\n if @modele_telephone.save\n format.html { redirect_to @modele_telephone, notice: 'Modele telephone was successfully created.' }\n format.json { render :show, status: :created, location: @modele_telephone }\n else\n format.html { render :new }\n format.json { render json: @modele_telephone.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "844b90f2aa12d228f7309c17fc3722c9", "score": "0.5428644", "text": "def new\n @telefononegocio = Telefononegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @telefononegocio }\n end\n end", "title": "" }, { "docid": "26c37a5adf878f8b882693ade6fa805e", "score": "0.5410944", "text": "def new\n @teleoperation = Teleoperation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teleoperation }\n end\n end", "title": "" }, { "docid": "e6f987cde702aa3fab4d0e61b2510282", "score": "0.5401388", "text": "def post_telephony_providers_edges_phones_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TelephonyProvidersEdgeApi.post_telephony_providers_edges_phones ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling TelephonyProvidersEdgeApi.post_telephony_providers_edges_phones\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/telephony/providers/edges/phones\".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(: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 => 'Phone')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TelephonyProvidersEdgeApi#post_telephony_providers_edges_phones\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4b06d19938878c49adc6e392e48906cd", "score": "0.5395114", "text": "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c5a8b62a09cd2caebc52e2da9ee273c", "score": "0.5346848", "text": "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5b9cd098bffd5118a949e688ba2e672", "score": "0.5345043", "text": "def create\n concat_phone_numbers params[:guest]\n @tablet_guest = Tablet::Guest.new(params[:guest])\n\n respond_to do |format|\n if @tablet_guest.save\n format.json { render :json => @tablet_guest, :status => :created}\n else\n format.json { render :json => @tablet_guest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3246a14f176e2f2f113a2414318586c", "score": "0.5319952", "text": "def update\n if @teleprovider.update(teleprovider_params)\n respond_with(@teleprovider, location: teleproviders_url, notice: 'Teleprovider was successfully updated.')\n else\n respond_with(@teleprovider)\n end\n end", "title": "" }, { "docid": "11af1fd3e695b98fe43a0eee63183979", "score": "0.5317439", "text": "def index\n @q = Teleprovider.search(params[:q])\n @teleproviders = @q.result(distinct: true).page(params[:page])\n\n respond_with(@teleproviders)\n end", "title": "" }, { "docid": "42f1f8c80a4ad2ebcf2e215595ada654", "score": "0.5317366", "text": "def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36698ef8120f2e34ff9323f89982b138", "score": "0.5295392", "text": "def create\n @tipo_telefone = TipoTelefone.new(params[:tipo_telefone])\n\n respond_to do |format|\n if @tipo_telefone.save\n flash[:notice] = 'TipoTelefone was successfully created.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { render :xml => @tipo_telefone, :status => :created, :location => @tipo_telefone }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03e9d88132deb15394a24ddf205e96e3", "score": "0.52883464", "text": "def create\n @telfornecedor = Telfornecedor.new(telfornecedor_params)\n\n respond_to do |format|\n if @telfornecedor.save\n format.html { redirect_to @telfornecedor, notice: 'Telfornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @telfornecedor }\n else\n format.html { render :new }\n format.json { render json: @telfornecedor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae442e95644e5baa4d00d3fa76a86dd0", "score": "0.52856195", "text": "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend", "title": "" }, { "docid": "352d671bcacf09408572e5063ddcafcc", "score": "0.52755755", "text": "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aaef75ca56fad73bc6991a41828b430d", "score": "0.52555627", "text": "def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f8bdbf362a3b0f6e316a1f8fc4de569", "score": "0.5253247", "text": "def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88fedccedc43f7cf57ebfeb6a3834f82", "score": "0.52465963", "text": "def create\n @tw_phone = TwPhone.new(tw_phone_params)\n\n respond_to do |format|\n if @tw_phone.save\n format.html { redirect_to @tw_phone, notice: 'Tw phone was successfully created.' }\n format.json { render :show, status: :created, location: @tw_phone }\n else\n format.html { render :new }\n format.json { render json: @tw_phone.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b910a9a07a32f794401e1c9a5787636", "score": "0.52409524", "text": "def tel_params\n params.require(:tel).permit(:tel)\n end", "title": "" }, { "docid": "4c424a5b0937f3b39f077cc1af63e777", "score": "0.52344215", "text": "def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2ed8558faa8e5406d9a8c26a9790bd2", "score": "0.5216179", "text": "def create\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new(params[:add_phone_to_nouveau_ticket])\n\n respond_to do |format|\n if @add_phone_to_nouveau_ticket.save\n format.html { redirect_to @add_phone_to_nouveau_ticket, notice: 'Add phone to nouveau ticket was successfully created.' }\n format.json { render json: @add_phone_to_nouveau_ticket, status: :created, location: @add_phone_to_nouveau_ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @add_phone_to_nouveau_ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7e356b1398cfbb76e1a2d9335d2b3ae", "score": "0.5215866", "text": "def new\n @telefon = Telefon.new\n respond_with(@telefon)\n end", "title": "" }, { "docid": "4e64f0c2e43995645632c061f503367e", "score": "0.5188007", "text": "def new\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_phone_to_nouveau_ticket }\n end\n end", "title": "" }, { "docid": "4aa363206a76342e4993ec3f2d87f855", "score": "0.5175794", "text": "def new\n @tipo_tel = TipoTel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_tel }\n end\n end", "title": "" }, { "docid": "22df294f62499e312374138858fb5893", "score": "0.5172094", "text": "def tw_phone_params\n params.require(:tw_phone).permit(:nickname, :code, :number)\n end", "title": "" }, { "docid": "52132ddec045db4d256911eae372f74d", "score": "0.51708555", "text": "def destroy\n @teleprovider.destroy\n\n respond_with(@teleprovider, location: teleproviders_url)\n end", "title": "" }, { "docid": "285d81fa0b55d78970fc1052f7ed7904", "score": "0.5162525", "text": "def send_request_to_patron_creator_service\n # Sierra supporting pin as password\n query = {\n 'names' => [\"#{last_name.upcase}, #{first_name.upcase}\"],\n 'emails' => [email],\n 'pin' => password,\n 'patronType' => patron_type,\n 'patronCodes' => {\n 'pcode1' => '-',\n 'pcode2' => '-',\n 'pcode3' => pcode3,\n 'pcode4' => pcode4\n },\n 'barcodes' => [self.barcode.present? ? self.barcode : self.assign_barcode.to_s],\n addresses: [\n {\n lines: [\n \"#{school.address_line_1}\",\n \"#{school.address_line_2}\"\n ],\n type: 'a'\n }\n ],\n phones: [{\n number: school.phone_number,\n type: \"t\"\n }],\n varFields: [{\n fieldTag: \"o\",\n content: school.name\n }]\n }\n response = HTTParty.post(\n ENV.fetch('PATRON_MICROSERVICE_URL_V02', nil),\n body: query.to_json,\n headers:\n { 'Authorization' => \"Bearer #{Oauth.get_oauth_token}\",\n 'Content-Type' => 'application/json' },\n timeout: 10\n )\n case response.code\n when 201\n LogWrapper.log('DEBUG', {\n 'message' => \"The account with e-mail #{email} was\n successfully created from the micro-service!\",\n 'status' => response.code\n })\n when 400\n LogWrapper.log('ERROR', {\n 'message' => \"An error has occured when sending a request to the patron creator service\",\n 'status' => response.code,\n 'responseData' => response.body\n })\n raise Exceptions::InvalidResponse, response[\"message\"][\"description\"]\n else\n LogWrapper.log('ERROR', {\n 'message' => \"An error has occured when sending a request to the patron creator service\",\n 'status' => response.code,\n 'responseData' => response.body\n })\n raise Exceptions::InvalidResponse, \"Invalid status code of: #{response.code}\"\n end\n end", "title": "" }, { "docid": "e4316a6ee61d8ae7b63fc258cdc313bf", "score": "0.51508147", "text": "def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "bdabf130aab53396ba4de8bc0b2f6cec", "score": "0.51432717", "text": "def create\n @telefone_cliente = TelefoneCliente.new(telefone_cliente_params)\n\n respond_to do |format|\n if @telefone_cliente.save\n format.html { redirect_to @telefone_cliente, notice: 'Telefone cliente was successfully created.' }\n format.json { render :show, status: :created, location: @telefone_cliente }\n else\n format.html { render :new }\n format.json { render json: @telefone_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b787c8dc5853767e760892bfc2e6ecce", "score": "0.514199", "text": "def create\n @phone_type = PhoneType.new(phone_type_params)\n\n respond_to do |format|\n if @phone_type.save\n format.html { redirect_to @phone_type, notice: 'Tipo Telefone criado com sucesso.' }\n format.json { render :show, status: :created, location: @phone_type }\n else\n format.html { render :new }\n format.json { render json: @phone_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca2cb6d5c032ee7c3f7fd3c1255797b5", "score": "0.5136478", "text": "def create\n @twet = current_user.twets.build(twet_params)\n\n respond_to do |format|\n if @twet.save\n format.html { redirect_to root_path, notice: 'Twet was successfully created.' }\n format.json { render :show, status: :created, location: @twet }\n else\n format.html { render :new }\n format.json { render json: @twet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "363cb7784554caa6ebf5862ace7fe96a", "score": "0.51262796", "text": "def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end", "title": "" }, { "docid": "f6f1bfc33779c54ac9938ac334283f06", "score": "0.5112988", "text": "def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e7adda6609937f5b80f40cb7a1fe8ed", "score": "0.507573", "text": "def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e754c2d3544dc5c133cf33f7d8a9add", "score": "0.5061532", "text": "def show\n respond_with(@teleprovider)\n end", "title": "" }, { "docid": "5dd23b729a926e62d316f6db45b63a5a", "score": "0.5036714", "text": "def create\n @teleport_incense = TeleportIncense.new(teleport_incense_params)\n\n respond_to do |format|\n if @teleport_incense.save\n format.html { redirect_to @teleport_incense, notice: 'Teleport incense was successfully created.' }\n format.json { render :show, status: :created, location: @teleport_incense }\n else\n format.html { render :new }\n format.json { render json: @teleport_incense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc879b3df9ff3de79c18682099aa41e7", "score": "0.50310886", "text": "def create\n @telefono = Telefono.new(telefono_params)\n\n respond_to do |format|\n if @telefono.save\n format.html { redirect_to @telefono, notice: 'Telefono was successfully created.' }\n format.json { render :show, status: :created, location: @telefono }\n else\n format.html { render :new }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e58d17c974664ee331647c047bdd7434", "score": "0.5020685", "text": "def create\n @account = PhoneAccount.new(params[:phone_account])\n current_user.person.phone_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cec1668c6b5bc717770694217a6e7a63", "score": "0.5020294", "text": "def telefone_params\n params.require(:telefone).permit(:numero, :contato_id)\n end", "title": "" }, { "docid": "ed6a1c096d012a33e15e4f530466c231", "score": "0.50179654", "text": "def create\n # puts \"provider_params #{provider_params}\"\n @provider = Provider.new(check_params)\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно создан.' }\n format.json { render :show, status: :created, location: @provider }\n else\n # puts \"@provider.errors #{@provider.errors.full_messages}\"\n # puts \"@provider #{@provider.to_json}\"\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b90cb227e79cd79519e1827abde3ba5d", "score": "0.49972945", "text": "def register_new(provider_data)\n location = Location.find_or_create_by(zip_code: provider_data[:zip_code])\n competencies = provider_data[:competencies].select{|k, v| v == 1}.keys\n provider = location.providers.new(provider_data)\n if provider.save\n competencies.each do |competency|\n assessment = Assessment.find_by(word: competency)\n provider.competencies.create(assessment: assessment)\n end\n end\n end", "title": "" }, { "docid": "e0b80e40ef4376c45c1488d241aaa5ac", "score": "0.49915794", "text": "def create\n @data_provider = DataProvider.new(params[:data_provider])\n\n respond_to do |format|\n if @data_provider.save\n format.html { redirect_to root_path, notice: 'Data provider was successfully created.' }\n format.json { render json: @data_provider, status: :created, location: @data_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3da1d57279561616622b362cf8663f05", "score": "0.49915388", "text": "def create\n @user_telephone = UserTelephone.new(user_telephone_params)\n\n respond_to do |format|\n if @user_telephone.save\n format.html { redirect_to @user_telephone, notice: 'User telephone was successfully created.' }\n format.json { render :show, status: :created, location: @user_telephone }\n else\n format.html { render :new }\n format.json { render json: @user_telephone.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e89b386e7c04aff21b34c1cd32c1ab1", "score": "0.49858037", "text": "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "48519b3ed34b120356945eaa848183e9", "score": "0.49851087", "text": "def post_routing_sms_phonenumbers_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.post_routing_sms_phonenumbers ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.post_routing_sms_phonenumbers\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/sms/phonenumbers\".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(: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 => 'SmsPhoneNumber')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#post_routing_sms_phonenumbers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "62e7dfa25859f253a9ebd780cb5e8391", "score": "0.49783668", "text": "def addTelefone(contato)\n\tputs(\"\\n\\nDigite o novo numero:\")\n\ttel = Telefone.new\n\ttel.numero = Validacao.validaTelefone(gets.chomp)\n\ttel.id_contato = contato.id\n\tcontato.telefones.push(tel)\n\tContatoDAO.new.addTelefone(tel)\nend", "title": "" }, { "docid": "dbb0782baf17c1224f18db36baa0de85", "score": "0.49438033", "text": "def postEntityPhone( entity_id, number, trackable)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['trackable'] = trackable\n return doCurl(\"post\",\"/entity/phone\",params)\n end", "title": "" }, { "docid": "46bc652fde42ae688aa995ad3e67a2d6", "score": "0.49407285", "text": "def create\n @twet = Twet.new(twet_params)\n\n respond_to do |format|\n if @twet.save\n format.html { redirect_to @twet, notice: \"Twet was successfully created.\" }\n format.json { render :show, status: :created, location: @twet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @twet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6cb84785a80ff70c5a1313e07466a152", "score": "0.4936159", "text": "def create\n @fornecedor = Fornecedor.new(fornecedor_params)\n @telefones = get_telefones\n @emails = get_emails\n respond_to do |format|\n if validate_telefones && validate_emails && @fornecedor.save # TODO: deal with validates errors messages\n add_telefones\n add_emails\n format.html { redirect_to @fornecedor, notice: 'Fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @fornecedor }\n else\n format.html { render :new, error: 'Erro.' }\n format.json { render json: @fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "149218cb8c8825f31cb595ecf99b4322", "score": "0.49353987", "text": "def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff0e7431cc4e94a0c35add655d2a0ac4", "score": "0.49275902", "text": "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "title": "" }, { "docid": "f5b36296b6dcd7cc63c62e0c3e7e13f5", "score": "0.4919532", "text": "def create\n @prospecto_telefono = ProspectoTelefono.new(prospecto_telefono_params)\n\n respond_to do |format|\n if @prospecto_telefono.save\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully created.' }\n format.json { render :show, status: :created, location: @prospecto_telefono }\n else\n format.html { render :new }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1cfaad94bedcaf1c33a94c4cecce526b", "score": "0.4913243", "text": "def tweet_from_api\n @tweet_api = User.find(2).tweets.create(tweet_params)\n render json: @tweet_api\n end", "title": "" }, { "docid": "fd8488cfd943a4f23fb14e9b88299b03", "score": "0.49120364", "text": "def register_lti_tool_provider(org_unit_id, create_lti_provider_data)\n path = \"/d2l/api/le/#{$le_ver}/lti/tp/#{org_unit_id}\"\n payload = {\n 'LaunchPoint' => '',\n 'Secret' => '',\n 'UseDefaultTcInfo' => '',\n 'Key' => '',\n 'Name' => '',\n 'Description' => '',\n 'ContactEmail' => '',\n 'IsVisible' => false,\n 'SendTcInfo' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendContextInfo' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendUserId' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendUserName' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendUserEmail' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendLinkTitle' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendLinkDescription' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendD2LUserName' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendD2LOrgDefinedId' => false, # Appears in LE's 1.12+ contract as of LE v10.6.0\n 'SendD2LOrgRoleId' => false # Appears in LE's 1.12+ contract as of LE v10.6.0\n }.merge!(create_lti_provider_data)\n check_create_lti_provider_data_validity(payload)\n _post(path, payload)\n # RETURNS: a LtiToolProviderData JSON block\nend", "title": "" }, { "docid": "a86220b279faaa2d40213482dc06a89c", "score": "0.49091098", "text": "def create\n @providers_payment_type = Providers::PaymentType.new(providers_payment_type_params)\n\n respond_to do |format|\n if @providers_payment_type.save\n\n format.html { redirect_to providers_payment_types_path, notice: 'Payment type was successfully created.' }\n format.json { render :show, status: :created, location: @providers_payment_type }\n else\n format.html { render :new }\n format.json { render json: @providers_payment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a30b46e73c9303ff2db560686ec32e48", "score": "0.4897953", "text": "def telfornecedor_params\n params.require(:telfornecedor).permit(:cnpj, :telefone)\n end", "title": "" }, { "docid": "487b9db06bc5999bbfd494a0271ca40c", "score": "0.48947302", "text": "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "title": "" }, { "docid": "4efdcc412e63f51f2520e54d3de8c98e", "score": "0.48840407", "text": "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "4efdcc412e63f51f2520e54d3de8c98e", "score": "0.48840407", "text": "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "9f75eb529f256672f4c92df43d74d72e", "score": "0.4880126", "text": "def index\n @telefones = Telefone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @telefones }\n end\n end", "title": "" }, { "docid": "fd3e9de153e278517c51fbfe2ed7b8f0", "score": "0.4877345", "text": "def telephone_params\n params.require(:telephone).permit(:numero_principal, :numero, :profile_id)\n end", "title": "" }, { "docid": "320dab0aafcb57d6e0c04301e6f572a6", "score": "0.48770517", "text": "def register_with_et\r\n App.et[\"accounts\"].each_pair do |account_name, account_config|\r\n next unless account_config[:rsvp_guest_list]\r\n ETSubscriberAdd.create!(\r\n :account => account_name,\r\n :target => self,\r\n :properties => {\r\n :list_id => account_config[:rsvp_guest_list],\r\n :values => {\r\n :email_address => self.email,\r\n :cobrand => cobrand.short_name\r\n }\r\n }\r\n )\r\n end\r\n end", "title": "" }, { "docid": "afccbd211637f2d48937e9945d3c9ae0", "score": "0.4874793", "text": "def create\n @supplier_provider = Supplier::Provider.new(supplier_provider_params)\n\n respond_to do |format|\n if @supplier_provider.save\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_provider }\n else\n format.html { render :new }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f140ca9c2eacede736bc20f1d92bb374", "score": "0.4873304", "text": "def create\n @partner_type = PartnerType.new(params[:partner_type])\n\n respond_to do |format|\n if @partner_type.save\n format.html { redirect_to @partner_type, notice: 'Partner type was successfully created.' }\n format.json { render json: @partner_type, status: :created, location: @partner_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c888a19621d220db90fc51941b4ae488", "score": "0.48665136", "text": "def create\n @type_partner = TypePartner.new(type_partner_params)\n\n respond_to do |format|\n if @type_partner.save\n format.html { redirect_to @type_partner, notice: 'Type partner was successfully created.' }\n format.json { render :show, status: :created, location: @type_partner }\n else\n format.html { render :new }\n format.json { render json: @type_partner.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6f5be8a058a171c2914c9c35b0420513", "score": "0.48623887", "text": "def create\n @payment_provider = PaymentProvider.new(params[:payment_provider])\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to @payment_provider, notice: 'Payment provider was successfully created.' }\n format.json { render json: @payment_provider, status: :created, location: @payment_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95c557ac7f3e86f207eaec51ad9e88f5", "score": "0.48623326", "text": "def new\n @fortune_teller = FortuneTeller.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune_teller }\n end\n end", "title": "" }, { "docid": "4470938e36915d83c2fc75fc4abfc4e3", "score": "0.48616412", "text": "def create\n @providerservice = Providerservice.new(providerservice_params)\n\n respond_to do |format|\n if @providerservice.save\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully created.' }\n format.json { render :show, status: :created, location: @providerservice }\n else\n format.html { render :new }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffa2ba11bd2f59d17af99153bfc4fb83", "score": "0.48597428", "text": "def provider_params\n params.require(:provider).permit(:user_id, :alias, :rfc, :razon_social, :direccion, :encargado, :telefono_encargado, :correo_encargado, :codigo_proveedor)\n end", "title": "" }, { "docid": "e5b5998b6c0726aa698a377cf720763a", "score": "0.48542795", "text": "def provider_params\n params.require(:provider).permit(:company_name, :fantasy_name, :cpf, :cnpj, :street, :number, :neighborhood, :cep, :ie, :bank, :ag, :cc, :variation, :state_id, :city_id, :phone1, :phone2)\n end", "title": "" }, { "docid": "469f45ed482afaf7423e20b4e5f84045", "score": "0.48524156", "text": "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "4794c3e6e2db462f4d8769453efddedd", "score": "0.48502856", "text": "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "title": "" }, { "docid": "8ec7caf4de69d497414813b1effea9ef", "score": "0.48456293", "text": "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "title": "" }, { "docid": "d7612e20f6db064f1538c4e327c4fd60", "score": "0.48440966", "text": "def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3674f22add47fdce45983dc63963130a", "score": "0.48432058", "text": "def create\n @twee = Twee.new(twee_params)\n\n respond_to do |format|\n if @twee.save\n format.html { redirect_to twees_path, notice: 'Twee was successfully created.' }\n format.json { render :show, status: :created, location: @twee }\n else\n format.html { render :new }\n format.json { render json: @twee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b7b37d0704986136108d44922dcac876", "score": "0.484312", "text": "def new\n @tipo_telefone = TipoTelefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end", "title": "" }, { "docid": "8dc9753844457326c37c875e6d5eec66", "score": "0.48384842", "text": "def add_prowl(options)\n uri = URI.parse(\"https://prowl.weks.net/publicapi/add\")\n https = Net::HTTP.new(uri.host, uri.port)\n # We have to use SSL\n https.use_ssl = true\n # Avoid to get warning\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.path)\n # Default options for notifications\n options = {:apikey => $configure[:prowl][:apikey], :application => \"Twitter\", :priority => 0}.merge(options)\n req.set_form_data(options)\n https.request(req)\nend", "title": "" }, { "docid": "9778ec8546e6779ff9518fc9766c67ab", "score": "0.48326352", "text": "def new\n @partner_type = PartnerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner_type }\n end\n end", "title": "" }, { "docid": "258962e572629bc3db7e4456001cbc28", "score": "0.48275065", "text": "def provider_params\n params.require(:provider).permit( :name, :manager, :phone, :komment, :address, \n :email, :url, :spec, :p_status_id, :city_id,\n :providers_group_id, :is_group, :group_id,\n budget_ids: [], style_ids: [], \n goodstype_ids: [], \n special_infos_attributes: [:id, :content, :_destroy])\n # goodstype_attributes: [],\n end", "title": "" }, { "docid": "f701c25590a20c5cabf63e1b74592379", "score": "0.4825664", "text": "def create\n @tweeeet = current_user.tweeeets.build(tweeeet_params)\n\n respond_to do |format|\n if @tweeeet.save\n format.html { redirect_to root_path, notice: 'Tweet creado con éxito!' }\n format.json { render :show, status: :created, location: @tweeeet }\n else\n format.html { render :new }\n format.json { render json: @tweeeet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a46d38bc375ac96a6c3f3e9401b8ad7c", "score": "0.4820164", "text": "def create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a46d38bc375ac96a6c3f3e9401b8ad7c", "score": "0.4820164", "text": "def create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f36ca117d8960111dc0b5ceaf444813", "score": "0.48172003", "text": "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "d56e70eee36257713722f101851890ba", "score": "0.48152298", "text": "def provider_params\n params.require(:provider).permit(:provider, :uid, :nickname, :token, :secret)\n end", "title": "" }, { "docid": "f88d4eda9666690f743d329de9b41f39", "score": "0.48092714", "text": "def create\n @extintor = Extintor.new(extintor_params)\n\n respond_to do |format|\n if @extintor.save\n format.html { redirect_to @extintor, notice: 'Extintor was successfully created.' }\n format.json { render :show, status: :created, location: @extintor }\n else\n format.html { render :new }\n format.json { render json: @extintor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c2e687c408e7691fc4b2a575bf0861a", "score": "0.48045486", "text": "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n\n @user.phones.destroy_all\n phone_count = phone_params[\"type_ids\"].try(:count) || 0\n\n phone_count.times do |index|\n unless phone_params[\"numbers\"][index] == \"\"\n @user.phones.create(type_id: phone_params[\"type_ids\"][index], number: phone_params[\"numbers\"][index], extension: phone_params[\"extensions\"][index])\n end\n end\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n @user = UserPresenter.new(@user, view_context)\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56dc63747ba365c51039c2be927824dc", "score": "0.4801359", "text": "def teather_params\n params.require(:teather).permit(:name, :address, :manager, :mobile, :phone, :web_site, :logo, :description, :latitude, :longitude)\n end", "title": "" } ]
4b1e12e33668f3a8e41f614275748106
PUT /tasks/1 PUT /tasks/1.json
[ { "docid": "bfb8b12a1a3379df3e6344f57d81d0a3", "score": "0.66440296", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.xml { render xml: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "8626542611c0376934f5646142b41bf4", "score": "0.75740594", "text": "def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end", "title": "" }, { "docid": "db5529000d5354efca8c48754294c35d", "score": "0.73170316", "text": "def update\n task = Task.find(params[:id])\n if task.update(task_params)\n render json: task\n else\n render_errors(task)\n end\n end", "title": "" }, { "docid": "83742016d0b0af9e6e5dc2f09d7ebbd7", "score": "0.7238722", "text": "def update\n @task = Task.find_by(id: params[:id])\n if @task.update(task_params)\n render json: { message: I18n.t('task.update.success') }, status: 200\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "94441a1c34a124388e4fd8f46876e62a", "score": "0.7167559", "text": "def update\n task = @task_list.tasks.find(params[:id])\n task.update_attributes(task_params)\n render nothing: true\n end", "title": "" }, { "docid": "791515f3a5d8167fb6a23c186a40a213", "score": "0.7156221", "text": "def update\n @task.update(task_params)\n end", "title": "" }, { "docid": "4219c75ec589fd7450c60c97df92c136", "score": "0.71259385", "text": "def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end", "title": "" }, { "docid": "4219c75ec589fd7450c60c97df92c136", "score": "0.71259385", "text": "def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end", "title": "" }, { "docid": "fabf5d0624633519ac7e476b9c0dfc47", "score": "0.69168645", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render :show, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "128eb44716b45200ba2df8b206847488", "score": "0.6911324", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to action: \"index\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd7bd0dbddaf176a065d792181b022e3", "score": "0.6882982", "text": "def update\n if @task.update(task_param)\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages\n end\n end", "title": "" }, { "docid": "de3ebf482d006888e9090b5b1f5560b0", "score": "0.68793243", "text": "def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n\n redirect_to tasks_path(@task)\n end", "title": "" }, { "docid": "93fb2fbf012bb8314e234370072f96ca", "score": "0.68686545", "text": "def update\n @user = current_user\n begin\n @task = Task.for_user(@user).find(params[:id])\n @task.change!(params[:task][:action])\n success = true\n error = nil\n rescue => e\n success = false\n error = e.message\n end\n render json: { task: (@task.constructor rescue nil), success: success, error: error }\n end", "title": "" }, { "docid": "59677a2d34f194ff305cb81af434720a", "score": "0.68450594", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32295d765b2181f623a667c97dcfc120", "score": "0.6834189", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32295d765b2181f623a667c97dcfc120", "score": "0.6834189", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32295d765b2181f623a667c97dcfc120", "score": "0.6834189", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c043b08e59933ac280f839a1b298197f", "score": "0.6832228", "text": "def update\n\t\trespond_to do |format|\n\t\t\tbegin\n\t\t\t\tif @task.update(task_params)\n\t\t\t\t\tformat.html { redirect_to @task, notice: 'Task was successfully updated.' }\n\t\t\t\t\tformat.json { render json: @task, status: :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :edit }\n\t\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\trescue ActiveRecord::RecordInvalid => error\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: { \"error\": error.message }, status: :ok }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "9b87006af9765c8143c527c1405c3ff9", "score": "0.6818636", "text": "def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end", "title": "" }, { "docid": "ec1e0c236f4991f7ac2af527e91f6644", "score": "0.68137103", "text": "def update\n if @task.update(task_params)\n render :show, status: :ok\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1947a08e3f2de03e39dee132ef569e16", "score": "0.6805498", "text": "def update\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to :action => :index, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e61f0601dcd40060b4c764475790f94", "score": "0.6803447", "text": "def edit_task\n puts 'edit task method'\n @task = Task.find_by(id: params[:id])\n @task.update(name: params[:new_name])\n\n render :json => @task.as_json(:only => [:id, :name])\n end", "title": "" }, { "docid": "47e9c977337300bece77a8b20bfd6ff5", "score": "0.68004423", "text": "def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n #@task.save\n redirect_to tasks_path(@task)\n end", "title": "" }, { "docid": "8982458b6a571dc89abe9ae63e87403e", "score": "0.68002874", "text": "def update\n if @task.update(task_params)\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d065e5421cdded056b6ebe644a507e5f", "score": "0.6787675", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4a18b81136d7309b3a8fecd281bd28f", "score": "0.6775049", "text": "def update\n respond_to do |format|\n if @api_task.update(api_task_params)\n format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_task }\n else\n format.html { render :edit }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9f8eb2469b3db96e2157e659bb0d9ea", "score": "0.6772873", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n $redis.publish('tasks.update', TaskSerializer.new(Task.last).to_json)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94bb351d891fc6c45f45533e9305763b", "score": "0.6757044", "text": "def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"tasks/#{self[\"id\"]}\", \"{\\\"task\\\": #{options.to_json}}\").body)\n end", "title": "" }, { "docid": "efa29a3e6bf6e62c0dc7bdeed59ef1f9", "score": "0.67356384", "text": "def set_api_v1_task\n @api_v1_task = Task.find(params[:id])\n end", "title": "" }, { "docid": "4a3afaca13665cc764d6b5272a415d07", "score": "0.6710496", "text": "def update\n @task = @project.tasks.find(params[:id])\n #@task = @project.tasks.update!(task_params)\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to project_url(@task), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7f002965f5276c5e284682ad37f60d1", "score": "0.6706691", "text": "def update \n\t logger.debug \"Params --------------------------------------- #{params}\"\n\n\t logger.debug \"task params --------------------------------------#{task_params}\"\n\t format_task_attributes(task_params)\n\t \n\t logger.debug \"-------------------------------------------------------------\"\n\t logger.debug \"Updated Params #{@updated_params}\"\n\t @updated_params[:id]=params[:id]\n\t @task = Task.find(@updated_params[:id])\n\t logger.debug \"#########################\"\n\t logger.debug \"Task found \"\n\t \n\t @task.assign_attributes(@updated_params)\n\t authorize! :update, @task\n\t @task.is_completed=false\n\t save_task\n\tend", "title": "" }, { "docid": "13fbb50e41ee9290dba893d7c3123122", "score": "0.6706487", "text": "def update\n @task = Task.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c0b450ecf945d2c2fc10b47e8246b3f", "score": "0.66886663", "text": "def update\n @task.update(task_params)\n redirect_to tasks_path\n end", "title": "" }, { "docid": "74a173f2c44c4ff4efb967a45f32ecbb", "score": "0.66781616", "text": "def update\n Task.associate_task(params:params, task: @task)\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c64be851be313f4deb2c82614373814", "score": "0.66701066", "text": "def update_task(id, title, description)\n task = Task.find(id)\n task.title = title\n task.description = description\n task.save\nend", "title": "" }, { "docid": "cfda236dde42a82b8ef800c3f6e84c23", "score": "0.6665687", "text": "def update\n @task.update(task_params)\n redirect_to task_path(@task)\n end", "title": "" }, { "docid": "096fbc3b8bf0c51f9f7b9932c21c0bb3", "score": "0.66579497", "text": "def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51f0fda0fc0e909f04b5cb12c790da7e", "score": "0.6649234", "text": "def update\n if @task.update(task_params)\n flash.now.alert = \"Task was updated\"\n render json: full_task(@task)\n end\n end", "title": "" }, { "docid": "3dddb6c34f2cbaf0df3761c0caf92cf5", "score": "0.66432977", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task.project, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab546b2385da385bcc88d36eaee0e848", "score": "0.6633771", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab546b2385da385bcc88d36eaee0e848", "score": "0.6633771", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8365ceac0aa674b47069d813c2550b4e", "score": "0.6630012", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @task.update(task_params)\n\t\t\t\tformat.html { redirect_to [:admin, @task], notice: 'Task was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: [:admin, @task] }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: [:admin, @task].errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "6bb89149f92b81da02cc2f65c67ec1db", "score": "0.66171503", "text": "def set_task\n @task = Todotasklist.find_by_id(params[:id])\n if @task\n else\n \trender json: { valid: false}, status: 404\n end\n end", "title": "" }, { "docid": "c65cbc15b511d5bfc765e7fdb20f4990", "score": "0.66055053", "text": "def update\n command = Tasks::Update.call(@task, params: task_params)\n respond_to do |format|\n if command.success?\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd9fdb0abc3fb7641dd89fbd461da0db", "score": "0.6604035", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1910af0ddbaf2919b4fc03d614feb566", "score": "0.65993243", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1910af0ddbaf2919b4fc03d614feb566", "score": "0.65993243", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1910af0ddbaf2919b4fc03d614feb566", "score": "0.65993243", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1910af0ddbaf2919b4fc03d614feb566", "score": "0.65993243", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1910af0ddbaf2919b4fc03d614feb566", "score": "0.65993243", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c27f423656eddd9775f66aa09cb0a7d", "score": "0.6592559", "text": "def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: t('task.successfully-updated') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f57e12b98df71d8e2779740dfb5dc7c", "score": "0.6590453", "text": "def update\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n end\n respond_with(@task)\n end", "title": "" }, { "docid": "d185011981b2a3d59180dcaf04083471", "score": "0.65851146", "text": "def update\n @task = Task.find_by(id: params[:id])\n if @task.nil?\n redirect_to tasks_path\n elsif @task.update(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n redirect_to task_path(@task.id)\n else\n render :edit\n end\n end", "title": "" }, { "docid": "a8c95102e01b6179d43d7c61e6f5aa1e", "score": "0.6584502", "text": "def update\n respond_to do |format|\n if @task.update task_params\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50d2c766441b20cfa9f6a54376bf2b8b", "score": "0.6583115", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "851c29e28e134127f9cba25283d2dae0", "score": "0.6578742", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_url, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "851c29e28e134127f9cba25283d2dae0", "score": "0.6578742", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_url, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d6c5ebc1354dbf90e39d3a4bf716f56d", "score": "0.65785795", "text": "def update\n @task = Task.find(params[:id])\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Tarefa was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n \tformat.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\nend", "title": "" }, { "docid": "2735fd48813d451071d2696ebe67cb85", "score": "0.6572795", "text": "def update\n flash[:notice] = \"Task was successfully updated.\" if task.save\n respond_with(task)\n end", "title": "" }, { "docid": "02a3f116f58bacd0924d455b23eac49d", "score": "0.65429795", "text": "def set_task\n @task = Task.find_by(id: params[:id])\n unless @task\n render json: { error: I18n.t('task.callbacks.set_task') }, status: 400\n end \n end", "title": "" }, { "docid": "803adc5e815fbf5d7df56faed5b838f1", "score": "0.6538083", "text": "def update\n \t@task = @project.tasks.find(params[:id])\n if @task.update_attributes(params[:task])\n redirect_to(project_tasks_path(@project))\n flash[:notice] = 'Task was successfully updated.'\n else\n render('edit')\n end\n end", "title": "" }, { "docid": "4ac156e443b1ae0cf4e74474ef815ff6", "score": "0.6536524", "text": "def update\n self.init\n authorize! :read, @list\n authorize! :update, @task\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @list, notice: I18n.t('tasks.update_success') }\n format.json { render json: [] }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fe2bb094e660d42df9a33ab4f0ec5d8", "score": "0.65364987", "text": "def update\n @todo_task = TodoTask.find(params[:id])\n\n respond_to do |format|\n if @todo_task.update_attributes(params[:todo_task])\n format.html { redirect_to @todo_task, notice: 'Todo task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acf8891bbe92761d3afc416092075a3b", "score": "0.65331113", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Úkol byl úspěšně upraven.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "290261ea740e47dfb75ce9718be295bb", "score": "0.65265673", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params.require(:task).permit(:complete))\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "995e7565f9c0b8caf7e3372c9684bf93", "score": "0.65224713", "text": "def update\n #binding.pry\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50294e8dedaa93e70668c53c61c5a7ab", "score": "0.6521232", "text": "def update\n @task = Task.find(params[:id])\n\n @task.title = params[:title] || @task.title\n @task.picture = params.has_key?(:picture) ? params[:picture] : @task.picture\n @task.description = params[:description] || @task.description\n @task.color = params[:color] || @task.color\n @task.date = params.has_key?(:date) ? params[:date] : @task.date\n @task.order = params[:order] || @task.order\n\n if @task.save\n head :no_content\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c4b2037047ab2a37ff4c277d1730eb0b", "score": "0.6520759", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, success: t('.notice') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e2e824aebf8bba3c403e4f3e8064be7", "score": "0.6518857", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e2e824aebf8bba3c403e4f3e8064be7", "score": "0.6518857", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e2e824aebf8bba3c403e4f3e8064be7", "score": "0.6518857", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e2e824aebf8bba3c403e4f3e8064be7", "score": "0.6518857", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e2e824aebf8bba3c403e4f3e8064be7", "score": "0.6518857", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e2e824aebf8bba3c403e4f3e8064be7", "score": "0.6518857", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
90f76dc55dfa96f9d1fec17ccea50b54
Support methods for deep transforming nested hashes and arrays. source://activesupport//lib/active_support/core_ext/hash/keys.rb116
[ { "docid": "cd66bc5ce6d83c9fc9323a65f3053e5a", "score": "0.70298105", "text": "def _deep_transform_keys_in_object(object, &block); end", "title": "" } ]
[ { "docid": "95d01147445adbc7f5dda74f811ef9c4", "score": "0.7984353", "text": "def deep_transform_keys!(&block); end", "title": "" }, { "docid": "95d01147445adbc7f5dda74f811ef9c4", "score": "0.7984353", "text": "def deep_transform_keys!(&block); end", "title": "" }, { "docid": "95d01147445adbc7f5dda74f811ef9c4", "score": "0.7984353", "text": "def deep_transform_keys!(&block); end", "title": "" }, { "docid": "968b15ca920ed10267db497ac095e8e8", "score": "0.79588765", "text": "def deep_transform_keys(&block); end", "title": "" }, { "docid": "c655079e0d9471ee84af62988ee37baa", "score": "0.75912786", "text": "def deep_symbolize_keys!; end", "title": "" }, { "docid": "c655079e0d9471ee84af62988ee37baa", "score": "0.75912786", "text": "def deep_symbolize_keys!; end", "title": "" }, { "docid": "8ccfe680c3a4df668b41e17e0a279156", "score": "0.75717753", "text": "def deep_transform_keys(&block)\n deep_transform_keys_in_object(self, &block)\n end", "title": "" }, { "docid": "8ccfe680c3a4df668b41e17e0a279156", "score": "0.75717753", "text": "def deep_transform_keys(&block)\n deep_transform_keys_in_object(self, &block)\n end", "title": "" }, { "docid": "8ccfe680c3a4df668b41e17e0a279156", "score": "0.75717753", "text": "def deep_transform_keys(&block)\n deep_transform_keys_in_object(self, &block)\n end", "title": "" }, { "docid": "8ccfe680c3a4df668b41e17e0a279156", "score": "0.75717753", "text": "def deep_transform_keys(&block)\n deep_transform_keys_in_object(self, &block)\n end", "title": "" }, { "docid": "bd97c38e158bfe54c96aee2e5bae1357", "score": "0.75045466", "text": "def deep_transform_keys!(&block)\n deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "bd97c38e158bfe54c96aee2e5bae1357", "score": "0.75045466", "text": "def deep_transform_keys!(&block)\n deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "bd97c38e158bfe54c96aee2e5bae1357", "score": "0.75045466", "text": "def deep_transform_keys!(&block)\n deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "bd97c38e158bfe54c96aee2e5bae1357", "score": "0.75045466", "text": "def deep_transform_keys!(&block)\n deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "071435e6c8e5f10edfae7a873177d2e1", "score": "0.7487884", "text": "def recursively_symbolize_keys!\n self.symbolize_keys!\n self.values.each do |v|\n if v.is_a? Hash\n v.recursively_symbolize_keys!\n elsif v.is_a? Array\n #v.recursively_symbolize_keys!\n end\n end\n self\n end", "title": "" }, { "docid": "8ffde88c2accada5ede06a1b6a0b9105", "score": "0.74760103", "text": "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "8ffde88c2accada5ede06a1b6a0b9105", "score": "0.74760103", "text": "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "8ffde88c2accada5ede06a1b6a0b9105", "score": "0.74760103", "text": "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "8ffde88c2accada5ede06a1b6a0b9105", "score": "0.74758875", "text": "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "7663b548e62029b87d83dc5c775162ec", "score": "0.74265206", "text": "def deep_convert_keys(&block)\n block_given? ? self.map do |i|\n i.respond_to?('deep_convert_keys') ? i.deep_convert_keys(&block) : i\n end : self\n end", "title": "" }, { "docid": "acec8b3b313f1e07680ffcee6133fe72", "score": "0.72927415", "text": "def deep_stringify_keys\n manipulate = lambda do |item|\n retrieve_new_object(item, ->(it) { it.deep_stringify_keys }, ->(it) { it })\n end\n\n each_with_object({}) do |(key, value), result|\n result[key.to_s] =\n if value.instance_of?(Array)\n value.each_with_object([]) { |item, new_item| new_item << manipulate.call(item) }\n else\n manipulate.call(value)\n end\n end\n end", "title": "" }, { "docid": "840117d9fbc5165d6577b3f813f6db8a", "score": "0.7287034", "text": "def deep_stringify_keys!; end", "title": "" }, { "docid": "840117d9fbc5165d6577b3f813f6db8a", "score": "0.7287034", "text": "def deep_stringify_keys!; end", "title": "" }, { "docid": "9fa5c473dbb9c2cc27b6fa233acd8a52", "score": "0.72547626", "text": "def flatten_keys!(hash)\n hash.keys.each do |k|\n if hash[k].is_a? Array\n # Go inside arrays (doesn't handle arrays of arrays)\n hash[k].map! do |e|\n if e.is_a? Hash\n flatten_keys! e\n e\n else\n e.to_s\n end\n end\n elsif hash[k].is_a? Hash\n # Go inside hashes\n flatten_keys!(hash[k])\n elsif hash[k].is_a? Time\n # Ensure all Time classes become DateTimes for comparison\n hash[k] = hash[k].to_datetime.to_s\n else\n # Ensure all fields become Strings\n hash[k] = hash[k].to_s\n end\n end\n end", "title": "" }, { "docid": "869941667af9d85e1ca9693286aa0984", "score": "0.713861", "text": "def deep_symbolize_keys!\n deep_transform_keys!(&:to_sym)\n end", "title": "" }, { "docid": "aee01f1d7701d73abc18cb62a4ea45d0", "score": "0.7112996", "text": "def deep_transform_keys(hash, &block)\n result = {}\n\n hash.each do |key, value|\n result[yield(key)] = value.is_a?(Hash) ? deep_transform_keys(value, &block) : value\n end\n\n result\nend", "title": "" }, { "docid": "481c57403ab7709345be186323aaf9b2", "score": "0.71107805", "text": "def deep_symbolize_keys!\n replace(deep_symbolize_keys)\n end", "title": "" }, { "docid": "3ba05159d9c9f2f8164b9f303c4eaf7e", "score": "0.7105217", "text": "def normalize_keys(node)\n case node\n when Hash\n node.inject({}) {|normalized, (key, val)| normalized.merge({normalize_key(key) => normalize_keys(val)})}\n \n when Array\n node.map(&method(:normalize_keys))\n \n else\n node\n end\nend", "title": "" }, { "docid": "581cbc11bc775a0853459d8a5bc1d207", "score": "0.709311", "text": "def utilise_deep_transform_keys(object, &block)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = utilise_deep_transform_keys(value, &block)\n end\n when Array\n object.map { |e| utilise_deep_transform_keys(e, &block) }\n else\n object\n end\n end", "title": "" }, { "docid": "ed35174dbcdac1fdcc88473668bbe08f", "score": "0.70885164", "text": "def recursive_symbolize_keys!\n\t\tsymbolize_keys!\n\t\t# symbolize each hash in .values\n\t\tvalues.each{|h| h.recursive_symbolize_keys! if h.is_a?(Hash) }\n\t\t# symbolize each hash inside an array in .values\n\t\tvalues.select{|v| v.is_a?(Array) }.flatten.each{|h| h.recursive_symbolize_keys! if h.is_a?(Hash) }\n\t\tself\n\tend", "title": "" }, { "docid": "217895fd2ebf21a2c84a553efd551cb6", "score": "0.7026209", "text": "def deep_transform_keys(hash, &block)\n new_hash = {}\n hash.each do |key, value|\n new_hash[yield key] = if value.is_a?(Hash)\n deep_transform_keys(value, &block)\n else\n value\n end\n end\n new_hash\n end", "title": "" }, { "docid": "05e907dcc3a3a5887923ff3adebcb37f", "score": "0.70059484", "text": "def mp_deep_transform_keys!(&block)\n __mp_deep_transform_keys_in_object!(self, &block)\n end", "title": "" }, { "docid": "f2ecabe652b94bedb473ac911595fd17", "score": "0.699975", "text": "def recursive_symbolize_keys!\n symbolize_keys!\n # symbolize each hash in .values\n values.each{|h| h.recursive_symbolize_keys! if h.is_a?(Hash) }\n # symbolize each hash inside an array in .values\n values.select{|v| v.is_a?(Array) }.flatten.each{|h| h.recursive_symbolize_keys! if h.is_a?(Hash) }\n self\n end", "title": "" }, { "docid": "8cae3b22a7f288c465b2f60803ac284f", "score": "0.698798", "text": "def _deep_transform_keys_in_object(object, &block)\n case object\n when ::Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = _deep_transform_keys_in_object(value, &block)\n end\n when Array\n object.map { |e| _deep_transform_keys_in_object(e, &block) }\n else\n object\n end\n end", "title": "" }, { "docid": "81ce896864428f1cd0a87c576e63156b", "score": "0.6976695", "text": "def _deep_transform_keys_in_object(object, &block)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = _deep_transform_keys_in_object(value, &block)\n end\n when Array\n object.map { |e| _deep_transform_keys_in_object(e, &block) }\n else\n object\n end\n end", "title": "" }, { "docid": "14aa8c17a2214ae9485b4a708666101c", "score": "0.697596", "text": "def deep_stringify_keys!\n deep_transform_keys!{ |key| key.to_s rescue key }\n end", "title": "" }, { "docid": "b3f33fe190bf346f2bca2cbb5d5480ea", "score": "0.69670314", "text": "def deep_stringify_keys(hash)\n hash.inject({}) do |mem, (k,v)|\n if v.kind_of?(Hash)\n mem[k.to_s] = deep_stringify_keys(v)\n else\n mem[k.to_s] = v\n end\n mem\n end\n end", "title": "" }, { "docid": "60eeb830bb6c59ea28e3a4dfb5b2dc7e", "score": "0.69600785", "text": "def deep_stringify_keys!\n replace(deep_stringify_keys)\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6942802", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6942802", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6942802", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6942802", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6942802", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "dd6dcd1bc8df8d17c00b47f762fd6708", "score": "0.6934232", "text": "def recursive_symbolize_keys!\n symbolize_keys!\n values.each { |h| h.recursive_symbolize_keys! if h.is_a?(Hash) }\n values.select { |v| v.is_a?(Array) }.flatten.each { |h| h.recursive_symbolize_keys! if h.is_a?(Hash) }\n self\n end", "title": "" }, { "docid": "1b9f3961ac6e12ff46a231dee578e882", "score": "0.6927189", "text": "def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end", "title": "" }, { "docid": "1b9f3961ac6e12ff46a231dee578e882", "score": "0.6927189", "text": "def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end", "title": "" }, { "docid": "1b9f3961ac6e12ff46a231dee578e882", "score": "0.6927189", "text": "def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end", "title": "" }, { "docid": "1b9f3961ac6e12ff46a231dee578e882", "score": "0.6927189", "text": "def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end", "title": "" }, { "docid": "1b9f3961ac6e12ff46a231dee578e882", "score": "0.6927189", "text": "def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end", "title": "" }, { "docid": "884610177e4a8ce59a60e25ace72b87e", "score": "0.6907096", "text": "def _deep_transform_keys_in_object(object, &block)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = _deep_transform_keys_in_object(value, &block)\n end\n when Array\n object.map { |e| _deep_transform_keys_in_object(e, &block) }\n else\n object\n end\n end", "title": "" }, { "docid": "f85d6a20608ceb0285938166949d18f9", "score": "0.6901714", "text": "def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "f85d6a20608ceb0285938166949d18f9", "score": "0.6901714", "text": "def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "f85d6a20608ceb0285938166949d18f9", "score": "0.6901714", "text": "def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "bf1c6a1e91f442080327a3a086028ef7", "score": "0.6886667", "text": "def deep_stringify_keys!(hash)\n hash.keys.each do |key|\n val = hash.delete(key)\n hash[key.to_s] = val.is_a?(Hash) ? deep_stringify_keys!(val) : val\n end\n hash\n end", "title": "" }, { "docid": "7ed620d08934738d9a251f8e2c0e4075", "score": "0.6878501", "text": "def deep_stringify_keys\n transform_hash(:deep => true) do |hash, key, value|\n hash[key.to_s] = value\n end\n end", "title": "" }, { "docid": "23287603a08d78c5a8fce54fbba8f86d", "score": "0.68726194", "text": "def symbolize_keys_deep!(h)\n if Hash == h\n Hash[\n h.map do |k, v|\n [k.respond_to?(:to_sym) ? k.to_sym : k, symbolize_keys_deep!(v)]\n end\n ]\n else\n h\n end\n end", "title": "" }, { "docid": "43aa6e045027ef4d46311102495c4402", "score": "0.68700755", "text": "def deep_transform_keys!(&block)\n keys.each do |key|\n value = delete(key)\n self[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys!(&block) : value\n end\n self\n end", "title": "" }, { "docid": "c79442c332d385353a4c6dedb02cda78", "score": "0.68670446", "text": "def deep_keys\n ret = []\n injector = proc { |k, v|\n ret << k\n if v.is_a?(Hash)\n v.each(&injector)\n end\n }\n self.each(&injector)\n ret\n end", "title": "" }, { "docid": "8622e09c1fbdba1e564e6e649f32ecd2", "score": "0.6866303", "text": "def deep_symbolize_keys(input)\n case input\n when Hash\n input.transform_keys(&:to_sym).transform_values do |value|\n deep_symbolize_keys(value)\n end\n when Array\n input.map do |value|\n deep_symbolize_keys value\n end\n else\n input\n end\n end", "title": "" }, { "docid": "fa6a2994ef2dc59beed2dd415052fdbe", "score": "0.6865901", "text": "def withdotkeys(deep_hash = self, flat_hash = {}, root = '')\n deep_hash.each do |key, value|\n if deep_hash[key].is_a?(Hash)\n flat_hash.merge! withdotkeys(value, flat_hash, key + '.')\n else\n key = \"#{root}#{key}\" if not root.empty?\n flat_hash[key] = value\n end\n end\n flat_hash\n end", "title": "" }, { "docid": "b717b180c51f96dba9a67509b495aad3", "score": "0.68453324", "text": "def _deep_transform_keys_in_object(object, &block)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = _deep_transform_keys_in_object(value, &block)\n end\n when Array\n object.map {|e| _deep_transform_keys_in_object(e, &block) }\n else\n object\n end\n end", "title": "" }, { "docid": "b717b180c51f96dba9a67509b495aad3", "score": "0.68453324", "text": "def _deep_transform_keys_in_object(object, &block)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = _deep_transform_keys_in_object(value, &block)\n end\n when Array\n object.map {|e| _deep_transform_keys_in_object(e, &block) }\n else\n object\n end\n end", "title": "" }, { "docid": "b717b180c51f96dba9a67509b495aad3", "score": "0.68453324", "text": "def _deep_transform_keys_in_object(object, &block)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = _deep_transform_keys_in_object(value, &block)\n end\n when Array\n object.map {|e| _deep_transform_keys_in_object(e, &block) }\n else\n object\n end\n end", "title": "" }, { "docid": "0b0181a8a814913faeb6670d3691e4f5", "score": "0.68310004", "text": "def deep_stringify_keys!(hsh)\n return unless hsh.respond_to?(:stringify_keys!)\n hsh.stringify_keys!\n hsh.values.each{|x| deep_stringify_keys!(x)}\n hsh\n end", "title": "" }, { "docid": "400dbb852819ea4ff6aa7afdee5fecf2", "score": "0.68103194", "text": "def deep_symbolize_keys!\n deep_transform_keys! do |key|\n begin\n key.to_sym\n rescue\n key\n end\n end\n end", "title": "" }, { "docid": "885157672beb53c167d255897b18038d", "score": "0.6803834", "text": "def deep_key(hash, keys = [])\n return hash if keys.size == 0\n \n value = hash\n keys.each do |k|\n value = value[k]\n break unless value.respond_to?(:[])\n end\n value\n end", "title": "" }, { "docid": "4f45db518b678db7f59e13cd7a74d338", "score": "0.6802153", "text": "def deep_symbolize_keys\n deep_transform_keys{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "c4bba71fd6f202752343667df03d5427", "score": "0.6793486", "text": "def deep_symbolize_keys!(h)\n\tkeys = h.keys\n\th.each do |k, v|\n\t\th[k.to_sym] = h.delete(k) if k.is_a? String\n\t\tdeep_symbolize_keys!(v) if v.is_a?(Hash)\n\tend\nend", "title": "" }, { "docid": "b85237bcd9bc997da1b75b6b2c1f5103", "score": "0.6783617", "text": "def deep_symbolize_keys!\n self.replace(self.deep_symbolize_keys)\n end", "title": "" }, { "docid": "e0c2203ee423a50eb4b2230467297a15", "score": "0.6782644", "text": "def deep_stringify_keys!\n deep_transform_keys!{ |key| key.to_s }\n end", "title": "" }, { "docid": "9952421aabe0bed2512a52d457952118", "score": "0.67817265", "text": "def transform_keys(hash_or_array, key_transform)\n if hash_or_array.is_a? Array\n hash_or_array.map { |obj| transform_keys(obj, key_transform) }\n elsif hash_or_array.is_a? Hash\n new_hash = {}.with_indifferent_access\n hash_or_array.each do |key, val|\n new_hash[key_transform.call(key)] = transform_keys(val, key_transform) \n end\n new_hash\n # Note: this case has been disabled because we now convert objects to hashes before passing them into underscore/camelize_keys.\n # elsif hash_or_array.respond_to? :attributes # if this is an object rather than a hash / array, get the hash from its attributes\n # transform_keys(hash_or_array.attributes, key_transform)\n else\n hash_or_array\n end\n end", "title": "" }, { "docid": "af4e83a3ec49b50158b8d982e78fbb6c", "score": "0.6775413", "text": "def deep_stringify_keys(hash)\n hash.inject({}) { |result, (key, value)|\n value = deep_stringify_keys(value) if value.is_a? Hash\n result[(key.to_s rescue key) || key] = value\n result\n }\n end", "title": "" }, { "docid": "33c860a64eceb44fd07ba43bd5123289", "score": "0.6775329", "text": "def recursive_stringify_keys(h)\n if h.class == [].class\n h.map {|key| recursive_stringify_keys(key)}\n elsif h.class == {}.class\n Hash[h.map {|k,v| [k.to_s, recursive_stringify_keys(v)]}]\n else\n h\n end\nend", "title": "" }, { "docid": "9128169ed68d8f591195b072f0ed45be", "score": "0.67504966", "text": "def deep_stringify_keys!\n deep_transform_keys! { |key| key.to_s }\n end", "title": "" }, { "docid": "9128169ed68d8f591195b072f0ed45be", "score": "0.67504966", "text": "def deep_stringify_keys!\n deep_transform_keys! { |key| key.to_s }\n end", "title": "" }, { "docid": "9128169ed68d8f591195b072f0ed45be", "score": "0.67504966", "text": "def deep_stringify_keys!\n deep_transform_keys! { |key| key.to_s }\n end", "title": "" }, { "docid": "642d65479db8c6f1f1321095aa80a165", "score": "0.67301476", "text": "def deep_symbolize_keys\n self.inject(Hash.new) do |result, array|\n key, value = array.first, array.last\n if value.respond_to?(:symbolize_keys)\n result[key.to_sym] = value.symbolize_keys\n else\n result[key.to_sym] = value\n end\n result\n end\n end", "title": "" }, { "docid": "ff3bbf452ef4cbfe6b64574132b25416", "score": "0.6729401", "text": "def recursive_stringify_keys(h)\n if h.class == [].class\n h.map {|key| recursive_stringify_keys(key)}\n elsif h.class == {}.class\n Hash[h.map {|k,v| [k.to_s, recursive_stringify_keys(v)]}]\n else\n h\n end\n end", "title": "" }, { "docid": "587c11c97817d49fff911070ac485d72", "score": "0.67094326", "text": "def deep_symbolize_keys(hash)\n hash.inject({}) { |result, (key, value)|\n value = deep_symbolize_keys(value) if value.is_a? Hash\n result[(key.to_sym rescue key) || key] = value\n result\n }\n end", "title": "" }, { "docid": "0502db6c8491e9501308ebf38fc07a5a", "score": "0.6704903", "text": "def transproc\n fn = Functions[:stringify_keys]\n nested ? Functions[:recursion, Functions[:is, Hash, fn]] : fn\n end", "title": "" }, { "docid": "a379659b540b34e734d1fb729dd5ecd8", "score": "0.6700443", "text": "def deep_symbolize_keys\n deep_transform_keys { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "a379659b540b34e734d1fb729dd5ecd8", "score": "0.6700443", "text": "def deep_symbolize_keys\n deep_transform_keys { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "a379659b540b34e734d1fb729dd5ecd8", "score": "0.6700443", "text": "def deep_symbolize_keys\n deep_transform_keys { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "1736c9a3df28b4bd2c2c923eef3b12e9", "score": "0.6699311", "text": "def flatten_hash(obj, parent_path = '', flat_hash_to_build = {})\n if obj.is_a?(Hash)\n obj.each do |key, val|\n if key_contains_unallowed_characters?(key)\n raise ArgumentError, 'Cannot deal with hash keys that contain \"[\" or \"]\" or \".\" because these characters have special meanings in CSV headers.'\n end\n path = parent_path + (parent_path.empty? ? '' : '.') + key\n flatten_hash(val, path, flat_hash_to_build)\n end\n elsif obj.is_a?(Array)\n obj.each_with_index do |el, index|\n path = parent_path + \"[#{index}]\"\n flatten_hash(el, path, flat_hash_to_build)\n end\n else\n flat_hash_to_build[parent_path] = obj unless obj.nil? || obj == '' # ignore nil or empty string values\n end\n\n flat_hash_to_build\n end", "title": "" }, { "docid": "37886b9563301a818f83467f86ba5bc4", "score": "0.6696413", "text": "def deep_underscore_keys!\n self.underscore_keys!.keys.each do |k|\n v = self[k]\n self[k] = if v.is_a? Hash\n v.deep_underscore_keys\n else\n v\n end\n end\n self\n end", "title": "" }, { "docid": "a60d96298f7a79df4342751ea2af2766", "score": "0.66810083", "text": "def recurse_keys(&block)\n if is_a?(Array)\n map do |o|\n if o.compound?\n o.recurse_keys(&block)\n else\n o\n end\n end\n elsif is_a?(Hash)\n new_hash = {}\n keys.each do |k|\n new_key = block.call k\n new_hash[new_key] = self[k]\n end\n new_hash.each_pair do |k,v|\n if v.is_a?(Hash)\n new_hash[k] = v.recurse_keys(&block)\n elsif v.is_a?(Array)\n new_ary = v.map do |o|\n o.is_a?(Hash) ? o.recurse_keys(&block) : o\n end\n new_hash[k] = new_ary\n end\n end\n new_hash\n else\n self\n end\n end", "title": "" }, { "docid": "9d8db5148849cd3766bdbb8c26306de6", "score": "0.66492736", "text": "def deeply_stringify_keys!\n return DeepHash.deeply_stringify_keys!(self)\n end", "title": "" }, { "docid": "7c6c94f08acdf886a8a102933c5fa4d4", "score": "0.6642012", "text": "def recursively_transform_keys(&block)\n _recursively_transform_keys_in_object(self, &block)\n end", "title": "" }, { "docid": "be5730fea708d071bb0a494d579bed9f", "score": "0.6628824", "text": "def deep_stringify_keys\n deep_transform_keys { |key| key.to_s }\n end", "title": "" }, { "docid": "249a28eefa5170bf2832dde13c14c917", "score": "0.6598547", "text": "def deep_transform_keys_in_object(object, &block)\n case object\n when Array\n object.map { |e| deep_transform_keys_in_object(e, &block) }\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[yield(key)] = deep_transform_keys_in_object(value, &block)\n end\n # Hash[object.map { |key, value| [yield(key), deep_transform_keys_in_object(value, &block)] }]\n else\n object\n end\n end", "title": "" }, { "docid": "cf24e875a9eeb98882dbe73ddf26d2a4", "score": "0.65941167", "text": "def flatten_hash(parent, hash, key_seq_hash)\n hash.each do |key, value|\n total_key = parent == \"\" ? key : \"#{parent}.#{key}\"\n if value.is_a? Hash\n flatten_hash(total_key, value, key_seq_hash)\n else\n key_seq_hash[total_key] = value\n end\n end\n end", "title": "" }, { "docid": "c04faac0d3397efb1de966dfb326e834", "score": "0.65925294", "text": "def symbolize_keys(hash) # rubocop:disable Metrics/MethodLength\n hash.each.with_object({}) do |(key, val), obj|\n obj[key.to_sym] =\n case val\n when Hash\n symbolize_keys(val)\n when Array\n val.map do |item|\n item.instance_of?(Hash) ? symbolize_keys(item) : item\n end\n else\n val\n end\n end\n end", "title": "" }, { "docid": "35524a3bd7c58e24cd1db549abf661ef", "score": "0.6578855", "text": "def symbolize_keys_recursively!(object); end", "title": "" }, { "docid": "406fb4901c53b30a61ee133ab723be75", "score": "0.6571249", "text": "def deep_flatten_dashes_and_symbolize_keys!\n deep_transform_keys!{ |key| key.gsub(\"-\", \"_\").to_sym rescue key }\n end", "title": "" }, { "docid": "d28f20fb57d7ff9c72124bb6519dab06", "score": "0.6567685", "text": "def deep_symbolize_keys!(hash)\n hash.each_with_object({}) do |(key, value), new_hash|\n new_key = key.respond_to?(:to_sym) ? key.to_sym : key\n new_value = value.is_a?(Hash) ? deep_symbolize_keys!(value) : value\n new_hash[new_key] = new_value\n end\n end", "title": "" }, { "docid": "512d52747bcf39f490cd4ab21acb127e", "score": "0.6549431", "text": "def apply_nested_hash(hash); end", "title": "" }, { "docid": "eb7fef23b273a3589b04edc37112fe54", "score": "0.64950466", "text": "def recursive_transform_values(parsed)\n case parsed\n when Hash\n node_pairs = parsed.flatten\n node_pairs.each_slice(2).reduce({}) do |result, (key,val)|\n case val\n when Array\n result.merge({ key => val.map {|v| recursive_transform_values(v) } })\n when Hash\n result.merge({ key => recursive_transform_values(val) })\n when ::Parslet::Slice, String, Symbol\n result.merge({ key => val.to_s })\n when nil\n result.merge({ key => val })\n else\n raise \"Error: Unknown type #{val.inspect}\"\n end\n end\n when Array\n parsed.map do |node|\n recursive_transform_values(node)\n end\n when ::Parslet::Slice\n parsed.to_s\n when nil\n nil\n else\n raise \"Error: in recursive_transform_values\\n-> (#{parsed.inspect})\"\n end\n end", "title": "" }, { "docid": "ce284a60c89d15d1c8043a254395cf2d", "score": "0.64862907", "text": "def deep_symbolize_keys(hash)\n hash.inject({}) { |result, (key, value)|\n value = deep_symbolize_keys(value) if value.is_a?(Hash)\n result[(key.to_sym rescue key) || key] = value\n result\n }\n end", "title": "" }, { "docid": "b2aae6b3f0e0f3ddb5bcd5904ceceae3", "score": "0.648368", "text": "def hash_flatten(hash, prefix=nil, flat = {})\n hash.keys.each {|key|\n newkey = key\n newkey = '%s.%s' % [prefix, key] if prefix\n val = hash[key]\n if val.is_a? Hash\n hash_flatten val, newkey, flat\n else\n flat[newkey] = val\n end\n }\n return flat\nend", "title": "" } ]
7647ad9a7b0b57c0b7bccb86f3235eb9
GET /body_style_product_features/1 GET /body_style_product_features/1.json
[ { "docid": "97633f02ab9e939c7d56282c39e8e5de", "score": "0.7998897", "text": "def show\n @body_style_product_feature = BodyStyleProductFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @body_style_product_feature }\n end\n end", "title": "" } ]
[ { "docid": "52378f20efd34846b02cc2e6657563ec", "score": "0.78783935", "text": "def index\n @body_style_product_features = if params[:body_style_id]\n BodyStyle.find(params[:body_style_id]).body_style_product_features\n else\n BodyStyleProductFeature.by_body_style\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @body_style_product_features }\n end\n end", "title": "" }, { "docid": "a7ec2e63b5b691ed288429e5ed5a2019", "score": "0.7572166", "text": "def new\n @body_style_product_feature = BodyStyleProductFeature.new params[:body_style_product_feature]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style_product_feature }\n end\n end", "title": "" }, { "docid": "0fdb9437c3985d6b2b5db7fbbe274ae3", "score": "0.6987115", "text": "def create\n @body_style_product_feature = BodyStyleProductFeature.new(params[:body_style_product_feature])\n\n respond_to do |format|\n if @body_style_product_feature.save\n format.html { redirect_to @body_style_product_feature, notice: 'Body style product feature was successfully created.' }\n format.json { render json: @body_style_product_feature, status: :created, location: @body_style_product_feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @body_style_product_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "243a03a6198376c6aa8ab8f34235cee5", "score": "0.6633324", "text": "def show\n @body_style = BodyStyle.find(params[:id])\n @products = @body_style.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @body_style }\n end\n end", "title": "" }, { "docid": "a0f08bcb9c9cf4eff58b364da0050972", "score": "0.6378312", "text": "def show\n @item_feature = ItemFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_feature }\n end\n end", "title": "" }, { "docid": "14ef3d8bd593ed1b923284f3e0d5b277", "score": "0.63044536", "text": "def destroy\n @body_style_product_feature = BodyStyleProductFeature.find(params[:id])\n @body_style_product_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to body_style_product_features_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42a1b59ab31cf5e4fe10bdfcdd33f34b", "score": "0.6302043", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_features }\n end\n end", "title": "" }, { "docid": "54315f4db223c2e140a07359096733f2", "score": "0.604258", "text": "def index\n @features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end", "title": "" }, { "docid": "11064a2e6428e301ebf9ad6a868d8481", "score": "0.6037127", "text": "def show\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feature }\n end\n end", "title": "" }, { "docid": "83f70a8495e925cecac4197687fbef66", "score": "0.6000307", "text": "def new\n @item_feature = ItemFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_feature }\n end\n end", "title": "" }, { "docid": "4468df9072e261c9e95d89adfc8b432d", "score": "0.5985481", "text": "def features\n validate_loaded\n resource = FEATURES % { id: @id }\n response = Request.new(client, :get, resource).perform\n response.body[:data]\n end", "title": "" }, { "docid": "fb99509e02f6b98697fe36fbb9ec13ad", "score": "0.5912572", "text": "def show\n @phosphosite_feature = PhosphositeFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phosphosite_feature }\n end\n end", "title": "" }, { "docid": "b92e3cb6ad1174e01696e0b7a63bbb4d", "score": "0.5868178", "text": "def show\n @feature = Feature.find(params[:id])\n # @homepage_features = Feature.homepage_list.published\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feature }\n end\n end", "title": "" }, { "docid": "d8d4d4fef7308700e632075f5d3fc76e", "score": "0.5849076", "text": "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "title": "" }, { "docid": "dce379fa4102e4ae376037be760ec3fc", "score": "0.5824763", "text": "def index\n @product_colors = ProductColor.where(\"product_type_id = ?\", params[:get_product_type_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_colors }\n end\n end", "title": "" }, { "docid": "c4d045e549f750311946b899af31341b", "score": "0.58138883", "text": "def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end", "title": "" }, { "docid": "c94b89351d2580ee9100be2c481c1a51", "score": "0.5805233", "text": "def show\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing_feature }\n end\n end", "title": "" }, { "docid": "9b98760fda2102d4755c6b0ab77fade8", "score": "0.57981145", "text": "def show\n render json: @food_product\n end", "title": "" }, { "docid": "c18643ebc64f7c111d4cd5319e9fcfba", "score": "0.5795997", "text": "def index\n @food_products = FoodProduct.all\n render json: @food_products\n end", "title": "" }, { "docid": "9ebc32f4a77a137c37d1c896ce73d5e4", "score": "0.57771343", "text": "def index\n respond_with(features)\n end", "title": "" }, { "docid": "9ebc32f4a77a137c37d1c896ce73d5e4", "score": "0.57767355", "text": "def index\n respond_with(features)\n end", "title": "" }, { "docid": "81a95dbd38f0524ab2d8402389dc084f", "score": "0.57696104", "text": "def show\n @feature_model = FeatureModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feature_model }\n end\n end", "title": "" }, { "docid": "2c08dfb6ef82245da680c2854284246c", "score": "0.57617176", "text": "def show\n @body_style_categorization = BodyStyleCategorization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @body_style_categorization }\n end\n end", "title": "" }, { "docid": "f7d05c3a6b1b760ed4599bb3b54e2fd4", "score": "0.57538736", "text": "def show\n @gene = Gene.find(params[:gene_id])\n @feature = @gene.features.find(params[:id])\n #@feature = Feature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feature }\n end\n end", "title": "" }, { "docid": "2eda868cf1769a19288d659bc1057513", "score": "0.571969", "text": "def index\n @featuring = Featuring.all\n end", "title": "" }, { "docid": "6e360e4ec198f8024bb50ec653bc9003", "score": "0.56737036", "text": "def show\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_feature }\n end\n end", "title": "" }, { "docid": "7d7616a5e1431348c5a390fc03bd79ce", "score": "0.56723064", "text": "def create\n @item_feature = ItemFeature.new(params[:item_feature])\n\n respond_to do |format|\n if @item_feature.save\n format.html { redirect_to @item_feature, notice: 'Item feature was successfully created.' }\n format.json { render json: @item_feature, status: :created, location: @item_feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d8f7429f23a1d5e3fd8354f3dbd38ab", "score": "0.5649096", "text": "def show\n @feature = @feature_category.features.find(params[:id])\n # @feature = Feature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feature }\n end\n end", "title": "" }, { "docid": "060708cc25d00934f68f3098c50e26a5", "score": "0.5634724", "text": "def show\n @product = Product.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { respond_with @product.to_json(:method => ['color', 'size']) }\n format.json {render :json => @product.to_json(:methods => [:color, :size])}\n end\n end", "title": "" }, { "docid": "755924ec93d7dc61ac7e15684519779a", "score": "0.56058484", "text": "def get_featured\n render json: Event.where(is_featured: true), status: :ok\n end", "title": "" }, { "docid": "19210ddea6e3a8d6d95c4ca55b670259", "score": "0.5581261", "text": "def show\n json_response(@api_v1_product)\n end", "title": "" }, { "docid": "a43c803a1ed48fd0223339cbf8718819", "score": "0.5571455", "text": "def show\n @product = Product.eager_loading.find_by_uuid(params[:id])\n\n respond_to do |format|\n format.html { redirect_to edit_shop_product_path(@product.shop_id, @product)}\n format.json { render json: @product.as_json(:include => {:product_variants => {:include => [:option_types,:pictures]}, :shipping_category => {}}, :methods => [:taxon_ids]) }\n end\n end", "title": "" }, { "docid": "0098402c2cc8f6dc601233eb4bef8bde", "score": "0.5570967", "text": "def new\n @feature = current_user.features.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "title": "" }, { "docid": "26960d3efad2fa9ee65e2f9a02834454", "score": "0.5570494", "text": "def new\n @phosphosite_feature = PhosphositeFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phosphosite_feature }\n end\n end", "title": "" }, { "docid": "54095224a09b8b0aa0a8d83e87f8af60", "score": "0.5570143", "text": "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "title": "" }, { "docid": "b81cef2a7c794a022496be1ae13fd3c3", "score": "0.55622554", "text": "def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "title": "" }, { "docid": "b81cef2a7c794a022496be1ae13fd3c3", "score": "0.55622554", "text": "def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "title": "" }, { "docid": "d95df07282357423f6a8014067b7f466", "score": "0.55504704", "text": "def show\n render json: @key_feature\n end", "title": "" }, { "docid": "12e86cdb8da9edec831d16980c0814dd", "score": "0.5539465", "text": "def new\n @housing_feature = HousingFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @housing_feature }\n end\n end", "title": "" }, { "docid": "228da54dc5873c035dacc56f9fe9b261", "score": "0.55099523", "text": "def new\r\n\t\t@current_area = 'features'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\t@feature_categories = Array.new\r\n\t\t@feature_static_pages = Array.new\r\n\t\tif params[:save]\r\n\t\t\tparams[:feature][:until] = ffs_parse_date(params[:feature][:until])\r\n\t\t\t@feature = Feature.new(params[:feature])\r\n\t\t\tif @feature.save\r\n\t\t\t\tif params[:category] && params[:category][:id]\r\n\t\t\t\t\tparams[:category][:id].each do |cur_cat|\r\n\t\t\t\t\t\t@feature.categories << Category.find(cur_cat.to_i)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\tif params[:static_page] && params[:static_page][:id]\r\n\t\t\t\t\tparams[:static_page][:id].each do |cur_stat|\r\n\t\t\t\t\t\t@feature.static_pages << StaticPage.find(cur_stat.to_i)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\r\n\t\t\t\t@feature.save\r\n\t\t\t\tredirect_to(:action => :list) and return false\r\n\t\t\tend\r\n\t\telse\r\n\t\t\t@feature = Feature.new\r\n\r\n\t\t\tif params[:id]\r\n\t\t\t\t@feature[:product_id] = params[:id].to_i\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t@products_by_category = Category.all.collect { |c| { :name => c.name, :id => c.id, :products => c.products } }\r\n\tend", "title": "" }, { "docid": "ccb44d0e8008d1b7ee8d9335fbdcfb60", "score": "0.5499105", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end", "title": "" }, { "docid": "3ab9e55086831dcc10127320c3813cf4", "score": "0.54749006", "text": "def index\r\n @features = Feature.order(:name).page(params[:page]).per(5) #配置kaminari到参数,每页几个数据\r\n @tags = Tag.all\r\n respond_to do |format|\r\n format.html # No_index.html.erb\r\n format.json { render json: @features }\r\n end\r\n\r\n end", "title": "" }, { "docid": "a72714db39aaf6a09eecc101ca571e98", "score": "0.54735637", "text": "def show\n @body_style_size = BodyStyleSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @body_style_size }\n end\n end", "title": "" }, { "docid": "c1131125291b7d642c8bc0fc87fddf57", "score": "0.547256", "text": "def show\n render json: @product, status: 200\n end", "title": "" }, { "docid": "ae85cd37ca2aeb4b57d46ef4e1a54a23", "score": "0.5462765", "text": "def show\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end", "title": "" }, { "docid": "913e6d664b8c2095726a49b22043ada3", "score": "0.54593456", "text": "def index\n @size_to_products = SizeToProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @size_to_products }\n end\n end", "title": "" }, { "docid": "d601bdeacacb94c3f17ec530267f763f", "score": "0.5455101", "text": "def index\n @shape_text = UniqueShapeName.for_profiles\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_text }\n end\n end", "title": "" }, { "docid": "6c8d7e4dcd0a6d46362e62a643bbf326", "score": "0.5452787", "text": "def show\n render json: @product\n end", "title": "" }, { "docid": "4d33cd29066775868d1c70a20a500db3", "score": "0.54449135", "text": "def featured\n properties = []\n begin\n # Try to get the 3 properties with priority flag\n Property.where(priority: true, status: :active).order('RANDOM()').limit(3).each { |p| properties << p }\n\n # Get the missing properties\n missing = 3 - properties.count\n Property.where(priority: false, status: :active).order('RANDOM()').limit(missing).each { |p| properties << p } if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "09f56d3be5e16211ce3333fb8b8dd965", "score": "0.54426074", "text": "def features_field\n product_descriptions.where(content_name: \"features\").first_or_initialize\n end", "title": "" }, { "docid": "eb14d17ef9f0d3b375ed84c202fe007b", "score": "0.54413325", "text": "def index\n @products = Product.order('category, priority desc, price')\n @basket_size = count_basket_items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "b87484a56cba3da8597b9e04bf9c47bf", "score": "0.5438389", "text": "def show\n render json: @product\n end", "title": "" }, { "docid": "06c575acdcb68066977c08832ebbf71c", "score": "0.5431303", "text": "def show\n @product = Product.find(params[:id])\n @bg = \"opaque\"\n\n respond_to do |format|\n format.html { render action: \"itemview\"} # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "cad1498555544483369b6fe4b669b26f", "score": "0.54302764", "text": "def show\n @flavor = compute.get_flavor(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @flavor }\n end\n end", "title": "" }, { "docid": "9ea8c93fcda38de3b55c55612a1ef9e9", "score": "0.542543", "text": "def show\r\n @feature = Feature.find(params[:id])\r\n # @content = File.readlines(@feature.name).each {|line| line.rstrip!<<'<br/>'}\r\n @content= File.read(@feature.name)\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @feature }\r\n end\r\n end", "title": "" }, { "docid": "e53b997f98fdb6893b98062f550e4fd0", "score": "0.5419857", "text": "def get_product\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "title": "" }, { "docid": "5efa217ef973eac23fa4dfc9fcac0ba7", "score": "0.54176813", "text": "def get_colours\n @item = Item.find(params[:id])\n @colours = @item.variants_for(:colour, params[:size], nil)\n respond_to do |format|\n format.json { render :json => @colours }\n end\n end", "title": "" }, { "docid": "7f57d6830f5196911e4400912286d525", "score": "0.54169214", "text": "def index\n @feature_requests = FeatureRequest.all\n end", "title": "" }, { "docid": "f36c98b670dff597396b92254f9cf024", "score": "0.5412077", "text": "def show\n @favorite_bundle = FavoriteBundle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favorite_bundle }\n end\n end", "title": "" }, { "docid": "1329412e3b006dee05c918b334830ae1", "score": "0.5408656", "text": "def index\n @educacao = Educacao.new\n @educacaos = Educacao.all\n @modal = true\n\n factory = RGeo::GeoJSON::EntityFactory.instance\n features = []\n @educacaos.each do |edu|\n feature = factory.feature(edu.the_geom, nil, {id: edu.id, nome: edu.nome, email: edu.email, contato: edu.contato})\n features << feature\n end\n\n json_edu = RGeo::GeoJSON.encode factory.feature_collection(features)\n\n respond_to do |format|\n format.html\n format.json { render :json => json_edu }\n format.xml { render :xml => @educacaos }\n end\n end", "title": "" }, { "docid": "9559e8d09288528c70dc48c620906f85", "score": "0.5407743", "text": "def show\n @star_product = Star::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @star_product }\n end\n end", "title": "" }, { "docid": "8c56bd9e8aecda7e11e3458928743af9", "score": "0.5401606", "text": "def getNodeFeatureData\n\t render json: Network.getFeatureData(params)\n\tend", "title": "" }, { "docid": "bb9c67a0a24e1bcdf0e7bb25c43bd327", "score": "0.5396357", "text": "def show\n @add_product = AddProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @add_product }\n end\n end", "title": "" }, { "docid": "945d23f17822d2cb2c13958465f8ea17", "score": "0.53957987", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_type }\n end\n end", "title": "" }, { "docid": "a748d686a3cb0ae22387b212ed82af4d", "score": "0.5385829", "text": "def index\n @user_interactive_products = UserInteractiveProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_interactive_products }\n end\n end", "title": "" }, { "docid": "39954a9004383ebadcde3635937e7b58", "score": "0.53828484", "text": "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "title": "" }, { "docid": "6312783a8c74589e2107d04886b34cb6", "score": "0.53814405", "text": "def new\n @star_product = Star::Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_product }\n end\n end", "title": "" }, { "docid": "c4266cf7c1952afe5bca98ffd28864e1", "score": "0.5352611", "text": "def show\n @product_color = ProductColor.find(params[:id])\n @product_sizes = ProductSize.where(\"product_color_id = ?\", @product_color.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_color }\n end\n end", "title": "" }, { "docid": "34b2ee5c83e7565ea25f57d84bc93e58", "score": "0.53430754", "text": "def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n end\n end", "title": "" }, { "docid": "6b084d609415528e8aef03af8df1eeea", "score": "0.534236", "text": "def view_product\n to_json(\n only: [:id, :title, :description, :key_information],\n methods: [:photo_url, :net_mrp, :mrp_per_unit, :quantity],\n :include => {\n store: {\n only: [:name, :id],\n methods: [:full_address]\n }\n }\n )\n end", "title": "" }, { "docid": "a18d177d2ebae9f6d18b2fcc20b3930d", "score": "0.5341326", "text": "def create\n @feature_group = FeatureGroup.new(feature_group_params)\n @product = Product.find(params[:product_id])\n @feature_group.product_id = @product.id\n respond_to do |format|\n if @feature_group.save\n format.html { redirect_to @product, notice: 'Feature group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feature_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @feature_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d51c94a568cbfeedbd6276c7a66a2e39", "score": "0.5340202", "text": "def show\n @product = ProductProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "d6ad4b6eb2ea117f8743d1056fffa170", "score": "0.5336864", "text": "def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end", "title": "" }, { "docid": "945aba40c7a454cbed270517e834bc30", "score": "0.533655", "text": "def show\n @size_to_product = SizeToProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @size_to_product }\n end\n end", "title": "" }, { "docid": "7076d6876750e22488e6c9058af0c60b", "score": "0.5335746", "text": "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "9c065f81ee5f7c39ee9075914f0f0bca", "score": "0.5332554", "text": "def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end", "title": "" }, { "docid": "97dd4012b8bdd553e2f52828c7f5e21f", "score": "0.5331625", "text": "def new\n @contractor_feature = ContractorFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contractor_feature }\n end\n end", "title": "" }, { "docid": "55208daa77f363e0afa2ea4ab87f0aae", "score": "0.53269", "text": "def get_all_data\n if request.xhr?\n @features = Feature.get_all_feature\n render :json => @features\n end\n end", "title": "" }, { "docid": "e516ac4708dac8bf4ce23bd5fea41f6b", "score": "0.53263116", "text": "def get_all_data_by_pricing_plan_id\n if request.xhr?\n @features = Feature.get_all_data_by_pricing_plan_id(params[:id])\n render :json => @features\n end\n end", "title": "" }, { "docid": "388ad9bbe61e8420ea09512b50f51347", "score": "0.53236604", "text": "def update_features(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/features\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n features:[{\"name\":\"public_dashboards\",\"enabled\":true},\n {\"name\":\"published_dashboards\",\"enabled\":true},\n {\"name\":\"downloadable_reports\",\"enabled\":true},\n {\"name\":\"scheduled_emails\",\"enabled\":true}]\n }.to_json)\n puts response.body\n puts \"Client's features were updated.\" if response.success?\n end", "title": "" }, { "docid": "6c920811146c7e5efee11fc5db107909", "score": "0.53220457", "text": "def show\n @product = Product.where([\"id = ?\", params[:id].to_i]).first\n raise NoProductError if @product.blank?\n\n @providers = @product.providers\n @product_contents = @product.contents\n\n @shop = @product.shop\n raise NoShopError if @shop.blank?\n \n @reviews = @product.reviews\n @review_images = @product.review_images\n \n @main_review = @reviews.first\n @main_image = @product.images.try(:first)\n @countries = Country.all\n\n add_breadcrumb \"#{@shop.name} - #{@product.name} 商品詳細\", product_path\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "2782f71eafff3cfb06c1ae2589dbb5d8", "score": "0.5319888", "text": "def new\n @favorite_bundle = FavoriteBundle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favorite_bundle }\n end\n end", "title": "" }, { "docid": "b8c8223f4b53cb320cf9b625444069d5", "score": "0.5317937", "text": "def show\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @belief }\n end\n end", "title": "" }, { "docid": "16ec5284c76b0426edc46b8757bef895", "score": "0.53077567", "text": "def show\n @tipo_product = TipoProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_product }\n end\n end", "title": "" }, { "docid": "4132c517ea859d25dbe493cd50adb457", "score": "0.5307707", "text": "def show\n @user_interactive_product = UserInteractiveProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_interactive_product }\n end\n end", "title": "" }, { "docid": "0f101b9c0ac406494eaa23b7a6e342c4", "score": "0.53042966", "text": "def get_required_features(features)\n end", "title": "" }, { "docid": "583a2c1d4ab82d097181acc53215046d", "score": "0.5301571", "text": "def featured\n properties = []\n begin\n # Tenta pegar 3 propriedades com a flag de prioridade\n Property.where(priority: true, status: :active).order(\"RANDOM()\").limit(3).each {|p| properties << p}\n # Verifica quantas propriedades faltam pra completar 3\n missing = 3 - properties.count\n # Pega as propriedades faltantes caso existam\n Property.where(status: :active).order(\"RANDOM()\").limit(missing).each {|p| properties << p} if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "96480faa7df7ec32946f4af683f1cafc", "score": "0.52962226", "text": "def index\n @vendor_features = VendorFeature.all\n end", "title": "" }, { "docid": "15487489fda1615d234261cbdb26c863", "score": "0.5292736", "text": "def index\n @products = Product.all\n render json: @products\n end", "title": "" }, { "docid": "cda9cc6ce501e0759ebd220bb0d15c09", "score": "0.5292494", "text": "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "title": "" }, { "docid": "c2f2957477fbd23222854bd7c6d0d3ae", "score": "0.52883244", "text": "def size_and_colour\n @product = Product.find(params[:product_id])\n end", "title": "" }, { "docid": "1ff35c10cdade3ab4d6c642e3cafac3b", "score": "0.52843326", "text": "def new\n @body_style_categorization = BodyStyleCategorization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style_categorization }\n end\n end", "title": "" }, { "docid": "092e6731153f9e369b41e7d162045434", "score": "0.5282418", "text": "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "cbe9bfc8528a9100c5ab5f78e23a528f", "score": "0.5280708", "text": "def show\n @product = Product.find(params[:id])\n json_response(params)\n end", "title": "" }, { "docid": "55610d179211d376abd86f8f135c3d9f", "score": "0.5274915", "text": "def create\n @feature = Feature.new(params[:feature])\n\n respond_to do |format|\n if @feature.save\n format.html { redirect_to admin_features_path, notice: 'Feature was successfully created.' }\n format.json { render json: @feature, status: :created, location: @feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39d131eaecfcff8591b60f6a5b12381d", "score": "0.52729887", "text": "def show\n @venue_product = VenueProduct.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue_product }\n end\n end", "title": "" }, { "docid": "92d87189ba3298b171f77c895073d717", "score": "0.52697426", "text": "def show\n @shopifyproduct = Shopifyproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopifyproduct }\n end\n end", "title": "" }, { "docid": "30135f1cebd2d8141e672a39ccf4f8f5", "score": "0.52683", "text": "def set_featuring\n @featuring = Featuring.find(params[:id])\n end", "title": "" }, { "docid": "fd5b284347e00889b7c3a4a93682af95", "score": "0.52670604", "text": "def new\n @feature_model = FeatureModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @feature_model }\n end\n end", "title": "" }, { "docid": "6fb1cd7362fd21a68c9a27de13973b43", "score": "0.5264033", "text": "def index\n @rental = Rental.friendly.find(params[:rental_id])\n @features = Feature.all\n end", "title": "" } ]
0e173acfa6fbfff19f87d190ffcf6340
shows given commit in a branch
[ { "docid": "4ef995c43cfbd360309e778cbb884d23", "score": "0.79269713", "text": "def show\n\t\t\n\t\trepo = @project.repo\n\t\t@branch = params[:branch]\n\t\t\n\t\tif params[:commit].nil? or params[:commit] == '-'\n\t\t\tcommits = repo.commits @branch\n\t\telse\n\t\t\tcommits = repo.commits params[:commit]\n\t\tend\n\t\t\n\t\t@commit = commits.first\n\t\t\n\t\tif commits[1].nil?\n\t\t\t@diffs = get_tree_diffs @commit.tree, [], ''\n\t\telse\n\t\t\t@commit2 = commits[1].id\n\t\t\t@diffs = Grit::Commit.diff repo, commits[1].id, @commit.id\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "5895b2d9eda0df62aa3b2f65f0ab393a", "score": "0.7076463", "text": "def show\n @commit = Commit.find(params[:id])\n if !@commit || @commit.try(:repo).try(:user) != current_user\n redirect_to commits_path, alert: \"commit not found\"\n end\n end", "title": "" }, { "docid": "5b7b33fc01391f9962be75cad12e443e", "score": "0.7015318", "text": "def show\n @test_var = \"\"\n commit = @repo.lookup(@commit.sha)\n if commit.parents.length > 0\n diff_commits = commit.parents[0].diff(commit, :context_lines => 100000000)\n @test_var = Iconv.conv('utf-8', 'latin1', diff_commits.patch())\n end\n render :layout => 'application'\n end", "title": "" }, { "docid": "f2e2115fe568828698d2120c0233e3f1", "score": "0.6830744", "text": "def commit\n read_repo\n if @branches.count < 1\n render :template => 'repositories/commit'\n return\n end\n\n params[:action] = \"commit\"\n\n blank_hash = \"4b825dc642cb6eb9a060e54bf8d69288fbee4904\"\n @commit = @repository.get_commit(@branch)\n @parent = @commit.parent\n @parent = @repository.get_commit(blank_hash) if @parent == nil\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "title": "" }, { "docid": "108c69c2b1d5dc6a3a4aa7e205009f8f", "score": "0.6688562", "text": "def show\n @commit = @repository.commits.where(gitid: params[:commit_gid]).first\n\n respond_to do |format|\n format.html do\n @commit_too_large =\n @commit.total_diff_lines > ConfigVar['max_diff_lines'].to_i\n unless @commit_too_large\n # Pre-fetch all the diff data to avoid O(n) SQL queries in render.\n @commit = @repository.commits.where(gitid: params[:commit_gid]).\n includes(diffs: :hunks).first\n end\n render action: :show # show.html.erb\n end\n format.xml { render xml: @commit }\n end\n end", "title": "" }, { "docid": "2a7c8edca55ca615665bc632fd8f094b", "score": "0.6589535", "text": "def branches_containing_commit(commit_ref); end", "title": "" }, { "docid": "2a7c8edca55ca615665bc632fd8f094b", "score": "0.65891325", "text": "def branches_containing_commit(commit_ref); end", "title": "" }, { "docid": "df551d95c1dd2272f93d1050abe1f105", "score": "0.6570597", "text": "def display_branch\n colored_active_branch = build_magenta_text_with_condition(@name, @is_active_branch)\n colored_issue_state = build_colored_issue_state\n colored_issue_title = build_magenta_text_with_condition(@issue_title, @is_active_branch)\n\n build_branch_view(colored_issue_state, colored_active_branch, colored_issue_title)\n end", "title": "" }, { "docid": "fa23093dc882500d0587e3a7522e38cf", "score": "0.6528524", "text": "def get_branch_name\r\n\tputs IO.popen('git branch --no-abbrev').read.slice(2..-1)\r\nend", "title": "" }, { "docid": "7a6cd239e7f2544e0529c4d0ad33a27c", "score": "0.6525672", "text": "def commit_sha commit_message\n output_of \"git log --grep='#{commit_message}' --format='%h' -1\"\nend", "title": "" }, { "docid": "3877751ae9d851546c586f60f7f58fd5", "score": "0.64556175", "text": "def branch\n %x[cd #{repo_path};git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}].chomp\n end", "title": "" }, { "docid": "53a9ce9c5b71893d184625a5d4332c8f", "score": "0.6430794", "text": "def entry_name_from_branch(commit_hash)\n Git::Parser.branch_of_commit(commit_hash).tr('-', ' ')\n end", "title": "" }, { "docid": "28d432e600a1d1e7a0d041cb91a26d98", "score": "0.6405413", "text": "def show\n @branch = @repository.branches.where(:name => params[:branch_name]).first!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @branch }\n end\n end", "title": "" }, { "docid": "c33b63a9c707b7356c7b211b7d79ec11", "score": "0.6380857", "text": "def fetch_commits(branch) \n puts \"Getting commits of a branch: #{branch.name} and #{branch.commit_id}\"\n stop = false\n branch_commits = []\n commit_id = branch.commit_id\n until stop\n cs = @github_client.fetch_commits(@repo_user,@repo_name,commit_id, COMMITS_PER_PAGE)\n commits = cs.map { |c| commit(branch.name, c) }\n branch_commits.concat(commits)\n puts \"Loaded commits: #{branch_commits.length}\" \n sha = commits.last.parent_ids[0]\n if commits.last.initial? || commit_id == sha\n stop = true\n else \n commit_id = sha\n end \n end\n branch_commits.reverse\n end", "title": "" }, { "docid": "884d61c4c33ced32bb95ff586c619433", "score": "0.63659286", "text": "def show\n @branch = @repository.branches.where(name: params[:branch_name]).first!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @branch }\n end\n end", "title": "" }, { "docid": "b5630faa9c8e81f497638ddd80a0f032", "score": "0.6346607", "text": "def branch(name, options = {})\n get_path(\n path_to_branch(name),\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end", "title": "" }, { "docid": "520bb892e00f93f72448cefc678e63f7", "score": "0.6345964", "text": "def commit_hash(branch_or_tag = nil)\n git 'rev-parse', branch_or_tag || 'HEAD'\n end", "title": "" }, { "docid": "fd914b7ea4b20c1319991ed2877021b6", "score": "0.6341231", "text": "def commit\n @commit ||= $repo.log.object(@rev || 'master').path(@name).first\n end", "title": "" }, { "docid": "0a94e94fbffa21eaa3cfa21852c64b75", "score": "0.63382465", "text": "def git_commit(repo, sha, options = {})\n get \"#{Repository.path repo}/git/commits/#{sha}\", options\n end", "title": "" }, { "docid": "732a372bc1fb6d3802c9c704edc3370d", "score": "0.6329945", "text": "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", "title": "" }, { "docid": "c7a4c1021ee7ca6fa7544a8fa286130d", "score": "0.6312728", "text": "def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend", "title": "" }, { "docid": "cd5b74af3086aaa6b02d3e3b56ae3390", "score": "0.6310391", "text": "def commits\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n @commits = @repository.commits(@branch)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "title": "" }, { "docid": "bdbca52db89539562a5d2db6956e5930", "score": "0.63065976", "text": "def commit\n @git = YMDP::GitHelper.new\n @git.do_commit(@message)\n @git_hash = git.get_hash(options[:branch]) \n end", "title": "" }, { "docid": "5006afce19616b0d0cf5f484ca5ae797", "score": "0.6303991", "text": "def fetch_revision(commit)\n `git rev-parse #{commit}`.tr(\"\\n\", '')\n end", "title": "" }, { "docid": "e930ae2b333d3743f7efe46f67c33bd3", "score": "0.62587786", "text": "def lookup_commit_details(msg)\n rev = msg[:message]\n commit = fetch_svn_commit(rev).first\n messagetext = \"#{commit[:author]} committed revision #{commit[:revision]} \" +\n \"#{time_ago_in_words(commit[:date])} ago:\\n\"\n\n messagetext += \"\\n#{commit[:message]}\\n\"\n messagetext += \"----\\n\"\n commit[:paths].each do |path|\n messagetext += path[:action] + \" \" + path[:path] + \"\\n\"\n end\n\n msg.paste(messagetext)\n\n messagetext = \"More detail can be found at \" + bot.config['svn_webui_url']\n msg.speak(messagetext)\n\n @log.info messagetext\n end", "title": "" }, { "docid": "384d56ebcd032b25342eb8a54e36f3af", "score": "0.62549114", "text": "def branch(tag=@current_branch)\n get_head(tag)\n end", "title": "" }, { "docid": "a13ad8aecbb5c03368a5685cefeefb23", "score": "0.6251116", "text": "def show_link_to_branch(build)\n \"#{build.repository.base_html_url}/tree/#{build.branch}\"\n end", "title": "" }, { "docid": "70a2d4964dfbd79f695fd8eaf3a65a8f", "score": "0.62227786", "text": "def line_uri\n branch.commit_uri.chomp(\"commit/$commit\")\n end", "title": "" }, { "docid": "b32cca6babf844c3f787ad880fda2bba", "score": "0.6146287", "text": "def title\n \"Interesting commit: #{commit.title}\"\n end", "title": "" }, { "docid": "16eddcd25a1e699eab29a40e88841057", "score": "0.61462766", "text": "def sha commit_message\n cmd = \"git reflog --grep-reflog='commit\"\n cmd += ' (initial)' if commit_message == 'Initial commit'\n cmd += \": #{commit_message.strip}' --format='%H'\"\n result = ''\n %w[developer developer_secondary].each do |user|\n next unless result.empty?\n in_repository(user) { result = output_of cmd }\n end\n result\nend", "title": "" }, { "docid": "739b8a2f54b750886e5ea5bc5fdf4c9f", "score": "0.6114287", "text": "def find_svn_rev_for_commit(repo_path, commit)\n `(cd \"#{repo_path}\" && git svn find-rev #{commit})`.strip\n end", "title": "" }, { "docid": "b76413b5b87d0e310efd4cc5f3851c77", "score": "0.61086404", "text": "def show_ref(repo_path, ref)\n Dir.chdir repo_path do\n lines = git('show-ref', ref).lines.to_a\n\n raise AmbiguousGitRef, ref if lines.size > 1\n\n lines.first.chomp.split(/\\s/).first\n end\n end", "title": "" }, { "docid": "9216bf2c13b10f91b479334f10b1e566", "score": "0.6098494", "text": "def commit_hash(branch_or_tag = nil)\n @version = git 'rev-parse', branch_or_tag || 'HEAD'\n end", "title": "" }, { "docid": "2aefa69d358b73245f62b1cfe38edf62", "score": "0.6092837", "text": "def last_commit(branch, filename)\n lc = @repo.log(branch, filename, {:n => 1})\n lc.empty? ? nil : lc.first\n end", "title": "" }, { "docid": "949e6390e6ce80de32a9597738f7f9f8", "score": "0.60854596", "text": "def commits(branch)\n raise \"Given branch: #{branch} is not found in this repository\" unless @branch_heads.key? branch.to_sym\n head = @branch_heads[branch.to_sym]\n CommitIterator.new(head)\n end", "title": "" }, { "docid": "97227fff8f6190804a908ff282dc55ad", "score": "0.6073126", "text": "def find_commit_for_svn_rev(repo_path, svn_rev, base_branch)\n `(cd \"#{repo_path}\" && git rev-list #{base_branch} --grep=\"git-svn-id:.*@#{svn_rev}\")`.strip\n end", "title": "" }, { "docid": "ee43786ada518e013ed936969b21a5b2", "score": "0.60674804", "text": "def branch\n if request.args.first == \"list\"\n request.args[1]\n else\n request.args.first\n end\n end", "title": "" }, { "docid": "edaa96f7b7b71501439b2932e9538a6e", "score": "0.60622185", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend", "title": "" }, { "docid": "edaa96f7b7b71501439b2932e9538a6e", "score": "0.60622185", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend", "title": "" }, { "docid": "edaa96f7b7b71501439b2932e9538a6e", "score": "0.60622185", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend", "title": "" }, { "docid": "edaa96f7b7b71501439b2932e9538a6e", "score": "0.60622185", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend", "title": "" }, { "docid": "edaa96f7b7b71501439b2932e9538a6e", "score": "0.60622185", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend", "title": "" }, { "docid": "edaa96f7b7b71501439b2932e9538a6e", "score": "0.60622185", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend", "title": "" }, { "docid": "27a92ef1a5dc0ae065d12edd75dc7840", "score": "0.6050083", "text": "def prompt_git_branch\n if !is_git?\n return \"\"\n end\n stat = `git status`\n \"[#{stat.split(\"\\n\")[0].split(\" \")[-1]}]\".yellow\nend", "title": "" }, { "docid": "ea84928e1010e0dde871dfd5e1d79bb0", "score": "0.6047822", "text": "def project_commit(project, commit_id)\n get(\"/projects/#{project}/commits/#{commit_id}\")\n end", "title": "" }, { "docid": "4d052f17d3910d1de1298f2c7ac1bdd9", "score": "0.6031074", "text": "def add_commits_in_branch branch_name\n array_output_of(\"git log #{branch_name} --format='%h|%s|%an <%ae>' --topo-order --reverse\").each do |commit|\n sha, message, author = commit.split('|')\n next if message == 'Initial commit'\n @commit_list.add sha: sha, message: message, branch_name: branch_name, author: author\n end\n @commit_list\n end", "title": "" }, { "docid": "3fbf61442f47c9a08bd15abf7a864050", "score": "0.60304016", "text": "def branch\n @branch ||= `git branch 2> /dev/null`[/\\*\\s(.+)$/, 1]\n end", "title": "" }, { "docid": "518c462ababfe2a4f5c15954f95f77b4", "score": "0.6029597", "text": "def load_commits(branch)\n commits = []\n page = 1\n begin\n begin\n commits += Octokit.commits(\"#{@user}/#{@project}\", branch, :page => page)\n page += 1\n end while true\n rescue Octokit::NotFound\n end\n commits\n end", "title": "" }, { "docid": "1263ccf93af66a7d825c833c29ffd117", "score": "0.6023776", "text": "def commit_hash(branch_or_tag = nil)\n version = 'HEAD'\n working_dir do\n version = git 'rev-parse', branch_or_tag || 'HEAD'\n end\n version.strip\n end", "title": "" }, { "docid": "525efd8d1156fcacdfb6ab39241a4384", "score": "0.60176265", "text": "def source_branch\n git_call('branch').chomp.match(/\\*(.*)/)[0][2..-1]\n end", "title": "" }, { "docid": "02bf9de68e5d732fded59d531d0a2331", "score": "0.6012448", "text": "def ask_for_branch(git,message)\n branch = git_branches(git)\n return branch[0] if branch.size == 1\n ask_for_item(message,branch)\n end", "title": "" }, { "docid": "6235c8692377ece1e59c012d06d25542", "score": "0.6012177", "text": "def commit(project, sha)\n get(\"/projects/#{project}/repository/commits/#{sha}\")\n end", "title": "" }, { "docid": "3ce594f7c3204b43172b8f7a91532bbf", "score": "0.60036695", "text": "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", "title": "" }, { "docid": "4b14c018b3109ac4ce663fe7b031adaf", "score": "0.60028046", "text": "def branch(repo, branch, options = {})\n get \"#{Repository.path repo}/branches/#{branch}\", options\n end", "title": "" }, { "docid": "decef2481615030e586bc775358ed999", "score": "0.59804523", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend", "title": "" }, { "docid": "decef2481615030e586bc775358ed999", "score": "0.59804523", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend", "title": "" }, { "docid": "d5eeea33ba28a0074d1d53909282e137", "score": "0.5975054", "text": "def current_branch; end", "title": "" }, { "docid": "d5eeea33ba28a0074d1d53909282e137", "score": "0.5975054", "text": "def current_branch; end", "title": "" }, { "docid": "cb8088aa3bcf215e2547f6760e3c0a01", "score": "0.5973001", "text": "def derive_branch_name\n @config[:git][:branch] == 'preview' ? preview_branches.last : @config[:git][:branch]\n end", "title": "" }, { "docid": "0f6e715eb5a02a32d3f9b4b4979fc022", "score": "0.5964326", "text": "def commit_diff(project, sha)\n get(\"/projects/#{project}/repository/commits/#{sha}/diff\") \n end", "title": "" }, { "docid": "74e5b910a722ae4855d6fadf57407266", "score": "0.59502536", "text": "def new_commit(commit)\n puts cyan(\"Found new commit: #{commit}\")\n end", "title": "" }, { "docid": "074e6ad94523d59921f35ef159f2a741", "score": "0.5945077", "text": "def current_branch\n %x(git branch | grep '*' | cut -d' ' -f2).chomp\nend", "title": "" }, { "docid": "81fd927f8cc93d392344f7c0320a7668", "score": "0.5938442", "text": "def set_commit\n @commit = Commit.find_by_sha(params[:sha])\n end", "title": "" }, { "docid": "9a47a6068d87803f999069d90af66942", "score": "0.59255505", "text": "def diff_branch_summary(branch_name)\n `cd #{project_repo_path} && git diff #{self.trunk_branch}..#{branch_name} --summary --stat`\n end", "title": "" }, { "docid": "009e55161ebd883c24ab78b33ce4f489", "score": "0.59125", "text": "def branch\n `git rev-parse --abbrev-ref HEAD`.strip.presence\n rescue\n nil\n end", "title": "" }, { "docid": "d7ff8253a29856f8b63fdfa70beb4b17", "score": "0.5911982", "text": "def get_branch_sha\n cmd = \"git ls-remote '#@repo_url' | awk '/#@branch/ {print $1}'\"\n puts cmd\n @branch_sha ||= %x[#{cmd}].chomp\n raise 'Could not get branch sha!' unless $?.success?\n @branch_sha\n end", "title": "" }, { "docid": "82b93df5055f9515d8598a011b985b9a", "score": "0.58922386", "text": "def branch \n extra[\"branch\"] \n end", "title": "" }, { "docid": "751d0393db80e390d21090320d5face5", "score": "0.5877997", "text": "def current_branch\n Dir.chdir @root do\n cmd = \"git rev-parse --abbrev-ref HEAD\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /unknown revision/\n raise Error, \"could not determine branch of repo with no commits\"\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.strip\n end\n end", "title": "" }, { "docid": "4908f9a0ac829febe1b5764fa132f4af", "score": "0.58756673", "text": "def human_friendly_branch_information\n return git_fork_config.branch if git_fork_config.branch.to_s.length > 0\n return sha[0...7]\n end", "title": "" }, { "docid": "53848a35a0384ac29f7dd28b27e1098c", "score": "0.58719516", "text": "def show\n\n @branch = Branch.first.nil?\n if @branch\n flash[:notice] = \"Branches Table Empty\"\n\n else\n @branch = Branch.find(params[:id])\n end\n end", "title": "" }, { "docid": "3b40c4da72585348aeedab8d330697d4", "score": "0.58677846", "text": "def show\n respond_to do |format|\n format.json { render json: @commit, status: 200 }\n end\n end", "title": "" }, { "docid": "8257d4546aff8977ca074ada03c58b3d", "score": "0.58628076", "text": "def commit(repo, sha, options = {})\n get \"#{Repository.path repo}/commits/#{sha}\", options\n end", "title": "" }, { "docid": "7344a8b9751c53fc8562c59d99396e64", "score": "0.58626294", "text": "def show\n @labbranch = Labbranch.find(params[:id])\n render :layout => 'empty_layout'\n end", "title": "" }, { "docid": "1ade793ae0c09032db4dbfd7aa096124", "score": "0.58611655", "text": "def branch_details(branches, remote_url)\n markaby do\n branches.map do |branch|\n h2.toggler.open \"Branch #{branch.name}\", :id => branch.name.gsub(/ /, '')\n div.toggle.branch do\n image_gallery(branch) if Babygitter.output_graphs\n div.branch_details do\n author_links(branch)\n branch_synopsis(branch)\n hr :class => \"end_of_info\"\n h3.toggler.open \"#{branch.name} commit history\"\n div.toggle do\n ul do\n branch_committer_detail(branch, branch.commits, remote_url)\n end\n end\n hr :class => \"end_of_info\"\n author_details(branch.name, branch.authors, remote_url, branch.total_commits)\n end\n end\n hr :class => \"end_of_branch_info\"\n end\n end\n end", "title": "" }, { "docid": "81e8ccb5567852e6567e7851092f13f8", "score": "0.5859404", "text": "def commit_for(ref)\n @access.commit(ref)\n rescue Gollum::Git::NoSuchShaFound\n end", "title": "" }, { "docid": "e155a66426f81f3f833848e06b2a941b", "score": "0.58283764", "text": "def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n logger.info \"Deploying branch #{branch}\"\n branch\nend", "title": "" }, { "docid": "1f24987d8aab8f697754daa85a594820", "score": "0.582401", "text": "def branch_name\n $repo.current_branch\n end", "title": "" }, { "docid": "e794e479de761f1cb43296922a2ccfcc", "score": "0.5822496", "text": "def commit(id)\n Gitlab::Git::Commit.find(self, id)\n end", "title": "" }, { "docid": "51acff96141a63b8e5265ff6f32180cd", "score": "0.581825", "text": "def recent_builds_branch(branch, params)\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).get\n end", "title": "" }, { "docid": "929765e1a487f0b0404f32713361b4c2", "score": "0.58084273", "text": "def fetch_commit(repo_user,repo_name,sha)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/commits/#{sha}\")\n body = response_body(uri)\n if body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n body\n end\n end", "title": "" }, { "docid": "5042e2b9551f6f1fbfdb7a4a60b5edec", "score": "0.5796282", "text": "def existing_commit_summary(noteable, existing_commits, oldrev = nil)\n return '' if existing_commits.empty?\n\n count = existing_commits.size\n\n commit_ids = if count == 1\n existing_commits.first.short_id\n else\n if oldrev && !Gitlab::Git.blank_ref?(oldrev)\n \"#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}\"\n else\n \"#{existing_commits.first.short_id}..#{existing_commits.last.short_id}\"\n end\n end\n\n commits_text = \"#{count} commit\".pluralize(count)\n\n branch = noteable.target_branch\n branch = \"#{noteable.target_project_namespace}:#{branch}\" if noteable.for_fork?\n\n branch_name = content_tag('code', branch)\n content_tag('li', \"#{commit_ids} - #{commits_text} from branch #{branch_name}\".html_safe)\n end", "title": "" }, { "docid": "58e14622b604631ba0855fdc7540ff0e", "score": "0.5795572", "text": "def generate_git_commit_log(rev=ENV['LAST_SUCCESS_REV'])\n g = Git.open(Dir.getwd)\n change_log = g.log.between(rev).map { |c| \"- \" + c.message.lines.first.chomp }.join \"\\n\"\n \"Commit Log:\\n\\n#{change_log}\\n\"\nend", "title": "" }, { "docid": "58e14622b604631ba0855fdc7540ff0e", "score": "0.5795572", "text": "def generate_git_commit_log(rev=ENV['LAST_SUCCESS_REV'])\n g = Git.open(Dir.getwd)\n change_log = g.log.between(rev).map { |c| \"- \" + c.message.lines.first.chomp }.join \"\\n\"\n \"Commit Log:\\n\\n#{change_log}\\n\"\nend", "title": "" }, { "docid": "04e85dd493b9d6ca5a0bc8878d6c0f8c", "score": "0.57948154", "text": "def commitid\n \"#{@project[:id]}-#{currentbranch}-#{currentcommit}\"\n end", "title": "" }, { "docid": "abb78b96256f72c17a9fc6f9c89a43bb", "score": "0.5792609", "text": "def branch(branch)\n all.select { |r| r.branch == branch }\n end", "title": "" }, { "docid": "0d397c9bdcffc9847449e21f5feae743", "score": "0.5773773", "text": "def last_commit_sha(branch = @base_branch)\n if branch\n commits(@repo, branch, page: 1, per_page: 1)[0]['sha']\n else\n raise ArgumentError, 'Branch must be specified'\n end\n end", "title": "" }, { "docid": "e9c28de81a7f4c321b3bbc2c457c6c1e", "score": "0.576863", "text": "def show\n @xinwen = Xinwen.find(params[:id])\n @commits = @xinwen.commits\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xinwen }\n end\n end", "title": "" }, { "docid": "de30198ae86e1aa5c81ea45879746f46", "score": "0.5763242", "text": "def recent_builds_branch(branch, params = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).get\n end", "title": "" }, { "docid": "45c20187a3e33891398a9cbc8e4ab1c7", "score": "0.576165", "text": "def show_entry( pattern )\n\t\tdir = self.directory\n\t\tbranch = Treequel::Branch.new( dir, pattern )\n\n\t\tif !branch.exists?\n\t\t\tbranch = Treequel::Branch.new( dir, pattern + ',' + dir.base_dn )\n\t\tend\n\n\t\tif !branch.exists?\n\t\t\tbranch = dir.filter( pattern ).first\n\t\tend\n\n\t\tif !branch\n\t\t\tself.prompt.say( self.prompt.color(\"No match.\", :error) )\n\t\tend\n\n\t\tyaml = self.branch_as_yaml( branch )\n\t\tself.prompt.say( yaml )\n\tend", "title": "" }, { "docid": "8f0b38dee2c25ad94e9c6fbc6c5755bb", "score": "0.57594436", "text": "def get_git_branch()\n return `git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e \"s/* \\\\(.*\\\\)/\\\\1/\"`.strip\nend", "title": "" }, { "docid": "c8dfa87e2d8da7fd649f1386013758a3", "score": "0.5748599", "text": "def head\n git.get_head(branch)\n end", "title": "" }, { "docid": "c8dfa87e2d8da7fd649f1386013758a3", "score": "0.5748599", "text": "def head\n git.get_head(branch)\n end", "title": "" }, { "docid": "c4775e1fcc13d226ced37c628c75f742", "score": "0.5747826", "text": "def github_url\n \"http://github.com/280north/cappuccino/commit/#{sha1}\"\n end", "title": "" }, { "docid": "5fe5248b7d27d3d228e7f719cb3c72ff", "score": "0.5740493", "text": "def current_branch\n repo.branches.find(&:head?)\n end", "title": "" }, { "docid": "a733ed67a33f9b574bf2da0a0e9bc9ad", "score": "0.57380486", "text": "def initial_ref\n %x[git rev-parse #{branch}].chomp\nend", "title": "" }, { "docid": "e30e8cdafa608014b42f02c19f207175", "score": "0.57356876", "text": "def commit\n @commit ||= @repo.commit(@repo.head.commit)\n end", "title": "" }, { "docid": "687acea8af5c56e64435db5b16f359fd", "score": "0.57347685", "text": "def recent_revision(repo, branch = nil)\n branch ||= default_branch(repo)\n api.branch(repo, branch).commit.sha\n end", "title": "" }, { "docid": "fa5c0cc50f00e5de7a3f46ddd45ac84a", "score": "0.5731194", "text": "def track(branch)\n # git branch --track <branch>\n command('branch', '--track', branch)\n end", "title": "" }, { "docid": "8e9e0494c8328ce3780d30f116d078c1", "score": "0.5719495", "text": "def branches_containing_commit(commit_ref)\n `git branch --column=dense --contains #{commit_ref}`.\n sub(/\\((HEAD )?detached (from|at) .*?\\)/, ''). # ignore detached HEAD\n split(/\\s+/).\n reject { |s| s.empty? || s == '*' }\n end", "title": "" }, { "docid": "05fcd5568003ac9c9fdedd4d2454a975", "score": "0.57176805", "text": "def get_branch(status = `git status`)\n branch = nil\n if match = Regexp.new(\"^# On branch (.*)\").match(status)\n branch = match[1]\n end\nend", "title": "" }, { "docid": "37e7bfa73ee5cb51affccdac52fa0622", "score": "0.57136226", "text": "def branch(project_id, branch_id)\n params = { query: [project_id, branch_id] }\n\n data = endpoint(name: 'Branches', params: params).do_get\n\n resource 'Branch', data\n end", "title": "" } ]
a34eae97fd257f3c582bed74f2f57bb2
POST /invoices POST /invoices.json
[ { "docid": "e9f4d8acefd4d573e32fe7fcf7e3a9fa", "score": "0.0", "text": "def create\n @articles = Article.con_nombre_barcode(params[:q]) if params[:q].present?\n @invoice = Invoice.new(params[:invoice].merge(customer_id: params[:customer_id]))\n @id = @invoice.orders(params[:article_id])\n @quantity = Article.quantity_order(@id)\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoice_path(@invoice), notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "a721341fd23fce1b8c0db9e696384d08", "score": "0.7803801", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n if @invoice.save\n render json: @invoice, status: :created, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a9b36cd0695933472ca92470f3865313", "score": "0.75027424", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n if @invoice.save\n render :show, status: :created\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e73c47bbd01f253388f0acc14daa0bc6", "score": "0.7468397", "text": "def create(options = nil)\n request = Request.new(@client)\n path = \"/invoices\"\n data = {\n \"name\"=> @name, \n \"amount\"=> @amount, \n \"currency\"=> @currency, \n \"metadata\"=> @metadata, \n \"request_email\"=> @request_email, \n \"request_shipping\"=> @request_shipping, \n \"return_url\"=> @return_url, \n \"cancel_url\"=> @cancel_url\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n \n \n return_values.push(self.fill_with_data(body))\n \n\n \n return_values[0]\n end", "title": "" }, { "docid": "a8f2dbfb5b9fb51e3abed2c3344b8bfa", "score": "0.7402453", "text": "def create\n respond_to do |format|\n if @invoices.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d37e7590d2e3f3417fc14e1d0ad3295f", "score": "0.7373965", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d37e7590d2e3f3417fc14e1d0ad3295f", "score": "0.7373965", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d37e7590d2e3f3417fc14e1d0ad3295f", "score": "0.7373965", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d37e7590d2e3f3417fc14e1d0ad3295f", "score": "0.7373965", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98f40b08f41d31a4ee6180c17506706c", "score": "0.7323317", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: t('activerecord.attributes.invoice.create') }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e0fda31a4c15f07cc976a80ead984ae5", "score": "0.7267408", "text": "def create\n new_invoice = current_account.billing_strategy.create_invoice(invoice_params_create)\n respond_with(new_invoice)\n end", "title": "" }, { "docid": "e0fda31a4c15f07cc976a80ead984ae5", "score": "0.7267408", "text": "def create\n new_invoice = current_account.billing_strategy.create_invoice(invoice_params_create)\n respond_with(new_invoice)\n end", "title": "" }, { "docid": "adbffc1a0349a2d1a9b489e2d7615fc0", "score": "0.72499394", "text": "def create\n @invoice = Invoice.new(invoice_params)\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f65fef35efd79761a37c093a2782dd1", "score": "0.7241388", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f65fef35efd79761a37c093a2782dd1", "score": "0.7241388", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f65fef35efd79761a37c093a2782dd1", "score": "0.7241388", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f65fef35efd79761a37c093a2782dd1", "score": "0.7241388", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f65fef35efd79761a37c093a2782dd1", "score": "0.7241388", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cedb215d038d4b57046469f947e042f2", "score": "0.7240741", "text": "def create\n if params['id']\n member = Member.find(invoice_option_params[:member_id])\n raise ::Mongoid::Errors::DocumentNotFound.new(Member, { id: invoice_option_params[:member_id] }) if member.nil?\n invoice_option = InvoiceOption.find(invoice_option_params[:id])\n raise ::Mongoid::Errors::DocumentNotFound.new(InvoiceOption, { id: invoice_option_params[:id] }) if invoice_option.nil?\n if (invoice_option_params[:discount_id])\n discounts = ::BraintreeService::Discount.get_discounts(@gateway)\n invoice_discount = discounts.find { |d| d.id == invoice_option_params[:discount_id]}\n end\n invoice = invoice_option.build_invoice(member.id, Time.now, invoice_option_params[:resource_id], invoice_discount)\n else\n invoice = Invoice.new(create_invoice_params)\n invoice.save!\n end\n render json: invoice, adapter: :attributes and return\n end", "title": "" }, { "docid": "d7b6a3c4b1074b71b4a33aa8e1cf6edc", "score": "0.72316873", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: \"Invoice was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8282d377d522683343657a0e3f3fe919", "score": "0.72291684", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoices_path, notice: 'Invoice was successfully uploaded.' }\n format.json { render :index, status: :created, location: invoices_path }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ad615d857396f74db70aa2b904e1362", "score": "0.7205068", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "title": "" }, { "docid": "3a8ae1c403b22707a4ef71db65352a43", "score": "0.71769357", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a8ae1c403b22707a4ef71db65352a43", "score": "0.7176308", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a8ae1c403b22707a4ef71db65352a43", "score": "0.7176308", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a8ae1c403b22707a4ef71db65352a43", "score": "0.7176308", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e87d565f16aae15edcd54f041f5a5c9b", "score": "0.71627164", "text": "def create\n \n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Orden creada correctamente.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ecbf8c9bd3b831fdeae0f945abc5b42b", "score": "0.7154635", "text": "def create\n params[:all] = Hash[params[:invoice]]\n params[:invoice].delete_if {|key, value| key.include? \"visit\" }\n \n @invoice = Invoice.new(params[:invoice])\n \n respond_to do |format|\n if @invoice.save\n create_visits\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "840c5def9b3434c678cd86a9ed6729e0", "score": "0.7148403", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.created_user = current_user.login_name\n @invoice.invoice_details.each do |i|\n i.created_user = current_user.login_name\n end\n @invoice_method = InvoiceCalculation::METHODS\n @payment_terms = Invoice::PAYMENT_TERMS\n @display_sidebar = true\n @back_index = true\n @title = \"Client Invoices\"\n respond_to do |format|\n if @invoice.save\n @invoice.validate\n if params[:commit] == \"Update\"\n format.html { render action: \"new\", notice: 'Invoice was successfully created.' }\n else\n format.html { redirect_to invoice_path(@invoice), notice: 'Invoice was successfully created.' }\n end\n format.json { render json: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5355480c865e1631e10bae0f4eeba89d", "score": "0.71302134", "text": "def create_invoice(invoice)\n end", "title": "" }, { "docid": "70f7ebbd962647f6c2cc8299cd4fd9cd", "score": "0.709924", "text": "def create\n @invoice = current_user.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4cf60b08b6a7f2f1cd91be103fd3cdd", "score": "0.70976096", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoices_url, flash: { 'alert alert-success' => 'Invoice was successfully created.' }}\n format.json { render :show, status: :created, location: @invoice }\n else\n @orders = []\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ccc41fdadae92d1e29180d489a70f787", "score": "0.703217", "text": "def create\n @invoice = Invoice.new(invoice_params)\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoices_url } \n else\n format.html { render :new, notice: 'La Factura fue creada correctamente.' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e33444ad20e5b7ab4951bdf0c6fa8f4", "score": "0.7022547", "text": "def create\n @invoice = authorize company.invoices.build(create_params)\n if @invoice.save\n render 'show', status: :created\n else\n render json: { errors: @invoice.errors }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2206674d04f33b15fc02347a8323fff2", "score": "0.70139736", "text": "def create\n @invoice = Invoice.new(invoice_params)\n \n respond_to do |format|\n if @invoice.save\n format.html { redirect_to admin_invoice_path(@invoice), notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c172bc484ed0b75aa5ec3bdb49bcb02d", "score": "0.7003579", "text": "def create\n @account = SubledgerAccount.find_by_uuid(params[:account_id])\n if @account.nil?\n head(:status=>:not_found) \n return \n end\n\n invoice_complete = params[:invoice].delete(:complete)\n Invoice.transaction do\n line_items = params[:invoice].delete(:invoice_lines)\n @invoice = @account.invoices.build(params[:invoice])\n line_items.each{|line_item| @invoice.invoice_lines << InvoiceLine.new(line_item)} if line_items\n end\n\n respond_to do |format|\n if @invoice.save\n @invoice.close! if invoice_complete\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to account_invoice_url(:account_id=>@account.uuid, :id=>@invoice.id) }\n format.xml { render :xml => @invoice.to_xml(:include=>[:invoice_lines, :invoice_payments]), \n :status => :created, \n :location => account_invoice_url(:account_id=>@account.uuid, :id=>@invoice.id) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad0bcaec7cf744a2390ce14196f80b64", "score": "0.69962955", "text": "def create\n @invoice = Invoice.new(params.require(:invoice).permit(:customer_id, :date_time, :invoice_number, :status))\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoices_url,\n notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n prepFormVariables(@invoice)\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "30720d366d9771abfec8a87fcacbb949", "score": "0.69906276", "text": "def new\n @invoice = Invoice.new\n @invoices = Invoice.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "title": "" }, { "docid": "203c206509d8d843e3b62f26b8a2a617", "score": "0.696217", "text": "def create\n # @orig_invoicable - in case the subcon issuing the invoice, the created invoice should be associated with the contractor ticket,\n # so @orig_invoiceable holds the subcon ticket used for the redirection\n respond_to do |format|\n if @invoice.save\n format.any(:html, :mobile) {\n redirect_to @orig_invoiceable, notice: 'Invoice was successfully created.'\n }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n flash[:error] = \"Failed to create the invoice. #{humanized_errors}\".html_safe\n format.html { redirect_to @orig_invoiceable }\n format.mobile { redirect_to invoices_path(params) }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "89878ec5b76aad05676fe7586e317b95", "score": "0.6935311", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to supplier_invoices_path, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "650ad183d0a217ea1474bb6a3b021061", "score": "0.6934206", "text": "def create\n @invoice = Invoice.new(invoice_params)\n @invoice.user_id=current_user.id\n @invoice.trips=format_trips(params[:trips])\n @invoice.brutto_price=params[:brutto_price]\n @invoice.netto_price=params[:netto_price]\n @invoice.taxes=params[:taxes]\n\n respond_to do |format|\n if @invoice.save\n #format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { \n puts 'success ran'\n render json: {:redirect_url => '/invoices/'+@invoice.id.to_s}, status: :created \n #render action: 'show', status: :created, location: @invoice \n }\n else\n \tputs 'error ran'\n #format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bdc333129af1b90cd558b401a126f20", "score": "0.6915595", "text": "def create\n @invoice = Invoice.new(invoice_params)\n \n @invoice.user_id = current_user.id\n if @invoice.status == 'paid'\n amount = params[:amount]\n @invoice.totalpaid = @invoice.amount\n end\n \n respond_to do |format|\n if @invoice.save\n set_formatted_dates()\n rate = params[:rate]\n quantity = params[:quantity]\n desc = params[:desc]\n \n rate.zip(quantity,desc).each do |rat, quan, desc|\n @lineitem = LineItem.create(price: rat, quantity: quan, description: desc, invoices_id: @invoice.id)\n @lineitem.save\n end\n format.html { redirect_to invoices_path, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d82d7f3bfa25d273bace7fe5bcff8f81", "score": "0.68969905", "text": "def show_invoices\n data = {\n invoices: @subscription.invoices\n }\n\n render json: data\n end", "title": "" }, { "docid": "299e418029b2486dd73e0ef91fa94bac", "score": "0.68904", "text": "def post_invoice(invoice)\n uri = 'https://api.xero.com/api.xro/2.0/Invoice'\n response = send(uri, create_invoice(invoice))\n\n parse_response(response) do |r|\n invoice.invoicing_system_id = extract_invoice_id(r)\n end\n invoice\n end", "title": "" }, { "docid": "a782035639ec9304ae6b25585abec039", "score": "0.68879384", "text": "def create\n @invoice = @conference.invoices.new(invoice_params)\n @payment = Payment.find(params[:payment_id]) if params[:payment_id].present?\n @user = @payment.try(:user)\n\n if params[:invoice][:ticket_purchase_ids].present?\n ticket_purchase_ids = params[:invoice][:ticket_purchase_ids].map{ |x| x.split(',') }.flatten.map(&:to_i)\n ticket_purchases = TicketPurchase.where(id: ticket_purchase_ids)\n\n @invoice.ticket_purchase_ids = ticket_purchases.pluck(:id)\n end\n\n respond_to do |format|\n if @invoice.save\n format.html {\n EmailInvoiceJob.perform_later(@invoice.recipient, @conference)\n\n redirect_to admin_conference_invoice_path(@conference.short_title, @invoice), notice: 'Invoice was successfully created.'\n }\n format.json { render json: @invoice, status: :created }\n else\n ticket_purchases = @invoice.recipient&.ticket_purchases&.where(conference: @conference)&.where&.not(ticket: nil) || []\n @tickets_grouped = tickets_grouped(ticket_purchases, user: @invoice.recipient)\n @tickets_collection = tickets_collection(@tickets_grouped)\n @tickets_selected = tickets_selected(@tickets_grouped)\n @overall_discount = Payment.where(id: ticket_purchases.pluck(:payment_id)).sum(&:overall_discount)\n\n @url = admin_conference_invoices_path(@conference.short_title)\n\n flash[:error] = 'Could not create invoice. ' + @invoice.errors.full_messages.to_sentence\n\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d501d14123c745abaa1b09ec812891b", "score": "0.6881182", "text": "def create\n @invoiceline = Invoiceline.new(invoiceline_params)\n @invoiceline.invoice = Invoice.find(params[:invoice_id])\n\n respond_to do |format|\n if @invoiceline.save\n format.html { redirect_to edit_invoice_path(@invoiceline.invoice), notice: 'Ligne créé.' }\n format.json { render :show, status: :created, location: @invoiceline }\n else\n format.html { render :new }\n format.json { render json: @invoiceline.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba3306cd340816bece2922073f0b8d0f", "score": "0.6861619", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.user_id = current_user.id\n @invoice.client_id = Client.find_by_name(params[:invoice][:client_name]).id\n @invoice.number = Client.find(@invoice.client_id).invoices.count + 1\n @invoice.rand = current_user.name.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')+'-'+SecureRandom.hex(16)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created. Rake in that money.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b70f8527ba236c948727e545b63c66e2", "score": "0.68586963", "text": "def create\n @invoice = Invoice.new(invoice_params.merge(invoice_date: Date.current))\n\n rowsParam = params[:invoice][:invoice_rows]\n rows = rowsParam.map do |row|\n data = row[1]\n { desc: data[:desc], units: data[:units], price: data[:price] }\n end\n\n respond_to do |format|\n if @invoice.save\n\n rows.each do |row|\n @invoice.invoice_row.create(row)\n end\n\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35d0b2f23717f9ad46da978a9dca28c4", "score": "0.68353564", "text": "def create\n @invoice = current_user.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Uw factuur is opgeslagen.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { @invoice.build_company\n @invoice.products.build\n @invoice.build_customer\n render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9dac0dac61cf04c4435fef469396f964", "score": "0.683476", "text": "def create\n @breadcrumb = 'create'\n @invoice = Invoice.new(params[:invoice])\n @invoice.created_by = current_user.id if !current_user.nil?\n\n # manually handle authorization\n authorize! :create, @invoice\n\n respond_to do |format|\n #\n # Must create associated bill\n #\n bill_id = bill_create(params[:Project],\n params[:Client],\n params[:invoice][:invoice_date].to_date,\n params[:invoice][:payment_method_id].to_i)\n @invoice.bill_id = bill_id == 0 ? nil : bill_id\n @invoice.invoice_operation_id = InvoiceOperation::INVOICE\n @invoice.biller_id = Project.find(params[:Project]).company_id\n\n # Go on\n if @invoice.save\n format.html { redirect_to commercial_billing_path(@invoice), notice: crud_notice('created', @invoice) }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n @organizations, @include_blank = organizations_according_oco\n @sale_offers = sale_offers_dropdown\n @projects = projects_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n # @clients = clients_dropdown\n @client = \" \"\n @payment_methods = payment_methods_dropdown\n @status = invoice_statuses_dropdown if @status.nil?\n @types = invoice_types_dropdown if @types.nil?\n @operations = invoice_operations_dropdown if @operations.nil?\n # @products = products_dropdown\n # @offer_items = []\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2acada1c60d7cc996494dd3592b761f0", "score": "0.6823735", "text": "def create\n @customer = Customer.find(params[:customer_id])\n @invoice = @customer.invoices.new(invoice_params)\n @invoice.store_id = current_store.id\n @invoice.user_id = current_user.id\n @invoice.customer_id = @customer.id\n authorize Invoice\n\n unless params[:invoice][:line_items_attributes] || params[:invoice][:payments_attributes]\n redirect_to new_customer_invoice_path(@customer), notice: \"You tried to create a blank sale invoice.\" and return\n end\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { redirect_to new_customer_invoice_path(@customer), notice: @invoice.errors }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36c6445365311f23cfcac489064a8cca", "score": "0.68104094", "text": "def create\n if params[:client_id]\n @client = Client.find(params[:client_id])\n @invoice = @client.invoices.new(invoice_params)\n else \n @invoice = Invoice.new(invoice_params)\n end\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to ([:admin, @invoice]), notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8243efa98289cb21f31cb0cf5b6c4fe7", "score": "0.6807276", "text": "def create\n @invoce = Invoce.new(invoce_params)\n\n respond_to do |format|\n if @invoce.save\n format.html { redirect_to @invoce, notice: t(:successfully_updated_invoice) }\n format.json { render action: 'show', status: :created, location: @invoce }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoce.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3678f933874cbfb44323a154f82df6e", "score": "0.6798705", "text": "def new\n @invoice = Invoice.new\n @invoice.line_items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "title": "" }, { "docid": "e3b5b3695acad211d46ef501880b2df7", "score": "0.6798575", "text": "def create\n params[:invoice][:user_id]= current_user.id\n @invoice = Invoice.new(params[:invoice])\n \n respond_to do |format|\n if @invoice.save\n params[:services].each_value {|service| @invoice.services << Service.find_by_description(service)}\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e2fca76928de8e51da3da4e457255c4", "score": "0.6789777", "text": "def create_sales_invoice(data, _options = {})\n lines = data.delete(:line_items)\n\n if lines\n data[:line_items_attributes] = {}\n lines.each_with_index do |value, index|\n data[:line_items_attributes][index] = value\n end\n end\n\n post 'sales_invoices', sales_invoice: data\n end", "title": "" }, { "docid": "7ead43a29aa9cc688204b05b50d24e1c", "score": "0.67801005", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n @invoice.scoop_loose_invoice_items\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to(invoices_url) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf86b79a2cadc7d681f925942a341d2c", "score": "0.6750691", "text": "def create\n invoice_id = params[:invoice_payment][:invoice_id]\n @invoice_payment = InvoicePayment.new(invoice_payment_params)\n\n respond_to do |format|\n if @invoice_payment.save\n @invoice_data = Invoice.find(@invoice_payment.invoice_id)\n Invoice.find(@invoice_payment.invoice_id).update(balance_amount: 0, paid_status: true)\n CompanyInventoryStock.company_stock_update_after_invoice(invoice_id)\n FranchiseeInventoryStock.franchisee_stock_update_after_invoice(invoice_id)\n format.html { redirect_to invoices_url, notice: 'Invoice payment was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_payment }\n else\n format.html { render :new }\n format.json { render json: @invoice_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7ce0b1d766b98c48333de9a548879d8", "score": "0.6747893", "text": "def create\n # @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to project_invoice_path(project_id: @project.id, id: @invoice.id), notice: \"Invoice was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e20b47aa88e88870997fbf69751e6c7", "score": "0.67391074", "text": "def index\n @invoices = Invoice.all\n\n render json: @invoices\n end", "title": "" }, { "docid": "6e6d63715d0143535d1f37e918c529fe", "score": "0.6732772", "text": "def create\n @invoice = Invoice.new(invoice_params)\n @invoice.date = Time.now\n respond_to do |format|\n if @invoice.save\n update_status\n format.html {\n flash[:notice] = 'La Factura Interna se creó satisfactoriamente.'\n redirect_to invoices_path\n }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html {\n flash[:error] = @invoice.errors\n redirect_to new_invoice_path\n }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b6204984ecf761aba9e4c044782bcb2", "score": "0.6732675", "text": "def create\n @invoice_line = InvoiceLine.new(invoice_line_params)\n\n if @invoice_line.save\n render json: @invoice_line, status: :created, location: @invoice_line\n else\n render json: @invoice_line.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "4ddb9d225f22f7842d3a9dd0b9d4bcd9", "score": "0.6732", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n if !@invoice.contract_id.nil?\n format.html { redirect_to Contract.all.find(@invoice.contract_id), notice: 'Invoice was successfully created.' }\n elsif !@invoice.order_id.nil?\n format.html { redirect_to Contract.all.find(Order.all.find(@invoice.order_id).contract_id), notice: 'Invoice was successfully created.' }\n else\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n end\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a9caf735f215e1ba0a8bbadc1d7784b", "score": "0.6716461", "text": "def create_invoice(client_id, issued, amount, invoice_id, term, comments=\"\")\n create_record \"/create/invoice\", :client_id => client_id,\n :issued => issued,\n :amount => amount,\n :invoice_id => invoice_id,\n :term => term,\n :comments => comments\n end", "title": "" }, { "docid": "f026c055f6b80702ec322b618230a715", "score": "0.6711019", "text": "def create_invoice_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: InvoicesApi.create_invoice ...\"\n end\n # resource path\n local_var_path = \"/invoices\"\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(opts[:'req'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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<InvoiceResource>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvoicesApi#create_invoice\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7e469de4973a87d1d4cb40d83a0e73dc", "score": "0.67085475", "text": "def create\n @user = current_user\n @patient = @user.patients.find(params[:patient_id])\n @invoice = @patient.invoices.new(params[:invoice])\n @invoice.insurance_id = @patient.insurance.id\n @invoice.sum = 0\n \n respond_to do |format|\n if @invoice.save\n format.html { redirect_to user_patient_invoice_path(@user, @patient, @invoice), notice: 'Invoice was successfully created.' }\n format.json { render json: user_patient_invoice_path(@user, @patient, @invoice), status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "218174d9f912f1b30aa21e5591e686b3", "score": "0.6695536", "text": "def initialize invoice\n @nfe_invoice = invoice\n @receipt = @nfe_invoice.receipt\n @nfe_company = @nfe_invoice.clinic.nfe_company\n\n response = create\n end", "title": "" }, { "docid": "1cc9314263822e2693c5c94ae68fb6f2", "score": "0.6691478", "text": "def create\n @invoice = Invoice.find(params[:invoice_id])\n @purchase = Purchase.new(purchase_params)\n @purchase.invoice = @invoice\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @invoice, notice: \"Purchase was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice}\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a61ed4be6fcbb02fd147b9e9a655fbd", "score": "0.6689903", "text": "def create\n @payment_invoice = PaymentInvoice.new(params[:payment_invoice])\n\n respond_to do |format|\n if @payment_invoice.save\n format.html { redirect_to payment_invoices_path, notice: 'Payment invoice was successfully created.' }\n format.json { render json: @payment_invoice, status: :created, location: @payment_invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19432e69e310dce96b7c1770154f2ba5", "score": "0.66864455", "text": "def create\n @invoice = current_user.invoices.new(invoice_params)\n @invoice.user = current_user\n\n respond_to do |format|\n if @invoice.save\n\n session[:storage].each do |id|\n @invoicedetail = @invoice.invoicedetails.new\n @invoicedetail.project_id = id\n @invoicedetail.save\n end\n\n session[:storage].clear\n\n format.html { redirect_to invoices_path, notice: t(\"controllers.invoice.success_created\") }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "606f9587497710f7bdd8bbe9fea258b1", "score": "0.6685684", "text": "def create(options)\n @client.ensure_valid_attributes options\n @client.ensure_presence_of_attributes %w(value return_url), options\n response = @client.make_request('create-invoice', options)\n\n token = response.delete(:invoice_token)\n response[:token] = token\n response[:payment_url] = response.delete(:invoice_location) || \"#{Litepaid::Client::INVOICE_URL}/id:#{token}\"\n\n new_record response\n end", "title": "" }, { "docid": "db537843926213fbd778c6b3fd9630a6", "score": "0.6684959", "text": "def create_purchase_invoice(data, _options = {})\n lines = data.delete(:line_items)\n\n if lines\n data[:line_items_attributes] = {}\n lines.each_with_index do |value, index|\n data[:line_items_attributes][index] = value\n end\n end\n\n post 'purchase_invoices', purchase_invoice: data\n end", "title": "" }, { "docid": "2fb0c3e672f7022c451b37121fac6781", "score": "0.667802", "text": "def create\n @service = Service.find(params[:service_id])\n @invoice = @service.invoices.create(invoice_params)\n respond_to do |format|\n if @invoice.save\n\n InvoiceMailer.new_invoice(@service, @invoice).deliver\n\n\n format.html { redirect_to service_invoices_url, location: [@invoice.service, @invoice], notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: [@invoice.service, @invoice] }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ff16670d76bcada10b04f7d751bbf98", "score": "0.66773635", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoices_url, notice: \"Invoice was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice }\n else\n @project = @invoice.project\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8896c64682f87b137649c19447ea53bb", "score": "0.66685605", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to [:account,@invoice], notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e178093c1e0b3f207de847b9c317000", "score": "0.6665217", "text": "def simulator\n @invoice = Invoice.new(:contract_monthly_rent => params[:invoice][:contract_monthly_rent])\n render json: @invoice\n end", "title": "" }, { "docid": "e4bb4d545126741c3e7e43fbfb51e276", "score": "0.66592324", "text": "def create\n @detail_invoice = DetailInvoice.new(detail_invoice_params)\n\n respond_to do |format|\n if @detail_invoice.save\n format.html { redirect_to @detail_invoice, notice: 'Detail invoice was successfully created.' }\n format.json { render :show, status: :created, location: @detail_invoice }\n else\n format.html { render :new }\n format.json { render json: @detail_invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fea6662108d2416814c8d8e8ac3b9e8", "score": "0.6654735", "text": "def new\n @invoice = Invoice.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "title": "" }, { "docid": "ef20ac26378bc0752a2c2f27ab370293", "score": "0.66516274", "text": "def create\n plan = Plan.where(id:params[:plan_id].to_i).select(:price,:fees).first\n price = (plan.price.to_f / BittrexInt.btc_usd).to_f.round(6) if params[:currency_id].to_i == 12\n price = (plan.price.to_f / (BittrexInt.btc_usd * BittrexInt.ltc_btc)).to_f.round(6) if params[:currency_id].to_i == 13\n fees = (plan.fees.to_f / BittrexInt.btc_usd).to_f.round(6) if params[:currency_id].to_i == 12\n fees = (plan.fees.to_f / (BittrexInt.btc_usd * BittrexInt.ltc_btc)).to_f.round(6) if params[:currency_id].to_i == 13\n wallet = Blockio.generate_wallet(@current_user.username.to_s + '_' + SecureRandom.uuid, params[:currency_id].to_i)\n @invoice = Invoice.new(invoice_params)\n \n if @current_user.has_attribute?(:ancestry)\n @invoice.user_id = @current_user.id\n client = @invoice.user\n else\n @invoice.temp_user_id = @current_user.id\n client = @invoice.temp_user\n end\n \n @invoice.invoice_status_id = 11\n @invoice.wallet = wallet\n @invoice.price = price.round(6)\n @invoice.fees = fees.round(6)\n\n if @invoice.save\n invoice = Invoice.find_by(uuid: @invoice.uuid)\n EmailNotification.send_invoice(client,@invoice) if invoice\n render json: filter(invoice), status: :ok\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "74fd0eb872a0c8a2470fd6004dca9cbd", "score": "0.6643736", "text": "def collect_invoice(shop_id, order_id, invoice)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/invoices\", body: invoice).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end", "title": "" }, { "docid": "acd2930fd5a3c3a3b6d560b843a0ccbe", "score": "0.6637583", "text": "def add_purchase_invoice_with_http_info(purchase_invoices, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PurchaseInvoiceApi.add_purchase_invoice ...'\n end\n # verify the required parameter 'purchase_invoices' is set\n if @api_client.config.client_side_validation && purchase_invoices.nil?\n fail ArgumentError, \"Missing the required parameter 'purchase_invoices' when calling PurchaseInvoiceApi.add_purchase_invoice\"\n end\n # resource path\n local_var_path = '/purchase_invoices'\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(purchase_invoices)\n auth_names = ['api_key']\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 => 'PurchaseInvoice')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PurchaseInvoiceApi#add_purchase_invoice\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c1af316b180580fd2caacab231a67e60", "score": "0.6635519", "text": "def create\n @iinvoice = Iinvoice.new(iinvoice_params)\n\n respond_to do |format|\n if @iinvoice.save\n format.html { redirect_to @iinvoice, notice: 'Iinvoice was successfully created.' }\n format.json { render :show, status: :created, location: @iinvoice }\n else\n format.html { render :new }\n format.json { render json: @iinvoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c65fce43576e488a6f790098b98e056", "score": "0.66315144", "text": "def create_invoice_using_post_with_http_info(invoice, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvoiceApi.create_invoice_using_post ...'\n end\n # verify the required parameter 'invoice' is set\n if @api_client.config.client_side_validation && invoice.nil?\n fail ArgumentError, \"Missing the required parameter 'invoice' when calling InvoiceApi.create_invoice_using_post\"\n end\n # resource path\n local_var_path = '/invoice'\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(invoice)\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 => 'Invoice')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvoiceApi#create_invoice_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "17987245f245e4eb51855284b8da5708", "score": "0.66312736", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n \n #Embedded Documents\n values = params[:datavalues]\n\n if values\n values.each do |f|\n @invoice.datavalues.create!(:name => f['name'], :fieldType => f['fieldType'])\n end\n end\n\n creatorName = @invoice.creatorName.gsub(' ','%20')\n signeeName = @invoice.signeeName.gsub(' ','%20')\n\n #Set email content. \n subject = \"Solicitud%20de%20Contrato\"\n footer = \"%0D%0DGracias,%0D%0D%5F%5F%0D%0D#{creatorName}\"\n message = \"El%20siguiente%20documento%20requiere%20su%20firma%20para%20aprobaci%C3%B3n.%0D%0Dhttp://tonkabeta.kytelabs.com/examples/require-drawn-signature.html?signatureid=#{@invoice.id}#{footer}\"\n email = \"https://sendgrid.com/api/mail.send.json?api_user=rgonzalez&api_key=123456&to=#{@invoice['signeeEmail']}&toname=#{signeeName}&subject=#{subject}&text=#{message}&from=#{@invoice['creatorEmail']}&fromname=#{creatorName}\"\n\n #Send email to request signature (with Sendgrid)\n HTTParty.get(email)\n\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity, :callback => params[:callback] }\n end\n end\n end", "title": "" }, { "docid": "503759fcdfbcfcb3d794044d31259461", "score": "0.66222805", "text": "def new\n \n @invoice = @customer.invoices.new\n 1.times {@invoice.orders.build}\n 1.times {@invoice.payments.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "title": "" }, { "docid": "ea03d2692768fea53d389fac00c50ff5", "score": "0.6618418", "text": "def create\n @invoice = Invoice.create(invoice_params)\n @clients = Client.all\n @currencies = Currency.all\n @clients_array = @clients.map { |client| [client.name, client.id] }\n @currencies_array = @currencies.map { |currency| [currency.title, currency.id] }\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e009de3ce96377be3fdd65598657828", "score": "0.6611261", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(edit_invoice_path( @invoice), :notice => 'Invoice was successfully created.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f67dcd5642756657d5b0a4309760b02", "score": "0.66100186", "text": "def create\n @invoice_detail = InvoiceDetail.new(params[:invoice_detail])\n\n respond_to do |format|\n if @invoice_detail.save\n format.html { redirect_to @invoice_detail.invoice, notice: 'Invoice detail was successfully created.' }\n format.json { render json: @invoice_detail, status: :created, location: @invoice_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b618c32045375cbfc43c46be64d9108", "score": "0.66041714", "text": "def create\n @invoice = current_user.invoices.build(invoice_params)\n @invoice.number = \"#{Time.now.to_i}-#{rand.to_s[2..3]}\"\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to edit_invoice_path(@invoice), notice: \"Invoice was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0fba2470c23a4b86947e6a5ac60a85ca", "score": "0.6601492", "text": "def invoice_params\n params.require(:invoice).permit(:number, :client_id, :description, :amount, :date_invoiced, :date_paid)\n end", "title": "" }, { "docid": "b048239570b6626faf638dfb07b0c1c2", "score": "0.65944743", "text": "def create\n @invoice = Invoice.new(invoice_params)\n @invoice.user_id = @user.id\n set_property_id(@invoice)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c970d4ad2beaf961357d08c5741d3e3f", "score": "0.6592757", "text": "def create\n @invoice = Invoice.new(invoice_params)\n @invoice.user = current_user\n @invoice.seller = current_user unless params[:invoice][:seller_id].present?\n @invoice.store = current_store\n\n @invoice.date = Date.today\n @invoice.time = Time.now\n\n respond_to do |format|\n if @invoice.save\n @invoice.code = build_code(\"HD\", @invoice)\n\n params[:invoice][:orderProducts].each do |product|\n pi = ProductInvoice.new\n pi.invoice = @invoice\n pi.product_id = product['id']\n pi.quantity = product['quantity']\n pi.unit_price = product['sale_price']\n pi.discount_percent = product['discount_percent']\n pi.discount_money = product['discount_money']\n pi.final_price = product['final_price']\n pi.save\n end if params[:invoice].present? && params[:invoice][:orderProducts].present?\n @invoice.update_price\n @invoice.status = :completed\n @invoice.save\n\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, serializer: InvoiceSerializer }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "344868e7dc518d176736bfd39d19ca18", "score": "0.65921926", "text": "def search_invoices(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/invoices/search',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "title": "" }, { "docid": "782c8551d8dfd18d9bf3e89b507cb16f", "score": "0.6582614", "text": "def create\n\t\t@invoice = Invoice.new(params[:invoice].merge({project_user_relation_id: params[:project_user_relation_id]}))\n\t\t@relation = @invoice.project_user_relation\n\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @invoice.save\n\t\t\t\tformat.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n\t\t\t\tformat.json { render json: @invoice, status: :created, location: @invoice }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @invoice.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "98a6136e7d12096c416758299090236d", "score": "0.6577105", "text": "def create\n @pagetitle = \"New invoice\"\n @action_txt = \"Create\"\n \n items = params[:items].split(\",\")\n \n @invoice = Invoice.new(params[:invoice])\n \n @company = Company.find(params[:invoice][:company_id])\n \n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n \n @invoice[:subtotal] = @invoice.get_subtotal(items)\n \n begin\n @invoice[:tax] = @invoice.get_tax(items, @invoice[:customer_id])\n rescue\n @invoice[:tax] = 0\n end\n \n @invoice[:total] = @invoice[:subtotal] + @invoice[:tax]\n \n if(params[:invoice][:user_id] and params[:invoice][:user_id] != \"\")\n curr_seller = User.find(params[:invoice][:user_id])\n @ac_user = curr_seller.username\n end\n\n respond_to do |format|\n if @invoice.save\n # Create products for kit\n @invoice.add_products(items)\n \n # Check if we gotta process the invoice\n @invoice.process()\n \n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully created.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "345d389b7f4ba2a78958e650a9beb8f4", "score": "0.65766317", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to(@invoice) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "345d389b7f4ba2a78958e650a9beb8f4", "score": "0.65766317", "text": "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to(@invoice) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3527902c3a2c1bf221a1c77b1f761fd2", "score": "0.6575659", "text": "def create\n entries = []\n params[:invoice].each do |key, value|\n if key.include? \"time_entry\"\n entries.push(TimeEntry.find(value)) unless value == \"\"\n end\n end\n\n @invoice = Invoice.new()\n @invoice.time_entries = entries\n @invoice.user = current_user\n @invoice.account = entries.first.account\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36d596092c431521ccf1cc11c53b594d", "score": "0.657157", "text": "def create\n authorize(:invoice)\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save!\n\n # Send invoice in with delayed job on a separate process\n InvoiceMailer.delay.unpaid_invoice_request(@invoice)\n\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n # Retrieve the current admission, in case of null failure, staff has to restart\n @admission = session[:current_invoicing_admission]\n\n format.html { render :new }\n # Todo handle errors as this redirects to the find form\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5af084f453c874103f8d7f299c3eb1e9", "score": "0.65542996", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "title": "" }, { "docid": "5af084f453c874103f8d7f299c3eb1e9", "score": "0.65542996", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "title": "" }, { "docid": "bb9b54e0fee2324cc6e0c3229102b142", "score": "0.6551056", "text": "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end", "title": "" } ]
e09e3b49a5ec548b3bec421d8695597c
Throw the given HTTP status code. When used, the execution of a callback or of an action is interrupted and the control returns to the framework, that decides how to handle the event. It also sets the response body with the message associated to the code (eg 404 will set `"Not Found"`).
[ { "docid": "0da6c084eb1f664cf3351e18d222899d", "score": "0.7751757", "text": "def throw(code)\n status(*Http::Status.for_code(code))\n super :halt\n end", "title": "" } ]
[ { "docid": "e9e7583e9b0209ca26b69d46335fbae9", "score": "0.7373082", "text": "def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\n end", "title": "" }, { "docid": "7ffae2fdc0b02ca3a31cc60416c7a0c7", "score": "0.72291726", "text": "def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end", "title": "" }, { "docid": "94c706f54c6304d0343e456d7f3c5900", "score": "0.72035986", "text": "def error code, body=nil\n code, body = 500, code if code.respond_to? :to_str\n @response.body = body unless body.nil?\n halt code\n end", "title": "" }, { "docid": "4a3bc7f4a0fcf494d1440e3cc347b0f4", "score": "0.7115689", "text": "def status(code)\n response.status = code\n end", "title": "" }, { "docid": "64f07e620846ed0406bba4fbaf561764", "score": "0.70454156", "text": "def status(code)\n @response.status = code\n end", "title": "" }, { "docid": "5ff46b78b11a523a8e615c3910237a1b", "score": "0.68669206", "text": "def handleHTTPStatus(code)\n case code\n when 200 # Ok\n puts \"HTTP request successful\"\n return true\n when 204\n puts \"HTTP Error: No Content\"\n return false\n when 401\n puts \"HTTP Error: Server rejected authentication.\"\n return false\n else\n puts \"Unhandled HTTP status: #{code}\"\n return false\n end # case code\n end", "title": "" }, { "docid": "7e13d7be53c18a969e090b880f494c17", "score": "0.68382424", "text": "def http_response_code(status = nil)\n if status\n @status = status\n else\n @status\n end\n end", "title": "" }, { "docid": "295d00c8900557f38650fa13926d4580", "score": "0.6747198", "text": "def error_response(status_code, message=nil)\n message ||= \"Your request has been denied as a #{status_code} error\"\n raise select_error(status_code), message\n end", "title": "" }, { "docid": "7fa6278ff9b96799e553675879c7f2fd", "score": "0.6730939", "text": "def respond_with(status_code)\n response.status = status_code\n response.write ''\n nil\n end", "title": "" }, { "docid": "291da03b83b5060f59874c2157601285", "score": "0.6727332", "text": "def status_code\n 500 # This should not be called directly\n end", "title": "" }, { "docid": "bee2c10bd8472d7568c407ef5307c203", "score": "0.6714071", "text": "def respond_with(status_code)\n response.status = status_code\n response.write \"\"\n nil\n end", "title": "" }, { "docid": "59a4168989c33a6b7cc5ac70e3b3131f", "score": "0.6697063", "text": "def set_status_code\n if self.status_code.nil?\n self.status_code = \"200\"\n end\n end", "title": "" }, { "docid": "cf57117a07edd2bf1b6af848855c69e8", "score": "0.6644664", "text": "def status(code, message)\n self.status = code\n self.body = message\n end", "title": "" }, { "docid": "cf57117a07edd2bf1b6af848855c69e8", "score": "0.6644664", "text": "def status(code, message)\n self.status = code\n self.body = message\n end", "title": "" }, { "docid": "023b0dc2b5d2beec5fd7140803822995", "score": "0.66005266", "text": "def status code=nil\n @response.status = code if code\n @response.status\n end", "title": "" }, { "docid": "28c8bbe840181bbf5b548d71a5b8bc37", "score": "0.65666604", "text": "def render_error(msg, code=500)\n respond_with(nil, :status => {:msg => msg, :code => code})\n end", "title": "" }, { "docid": "f0e9b1c47231cb0ba593d5d8a9fd0585", "score": "0.65497434", "text": "def halt_with_error(error_code, error_message)\n json_h = { error_message: error_message }\n headers = { \"Content-Type\" => \"application/json\" }\n response = [error_code, headers, [json_h.to_json]]\n throw(HALT, response)\n end", "title": "" }, { "docid": "192b8ea9e4f58cb9eec2a72fa4ff32b1", "score": "0.6536156", "text": "def status_code\n params[:code] || 500\n end", "title": "" }, { "docid": "192b8ea9e4f58cb9eec2a72fa4ff32b1", "score": "0.6536156", "text": "def status_code\n params[:code] || 500\n end", "title": "" }, { "docid": "08310b8ecd4beaa15f9405b9b665f2a9", "score": "0.65051204", "text": "def set_http_code(h_c)\n if h_c.nil?\n @http_code = 200\n else\n @http_code = h_c.to_i\n end\n end", "title": "" }, { "docid": "84cb34b153bf86816776782873cfd207", "score": "0.64748085", "text": "def error(message, code)\n error_response = {\n message: message\n }\n render :json => error_response, :status => code\n end", "title": "" }, { "docid": "df839bf38d7a36b5c1e3e96d82a9f362", "score": "0.64295375", "text": "def error!(status, message)\n response.status = status\n response[\"Content-Type\"] = \"application/json\"\n response.write({error: message}.to_json)\n request.halt\n end", "title": "" }, { "docid": "f81ea1fb9b4abc669ccb90c49cda9285", "score": "0.64270115", "text": "def send_by_code request, response, code, headers = {}\n\t\t\t\tbegin\n\t\t\t\t\tresponse.status = code\n\t\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\t\treturn ErrorCtrl.new(request, response).index\n\t\t\t\trescue => e\n\t\t\t\t\tPlezi.error e\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend", "title": "" }, { "docid": "f2906495bd8cee7c41aac239cad7017a", "score": "0.63941467", "text": "def status_code\n response_value(:code)\n end", "title": "" }, { "docid": "9bc7b335670bda5df5ba21213f707533", "score": "0.6387767", "text": "def raise_exception_or_error_response(exception, status_code)\n if raise_exceptions?\n raise exception\n else\n bail status_code, exception.message\n end\n end", "title": "" }, { "docid": "fb1ec552c71bc1f23946e48bafee21ca", "score": "0.6379582", "text": "def raise_http_errors(status, message)\n error_class = Starwars::Error.errors[status]\n fail(error_class.new(message, status)) if error_class\n end", "title": "" }, { "docid": "a3a0954a44e3c696b8d38bbb12b49c9b", "score": "0.63519", "text": "def http_error(code, message = nil, headers = {})\n [code, {'Content-Type' => 'text/plain; charset=utf-8'}.merge(headers),\n [http_status(code) + (message.nil? ? \"\\n\" : \" (#{message})\\n\")]]\n end", "title": "" }, { "docid": "a1757ddbbed1cd8c12edeca43efe2af2", "score": "0.63499296", "text": "def _error(message,code) \n status code\n response.headers['Content-Type'] = 'application/json'\n body({:error=>{:message=>message}}.to_json)\n end", "title": "" }, { "docid": "cf3f4f32b0dbffcb494889016af8903a", "score": "0.6331902", "text": "def set_status(code)\n new(\n status: code\n )\n end", "title": "" }, { "docid": "64e669b554f43ce4284a01217528c170", "score": "0.6330004", "text": "def http_status_exception(exception)\n @exception = exception\n render_options = {:template => exception.template, :status => exception.status}\n render_options[:layout] = exception.template_layout if exception.template_layout\n render(render_options)\n rescue ActionView::MissingTemplate\n head(exception.status)\n end", "title": "" }, { "docid": "e77be84fb1ece927430891791a465a04", "score": "0.6321464", "text": "def render_error( status_code )\n\n respond_to do |format|\n\n format.html { render( action: status_code, status: status_code )}\n format.all { head( status_code )}\n\n end\n\n @error_sent = true\n\n true # return something so we can chain things\n\n end", "title": "" }, { "docid": "db438bce19639ad6d1ed3d8230e7be6e", "score": "0.63056123", "text": "def get_http_response_code\n raise 'To be implemented in child classes'\n end", "title": "" }, { "docid": "c44b09c1c55b28e0fe134f1ca232d121", "score": "0.6272587", "text": "def response_error(args = {})\n opts = { code: 418 }\n opts[:message] ||= args\n render status: opts[:code], json: {\n message: opts[:message]\n }\n end", "title": "" }, { "docid": "4a2bdc4d5c97b0221cbe7b9ed700d9e4", "score": "0.6271592", "text": "def client_error_status_code\n _undefined\n end", "title": "" }, { "docid": "e8bd87cf22b25d6861d84d2581a008f5", "score": "0.6263727", "text": "def render_error(code, message)\n respond_with Utils::RenderableError.new(code, message), status: code\n end", "title": "" }, { "docid": "708192b7f042f5ca98d1cd8a000eb0a6", "score": "0.6239133", "text": "def error(status, code, message)\n render :json => {:response_type => \"ERROR\", :response_code => code, :message => message}.to_json, :status => status\n end", "title": "" }, { "docid": "5b5fb9cb4183faf8d1f67a2bdecbbc39", "score": "0.62347525", "text": "def error!(status, message)\n request.halt status, {error: message}.to_json\n end", "title": "" }, { "docid": "5b5fb9cb4183faf8d1f67a2bdecbbc39", "score": "0.62347525", "text": "def error!(status, message)\n request.halt status, {error: message}.to_json\n end", "title": "" }, { "docid": "c66692d1fb8ed923290aca0c97054118", "score": "0.6212866", "text": "def http_status_line(code = 200)\n \"#{HTTP_VERSION} #{code} #{Shelf::Utils::HTTP_STATUS_CODES[code]}\"\n end", "title": "" }, { "docid": "0bbb800b76f04c4d6b46607df3b2bb33", "score": "0.6200952", "text": "def set_status(status)\n if status.kind_of?(Symbol)\n status = Merb::ControllerExceptions::STATUS_CODES[status]\n status || raise(\"Can't find a response code with that name\")\n end\n @_status = status\n end", "title": "" }, { "docid": "b2cb49cc1831ddf9fdc22458d3a26430", "score": "0.6183609", "text": "def finish_with( http_status, message, otherstuff={} )\n\t\thttp_response = otherstuff.merge( :status => http_status, :message => message )\n\t\tthrow :finish, http_response\n\tend", "title": "" }, { "docid": "d9e8f9df83703970fa9c7915efa7127c", "score": "0.6138719", "text": "def validate_http_status\n return true if @http.code.to_i == 200\n DomainTools::Exceptions::raise_by_code(@http.code)\n end", "title": "" }, { "docid": "a167bdb53382ec1b05a230c577d19788", "score": "0.6128288", "text": "def respond_with_error(status, message)\n respond_to do |format|\n # when format :json\n format.json do\n # write json with error\n render status: status, json: { error: message }\n end\n # when format :pdf or :html\n format.any(:pdf, :html) do\n # retrieve code for status symbol. e.g. 404 for :not_found\n status_code = Rack::Utils::SYMBOL_TO_STATUS_CODE[status]\n # write error to flash\n flash[:danger] = \"[#{status_code}] #{message}\"\n # redirect back\n redirect_back(fallback_location: '/')\n end\n end\n end", "title": "" }, { "docid": "668b68a1253a65ddc2bcfd4bccacdb31", "score": "0.6125048", "text": "def api_response(*args) # :nodoc:\n code = args.first\n args.shift\n\n err = @@ERROR_CODES[code] || @@ERROR_CODES[:unknown]\n render :json => {\n :error => {\n :code => err[0],\n :message => err[1],\n },\n :content => args.first,\n }, :status => err[2]\n end", "title": "" }, { "docid": "616273574ee221770484cc4b3e8c8073", "score": "0.61026436", "text": "def send_error(code, status = :bad_request, error = nil, data = nil)\n error_hash = {\n code: code\n }\n\n error_hash[:message] = error if error\n error_hash[:data] = data if data\n\n render json: error_hash, status: status\n end", "title": "" }, { "docid": "cb3d7d0f51ce8772da370967eac0444c", "score": "0.60940915", "text": "def respond_with_error(message: \"Not specified\", error_code: \"not_specified\", status: 400)\n render partial: \"api/error\", locals: { message: message, error_code: error_code }, status: status\n return false\n end", "title": "" }, { "docid": "8c0c65902e98184377ecab5d87c3cda8", "score": "0.609127", "text": "def ok_status_code\n _undefined\n end", "title": "" }, { "docid": "55643a535844d234865575173e7a110e", "score": "0.6090035", "text": "def render_exception_response(exception, response_code)\n case response_code\n when :unauthorized\n logged_in? ? access_denied : must_be_logged_in\n when :forbidden\n access_denied\n when :not_implemented\n not_yet_implemented\n else\n status = interpret_status(response_code) # defaults to \"500 Unknown Status\" if response_code is not recognized\n status_code = status[0,3]\n respond_to do |format|\n format.html do\n @error_page_title = I18n.t(\"error_#{status_code}_page_title\", :default => [:error_default_page_title, \"Error.\"])\n @status_code = status_code\n render :layout => 'v2/errors', :template => 'content/error', :status => status_code\n end\n format.js do\n render :layout => false, :template => 'content/error', :status => status_code\n end\n format.all { render :text => status, :status => status_code }\n end\n end\n end", "title": "" }, { "docid": "93f68a66f6641bfa6dabed6a50b582b1", "score": "0.60692626", "text": "def set_message(code)\n\t\tif(code == 200)\n\t\t\t@message = 'ok'\n\t\telsif(code == 404)\n\t\t\t@message = 'The resource wasn\\'t found.'\n\t\telsif(code == 500)\n\t\t\t@message = 'An error occured.'\n\t\telse\n\t\t\t@message = 'Unknown error.'\n\t\tend\n\tend", "title": "" }, { "docid": "7b0336aadebc4da330f8c657855f4d43", "score": "0.6061827", "text": "def status_code\n return manual_status_code if manual_status_code\n return 422 if errors.present?\n return 200 if result\n return 400\n end", "title": "" }, { "docid": "811d301a05f5c6d8ab557f8c525f8462", "score": "0.60613793", "text": "def status_code(val = nil)\n if val\n @j_del.setStatusCode(val)\n self\n else\n @j_del.getStatusCode\n end\n end", "title": "" }, { "docid": "544bc5a326150798668b80d81d7ef7e6", "score": "0.6057774", "text": "def set_error(status)\n error_response = Rack::Response.new\n error_response.status = status\n @error_response = error_response.finish {yield}\n end", "title": "" }, { "docid": "a7e6922a1b05f9796d31bac7577c0567", "score": "0.6050942", "text": "def code\n @http_response.code.to_i\n end", "title": "" }, { "docid": "e4ab287b833fd9876c1ad5ddf6cb6f10", "score": "0.6047069", "text": "def status_code; end", "title": "" }, { "docid": "79dc9c071b8904eb9f313ea995b1cf29", "score": "0.6043116", "text": "def status_code\n STATUS_CODE\n end", "title": "" }, { "docid": "625484922698811af69a629737b0aa26", "score": "0.6042836", "text": "def response code=nil, body=nil, headers=nil\n args = [code, body, headers].compact\n\n headers = {'Content-Type' => DEFAULT_CONTENT_TYPE}\n code = 200\n body = \"\"\n\n args.each do |arg|\n case arg\n when Hash then headers.merge!(arg)\n when String then body = arg\n when Integer then code = arg\n end\n end\n\n [code, headers, body]\n end", "title": "" }, { "docid": "d9623f491a8b1906c144e8b934c1b130", "score": "0.60291684", "text": "def set_error(error_code, msg, status_code=nil)\n return if @error\n @error = {:code => error_code, :message => msg} \n @status_code = status_code || 500\n end", "title": "" }, { "docid": "4ac6a12d186ad95681f8ecbd0b3dc4fe", "score": "0.60249156", "text": "def http_status\n self[:status_code]\n end", "title": "" }, { "docid": "7edaff8cdb818d5d5d9bcb79f5ac2eb5", "score": "0.60092515", "text": "def status_code\n @response.status\n end", "title": "" }, { "docid": "de12045414958a91b59722d03ec7d6d4", "score": "0.60075486", "text": "def http_err_code\n http_codes[@http_err]\n end", "title": "" }, { "docid": "9670a5c8b03aca7c7b772d19099f2dab", "score": "0.59957415", "text": "def error!(message, status=403)\n throw :error, :message => message, :status => status\n end", "title": "" }, { "docid": "7f98921dbe4433f50b4431fd7750d758", "score": "0.59892803", "text": "def server_error_status_code\n _undefined\n end", "title": "" }, { "docid": "2a54e7e25156931136c766c7ff6e139f", "score": "0.59870434", "text": "def resp_error(message = '')\n # {code: 300, message: message}\n error!({code: 300, message: message}, 300)\n end", "title": "" }, { "docid": "569a082a30e08465dba4fce708d788e4", "score": "0.59864724", "text": "def respond(code, message, hash = {})\n @status = code\n response = { # default structure.\n status: code,\n message: message,\n }.merge(hash)\n throw(:KenjiRespondControlFlowInterrupt,\n [@status, @headers, [response.to_json]])\n end", "title": "" }, { "docid": "58ebc40620b94c3f47a10608515208bc", "score": "0.59842217", "text": "def status_code_meaning(number)\r\n if number == 200\r\n return \"OK\"\r\n elsif number == 301\r\n return \"Moved Permanently\"\r\n elsif number == 401\r\n return \"Unauthorized\"\r\n elsif number == 404\r\n return \"Not Found\"\r\n elsif number == 500\r\n return \"Internal Server Error\"\r\n end\r\nend", "title": "" }, { "docid": "6b62a14b3b457cdfb8405409548bde40", "score": "0.59822273", "text": "def validate_response(response) # :nodoc:\n code = response.code.to_i\n raise HttpError, \"#{code} #{response.msg}\" if code < 200 || code > 299\n end", "title": "" }, { "docid": "0d37c57da2cf23705ff7dabefe9d0ef2", "score": "0.59733105", "text": "def ok; @status = 200 end", "title": "" }, { "docid": "0d37c57da2cf23705ff7dabefe9d0ef2", "score": "0.59733105", "text": "def ok; @status = 200 end", "title": "" }, { "docid": "decc85d9757129e092d15ceb7d12fd9d", "score": "0.5970214", "text": "def status(value = nil)\n\t\t\tresponse.status ||= 200\n\t\t\tresponse.headers['X-Cascade'] = 'pass' if value == 404\n\t\t\tvalue ? response.status = value : response.status\n\t\tend", "title": "" }, { "docid": "a9bf56f4864d29d4503111a9e9ed402e", "score": "0.5952366", "text": "def status_code\n @status_code || errors.empty? ? 200 : 422\n end", "title": "" }, { "docid": "2e7c20da9c15a0536cd61203f00a1498", "score": "0.5949743", "text": "def prepare_status_response( txn, status_code, message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\ttxn.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it.\n\t\tunless BODILESS_HTTP_RESPONSE_CODES.include?( status_code )\n\t\t\ttxn.content_type = 'text/plain'\n\t\t\treturn message.to_s\n\t\tend\n\n\t\t# For bodiless responses, just tell the dispatcher that we've handled \n\t\t# everything.\n\t\treturn true\n\tend", "title": "" }, { "docid": "57aa6b89275a99b72f08cb9cfb5f2b83", "score": "0.59405524", "text": "def response_message message, code\n render json: {message: message, code: code}\n end", "title": "" }, { "docid": "7dc2bda1314b75ec7ae94fcee31ee1b1", "score": "0.5939436", "text": "def handle_error(exception, error_status = 500)\n unless @context.status == error_status\n @context.status = error_status\n \n # FIXME: have to reset @context as well. This is uggly \n # and extremely error prone. We should rethink how this \n # works.\n \n @out = @context.output_buffer = \"\"\n\n session[:RENDERING_ERROR] = exception\n\n render(\"/status_#{error_status}\")\n end\n end", "title": "" }, { "docid": "45554fbb7b6d957f23bd7fc743a474ab", "score": "0.5935975", "text": "def send_headers response_code\n end", "title": "" }, { "docid": "32ec1705e8d310ce5d1e16bed5aa0961", "score": "0.5925995", "text": "def status_code\n wrapper.status_code.to_i\n end", "title": "" }, { "docid": "eb285f01380bd9045d8bf2d0a96e9018", "score": "0.59183013", "text": "def send_status( status )\n self.status = ::Rack::Utils.status_code( status )\n self.write ::Rack::Utils::HTTP_STATUS_CODES[ self.status ]\n end", "title": "" }, { "docid": "44c274c755e35f826dd6a766d27b4a97", "score": "0.5914916", "text": "def status_error\n @status = 500\n end", "title": "" }, { "docid": "5fe1bba7a2fc3cb5afb613c3b291488f", "score": "0.58921224", "text": "def generate_response(code = 503, text)\n \"HTTP/1.1 #{code} #{CODES[code]}\\r\\nContent-type: text/plain\\r\\nContent-length: #{text.length}\\r\\n\\r\\n#{text}\"\n end", "title": "" }, { "docid": "547bc7ff082fcff8c38ef89496b2484d", "score": "0.58857936", "text": "def elb_response_code(elb_expected_code)\n test_http_response(elb_expected_code, elb_href, ELB_PORT)\n end", "title": "" }, { "docid": "39bdc47fe7345942833aba614bb204d6", "score": "0.5876605", "text": "def callback\n result, message = handle_callback_params!\n status = result ? :ok : :bad_request\n render plain: message, status: status\n end", "title": "" }, { "docid": "f5024afbef2588af398cb78803cea5d8", "score": "0.58684176", "text": "def test_dispatch_error_status_code\n Net::HTTP.class_eval do\n def self.get_response(*_args) # rubocop:todo Lint/DuplicateMethods\n DummyResponse.new('503')\n end\n end\n\n properties = {\n 'env' => 'dummyKey',\n 'combination' => 1,\n 'url' => 'https://dev.visualwebsiteoptimizer.com/server-side/track-user', # noqa: E501\n 'ed' => '{\"p\": \"server\"}',\n 'random' => 0.7382938446947298,\n 'ap' => 'server',\n 'u' => '09CD6107E42B51F9BFC3DD97EA900990',\n 'experiment_id' => 229,\n 'sId' => 1_565_949_670,\n 'sdk-v' => '1.0.2',\n 'sdk' => 'python',\n 'account_id' => 60_781\n }\n\n result = @dispatcher.dispatch(properties, {}, 'end_point')\n assert_equal(result, false)\n end", "title": "" }, { "docid": "a9a25b59c861b399e04f8cec148f33c2", "score": "0.58589196", "text": "def http_code\n '000'\n end", "title": "" }, { "docid": "ca439195f18528711b94bd2d66c5d18e", "score": "0.5846806", "text": "def status_not_found\n @status = 404\n @e.error 'The requested page does not exist.', 404\n throw :exit\n end", "title": "" }, { "docid": "b34c1f1cd75d7fcdf0dad9552d7dd8c6", "score": "0.5846525", "text": "def error code=nil, message=nil\n if code\n if code.is_a?(String)\n error = Lux::Error.new 400\n error.message = code\n else\n error = Lux::Error.new code\n error.message = message if message\n end\n\n raise error\n else\n Lux::Error::AutoRaise\n end\n end", "title": "" }, { "docid": "1bd2aaccb745b8ec75dc7f02043a2b04", "score": "0.58337677", "text": "def handle_response(response)\n case response.code.to_i\n when 200...300\n response\n else\n raise ResponseError.new(response)\n end\n end", "title": "" }, { "docid": "25fa2ce9ff7403762d945254d95f896f", "score": "0.5829382", "text": "def respond(status_code, body = nil, **headers)\n # Log response\n log = \"RESPONSE [#{ status_code }] #{ body }\"\n Yake.logger&.send(status_code.to_i >= 400 ? :error : :info, log)\n\n # Set headers\n content_length = (body&.bytesize || 0).to_s\n to_s_downcase = -> (key) { key.to_s.downcase }\n headers = {\n 'content-length' => content_length,\n **(@headers || {}),\n **headers,\n }.transform_keys(&to_s_downcase).compact\n\n # Send response\n { statusCode: status_code, headers: headers, body: body }.compact\n end", "title": "" }, { "docid": "ad92d2362687e23da4498722cba72924", "score": "0.581951", "text": "def flex_error_handling\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422)\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201)\n end", "title": "" }, { "docid": "538f7006e67d4687e3c42f24fc44920e", "score": "0.5807041", "text": "def set_redirect_error_status(status)\n end", "title": "" }, { "docid": "c24a6deee99ec3709c82b86aae6b4e71", "score": "0.58067113", "text": "def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise Redirection, response\n when 200...400\n response\n when 400\n raise ResourceInvalid, response\n when 401\n raise UnauthorizedAccess, response\n when 403\n raise ForbiddenAccess, response\n when 404\n raise ResourceNotFound, response\n when 405\n raise MethodNotAllowed, response\n when 409\n raise ResourceConflict, response\n when 410\n raise ResourceGone, response\n when 422\n raise ResourceInvalid, response\n when 401...500\n raise ClientError, response\n when 500...600\n raise ServerError, response\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end", "title": "" }, { "docid": "02705dabeffe55517012a4bc5535f68e", "score": "0.5783601", "text": "def error(message, status = 422)\n render text: message, status: status\n end", "title": "" }, { "docid": "93f6bebe6e582809268d4762a921ed1f", "score": "0.5756966", "text": "def code\n @raw_response.code\n end", "title": "" }, { "docid": "94f618fb4a79cb6b828b79183c94e127", "score": "0.5751291", "text": "def reply_http(env, body, code=200, headers={\"Content-type\" => \"text/html\"})\n self.reply(env, http_response(body, code, headers))\n end", "title": "" }, { "docid": "05ca663d003a9e34027beced301d3f8c", "score": "0.5743496", "text": "def render_optional_error_file(status_code)\n if status_code == :unauthorized\n render_401\n elsif status_code == :not_found\n render_404\n elsif status_code == :unprocessable_entity\n render_422\n elsif status_code == :internal_server_error\n render_500\n else\n super\n end\n end", "title": "" }, { "docid": "e3ecdf4d14bc46fc1b099cc7e251eee6", "score": "0.57412493", "text": "def error(event, msg, code=500, trace = [])\n title = case code\n when 400\n \"Bad Request (400)\"\n when 401\n \"Unauthorized Request\"\n when 403\n \"Access Restricted\"\n when 404\n \"Page Not Found\"\n when 405\n \"HTTP Method Not Allowed\"\n else\n \"An Error Has Occured\"\n end\n @content = render('error', {title: title, message: msg, error_code: code, trace: trace})\n warnlog 'Error handler called with \"' << msg << '\", code ' << code.to_s << ' (trace: ' << trace.to_s << ')'\n end", "title": "" }, { "docid": "a5f181222b156822360d2e334ed51981", "score": "0.57399964", "text": "def do_status( code, message, language )\n if code == FX_EOF\n @log.debug \"[#{@id}] got EOF\" if @log.debug?\n @callback[ OK, @data ]\n else\n super\n end\n end", "title": "" }, { "docid": "901088487ba428b57d39aacf978bf46b", "score": "0.5727798", "text": "def getStatusCode\n @_statusCode\n end", "title": "" }, { "docid": "b9f6c722f421659fecbba8bdfb462277", "score": "0.57223654", "text": "def http_status exception\n http_status = nil\n if defined?(ActionDispatch::ExceptionWrapper) &&\n ActionDispatch::ExceptionWrapper.respond_to?(\n :status_code_for_exception\n )\n http_status =\n ActionDispatch::ExceptionWrapper.status_code_for_exception(\n exception.class.name\n )\n end\n\n http_status\n end", "title": "" }, { "docid": "3db0726595e15c14de032e4d1ee03303", "score": "0.57200116", "text": "def error_response(code, message)\n render :json => {:success=>false,:error_code => code,:error_msg => message}\n end", "title": "" }, { "docid": "405ef4e84bcbf872ab742b9ea71ac228", "score": "0.57142353", "text": "def response_status(kind)\n response.headers['status'] = kind.to_s\n end", "title": "" }, { "docid": "33620d6b4f205d6ce8ab16026963aa12", "score": "0.5709073", "text": "def respond_bad_request; make_response(nil, false, 400, \"Bad Request\") end", "title": "" } ]
ba1be31b222ee645010045951c34bb93
check the rows of the grid If the row has 2 of one mark (X or Y), and one nil value, retun the index of the nil value
[ { "docid": "47207bc987a0030e5a45d093074896b0", "score": "0.723647", "text": "def row_winning_move\n\t\t@board.grid.each_with_index do |row, r|\n\t\t\tother_nil_index = contains_two_marks(row)\n\t\t\tif(other_nil_index)\n\t\t\t\treturn [r, other_nil_index]\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "title": "" } ]
[ { "docid": "6727902f9da96ae5faf5370b4da9c3ea", "score": "0.7264211", "text": "def find_empty_cell()\n\t$value_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tif col.to_i == 0\n\t\t\t\treturn [index_r,index_c]\n\t\t\tend\n\t\tend\n\tend\n\treturn [$N,$N]\nend", "title": "" }, { "docid": "11411e2ac0ad9010bb6b36676139d9bb", "score": "0.6740813", "text": "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:O) == 2) )\n\t\t\tif(values.include?(nil))\n\t\t\t\treturn values.index(nil)\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "title": "" }, { "docid": "b13a3fbe08d974a8fed752fc6b92926a", "score": "0.67221236", "text": "def count_valid_cell(row, col)\n if row == -1 || row == grid.row_count\n 0\n elsif col == -1 || col == grid.column_count\n 0\n elsif !grid[row, col]\n 0\n else\n 1\n end\n end", "title": "" }, { "docid": "3266da0c97ad3945ab0b08af2a60f157", "score": "0.66683745", "text": "def empty_cell?(position)\n case @signs[position[0].to_i-1][position[1].to_i-1]\n when \"x \" \n return false\n when \"o \" \n return false\n else return true\n end\n end", "title": "" }, { "docid": "217d144947a6d7bfeb74086951fcb35d", "score": "0.6653137", "text": "def invalid_cell?(pos)\n pos[0] < 0 || pos[1] < 0 || pos[0] > MAXX || pos[1] > MAXY\n end", "title": "" }, { "docid": "8b8db58f04bff192ed1c7249d24c8294", "score": "0.66522086", "text": "def none_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 0 && board.squares.values_at(*the_line).count(' ') == 3\n return true\n end\n end\n end", "title": "" }, { "docid": "79ba2af4fb145eb62a954669e333c343", "score": "0.6612824", "text": "def contains_mine?(row, col)\n grid[row][col].fill == 1\n end", "title": "" }, { "docid": "cbef7848112baf4b6a0d3a387ad32fd9", "score": "0.65868014", "text": "def find_all_empty_cells\n @board_array.each_index do |i|\n row = @board_array[i]\n row_index = i\n row.each_index do |i|\n char = row[i]\n column_index = i\n if char == \"-\"\n return [row_index,column_index]\n end\n end\n end\n end", "title": "" }, { "docid": "20f085b0c5e86036de218e315c508533", "score": "0.65542406", "text": "def empty_cell?(grid, r, c)\n r < 0 || c < 0 || r >= grid.size || c >= grid[0].size || grid[r][c] == 0\nend", "title": "" }, { "docid": "e99e3f03045a9329054e708894ae53b9", "score": "0.65411353", "text": "def within_field?(row, col)\n (row >= 0 && row < @row_count) &&\n (col >= 0 && col < @column_count)\n end", "title": "" }, { "docid": "8a48fc29baf4b91f67fbd8be82d980c8", "score": "0.6524983", "text": "def safe?(x, y, arr)\n (x >= 0 && x < $N && y >= 0 && y < $N && arr[x][y] == -1)\nend", "title": "" }, { "docid": "1cd6a961e9bd951d06be7baf26234af1", "score": "0.6515335", "text": "def on_table?(x,y)\n (0 <= x && x < GRID_X) && (0 <= y && y < GRID_Y)\n end", "title": "" }, { "docid": "be99230693066f8e295c5b102e633ebb", "score": "0.6479274", "text": "def contains_mine?(row, col)\n false\n end", "title": "" }, { "docid": "be99230693066f8e295c5b102e633ebb", "score": "0.6479274", "text": "def contains_mine?(row, col)\n false\n end", "title": "" }, { "docid": "eb85f3873566d30f402339767199ae72", "score": "0.64655703", "text": "def row_pos_invalid?(row_pos=@initial_position.row)\n !rows.include?(row_pos.to_s)\n end", "title": "" }, { "docid": "3f69720333f1f1c8f58717b97a01f98d", "score": "0.6410704", "text": "def occupied?(x,y) # board position !nil\n !self.board.grid[x][y].nil?\n end", "title": "" }, { "docid": "32796277d931690db372f3ed97e5f9c3", "score": "0.6396278", "text": "def second_color_row?(pos)\n pos[0] == 0 || pos[0] == 7\n end", "title": "" }, { "docid": "0a284ddaa7715acad097e03c11988804", "score": "0.6378867", "text": "def x_in_cell?\n\n end", "title": "" }, { "docid": "f22d29e4ccaca69ca11adf43f19e119b", "score": "0.637229", "text": "def valid_position?(row, col)\n row.between?(0, 7) && col.between?(0, 7) ? true : false\n end", "title": "" }, { "docid": "e9f1c0deb8dd52ec2faa4976ecc5a10d", "score": "0.635623", "text": "def next_cell(grid)\n grid.each_with_index do |row, x|\n row.each_with_index do |cell, y|\n return x, y if cell.length > 1\n end\n end\n end", "title": "" }, { "docid": "39bf9b27b415e2b9ed92e44d873e262a", "score": "0.6346326", "text": "def tied?\n @grid.all? { |row| row.all? { |el| el != nil } }\n end", "title": "" }, { "docid": "98828a8cbd3b8d3c5ecf8b558befa0a7", "score": "0.6341902", "text": "def cell_in_grid(y, x)\n return y >= 0 && x >= 0 && y < $grid.length && x < $grid.length\nend", "title": "" }, { "docid": "f2fdfc0cc05d498fe1aaa802462320de", "score": "0.6341612", "text": "def valid_row?(row)\n if @row_counter[row - 1] == nil\n puts \"Row invalid\"\n return 9\n elsif @row_counter[row - 1] > 5\n puts \"Row full\"\n return 9\n else\n return row\n end\n end", "title": "" }, { "docid": "cd4ff49dad9e1e2507916b17f1cf7958", "score": "0.63378006", "text": "def position_taken?(board,index)\n (!(board[index] == \" \" || board[index] == \"\" || !nil) || (board[index] == \"X\" || board[index] == \"O\"))\nend", "title": "" }, { "docid": "590c772652487cec0a651600e964724b", "score": "0.6329852", "text": "def filled?(x, y)\n @grid[x][y].value != 0\n end", "title": "" }, { "docid": "6f3ab4cbb49f809a3595d0baa40dab0c", "score": "0.6324234", "text": "def position_taken?(board,index)\n if board[index] == nil\n false\n elsif board[index].strip.empty?\n false\n else\n true\n end\nend", "title": "" }, { "docid": "cbc849f8b2272d8a0e957ffc3e5e4767", "score": "0.63203174", "text": "def is_empty(row,column)\n @coords[row][column].is_water\n end", "title": "" }, { "docid": "de40a395df2b866cc33a1bdb02d305c4", "score": "0.6316281", "text": "def get_empty_posns \n empty_posns = []\n\n @board.rows.each_with_index do |row, idx1| \n row.each_with_index do |block, idx2| \n if @board.empty?([idx1, idx2])\n empty_posns << [idx1, idx2]\n end\n end\n end\n\n empty_posns\n end", "title": "" }, { "docid": "74ef2befdb77e1c675d8a4ea55b70907", "score": "0.63094735", "text": "def row_col\n f = lambda do |board ,mark|\n board.any? { |row| row.all? {|cell| cell == mark } } end\n\n return :X if (f.call(@grid ,:X) || f.call(@grid.transpose,:X))\n return :O if (f.call(@grid ,:O) || f.call(@grid.transpose,:O))\n end", "title": "" }, { "docid": "5f33658d9c938db65871b4d556c1f0f0", "score": "0.6292346", "text": "def empty_board?\n cell_rows.flatten.uniq.size == 1 && cell_rows.flatten.uniq.first == nil\n end", "title": "" }, { "docid": "09b6874bd99893f167ade55105545a62", "score": "0.6284706", "text": "def valid?(position)\n row, col = position\n position.all? {|i| i >= 0 && i< @grid.length}\n \n end", "title": "" }, { "docid": "3480b5e265311345b653afe12252fb31", "score": "0.62839234", "text": "def locode_data?(row)\n !row[2].nil?\n end", "title": "" }, { "docid": "e51b89616f84cdb407e01469ee521430", "score": "0.6283263", "text": "def position_taken?(board, indx)\n if (board[indx] == \"X\" || board[indx] == \"O\")\n true \n elsif (board[indx] == \" \" || board[indx] == \" \" || board[indx] == \"\")\n false \n elsif (board[indx] == nil)\n false\n end \nend", "title": "" }, { "docid": "a98e954b1dad2216279722c348b6042d", "score": "0.62819874", "text": "def position_taken?(board,index)\n (board[index]==\"\"||board[index]==\" \"||board[index]==nil)? false:true\n\nend", "title": "" }, { "docid": "6a3c91188da8e0059fd7846ad8849a6a", "score": "0.62741154", "text": "def one_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 1 && board.squares.values_at(*the_line).count(' ') == 2\n return true\n end\n end\n end", "title": "" }, { "docid": "05a8cf205273630bf10c816c05002144", "score": "0.6256515", "text": "def is_valid_index?(row, column)\r\n # Check if the specified row is out of bounds\r\n if ( row < 0 ) || ( row >= @image_array.length )\r\n return false\r\n end\r\n\r\n # Check if the specified column is out of bounds\r\n if ( column < 0 ) || ( column >= @image_array[row].length )\r\n return false\r\n end\r\n\r\n return true\r\n end", "title": "" }, { "docid": "27b60d46250a19c0839d4ae9ec757f8d", "score": "0.62523675", "text": "def check_ship (horv,x1,y1)\n if horv==1 #build in vertical position row increases\n (x1..x1+4).each { |r| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == r && s.colid==y1}\n if !sq.empty\n return true\n end #if\n }\n else\n (y1..y1+4).each { |c| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == x1 && s.colid==c}\n if !sq.empty\n return true\n end\n }\n end #horv\n return false # nothing to hit\n end", "title": "" }, { "docid": "0b47e09ded22494b3a433ccfa336a08e", "score": "0.6250748", "text": "def position_taken?(board,index_number)\n board[index_number] == \" \"\nboard[index_number] != \"\"\nboard[index_number] == \"nil\"\nboard[index_number] == \"X\"\nboard[index_number] == \"X\" || board[index_number] == \"O\"\nend", "title": "" }, { "docid": "5d620b79d578efac7e037e89f572b987", "score": "0.62470365", "text": "def out_of_board(row,column)\n (!(0...@rows).include? row) ||\n (!(0...@columns).include? column)\n end", "title": "" }, { "docid": "a7c688e55d49bdbd791d2df43adbbf07", "score": "0.6240374", "text": "def position_taken?(board, index)\nif board[index] == \" \" \n return board[index] != \" \"\n elsif board[index] == \"\"\n return board[index] != \"\"\n elsif board[index] == nil\n return board[index] != nil\n elsif board[index] == \"X\"\n return board[index] == \"X\"\n elsif board[index] == \"O\"\n return board[index] == \"O\"\nend\nend", "title": "" }, { "docid": "add5fd281f4b02d09cb8cbe5fb56ea2e", "score": "0.62352204", "text": "def cell_cleared?(row, col)\n grid[row][col].uncovered\n\n end", "title": "" }, { "docid": "8fb098468ef42ae9ae994b24451e2b6d", "score": "0.6231262", "text": "def position_taken? (board,index)\n if board [index] == \"X\" || board [index] == \"O\"\n TRUE\nelse board [index] == \" \" || board [index] == \"\" || board [index] == nil \n FALSE\nend\nend", "title": "" }, { "docid": "61ddf9b82e42c5efb2f781019448675a", "score": "0.6230409", "text": "def position_taken?(board, index)\n\n if (board[index]==\" \" || board[index]==\"\" || board[index] ==nil)\n false\n elsif (board[index]==\"X\"|| board[index]==\"O\")\n true\n end\n\nend", "title": "" }, { "docid": "ffbbed2d803384b2b62b680ab2ea536c", "score": "0.6212626", "text": "def position_taken?(board, index)\n if board[index] == \"\"\n false\n elsif board[index] == \" \"\n false\n elsif board[index] == nil\nfalse\nelse board[index] == \"X\" || \"O\"\n true\n end\nend", "title": "" }, { "docid": "a34b007bb04b2b6624d4629e01e0c4ee", "score": "0.62114805", "text": "def valid?(pos) #getter\n #pos shoul be 2 number like [2,n]\n #need to check if [2,n] is in our @grid\n row,col = pos\n pos.all? {|num| num >= 0 && num < @n}\n end", "title": "" }, { "docid": "34f92f23c941baa1acbae04ad58d0d9d", "score": "0.6209251", "text": "def check_rows\n for row in 0..2\n if @game_array[row][0] == @game_array[row][1] &&\n @game_array[row][0] == @game_array[row][2] &&\n !@game_array[row][0].nil?\n\n result = @game_array[row][0]\n end\n end\n result\n end", "title": "" }, { "docid": "8489e81c64ad79917ecf51976fdedbbe", "score": "0.620712", "text": "def position_taken?(board,index)\n if board[index.to_i]==\"\"||board[index.to_i]==\" \"||board[index.to_i]==nil then\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "c5daf3c1b603dec60deab7be47d3d30d", "score": "0.6206387", "text": "def position_taken? (board, index)\n if board[index] == nil || board[index] == \"\"\n return false\n \n elsif board[index] == \" \"\n return false\n \n elsif board[index] == \"X\" || board[index] == \"O\"\n return true\n end\nend", "title": "" }, { "docid": "0de2ba384eb08b9eeb0a6aef4fa1da67", "score": "0.6204965", "text": "def position_taken?(board,index)\n index.to_i\n if board[index] == \" \" || board[index] == \"\" || board[index] == nil\n false\n elsif board[index] == \"X\" || board[index] == \"O\"\n true\n end\nend", "title": "" }, { "docid": "ec08e1574e4e4fb629e76372a0bb3b73", "score": "0.6196738", "text": "def position_taken?(board, index)\n if board[index] === \" \" || board[index] === \"\" || board[index] == nil\n return false\n else board[index] === \"X\" || board[index] === \"O\"\n return true \n end\n \nend", "title": "" }, { "docid": "e4ebc4ddec5c59a6f22f14e26d25c51e", "score": "0.6192816", "text": "def position_taken?(board, index)\n !(board.any?{ |e| e.nil?} || board.any?{ |e| e.eql? \"\"} || board[index] == \" \")\nend", "title": "" }, { "docid": "4bff5e2cdc30f22966d51dbbb6ce6970", "score": "0.61874044", "text": "def empty_positions?\n @grid.flatten.any? {|pos| pos == \"_\"}\n end", "title": "" }, { "docid": "214c3372fb3cf184c1ba4b135db79018", "score": "0.61841273", "text": "def check_prow\n @prow = 0 if @prow < 0\n if @prow > @maxrow-1\n @prow = @maxrow-1\n end\n if @pcol > @maxcol-1\n @pcol = @maxcol-1\n end\n @pcol = 0 if @pcol < 0\n end", "title": "" }, { "docid": "a69d4990b02456e9a233b41a216956fe", "score": "0.6183918", "text": "def position_taken?(board,index)\n index_new = index.to_i\n if board[index_new] == \" \"\n false\n elsif board[index_new] == \"\"\n false\n elsif board[index_new] == nil\n false\n elsif board[index_new] == \"X\" || board[index_new] == \"O\"\n true\n end\nend", "title": "" }, { "docid": "7ef37e1dc7b9320be121d3d6e13b0f7a", "score": "0.6182163", "text": "def position_taken?(board,index)\n if board[index] == \" \"\n false\n elsif board[index] == \"\"\n false\n elsif board[index] == nil\n false\n else board[index] == \"X\" || \"O\"\n true\n\n end\nend", "title": "" }, { "docid": "57e7eff074bb7d2b957918aab5bd22a1", "score": "0.6181329", "text": "def position_taken?(board, idx)\n [\"X\", \"O\"].include?(board[idx])\nend", "title": "" }, { "docid": "0d22887adae15bc0e90a12880900dfbb", "score": "0.6175573", "text": "def check_grid_coordinates(x, y)\n (x >= 0) && (x < @height) && (y >= 0) && (y < @width)\n end", "title": "" }, { "docid": "d849a9456f32e71d7ea07ec5bda74428", "score": "0.61745435", "text": "def position_taken? (board, indx)\n #notice errors with nil and .strip\n if board[indx]==nil\n false\n elsif board[indx].strip== \"\"\n false\n else\n true\n end\nend", "title": "" }, { "docid": "0acd4b7c4afab6e8f6217e44b43a76a2", "score": "0.6173544", "text": "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\nend", "title": "" }, { "docid": "0acd4b7c4afab6e8f6217e44b43a76a2", "score": "0.6173544", "text": "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\nend", "title": "" }, { "docid": "ee56be81b87daaa8e6cefd7710047c83", "score": "0.61731285", "text": "def first_empty_index\n #_, index = @pz.lazy.each_with_index.select { |value, n| value.nil? }.first\n each_empty_cell.first.try :last\n end", "title": "" }, { "docid": "4c1363322457e8f11fc2aed91bdcb471", "score": "0.6172407", "text": "def position_taken?(index)\n if @board[index] == nil or @board[index] == \"\" or @board[index] == \" \"\n return false\n elsif @board[index] == \"X\" or @board[index] == \"O\"\n return true\n end\n end", "title": "" }, { "docid": "ac347fc3cd4a9138e08a175c4d8fc2ff", "score": "0.6170834", "text": "def position_taken?(board, index)\n if board[index] == \" \"\n false\n elsif board[index] == \"\"\n false\n elsif board[index] == nil\n false\n else board[index] == \"X\" || board[index] == \"O\"\n true\n end\nend", "title": "" }, { "docid": "3806a24cbec27f4a0ca397f9ab786065", "score": "0.6170401", "text": "def position_taken?(index_i)\n ((@board[index_i] == \"X\") || (@board[index_i] == \"O\"))\n end", "title": "" }, { "docid": "3194ed5159e66793167ff5a2fdde143f", "score": "0.6169514", "text": "def position_taken?(board, index)\nposition = board[index]\n if position==\" \"\n return false\n elsif position==\"\"\n return false\n elsif position==nil\n return false\n elsif position == \"X\"\n return true\n elsif position==\"O\"\n return true\n end\nend", "title": "" }, { "docid": "ba029dc337253bebab8d346992de193d", "score": "0.6166886", "text": "def winner_row\n for row_index in 0..BOARD_MAX_INDEX\n first_symbol=@board[row_index][0]\n for col_index in 1..BOARD_MAX_INDEX\n if first_symbol !=@board[row_index][col_index]\n break \n elsif col_index ==BOARD_MAX_INDEX and first_symbol != EMPTY_POS\n return first_symbol\n end\n end\n end\n return \n end", "title": "" }, { "docid": "ef78b7eac3eab00169e30629b6f90fd6", "score": "0.61642236", "text": "def create_board_indicator\n @row_of_first_empty_square = 0\n @col_of_first_empty_square = 0\n first_empty_square_found = false\n board_indicator = initialize_empty_board\n (MIN_ROW_POSITION..MAX_ROW_POSITION).each do |j| \n (MIN_COL_POSITION..MAX_COL_POSITION).each do |i|\n #board_indicator[j][i] = 1 if (@board[j][i] != 0 && @board[j][i] != '')\n if (@board[j][i] == 0 || @board[j][i] == '')\n if !first_empty_square_found\n puts 'first empty'\n first_empty_square_found = true\n @row_of_first_empty_square = j\n @col_of_first_empty_square = i\n end\n else\n board_indicator[j][i] = 1\n end\n end\n end\n board_indicator\n end", "title": "" }, { "docid": "5fd3ed1c8af9f418407afbff31ac0ef4", "score": "0.6158907", "text": "def position_taken?(board,index)\n index_num = index\n if board[index_num] == \" \" || board[index_num] == \"\" || board[index_num] == nil\n false\n elsif board[index_num] == \"X\" || board[index_num] == \"O\"\n true\n end\nend", "title": "" }, { "docid": "8a43f27cb16ef8b8b07383e17bc26d27", "score": "0.6158554", "text": "def position_taken?(index)\n @board[index] == \"X\" || @board[index] == \"O\"\n end", "title": "" }, { "docid": "489492d8dbc0a2bfcd1d500cf6cbf57e", "score": "0.61569506", "text": "def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "548253f2c5e683dea1121616c9ec5e35", "score": "0.6156576", "text": "def valid_position?(position)\n arr = @rows.flatten\n arr.find_index(position)\n end", "title": "" }, { "docid": "3a2b2b121f1a18d83c96414e3422875f", "score": "0.6147539", "text": "def position_taken?(board, index)\n if board[index] == \" \"\n false\n elsif board[index] == \"\"\n false\n elsif board[index] == nil\n false\n\n elsif board[index] == \"X\"\n true\n else board[index] == \"O\"\n true\n end\nend", "title": "" }, { "docid": "b7f7da27166e4d61c636de134df3ed00", "score": "0.6146589", "text": "def position_taken?(board, index)\nif board[index].strip.empty? || board[index].strip.nil? || board[index] == \"X\" || board[index] == \"O\"\n false\nelse board[index] == \"\" || board[index] == \" \"\n true\nend\n end", "title": "" }, { "docid": "66b379d7494d4c4c91b335551ff6d7c9", "score": "0.614573", "text": "def position_taken?(board,index)\n #This method must take in both the existing board and the index that the user\n #is trying to fill if the index is already occupied it will not allow this\n position_value=board[index]\n if position_value != nil\n if position_value.include? \"x\" or position_value.include? \"o\" or position_value.include? \"X\" or position_value.include? \"O\"\n return true\n else\n return false\n end\n else\n return false\n end\nend", "title": "" }, { "docid": "2f5d1e9ff14fd0c8045a34ce5177ae2a", "score": "0.6136246", "text": "def taken?(cells = @cells, location)\n @cells[location.to_i - 1] == \"X\" || @cells[location.to_i - 1] == \"O\"\n end", "title": "" }, { "docid": "0779c688a5372c9d4370b478d4c6d130", "score": "0.61332375", "text": "def inside_boundary?()\n @col_idx >= 0 and @col_idx < @@col_count and @row_idx >= 0 and @row_idx < @@row_count\n end", "title": "" }, { "docid": "5d7c7e6b7f0e89a15d21f3c583b60bc6", "score": "0.61325663", "text": "def position_taken?( index )\n !(@board[index].nil? || @board[index] == \" \")\n end", "title": "" }, { "docid": "27ab99366273d8f51035996e5e6f2dfd", "score": "0.6130956", "text": "def position_taken?(board, index)\n board[index] == \"X\" || board[index] == \"O\"\n end", "title": "" }, { "docid": "e8fe35f0a6d08619c3efab2b93380dc6", "score": "0.61307967", "text": "def check_columns\n for column in 0..2\n if @game_array[0][column] == @game_array[1][column] &&\n @game_array[0][column] == @game_array[2][column] &&\n !@game_array[0][column].nil?\n\n result = @game_array[0][column]\n end\n end\n\n result\n end", "title": "" }, { "docid": "dfaac308857e6c3051355e5c6cbd7d9a", "score": "0.61271924", "text": "def invalid_move?(col)\n col = col.to_i\n i = 0 \n while i < @height && col < @width\n if @grid[i][col] == nil\n return false \n end \n i += 1 \n end \n return true \n end", "title": "" }, { "docid": "ee5b5083f38b8d09a170a08cfe91ffe9", "score": "0.6127101", "text": "def position_taken?(board,index)\n if board[index]==\"\" || board[index]==\" \" || board[index]== nil\nreturn false\nelse\n return true \nend \nend", "title": "" }, { "docid": "9bc764e6637c9f1df61bfe522c19f6eb", "score": "0.61264044", "text": "def position_taken?(board,index)\n board[index] != \"\" and board[index] != \" \" and board[index] != nil\nend", "title": "" }, { "docid": "34117ed685751bf317c9f82bfb3d17e1", "score": "0.6125196", "text": "def position_taken?(board, index)\n if board[index] == \" \" || board[index] == \"\" || board[index] = nil\n false\n else\n true\n #board[index] == \"X\" || board[index] == \"O\"\n \n end\nend", "title": "" }, { "docid": "e0510a021be125393c3a5b9e30404b98", "score": "0.6121417", "text": "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\n end", "title": "" }, { "docid": "25360a52547726e9e7815bd11465d863", "score": "0.6118926", "text": "def position_taken?(board,index) \n if board[index] == \"X\" || board[index] == \"O\"\n true\n elsif board[index] == \" \"\n false\n elsif board[index] == \"\"\n false\n elsif board [index] == nil \n false\n end \nend", "title": "" }, { "docid": "53e5725f1de3fd918757f12d53307a11", "score": "0.6117229", "text": "def position_taken?(board,n)\n return board[n]=='X'||board[n]=='O'\nend", "title": "" }, { "docid": "1b30311d61c938502b05ef977d2f8264", "score": "0.6116663", "text": "def position_taken?(board, index)\nif board[index] == \" \"\n false\nelsif board[index] == \"\"\n false\nelsif board[index] == nil\n false\nelsif board[index] == \"X\" || \"O\"\n true\nelse\nend\nend", "title": "" }, { "docid": "b2a673c86f4d773dbc21e7b7c7388ff5", "score": "0.61157215", "text": "def find_start_and_finish\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |spot, col_idx|\n if spot == START_MARK\n @start = [row_idx, col_idx]\n elsif spot == END_MARK\n @finish = [row_idx, col_idx]\n end\n end\n end\n end", "title": "" }, { "docid": "ba7e97bf59c544b472778cf4b7b1d181", "score": "0.6115336", "text": "def position_taken?(board,index)\n board[index] == \" \" || board[index] == \"\" || board[index] == nil ? false:true\nend", "title": "" }, { "docid": "440fc7b39201150c1635d1859fa485f4", "score": "0.6115284", "text": "def position_taken?(board,index)\nif board[index] == \" \" || board[index] == \"\" || board[index] == nil\nfalse\nelsif board[index] == \"X\" || board[index] == \"O\"\ntrue\nend\n\nend", "title": "" }, { "docid": "f94a37f14d84db563a029bcb4026008a", "score": "0.611525", "text": "def position_taken?(board,index)\n if (board[index]) == \" \"\n false\n elsif (board[index]) == \"\"\n false\n elsif (board[index]) == nil\n false\n elsif (board[index]) == \"X\" || \"O\"\n true\n end\nend", "title": "" }, { "docid": "fff2f295053cbae3c4fdb6ed4e35fcf8", "score": "0.6114991", "text": "def position_taken?(board, index_number)\n if board [index_number] == \" \" || board [index_number] == \"\"\n return false\n elsif board [index_number] == nil\n return false\n else board [index_number] == \"X\" || \"O\"\n return true\n end \nend", "title": "" }, { "docid": "77f69e6eb07d6cee0b3e3bfeee44c8b8", "score": "0.6113095", "text": "def position_taken?(board,index)\n !(board[index].nil? || board[index] == \" \" || board[index] == \"\")\nend", "title": "" }, { "docid": "4fa42133bf00ecd1f5860d9b6bb4b1ab", "score": "0.61130905", "text": "def position_taken?(board,index)\n # get index, check if index is taken\n # check board, false = not taken, true = taken\n #board = [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n board[index] == \" \" || \"\" || nil\n (board[index] == \"X\") || (board[index] == \"O\")\nend", "title": "" }, { "docid": "cd8262263ee5c41afd55d9f6fd1175f7", "score": "0.6106735", "text": "def position_taken?(index)\n ((@board[index] == \"X\") || (@board[index] == \"O\"))\n end", "title": "" }, { "docid": "9ab4cb26ed233eb0758155ac09a5d2ec", "score": "0.61057943", "text": "def get_row(matrix, row)\n matrix[row].select { |n| !n.nil? }\nend", "title": "" }, { "docid": "a60926641ba6c662dcd1ac6a087803f8", "score": "0.6105642", "text": "def position_taken? board,index\n board[index] == \" \" || board[index] == \"\" || board[index] == nil ? true : false\nend", "title": "" }, { "docid": "fead4d439c9e20969ed47bd682097cb0", "score": "0.6105283", "text": "def position_taken?(board,index)\nif board[index] == \" \" || board[index] == \"\" || board[index] == nil\n false\nelsif board[index] == \"X\" || board[index] == \"O\"\ntrue\n end\nend", "title": "" }, { "docid": "095ee2d3f139541fda4ce8cc95ee6cb9", "score": "0.6105236", "text": "def position_taken?(board, index)\n\n!(board[index].nil? || board[index] == \" \"|| board[index] == \"\")\nend", "title": "" }, { "docid": "c97e280da36b78125afa30882e627c10", "score": "0.61050135", "text": "def position_taken?(board,index)\nif board[index] == \" \" || board[index] == \"\" || board[index] == nil\n false \n\nelsif board[index] == \"X\" || board[index] == \"O\"\ntrue\nend\n \nend", "title": "" } ]
8f7bd8842c1e06e58c0db72a535a0123
GET /library_clips/new GET /library_clips/new.xml
[ { "docid": "21ab6469b29bd28151ebb745fd84f7fc", "score": "0.6908125", "text": "def new\n @library_clip = LibraryClip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library_clip }\n end\n end", "title": "" } ]
[ { "docid": "c08e6e02a3fc2c19967c6c21b048f50e", "score": "0.66176367", "text": "def new\n @clilab = Clilab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clilab }\n end\n end", "title": "" }, { "docid": "338816eb37ee671ea0f7d8c54e383866", "score": "0.6577732", "text": "def new\n @library = Library.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library }\n end\n end", "title": "" }, { "docid": "51834473e988a0dcd54581d85e529441", "score": "0.63750875", "text": "def new\n @libro = Libro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @libro }\n end\n end", "title": "" }, { "docid": "5a55b848245a2a7ef79c19389eeb88dd", "score": "0.6362042", "text": "def new\n @catalogs_resource = Catalogs::Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_resource }\n end\n end", "title": "" }, { "docid": "3b78d4d001093a4608b7041218f0ab8d", "score": "0.6327804", "text": "def new\n @poi_cat = PoiCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poi_cat }\n end\n end", "title": "" }, { "docid": "5b4bd5281e95093b1e526afc217beea4", "score": "0.63044614", "text": "def new\n @library_category = LibraryCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library_category }\n end\n end", "title": "" }, { "docid": "c4d779b3dd15215df862138fdad39224", "score": "0.62485826", "text": "def new\n @clip = Clip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clip }\n end\n end", "title": "" }, { "docid": "d8ea74214e44961b9d0ea299ddf00ae2", "score": "0.624237", "text": "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end", "title": "" }, { "docid": "571ae8bec656e39857cb90064e2c4192", "score": "0.62408507", "text": "def new\n @catalogue = Catalogue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogue }\n end\n end", "title": "" }, { "docid": "e0082b64705d22806e6553e93e7f35a2", "score": "0.6222599", "text": "def new\n @circule = Circule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @circule }\n end\n end", "title": "" }, { "docid": "ce2782f3dafb5faeea2cf1deabd754f4", "score": "0.620331", "text": "def new\n @lookup_cogstatus = LookupCogstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_cogstatus }\n end\n end", "title": "" }, { "docid": "616e712c54d073315271cc6dc47338dd", "score": "0.6186566", "text": "def new\n @clipping = Clipping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clipping }\n end\n end", "title": "" }, { "docid": "d2babd32fceba49dc92e0e411c9aad59", "score": "0.61800116", "text": "def new\n @collectionnode = Collectionnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collectionnode }\n end\n end", "title": "" }, { "docid": "2615b0fa01e524018f5a04b022616154", "score": "0.61588174", "text": "def new\n @pcr = Pcr.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pcr }\n end\n end", "title": "" }, { "docid": "6ea1eed1ad061793306122964d805c9c", "score": "0.6158505", "text": "def new\n @pcr = Pcr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pcr }\n end\n end", "title": "" }, { "docid": "0bb1a9a1b44b86d8aff7d61930d8f97b", "score": "0.61573654", "text": "def new \n\t\t@voc = Voc.new \n\t\tdata = get_select_data\n\t\t@grms = data.at(0)\n\t\t@cats = data.at(1)\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @voc }\n\t\tend\n\tend", "title": "" }, { "docid": "d59d214ef2cb7e922f225e634ffa9f0e", "score": "0.6152557", "text": "def new\n @prac = Prac.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prac }\n end\n end", "title": "" }, { "docid": "a34699761ca6e32fce05d26a3a2a159e", "score": "0.610485", "text": "def new\n @library = Library.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library }\n end\n end", "title": "" }, { "docid": "a34699761ca6e32fce05d26a3a2a159e", "score": "0.610485", "text": "def new\n @library = Library.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library }\n end\n end", "title": "" }, { "docid": "8bae652401f7707d1e4fd2b5bbd6ea5a", "score": "0.61044717", "text": "def new\n @components_cog = Components::Cog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @components_cog }\n end\n end", "title": "" }, { "docid": "f76cced5b2bf92fdf20a1a803ce9a427", "score": "0.6084584", "text": "def new\n @cfop = Cfop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cfop }\n end\n end", "title": "" }, { "docid": "b14e7636969d6a4e299d05eeca7b151a", "score": "0.6066951", "text": "def new(options) \n Client.get(\"/lovers/new\", :query => options)\n end", "title": "" }, { "docid": "0ba707c5683fac93c535545c609922aa", "score": "0.6053238", "text": "def new\n @cat = Cat.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end", "title": "" }, { "docid": "6f118fd2c50d93379c70a66e9180a8e5", "score": "0.60475844", "text": "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @catalog }\n end\n end", "title": "" }, { "docid": "6f118fd2c50d93379c70a66e9180a8e5", "score": "0.60475844", "text": "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @catalog }\n end\n end", "title": "" }, { "docid": "54d5be9cc330b79aadbead02683256fd", "score": "0.6046505", "text": "def new\n @closer = Closer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @closer }\n end\n end", "title": "" }, { "docid": "f86c46046c5f077d983a59f9e2a77a40", "score": "0.6045633", "text": "def new\n @lb202555 = Lb202555.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb202555 }\n end\n end", "title": "" }, { "docid": "d3b3e16968a61836790d6e18d516b593", "score": "0.60447216", "text": "def new\n @copperwire = Copperwire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @copperwire }\n end\n end", "title": "" }, { "docid": "3e6df1fdecff6958db73afdb391ac459", "score": "0.60410583", "text": "def index\n @library_clips = LibraryClip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @library_clips }\n end\n end", "title": "" }, { "docid": "a0346a983f3ee4c48503b6d17721abe4", "score": "0.6028044", "text": "def new\n @cargo_category = CargoCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cargo_category }\n end\n end", "title": "" }, { "docid": "31c35aa4cee2839afc75efbd34be448d", "score": "0.60248077", "text": "def new\n @pig = Pig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pig }\n end\n end", "title": "" }, { "docid": "d6f680fc3930dabde9cf302765cbe508", "score": "0.6022693", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @tone_library_patch }\n end\n end", "title": "" }, { "docid": "5da16b2c91298b65822f602999d1754d", "score": "0.60068446", "text": "def new_stories\n get('/newstories.json')\n end", "title": "" }, { "docid": "2529b9b83c02a0fce482634bdabdac76", "score": "0.599713", "text": "def new\n @clip = Clip.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clip }\n format.xml { render xml: @clip }\n end\n end", "title": "" }, { "docid": "c17ef6df0e91c9dd46325e69f3c9b770", "score": "0.5995735", "text": "def new\n # XXXFIX P2: Want to have access to new items per category, also with RSS feed\n @new_products = Product.find_new_for_listing()\n options = {\n :feed => {:title => \"#{SmartFlix::Application::SITE_NAME} new titles\", :link => url_for(:format => nil)},\n :item => {\n :title => :listing_name,\n :pub_date => :date_added,\n :link => lambda { |p| url_for(:action => p.action, :id => p.id) }\n }\n }\n end", "title": "" }, { "docid": "40b562bc5c4bdb0d5d2c416c97e4af2c", "score": "0.59950745", "text": "def new\n @libro_visitum = LibroVisitum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @libro_visitum }\n end\n end", "title": "" }, { "docid": "0f9125edf5778c8f9b0705a235c7a290", "score": "0.5993561", "text": "def new\n @outlay_category = @house_book.outlay_categories.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @outlay_category }\n end\n end", "title": "" }, { "docid": "96a33d4f681b7a9f59384467adc3ba2f", "score": "0.5992158", "text": "def new\n @shopcat = Shopcat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopcat }\n end\n end", "title": "" }, { "docid": "45c9c674db5740c31cc49de63222f0f7", "score": "0.5988807", "text": "def new\n @pm_lib = PmLib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pm_lib }\n end\n end", "title": "" }, { "docid": "45c9c674db5740c31cc49de63222f0f7", "score": "0.5988807", "text": "def new\n @pm_lib = PmLib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pm_lib }\n end\n end", "title": "" }, { "docid": "4273130498cfdc1fb4be661e81c2ff0c", "score": "0.5988725", "text": "def new\n @scrap_xml = ScrapXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrap_xml }\n end\n end", "title": "" }, { "docid": "fbf1b7fff2527b5ad8217528e1aacac3", "score": "0.59840906", "text": "def new\n @lb40 = Lb40.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb40 }\n end\n end", "title": "" }, { "docid": "86d7e5001304b2ec899dc066855630ce", "score": "0.5982419", "text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "title": "" }, { "docid": "86d7e5001304b2ec899dc066855630ce", "score": "0.5982419", "text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "title": "" }, { "docid": "86d7e5001304b2ec899dc066855630ce", "score": "0.5982419", "text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "title": "" }, { "docid": "a3405258e82fcc93119147f4291c6794", "score": "0.5976755", "text": "def new\n @poll = @p.polls.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end", "title": "" }, { "docid": "e159ea3e0caa584a0d6769336dd2b77c", "score": "0.5975915", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @vip_service_service_category }\n end\n end", "title": "" }, { "docid": "92d927c3aac206057a5f80de9c067398", "score": "0.59724855", "text": "def new\n @lab_cat = LabCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_cat }\n end\n end", "title": "" }, { "docid": "266d31ae0905a060ff33d386c1a6529e", "score": "0.5968419", "text": "def new\n @list = List.new\n\n breadcrumbs.add 'Lists', lists_path\n breadcrumbs.add 'New'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list }\n end\n end", "title": "" }, { "docid": "ec35e5d5e64dd26bc53cec9c5fd8e8e6", "score": "0.596657", "text": "def new\n @paper_category = PaperCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paper_category }\n end\n end", "title": "" }, { "docid": "2aee7b4423785691680a305f27f41d78", "score": "0.59652877", "text": "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end", "title": "" }, { "docid": "2aee7b4423785691680a305f27f41d78", "score": "0.59652877", "text": "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end", "title": "" }, { "docid": "3c2de46776864f0e05a276b30507eb1a", "score": "0.5962536", "text": "def new\n\t\t@library = Library.new\n\t\trender :new\n\tend", "title": "" }, { "docid": "fb0218c188e67eec296084c069f4f438", "score": "0.59603745", "text": "def new\n @glycodb = Glycodb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @glycodb }\n end\n end", "title": "" }, { "docid": "0e353c8a63dc8e2eadfee53565031e9c", "score": "0.5958596", "text": "def new\r\n @cargo_category = CargoCategory.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @cargo_category }\r\n end\r\n end", "title": "" }, { "docid": "59d637559b97bbf46b00fdfa496c1a61", "score": "0.59580165", "text": "def new\n @crop = Crop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crop }\n end\n end", "title": "" }, { "docid": "8003c059774fd45f4cf5fb8ece01c5f2", "score": "0.59506184", "text": "def new\n @scrapper = Scrapper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrapper }\n end\n end", "title": "" }, { "docid": "8a850ca15cb3b233afbf826e96580eb0", "score": "0.5945635", "text": "def new\n @native_library = MavenJnlp::NativeLibrary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @native_library }\n end\n end", "title": "" }, { "docid": "db34a4ab5639c18e00d9160aa49f4ba9", "score": "0.5942741", "text": "def create\n @clilab = Clilab.new(params[:clilab])\n\n respond_to do |format|\n if @clilab.save\n flash[:notice] = 'Clilab was successfully created.'\n format.html { redirect_to(@clilab) }\n format.xml { render :xml => @clilab, :status => :created, :location => @clilab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @clilab.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9ac13d77774535a9cef8d54c9f0a06d", "score": "0.59369695", "text": "def new\n @pkg = Pkg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pkg }\n end\n end", "title": "" }, { "docid": "d364e92db1692a7f0e8dc70d5b0079ea", "score": "0.5936442", "text": "def new\n @version = @page.versions.new\n\n respond_to do |format|a\n format.html # new.html.erb\n format.xml { render :xml => @version }\n end\n end", "title": "" }, { "docid": "b9c9861abaf153e29b780732af0606fb", "score": "0.59254533", "text": "def new\n @response, @document = search_service.fetch(params[:id])\n\n # The individual item object for use in the view. May wind up\n # with nil for copy/item multi-level holdings, bah.\n @holding = @document.to_holdings.find {|h| h.id == params[:item_id]}\n\n\n horizon_bib_id = @document.ils_bib_id\n\n @ils_request = HipPilot::Request.new(:bib_id => horizon_bib_id, :item_id => params[:item_id])\n\n @hip_pilot.init_request(@ils_request)\n end", "title": "" }, { "docid": "b808f4b103f39024bbb154fefd7bcb51", "score": "0.59249455", "text": "def new\n @template_folder_collab = TemplateFolderCollab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_folder_collab }\n end\n end", "title": "" }, { "docid": "5be61eb0d62021322daac2f4ddee3085", "score": "0.59246945", "text": "def new\n @orange = Orange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orange }\n end\n end", "title": "" }, { "docid": "4022560cb858019a8545a6dd135ea47c", "score": "0.5921894", "text": "def new\n @soaplab_server = SoaplabServer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @soaplab_server }\n end\n end", "title": "" }, { "docid": "e62586e601ab0025830474ea02aa70e6", "score": "0.59193695", "text": "def new\n @life_catalog = LifeCatalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @life_catalog }\n end\n end", "title": "" }, { "docid": "c52520d1bc58c1f23a76367f679c1bbc", "score": "0.59188396", "text": "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @client }\n end\n end", "title": "" }, { "docid": "01c203d60aabe6c3168a5f4913f5324d", "score": "0.5918762", "text": "def new\n @clip = Clip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clip }\n end\n end", "title": "" }, { "docid": "01c203d60aabe6c3168a5f4913f5324d", "score": "0.5918762", "text": "def new\n @clip = Clip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clip }\n end\n end", "title": "" }, { "docid": "9f578f2078065f738011a2ac48a9e5aa", "score": "0.5917144", "text": "def new\n @ccdisclosure = Ccdisclosure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ccdisclosure }\n end\n end", "title": "" }, { "docid": "265d91952f8898affb0ca34eb2ed6eca", "score": "0.5913533", "text": "def new\n # puts \"\\n--calls#new\".yellowish\n \n @call = Call.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @call }\n end\n end", "title": "" }, { "docid": "1572043787fb1ce6cc13d4a754584bc7", "score": "0.59103864", "text": "def new_rest\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "8984d4b325c39599acad812e5c7dd81e", "score": "0.5910054", "text": "def new\n @cofile = Cofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cofile }\n end\n end", "title": "" }, { "docid": "8984d4b325c39599acad812e5c7dd81e", "score": "0.5910054", "text": "def new\n @cofile = Cofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cofile }\n end\n end", "title": "" }, { "docid": "9feeda8ae869077ea73af48a3fa021f8", "score": "0.59081346", "text": "def new\n @cp_application = CpApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cp_application }\n end\n end", "title": "" }, { "docid": "45ce9515d27bc21e72828e07777678be", "score": "0.5908084", "text": "def new\n @lb202554 = Lb202554.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb202554 }\n end\n end", "title": "" }, { "docid": "4b5d453f10bba15cfb4cc94e42b5472b", "score": "0.590687", "text": "def new\n @pool_plate = PoolPlate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool_plate }\n end\n end", "title": "" }, { "docid": "7b689672fb051affca32a268fdcb4736", "score": "0.59042424", "text": "def new\n\tuuid = SecureRandom.uuid\n\t@new_url = searches_url + \"/\" + uuid # creates http://localhost/search/123-34552-adsfrjha-234\n\tresponse.set_header(\"Location\", @new_url)\n respond_to do |format|\n format.html { render :new, status: 201 }\n format.json { render :new, status: 201 }\n format.jsonld { render :new, formats: :json, status: 201 }\n end\n\t\n end", "title": "" }, { "docid": "ffe707edc6453a505627a6c5128d91ff", "score": "0.59042186", "text": "def new\n @clip = Clip.new\n @url = params[:url] if params[:url]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clip }\n end\n end", "title": "" }, { "docid": "3554410b7b340a66df18f713f267b3d6", "score": "0.59018517", "text": "def new\n @grablist = Grablist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @grablist }\n end\n end", "title": "" }, { "docid": "5bcbabd7e583c99980369e2f277c1f89", "score": "0.59015083", "text": "def new\n @libro = Libro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @libro }\n end\n end", "title": "" }, { "docid": "5bcbabd7e583c99980369e2f277c1f89", "score": "0.59015083", "text": "def new\n @libro = Libro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @libro }\n end\n end", "title": "" }, { "docid": "5bcbabd7e583c99980369e2f277c1f89", "score": "0.59015083", "text": "def new\n @libro = Libro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @libro }\n end\n end", "title": "" }, { "docid": "94ceaaf9250cdc3d062aeb18bbab1a52", "score": "0.59008443", "text": "def new\n @newstuff = Newstuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newstuff }\n end\n end", "title": "" }, { "docid": "41528a53a52ed8dd5c6778516593c6a7", "score": "0.5900841", "text": "def new\n @cord_clip = CordClip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cord_clip }\n end\n end", "title": "" }, { "docid": "16b9569dda70acebb63f5bd8a1a2b09a", "score": "0.5899115", "text": "def new_rest\n @page_usage = PageUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage }\n end\n end", "title": "" }, { "docid": "5717aad698749b692a7c291fb4284ba0", "score": "0.5898972", "text": "def new\n @lb402555 = Lb402555.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb402555 }\n end\n end", "title": "" }, { "docid": "7d40046cbdc72e8677bbbad72ac5e227", "score": "0.5889186", "text": "def new\n @witch_cat = WitchCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @witch_cat }\n end\n end", "title": "" }, { "docid": "a5813dcaa71b0676cbb1fd98a440d90c", "score": "0.58885705", "text": "def new\n @subrack = Subrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subrack }\n end\n end", "title": "" }, { "docid": "70361104f2c186f0e78517aa58fccb06", "score": "0.58874714", "text": "def new\n @crawl = Crawl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawl }\n end\n end", "title": "" }, { "docid": "b5bae3c9961e7915a001f959158a2b1c", "score": "0.58844566", "text": "def new\n @counter = Counter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counter }\n end\n end", "title": "" }, { "docid": "1ce8c6100a3d082b498ee1b93f6395e4", "score": "0.5883692", "text": "def new\n path = \"/view/new\"\n retrieve_stories(path,true)\n end", "title": "" }, { "docid": "e1a775e22775c35a906bb69fb64adc01", "score": "0.58829534", "text": "def new\n @collage = Collage.new\n get_all_categories\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @collage }\n end\n end", "title": "" }, { "docid": "b47d70607489846a54f78f2c71487d2f", "score": "0.5882909", "text": "def new\n @clicks = Click.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clicks }\n end\n end", "title": "" }, { "docid": "63eb376ac06fe781fbd17fcc7693f6b9", "score": "0.588082", "text": "def new\n @client_list = ClientList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client_list }\n end\n end", "title": "" }, { "docid": "ab1b09c3761121d60a05096a8647f744", "score": "0.5879883", "text": "def new\n @pcr = current_house.pcrs.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pcr }\n end\n end", "title": "" }, { "docid": "138a3a21d2df498d578cba9705c6520b", "score": "0.587104", "text": "def new\n @link_collection = LinkCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link_collection }\n end\n end", "title": "" }, { "docid": "7e78d3dfe661e304f47675649561ef66", "score": "0.58700967", "text": "def new\n @vip_style = VipStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vip_style }\n end\n end", "title": "" }, { "docid": "426b398e2b4a2ea5bad261c4c9175842", "score": "0.5866344", "text": "def new\n @cyclist = Cyclist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cyclist }\n end\n end", "title": "" }, { "docid": "d1711de07286425bf4d451f48c5399ff", "score": "0.5862116", "text": "def new\n @cg = Cg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cg }\n end\n end", "title": "" } ]
556177db28c3ca3f546935dd146c02d0
A method for Visitor pattern.
[ { "docid": "9c3f7e4fd17eaf52e7e1281fe586a0ef", "score": "0.0", "text": "def accept(evaluator)\n evaluator.reserved(self)\n end", "title": "" } ]
[ { "docid": "2a4bf63f7b1817f4bdf64b7c3f25dd2b", "score": "0.8370765", "text": "def accept(visitor); end", "title": "" }, { "docid": "2a4bf63f7b1817f4bdf64b7c3f25dd2b", "score": "0.8370765", "text": "def accept(visitor); end", "title": "" }, { "docid": "545e2df060ab5bcc5a821cb1e7f05dc2", "score": "0.7802525", "text": "def accept(_visitor)\n raise NotImplementedError\n end", "title": "" }, { "docid": "d3b18a09053b437ffdb5a51d62989d6c", "score": "0.76122034", "text": "def accept(visitor)\n visitor.visit(self)\n end", "title": "" }, { "docid": "3466dd75e21e9dd720aa22cae1b6d34b", "score": "0.759846", "text": "def accept(visitor)\n visitor.visit(self)\n end", "title": "" }, { "docid": "620271bae19a4ccf6ecd7d5d05d994a5", "score": "0.72118574", "text": "def accept_visitor(visitor)\n visit_method_name = \"visit#{basename(self.class.name.to_s.gsub(/::/, '/'))}\".to_sym\n visitor.send(visit_method_name, self) if visitor.respond_to?(visit_method_name)\n end", "title": "" }, { "docid": "d85015a46a2b0bf5739951ae93114017", "score": "0.68024784", "text": "def visit(&block)\n block.call self\n end", "title": "" }, { "docid": "3895a00e13ac8d410f721096d3094475", "score": "0.67998224", "text": "def accept visitor\n visitor.accept_raw self\n end", "title": "" }, { "docid": "6bc7fd97073ae6f21b3ab0f6047c7caa", "score": "0.67263395", "text": "def visit(&block)\n # block.call self\n yield self\n end", "title": "" }, { "docid": "71de3adf8f8df3cc156b343db814ee36", "score": "0.66362524", "text": "def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end", "title": "" }, { "docid": "5158ba77e9c4fbdaa1e98a962a4c727b", "score": "0.65232396", "text": "def visit(node)\n visitor = self.class.visitor(node.class)\n\n visitor.visit(self, node)\n end", "title": "" }, { "docid": "48f67b4b93d50d02135bd7e4e3871754", "score": "0.6382928", "text": "def accept(aVisitor)\n aVisitor.visit_terminal(self)\n end", "title": "" }, { "docid": "ac36160fcd8ce2403bf8036da4838511", "score": "0.62678593", "text": "def accept visitor\n visitor.accept_verbatim self\n end", "title": "" }, { "docid": "c46bcb80eb12ace546cab385ab1a1bfa", "score": "0.6192962", "text": "def accept visitor\r\n visitor.accept_hard_break self\r\n end", "title": "" }, { "docid": "69d0ba4c7324802a4093784b72d07d98", "score": "0.6127083", "text": "def visit\r\n self.map {|x| puts x}\r\n end", "title": "" }, { "docid": "806efd1c59005661b8b6c8c928f30d00", "score": "0.61204165", "text": "def accept(aVisitor)\n aVisitor.visit_terminal(self)\n end", "title": "" }, { "docid": "3c50f87227a735ac787f223cdf926f2d", "score": "0.61204046", "text": "def accept(aVisitor)\n aVisitor.visit_nonterminal(self)\n end", "title": "" }, { "docid": "3c50f87227a735ac787f223cdf926f2d", "score": "0.61204046", "text": "def accept(aVisitor)\n aVisitor.visit_nonterminal(self)\n end", "title": "" }, { "docid": "ccb6545623194af6cac23635b246a950", "score": "0.6090634", "text": "def accept visitor\n visitor.accept_hard_break self\n end", "title": "" }, { "docid": "f74f6c10c0da93b7e6b8873a9c698256", "score": "0.6064024", "text": "def accept(aVisitor)\n aVisitor.visit_unary_expression(self)\n end", "title": "" }, { "docid": "ad4bd0ed3a01c91e01144de14cd4512e", "score": "0.60604274", "text": "def accept visitor\n visitor.accept_heading self\n end", "title": "" }, { "docid": "a3ab4d2a155945c038e5e6e3a0aa8699", "score": "0.6007653", "text": "def accept_visitor(visitor)\n visitor.visit_left_paddle(@paddles[0])\n visitor.visit_right_paddle(@paddles[1])\n @map.accept_visitor(visitor)\n @bonuses.each { |bonus| visitor.visit_bonus(bonus) }\n @balls.each { |ball| visitor.visit_ball(ball) }\n end", "title": "" }, { "docid": "41e63b395a0e713921d1dd6b4bab1846", "score": "0.5985223", "text": "def visit subject\n pp subject\n end", "title": "" }, { "docid": "c797e4eb3dcaa0f31fc10d0b70a45ceb", "score": "0.5926145", "text": "def accept(aVisitor)\n aVisitor.visit_nonterminal(self)\n end", "title": "" }, { "docid": "5e9e8e3463bf1567075c47635fffb0e9", "score": "0.59239966", "text": "def add_visitors(visitors)\n if visitors.is_a? Array\n visitors.each do |target, visitor|\n add_visitor target, visitor\n end\n else\n visitors.public_methods(false).grep(/^visit_/).map do |method|\n add_visitor method.to_s.sub( /^visit_/, '' ), visitors.method( method )\n end\n end\n self.visitors\n end", "title": "" }, { "docid": "cedadf292ab643f7999da97c9a3ae0d0", "score": "0.5921781", "text": "def accept(*) end", "title": "" }, { "docid": "cedadf292ab643f7999da97c9a3ae0d0", "score": "0.5921781", "text": "def accept(*) end", "title": "" }, { "docid": "cedadf292ab643f7999da97c9a3ae0d0", "score": "0.5921781", "text": "def accept(*) end", "title": "" }, { "docid": "728e07770fb3d0ea79b34c81b70804be", "score": "0.5878299", "text": "def visited\n clone.visit!\n end", "title": "" }, { "docid": "2c543dc9241d1f84ac89ae4f55c17845", "score": "0.5874051", "text": "def accept(visitor)\n visitor.visit_file(self)\n end", "title": "" }, { "docid": "59e3c7d64ea38cd40488707fa61c6ae9", "score": "0.5837951", "text": "def traverse; end", "title": "" }, { "docid": "c0d9b04118519a0dfec02190c70e5fd7", "score": "0.5805021", "text": "def accept(being) \n being.visit_cave(self)\n end", "title": "" }, { "docid": "d7085247b907f2207b1e1fcb5d0f6e09", "score": "0.5797865", "text": "def visit(&block)\n raise \"need block\" if not block_given?\n\n block.call(self)\n\n begin\n @value.each do |o|\n o.visit(&block)\n end\n rescue\n end\n end", "title": "" }, { "docid": "ccbd98fdb480dcc974a26aa4d44d05b5", "score": "0.57905096", "text": "def enter\n visitors.first.enter\n end", "title": "" }, { "docid": "340f44784de5d0eb54c30e7574055c30", "score": "0.57758933", "text": "def visit(_bytecode)\n raise NotImplementedError, 'subclass responsibility'\n end", "title": "" }, { "docid": "34f4ead1c8a9f11e3b440e142402d863", "score": "0.57710266", "text": "def take_as(objType, name)\n @visitor = Visitor.new(objType)\n @visitor.name = name\n @visitor\n end", "title": "" }, { "docid": "07b00e4e9c2f140e11b8d2147f783cd7", "score": "0.57644075", "text": "def visit(elem, data)\r\n @@log.debug(\"XmlVisitor::visit\")\r\n @@log.debug(elem.inspect)\r\n\r\n case elem.name\r\n when 'Compute'\r\n data = visitCompute(elem, data)\r\n\r\n when 'Operator'\r\n data = visitOperator(elem, data)\r\n\r\n when 'LeftOperand'\r\n data = visitLeftOperand(elem, data)\r\n\r\n when 'RightOperand'\r\n data = visitRightOperand(elem, data)\r\n\r\n when 'Brace'\r\n data = visitBrace(elem, data)\r\n\r\n when 'Constant'\r\n data = visitConstant(elem, data)\r\n\r\n when 'Rule'\r\n data = visitRule(elem, data)\r\n\r\n when 'Ruleset'\r\n data = visitRuleset(elem, data)\r\n\r\n when 'PPM'\r\n data = visitPPM(elem, data)\r\n\r\n when 'DPM'\r\n data = visitDPM(elem, data)\r\n\r\n when 'Condition'\r\n data = visitCondition(elem, data)\r\n\r\n when 'IfActions'\r\n data = visitIfActions(elem, data)\r\n\r\n when 'ElseActions'\r\n data = visitElseActions(elem, data)\r\n\r\n when 'Assign'\r\n data = visitAssign(elem, data)\r\n\r\n when 'AssignTo'\r\n data = visitAssignTo(elem, data)\r\n\r\n when 'AssignValue'\r\n data = visitAssignValue(elem, data)\r\n\r\n when 'Lookup'\r\n data = visitLookup(elem, data)\r\n\r\n when 'LOOKUP'\r\n data = visitLookupData(elem, data)\r\n\r\n when 'XParameter'\r\n data = visitXParameter(elem, data)\r\n\r\n when 'YParameter'\r\n data = visitYParameter(elem, data)\r\n\r\n when 'Function'\r\n data = visitXmlFunction(elem, data)\r\n\r\n when 'Args'\r\n data = visitArgs(elem, data)\r\n\r\n when 'Arg'\r\n data = visitArg(elem, data)\r\n\r\n else\r\n data = visitDefault(elem, data)\r\n end # case\r\n\r\n return data\r\n end", "title": "" }, { "docid": "e2f5f4e52841910290ca3f8f6ff9e739", "score": "0.57486457", "text": "def convert(aVisitor)\n aVisitor.subscribe(self)\n aVisitor.start\n aVisitor.unsubscribe(self)\n curr_hash\n end", "title": "" }, { "docid": "882742e2eb5be4644f88973c31066003", "score": "0.5728208", "text": "def visit(visitor, result=Array.new, level=0)\n # {{{\n if visitor.match(self) then\n result += self\n \n my_children_groups = User_Group_Hierarchy.select { |g|\n g.where(g['node_id__parent'] == attr['user_group_id'])\n }\n \n my_children_groups.each { |g|\n g.visit(visitor, result, level+1)\n }\n return result\n \n end\n return nil\n end", "title": "" }, { "docid": "ba2e5e6db286086635f5a95be8dde3f3", "score": "0.57122403", "text": "def visit(item)\n @visited << item\n @visit.call(item)\n end", "title": "" }, { "docid": "c576191618d9c3f09c97f37662804229", "score": "0.56953937", "text": "def accept; end", "title": "" }, { "docid": "c576191618d9c3f09c97f37662804229", "score": "0.56953937", "text": "def accept; end", "title": "" }, { "docid": "01a8b3a4a982f3e608e257b4a774b2d2", "score": "0.5668122", "text": "def visit(visitor, parent=nil)\n visitor.__send__ self.node_name, self, parent\n children { |c| c.visit visitor, self }\n end", "title": "" }, { "docid": "c2244bafba633ec312dd40740c3b5189", "score": "0.56605494", "text": "def visit_node(n); end", "title": "" }, { "docid": "3cc79bc4d715768e5b8b8544171a737e", "score": "0.565672", "text": "def accept(evaluator)\n evaluator.astree(self)\n end", "title": "" }, { "docid": "9971da9fbcb5a3ea5cdb19de37457c9a", "score": "0.56400526", "text": "def visit(params = {})\n @parameters.visit params\n end", "title": "" }, { "docid": "00a2a6c2f0d49f8446376cddc10e7dc5", "score": "0.5625881", "text": "def visit(builder = nil)\n return builder.send(type,*self) if builder.respond_to?(type)\n return self.first.visit(builder) if self.size == 1\n self.map { |c| c.visit(builder) }\n end", "title": "" }, { "docid": "89966cc4e2e78c897eb5df5bec7db2d6", "score": "0.5624265", "text": "def source\n visit(input)\n end", "title": "" }, { "docid": "b9d6b878fb8e654ac61ed0c2506252d0", "score": "0.562103", "text": "def accept visitor\n visitor.start_accepting\n\n visitor.accept_document self\n\n visitor.end_accepting\n end", "title": "" }, { "docid": "f6e11ef28327c78832553a48a56756d4", "score": "0.55869126", "text": "def accept visitor\n visitor.accept_list_item_start self\n\n @parts.each do |part|\n part.accept visitor\n end\n\n visitor.accept_list_item_end self\n end", "title": "" }, { "docid": "543cd48a3fb70775782ef453f63e4573", "score": "0.55814487", "text": "def visit(entity)\n traverse(filter(entity))\n end", "title": "" }, { "docid": "eb7ce11f8973e446c9b5f69500a6e842", "score": "0.5569782", "text": "def accept_name(visitor, *rest)\n if nodeType == ELEMENT_NODE\n name_method = \"visit_name_\" + nodeName\n visitor.send(name_method, self, *rest)\n else\n self.accept(visitor, *rest)\n end\n end", "title": "" }, { "docid": "ad13fe033f262fe713cf07cc6a87e10e", "score": "0.55683464", "text": "def visit(&action)\n cont = action.call(self)\n if (cont != :stop)\n @other.each {|k,child|\n visit_child(child, &action)\n }\n end\n end", "title": "" }, { "docid": "0e87bf70d3c8c2785dbd35de2e11e9d2", "score": "0.55055356", "text": "def accept\r\n end", "title": "" }, { "docid": "850b4b492b34b777186580451f70110a", "score": "0.54331905", "text": "def accept=(_arg0); end", "title": "" }, { "docid": "05a4952a870e8dac9852553521e6449d", "score": "0.5423278", "text": "def client_code(components, visitor)\n # ...\n components.each do |component|\n component.accept(visitor)\n end\n # ...\nend", "title": "" }, { "docid": "c75155fa8dcf5f8dac29ac3af3ab3529", "score": "0.5340469", "text": "def visit(source)\n target = @copier.call(source)\n super(source, target)\n end", "title": "" }, { "docid": "c25195b11b5305dc4986708370350f83", "score": "0.5340148", "text": "def visit_product\n raise NotImplementedError, 'This is an interface'\n end", "title": "" }, { "docid": "6cb0f534d43c926d56e10c1ed637305c", "score": "0.5301011", "text": "def view(visitor, options={})\n build_or_create_visit(visitor, {:unique => !visited_by?(visitor)}.merge(options))\n end", "title": "" }, { "docid": "ada8a865a8252ba5ee1c773eda67a1ea", "score": "0.52720094", "text": "def register(curr); end", "title": "" }, { "docid": "41f78227d48683a0417671a6f214f3ea", "score": "0.52627593", "text": "def visit(_visit_path)\n true\n end", "title": "" }, { "docid": "c146bb5878b7bbbf636cf1f85f06641e", "score": "0.5255238", "text": "def children_accept(visitor, *rest)\n ret = []\n @children && @children.each { |node|\n ret.push(node.accept(visitor, *rest))\n }\n ret\n end", "title": "" }, { "docid": "a8541f79fb4d1684d7ca3124a4efebb6", "score": "0.52426517", "text": "def travel(*args, &block); end", "title": "" }, { "docid": "9195939fb63a314bf192776cd251d374", "score": "0.5239095", "text": "def visit\n @mark = true\n end", "title": "" }, { "docid": "a70cd38892e1723254d0bb1f828cb524", "score": "0.5218622", "text": "def dispatch\n raise NotImplementedError\n end", "title": "" }, { "docid": "8044587d1aa59b0392d1a78551717db2", "score": "0.5193135", "text": "def walk; end", "title": "" }, { "docid": "a2f839ff959428737afca92a2dd4b5ed", "score": "0.5190646", "text": "def ptree_visitor(aPTree)\n return ParseTreeVisitor.new(aPTree)\n end", "title": "" }, { "docid": "5dc3f8de286a526d12246e0e91e510b6", "score": "0.51735604", "text": "def new_visit\n @phrase.add_visit\n end", "title": "" }, { "docid": "e190594e9aab6fafcacf7f30322d196a", "score": "0.5171912", "text": "def visitor_params\n params[:visitor]\n end", "title": "" }, { "docid": "79825052abd062bdb0871c74dab9efea", "score": "0.51656556", "text": "def match(object); end", "title": "" }, { "docid": "6362bbe028767ad4779246103b8b5b53", "score": "0.51638055", "text": "def accept(evaluator)\n evaluator.super_method(self)\n end", "title": "" }, { "docid": "f16ff32cc5d62b67dce4d0f2f400dfbd", "score": "0.51620156", "text": "def accept\n\n end", "title": "" }, { "docid": "a53272aace6a9116220f7a07137734cb", "score": "0.5142066", "text": "def _V(data) ; end", "title": "" }, { "docid": "5df6f34ec01abb1685162157714dd4aa", "score": "0.5124899", "text": "def visit\r\n cursor = @head\r\n while cursor\r\n puts cursor.data\r\n end\r\n end", "title": "" }, { "docid": "488da7a3e283d4231495c002ec5035f4", "score": "0.5119067", "text": "def accept(visitor)\n visitor.visit_keyval_node(self)\n end", "title": "" }, { "docid": "eb26c9fff1348865932a9596a541754d", "score": "0.51170236", "text": "def accept visitor\n visitor.accept_blank_line self\n end", "title": "" }, { "docid": "4a7d8471f11656eb8d11f4cece589dac", "score": "0.5116766", "text": "def accept(aVisitor)\n aVisitor.start_visit_pforest(self)\n\n # Let's proceed with the visit of nodes\n root&.accept(aVisitor)\n\n aVisitor.end_visit_pforest(self)\n end", "title": "" }, { "docid": "8cd4204418e3219039f8646157a8822c", "score": "0.5115235", "text": "def for_node; end", "title": "" }, { "docid": "f697550d1d13e6384cf1363adab96506", "score": "0.50947976", "text": "def visit(node, &operator)\n visit_root(node, &operator)\n end", "title": "" }, { "docid": "9d19d4b4a7dd7f8eb03ddcf906eb06d4", "score": "0.50931424", "text": "def accept(aVisitor)\n aVisitor.start_visit_ptree(self)\n\n # Let's proceed with the visit of nodes\n root&.accept(aVisitor)\n\n aVisitor.end_visit_ptree(self)\n end", "title": "" }, { "docid": "a3294f7ee23c1dde7d724288e0590ce4", "score": "0.5092189", "text": "def information?\n not_a_visitor\n end", "title": "" }, { "docid": "0e43fc7a8c83dfff84f6ad972eef4d5f", "score": "0.5090895", "text": "def visit_offerwall\n raise NotImplementedError\n end", "title": "" }, { "docid": "c204e8cf882e7b635517c57bcad3fa2b", "score": "0.5080795", "text": "def show_visitor\n @visitor = visitor_db_or_new\n @visitor = Visitor.create if Visitor.all.empty?\n end", "title": "" }, { "docid": "f905f62e80b56bea71ad8c86a9ba7a20", "score": "0.50694704", "text": "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "title": "" }, { "docid": "f905f62e80b56bea71ad8c86a9ba7a20", "score": "0.50694704", "text": "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "title": "" }, { "docid": "f905f62e80b56bea71ad8c86a9ba7a20", "score": "0.50694704", "text": "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "title": "" }, { "docid": "25512b5eff9b8a2fc98dc5765243432b", "score": "0.5066234", "text": "def captures() end", "title": "" }, { "docid": "507de57c4d1e0e6082e9cc9872d24182", "score": "0.5052421", "text": "def accept(evaluator)\n evaluator.return_values(self)\n end", "title": "" }, { "docid": "30fe98dfebeee158405e0cc95431aa34", "score": "0.5048905", "text": "def visit\n self.update(last_visit: DateTime.now);\n self.update(visit_count: (self.visit_count + 1));\n end", "title": "" }, { "docid": "6da36ca2890da46a7e4d3045fabe7b5c", "score": "0.50444067", "text": "def accept(evaluator)\n evaluator.instance_variable(self)\n end", "title": "" }, { "docid": "9085d1c84a4b380173f15a67a571877e", "score": "0.5036873", "text": "def bark(visitor)\n puts \"My dog is barking at #{visitor}\"\n end", "title": "" }, { "docid": "79c0ea7126cb2feebc2d88a57814981e", "score": "0.5030533", "text": "def accept(evaluator)\n evaluator.binary(self)\n end", "title": "" }, { "docid": "4c32b93a94da79cde4c289466c89334e", "score": "0.5029492", "text": "def accept(evaluator)\n evaluator.call(self)\n end", "title": "" }, { "docid": "72279f018b12e529c776b21b21b46946", "score": "0.50232273", "text": "def traverse(&block); end", "title": "" }, { "docid": "72279f018b12e529c776b21b21b46946", "score": "0.50232273", "text": "def traverse(&block); end", "title": "" }, { "docid": "947ed027bef1e9d343be1c58ec6ba290", "score": "0.50049084", "text": "def accept(observer)\n observer.on_next value\n end", "title": "" }, { "docid": "0f30c3a0879a2fdc96f50582a4f99d18", "score": "0.4999682", "text": "def visit(visitor, options={})\n visited_by?(visitor) ? false : build_or_create_visit(visitor, {:unique => true}.merge(options))\n end", "title": "" }, { "docid": "586bd7a7390acc24b73251f4c8fb4f86", "score": "0.4993486", "text": "def greibach_normal_form\n raise NotImplementedError\n end", "title": "" }, { "docid": "d351cb0caafe0fe6bc657cc6276d25f1", "score": "0.4990312", "text": "def accept(evaluator)\n evaluator.label(self)\n end", "title": "" }, { "docid": "a2f013e25dcb95e1b2d5b3f8a64a606b", "score": "0.4988245", "text": "def visit_Arel_Nodes_Top o, collector\n collector\n end", "title": "" }, { "docid": "3955efde4ab2e2dd6b129790e4ef9c62", "score": "0.49849886", "text": "def accept(evaluator)\n evaluator.exprs(self)\n end", "title": "" } ]
52e5868dca2699afe5323764ba03aeef
function to print one line at a time I don't quite understand how it works
[ { "docid": "b48f123980fdfcadc593271bca5b964c", "score": "0.0", "text": "def print_a_line(line_count, f)\n puts \"#{line_count}, #{f.gets.chomp}\"\nend", "title": "" } ]
[ { "docid": "8de393b8ffa6851f4e01b1d7b027f7d1", "score": "0.756233", "text": "def print_line(count)\n (1..count).each do |i| # or, equivalently, for i in (1..count)\n print \"*\" # This prints a single \"*\"\n end\nend", "title": "" }, { "docid": "94aa11be9c42431686b41efe60af6c07", "score": "0.7291814", "text": "def print_line(ch); 80.times{print ch}; print \"\\n\"; end", "title": "" }, { "docid": "4766b3763fc305896bed6d008cb9d118", "score": "0.7053799", "text": "def print_line\n\n # print is like System.out.print (no carriage return)\n # puts is like System.out.println (implicit carriage return at end)\n \n # Print the '*' character 20 times to make a line\n 20.times { print '*' }\n # Now add a carriage return\n # Note that EVERY statement in Ruby return something - this\n # returns \"nil\" and we can ignore it, but it is returned\n puts\nend", "title": "" }, { "docid": "e358b4a4e10d68a680fa4f5b1e286e9e", "score": "0.7032585", "text": "def print_line *a\n sync { _print_line(*a) }\n end", "title": "" }, { "docid": "e1176ad980940450c0edc9df620e1f4b", "score": "0.70273083", "text": "def lineax(n)\n n.times do\n print '*'\n end\n print \"\\n\"\nend", "title": "" }, { "docid": "aba1199edb9053a6859fb9ad11d9121f", "score": "0.69785124", "text": "def print_a_line(line_count, f) # how does this know to get one line at a time?\n puts \"#{line_count}, #{f.gets.chomp}\"\nend", "title": "" }, { "docid": "ff512e5c02fd24e3e4b76dfac5a56dad", "score": "0.6976057", "text": "def print_line\n puts ' - [L] Line'\n puts ' - [N] Line'\n puts ' - [6] Line'\n puts '-=' * 20\n puts ' - [Q] Exit'\n puts '-=' * 20\nend", "title": "" }, { "docid": "bee94f82c6b0737ac65ab9d3a94eb1d0", "score": "0.6900497", "text": "def new_line(times = 1)\r\n times.times do\r\n print \"\\n\"\r\n end\r\n end", "title": "" }, { "docid": "76bed6f3180b122f25489ef985e749c6", "score": "0.68823755", "text": "def print(line)\n end", "title": "" }, { "docid": "32dd2f916920cbfbea634a6513bb127f", "score": "0.6839555", "text": "def print_a_line(line_count, f)\n#printing the line in a sequence using a method gets.chomp which gets the next line in sequence after printing a particular line\n\tputs \"#{line_count}, #{f.gets.chomp}\"\nend", "title": "" }, { "docid": "26428a523ec43d8cb099232c25af0351", "score": "0.68251187", "text": "def print\n\t\t# lines\n\t\t(1..@n).each do |i|\n\t\t\tline = \"\"\n\t\t\t# rows of w\n\t\t\t(1..@n).each do |j|\n\t\t\t\tline << printable(get_w(i,j))\n\t\t\t\tline << ' '\n\t\t\tend\n\t\t\tline << '| ' + printable(get_W(i))\n\t\t\tline << '| ' + get_v(i).to_s\n\n\t\t\tputs line\n\t\tend\n\tend", "title": "" }, { "docid": "2975104c53e660b4cf19db18099df319", "score": "0.67983425", "text": "def printer(message, x)\r\n x.times do\r\n puts message\r\n end \r\nend", "title": "" }, { "docid": "18091c9d9ab822802d84cb25eef02664", "score": "0.6774612", "text": "def print_line(string)\n print \"#{string}\\n\".white\nend", "title": "" }, { "docid": "19694905de99032f259f02a13c0a3a14", "score": "0.6768818", "text": "def integer_print_10_one_line\n 10.times {|n| puts n}\nend", "title": "" }, { "docid": "ea259fb326ce1668382ff8b03fd339c0", "score": "0.66893697", "text": "def show_line\n puts \"*\" * 80\nend", "title": "" }, { "docid": "f6af4d207413264819373a603fd094f4", "score": "0.66779864", "text": "def console_print(line)\n end", "title": "" }, { "docid": "de9fc45e757792eb590f3798f1d7c93c", "score": "0.66700745", "text": "def output_line\n puts \"=============================================\"\n end", "title": "" }, { "docid": "b9e26282570ee2780d8b6e1e5002e931", "score": "0.6658781", "text": "def output_line(line)\n puts \" <p>#{line}</p>\"\n end", "title": "" }, { "docid": "49490006dd60ee7dcff34f8a4572393d", "score": "0.66563195", "text": "def print\n to_a.cycle(1) {|inner| p inner}\n end", "title": "" }, { "docid": "d57b3e0ee6a8c1db3208a6f247a3818c", "score": "0.66486603", "text": "def print_out line\n\tKernel.print \"#{line}\\n\"\nend", "title": "" }, { "docid": "3e52762839c807e30cb832c10964ee68", "score": "0.66360664", "text": "def print_board\n print_line(1)\n puts \"---+---+---\"\n print_line(2)\n puts \"---+---+---\"\n print_line(3)\n puts\n end", "title": "" }, { "docid": "62f8971d553e356a40f5fd4c5276a878", "score": "0.66306937", "text": "def space_lines(n)\n n.times{puts ''}\n end", "title": "" }, { "docid": "a3115c365b06b54018704eb45aec5291", "score": "0.6593069", "text": "def execute_on_line\n if @multispinner\n @multispinner.synchronize do\n if @first_run\n @row ||= @multispinner.next_row\n yield if block_given?\n output.print \"\\n\"\n @first_run = false\n else\n lines_up = (@multispinner.rows + 1) - @row\n output.print TTY::Cursor.save\n output.print TTY::Cursor.up(lines_up)\n yield if block_given?\n output.print TTY::Cursor.restore\n end\n end\n elsif block_given?\n yield\n end\n end", "title": "" }, { "docid": "5bbd8b733bff9a8f8ff34fd67e921014", "score": "0.6575116", "text": "def put_line\n\tputs \"-------------------------------------------------------------------------------------------------------------\"\nend", "title": "" }, { "docid": "8002e0df35c30f7c849484b7fd82c88e", "score": "0.6569821", "text": "def print_first_line\n puts\n #l33t hax0rs\n (0..@board[0].length-1).each {|e| print \" #{e}\"}\n puts\n end", "title": "" }, { "docid": "8ac77844c330c8cec116b7fb3c961c0a", "score": "0.65546316", "text": "def print_four_times( to_print )\n 4.times do\n puts to_print\n end\nend", "title": "" }, { "docid": "d24abf93d8ec580caff69d62a57d1abf", "score": "0.6551844", "text": "def display_position\n print_line(1)\n puts \"---+---+---\"\n print_line(2)\n puts \"---+---+---\"\n print_line(3)\n puts\n end", "title": "" }, { "docid": "0ca3a016b728109acbd0725862a6d030", "score": "0.65373796", "text": "def example\n puts \" 1 | 2 | 3 \"\n puts \"-----------\"\n puts \" 4 | 5 | 6 \"\n puts \"-----------\"\n puts \" 7 | 8 | 9 \"\n end", "title": "" }, { "docid": "01ca95daf31d2d46df57ed71279859f0", "score": "0.65351844", "text": "def print_screen(lines)\n color_pair = 1\n lines.each_with_index do |line,lno|\n color_pair = color_pair == 1 ? 2 : 1\n write(lno, 0, block_given? ? yield(line,lno) : line, color_pair)\n break if lno > height-3\n end\n end", "title": "" }, { "docid": "c1b8f3a3c5a67635ad34126af6e6c622", "score": "0.6465925", "text": "def line()\n\t\tputs \"\"\n\tend", "title": "" }, { "docid": "0b88ae3d3b4f9ac65adec56021da790c", "score": "0.64653826", "text": "def printLine (line, io, suppress = false)\n if (!suppress)\n line.gsub!(/\\s+$/, \"\")\n @buffered_lines.push(\"#{line}\\n\")\n tryPrintPartialPage(io)\n tryPrintBottom(io)\n end\n end", "title": "" }, { "docid": "3ac44f9e74f9cc06ee3f3033af53696a", "score": "0.645308", "text": "def printBlockChain(text)\n for i in text\n puts(i)\n end\n end", "title": "" }, { "docid": "197d0aa4bd1e580d23de5348603b688b", "score": "0.64416564", "text": "def print_current_line\r\n begin\r\n puts \"#{@current_line_number}: \"+@buffer[@current_line_number-1]\r\n rescue\r\n @current_line_number = 1\r\n puts \"#{@current_line_number}: \"+@buffer[@current_line_number-1]\r\n end\r\n end", "title": "" }, { "docid": "399e35a3f1ae9398780d43c83e796cbb", "score": "0.64245164", "text": "def line\n puts \"-\" * 50\nend", "title": "" }, { "docid": "dcffb690ffe7fa52a5db5b927a40aa45", "score": "0.6407197", "text": "def print_slowly\n dots = [\".\",\".\",\".\"]\n dots.each {|i| print i; sleep 0.20}\n puts \"\\n\"\nend", "title": "" }, { "docid": "79aeef83f073f07293811bc9606cbdb3", "score": "0.6406661", "text": "def liner(lines)\n\tprint '+'\n\tlines.times do |l|\n\t\tprint '-'\n\tend\nend", "title": "" }, { "docid": "113a0786ca11c631c7073e5b20166b34", "score": "0.63980377", "text": "def line_break\n puts \"\"\n end", "title": "" }, { "docid": "7343d1a5dea625bbac67bce69c78bf02", "score": "0.6397804", "text": "def print_in_box(text)\n line = '-'\n lines = []\n text.size.times { lines << line }\n space = ' '\n spaces = []\n text.size.times { spaces << space }\n puts \"+#{lines.join}+\"\n puts \"|#{spaces.join}|\"\n puts \"|#{text}|\"\n puts \"|#{spaces.join}|\"\n puts \"+#{lines.join}+\"\nend", "title": "" }, { "docid": "d7fe19a5dee3eba6a7ef4f7c0f5e6e6f", "score": "0.63933027", "text": "def display(x)\n x.each do |x|\n puts \"* #{x}\"\n end\nend", "title": "" }, { "docid": "480f621f51b1f47ae9406bb540f31040", "score": "0.6390205", "text": "def print_row()\n row.each { |r| print r}\n puts \"\"\n end", "title": "" }, { "docid": "89a49b67ec26d95a42b101a334d54d79", "score": "0.6382357", "text": "def line(queue)\n deli_line = \"The line is currently:\"\n if queue.size == 0\n puts \"The line is currently empty.\"\n return\n else\n queue.each_with_index do |person, index|\n deli_line = deli_line + \" #{index + 1}. #{person}\"\n end\n end\n puts deli_line\nend", "title": "" }, { "docid": "1b3a0cd911dda8918b78e75398a59b87", "score": "0.6377532", "text": "def output_line(line)\n puts line\n end", "title": "" }, { "docid": "1b3a0cd911dda8918b78e75398a59b87", "score": "0.6377532", "text": "def output_line(line)\n puts line\n end", "title": "" }, { "docid": "6356019c2399317e705ced9f0091f01b", "score": "0.6377108", "text": "def print_a_line(line_count, f)\n\tputs\n\tputs \"Currently on line #{line_count}\"\n\tputs \"#{line_count} #{f.readline()}\"\nend", "title": "" }, { "docid": "a8fb2424b52351bc511937377e2685df", "score": "0.63755196", "text": "def newline\n puts\n end", "title": "" }, { "docid": "34e40f5a3c785b43c4ec8ff28fccff77", "score": "0.6372072", "text": "def print_a_line(f)\n\tputs \"#{f.readline}\"\nend", "title": "" }, { "docid": "f0be962fa14c42ee00475e984f1393a8", "score": "0.6371837", "text": "def newline\n puts\n end", "title": "" }, { "docid": "e2363b1188daaa1911880b4304afdb1d", "score": "0.6371522", "text": "def print_in_same_line(log_string); end", "title": "" }, { "docid": "944f7aca6880f6dd4f0459798d716f2a", "score": "0.6358222", "text": "def display_output(str, same_line=false)\n same_line ? (print str) : (puts str)\n end", "title": "" }, { "docid": "6f9db11172b4a03dbbbc48bfd0d9a217", "score": "0.6358149", "text": "def putLine(text)\n\tprint \"\\n\"+text\nend", "title": "" }, { "docid": "181c7940c32439435ab55810b493ffe9", "score": "0.63567406", "text": "def printBlockChain(text)\n for i in text\n puts(i)\n end\nend", "title": "" }, { "docid": "cdea6d6fb54bb775ede0bb639c73ca9f", "score": "0.63507324", "text": "def print(line)\n @shell.say(line, nil, true)\n end", "title": "" }, { "docid": "2057e2b3878c90a9ccb093509e2b1658", "score": "0.6347957", "text": "def printer\r\n puts \"This is just a test!\"\r\n 3.times { yield(\"1\", \"2\", \"3\") }\r\nend", "title": "" }, { "docid": "5f598cd93a91316886d434b49e7f2a73", "score": "0.63395196", "text": "def print_line(arr)\n puts($/, *arr, $/)\n end", "title": "" }, { "docid": "aaee20cbb8df04729587cc07529e5378", "score": "0.63112044", "text": "def star_line_break\n print_this \"**************************\"\nend", "title": "" }, { "docid": "8cc00f76b512254e817bc2e76fe7db16", "score": "0.62893444", "text": "def line(someone) \n cur_line = \"The line is currently:\" \n someone.each.with_index(1) do |num, name|\n cur_line << \" #{name}. #{num}\"\n end\n someone.length < 1 ? (puts \"The line is currently empty.\") : (puts cur_line)\nend", "title": "" }, { "docid": "c52a07635b14b941157ea2f7b6a46c37", "score": "0.628913", "text": "def newline\r\n @io.puts\r\n start_line\r\n end", "title": "" }, { "docid": "355769bc6b20f73a027b8edb048e2d27", "score": "0.62861514", "text": "def print_line( str = '', unmute = false )\n return if only_positives?\n return if muted? && !unmute\n\n # We may get IO errors...freaky stuff...\n begin\n puts str\n rescue\n end\n end", "title": "" }, { "docid": "e5a10615ad3d874dab1d4de925506c4d", "score": "0.6279391", "text": "def line\n puts '-' * 10\nend", "title": "" }, { "docid": "b9d4c808a1bff89f779b1b0b1acfc3a5", "score": "0.6276057", "text": "def print_twice\n yield\n yield\n end", "title": "" }, { "docid": "dd649d540c35bd514657367e060cc54a", "score": "0.62676173", "text": "def print\n @grid.each { |line| puts line.join(\"\") }\n end", "title": "" }, { "docid": "de97736f3d278b83737e2141514cdd10", "score": "0.62586194", "text": "def firstLastLine\n 5.times { print ' ' }\n 15.times { print '[' }\n 5.times { print ' ' }\n 15.times { print ']'}\n puts ''\nend", "title": "" }, { "docid": "43be394cf5d436f0f4b058a94852e52b", "score": "0.6256484", "text": "def one_display\n [\n ' X',\n ' X',\n ' X',\n ' X',\n ' X'\n ].join(\"\\n\")\nend", "title": "" }, { "docid": "5083978e36a6effc69f9a6c83a2ba5d3", "score": "0.6255587", "text": "def display(arr)\n puts\n puts \"----------\" if arr.count > 1\n arr.each do| el | #Puts out each element from the array\n puts el \n sleep(DELAY)\n end \n puts \"----------\" if arr.count > 1\n puts\n end", "title": "" }, { "docid": "35f44d28a4ff536bd786c55a5c143eae", "score": "0.6252022", "text": "def put_a_line\n puts \"-\" * 50\nend", "title": "" }, { "docid": "35f44d28a4ff536bd786c55a5c143eae", "score": "0.6252022", "text": "def put_a_line\n puts \"-\" * 50\nend", "title": "" }, { "docid": "8a6e4fc57b9bf0fa9f5cf5da0e36fc5c", "score": "0.6244082", "text": "def each\n title = @title + (@subtitle ? \": #{@subtitle}\" : '') + (@done ? sprintf(\" (%3.2f seconds)\", @done - @start) : '')\n yield title\n yield title.gsub(/./, ':')\n\n @tempfile.rewind\n\n if @counter > @@max_lines\n yield \"Note: #{@counter - @@max_lines} of #{@counter} lines were discarded - see the system log for the complete report.\"\n\n _top_lines.times { yield @tempfile.gets } # print first half\n\n @tempfile.rewind\n\n (@counter - _bottom_lines).times { @tempfile.gets } # discard middle\n\n yield \" ...\"\n\n while not @tempfile.eof # print last half\n yield @tempfile.gets\n end\n\n else # we can print everything\n @tempfile.rewind\n while not @tempfile.eof\n yield @tempfile.gets\n end\n end\n\n yield ''\n end", "title": "" }, { "docid": "aba7490ed3d73d2688ebe348edfcfa83", "score": "0.62340975", "text": "def display\n\t @ary_display.each{|line| $stdout.print(line + \"\\n\")}\n\tend", "title": "" }, { "docid": "5b63326a3b3c95987deed0bd6ced47f9", "score": "0.6233939", "text": "def textLine\r\n puts(\"**\")\r\n puts(\"*\")\r\n puts(\"**\\n\")\r\nend", "title": "" }, { "docid": "5b63326a3b3c95987deed0bd6ced47f9", "score": "0.6233939", "text": "def textLine\r\n puts(\"**\")\r\n puts(\"*\")\r\n puts(\"**\\n\")\r\nend", "title": "" }, { "docid": "e54b3d35cfa97d4701fa4384b9d81400", "score": "0.62315905", "text": "def put_a_line\n puts \"*\" * 50\nend", "title": "" }, { "docid": "c7ae8f80b56acaea65db8e90897600a8", "score": "0.6225437", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "c7ae8f80b56acaea65db8e90897600a8", "score": "0.6225437", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "d47ef66eb5d3b69ab88dd8628186f9f4", "score": "0.6220668", "text": "def lines\r\n prime_fact(@lines) << \" line\" << (\"s\" unless @lines == 1).to_s\r\n end", "title": "" }, { "docid": "183267d836cd9e7b981ac78590b1c0a2", "score": "0.6214157", "text": "def the_spacer \n 50.times do\n puts \"\"\n end\n \n end", "title": "" }, { "docid": "9075631fd266d6a2f76483c681b0cec9", "score": "0.62117124", "text": "def sing(&step) # '&step' takes the block { |lines| lines.printlns }\r\n # Used this way, the value acessible inside 'sing()' when \r\n #'step' is referenced is a number (<= initial number \r\n #specified). \r\n\r\n $output << \"#{lines} of text on the screen, #{lines} of text.\\n\"\r\n\r\n tmp = @lines\r\n @lines = step[@lines]\r\n\r\n # Get a string of the factored number of lines remaining\r\n factorednum = prime_fact(@lines - tmp)\r\n\r\n # Check if we've reached the desired number of lines\r\n if @lines == $total_lines\r\n $output << \"Print #{factorednum} out, stand up and shout, \"\r\n # Setting 'step' to be the method :end will cause the :end function\r\n # to be called once and then end the program, rather than executing\r\n # 'screen.call()' again and decrementing the number of lines.\r\n step = method :end\r\n else\r\n $output << \"Print #{factorednum} out, stand up and shout, \"\r\n end\r\n\r\n $output << \"#{lines} of text on the screen.\\n\"\r\n\r\n # Print a newline and execute 'screen.call' continuation if 'step' is not a \r\n # method (i.e. as long as it's a number and not :end)\r\n ($output << \"\\n\") and screen.call unless step.kind_of? Method\r\n\r\n end", "title": "" }, { "docid": "28367a2099c03685a81eb609ded658a5", "score": "0.6203032", "text": "def line (queue)\nreturn puts \"The line is currently empty.\" if queue.empty?\nline_array=[\"The line is currently:\"]\n#1. Logan 2. Avi 3. Spencer\nqueue.each_with_index{ |line,index| line_array.push(\"#{index+1}. #{line}\")}\nputs line_array.join(' ')\nend", "title": "" }, { "docid": "174ab1faffd0ca31997b6a55b4117f73", "score": "0.61997086", "text": "def newline\n print('')\n end", "title": "" }, { "docid": "39f1d0a0f94d7648056239e94845c19f", "score": "0.61974084", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "39f1d0a0f94d7648056239e94845c19f", "score": "0.61974084", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "7ed8adeb3776438474cf3441b657064a", "score": "0.6196995", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "a5445c361557d7264a0ee7d4d268b634", "score": "0.6196424", "text": "def line(katz_deli)\n # binding.pry\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n i = 0\n s = \"The line is currently:\"\n while i < katz_deli.length do\n s += \" #{i + 1}. #{katz_deli[i]}\"\n i += 1\n end\n puts s\n end\nend", "title": "" }, { "docid": "ba428da72f9d00101b7ed5eaa6126893", "score": "0.619513", "text": "def print_in_same_line(log_string)\n print log_string + \"\\r\"\n end", "title": "" }, { "docid": "ba428da72f9d00101b7ed5eaa6126893", "score": "0.619513", "text": "def print_in_same_line(log_string)\n print log_string + \"\\r\"\n end", "title": "" }, { "docid": "9f7ada1b7978090516a57c153191e706", "score": "0.6193752", "text": "def print_string(a, b)\n b.times do\n puts a\n end\nend", "title": "" }, { "docid": "a0b74ff1537c061c4204e131e7ff582e", "score": "0.61935526", "text": "def line_break\n puts \"\\n\"\nend", "title": "" }, { "docid": "7d2c5db8be0fe6ee0e96c12d17077f9c", "score": "0.6190482", "text": "def loop\r\n while 1\r\n get_line\r\n end\r\n end", "title": "" }, { "docid": "10a0dbd40be2e6a2269c3d3aea88b676", "score": "0.6189576", "text": "def print(text)\n @output += %Q|#{text}\\n|\n puts text\n @output\n end", "title": "" }, { "docid": "ce4af37820e5b21f48df3bb9bba3c516", "score": "0.61882937", "text": "def line(a, b, c)\n\t\tputs \" \" * 3 + \"|\" + a + \"|\" + \" \" * 2 + \" .\" + \" \" * 3 + \"|\" + b + \"|\" + \" \" * 2 + \" .\" + \" \" * 3 + \"|\" + c + \"\" \" \" * 2\n\tend", "title": "" }, { "docid": "deb4fc7a8a647fbe82269466f0a20526", "score": "0.6186821", "text": "def displayScreen s\n rows = s.count\n labelWidth = rows.to_s.size\n for y in (rows - 1).downto(0) do\n printf \"%#{labelWidth}s: |\", y\n s[y].each_line do |x|\n printf \"%3s \", x\n end \n puts \"|\"\n end\n end", "title": "" }, { "docid": "535ca8e099cf6d9b5adf1348c2050a28", "score": "0.6177958", "text": "def line(a)\n if a.length == 0\n puts \"The line is currently empty.\"\n else\n s = \"The line is currently:\"\n x = 1\n for i in a\n s += \" #{x}. #{i}\"\n x += 1\n end\n puts s\n end\nend", "title": "" }, { "docid": "adb16310dd92d6f26655ebe65608e103", "score": "0.6177437", "text": "def draw_a_line\n puts\n 30.times { print \"_-\".red}\n puts\n end", "title": "" }, { "docid": "0b94b8e6e127f1548064383c1261f041", "score": "0.6171564", "text": "def line (katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n str=\"The line is currently:\"\n katz_deli.each_with_index do |item,index|\n # binding.pry\n str+=\" #{index+1}. #{item}\"\n end\n puts str\nend\nend", "title": "" }, { "docid": "c58535460e91caef04fec4f41c0b4147", "score": "0.61698484", "text": "def print_board\n puts ' | A | B | C |'\n @board.each_with_index do |line, y_index|\n puts '========================='\n puts \" #{y_index + 1} #{render_line(line)}\"\n end\n puts '========================='\n end", "title": "" }, { "docid": "2cc40e1fa2cb5f2e9d61f476f427e789", "score": "0.6162237", "text": "def render\n print_first_line\n @board.each.with_index do |arr, i1|\n print i1\n arr.each.with_index {|e, i2| print \"#{e.display} \"}\n puts\n end\n puts\n end", "title": "" }, { "docid": "e7e5bef8511bdb2f2c3183eb9b8f632e", "score": "0.61612964", "text": "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end\n end", "title": "" }, { "docid": "d13f5ec5f116bc14d1f3b52b0b90aa51", "score": "0.6159557", "text": "def line(queue)\n queue_sentence = \"The line is currently:\"\n if queue.length > 0 \n queue.each_with_index do |name, index|\n queue_sentence << \" #{index + 1}. #{name}\"\n end\n puts queue_sentence\n else \n puts \"The line is currently empty.\"\n end \nend", "title": "" }, { "docid": "770222d963c7e20444285586fe6dec61", "score": "0.6149602", "text": "def view(line_count = 1, x = 7)\n sleep(0.008)\n return if line_count > 17\n if line_count == 1\n puts ' ┏━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┓'\n view(line_count + 1, x)\n elsif line_count.odd? && line_count < 17\n puts ' ┣━━━╋━━━╋━━━╋━━━╋━━━╋━━━╋━━━╋━━━┫'\n view(line_count + 1, x)\n elsif line_count == 17\n puts ' ┗━┯━┻━┯━┻━┯━┻━┯━┻━┯━┻━┯━┻━┯━┻━┯━┛'\n puts ' A B C D E F G H '\n elsif line_count.even?\n piece_line(x, 0)\n view(line_count + 1, x - 1)\n end\n end", "title": "" }, { "docid": "c9b208805237b3b38cb2a5413ad1a150", "score": "0.61323076", "text": "def print_a_line(line_count, f)\n\tputs \"#{line_count}, #{f.readline()}\"\nend", "title": "" }, { "docid": "ead66411f8347e662eb83255839166d0", "score": "0.61314154", "text": "def print_progress(count)\n # If the line is 72 characters, then print a line break \n puts if count % 72 == 0\n # Print the progress indicator\n print \"+\"\n end", "title": "" }, { "docid": "41589a1d748f2c23e22a2ba896730823", "score": "0.6124552", "text": "def print_a_line(line_count, f)\n\t puts \"#{line_count} #{f.readline()}\"\nend", "title": "" } ]
5a89e835b46465c0323eb4aab89b3ae6
Returns a Time object that indicates the next time the task will run.
[ { "docid": "4dff71f95bab121207851030e7d7838f", "score": "0.76874185", "text": "def next_run_time\n raise Error, _('No currently active task. ITask is NULL.') if @pitask.nil?\n\n time = nil\n\n FFI::MemoryPointer.new(WIN32::SYSTEMTIME.size) do |ptr|\n @pitask.GetNextRunTime(ptr)\n time = WIN32::SYSTEMTIME.new(ptr).to_local_time\n end\n\n time\n end", "title": "" } ]
[ { "docid": "440c9b5e849c8f9f4d30eb3ddad09db3", "score": "0.79994375", "text": "def next_run_time\n check_for_active_task\n @task.NextRunTime\n end", "title": "" }, { "docid": "440c9b5e849c8f9f4d30eb3ddad09db3", "score": "0.79994375", "text": "def next_run_time\n check_for_active_task\n @task.NextRunTime\n end", "title": "" }, { "docid": "e802d0e54976512b39e5726dafc17772", "score": "0.79504144", "text": "def next_time\n @next_time ||= cron_schedule&.next_time(current_time)\n end", "title": "" }, { "docid": "c8eb45a2be8106a1502bb60ef7e52212", "score": "0.7793837", "text": "def next_time\n execution_time = SidekiqScheduler::RedisManager.get_job_next_time(name)\n\n relative_time(Time.parse(execution_time)) if execution_time\n end", "title": "" }, { "docid": "ee6844f128e1edcf7a8e8b254148c641", "score": "0.7599847", "text": "def next_schedule_run_date_time\n return @next_schedule_run_date_time\n end", "title": "" }, { "docid": "a77f49cd0e656ea16e1338b7b4f16ecf", "score": "0.7503851", "text": "def next_run_time\n Time.now.utc + (60 - Time.now.strftime(\"%M\").to_i).minutes\n end", "title": "" }, { "docid": "299d122948899fcffa9758dfae71be57", "score": "0.7491283", "text": "def next_run_time\n raise Error, 'null pointer' if @pITask.nil?\n raise Error, 'No currently active task' if @pITask.nil?\n\n lpVtbl = 0.chr * 4\n table = 0.chr * 40\n\n memcpy(lpVtbl, @pITask, 4)\n memcpy(table, lpVtbl.unpack('L').first, 40)\n table = table.unpack('L*')\n\n getNextRunTime = Win32::API::Function.new(table[9], 'PP', 'L')\n st = 0.chr * 16\n hr = getNextRunTime.call(@pITask, st)\n\n if hr != S_OK\n raise Error, get_last_error\n end\n\n a1,a2,_,a3,a4,a5,a6,a7 = st.unpack('S*')\n a7 *= 1000\n\n Time.local(a1,a2,a3,a4,a5,a6,a7)\n end", "title": "" }, { "docid": "64d2526a03cd5b49067fa147e68cf928", "score": "0.7475369", "text": "def next_time\n @mutex.synchronize { @next_time }\n end", "title": "" }, { "docid": "81d95ec6e96da329e89b512acb03ff35", "score": "0.7371691", "text": "def next_run_time\n time = run_at.to_time\n case cron_setting.periodic_type\n when 0\n time = time.to_s.to_time\n when 1\n time = time.to_s.to_time + 1.year\n when 2\n time = time.to_s.to_time + 1.month\n when 3\n time = time.to_s.to_time + 1.week\n when 4\n z = time.to_s.to_time + 1.day\n if weekend? z\n time = next_monday(time.to_s.to_time)\n else\n time = time.to_s.to_time + 1.day\n end\n when 5\n z = time.to_s.to_time + 1.day\n unless weekend? z\n time = next_saturday(time.to_s.to_time)\n else\n time = time.to_s.to_time + 1.day\n end\n when 6\n time = time.to_s.to_time + 1.day\n end\n time\n end", "title": "" }, { "docid": "70d6848e5ed20245deb96a3772478106", "score": "0.73418605", "text": "def next_run_at\n DateTime.new(next_year, next_month, next_day, next_hour, next_minute)\n end", "title": "" }, { "docid": "6ec41d3be47be6be8b297fafcff9df8b", "score": "0.7246725", "text": "def min_time_next\n tn = DEVS::INFINITY\n if (obj = @scheduler.peek)\n tn = obj.time_next\n end\n tn\n end", "title": "" }, { "docid": "bf96931657cd22280ff8788b5237dfda", "score": "0.7219825", "text": "def next_time\n\n Time.at(@at)\n end", "title": "" }, { "docid": "bc9ea0263c4635d601995c7114cfb405", "score": "0.71298856", "text": "def next_scheduled_occurrence\n get_timestamp \"next\"\n end", "title": "" }, { "docid": "a4144826416b9fd998a163f432636d5f", "score": "0.7025498", "text": "def next_reminder(time)\n # return next_time\n end", "title": "" }, { "docid": "96e79aa0e59d17fcfbfb038bc0b66be6", "score": "0.7019444", "text": "def next_execute_time\n @trigger.next_execute_time\n end", "title": "" }, { "docid": "90618efbd7495e18abafec9ca8bc28c1", "score": "0.684336", "text": "def schedule( now )\n @next_time = nil\n\n if fixed_times\n @next_time = next_fixed_time( now )\n elsif period\n @next_time = ( now + period )\n end\n\n if @next_time && ( @next_time - now ) > 60.0\n @log.debug { \"Next run scheduled @ #{ next_time_to_s }\" }\n end\n\n @next_time\n end", "title": "" }, { "docid": "8f78bc190667a5e256b59a70109b14dd", "score": "0.68057656", "text": "def next_time (from=Time.now)\n\n @cron_line.next_time(from)\n end", "title": "" }, { "docid": "464bb865f2c5e0a3ac62d2ed6549795d", "score": "0.6769614", "text": "def next_time(from = T.unsafe(nil)); end", "title": "" }, { "docid": "98d0beae80166f1b0eac057545ead755", "score": "0.67210543", "text": "def next_time\n\t\treturn if index_data.empty?\n\t\tif index_data.size > current_cycle + 1\n\t\t Time.at(*index_data[current_cycle + 1][:start])\n\t\tend\n\t end", "title": "" }, { "docid": "e40bd3920679fca39f3b4e7059116e12", "score": "0.6701249", "text": "def nextTime(now)\n if !@seen\n now\n elsif @lastSeen\n @lastSeen + frequency\n else\n now + frequency\n end\n end", "title": "" }, { "docid": "4eb195d70598d3653ff08ebb9ef660f9", "score": "0.6669279", "text": "def get_alarm_time\n # TODO: don't hardcode this tag\n alarm_jobs = Scheduler.instance.get_by_tag(\"alarmclock\")\n return nil if !alarm_jobs[0]\n alarm_jobs[0].next_time\n end", "title": "" }, { "docid": "24e75d1aa8de18fb53d529564ded5d72", "score": "0.66291225", "text": "def later\n # Add the Integer to Time.new\n Time.new + self\n end", "title": "" }, { "docid": "5a34def09c951b25e284d4141e1a7195", "score": "0.6621625", "text": "def succ\n SimpleTime.new(@hour, @minute+1)\n end", "title": "" }, { "docid": "4952c22426b278bc23d3ba3fdceda58b", "score": "0.661437", "text": "def nextTime(time = nil)\n time = Utils::Time.current if time.nil?\n if time < expiryTime\n if !seen\n time\n else\n if remindable && remindTime\n remindTime\n else\n time\n end\n end\n else\n time\n end\n end", "title": "" }, { "docid": "881180f6cd7757433ef5212fb0fa8ad1", "score": "0.6507568", "text": "def calculate_next_time(person) \t\n end", "title": "" }, { "docid": "d286d6c2b42e4057e79132e6e5651100", "score": "0.6496083", "text": "def next_ping_at\n return nil unless (temp_next_ping_at = read_attribute(:next_ping_at))\n # logger.debug2 \"temp_next_ping_at = #{temp_next_ping_at}\"\n Time.at temp_next_ping_at\n end", "title": "" }, { "docid": "d286d6c2b42e4057e79132e6e5651100", "score": "0.6496083", "text": "def next_ping_at\n return nil unless (temp_next_ping_at = read_attribute(:next_ping_at))\n # logger.debug2 \"temp_next_ping_at = #{temp_next_ping_at}\"\n Time.at temp_next_ping_at\n end", "title": "" }, { "docid": "fddc963e78d4cf56ff8cf67b3e7997bc", "score": "0.6469013", "text": "def later\n # Add the Integer to Time.new\n Time.new + self\n end", "title": "" }, { "docid": "9cd9572dc97db6fc98e9ef93f639b377", "score": "0.6468437", "text": "def next_schedule_run_date_time=(value)\n @next_schedule_run_date_time = value\n end", "title": "" }, { "docid": "86ebb91c4e5a62b67bbec360a69b58d9", "score": "0.6441041", "text": "def next_start_at\n @last_started_at && @backoff_duration ? @last_started_at + @backoff_duration : now\n end", "title": "" }, { "docid": "c78e97156b15186ca212f91d5c157c2d", "score": "0.6420825", "text": "def running_time\n a = started_at or return nil\n b = done_at or return nil\n (b - a).to_f / 60.0\n end", "title": "" }, { "docid": "8deb75f8fdc9eece62d98180cea94431", "score": "0.6406918", "text": "def next_time(duration=0)\n\t\tnow\t= Time.now\n\t\tst = SunTimes.new\n\n\t\tif @type == :sunrise\n\t\t\ttime = st.rise(now, @@lat, @@long)\n\t\telsif @type == :sunset\n\t\t\ttime = st.set(now, @@lat, @@long)\n\t\tend\n\n\t\trtweak = random_tweak\n\t\ttime = is_tomorrow(now, time+duration+rtweak)\n\n\t\t[ time, rtweak ]\n\tend", "title": "" }, { "docid": "3a73a2557ce41e6c78806ece876c5be7", "score": "0.6380396", "text": "def update_next_run_time!\n if cron? then\n self.scheduled_at = CronParser.new(self.schedule).next()\n end\n end", "title": "" }, { "docid": "90bc16da8541dbeffbe5c9785a1a4f13", "score": "0.635854", "text": "def min() time[1] end", "title": "" }, { "docid": "4960afe280863ce439db3f51a5c832a7", "score": "0.6344448", "text": "def next_request_time\n last_request_time + 0.1\n end", "title": "" }, { "docid": "998b1b551f8479cfa60aeb37c7ba2e01", "score": "0.63433236", "text": "def time\n Time.at(integer(0..TIMEMAX))\n end", "title": "" }, { "docid": "0a27513b634a7e1c9bc15116a3970255", "score": "0.63171005", "text": "def get_start_time\n return nil if self.recurring?\n start_time = Time.at(self.next_start_time).in_time_zone(EventsHelper.get_tz(self.city))\n hour = start_time.hour\n minute = start_time.min\n hour *= 100\n hour + minute\n end", "title": "" }, { "docid": "2385d5c1886688398e49fcb53be9255a", "score": "0.6310401", "text": "def most_recent_run_time\n check_for_active_task\n\n time = nil\n\n begin\n time = Time.parse(@task.LastRunTime)\n rescue\n # Ignore\n end\n\n time\n end", "title": "" }, { "docid": "779536ac41d9764ff41e9315c05152a0", "score": "0.6301879", "text": "def schedule_hour()\n adjust_schedule()\n\n start = @next_free_date\n @next_free_date = @next_free_date.next_work_hour()\n return start\n end", "title": "" }, { "docid": "9eaf2f79327e94d12b9838f1dea36256", "score": "0.6277531", "text": "def get_time\n ((Time.now - START_TIME)*1000).to_i\n end", "title": "" }, { "docid": "fcaedd9c98cc266c199e841b26ad5e42", "score": "0.6276109", "text": "def timestamp\n t = prerequisite_tasks.collect { |pre| pre.timestamp }.max\n return t if t\n if remote\n create_remote_task\n Time.parse rget(\"timestamp\")\n else\n Time.now\n end\n end", "title": "" }, { "docid": "96d698ec27ca46f0bd51baf9c2d4e131", "score": "0.62751466", "text": "def most_recent_run_time\n check_for_active_task\n\n time = nil\n\n begin\n time = Time.parse(@task.LastRunTime)\n rescue StandardError\n # Ignore\n end\n\n time\n end", "title": "" }, { "docid": "bf536e370503c58abdf0f0634818fdd3", "score": "0.6271439", "text": "def start_time\n self.start\n end", "title": "" }, { "docid": "29770371b8961f65a3c4de18b0cd4794", "score": "0.6265381", "text": "def latest\n Time.current + 1.second\n end", "title": "" }, { "docid": "902c082e2b270bde898d7048653028c8", "score": "0.62404513", "text": "def next_run_at\n cron = CronParser.new(reoccurrence_crontab)\n run_at = cron.next(Time.now)\n end", "title": "" }, { "docid": "267d0537fef6eb889cefb67138679bb5", "score": "0.6236537", "text": "def init_next_execution_time\n if Daemon.respond_to?(@attr_daemon_time) and not Daemon.send(@attr_daemon_time).nil?\n @next_exec = Daemon.send(@attr_daemon_time)\n else\n @next_exec = @time_for_exec.has_key?(:begin_in) ? Time.parse(@time_for_exec[:begin_in], Time.new) : Time.now\n unless @time_for_exec[:start_now]\n @next_exec += @time_for_exec[:frecuency] if Time.now > @next_exec\n end\n end\n end", "title": "" }, { "docid": "32246cba62ecf00f4dd1d3afcfcb7c56", "score": "0.62364066", "text": "def schedule_next_run\n Scheduler.perform_in(1.minute)\n end", "title": "" }, { "docid": "a4afb4d15c6930db3735dc1b84eaf4c3", "score": "0.6220386", "text": "def schedule_time; end", "title": "" }, { "docid": "a4afb4d15c6930db3735dc1b84eaf4c3", "score": "0.6220386", "text": "def schedule_time; end", "title": "" }, { "docid": "1b77ea382e3a62372b6ddbc994e527d8", "score": "0.62189466", "text": "def next_refresh_time\n (Faulty.current_time + options.cache_refreshes_after).floor\n end", "title": "" }, { "docid": "7731b38becd5246789a460b3bff6f4dd", "score": "0.62161005", "text": "def next_hour\n (Time.now + 3600).strftime(\"%I\").to_i\n end", "title": "" }, { "docid": "d931778843a133827871d05edacf2799", "score": "0.6212556", "text": "def start_time\n @start_time ||= Time.at(read(4, 0).unpack('L').first)\n end", "title": "" }, { "docid": "258db8185ad1b51e2cad1234661193d5", "score": "0.62065774", "text": "def next(pointer)\n super\n \n half_day = 60 * 60 * 12\n full_day = 60 * 60 * 24\n \n first = false\n \n unless @current_time\n first = true\n midnight = Time.local(@now.year, @now.month, @now.day)\n yesterday_midnight = midnight - full_day\n tomorrow_midnight = midnight + full_day\n\n catch :done do\n if pointer == :future\n if @type.ambiguous?\n [midnight + @type, midnight + half_day + @type, tomorrow_midnight + @type].each do |t|\n (@current_time = t; throw :done) if t >= @now\n end\n else\n [midnight + @type, tomorrow_midnight + @type].each do |t|\n (@current_time = t; throw :done) if t >= @now\n end\n end\n else # pointer == :past\n if @type.ambiguous?\n [midnight + half_day + @type, midnight + @type, yesterday_midnight + @type * 2].each do |t|\n (@current_time = t; throw :done) if t <= @now\n end\n else\n [midnight + @type, yesterday_midnight + @type].each do |t|\n (@current_time = t; throw :done) if t <= @now\n end\n end\n end\n end\n \n @current_time || raise(\"Current time cannot be nil at this point\")\n end\n \n unless first\n increment = @type.ambiguous? ? half_day : full_day\n @current_time += pointer == :future ? increment : -increment\n end\n \n Chronic::Span.new(@current_time, @current_time + width)\n end", "title": "" }, { "docid": "2e14b33318377b925a6f130d8d52c243", "score": "0.6205409", "text": "def most_recent_run_time\n raise Error, 'null pointer' if @pITask.nil?\n raise Error, 'No currently active task' if @pITask.nil?\n\n lpVtbl = 0.chr * 4\n table = 0.chr * 64\n\n memcpy(lpVtbl, @pITask, 4)\n memcpy(table, lpVtbl.unpack('L').first, 64)\n table = table.unpack('L*')\n\n getMostRecentRunTime = Win32::API::Function.new(table[15], 'PP', 'L')\n st = 0.chr * 16\n hr = getMostRecentRunTime.call(@pITask, st)\n\n if hr == 0x00041303 # SCHED_S_TASK_HAS_NOT_RUN\n time = nil\n elsif hr == S_OK\n a1, a2, _, a3, a4, a5, a6, a7 = st.unpack('S*')\n a7 *= 1000\n time = Time.local(a1, a2, a3, a4, a5, a6, a7)\n else\n raise Error, get_last_error\n end\n\n time\n end", "title": "" }, { "docid": "593bec52b739c31fd174ee18f6050f2e", "score": "0.61974233", "text": "def run_time\n get_counter\n end", "title": "" }, { "docid": "29e9b8e8a652817f2118be640e0c6481", "score": "0.61647564", "text": "def next_time(time, schedule, closing_time)\n @time = time\n @schedule = schedule\n\n return nil unless find_acceptable_time_before(closing_time)\n\n @uses += 1 if @time\n @time\n end", "title": "" }, { "docid": "9bca806e1933e59f496e60b5127f512b", "score": "0.6142705", "text": "def succ\n `var t=c$Time.m$new()`\n `t.__value__=new(Date)(1000+this.__value__.valueOf())`\n return `t`\n end", "title": "" }, { "docid": "a12b00f83e335101d2567e99e22ab8d9", "score": "0.6140831", "text": "def now\n Morrow.update_start_time\n end", "title": "" }, { "docid": "403887efe04ad23ce041ecdd1c217ba6", "score": "0.61407995", "text": "def tomorrow\n tomorrow = (self.start_time + 1.day)\n Time.utc(tomorrow.year, tomorrow.month, tomorrow.day)\n end", "title": "" }, { "docid": "bbd912764ba206116abd284cd3c6c1dd", "score": "0.61303365", "text": "def set_next_run\n self.next_run_at = Time.zone.now unless self.next_run_at\n end", "title": "" }, { "docid": "621fca0ec6449ecae23c08c60504c591", "score": "0.6122685", "text": "def current_time\n RubyVPI::Scheduler.current_time\n end", "title": "" }, { "docid": "35222761ab116425ba707216de6cd5f9", "score": "0.6114516", "text": "def calculate_next_run\n case self.frequency\n when :hour\n @next_run = Time.now + 1.hour - Time.now.min.minutes - Time.now.sec\n when :day\n @next_run = Time.now.beginning_of_day + @offset\n @next_run += 1.day if @next_run < Time.now\n when :weekday\n case Time.now.wday\n when 0 # Sunday\n @next_run = Time.now.beginning_of_day + 1.day + @offset\n when 6 #Saturday\n @next_run = Time.now.beginning_of_day + 2.days + @offset\n else\n @next_run = Time.now.beginning_of_day + @offset\n if @next_run < Time.now\n if Time.now.wday == 5 # Friday\n @next_run += 3.days\n else\n @next_run += 1.day\n end\n end\n end\n when :week\n @next_run = Time.now.beginning_of_week + @offset\n @next_run += 1.week if @next_run < Time.now\n when :month\n @next_run = Time.now.beginning_of_month + @offset\n @next_run += 1.month if @next_run < Time.now\n when :monday\n @next_run = Time.now.beginning_of_week + @offset\n @next_run += 1.week if @next_run < Time.now\n when :tuesday\n @next_run = Time.now.beginning_of_week + 1.day + @offset\n @next_run += 1.week if @next_run < Time.now\n when :wednesday\n @next_run = Time.now.beginning_of_week + 2.days + @offset\n @next_run += 1.week if @next_run < Time.now\n when :thursday\n @next_run = Time.now.beginning_of_week + 3.days + @offset\n @next_run += 1.week if @next_run < Time.now\n when :friday\n @next_run = Time.now.beginning_of_week + 4.days + @offset\n @next_run += 1.week if @next_run < Time.now\n when :saturday\n @next_run = Time.now.beginning_of_week + 5.days + @offset\n @next_run += 1.week if @next_run < Time.now\n when :sunday\n @next_run = Time.now.beginning_of_week + 6.days + @offset\n @next_run += 1.week if @next_run < Time.now\n end #case\n end", "title": "" }, { "docid": "4a85b8dccbadb9b6b5ab3ddb64f72bf2", "score": "0.6112268", "text": "def next_backup\n next_task = Time.new(3000) # Set time to year 3000.\n @tasks.each do |task|\n if task.next_backup < next_task\n next_task = task.next_backup\n end\n end\n \n ntime = (next_task - Time.now)\n # Check for negative integers.\n if ntime < 0 then ntime = 0 end\n @logger.info \"Sleeping: #{(ntime.round(2))} seconds...\"\n ntime\n end", "title": "" }, { "docid": "b5974abafd2541ec8882a223e1fbbfa3", "score": "0.61111975", "text": "def immediately\n Time.now\n end", "title": "" }, { "docid": "7acf89e9558a7f98e81a6cdc74f4d753", "score": "0.61027426", "text": "def to_time\n @finish || Time.now + self.to_f\n end", "title": "" }, { "docid": "e3496242be96698d6af462729cd70f73", "score": "0.6098157", "text": "def start_time\n \tself.schedule_on\n\tend", "title": "" }, { "docid": "27fd03adcbe47558d0e1e1e8405ae2b7", "score": "0.60951096", "text": "def get_final_time\n meeting_individual_result ? meeting_individual_result.get_timing_instance : \"#{compute_final_time} ***\"\n end", "title": "" }, { "docid": "58569651701147ab7d37980424a4aa2a", "score": "0.6094833", "text": "def start_time\n eval(start) if start.present?\n end", "title": "" }, { "docid": "75be4584c4b06d1d3b44accfaf316e8f", "score": "0.6086591", "text": "def last_run\n\t\t\tstamp = @redis.get( redis_key )\n\t\t\tTime.at(stamp.to_i)\n\t\tend", "title": "" }, { "docid": "101ca389e2e1cdb48540df74fc32dcce", "score": "0.6080077", "text": "def one_hour_from_now\n return Time.now + one_hour\n end", "title": "" }, { "docid": "101ca389e2e1cdb48540df74fc32dcce", "score": "0.6080077", "text": "def one_hour_from_now\n return Time.now + one_hour\n end", "title": "" }, { "docid": "649bbb18119b5d90a557b2878c52270c", "score": "0.6071349", "text": "def time\n Time.now - @start\n end", "title": "" }, { "docid": "31d80503fb5cb610293828c4a3209287", "score": "0.6069283", "text": "def last_time\n execution_time = SidekiqScheduler::RedisManager.get_job_last_time(name)\n\n relative_time(Time.parse(execution_time)) if execution_time\n end", "title": "" }, { "docid": "3d77bd78d82d42552a53c6ac2606cf9c", "score": "0.6063587", "text": "def monotonic_time; end", "title": "" }, { "docid": "3d77bd78d82d42552a53c6ac2606cf9c", "score": "0.6063587", "text": "def monotonic_time; end", "title": "" }, { "docid": "3d77bd78d82d42552a53c6ac2606cf9c", "score": "0.6063587", "text": "def monotonic_time; end", "title": "" }, { "docid": "29f6c05d74b32d5c1e8a9b70e38412ba", "score": "0.6055092", "text": "def delayed_time(start = Time.zone.now)\n potential = nil\n until(valid_delayed_time?(potential))\n potential = start + Offset.shuffle.first.days # Date\n potential += rand(24).hours\n potential += rand(60).minutes\n end\n potential\n end", "title": "" }, { "docid": "6232ede7fa46c60ea77e8a9565c8cab4", "score": "0.60509706", "text": "def calc_next_run\n self.next_run_at = nil\n end", "title": "" }, { "docid": "3acaaafbd51d355f35d6ff2e7778b529", "score": "0.6049869", "text": "def next_run\n return Time.now unless @last_run\n \n @next_run = @last_run\n \n if @scope and @interval\n @next_run += @interval * @scope\n \n calc_precision\n \n calc_limits\n else\n raise 'No proper period specified'\n end\n \n return @next_run\n end", "title": "" }, { "docid": "9f22009b1ad5a3e52b0ff7d86eec78f5", "score": "0.6046203", "text": "def desired_time\n @@specific_time_desired || Time.now\n end", "title": "" }, { "docid": "37fd8a6b0ae8276349451bcb2f08c14c", "score": "0.6039895", "text": "def start_time\n Time.parse(@server.get_run_attribute(@uuid, @links[:starttime]))\n end", "title": "" }, { "docid": "c39072dff39359749c315508db93a552", "score": "0.60338306", "text": "def rn_time\n runtime_seconds \n end", "title": "" }, { "docid": "ac7b0c7a20ec13d64c3a366342ef6bd3", "score": "0.6033374", "text": "def start_time\n if schedule\n return IceCube::Schedule.from_yaml(schedule).start_time\n end\n end", "title": "" }, { "docid": "8a5b25f25250f10586c00d57040c8257", "score": "0.6030065", "text": "def most_recent_run_time\n raise Error, _('No currently active task. ITask is NULL.') if @pitask.nil?\n\n time = nil\n\n begin\n FFI::MemoryPointer.new(WIN32::SYSTEMTIME.size) do |ptr|\n @pitask.GetMostRecentRunTime(ptr)\n time = WIN32::SYSTEMTIME.new(ptr).to_local_time\n end\n rescue Puppet::Util::Windows::Error => e\n raise e unless e.code == SCHED_S_TASK_HAS_NOT_RUN\n end\n\n time\n end", "title": "" }, { "docid": "a29a6cf6a2820dbb8b1cd3af35944aa4", "score": "0.60244924", "text": "def start_time\n @start_time\n end", "title": "" }, { "docid": "a29a6cf6a2820dbb8b1cd3af35944aa4", "score": "0.60244924", "text": "def start_time\n @start_time\n end", "title": "" }, { "docid": "a29a6cf6a2820dbb8b1cd3af35944aa4", "score": "0.60244924", "text": "def start_time\n @start_time\n end", "title": "" }, { "docid": "a29a6cf6a2820dbb8b1cd3af35944aa4", "score": "0.60244924", "text": "def start_time\n @start_time\n end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.60213", "text": "def start_time; end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.60213", "text": "def start_time; end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.60213", "text": "def start_time; end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.60213", "text": "def start_time; end", "title": "" }, { "docid": "8029be1c3941981ab13d4012e5a66b56", "score": "0.6018365", "text": "def delay_before_next_timer_run\n if self.timers.empty?\n nil\n else\n now = Time.now\n # find the first timer to trigger\n t = self.timers.sort_by(&:next_run).first\n [t.next_run - now, 0].max\n end\n end", "title": "" }, { "docid": "ca756e3be1a0d1e769404bd38b56aa7b", "score": "0.60090154", "text": "def actual_time\n # Time.now.min\n Time.now.hour\n end", "title": "" }, { "docid": "66d0f01f3aa5005181e1bcc5f23a1c36", "score": "0.6008472", "text": "def start_time\n return @start_time\n end", "title": "" }, { "docid": "2a06bcc9a79c3d586ce6b6e17dcd77f6", "score": "0.6006933", "text": "def next_scheduled_time(stop)\n @realtime = false\n stop_data = stop_schedule(stop)\n route_schedule = route_stops(stop_data)\n if route_schedule\n next_arrival = route_schedule.find { |stop| stop['arrivalTime']/1000 > @earliest_time }\n next_arrival ||= route_schedule[0] # if none before midnight, gets first arrival of the day; bug when actual next day's schedule is different.\n @scheduled_time = next_arrival['arrivalTime'] / 1000\n end\n end", "title": "" }, { "docid": "4708397af7d5b2ca3a752937b8275854", "score": "0.5984828", "text": "def start_time\n @options[:time_range].first\n end", "title": "" }, { "docid": "5f9ddba9ff495af92537183f8f7f9826", "score": "0.5984533", "text": "def from_now\n Time.now + self\n end", "title": "" }, { "docid": "05d169c8400e3d3fa1929a1ac135f87c", "score": "0.5983035", "text": "def tomorrow\n Task.tomorrow({:user => self})\n end", "title": "" }, { "docid": "84f9df0808d5c0a9ffd1b3cf382fa15a", "score": "0.59817785", "text": "def rocket_job_cron_next_time(time = Time.now)\n RocketJob::Plugins::Rufus::CronLine.new(cron_schedule).next_time(time)\n end", "title": "" } ]
3dbc15cdfabee02f15d6f2641cafbd49
For each turn, show a prompt to the user and return what was typed.
[ { "docid": "3be87694de670f37e06e148edaaddba4", "score": "0.0", "text": "def take_turn(pattern)\n\t\tunless @vowels.empty?\n\t\t\tvowel = @vowels.delete_at(0)\n\t\t\t@letters.delete(vowel)\n\t\t\tvowel\n\t\telse\n\t\t\t@letters.delete_at(0)\n\t\tend\n end", "title": "" } ]
[ { "docid": "85625045986ac983ada3cd43124c172a", "score": "0.7018406", "text": "def prompt\n if @first_guess\n first_turn\n else\n second_turn\n end\n end", "title": "" }, { "docid": "e7144b99f37b8fdc5d3d7fea22f36334", "score": "0.682819", "text": "def get_turn\n @pos, @action = @player.prompt\n end", "title": "" }, { "docid": "959d209e4a00cca6a38bc1e3a5d4cfbb", "score": "0.6817043", "text": "def turn\n\t\t\t@turns += 1\n\t\t\t@guess_letter = gets[0].downcase\n\t\t\tshow_matches\n\t\t\tcheck_win\n\t\tend", "title": "" }, { "docid": "93d052bd760c483459d3aa462f46651b", "score": "0.6645079", "text": "def take_turn\n valid_input = false\n puts \"\"\n puts \"Current text is: #{@fragment}\"\n\n until valid_input\n player_char = @current_player.guess\n valid_input = valid_play?(player_char)\n unless valid_input\n @current_player.alert_invalid_guess\n end\n end\n\n @fragment += player_char\n end", "title": "" }, { "docid": "1943640f48af2c1691108d0cf56eb286", "score": "0.65901005", "text": "def display_results(result)\n case result\n when \"Win\"\n prompt(\"You win!\")\n when \"Lose\"\n prompt(\"You lose!\")\n when \"Tie\"\n prompt(\"It's a tie!\")\n end\nend", "title": "" }, { "docid": "2fb171b6cb71c17021a1e57c79761377", "score": "0.65559405", "text": "def print_result(user_input, computer_input, who_win)\n puts ''\n puts '================================================='\n puts ''\n puts \"You choose: #{transfer_input_string(user_input)}\"\n puts \"The computer chooses: #{transfer_input_string(computer_input)}\"\n puts \"***** #{who_win} ******\"\n puts ''\n puts '================================================='\n puts ''\nend", "title": "" }, { "docid": "5056ad349b0bef1527408bfb8acce2de", "score": "0.65360665", "text": "def prompt\n until game_won? || game_tied?\n\n display_board\n puts \"Player #{@current_player.name}, it's your turn!\"\n puts \"Please enter the numbered square where you'd like to player you #{@current_player.mark}\"\n input_square = get_input\n\n until input_square && @board.is_clear?(input_square)\n puts \"Sorry, that's not an option. Try again!\"\n input_square = get_input\n end\n\n play(@current_player.mark, input_square)\n switch_player\n\n end\n\n if game_tied?\n display_board\n puts 'GAME TIED!'\n else\n switch_player\n display_board\n puts \"#{@current_player.name.upcase} WINS THE GAME!\"\n end\n end", "title": "" }, { "docid": "dae524d2b2c5847822b38d1f9f118629", "score": "0.64893895", "text": "def prompt_action \n puts \"You have six options: list users, list channels, select user, select channel, display details, send message, or quit.\"\n puts \"\\n\"\n print \"Please enter your choice: \"\n return gets.chomp.downcase\nend", "title": "" }, { "docid": "a01582189d788932bb715672d498403f", "score": "0.64696956", "text": "def prompt(digits, what, name, args = {}, &action)\n @scoped_state.sayings = [] if @scoped_state.sayings.nil?\n @scoped_state.sayings << what\n press(digits, name, args, &action)\n end", "title": "" }, { "docid": "d306e5ea8861a26bcc3fdae9742024c3", "score": "0.6467826", "text": "def feedback()\n return $prompt # $prompt is conditionally populated by good_letter(), word_test() and wrong_letter()\nend", "title": "" }, { "docid": "f8c7dd87332d3c8f81e4ab071d8a981b", "score": "0.64398974", "text": "def prompt(question)\n puts question\n gets.chomp\nend", "title": "" }, { "docid": "40634c384a744f64094d5620bf70cd02", "score": "0.64306027", "text": "def prompt\n puts\"=>\"\n gets.chomp\nend", "title": "" }, { "docid": "8cc188f706be8084ca1bd501618bba45", "score": "0.6423388", "text": "def prompt\n puts \"Select a position e.g. 0, 0\"\n position = gets.chomp.split(\", \").map {|i| i.to_i }\n puts \"Would you like to reveal or toggle flag? e.g. R or F\"\n action = gets.chomp.upcase\n [position, action]\n end", "title": "" }, { "docid": "d9d437d14f4cb5906055ad2269dd296b", "score": "0.64212364", "text": "def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend", "title": "" }, { "docid": "8efe97cbd9c9480e80aa768a273c5e4a", "score": "0.6416748", "text": "def prompt_for_guess\n puts (\"1. Enter a vowel.\")\n\tputs (\"2. Enter a consonant.\")\n\tputs (\"3. Guess the entire word.\")\n\tputs (\"(Enter your letter choice now. If you enter more than a letter than its your own fault.)\")\n end", "title": "" }, { "docid": "e2e5a5cd3a5b04f3b4a6e2eb75369c14", "score": "0.6412602", "text": "def ask_play \n\tputs \" - Bon, tu joues quoi #{@name} ? je n'est pas que ca a faire !!! (Donne les coordonnees, ex : a1, b3, c2, etc.) \"\n\t@answer_play = gets.chomp \t\n end", "title": "" }, { "docid": "8103d1a76a00a4d6012b9b5d3de47f4d", "score": "0.6401703", "text": "def player_turn\r\n answer = nil\r\n puts \"#{player.name} has #{player.total_for_hand}\"\r\n loop do\r\n puts \"Do you want to hit or stay? (enter 'h' or 's') \"\r\n loop do\r\n answer = gets.chomp.downcase\r\n break if ['h', 's'].include? answer\r\n puts \"Please enter h or s\"\r\n end\r\n if answer == 's'\r\n player.show_hand\r\n break\r\n elsif answer == 'h'\r\n player.add_to_hand(deck)\r\n puts \"#{player.name} has #{player.total_for_hand}\"\r\n end\r\n break if player.busted?\r\n end\r\n end", "title": "" }, { "docid": "b4fac5dcb4fceacabfbf3ad11454fbb0", "score": "0.6388333", "text": "def prompt(word)\n puts \"Enter a #{word}:\"\nend", "title": "" }, { "docid": "92df750aa9fec80c25773921779e77af", "score": "0.6385091", "text": "def prompt\n\tputs \"Any Key to continue\"\n\tgets\nend", "title": "" }, { "docid": "34e9c787b2bdfef93e42f228f5deb23a", "score": "0.6371912", "text": "def ask_for_(thing)\n puts \"What's the #{thing}?\"\n gets.chomp\n end", "title": "" }, { "docid": "f99e39c14e768603248d29d75557bead", "score": "0.63710415", "text": "def prompt\n print yield\n gets.chomp\nend", "title": "" }, { "docid": "9235f957de39754841535710a73acd23", "score": "0.6352096", "text": "def get_move\n\t\tputs \"Your current bankroll is $#{bankroll}, and your hand is:\"\n\t\t@hand.render \n\t\tputs \"Do you wish to fold, see the bet, or raise?\"\n\t\tbegin\n\t\t\tinput = gets.chomp.downcase\n\t\t\traise BadInputError unless ['fold', 'see', 'raise'].include?(input)\n\t\t\tinput.to_sym\n\t\trescue\n\t\t\tputs \"You must input 'fold', 'see', or 'raise'.\"\n\t\t\tretry\n\t\tend\n\tend", "title": "" }, { "docid": "c7754b3b32498ad769d9983aba16b1eb", "score": "0.63321877", "text": "def get_input\n puts \"Input [L] to turn Left, [R] to turn right and [M] to move your Mars rover forward. Type [Q] to leave. See you, Space Cowboy\"\n @input = gets.chomp.downcase\n # Loops through the array of inputs to specify commands for each specific instruction with a case statement\n @input.each_char do |i|\n case i\n # If l is inputted, make the Rover face left\n when \"l\"\n turn_left\n # If r is inputted, make the Rover face right\n when \"r\"\n turn_right\n # Get the rover to move forward in the direction it's facing.\n when \"m\"\n move\n # Exit the game when q is typed\n when \"q\"\n exit\n end\n # Convert the results to a string\n to_s\n end\n end", "title": "" }, { "docid": "6119d2009c132174e56ca1cef0480435", "score": "0.6324073", "text": "def take_turn\n puts \"Pick a space, #{@name}\"\n space = gets\n parse_input(space)\n end", "title": "" }, { "docid": "12687b281813a929bbc3ecd22bf6f23f", "score": "0.63123506", "text": "def pre_game\n puts \n puts \"Get ready for the Horde - Level 1....\"\n puts \"Press enter when you're ready...\"\n gets\n display_word\nend", "title": "" }, { "docid": "68abd0a8594d531a4c0dab00a242ecfe", "score": "0.6304588", "text": "def play_game\n turn = 1\n while turn < @turns\n puts \"Please guess a letter in the word.\"\n puts \"\"\n user_choice = gets.chomp.to_s\n until @alphabet.include? user_choice and user_choice.length == 1 do\n puts \"Please choose a single letter in the alphabet to guess the content of the word.\"\n user_choice = gets.chomp.to_s\n end\n puts \"Evaluating user choice\"\n is_secret_word_letter(user_choice)\n self.show_game_progress\n turn +=1\n puts \"Turn #{turn} complete!\"\n self.game_over_check\n end\n end", "title": "" }, { "docid": "050961da0929f4714d12860182aeae33", "score": "0.62941563", "text": "def view_fight_input\n puts \"Would you like to view a specific fight? (y/n)\"\n input = gets.strip.downcase\n end", "title": "" }, { "docid": "05286791d19c74b2bf20cd0f7a2db7ec", "score": "0.6293063", "text": "def get_question\r\n\r\n reply = \"\"\r\n\r\n #loop until the player enters something\r\n until reply != \"\"\r\n Console_Screen.cls #Clear the display area\r\n\r\n question = \"Type your question and press the Enter key. \\n\\n: \"\r\n print question\r\n\r\n reply = STDIN.gets #Collect the player's questions\r\n reply.chop! #Remove any extra characters\r\n end\r\n\r\n end", "title": "" }, { "docid": "213c97d0a1364990c72e99b2e4584f54", "score": "0.62858766", "text": "def prompt\n gets.strip\nend", "title": "" }, { "docid": "836027faa98022e9ea04ed6b6276c8f1", "score": "0.6276642", "text": "def input\n puts \"It's #{@player_turn.capitalize}'s turn. Please enter your move/ command.\"\n @input = gets.chomp.upcase\n end", "title": "" }, { "docid": "0831caad6a5c279a53c8d7b0e1b598c1", "score": "0.62696075", "text": "def prompt_user\n puts \"Type \\'h\\' to hit or \\'s\\' to stay\"\nend", "title": "" }, { "docid": "28a7aa37f67f5c53f7d0a0dc98efd2ab", "score": "0.6268696", "text": "def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end", "title": "" }, { "docid": "38a08a96c5d49ec346f93b241339cd08", "score": "0.626775", "text": "def request_input(turn)\r\n if turn === true\r\n puts \"Player 1\"\r\n puts \"=\" * 8\r\n puts \"Put in your first coordinate:\"\r\n first_coor = gets.chomp.to_i\r\n puts \"Put in your second coordinate:\"\r\n second_coor = gets.chomp.to_i\r\n end\r\n return [first_coor, second_coor]\r\nend", "title": "" }, { "docid": "a4bacde236b5979b4eadc08bd3c5a51c", "score": "0.62580967", "text": "def prompt(mess) # prompt for all questions\n puts \"==> #{mess}\"\nend", "title": "" }, { "docid": "1027596253efb082ae4f7d1ad009a2ac", "score": "0.62510073", "text": "def continue_prompt\n puts \"Do you wish to continue?\"\n response = gets.chomp\n response.downcase\nend", "title": "" }, { "docid": "88870a023da453d686fb193af7cd606d", "score": "0.62502164", "text": "def start_game\n 'Here is the set up for our story. Please enter your name:'.each_char do |value|\n putc value\n sleep 0.05\n end\n # creates a return line\n puts\n # is the return value from the function - implicit return\n gets.chomp\nend", "title": "" }, { "docid": "451d4a9fefbdd41468459d7c87d88521", "score": "0.6246345", "text": "def prompt\n print \"=> \"\n gets.chomp\nend", "title": "" }, { "docid": "c5644361c4b0a01388bd55ce4374639d", "score": "0.6237675", "text": "def guess(hints = nil, turn = nil)\n computer_guess = get_guess(hints, turn)\n puts \"#{computer_guess[0]}, #{computer_guess[1]}, #{computer_guess[2]}, #{computer_guess[3]}\"\n computer_guess\n end", "title": "" }, { "docid": "eeffc2efad47105124e527e28bad03eb", "score": "0.6235633", "text": "def prompt(text)\n @output += %(#{text}\\n)\n print text\n STDIN.gets\n end", "title": "" }, { "docid": "8ef024286cb9906ec44305093ced0de4", "score": "0.6235539", "text": "def prompt(sentence)\n puts \">> #{sentence}\"\nend", "title": "" }, { "docid": "d7de55e18383c3715fecbe089b235f54", "score": "0.62321764", "text": "def get_text(input)\n \n check = false\n until check == true\n puts \"Please enter your character's #{input}.\".colorize(:cyan).indent(10)\n print \"***>\".indent(10)\n user_input = gets.chomp\n puts \"Your character's #{input} is: #{user_input.capitalize.bold}\".colorize(:cyan).indent(10)\n check = confirm_text\n end\n user_input\n\nend", "title": "" }, { "docid": "72fd77bff43d7e62d319e345fc1b4f34", "score": "0.6217675", "text": "def ask_choice_prompt\n puts \"Which cell will you take?\"\n print '>'\n end", "title": "" }, { "docid": "7dc3aba4364dc46eae0306691db3bd78", "score": "0.62101126", "text": "def ask(question)\n print question + \" \"\n gets\nend", "title": "" }, { "docid": "9b733fbf5fce35b0938a4ac274eeef05", "score": "0.61957866", "text": "def prompt (name)\n puts \"What is your name?\"\n name = gets\n puts \"Hello #{name}!\"\n end", "title": "" }, { "docid": "95efcabffb28fcae2cc9876c7b1755fd", "score": "0.61940074", "text": "def first_guess\n\tputs \"\\nSo, what do you think the number is?\"\n\tgets\nend", "title": "" }, { "docid": "7d1da58d49f0c2625b4709692c4afd37", "score": "0.6184443", "text": "def ask_for_move\n puts\n puts @Player1 + \"! What is your move?\"\n move1 = assign_play_value(gets.chomp.downcase)\n puts\n puts @Player2 + \", what is YOUR move?\"\n move2 = assign_play_value(gets.chomp.downcase)\n return move1, move2\n end", "title": "" }, { "docid": "0a15d5aeb455472766f09489cd85425d", "score": "0.6180034", "text": "def get_question\r\n\t\t\r\n\t\treply = \"\"\r\n\t\t\r\n\t\t#loop until player enters something\r\n\t\tuntil reply != \"\"\r\n\t\t\tConsole_Screen.cls #clear the display area\r\n\t\t\tquestion = \"Type your question and press the Enter key. \\n\\n: \"\r\n\t\t\tprint question\r\n\t\t\treply = STDIN.gets #collect player input\r\n\t\t\treply.chop! #remove extra chars\r\n\t\tend \r\n\tend", "title": "" }, { "docid": "e7a721937190b8b1c9b85d5bd411b130", "score": "0.6174454", "text": "def pt;z.gets 'Your choice:'; end", "title": "" }, { "docid": "95868fe43c64d2a646d21969e17b502d", "score": "0.6170157", "text": "def get_user_input(prompt)\n print \"#{prompt}: \"\n gets.chomp\nend", "title": "" }, { "docid": "5bc69ed13a7cfeac1f6bb14a5d38f708", "score": "0.6168019", "text": "def prompt(arg)\n puts(arg)\n gets.chomp\nend", "title": "" }, { "docid": "d2b495f7de0e47abcf47e68e9b111083", "score": "0.6167982", "text": "def ask( prompt )\n print prompt\n gets.chomp\nend", "title": "" }, { "docid": "79e05fa361f5101ab217c5c6dce94d79", "score": "0.6166188", "text": "def asks_question(question)\n puts question\n gets.chomp\nend", "title": "" }, { "docid": "3901a4368c8c91ba95fd077a2485d7c7", "score": "0.61649364", "text": "def play_as_codebreaker\n # answer = colors.sample(4)\n loop do\n display.tables(hint.table,decode.table)\n puts \"Please enter your guess #{colors.join(' | ')}:\"\n player.input = gets.split.map(&:capitalize)\n if player.valid_input?\n if player.win?(answer)\n puts \"You won! #{display_answer}\"\n exit\n elsif player.lose?\n puts \"You lost! #{display_answer}\"\n exit\n else\n complete_turn\n end\n else\n puts \"Not a valid input!\"\n end\n end\n end", "title": "" }, { "docid": "2216a7a174cac5a92ac3724561208fb2", "score": "0.61623186", "text": "def prompt_greeting(namehere)\n print(namehere)\n gets\nend", "title": "" }, { "docid": "4f945b68545ec3a3f4a74f07acbb1085", "score": "0.6161604", "text": "def prompt(message)\n print message\n gets.chomp\nend", "title": "" }, { "docid": "54568d604ce34fbfee5a6297d3a3438f", "score": "0.6159115", "text": "def running(turn, time_to_guess, last_guess, last_word, last_feedback)\n system('cls')\n puts '***************************************************************'\n puts '* Word Mastermind *'\n puts '***************************************************************'\n puts '* Turn Number: ' + turn.to_s + ' Turns To Guess: '+time_to_guess.to_s+' *'\n puts '***************************************************************'\n puts ''\n puts ' REMEMBER: Your Word can only have 5 letters, and can only'\n puts ' contain one of each character!'\n puts ''\n puts '|X| = Not in word |O| = In the word and the correct place'\n puts '|-| = In the word but in the incorrect place '\n puts ''\n puts ' Your Last Guess Was: ' + last_word\n puts ''\n puts ' ' + \"#{last_guess}\"\n puts ' ' + \"#{last_feedback}\"\n puts ''\n puts ''\n puts 'What will you guess this turn?'\n puts ''\n print 'Guess: '\n end", "title": "" }, { "docid": "5236973032471e7ef5c64d408e2b0992", "score": "0.6157345", "text": "def ask(question)\n puts question\n gets.chomp\nend", "title": "" }, { "docid": "e8e9139cbb4cc29bbf41aa9082b2eded", "score": "0.6154538", "text": "def display_game(word, guesses, chances)\n puts \"\\n***********************************\"\n puts \"Your word: #{word}\"\n puts \"\\nChances left: #{chances}\"\n puts \"Your guesses: #{guesses_s(guesses)}\"\n puts \"Enter a letter: \"\nend", "title": "" }, { "docid": "a3aab852cd5ff6dcb706ccb42c88b5e1", "score": "0.6154353", "text": "def prompt(text)\n puts \">> \" + text\nend", "title": "" }, { "docid": "a8a5b972894902892dd4c5a7d2890d18", "score": "0.61516356", "text": "def prompt_user\n puts \"Type 'h' to hit or 's' to stay\"\nend", "title": "" }, { "docid": "a8a5b972894902892dd4c5a7d2890d18", "score": "0.61516356", "text": "def prompt_user\n puts \"Type 'h' to hit or 's' to stay\"\nend", "title": "" }, { "docid": "a8a5b972894902892dd4c5a7d2890d18", "score": "0.61516356", "text": "def prompt_user\n puts \"Type 'h' to hit or 's' to stay\"\nend", "title": "" }, { "docid": "a4e4ab21d83bb6cab11d71afc77d1d69", "score": "0.6149235", "text": "def turnon()\n puts \"You put ingredients in the blender.\"\n puts \"Would you like to turn the blender on? If so type 'Yes'\"\n prompt = gets.chomp.downcase\n\n # Until loop prompts for correct \"Yes\"/\"yes\" answer or keeps asking\n until prompt == \"yes\"\n puts \"Sure you don't want to push 'Yes'?\"\n prompt = gets.chomp.to_s.downcase \n end\n # If until loop passed, run outcome method which then runs puts blend method\n outcome \n end", "title": "" }, { "docid": "6d95cb3f9c57bc1b25b695883669489d", "score": "0.61475706", "text": "def congrats\n\t\tp \"Congrats on Guessing the Word\"\n\tend", "title": "" }, { "docid": "b33d0aa30a033662952c3a4e90810391", "score": "0.6137057", "text": "def prompt_user(message)\n puts message\n print \">> \"\n gets.chomp\nend", "title": "" }, { "docid": "3272e9c8568b590da80ec4b2b34f6ddb", "score": "0.6136004", "text": "def present_test(challenge)\n\n\tConsole_Screen.cls #clear the display area\n\tprint challenge + \"\\n\\n: \" #display the challenge sentence\n\tresult = STDIN.gets #collect the player's input\n\tresult.chop! #remove the end of line marker\n\n\t#analyze the player input and see if it is correct\n\tif challenge == result then\n\n\t#keep track of the number of corretly retyped challenge sentences \n\t$noRight += 1\n\tConsole_Screen.cls #clear the display area\n\t#keep player informed\n\tprint \"Correct!\\n\\nPress Enter to continue.\"\n\tConsole_Screen.pause #pause the game\n\nelse \n\n\tConsole_Screen.cls #clear the diplay area\n\t#keep the player informed\n\tprint \"Incorrect!\\n\\nPress Enter to continue\"\n\tprint \" Correct sentence: \" + challenge.to_s + \"\\tYour sentence: \" + result.to_s \n\tConsole_Screen.pause #clear the game\n\nuntil result != \" \"\n\n\tConsole_Screen.cls #clear the diplay area\n \n #prompt the playwer for permission to bein the test\n print \"You have to type something \"\n\n result = STDIN.gets #collect the player's response \n result.chop! #remove any extra characters appended to the string\t\nend\nend\nend", "title": "" }, { "docid": "a78c4aeca3f2379bfd9fec1016403ee3", "score": "0.61351526", "text": "def get_user_selection(message)\n print message\n gets.chomp\nend", "title": "" }, { "docid": "324cc4dbc48511bbe1d92119e1eaa921", "score": "0.6133336", "text": "def question\n puts \"Do you want: \\n1. Stuff\\n2. No stuff\\n3. enumerated stuff\"\n prompt; stuff = gets.chomp.to_i #This is magic! Love it!\n return stuff\nend", "title": "" }, { "docid": "9bee11990d15c297969b841ba6d2ee92", "score": "0.61255103", "text": "def welcome\n puts \"Welcome, Landlord!\"\n puts \"What would you like to do?\"\n puts \"Press 1 if you'd like to see your properties.\"\n puts \"Press 2 if you'd like to see your tenants\"\n puts \"Press 3 if you'd like to see both\"\n puts \"Press 4 if you'd like to exit the program.\"\n gets.chomp\nend", "title": "" }, { "docid": "a17ef27761cd78f03c406d6a8cdf281c", "score": "0.6125268", "text": "def run\n choose_game(prompt)\nend", "title": "" }, { "docid": "6938cf03de807d49003a754728f6d022", "score": "0.6122474", "text": "def look_at\n pause(0.25)\n\n look_at = TTY::Prompt.new\n\n choices = [\n { name: 'Inventory Item', value: 1 },\n { name: 'Whats in the Room', value: 2 },\n ]\n \n input = look_at.select(slow_type(\"\\nWhat would you like to look at?\\n\"), choices)\n\n pause(0.5)\n\n if input == 1\n look_at_inventory\n\n else input == 2\n slow_type(\"\\nHere's what's in #{find_room_by_id(@current_room_id).name}:\\n\")\n print_out_room_items\n end\n\n end", "title": "" }, { "docid": "4e77a596e98a5dbe811e82bb3711dde9", "score": "0.6121107", "text": "def directions\n puts(\"\\tThe Rules: \\n\")\n print(\"\\tPlaying this game is very simple. The game will first display a\\n\")\n print(\"\\trandomly selected word replaced with underscores and a hint to\\n\")\n print(\"\\twhat the word is. The player (you) will then be prompted to enter\\n\")\n print(\"\\teither a vowel or a consonant. The game will then print out anoter\\n\")\n print(\"\\tscreen with any spaces filled in the hidden word if you entered\\n\")\n print(\"\\ta correct guess. The player will than have the option to enter\\n\")\n print(\"\\tthe entire word or keep guessing single letters. WARNING if you\\n\")\n print(\"\\ttry to guess the hidden word and turnout to be incorrect than\\n\")\n print(\"\\tyou lose the game. The wheel is spun for every guess. When\\n\")\n print(\"\\ta player enters a vowel 250 points is deducted, but if a \\n\")\n print(\"\\tplayer enters a correct consonant they win the point for the\\n\")\n print(\"\\tround, Good Luck!\\n\\n\")\n puts (\"Press Enter to continue.\")\n end", "title": "" }, { "docid": "17a64a84574a666868b028e4acf0a0d1", "score": "0.61211044", "text": "def prompt(msg)\n puts \" => #{msg}\"\n gets.chomp\nend", "title": "" }, { "docid": "757e8847285c7fab3b1f139c081ca0a7", "score": "0.61187", "text": "def prompt(text)\n print \">> \" + text\nend", "title": "" }, { "docid": "a70bf83ae80d65dc2103e5a9deeda43a", "score": "0.61093", "text": "def prompt_player_for_turn\n\t\t\tputs \"It is Player #{@current_player.player_num}'s turn\"\n\t\t\tputs \"Which column would you like to drop your piece?\"\n\t\t\tputs \"Columns are 1-#{@Col_num.to_i}\"\n\n\t\t\t@current_player.get_player_response\n\n\n\t\tend", "title": "" }, { "docid": "3245792f8514fb4c759185c6c04a7b5f", "score": "0.6107642", "text": "def fetch_input(prompt)\n\tprint prompt\n\tgets.chomp #implicit return again\nend", "title": "" }, { "docid": "c5b3761d531f693d06877b7a08e47694", "score": "0.61076343", "text": "def prompt(text)\n Kernel.puts(\"=> #{text}\")\nend", "title": "" }, { "docid": "0b7e7baf08ddf99b01a46f3ee6d78541", "score": "0.61064684", "text": "def player_turns\n show_hands_initial\n response = \"\"\n until (response == \"s\") or (player.bust == true) or (player.hand_total == 21)\n puts \"Would you like to hit or stay (h/s)\"\n response = get_console_char\n if response == \"h\"\n self.hit(player)\n show_hands_initial\n elsif response == \"s\"\n puts \"Good move!\"\n else\n puts \"You provided '#{response}'. Please provide 'h' or 's'.\"\n player_turns\n end\n hand_check(player)\n end\n dealer_turns\n end", "title": "" }, { "docid": "d0ce266bb3087c9115b1c7971276b320", "score": "0.61061424", "text": "def play_game\n\n\tword = select_word #call on the method that retrievess a random word\n\n\tConsole_Screen.cls #clear the display area\n\n\tconsonants = get_consonants #call on the method that prompts the player\n\t#to enter a list of consonatns\n\n\tConsole_Screen.cls #clear the display area\n\n\t#call on the method that prompts the player to enter a vowel\n\tvowel = get_vowel\n\n\t#remove blank spaces from the word to create a short version of the word\n\tshortWord = word.gsub(\" \", \"\")\n\n\t#call the method that processes palyer guesses\n\tprompt_for_guess(shortWord, word, consonants, vowel)\n\n\tConsole_Screen.cls #clear the display area\n\nend", "title": "" }, { "docid": "456845c8d6f43b5a0bf757fb95518ee2", "score": "0.61060196", "text": "def get_move(player, hand)\n # tell the player what we can do\n puts\n puts \"You can [h]it\"\n puts \"or [s]tand\" \n puts \"or [d]ouble down\" unless !player.double_bet?(hand)\n puts \"or s[p]lit\" unless !player.split_hand?(hand)\n puts \n\n # now prompt the player\n result = nil\n while not result\n result = prompt(\"What would you like to do? [h]:\", \"h\")\n end\n return result\n end", "title": "" }, { "docid": "84c5aeec8a0814a8b3f06de7f5fa0d9c", "score": "0.60992783", "text": "def play_game\r\n\r\n word = select_word #Call on the method that retrieves a random word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants = get_consonants #Call on the method that prompts the player\r\n #to enter a list of consonants\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method that prompts the player to enter a vowel\r\n vowel = get_vowel\r\n\r\n #Remove blank spaces from the word to create a short version of the word\r\n shortWord = word.gsub(\" \", \"\")\r\n\r\n #Call the method that processes player guesses\r\n prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n end", "title": "" }, { "docid": "e832ae2213c6ea32b255d55cd7ba563d", "score": "0.6092552", "text": "def prompt( message )\n\tprint message\n\tgets.chomp\nend", "title": "" }, { "docid": "8ef81b3ef31172ada69069a8aa48cdd7", "score": "0.608882", "text": "def first_or_second\n turn_answer = ''\n loop do\n prompt 'Would you like to go first or second?'\n sleep 1.5\n prompt 'Press [1] to go first and [2] to go second.'\n turn_answer = gets.chomp\n break if turn_answer.downcase.start_with?('1', '2')\n prompt 'That is not a valid answer'\n end\n \n if turn_answer == '1'\n 'Player'\n elsif turn_anser == '2'\n 'Computer'\n end\nend", "title": "" }, { "docid": "20d80f1d80bc886ba12824e22ae22b27", "score": "0.60856706", "text": "def prompt message\n puts (\"=> #{message}\")\nend", "title": "" }, { "docid": "4cf38825d2a0587406a08e5a50e649af", "score": "0.6064619", "text": "def your_turn\n type(\"#{\"It's\".green} #{@current_team.name.white}#{'\\'s turn:'.green}\\n\\n\\n\")\n end", "title": "" }, { "docid": "476be58077b88bb247c238c7d5321719", "score": "0.6061864", "text": "def prompt(string)\n puts \"=> #{string}\"\n gets.chomp\nend", "title": "" }, { "docid": "382a451b364d404a0cc99877e2ba2d0e", "score": "0.6056071", "text": "def welcome_message_for_user_as_codemaker\n puts \"OK, great! You're the codemaker.\"\n puts \"In order to play, you need to think up a secret code with 4 spots.\"\n puts \"The colors you can choose from are: red, blue, green, yellow, purple, and orange.\"\n puts \"Hit enter when you're ready for my first guess!\"\n get_input\n end", "title": "" }, { "docid": "95489b343b48779bdba2778d06647b32", "score": "0.6055491", "text": "def prompt(message)\n\tprint message\n\tgets.chomp\nend", "title": "" }, { "docid": "50955d8ce2d10847b7647b88af586274", "score": "0.60551953", "text": "def prompt(message)\n\tprint messaage\n\tgets.chomp # implicit return\nend", "title": "" }, { "docid": "18928314edc66a4abf8f5122208c5fd4", "score": "0.6051589", "text": "def prompt(msg)\n print \"#{msg}: \"\n gets.chomp\nend", "title": "" }, { "docid": "18928314edc66a4abf8f5122208c5fd4", "score": "0.6051589", "text": "def prompt(msg)\n print \"#{msg}: \"\n gets.chomp\nend", "title": "" }, { "docid": "21a3f1f5d63064a70eb497428962fd22", "score": "0.6051448", "text": "def player_guess\n print \"> \"\n @guess = $stdin.gets.chomp\n end", "title": "" }, { "docid": "e983353d7f8e41fb5ae196b3e2e656a3", "score": "0.60490644", "text": "def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend", "title": "" }, { "docid": "75f1eeee7ffe876956524043b7796992", "score": "0.60465574", "text": "def ask_question\n puts '---- NEW TURN -----'\n puts \"#{@current_player.name}: what does #{@first_number} plus #{@second_number} equal?\"\n \n end", "title": "" }, { "docid": "7a920d90d31af8ccdafb7f4308666cce", "score": "0.6044495", "text": "def get_user_input\n loop do\n puts @current_player ? \"Player 1's turn\" : \"Player 2's turn\"\n\n input = CLI.ask \"Please enter a valid column from 1 to 7:\"\n case input\n when /^[1-7]$/\n return input.to_i\n else\n puts \"INVALID INPUT!\"\n puts\n next\n end\n end\n end", "title": "" }, { "docid": "034ba92e49de04542f4b38668277a006", "score": "0.60417897", "text": "def make_guess\n\t\tget_colors_from_player MAKE_GUESS_PROMPT\n\tend", "title": "" }, { "docid": "45f52c64e1586a89e5c4094349c25c21", "score": "0.60392606", "text": "def input_move(db, cur_position)\r\n\tprint \"Enter a move for #{cur_player(db, cur_position)} in standard chess notation, or HELP for help: \"\r\n\tmove = gets.chomp.downcase\r\n\treturn move\r\nend", "title": "" }, { "docid": "958722d911cb276d4aba3650230b1b47", "score": "0.6038234", "text": "def you_win\n puts \"Congrats! You survived\"\n puts \"The answer was \\\"#{@word}\\\"\"\n end", "title": "" }, { "docid": "92b36549a213002cfbedd306aa62b4d3", "score": "0.6033841", "text": "def start(round)\n puts \" \"\n puts \" \"\n puts \"***F L A S H ***C A R D***G A M E***\"\n puts \" \"\n puts \" \"\n puts \"Welcome! You are playing with #{@cards.length} cards.\"\n puts \"Good Luck and Enjoy! : ) \"\n puts \"This is card number #{@round.turns.length + 1} out of #{@cards.length}...\"\n puts \"--------------------------------------\"\n @cards.each do |card| #iterates through cards\n puts \"Question: #{card.question}\"\n puts \"Type your guess -> \"\n @guess = gets.chomp\n @round.take_turn(@guess)\n puts \"#{@round.turns.last.feedback}\"\n #require 'pry'; binding.pry\nend\nend", "title": "" }, { "docid": "dbce27d45ed070040be4414d75b85e04", "score": "0.6031863", "text": "def prompt_user(msg)\n puts \" => #{msg}\"\nend", "title": "" }, { "docid": "682462dbc00d7fb20b379676eba647dd", "score": "0.6030803", "text": "def gets\n print @prompt\n @io.gets\n end", "title": "" } ]
aadbc7a5e180b19631c8f6f7f2c18a21
GET /messages/1 GET /messages/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "ea7086ff90058b90c171a0d36a56b3ff", "score": "0.7437026", "text": "def show\n @message = User.find(params[:id]).messages\n\n render json: @message\n end", "title": "" }, { "docid": "01d640eaab3a1942727bd3c46448dee5", "score": "0.74316514", "text": "def show\n msg = @user.messages.find(params[:id])\n if msg.nil?\n render json_status_response(404, \"Message not found\")\n return\n end\n\n render :status => 200,\n :json => msg_as_hash(msg).merge(status: 200)\n end", "title": "" }, { "docid": "60aa07ba18cdd5cb89d6b048c7b9fcb7", "score": "0.7250203", "text": "def show\n @message = @user.messages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end", "title": "" }, { "docid": "7106eb8238030fb0e5e14c6828587bb4", "score": "0.7243253", "text": "def show\n @message = Message.find(params[:id])\n\n render json: @message\n end", "title": "" }, { "docid": "7106eb8238030fb0e5e14c6828587bb4", "score": "0.7243253", "text": "def show\n @message = Message.find(params[:id])\n\n render json: @message\n end", "title": "" }, { "docid": "7106eb8238030fb0e5e14c6828587bb4", "score": "0.7243253", "text": "def show\n @message = Message.find(params[:id])\n\n render json: @message\n end", "title": "" }, { "docid": "df2045abd8b2acaabd96de537702de3a", "score": "0.7230436", "text": "def show\r\n\t\t@message = Message.find(params[:id])\r\n\t\trender :json => {:message => @message}.to_json()\r\n\tend", "title": "" }, { "docid": "d90cbe6f9045b622996e3eea44cdbfdc", "score": "0.7191539", "text": "def show\n\t\t@messages = Message.where(recipient: params[:id]).order('created_at DESC')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend", "title": "" }, { "docid": "4bfe8529a1b3ffaa349306800da080a1", "score": "0.7173827", "text": "def show \n message = Message.find(params[:id])\n render json: message\n end", "title": "" }, { "docid": "a12c61b3b3c265e07d2d0d910c485462", "score": "0.71607286", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message.json_string }\n end\n end", "title": "" }, { "docid": "951800ccd5761ed3eb4d5c3ff36a8c67", "score": "0.71603715", "text": "def show\r\n @message = message.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @message }\r\n end\r\n end", "title": "" }, { "docid": "dbc96cdcfe96d0a5cfff134d321e521f", "score": "0.71598184", "text": "def messages\n get_data('/messages')\n end", "title": "" }, { "docid": "5424309524919e21ec1eb7b0d2c7958a", "score": "0.71143186", "text": "def index\n @messages = @conversation.messages\n render json: @messages\n end", "title": "" }, { "docid": "dd4ee6557cc4404a4c0212bf2f70f49e", "score": "0.71139914", "text": "def show\n render :json => Message.find(params[:id])\n end", "title": "" }, { "docid": "d327b34402dd1a391d07662379fec215", "score": "0.7107078", "text": "def show\n message = Message.find_by(id: params[:id])\n render json: message\n end", "title": "" }, { "docid": "83160aa83077860adcf302e6cac74ca9", "score": "0.7091976", "text": "def show\n @message = Message.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "8b25d278b901e8ffe4ce27618b0e2952", "score": "0.70723635", "text": "def index\n messages = Message.all\n render json: messages \n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "382dfefeb36bfd8dd92c7d2553410116", "score": "0.7067096", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "583503392b6de95f980316674d2735fc", "score": "0.7043401", "text": "def show\n message = Message.find_by rsaid: params[:id], id: params[:msgid];\n respond_to do |format|\n format.json {render json: {'message' => message.message}}\n end\n end", "title": "" }, { "docid": "1f84fa1233c77e69b1ccd9e28709c4e1", "score": "0.7040591", "text": "def show\n @message = Message.find_by id: params[:id]\n\n respond_to do |format|\n format.html {}\n format.json { render json: @message }\n end\n\n end", "title": "" }, { "docid": "d9e19027d5784f1e96a56741eb98f32c", "score": "0.7022799", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end", "title": "" }, { "docid": "d9e19027d5784f1e96a56741eb98f32c", "score": "0.7022799", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end", "title": "" }, { "docid": "d9e19027d5784f1e96a56741eb98f32c", "score": "0.7022799", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end", "title": "" }, { "docid": "d9e19027d5784f1e96a56741eb98f32c", "score": "0.7022799", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end", "title": "" }, { "docid": "6adf50da9cffd4a113de20e5f2097fcd", "score": "0.7021241", "text": "def index\n @messages = Message.all\n\n render json: @messages\n end", "title": "" }, { "docid": "6adf50da9cffd4a113de20e5f2097fcd", "score": "0.7021241", "text": "def index\n @messages = Message.all\n\n render json: @messages\n end", "title": "" }, { "docid": "5703ccfb9c814220af7ac5e4a28c7bbe", "score": "0.7009628", "text": "def show\n @message = Message.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @message}\n end\n end", "title": "" }, { "docid": "b6a88fb471e41dd40aae95a97f6fd1cb", "score": "0.6998104", "text": "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "8723c8eefd03e9053c889b671128071b", "score": "0.6991041", "text": "def index\n temp = User.find(current_user.id)\n @messages = temp.get_received_messages\n #Hier Methode einfügen, nur eigene Nachrichten\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "title": "" }, { "docid": "6f9e82fd0b4ab35e7366ed3330befd3d", "score": "0.69598204", "text": "def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "title": "" }, { "docid": "acceab1032c3ef27aaa36733104db4b3", "score": "0.6924146", "text": "def index\n @messages = Message.all\n\n\n render json: @messages\n\n end", "title": "" }, { "docid": "2e564ce3d49e2fa5a1f6cd965353d964", "score": "0.6912392", "text": "def show\n @message = @course.messages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end", "title": "" }, { "docid": "601ed3ae324f6a66cd604c3159b05548", "score": "0.6910262", "text": "def show\n # puts params\n @message = Message.where(id: params[:id])\n if @message.exists?\n render json: @message, status: :ok\n else\n render json: {status: \"error\", message: \"Can't find message\"}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2fe713636a8cb39a8f3ef269bf118008", "score": "0.69090766", "text": "def show\n message = Message.find(params[:id])\n if message.present?\n render json: {\n message_status: message.status\n }\n else\n render_error_msg(\"No message found for message_id (#{params[:id]})\")\n end\n end", "title": "" }, { "docid": "e8e55bf848dcdab8de571304e550d060", "score": "0.68943584", "text": "def index\n @messages = Message.all\n\n @page_title = 'Messages'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "title": "" }, { "docid": "177294a1b9801e6ad02b92996a59d4d4", "score": "0.6884153", "text": "def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "title": "" }, { "docid": "1e9768875734354805efa4c863cb6404", "score": "0.68726766", "text": "def get\n return messages\n end", "title": "" }, { "docid": "59c72ba2f2ae8d756931985185f09fcb", "score": "0.6865534", "text": "def get_messages(page = 1)\n options = @options\n options[:query] = { page: page }\n response = self.class.get(\"/message_threads\", options)\n @messages = JSON.parse(response.body)\n puts JSON.pretty_generate(@messages, { indent: \" \" })\n end", "title": "" }, { "docid": "32056de5cf8dcf8d16efb78e93f02ec0", "score": "0.68601674", "text": "def show\n @msg = Msg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @msg }\n end\n end", "title": "" }, { "docid": "c561f7c91458d30f4e57dfc724c22e8c", "score": "0.68585676", "text": "def show\n respond_to do |format|\n format.html\n format.json { render json: @message }\n end \n end", "title": "" }, { "docid": "2374f2573e6e3aff620e24e66c2512e7", "score": "0.6849991", "text": "def show\n @chat_message = ChatMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chat_message }\n end\n end", "title": "" }, { "docid": "2374f2573e6e3aff620e24e66c2512e7", "score": "0.6849991", "text": "def show\n @chat_message = ChatMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chat_message }\n end\n end", "title": "" }, { "docid": "1eea9066c415b41f7eee817e13cecfec", "score": "0.6842586", "text": "def index\n @messages = Message.latest.includes(:user)\n\n respond_to do |format|\n format.html do\n store_preloaded_json(\"messages_latest\", @messages)\n end\n\n format.json do\n render json: @messages\n end\n end\n end", "title": "" }, { "docid": "e95015df147dfb67e2cdabdd7e616aab", "score": "0.68175656", "text": "def show\n @messages = authenticate!.messages.where(category: message_params[:category])\n if @messages\n render json: @messages, each_serializer: MessagesSerializer, root:\n 'result', status: :ok, event: 'get_message'\n else\n render json: error('Error', 400), status: 400\n end\n end", "title": "" }, { "docid": "70e25b1ecdf24172df6620ecfc8b4d8a", "score": "0.68066204", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_list }\n end\n end", "title": "" }, { "docid": "e9242a36828e0fd24b7f2d47001481f3", "score": "0.67869496", "text": "def show\n @user_message = UserMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_message }\n end\n end", "title": "" }, { "docid": "9d0d84952913851a21afedd17e8a92a2", "score": "0.67495775", "text": "def show\n @chat = Chat.find(params[:id])\n @message = Message.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chat }\n end\n end", "title": "" }, { "docid": "db9289ec741aec52b5be5891b6857460", "score": "0.6745183", "text": "def index\n render json: Message.all\n end", "title": "" }, { "docid": "314184128d7205fd50197e1d0ee6208e", "score": "0.6726216", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_request }\n end\n end", "title": "" }, { "docid": "a4228ee73aad66c3cd6fd25d5a700832", "score": "0.6717163", "text": "def get_messages(query)\n resp = client.get(:path => \"#{base_path}/messages\", :query => query)\n extract_response('messages', resp)\n end", "title": "" }, { "docid": "6e5bebc16b5f486a6b5b4170543fa104", "score": "0.67073035", "text": "def index\n @messages = current_user.messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "title": "" }, { "docid": "8575df883c70380b7464324d50b64681", "score": "0.66986024", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message_request }\n end\n end", "title": "" }, { "docid": "d6670b1b44abccd8f35b068dda44353a", "score": "0.66914505", "text": "def index\n @messages = @user.messages.find(:all, :order=>'id desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @messages }\n end\n end", "title": "" }, { "docid": "b9771aea569749f25cc444043fb0ecc2", "score": "0.66864896", "text": "def show\n\tmsg = Message.find_by id: params[:mid], rid: params[:id]\n\trespond_to do |format|\n\t\tformat.json {render json: {'msg' => msg.content}}\n\tend\n end", "title": "" }, { "docid": "5aa84258cea0427c8f15440468b5e1b2", "score": "0.66799307", "text": "def checkStatus\n @messages = Message.find(params[:id])\n render :json => @messages\n end", "title": "" }, { "docid": "7a5f2ffc755ed761ad9d356e0522546f", "score": "0.66781926", "text": "def index\n @messages = Message.find_all_by_course_id(params[:course_id])\n\n respond_to do |format|\n format.html # index.html.erb]\n format.json { render json: @messages }\n end\n end", "title": "" }, { "docid": "35b93a9eeaf07a4f33ae13a051ea5ae7", "score": "0.6661968", "text": "def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end", "title": "" }, { "docid": "fbbc28e7d548ff6b7a05ac9c1a2aa6c3", "score": "0.6649959", "text": "def index\n @messages = authenticate!.messages\n if @messages\n render json: @messages,\n serializer: MessagesSerializer,\n root: 'results',\n status: :ok,\n event: 'get_all_message'\n else\n render json: error('Error', 400), status: 400\n end\n end", "title": "" }, { "docid": "87f85198dd60e5fdd3502fb1bd8205f8", "score": "0.6649613", "text": "def incoming_messages\n @direction = [\"incoming\", \"Incoming\"]\n fetch_message(@direction)\n render json: @messages\n end", "title": "" }, { "docid": "294de9400a1942bfa57f6ef43b7af1f2", "score": "0.66485345", "text": "def get_messages\n ensure_client & ensure_uri\n response = @client.rest_get(\"#{self['uri']}/messages\")\n @client.response_handler(response)\n end", "title": "" }, { "docid": "c8b9c288331eee6186520f015a2e3df1", "score": "0.66443616", "text": "def list_messages\n\t messages = []\n if Conversation.between(current_user.id, params[:recipient_id]).present?\n conversation = Conversation.between(current_user.id, params[:recipient_id]).first\n \t messages = conversation.messages\n end\n render json: {conversation: messages}\n end", "title": "" }, { "docid": "ecd0bf30f20ddad6d2ef77d39be41240", "score": "0.66339624", "text": "def show\n @message = current_user.received_messages.find(params[:id])\n @message.sm_read!\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end", "title": "" }, { "docid": "ebc80e0c860a8e7db549db1d49f542fc", "score": "0.6633833", "text": "def show\n render_json :entry => @message\n end", "title": "" }, { "docid": "785eeafd1ceb62104a833d794202a048", "score": "0.6623448", "text": "def index\n match_id = params[:match_id]\n @messages = Message.where(match_id: match_id)\n render json: @messages\n # this will look like\n # [\n # {message: \"sdhfkas\", user1_id: 34},\n # {message: \"sdhfkas\", user1_id: 34},\n # {message: \"sdhfkas\", user1_id: 34},\n # ]\n end", "title": "" }, { "docid": "5cdd696dc0b199ce0ccd33b2e6d21baa", "score": "0.6622558", "text": "def getMessages()\r\n @client.api.account.messages.list\r\nend", "title": "" }, { "docid": "1a4ff0a0932c6679fdfb56015b8609a1", "score": "0.66157246", "text": "def show\n render json: @message\n end", "title": "" }, { "docid": "3634fbb6733c6faab1e90bdc2b4c38bd", "score": "0.66014403", "text": "def fetch_messages(id)\n conn = api_connection api_url\n response = conn.get(\"#{api_url}/#{id}/messages\")\n\n return response.body if response.success?\n\n raise Hermes::Error.new(response.status, response.body)\n end", "title": "" }, { "docid": "667aa3f8a9a64dd08ac2fa7cbeb4743b", "score": "0.65925694", "text": "def index\n @chat_room = ChatRoom.find(params[:chat_room_id]) \n @messages = @chat_room.messages.all\n\n respond_to do |format|\n format.html { render :index, layout:false }\n format.json\n end\n end", "title": "" }, { "docid": "c1e8ad7dd26f729003b1d74b6730321e", "score": "0.6592416", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_template }\n end\n end", "title": "" }, { "docid": "7c2151f8a21a7af5f1a76df2b78d453f", "score": "0.6575139", "text": "def show\n #@message = Message.find(params[:id])\n redirect_to messages_url\n #respond_to do |format|\n #format.html # show.html.erb\n #format.json { render json: @message }\n #end\n end", "title": "" }, { "docid": "cf512529995770d3670a7b29fc8f9587", "score": "0.6570176", "text": "def show\n @incoming_message = IncomingMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incoming_message }\n end\n\n end", "title": "" }, { "docid": "0052e508a23c2bf9ff3c302eaeea1ddc", "score": "0.6541001", "text": "def view\n render json: @messages\n end", "title": "" }, { "docid": "b79dcefc103b0320ba87f0d52f6ff4fc", "score": "0.6537139", "text": "def retrieve_messengers()\n start.uri('/api/messenger')\n .get()\n .go()\n end", "title": "" }, { "docid": "37cd8327a1e58c3e1b19186e754c34a0", "score": "0.65350777", "text": "def index\n @messages = Message.all\n json_string = MessageSerializer.new(@messages).serializable_hash.to_json\n render json: json_string\n end", "title": "" }, { "docid": "fa220fe398d82c48bd1628949101a074", "score": "0.65144026", "text": "def get_messages\n @con = Conversation.find(params[:id])\n \n @msgs = []\n \n if (params[:last].nil?)\n @msgs = @con.get_messages_limit(params[:from], params[:to])\n else\n time = params[:last].to_f / 1000.0\n puts time\n time = Time.at(time)\n puts \"PARAMS LAST: \" + time.to_s\n @msgs = @con.get_messages_newer(time)\n end\n \n @users = {}\n \n @con.get_users.each do |u|\n @users[u.id] = User.find(u.id)\n end\n \n @temp = []\n @msgs.each do |msg|\n m = {}\n sender = @users[msg.sender_id]\n m[:body] = msg.body\n m[:sender] = sender.name + \" \" + sender.surname\n m[:sender_id] = sender.id\n m[:date] = msg.created_at\n m[:own] = msg.sender_id.to_i == session[:user_id]\n m[:img] = User.find(msg.sender_id).avatar_url(:display)\n @temp << m\n end\n @msgs = @temp\n \n respond_to do |format|\n format.json {\n render json: @msgs.to_json.html_safe\n }\n end\n end", "title": "" }, { "docid": "6d82e324b1b05af97c3f75e3faaa9b1b", "score": "0.65054756", "text": "def show\n @user_msg = UserMsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_msg }\n end\n end", "title": "" }, { "docid": "fe669b04b90a46ed50f5f492f296be8e", "score": "0.6496262", "text": "def show\n @message = @user.messages.find(params[:id])\n end", "title": "" }, { "docid": "609b4509ac09a28fca225bfcc0c6c146", "score": "0.6486363", "text": "def index\n user_messages = UserMessage.all\n # @message = @user_messages.messages \n # @user = @user_messages.user\n render json: user_messages, methods: [:message,:user]\n end", "title": "" }, { "docid": "cb21a5eb7efbce4fd17ac6ac4aa2f03d", "score": "0.6479286", "text": "def index\n\t\t@messages = Message.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.messages }\n end\n end", "title": "" }, { "docid": "dbccf933d8bef30d7c15424b162d9045", "score": "0.647379", "text": "def index\n @chat_messages = ChatMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chat_messages }\n end\n end", "title": "" }, { "docid": "cb73eeb1a9fec3e4843ffe159274a99d", "score": "0.6458386", "text": "def show \n activity = Activity.find(params[:id])\n render json: activity, include: :messages\n end", "title": "" }, { "docid": "280ef4bd62efeb308bd4f5d824f4d881", "score": "0.6453049", "text": "def show\n @phone_number = params[:id]\n @messages = Message.where(\"to_number LIKE ? OR from_number LIKE ?\", \"%#{@phone_number}%\", \"%#{@phone_number}%\").order(\"time_created DESC\").limit(20).reverse\n @first_msg = @messages.first\n unless @first_msg.nil? || @first_msg.direction.nil?\n check_message_direction(@first_msg)\n @conversation.first.update(:unread_count => 0)\n end\n render :json => @messages\n end", "title": "" }, { "docid": "084cf848ae39300e10739d69785ddd09", "score": "0.6452195", "text": "def messages\n #### finds a ChatRoom by the 'id' params, though 'id' could be anything like 'beef' as it is only a parameter that will accept anything you pass it.\n chat_room = ChatRoom.find(params[:id])\n user = User.find(params[:user_id])\n # notes = Note.find_by(chatroom_id: chat_room.id, user_id: user.id)\n #### this 'render json:' returns the messages associated with the chat_room that has matching parameters. in this case...all messages associated with the chat_room_id of 'params[:id]' or for example all messagess that are associated with ChatRoom(id: 1) would be returned for a 'GET' request.\n render json: {messages: chat_room.messages.map{|message| MessageSerializer.new(message)}, notes: chat_room.notes.map{|note| NoteSerializer.new(note)}}\n end", "title": "" }, { "docid": "fb0d82df8dc43ea29a5de05de0896eb8", "score": "0.6430745", "text": "def messages\n # If a contact id was specified, show only messages with that user\n _messages = {}\n if (contact_id = params[:contact_id]) then\n _messages = Message.where(user_id: params[:id], contact_id: contact_id)\n else\n _messages = Message.where(user_id: params[:id]).to_json(except: [:created_at, :updated_at])\n end\n\n ret = Jbuilder.encode do |json|\n json.array! _messages do |message|\n json.(message, :content, :user_id, :contact_id, :song_id, :sent, :created_at)\n\n if message.song_id\n song = Song.find(message.song_id)\n json.song do\n json.(song, :title, :artist, :category_id, :created_at)\n json.path song.path\n end\n end\n\n json.contact User.find(message.contact_id)\n end\n end\n render json: ret\n end", "title": "" } ]
e55ae247a2b6a1e26ca3637856875d0b
List of transactions by address
[ { "docid": "72df9fbdf35b60bdbb868eab1c869eae", "score": "0.76059115", "text": "def transactions_by_address(address, options = {})\n agent.transactions_by_address(self['id'], address, options) do |data, resp|\n yield(data, resp) if block_given?\n end\n end", "title": "" } ]
[ { "docid": "2964377bd042075a01a3a93b0616aed4", "score": "0.74159175", "text": "def fetch_transactions_for(address)\n tid = api_request('queryTransactionInventory', { addresses: [address], limit: 1 })[\"txIds\"].first\n tid ? [fetch_transaction(tid, address: address)] : []\n end", "title": "" }, { "docid": "ce0afb00ac83d8fa9c8c5ab040f93b24", "score": "0.7196016", "text": "def normal_transactions(address, args = {})\n action = 'txlist'\n transcations(action, address, nil, args)\n end", "title": "" }, { "docid": "ccfdbc060980f2a5dc6e8ea38fb2bf82", "score": "0.7134264", "text": "def transactions_by_address(account_id, address, options = {})\n out = nil\n currency = if options[:currency] then options[:currency] else blockchain_type end\n get(\"/v1/#{currency}/accounts/#{account_id}/transactions/address/#{address}\", options) do |resp|\n out = resp.data.map { |item| Cryptoprocessing::Transaction.new(self, item) }\n yield(out, resp) if block_given?\n end\n out\n end", "title": "" }, { "docid": "de6597930877649da3a7d1b562d9f1a3", "score": "0.6972321", "text": "def addresses\n query(:address)\n end", "title": "" }, { "docid": "94e0e31ae5f3e4a92a9fb3e980681ff1", "score": "0.6956816", "text": "def addresses\n @client.request('getaddressesbyaccount', name)\n end", "title": "" }, { "docid": "e4996367c4c7f3559c7d391282f336c2", "score": "0.69064623", "text": "def fetch_transactions_for(address)\n # API may return nil instead of an empty array if address turns out to be invalid\n # (for example when trying to supply a testnet address instead of mainnet while using\n # mainnet adapter.\n if api_response = api_request('queryTransactionInventory', {addresses: [address], limit: 100})\n (api_response['txIds'] || []).map { |tid| fetch_transaction(tid, address: address) }\n else\n raise BitcoinAddressInvalid, message: \"address in question: #{address}\"\n end\n end", "title": "" }, { "docid": "a0a3d27aa1936f5187423661bf9ea8bb", "score": "0.68529665", "text": "def internal_transactions(address, args = {})\n action = 'txlistinternal'\n transcations(action, address, nil, args)\n end", "title": "" }, { "docid": "be68fe3e154f9a8ca4aa3e9f39fcd2d7", "score": "0.6671672", "text": "def list_addresses\n Address.list(@id)\n end", "title": "" }, { "docid": "c701a6de47077b77069eb2f1f6c38b75", "score": "0.6598118", "text": "def fetch_transactions_for(address)\n super\n rescue Straight::Blockchain::Adapter::BitcoinAddressInvalid => e\n StraightServer.logger.warn \"Address #{address} seems to be invalid, ignoring it. #{e.message}\"\n return []\n rescue => ex\n StraightServer.logger.debug \"fetch_transactions_for #{address} failed: #{ex.inspect}\"\n return []\n end", "title": "" }, { "docid": "bdc1705c32f6a34463a887782b826e33", "score": "0.65352666", "text": "def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end", "title": "" }, { "docid": "e8c10f348fdf1fbac4daccdffe841b38", "score": "0.6521055", "text": "def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end", "title": "" }, { "docid": "ab03ab0f7c90bdfbf435690cd9457da5", "score": "0.64822876", "text": "def getaddressesbyaccount(account)\n @api.request 'getaddressesbyaccount', account\n end", "title": "" }, { "docid": "2b70b79e430a253f17f2f9d56c0dc640", "score": "0.6431953", "text": "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "title": "" }, { "docid": "10e1c5e9836456a05475c632fbc485aa", "score": "0.6365158", "text": "def index\n @tadresses = Tadress.all\n end", "title": "" }, { "docid": "8bc0a7be232e0359a8c7928b05001595", "score": "0.6357371", "text": "def list_unspent(addresses)\n unspents = []\n addresses.in_groups_of(500, false).collect do |group|\n unspents += list_unspent_helper(group)\n end\n unspents\n end", "title": "" }, { "docid": "ddad2ff73824d004b1bbf3c79fe71e9e", "score": "0.6352787", "text": "def tx_by_address( address, api_key )\n address = encode( address )\n get(\"/txbyaddress/#{address}/#{api_key}\")\n end", "title": "" }, { "docid": "48c82f5ee0707f98c83eaab28e86692f", "score": "0.63254386", "text": "def index\n @account_addresses = AccountAddress.all\n end", "title": "" }, { "docid": "9510f363cf0ab7b1cd161a023ade93e0", "score": "0.6320651", "text": "def list_unspent(addresses)\n raise NotImplementedError\n end", "title": "" }, { "docid": "f50fa139def45eeec41e2948ea824a75", "score": "0.62938726", "text": "def listtransactions(account, count = 10)\n coind.listtransactions account, count\n end", "title": "" }, { "docid": "634554b338ccd99450ef0a80b074c031", "score": "0.62766546", "text": "def index\n @addresses = current_customer.addresses.order(is_primary_address: :desc, updated_at: :desc)\n end", "title": "" }, { "docid": "b2b7a3c69227d024cd5bf3f0130966cd", "score": "0.6244531", "text": "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "title": "" }, { "docid": "937494a14ac670834386ca88c5bd2832", "score": "0.6224535", "text": "def addresses\n Array(@addresses)\n end", "title": "" }, { "docid": "8b57ab416d89597e46ee995845db12a7", "score": "0.6222411", "text": "def addresses\n @addresses\n end", "title": "" }, { "docid": "4fab7d0b658b218d997f5bc36af6aaac", "score": "0.6221669", "text": "def index\n @addresses = Address.order(:number).all\n end", "title": "" }, { "docid": "07c26ef25b23726f857e76158428a851", "score": "0.61916625", "text": "def addresses\n collect { |a| a.address }\n end", "title": "" }, { "docid": "7ac623243fd19f51a6002b9d3e9c94fb", "score": "0.6189119", "text": "def searchrawtransactions(bitcoinaddress, verbose=1)\n @api.request 'searchrawtransactions', bitcoinaddress, verbose\n end", "title": "" }, { "docid": "05333b2f87c7a5ead4304619ba32d415", "score": "0.61752695", "text": "def index\n\t\t@addresses = Address.all\t\n\tend", "title": "" }, { "docid": "e4e14b9a0518e9f7a3026e61101af6d0", "score": "0.6163391", "text": "def index\n @user_addresses = UserAddress.all\n end", "title": "" }, { "docid": "77d04ced35a6505c242140d5e4cde0a4", "score": "0.6126412", "text": "def list_unspent(addresses = [], min = 1 , max = 9999999)\n listunspent(min, max, addresses)\n end", "title": "" }, { "docid": "1ec80f41052bcbaa8ee51cd69fb932c7", "score": "0.612513", "text": "def index\n @vendor_addresses = VendorAddress.all\n end", "title": "" }, { "docid": "cc76e94412aa2de177a388d1c0cb26f5", "score": "0.6093766", "text": "def address_listing\n @addresses = current_user.addresses\n end", "title": "" }, { "docid": "28e86755c2a91ae04a578679b8a1e42f", "score": "0.6087802", "text": "def index\n @q = Address.where([\"user_email = ?\", current_user.email]).ransack(params[:q])\n @addresses = @q.result(distinct: true)\n end", "title": "" }, { "docid": "281c733b9c39c24687e0ff90d781a24c", "score": "0.6078621", "text": "def transactions\n txs = @client.listtransactions.reverse\n txs.map do |tx|\n tx = symbolize tx\n Transaction.new(\n account: tx.f(:account),\n address: tx.f(:address),\n category: tx.f(:category),\n amount: tx.f(:amount),\n vout: tx.f(:vout),\n confirmations: tx.f(:confirmations),\n blockhash: tx[:blockhash],\n blockindex: tx[:blockindex],\n blocktime: tx[:blocktime],\n txid: tx.f(:txid),\n keychainconflicts: tx.f(:keychainconflicts),\n time: tx.f(:time),\n timereceived: tx.f(:timereceived),\n )\n end\n end", "title": "" }, { "docid": "6f10369624afedac62882e16a1ddd670", "score": "0.6068555", "text": "def index\n @addresses = Address.all\n end", "title": "" }, { "docid": "6f10369624afedac62882e16a1ddd670", "score": "0.6068555", "text": "def index\n @addresses = Address.all\n end", "title": "" }, { "docid": "ce99ed24bf449a84a60724e5c8cce00a", "score": "0.6043306", "text": "def listtransactions(account, count = 10)\n request :listtransactions, account, count\n end", "title": "" }, { "docid": "7610d81a2390dbe89c8526d7fecf33f9", "score": "0.6019217", "text": "def get_txouts_for_address(address, unconfirmed = false)\n hash160 = Bitcoin.hash160_from_address(address)\n type = Bitcoin.address_type(address)\n get_txouts_for_hash160(hash160, type, unconfirmed)\n end", "title": "" }, { "docid": "bdcfb34ec23c8f017fe3ebb44562b196", "score": "0.60140216", "text": "def list_unspent(oa_address_list = [])\n btc_address_list = oa_address_list.map { |oa_address| oa_address_to_address(oa_address)}\n outputs = get_unspent_outputs(btc_address_list)\n result = outputs.map{|out| out.to_hash}\n result\n end", "title": "" }, { "docid": "6ab11380349e5020f51b9ee8ec887493", "score": "0.6009974", "text": "def index\n @ag_addresses = Ag::Address.all\n end", "title": "" }, { "docid": "065e7a163c543b9c9f2ccc4528e0bdac", "score": "0.6006242", "text": "def listtransactions(account = '' , count = 10, from = 0)\n @api.request 'listtransactions', account, count, from\n end", "title": "" }, { "docid": "7217df4b427df0bca21a67fa2bc8ffc8", "score": "0.59901994", "text": "def index\n @customer_addresses = CustomerAddress.all\n end", "title": "" }, { "docid": "ec2af888cccbf19bbc77fcabdb6d7692", "score": "0.59794104", "text": "def index\n @address_records = AddressRecord.all\n end", "title": "" }, { "docid": "f9eba63ac899984e0b9d3b7bcb11523d", "score": "0.5971735", "text": "def search\r\n @addresses = Address.find_by_address(params[:address])\r\n end", "title": "" }, { "docid": "0483e6cb56c0f9d0d9a0c40b9be56f59", "score": "0.59487516", "text": "def index\n @sales_addresses = Sales::Address.all\n end", "title": "" }, { "docid": "68efb79b927e3ebc57f2ee3ec1a15e39", "score": "0.5914391", "text": "def index\n @adresses = Adress.all\n end", "title": "" }, { "docid": "227eb380d48ba27f75322325d95ab290", "score": "0.58944285", "text": "def get_txrefs(addy, before = nil, limit = 100)\n bcypher.address_details(addy, before: before, limit: 100)\n end", "title": "" }, { "docid": "ca21e4b9f438a0e190e91898e26aae0b", "score": "0.5873553", "text": "def list_internal_transactions_by_address(blockchain, network, address, opts = {})\n data, _status_code, _headers = list_internal_transactions_by_address_with_http_info(blockchain, network, address, opts)\n data\n end", "title": "" }, { "docid": "dbf895d81d5e0eb99ebd7fa4731facef", "score": "0.5873322", "text": "def index\n @client_addresses = ClientAddress.all\n end", "title": "" }, { "docid": "c74993797f6362343bb445e415a95caa", "score": "0.58730775", "text": "def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end", "title": "" }, { "docid": "d30a8bb09a92a458466d5110edd4b29b", "score": "0.5868414", "text": "def index\n\t\t@addresses = current_user.addresses\n\tend", "title": "" }, { "docid": "6bf6eabf07ceb93f2142e810f997fb3a", "score": "0.5825302", "text": "def token_transactions(contract_address, address = nil, args = {})\n fail Etherscan::Exception, 'contract or address must be defined' if (contract_address || address).nil?\n action = 'tokentx'\n transcations(action, address, contract_address, args)\n end", "title": "" }, { "docid": "4dcc95dfe67db4d39a18679d247747e2", "score": "0.58246964", "text": "def accounts\n @transactions.collect(&:account).uniq\n end", "title": "" }, { "docid": "2690ded81846a7ad8d089a478f1128da", "score": "0.5811678", "text": "def index\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "title": "" }, { "docid": "95294fd3ec27593f880ebc224856176f", "score": "0.58059657", "text": "def show_addresses(**params)\n get('addresses', params)\n end", "title": "" }, { "docid": "490d36be8fead6258e8d8fc1ba9eab2b", "score": "0.57947344", "text": "def index\n @user_addresses = current_user.user_addresses\n end", "title": "" }, { "docid": "0b2e30c1f9944ab02aa6590638b64f99", "score": "0.5776131", "text": "def index\n @person_addresses = PersonAddress.all\n end", "title": "" }, { "docid": "afaeb29e97be6084e6dcebc72a4f9f25", "score": "0.57746977", "text": "def orders\n Spree::Order.with_address(self)\n end", "title": "" }, { "docid": "f3841977e081ffce22e38be51bd6e4fd", "score": "0.5764565", "text": "def transactions\n res = filter\n .apply( account.all_transactions.reverse_order(:created_at) )\n\n res\n .paginate(page, per_page)\n end", "title": "" }, { "docid": "9897025be0c31323da89580908da433c", "score": "0.5759425", "text": "def listunconfirmed(addr)\n json_get('address','unconfirmed',addr)['data']['unconfirmed']\n end", "title": "" }, { "docid": "462d03a552c4c6b6c3e90f08d2155902", "score": "0.5757543", "text": "def utxos(sources)\n txns = []\n sources.each do |hash|\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/address').append(hash).append('unspent')\n )\n data = json['data']\n raise Sibit::Error, \"The address #{hash} not found\" if data.nil?\n txns = data['list']\n next if txns.nil?\n txns.each do |u|\n outs = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/tx').append(u['tx_hash']).add(verbose: 3)\n )['data']['outputs']\n outs.each_with_index do |o, i|\n next unless o['addresses'].include?(hash)\n txns << {\n value: o['value'],\n hash: u['tx_hash'],\n index: i,\n confirmations: u['confirmations'],\n script: [o['script_hex']].pack('H*')\n }\n end\n end\n end\n txns\n end", "title": "" }, { "docid": "e94f09b3146c44938463a21b75cbe2b6", "score": "0.575485", "text": "def by_address(address)\n Apis.client.get(\"/company?address=#{address}\")\n end", "title": "" }, { "docid": "8b0ece5e71e082716ff4f04619b6f624", "score": "0.5720174", "text": "def index\n @addresses = current_user.addresses\n @address = Address.new\n end", "title": "" }, { "docid": "f41de26a728aab3347326f0782b69fe5", "score": "0.5720159", "text": "def find(address)\n Mailgun.submit :get, list_url(address)\n end", "title": "" }, { "docid": "dcf4ed68e43d0c0b72e4e598442aa2a1", "score": "0.56967473", "text": "def index\n @addresses_people = AddressesPerson.all\n end", "title": "" }, { "docid": "b41fbdda32bc1b6bc02fd7840b77ba4b", "score": "0.5694899", "text": "def index\n @ripple_addresses = RippleAddress.all\n end", "title": "" }, { "docid": "f85bbf62175095c24235194638eea7dd", "score": "0.5684683", "text": "def find_all(options = {})\n response = JSON.parse(@client.get('transactions', options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end", "title": "" }, { "docid": "f78cc4e48c48849b83a15e71df9c40c7", "score": "0.56757957", "text": "def index\n @wallet_transactions = WalletTransaction.all\n end", "title": "" }, { "docid": "33ab67acc7afaf3e7cdf8e3abea6aaa5", "score": "0.5671456", "text": "def addresses\n # prevent original array from being changed\n @addresses.dup\n end", "title": "" }, { "docid": "e6f527d9ca637ba516dde4a2a8d27955", "score": "0.5662075", "text": "def addresses(tenantArr)\n tenantArr.each do |tenant|\n #puts tenant[:name]\n end\n end", "title": "" }, { "docid": "d60684cea238885d1541dee2d6938856", "score": "0.565996", "text": "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "title": "" }, { "docid": "3ce4dbdfedc1e1f2742b5a98934c0811", "score": "0.5657635", "text": "def listreceivedbyaddress(minconf = 1, includeempty = false)\n coind.listreceivedbyaddress minconf, includeempty\n end", "title": "" }, { "docid": "41ce5215923103e6c8b103d751522b05", "score": "0.5655924", "text": "def addresses\n options = (token && secret) ? {:access_token => token, :access_secret => secret} : {}\n @addresses ||= Address.find(username, options)\n end", "title": "" }, { "docid": "41ce5215923103e6c8b103d751522b05", "score": "0.5655924", "text": "def addresses\n options = (token && secret) ? {:access_token => token, :access_secret => secret} : {}\n @addresses ||= Address.find(username, options)\n end", "title": "" }, { "docid": "0737bb5808c09b688e0277247cf39108", "score": "0.56552696", "text": "def index\n @post_addresses = PostAddress.all\n end", "title": "" }, { "docid": "0f69e451ef5c874de9718f5d9cc7b56d", "score": "0.564885", "text": "def hash_for_search\n return addresses.each.inject([]) do |memo, a|\n memo.push({\n search_customer: \"#{last_name} #{first_name} #{primary_phone} #{a.format_for_search}\",\n label: \"#{last_name}, #{first_name} #{number_to_phone(primary_phone)} #{a.label}\",\n customer_id: id,\n address_id: a.id\n })\n end\n end", "title": "" }, { "docid": "c093215430ebe38f136376e892046662", "score": "0.5642915", "text": "def listreceivedbyaddress(minconf = 1, includeemepty = false)\n request :listreceivedbyaddress, minconf, includeemepty\n end", "title": "" }, { "docid": "f336f40c4f8a61c4c2a230ecf37ca726", "score": "0.56276345", "text": "def balance_of(address)\n payload = Base58.decode(address).to_s(16)\n public_key_hash = payload.slice(0, payload.length - 4)\n unspent_txs = unspent_transaction_outputs_of(public_key_hash)\n unspent_txs.reduce(0) { |sum, tx_out| sum + tx_out.value }\n end", "title": "" }, { "docid": "280fb74ff6be7136772dffff9447843d", "score": "0.562357", "text": "def get_addresses apts\n return apts.map { |apt| apt.address }\n end", "title": "" }, { "docid": "3dba667afe0281dff022c8f2a3ca9048", "score": "0.5621319", "text": "def index\n if address_type==\"Address\"\n @addresses = Address.find(:all)\n else\n @addresses = Address.find_all_by_type(address_type)\n end\n @addresses ||= []\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "title": "" }, { "docid": "376cad2c142560012e8060d89b297248", "score": "0.5617016", "text": "def index\n @address_details = AddressDetail.all\n @customers = Customer.all\n end", "title": "" }, { "docid": "0719ab2e5eedd9157274abdc90bb1778", "score": "0.5608829", "text": "def unspent(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/utxo?noCache=1\")\n end", "title": "" }, { "docid": "730d9e7379a8d332f0d4462e0afebe55", "score": "0.5605365", "text": "def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end", "title": "" }, { "docid": "41f81b927caa793c85453eede531ff36", "score": "0.55970097", "text": "def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end", "title": "" }, { "docid": "6b56c3f064cf37e9e7f34ae956341579", "score": "0.5591737", "text": "def add_address(addresses, address)\n address[:postcode] = postcode\n addresses.push(AddressSummary.new_from_search(address))\n end", "title": "" }, { "docid": "6b956bf4d5b04e486974c0cf71e71390", "score": "0.5573814", "text": "def addresses; end", "title": "" }, { "docid": "7fd9b511d70b7b159b03f97ad54eafdf", "score": "0.55602974", "text": "def list_wallet_addresses(wallet_id: default_wallet_id)\n call :get, '/wallet/' + wallet_id + '/addresses'\n end", "title": "" }, { "docid": "646e39dd956938356d6c9be26264667c", "score": "0.55559665", "text": "def from_addresses\n return @from_addresses\n end", "title": "" }, { "docid": "dd35975f0fb65bca095c3796595d82dd", "score": "0.5551439", "text": "def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end", "title": "" }, { "docid": "9f171675a9df3e0a7730cd9a2f991a2c", "score": "0.55244213", "text": "def index\n @addresses = Address.paginate :page => params[:page], :order => 'street ASC'\n #@addresses = Address.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "title": "" }, { "docid": "c9c08fdb70871c61b8036a4436de2125", "score": "0.55198705", "text": "def index\n\t@addresses=current_user.addresses\nend", "title": "" }, { "docid": "a862f973fb4d7979766baaa6a2fcd5df", "score": "0.55161715", "text": "def address_regions(address)\n return [] unless address\n \n if address.new_record? && address.country_id\n Region.find_all_by_country_id(address.country_id)\n elsif address.region\n address.regions\n else\n []\n end\n end", "title": "" }, { "docid": "9fc786eaec199c17739c2fb38748eafb", "score": "0.55132073", "text": "def show\n\t @addresses = @user.addresses\n end", "title": "" }, { "docid": "3799ebe6c1f608e7be5e10fe60a48523", "score": "0.55119395", "text": "def index\n @electronic_addresses = ElectronicAddress.all\n end", "title": "" }, { "docid": "6f3139ce2e0fdbb1b667dcf9a1b77288", "score": "0.5510373", "text": "def listreceivedbyaddress(minconf = 1, includeempty = false)\n @api.request 'listreceivedbyaddress', minconf, includeempty\n end", "title": "" }, { "docid": "f25c54f9958d94953fc81bbab7616b6e", "score": "0.5503586", "text": "def index\n @addresses = Address.scoped.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @addresses }\n end\n end", "title": "" }, { "docid": "cb455e452abd403fde22387ea64540e9", "score": "0.5495163", "text": "def index\n @transactions = current_user.wallet.transactions\n\n end", "title": "" }, { "docid": "8c0904ea7e1a3ee09b0e005714f383e7", "score": "0.54913634", "text": "def transactions(account_name=nil, count=10)\n transaction_data = request('listtransactions', account_name, count)\n transaction_data.map do |txdata|\n Transaction.new(self, txdata['txid'], txdata)\n end\n end", "title": "" }, { "docid": "d8dabe6d2f27510231eced00dcb52013", "score": "0.54893535", "text": "def address\n @client.request('getaccountaddress', name)\n end", "title": "" }, { "docid": "422ab14864897268df37863b440f70bb", "score": "0.5485624", "text": "def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end", "title": "" }, { "docid": "6a42dbe53b75b398e97b03689ee0340d", "score": "0.54846776", "text": "def listunspent(bitcoinaddress=nil, minconf=1, maxconf=nil)\n @api.request 'listunspent', minconf, maxconf, bitcoinaddress\n end", "title": "" } ]
ddb934f0d41b849d064231c6b5735a6a
list of rooms that are not reserved for a given date range, so that I can see all available rooms for that day. It retuns an arrary with rooms with not reservations with a given date.
[ { "docid": "a49807f2c9756b0896c0110dc6b87fd5", "score": "0.7934592", "text": "def get_available_rooms(date_range)\n unavailable_rooms = []\n # Send the room to unavailable rooms if room has a reservation for a specific data_range. \n @reservations.each do |reservation|\n if reservation.daterange.overlap?(date_range) == true\n unavailable_rooms << reservation.room\n end\n end\n # Array substrating total_rooms minus unavailable rooms.\n return @rooms - unavailable_rooms\n end", "title": "" } ]
[ { "docid": "bbae131749b63e546a95f80ed5049f6f", "score": "0.87951815", "text": "def unreserved_rooms_by_date(start_date, end_date)\n dates = date_range(start_date, end_date)\n dates << Date.parse(end_date)\n unreserved_rooms = []\n @rooms.each do |room|\n if is_available?(room, dates) && is_not_blocked?(room, dates)\n unreserved_rooms << room\n end\n end\n return unreserved_rooms\n end", "title": "" }, { "docid": "be783c251b6bc433a61c8070365b9682", "score": "0.8601857", "text": "def get_unreserved_rooms(date_range)\n unreserved_room_ids = check_reservations(date_range, reservations)\n\n blocks.each do |block|\n block_start = block[:start_date]\n block_end = block[:end_date]\n room_objs = block[:rooms]\n room_ids = room_objs.map {|room| room.room_id}\n\n if date_range[:start_date] >= block_end == true\n next\n else\n if date_range[:end_date] <= block_start == false\n room_ids.each do |id|\n unreserved_room_ids.delete(id)\n end\n end\n end\n end\n\n return unreserved_room_ids.sort.uniq\n end", "title": "" }, { "docid": "8240ac75046e47bfb6844d64ce3eccf3", "score": "0.8263708", "text": "def list_reservations_for_date(date)\n # Access array of rooms\n rooms.reject do |room|\n # Check if room is available for the date\n room.is_available?(date)\n end\n end", "title": "" }, { "docid": "0713742ad8ffe429f377c87459ea8f46", "score": "0.8093667", "text": "def list_available_rooms(date_range)\n conflicting_reservations = reservations_by_date_range(date_range)\n\n available_rooms = @rooms.reject do |room|\n conflicting_reservations.find do |res|\n res.room_number == room[:room_number]\n end\n end\n return available_rooms\n end", "title": "" }, { "docid": "7e16deee79d403febf996cdcc44d0a08", "score": "0.7813327", "text": "def find_all_available_rooms(date_range)\n\n available_rooms = VALID_ROOM_IDS.dup\n\n if @reservations.empty?\n return @rooms\n end\n\n @reservations.each do |reservation|\n\n range_set_difference = date_range - ((reservation.checkin_date..reservation.checkout_date).to_a - [reservation.checkout_date])\n\n if range_set_difference != date_range\n available_rooms -= [reservation.room_number]\n end\n\n end\n\n if available_rooms.empty?\n raise StandardError.new(\"Hotel fully booked for this date range. Try a different date.\")\n end\n\n return available_rooms\n end", "title": "" }, { "docid": "2484b20a72cacb5846e1bd3901b46d3a", "score": "0.7788335", "text": "def list_available_rooms(date)\n available_room_ids = []\n @rooms.each do |room| \n if room.dates_reserved == [] \n available_room_ids << room.id\n else \n room.dates_reserved.each do |reservation|\n if date < reservation[:start] && date <= reservation[:end]\n available_room_ids << room.id\n elsif date > reservation[:start] && date >= reservation[:end]\n available_room_ids << room.id\n end\n end\n end\n end\n \n return available_room_ids\n end", "title": "" }, { "docid": "596a585108e448d31d4bd6dd837a9844", "score": "0.75213784", "text": "def list_rooms_available_for_date_range(start_date, end_date)\n # Select room if all reservations for the room return false for overlap with the given start date end date\n rooms_available = rooms.select do |room|\n room.reservations.all? { |reservation| date_range_overlap?(start_date, end_date, reservation.check_in, reservation.check_out) == FALSE }\n end\n # If there is no room available, raise an error\n if rooms_available.empty?\n raise NoRoomsAvailableError, \"No rooms are available for this date range\"\n else\n return rooms_available\n end\n end", "title": "" }, { "docid": "c45475e55bd8c42bc4d9bd704d3611d9", "score": "0.7356668", "text": "def dates_unavailable\n dates_booked = @room_reservations.map do |reservation|\n reservation.reservation_dates.all_dates\n end\n return dates_booked.flatten\n end", "title": "" }, { "docid": "274103bf64c57420dbca30e7dca0bf4b", "score": "0.7285753", "text": "def unavailable_date_ranges_from_today\n self.reservations\n .where('end_date > ?', Date.today())\n .where(status: [1, 5])\n .map {|item| [item.start_date, item.end_date]}\n end", "title": "" }, { "docid": "c6a11d85b1a371e24cfeade605e7721a", "score": "0.7285718", "text": "def get_rooms_by_date(date)\n\t\t\tunavail_rooms = get_reservations_by_date(date).map { |reservation| reservation.room }\n\t\t\treturn @rooms - unavail_rooms\n\t\tend", "title": "" }, { "docid": "0ff8025388191dd2d47aec77856d6a14", "score": "0.7271629", "text": "def find_available_room(date_range)\n\n if @reservations.empty?\n return @rooms[0]\n end\n\n available_rooms = VALID_ROOM_IDS.dup\n\n #if reservation date_range overlaps with date_range, delete reservation.room_number from list of available rooms\n @reservations.each do |reservation|\n\n # #if date_range has nothing in common with reservations range, then set_difference is date_range\n range_set_difference = date_range - ((reservation.checkin_date..reservation.checkout_date).to_a - [reservation.checkout_date])\n\n # #if set difference not equal to date_range, that room is unavailabel for that date\n if range_set_difference != date_range\n available_rooms -= [reservation.room_number]\n end\n end\n\n #throw error if the unavailable_rooms = 20\n #throw another type of RuntimeError if no available rooms\n if available_rooms.empty?\n raise StandardError.new(\"Hotel fully booked for this date range. Try a different date.\")\n end\n\n #use find by to find the first number that isn't in unavailable rooms array\n return available_rooms[0]\n\n end", "title": "" }, { "docid": "5c210b50ba6eb94d0a5d8f5910ae609c", "score": "0.71941334", "text": "def find_available_rooms(start_date, end_date) \n available_room_ids = []\n \n @rooms.each do |room| \n if room.dates_reserved == [] && room.blocks == []\n available_room_ids << room.id\n else \n num_available_rooms = 0 \n room.dates_reserved.each do |reservation|\n num_available_rooms += check_reservation_conflicts(start_date, end_date, reservation, num_available_rooms)\n end\n \n if room.blocks != []\n room.blocks.each do |block|\n num_available_rooms += check_reservation_conflicts(start_date, end_date, block, num_available_rooms)\n end\n end\n \n if num_available_rooms == (room.dates_reserved.length + room.blocks.length)\n available_room_ids << room.id\n end\n end\n end\n \n return available_room_ids unless available_room_ids == []\n \n raise ArgumentError, \"No rooms available at this time\"\n end", "title": "" }, { "docid": "64643bfea791012a3dced3bab1072c96", "score": "0.7130832", "text": "def reservations_by_room(room, date)\n valid_room_inputs = []\n 20.times do |i|\n valid_room_inputs << (\"room#{i+1}\").to_sym\n end\n\n unless valid_room_inputs.include?(room)\n raise ArgumentError.new(\"Not a valid room\")\n end\n\n room_index = (((room.to_s).match('[0-9]')[0]).to_i) - 1\n reservation_list = []\n\n @rooms[room_index][room].each do |reservation_instance|\n if date.between?(reservation_instance.start_date, reservation_instance.end_date)\n reservation_list << reservation_instance\n end\n end\n\n return reservation_list\n end", "title": "" }, { "docid": "94cc4a09cd92648f1be80f85321b35f1", "score": "0.70654076", "text": "def list_available_rooms(given_date_range)\n\n return find_all_available_rooms(given_date_range)\n end", "title": "" }, { "docid": "082eb7cd3ed93f29973ce9a0401bb335", "score": "0.7021334", "text": "def find_booked(date)\n rooms_booked = []\n @reservations.each do |reservation|\n if reservation.reservation_date_range.start_date == date.start_date && reservation.reservation_date_range.end_date == date.end_date\n rooms_booked << reservation\n end\n end\n return rooms_booked\n end", "title": "" }, { "docid": "f72cf7447320a4b2c4852a17aa43767d", "score": "0.6936323", "text": "def reservations_by_room_date (room_number, date_range)\n # reservations_by_room contains all the reservations match\n # based on the room and a given date range. \n reservations_by_room = @reservations.select do |reservation|\n reservation.room.room_id == room_number &&\n reservation.daterange.overlap?(date_range)\n end\n return reservations_by_room\n end", "title": "" }, { "docid": "8075f79c58f41300421fd1f0e2878c4e", "score": "0.6931557", "text": "def available_rooms(check_in, check_out)\n check_in = Date.parse(check_in)\n check_out = Date.parse(check_out)\n\n if check_in == check_out\n booking_dates = [check_in]\n else\n booking_dates = (check_in..check_out).to_a\n end\n\n # returns a list of all rooms, if no reservations have been made\n return rooms if reservations.empty?\n\n available = []\n availability = \"yes\"\n\n # searches through each room's reservation dates and if they don't include\n # any of the dates being inquired about adds the room to the available\n # list\n rooms.each do |room|\n room.reservations.each do |reservation|\n reservation.all_dates.each do |date|\n availability = \"no\" if booking_dates.include?(date)\n end\n end\n available << room if availability == \"yes\"\n availability = \"yes\"\n end\n\n return available\n end", "title": "" }, { "docid": "dbf62e1d4bfd5913133b854a87ec3804", "score": "0.6930728", "text": "def list_blocked_rooms(start_date, end_date)\n date_valid?(start_date, end_date)\n\n blocked_rooms = []\n\n @blocks.each do |block|\n blocked_rooms += block.rooms\n end\n\n return blocked_rooms\n end", "title": "" }, { "docid": "dc3907d77d47c4100921edbd256c0a4c", "score": "0.68909895", "text": "def available_rooms(range_query)\n all_rooms = @rooms.map {|room| room.number}\n\n conflicting_reservations = @reservations.find_all { |res| res.range.overlap?(range_query) == true }\n occupied_rooms = conflicting_reservations.map {|res| res.room_num}\n occupied_rooms = occupied_rooms.uniq\n\n available_rooms = all_rooms - occupied_rooms \n\n return available_rooms\n end", "title": "" }, { "docid": "e6443691eaa1dc785284401c40736154", "score": "0.68820757", "text": "def room_finder(searching_range)\n\t\t\tpossible_rooms = @rooms\n\t\n\t\t\t@reservations.each do |reservation|\n\t\t\t\tif reservation.range.include_range?(:booking, searching_range) == false\n\t\t\t\t\tpossible_rooms.delete(reservation.room)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\traise ArgumentError.new(\"No rooms left for this time range\") if possible_rooms.length == 0\n\n\t\t\treturn possible_rooms\n\t\tend", "title": "" }, { "docid": "9c4452f3059cffb55a4d0b489b98fba2", "score": "0.68702984", "text": "def find_available_rooms(rooms, start_date: Date.today, end_date: Date.today + 2)\n return Room.all_available_rooms(rooms, start_date: start_date, end_date: end_date)\n end", "title": "" }, { "docid": "bc480b888c26a30d2698d2d4e70b4ce5", "score": "0.6851588", "text": "def unavailable_dates\n bookings.pluck(:start_dt, :end_dt).map do |range|\n { from: range[0], to: range[1] }\n end\n end", "title": "" }, { "docid": "49e85a5842dd0fb37fc883547742ceb5", "score": "0.67831224", "text": "def rooms_unavailable\n return @occupied.keys\n end", "title": "" }, { "docid": "6e62763abac796bf23d2bdab17ada6eb", "score": "0.67504764", "text": "def rooms_available\n avail_block_reservations = []\n \n reservations.each do |reservation|\n if reservation.block_res_taken == false\n avail_block_reservations << reservation\n end\n end\n \n if avail_block_reservations.length == 0\n raise AvailabilityError.new(\"All rooms in this block are reserved.\")\n end\n \n return avail_block_reservations\n end", "title": "" }, { "docid": "e7a5173cf90e18716838e2dc7ff7850d", "score": "0.67453915", "text": "def reservations_by_date_range(date_range)\n res_by_date_range = @reservations.select do |res|\n res.date_range.overlaps?(date_range)\n end\n return res_by_date_range\n end", "title": "" }, { "docid": "7091c094dc18bea5eda2cf1cd9c1565b", "score": "0.66940385", "text": "def availability_of_room\n room_type = RoomType.find(self.room_type_id) rescue nil\n errors.add(:room_type_id, \"Pleass select room type\") if room_type.blank?\n return if room_type.blank?\n total_rooms = room_type.rooms.pluck(:id)\n booked_rooms = Booking.where('(start_date >= ? and start_date <= ?) or (end_date >= ? and end_date <= ?)', self.start_date, self.end_date, self.start_date, self.end_date).pluck(:room_id)\n available_rooms = total_rooms - booked_rooms\n errors.add(:start_date, \"unavailable for given time period\") if available_rooms.count == 0\n end", "title": "" }, { "docid": "98048d597db66296c7c4d308994372bc", "score": "0.6681759", "text": "def reservations_by_date(date)\n date = Date.parse(date)\n res_by_date = @reservations.select do |res|\n res.date_range.included_in_date_range(date)\n end\n return res_by_date\n end", "title": "" }, { "docid": "18850cbfa8798cb7d4822b7010d7c8c5", "score": "0.66689366", "text": "def get_reservations_by_date(date)\n\t\t\tfound_reservations = []\n\n\t\t\t@reservations.each do |reservation|\n\t\t\t\tif reservation.range.include_single_date?(date)\n\t\t\t\t\tfound_reservations << reservation\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn found_reservations\n\t\tend", "title": "" }, { "docid": "613b9c8749e658a58b43fb73419c0e97", "score": "0.6667133", "text": "def available_rooms\n available_rooms = reservations.select do |reservation|\n reservation.status == :HOLD\n end\n \n return available_rooms\n end", "title": "" }, { "docid": "8bb2c36e7c69d5a9c6e51ff0042b31bc", "score": "0.66571563", "text": "def list_rooms_available_today\n\n return find_all_available_rooms([Date.today()])\n end", "title": "" }, { "docid": "b2f4da94af86926f5b7d266b9fb74325", "score": "0.6655158", "text": "def reserve_room(start_date, end_date) \n \n current_room = ()\n if @reservation_list.empty? == true\n current_room = rooms.shift\n elsif @reservation_list.empty? == false\n @reservation_list.include?(start_date)\n count = @reservation_list.count(start_date)\n current_room = rooms[count - 1]\n end\n \n \n room = current_room\n range = Hotel::DateRange.new(start_date, end_date)\n start_date = range.start_date\n end_date = range.end_date\n nights = range.nights\n \n # if the range has overlapping dates, then it will return true\n # if the range returns true \n \n reservation = Reservation.new(start_date, end_date, nights, room)\n \n # if @reservations_list.overlap?(range)\n # raise ArgumentError.new\n # end\n \n @reservation_list << reservation\n return reservation\n end", "title": "" }, { "docid": "ca1ddc98e06518c3c0b1e162483b6d1b", "score": "0.6639749", "text": "def get_reservation_list(date)\n if reservations.length != 0\n reservation_list = reservations.select { |reservation| compare_dates(reservation, date) }\n return reservation_list\n else\n return []\n end\n end", "title": "" }, { "docid": "510f463b0d337376f5db126db2498650", "score": "0.6575431", "text": "def find_reservations(date: Date.today)\n found_reservations = []\n\n if date.class != Date\n date = Date.parse(date)\n end\n\n reservations.each do |reservation|\n all_dates = DateRange.create_date_array(start_date: reservation.start_date, end_date: reservation.end_date)\n if all_dates.include? date\n found_reservations << reservation\n end\n end\n\n return found_reservations\n end", "title": "" }, { "docid": "704d6930faa60820cb2328ff814cdde8", "score": "0.65651816", "text": "def reserved_slots(date)\n Reservation.confirmed.where(nook_id: self.id)\n .happening_within(date.beginning_of_day..date.end_of_day)\n .map do |r|\n r.start.strftime('%H%M').to_i..\n (r.end + 1.seconds).strftime('%H%M').to_i\n end\n end", "title": "" }, { "docid": "515cd0f5312afc795dead137afe54b4f", "score": "0.6560747", "text": "def reservations_by_date(date_query)\n res_list = []\n @reservations.each do |res|\n if res.range.include?(date_query)\n res_list << res\n end\n end \n return res_list \n end", "title": "" }, { "docid": "359c692e13a1a79cdbe339fd6fa1bc83", "score": "0.65467644", "text": "def unavailable_dates\n bookings.pluck(:check_in, :check_out).map do |range|\n { from: range[0], to: range[1] }\n end\n end", "title": "" }, { "docid": "957c000cde4de2b1c4fc7eda1f16acf3", "score": "0.65426785", "text": "def get_reservations_by_room(room, searching_range)\n\t\t\tfound_reservations = []\n\n\t\t\troom.reservations.each do |reservation|\n\t\t\t\tif reservation.range.include_range?(:searching, searching_range) == false\n\t\t\t\t\tfound_reservations << reservation\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn found_reservations\n\t\tend", "title": "" }, { "docid": "8e62be37199e95cb2a0d5fe1dad94d0a", "score": "0.65027404", "text": "def reserveRoom(date, time, scheduleTable)\n j=0\n reservedRooms = []\n while j < scheduleTable.size\n if date == scheduleTable[j][\"Date\"] && time == scheduleTable[j][\"Time\"] && self.building == scheduleTable[j][\"Building\"] && self.roomNum == scheduleTable[j][\"Room\"]\n scheduleTable[j][\"Available\"] = \"false\"\n end\n j+=1\n end\n end", "title": "" }, { "docid": "7e76e0e4140a21c51b02346eb5b33746", "score": "0.6478225", "text": "def list_reserved_rooms\n unless @rooms.empty?\n @rooms.each do |key, room|\n puts room.report_lister\n end\n end\n end", "title": "" }, { "docid": "7ead731316e3e5454df7e02d2899db42", "score": "0.64181817", "text": "def reservations_by_date(date)\n date = Date.parse(date)\n list_res = []\n @reservations.each do |reservation|\n if reservation.check_in_date <= date && reservation.check_out_date >= date\n list_res << reservation\n end\n end\n return list_res\n end", "title": "" }, { "docid": "571d414c8a2e5bc5d254d0ca73842a34", "score": "0.64082783", "text": "def search\n @rooms = Room.available_in_range(@start_date, @end_date).group(:type).presence\n end", "title": "" }, { "docid": "cfd745f38ecdf4d75b36a218dcad8afa", "score": "0.63894606", "text": "def reservations_by_date(date)\n specific_reservations = @reservations.find_all do |reservation|\n (reservation.start_date..reservation.end_date).cover?(Date.parse(date))\n end\n\n return specific_reservations\n end", "title": "" }, { "docid": "0862936b51d3e4ab58e7fced642fb019", "score": "0.6338058", "text": "def get_availability\n unbooked_days = []\n availability_blocks = self.availabilities.includes(:bookings)\n availability_blocks.each do |availability_block|\n booked_days = []\n availability_block.bookings.each do |booking|\n booked_days += (booking.start_date..booking.end_date).to_a\n end\n (availability_block.start_date..availability_block.end_date).each do |day|\n unbooked_days.push(day) unless booked_days.include?(day)\n end\n end\n unbooked_days\n end", "title": "" }, { "docid": "0e942aa8496aa3bc4b8bc0d01c7f084f", "score": "0.6327469", "text": "def index\n \n @rooms= Room.all.where(\"id NOT IN (SELECT room_id FROM reservations WHERE ? < check_out_date AND ? > check_in_date) AND hotel_id IN (SELECT id from hotels WHERE city LIKE ?)\",params[:checkin].to_date.beginning_of_day,params[:checkout].to_date.beginning_of_day,\"%#{params[:destination].to_s}%\")\n end", "title": "" }, { "docid": "4ece673727359e6c2b9c4b9b5764ef69", "score": "0.6321533", "text": "def reservations_by_date(date)\n @all_reservations.select {|reservation| reservation.contains(date)}\n end", "title": "" }, { "docid": "1e4a5aa50ffaeda5a8c13a61372adb08", "score": "0.6310777", "text": "def date_range(items, from, to)\n\n date_range_items = items.reject{ |item| item[\"date\"] < from }\n date_range_items.reject!{ |item| item[\"date\"] > to }\n\n return date_range_items\nend", "title": "" }, { "docid": "5aa18daebb0b845e05fd6b5429ffd129", "score": "0.62392974", "text": "def list_reservations(date)\n res_on_date = @reservations.select do |reservation|\n date >= reservation.start_date && date < reservation.end_date\n end\n \n return res_on_date\n end", "title": "" }, { "docid": "d1736b7a59b28abcab95981885515a7d", "score": "0.6214442", "text": "def reserve_room(start_date, end_date)\n if start_date.class != Date || end_date.class != Date\n raise ArgumentError.new(\"Please input valid dates\")\n else\n reservation = Reservation.new(start_date, end_date)\n @reservations << reservation\n return reservation\n end\n end", "title": "" }, { "docid": "7ffb7e1551813d0c2711f128955dad85", "score": "0.62082016", "text": "def index\n @reservations = Reservation.all\n @rooms = Room.all\n\n since_date = date_param || Date.today - 3\n until_date = since_date + 14\n @dates = ( since_date )..( until_date )\n\n @reservation_rooms = ReservationRoom.where( \"since <= ? OR until >= ?\", until_date, since_date )\n end", "title": "" }, { "docid": "7ffce84ce5639558e3e4250aa978fb58", "score": "0.61627036", "text": "def existing_reservations\n start_dt = self.start_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n end_dt = self.end_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n room_id = self.room.try(:id)\n results_size = (self.is_block?) ? 1000 : 1\n\n return [] if room_id.blank? || start_dt.blank? || end_dt.blank?\n block_query = [{ term: { is_block: false } }, { range: { end_dt: { gte: Time.zone.now.to_datetime.change(offset: \"+0000\") } } }]\n query =\n {\n query: {\n constant_score: {\n filter: {\n bool: {\n must: [\n { term: { room_id: room_id } },\n { term: { deleted: false }},\n { bool:\n {\n should: [\n {\n bool: {\n must: [\n { range: { start_dt: { gte: start_dt } } },\n { range: { start_dt: { lt: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { end_dt: { gt: start_dt } } },\n { range: { end_dt: { lte: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { start_dt: { lte: start_dt } } },\n { range: { end_dt: { gte: end_dt } } }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n },\n size: results_size\n }\n query[:query][:constant_score][:filter][:bool][:must] += block_query if self.is_block?\n return Reservation.search(query).results\n end", "title": "" }, { "docid": "6a5556413ed5434c4f935d0910cc6e69", "score": "0.61576885", "text": "def check_block_availability(rooms, range)\n\t\t\tpossible_rooms = room_finder(range) # Returns available rooms in the given range.\n\t\t\tavail = []\n\n\t\t\trooms.each do |room|\n\t\t\t\tif possible_rooms.include?(room)\n\t\t\t\t\tavail << room\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn avail\n\t\tend", "title": "" }, { "docid": "cf263104e3eba80d142df922f2110e49", "score": "0.611491", "text": "def reservations_by_date(date)\n reservations.find_all { |reservation| reservation.all_dates.include?(Date.parse(date)) }\n end", "title": "" }, { "docid": "bf3d81070911b279bfd6801c1f8c4e28", "score": "0.6084341", "text": "def available_rooms_in_block(block_name:)\n available = reservations.find_all do |reservation|\n reservation.block_name == block_name && reservation.booking_name == nil\n end\n\n return available\n end", "title": "" }, { "docid": "abb17e63dff28567a1980f33e84ce913", "score": "0.60542667", "text": "def search_by_room_date(room, first_date, second_date)\n\t\t\traise ArgumentError, \"Room #{room} does not exist\" if @rooms.last.id < room\n\n\t\t\treservation_room_date = []\n\n\t\t\t@reservation_blocks.each do |reservation_block|\n\t\t\t\tfound_room = reservation_block.room_ids.include? room\n\t\t\t\tif reservation_block.check_reservation_range(first_date,second_date) && found_room\n\t\t\t\t\treservation_room_date << reservation_block\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn reservation_found?(reservation_room_date, \"reservations\")\n\t\tend", "title": "" }, { "docid": "6fc3518d9311dd2bc8d05cf0d293e313", "score": "0.60092473", "text": "def overlapping_reservations\n\t\t# =? prevents sql injection\n\t\treservations = Reservation.where(\"listing_id =?\", self.listing_id)\n\n\t\tif reservations.count > 0\n\t\t\treservations.each do |r|\n\t\t\t\tif overlaps?(r)\n\t\t\t\t\treturn errors.add(:unavailable, \"dates!\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "ad8dc93b8074c362fd17da9a2dbc00df", "score": "0.6007151", "text": "def room_index\n @bookings = @room.bookings.where.not('is_canceled').order(start_date: :asc)\n end", "title": "" }, { "docid": "abf6deecd26cf8bfcb26c315993dd26f", "score": "0.5988007", "text": "def available_movies(date_range)\n all_movies = @movies\n # returns only movies that are not booked on given date range\n # deletes movie from list of movies if it is booked\n # specific to id\n rentals.each do |rental|\n all_movies.delete_if do |movie|\n rental.movie.id == movie.id && rental.date_range.overlaps(date_range)\n end\n end\n \n return all_movies\n end", "title": "" }, { "docid": "1689568e055f1767c9a01773c6dc779e", "score": "0.5984844", "text": "def reservations_by_room_and_range(room_num_query, range_query)\n return @reservations.find_all { |res| res.room_num == room_num_query && res.range.overlap?(range_query) }\n end", "title": "" }, { "docid": "deb40637489fef1fde736d09b1038e80", "score": "0.5972393", "text": "def reserve_room(start_date, end_date)\n requested_range = DateRange.new(start_date: start_date, end_date: end_date)\n reservable_rooms = available_rooms(requested_range)\n chosen_room = nil\n\n # pick first room in list of open rooms\n if reservable_rooms.length == 0\n raise ArgumentError.new(\"There are no open rooms available between the dates #{start_date} and #{end_date}. Please try another date range.\")\n else \n chosen_room = reservable_rooms.first \n end \n\n # create a unique id \n if @reservations.length == 0 \n new_res_id = 1\n else \n new_res_id = @reservations.last.id + 1\n end \n\n # create a new reservation \n new_reservation = Hotel::Reservation.new(id: new_res_id, room_num: chosen_room, start_date: start_date, end_date: end_date)\n\n # update @reservations \n update_reservations_list(new_reservation)\n end", "title": "" }, { "docid": "17b37e86bbafb6d2e6b96d62bae2c980", "score": "0.59711736", "text": "def reservations(date)\n reservation_list.each do |index, date|\n if reservation_list[index].include?(date)\n print reservation_list[index]\n end \n end\n end", "title": "" }, { "docid": "f8d4913b6fac4720c054dbad92c545e2", "score": "0.5945102", "text": "def search_available_rooms\n room_type = params[:room_type].to_i\n start_date = params[:start_date]\n end_date = params[:end_date]\n booked_rooms = find_available_rooms(room_type, start_date, end_date)\n booked_rooms_id = []\n booked_rooms.each do |room|\n booked_rooms_id.push(room.room_id)\n end\n filtered_rooms_on_room_type = RoomCategory.find(room_type).rooms.pluck(:id)\n @available_rooms = filtered_rooms_on_room_type - booked_rooms_id\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "3de1444d8d584b972c523c315ca8d62e", "score": "0.5931635", "text": "def make_room_reservation(test_range, room)\n overlapping = self.list_room_reservations(room, test_range)\n if overlapping.length != 0\n raise ArgumentError.new(\"room not available in that date range\")\n else\n new_res = Reservation.new(date_range: test_range, room: room)\n @reservations << new_res\n return new_res\n end\n end", "title": "" }, { "docid": "28998849a49e57bc6df47fd957384b2d", "score": "0.59302044", "text": "def find_day_reservations(date)\n day_reservations = all_reservations.select do |number, reservation|\n start_date = reservation.check_in\n end_date = reservation.check_out\n (start_date...end_date).include?(Date.parse(date)) && reservation.status == :CONFIRMED\n end\n \n return day_reservations\n end", "title": "" }, { "docid": "d6ceba298dfaf0037c1aa0fded960c2c", "score": "0.5914548", "text": "def available_time_slot date_of_booking\n\t\tif date_of_booking.gsub(/[-]+/,\"\").to_i != Time.zone.now.strftime(\"%Y%m%d\").to_i\n\t\t\tresource_slot = self.timeslots\n\t\t\tif self.bookings.where(date_of_booking:date_of_booking).where(status:1)\n\t\t\t\tbookings_of_day = self.bookings.where(date_of_booking: date_of_booking).where(status:1)\n\t\t\t\tbookings_of_day.each do |x|\n\t\t\t\t\tresource_slot.delete_at(x.slot)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tresource_slot = next_time_slots\n\t\tend\n\t\tresource_slot\n\tend", "title": "" }, { "docid": "d9bb58bab7efffe1084a550885fc89d9", "score": "0.5898621", "text": "def available?(date_range)\n if reservations.length == 0\n return true\n end\n if reservations.any? {|r| r.overlap?(date_range)}\n return false\n else\n return true\n end\n end", "title": "" }, { "docid": "bd42d51b04969f84d99359a3c9543d15", "score": "0.5888807", "text": "def make_reservation(check_in, check_out, rooms)\n unavailable_rooms = []\n\n if room_flagged_available?(check_in, check_out, rooms, unavailable_rooms)\n @reservations.push(Reservation.new(check_in, check_out, rooms))\n else\n raise ArgumentError.new(\"Room: #{unavailable_rooms} not available\")\n end\n end", "title": "" }, { "docid": "8ef960b90657a9e2dd693493c27ef21a", "score": "0.5858799", "text": "def list_reservations\n return @occupied.values.select { |value| value.class == Hotel::Reservation }\n end", "title": "" }, { "docid": "b65fb4830634f9cea67bfbfa77e1ab10", "score": "0.5842449", "text": "def neighborhood_openings(start_date, end_date)\n openings = []\n self.listings.each do |listing|\n listing.reservations.each do |r|\n booked_dates = r.checkin..r.checkout\n unless booked_dates === start_date || booked_dates === end_date\n openings << listing\n end\n end\n end\n return openings\n end", "title": "" }, { "docid": "0e5e29ac06c2830f4e66b10c26d2f736", "score": "0.5839013", "text": "def room_available\n !self.rooms.where(available: true).blank?\n end", "title": "" }, { "docid": "f967eb49c1111dfd8fa15cf145ce7b60", "score": "0.58049756", "text": "def availability(room_number, end_date, start_date)\n\n @reservations.each do |reservation|\n\n # i am trying to look throught all the reservation instances and\n # see what dates are available to reserve a reservation.\n\n if room_number == reservation.room_number && reservation.does_overlap(end_date,start_date)\n\n # if reservation.start_date == start_date && reservation.end_date == end_date\n # return false\n # elsif reservation.start_date > start_date && reservation.start_date < end_date\n # next #true\n # elsif reservation.start_date < start_date && reservation.start_date < end_date\n # next #true\n # elsif reservation.start_date > start_date && reservation.start_date > end_date\n # next #false , i think i need only\n # else\n # end\n\n\n\n\n\n end\n\n end\nend", "title": "" }, { "docid": "87c74b7bf2e7b3fe83ef2763b1f5c9f4", "score": "0.57856584", "text": "def past_reservations\n self.reservations.where(\"date < ?\", Date.today.to_s)\n end", "title": "" }, { "docid": "b1f82172f7fdb8746f3af676cbb0a6be", "score": "0.578203", "text": "def list_daily_reservations(given_date)\n\n given_date = Date.parse(given_date)\n daily_reservations = []\n\n @reservations.find_all do |reservation|\n if ((reservation.checkin_date..reservation.checkout_date).to_a - [reservation.checkout_date]).include?(given_date)\n daily_reservations << reservation.confirmation_id\n end\n end\n\n return \"No reservations for #{given_date}.\" if daily_reservations.empty?\n return daily_reservations\n end", "title": "" }, { "docid": "a9bf8c7e3b19569aad4e28f4ae23c29c", "score": "0.5781594", "text": "def city_openings(start_date, end_date)\n listings.collect do |listing|\n reservations_in_range = listing.reservations.collect do |reservation|\n reservation.checkin <= end_date.to_date && reservation.checkout >= start_date.to_date\n end\n listing unless reservations_in_range.include?(true)\n end\n end", "title": "" }, { "docid": "ef0e14b1223674ffe073d2c458ed12c2", "score": "0.5767662", "text": "def room_list\n\t\t@room = Accommodation.find_all_by_host_id(@current_user.id)\n\t\t@date = RoomBooking.find_all_by_room_id(@room)\n \tend", "title": "" }, { "docid": "3307ec8d0617644540638fa6abe24ca1", "score": "0.57531303", "text": "def make_resevation(date_range)\n available_rooms = get_available_rooms(date_range)\n if available_rooms.length < 1\n raise ArgumentError\n end\n new_reservation = Hotel::Reservation.new(date_range,available_rooms[0])\n @reservations << new_reservation\n return new_reservation\n end", "title": "" }, { "docid": "7c6f2153ca6ebbf52b1c2f72d635d0cc", "score": "0.57061714", "text": "def city_openings(start_date, end_date)\n date_range = (Date.parse(start_date)..Date.parse(end_date))\n listings.collect do |listing|\n available = true\n listing.booked_dates.each do |date|\n if date_range === date\n available = false\n end\n end\n listing if available\n end\n end", "title": "" }, { "docid": "b0a50b3bcd30b559ff9c6d5ce35c8e03", "score": "0.56908685", "text": "def index\n @reserved_rooms = ReservedRoom.all\n end", "title": "" }, { "docid": "c7a882a9cd94c75738cfd3922f78eb58", "score": "0.56801605", "text": "def reservations_by_date(date)\n total_by_date = @reservations.select do |reservation|\n reservation.daterange.start_date == date\n end\n return total_by_date\n end", "title": "" }, { "docid": "047b4316ff9b949b5148cf421fcd5fee", "score": "0.5664048", "text": "def overlap(existing_reservations)\n booked_rooms = []\n existing_reservations.each do |reservation|\n if @check_out >= reservation.check_in && @check_out < reservation.check_out ||\n @check_in >= reservation.check_in && @check_in < reservation.check_out ||\n @check_in > reservation.check_in && @check_out < reservation.check_out\n if reservation.class == BookingSystem::Block\n reservation.avail_block_rooms.map { |block_room_num| booked_rooms << block_room_num }\n else\n booked_rooms << reservation.room_num\n end\n end\n end\n return booked_rooms\n end", "title": "" }, { "docid": "242a268dd658bc58128eec8dd4fc3df3", "score": "0.56301177", "text": "def reserve_room(check_in, check_out)\n dates = date_range(check_in, check_out)\n new_reservation = nil\n @rooms.each do |room|\n if is_available?(room, dates) && is_not_blocked?(room, dates)\n new_reservation = Reservation.new(room, check_in, check_out)\n new_reservation.id = assign_res_id\n @reservations << new_reservation\n break\n end\n end\n if new_reservation != nil\n return new_reservation\n else\n raise StandardError, 'no rooms available in date range'\n end\n end", "title": "" }, { "docid": "69cf57753cef6c8cdfb1c42409a2c860", "score": "0.56213975", "text": "def available?(start_date, end_date)\n unless self.reservations.any? { |res| start_date.to_date.between?(res.checkin, res.checkout) || end_date.to_date.between?(res.checkin, res.checkout)} \n true\n end\n end", "title": "" }, { "docid": "bf5e9238f6ca7ac01ddce26a67e34d4f", "score": "0.5574264", "text": "def availabilities_for(date)\n {\n date: date,\n slots: available_slots_for(date)\n }\n end", "title": "" }, { "docid": "00d8d6d1f8a62d7179a747503443f829", "score": "0.55656606", "text": "def search_by_date(date)\n\t\t\treservation_by_date = []\n\n\t\t\t@reservation_blocks.each do |reservation_block|\n\t\t\t\treservation_by_date << reservation_block if reservation_block.check_date(date)\n\t\t\tend\n\n\t\t\treturn reservation_found?(reservation_by_date, \"reservations\")\n\t\tend", "title": "" }, { "docid": "b3da03813c3011eebe68cc2b1f95b732", "score": "0.5558148", "text": "def make_reservation(checkin_date, checkout_date, num_rooms = 1, room_block_discount = 1)\n\n num_rooms = num_rooms.to_i\n\n if num_rooms > 2 && num_rooms < 5\n return make_room_block(checkin_date, checkout_date, num_rooms)\n elsif num_rooms > 5\n raise ArgumentError.new(\"Room blocks of more than 5 are not allowed. Please split up reservations.\") if num_rooms > 5\n elsif num_rooms <= 0\n raise ArgumentError.new(\"Please enter room numbers larger than 0.\") if num_rooms\n end\n\n range = (Date.parse(checkin_date)..Date.parse(checkout_date)).to_a\n room = find_available_room(range)\n\n input = parse_reservation_data(checkin_date, checkout_date, room, room_block_discount)\n reservation = Hotel::Reservation.new(input)\n\n add_reservation_to_list(reservation)\n return reservation\n end", "title": "" }, { "docid": "b183c2c36eb490095a1bd4b6dc794a34", "score": "0.55558103", "text": "def find_room_with_spaces\n available_rooms = Array.new()\n available_rooms = @rooms\n .find_all { |room| room.is_full == false}\n .map { |room| room.name }\n return available_rooms\nend", "title": "" }, { "docid": "023046e3e41cd8eecd3b604faadfa28b", "score": "0.55554897", "text": "def initialize\n @rooms = list_rooms\n @reservations = []\n end", "title": "" }, { "docid": "5360641b1365ccfddbdb3233ee9f0eef", "score": "0.5539429", "text": "def available_rooms\n @booking = current_user.bookings.new(booking_params)\n @hotel_rooms = @hotel_category.hotel_rooms.available_rooms(params[:booking][:check_in], params[:booking][:check_out])\n end", "title": "" }, { "docid": "0b79f54ec3f002844f3897e694689666", "score": "0.5536216", "text": "def open_slots(date)\n time = date.to_time\n \n slots = []\n prev_time = time - 30.minutes\n loop do\n start_time = prev_time + 30.minutes\n \n if start_time.to_date == date\n slots << Slot.new(starts_at: start_time, cat: self)\n prev_time = start_time\n else\n break\n end\n end\n \n # Remove taken/past timeframes\n slots.reject do |slot|\n Reservation.exists?(cat: self, starts_at: slot.starts_at) || slot.starts_at.past?\n end\n end", "title": "" }, { "docid": "45bc0c0efdf33d7acc1fc132b1e9f5cc", "score": "0.5528104", "text": "def missing_ranges()\n return [] if @time_map.nil?\n @time_map.missing_ranges()\n end", "title": "" }, { "docid": "09660bc0103f785d1961f40b3145257f", "score": "0.55208254", "text": "def range\n (start_date...end_date) #exclusive date range\n end", "title": "" }, { "docid": "645837f1eb1bb9fd42a851a30704ab00", "score": "0.5509863", "text": "def nights_booked\n nights_occupied = []\n counter = 0\n @num_nights.times do\n nights_occupied << (@start_date + counter)\n counter += 1\n end\n return nights_occupied\n end", "title": "" }, { "docid": "605283a8e4cf2eb145c2593912134824", "score": "0.5505803", "text": "def check_overlapping_dates\n # compare this new reservation againsts existing reservations\n if start_date.present? and end_date.present?\n listing.reservations.each do |old_reservation|\n if overlap?(self, old_reservation)\n return errors.add(:The_dates_are_not_available, \"\")\n end\n end\n end\n end", "title": "" }, { "docid": "aa8201ada25af545760124cd0db1eb7b", "score": "0.54931647", "text": "def show_vendor_availability\n start_time = params[:start_time]\n end_time = params[:end_time]\n meetings = VendorCalendarUnavailability.where(vendor_id: @current_user.id).where(\"((end_time > ?) OR (end_time < ?)) AND ((start_time > ?) OR (start_time < ?))\", start_time, end_time, start_time, end_time)\n render json: { unavailable_times: meetings }, status: 200\n end", "title": "" }, { "docid": "1b08b4f60415a10b18eec60ced0acf8a", "score": "0.54568917", "text": "def out_of_bounds?(date)\n date < @available_date_range[:min] || date > @available_date_range[:max]\n end", "title": "" }, { "docid": "785e78b80489b83a2bcec4e1e029ff9d", "score": "0.54423976", "text": "def conflicts\n if new_record?\n query = 'unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, unit_id, start_at, end_at)\n else\n query = 'id <> ? AND unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, id, unit_id, start_at, end_at)\n end\n end", "title": "" }, { "docid": "305a7138b3b545f0e732232b3f78f741", "score": "0.5437681", "text": "def no_other_reservations_on_this_time_period\n item_reservations.each do |ir|\n item = ir.item\n amount_available = item.get_availability(pick_up_time.to_datetime, return_time.to_datetime, id)\n if ir.amount > amount_available\n if amount_available > 0\n errors.add(:items, errors.generate_message(:items, :too_few_available, { :item_title => item.title, :count => amount_available.to_s }))\n else\n errors.add(:items, errors.generate_message(:items, :none_available, { :item_title => item.title }))\n end \n end\n end \n end", "title": "" }, { "docid": "a5bcda4556afa746dea7ea2cef83d25c", "score": "0.54270536", "text": "def new_reservation(room, checkin_date, checkout_date)\n (checkin_date...checkout_date).each do |day|\n if !room.is_available?(day)\n raise ArgumentError.new(\"Room#{room.room_num} is not available\")\n end\n end\n reservation = BookingSystem::Reservation.new(room: room, checkin_date: checkin_date, checkout_date: checkout_date)\n add_reservation(reservation)\n room.add_reservation(reservation)\n end", "title": "" }, { "docid": "1cc3329cad88bf4632f1771906a9ef09", "score": "0.5418749", "text": "def unscheduled_maintenances(start_time, end_time)\n unsched_maintenances = @check.unscheduled_maintenances_by_start.\n intersect_range(start_time, end_time, :by_score => true).all\n\n # to see if we start in an unscheduled maintenance period, we must check all unscheduled\n # maintenances before the period and their durations\n start_in_unsched = start_time.nil? ? [] :\n @check.unscheduled_maintenances_by_start.\n intersect_range(nil, start_time, :by_score => true).all.select {|pu|\n pu.end_time >= start_time\n }\n\n {:unscheduled_maintenances => (start_in_unsched + unsched_maintenances)}\n end", "title": "" }, { "docid": "54751dacbc99c7221e0809281c5471e2", "score": "0.5413421", "text": "def get_negatives(rooms,user)\n preferences = sorted_preferences(user)\n final_negative_responses = Array.new\n rooms.each do |room|\n results = Array.new\n results = get_room_over_under(room,preferences)\n\n #push first negative result for each room\n count = 0\n results.each do |result|\n if count == 0\n if result[2].to_i < 0\n final_negative_responses.push(result[1])\n count = 1\n end\n end\n end\n end\n return final_negative_responses\n end", "title": "" }, { "docid": "6cb92ecfe7df2db45303a128543a1c3d", "score": "0.54072297", "text": "def available_dateinfo(property, checkin, checkout)\n # First get all the information about a property in a date range\n dateinfo = $dates.select {|date|\n date.property_id == property.property_id &&\n date.date === checkin.upto(checkout-1) {}\n }\n \n # Its less painful to miss an available booking than be denied at the door\n if dateinfo.length == 0 then return nil end\n\n # Check if any dates in that range are unavailable\n dateinfo.each do |date|\n if date.available == 0 then return nil end\n end\nend", "title": "" } ]
e948f6aea3efdbf8909988ccb463a134
Creates the album path
[ { "docid": "fb1fe73973733ed419e2e4f59735ace9", "score": "0.7776218", "text": "def create_album_path(url)\r\n\t\t\t\t@album_path = url.split('/').last.gsub!(/-|mp3|songs|.html/,\"\").strip\r\n\t\t\t\tDir.mkdir @album_path unless File.exists?(@album_path)\r\n\t\t\tend", "title": "" } ]
[ { "docid": "5c2767973df48e3102bfd4da85e24b89", "score": "0.7126422", "text": "def save! target=\"./Albums\"\n dirname = File.join target, @name\n FileUtils.mkdir_p dirname\n\n self.photos{|p| p.save! dirname}\n end", "title": "" }, { "docid": "80ff8875f851494989bbb1f4d37524ac", "score": "0.6843923", "text": "def create\n @album = Album.new(params[:album])\n\n album_path = ALBUMS_ROOT + @album.name\n FileUtils.mkdir_p(album_path)\n\n FileUtils.mkdir_p(album_path + \"/pictures\")\n FileUtils.mkdir_p(album_path + \"/thumbnail\")\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to(@album, :notice => 'Album was successfully created.') }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "daeb8537eba5de7a57ec765804f1e226", "score": "0.67452514", "text": "def store_dir\n \"files/#{model.album.path}\"\n end", "title": "" }, { "docid": "cd5b479d576dad2918b4015058e16769", "score": "0.6700591", "text": "def get_or_create_album(path, album_url: nil)\n folder_path = File.dirname(path).split('/').map(&:capitalize).join('/')\n album_name = File.basename(path).split(' ').map(&:capitalize).join(' ')\n album = nil\n\n folder = get_or_create_folder(folder_path)\n resp = get(folder[:albums_url])\n albums = get(folder[:albums_url])['Album'] if resp.key? 'Album'\n albums ||= []\n albums.each do |album_raw|\n next unless album_raw['Name'] == album_name\n album = album_parser(album_raw)\n end\n\n if album.nil?\n url = \"/api/v2/folder/user/#{@user}\"\n url += \"/#{folder_path}\" unless folder_path.empty?\n url += '!albums'\n album_url = album_name if album_url.nil?\n resp = post(url, Name: album_name,\n UrlName: album_url.tr(' ', '-').capitalize,\n Privacy: 'Unlisted',\n SmugSearchable: 'No',\n SortMethod: 'Date Taken',\n LargestSize: 'X4Large',\n SortDirection: 'Ascending',\n WorldSearchable: false,\n EXIF: false,\n Printable: false,\n Filenames: true)\n album_raw = resp['Album']\n album = album_parser(album_raw)\n end\n album\n end", "title": "" }, { "docid": "425d0774a3a4fcf521b22ce68b37d632", "score": "0.6562526", "text": "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n #Dir.chdir(\"public/images\")\n Dir.mkdir(@album['directory'])\n flash[:notice] = 'Album was successfully created.'\n #flash[:notice] = Dir.pwd\n format.html { redirect_to @album }\n #format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action = \"new\" }\n #format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "281459c7a5238f978cff770f45c01f3d", "score": "0.63780844", "text": "def create\n @album = Album.new(params[:album]) \n @album.user_id = @current_user.id \n respond_to do |format| \n if @album.save \n dir_path = \"#{RAILS_ROOT}/public/uploads/#{@current_user.login}/#{@album.id}\" \n if Dir[dir_path].size == 0\n Dir.mkdir(dir_path)\n end\n format.html { redirect_to(@album, :notice => 'Альбом создан') }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "275bbff896ae38107281426715fad89d", "score": "0.63489145", "text": "def create_photo(album_id, photo_id, file, filename)\n \n end", "title": "" }, { "docid": "a5fc5fb70b0f5f6855424b60e7b105ea", "score": "0.62828773", "text": "def album(albid)\n if File.exists?(path = _(albid))\n {:albid => albid, :name => albid, :path => cut_path(path)}\n else\n raise Error, \"No such album #{albid}\"\n end\n end", "title": "" }, { "docid": "f39ee5a6cfabb560373ee60022ade224", "score": "0.6271853", "text": "def create_album(person_id, caption, location='', privacy='Everyone')\n @restv9.create_albumv9(person_id, caption, location, privacy)\n end", "title": "" }, { "docid": "10fd41a75680bf7d788cf42523b8d3da", "score": "0.6246167", "text": "def createalbum\n \tredirect_to(\"/photo/createAlbumPage\")\n end", "title": "" }, { "docid": "b1da71864a14f7a9e962e541c025eb45", "score": "0.61971056", "text": "def album!(options = {})\n user.album!(options)\n end", "title": "" }, { "docid": "b1da71864a14f7a9e962e541c025eb45", "score": "0.61971056", "text": "def album!(options = {})\n user.album!(options)\n end", "title": "" }, { "docid": "88cb508a1a9836ec1e93874978b388c0", "score": "0.6129286", "text": "def create\n @album = current_user.albums.build(params[:album])\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n redirect_to(album_pictures_path(@album))\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "aeed937654796cadbf61a4aa233b4fd9", "score": "0.6098857", "text": "def image_path\n photo = album_cover ? album_cover.photo : photos.first\n if photo\n return \"/album/#{id}/photo/#{photo.id}\"\n else\n return nil\n end\n end", "title": "" }, { "docid": "e5c7a4c9cbb021119b796610c22bdf57", "score": "0.59923166", "text": "def album\r\n #prepare_new_album extracted for reuse from spec\r\n prepare_new_album unless @content\r\n end", "title": "" }, { "docid": "1fbbd7825a9219805295160ec1bbd421", "score": "0.5988669", "text": "def album!(options = {})\n response = user.photos.createAlbum(:title => options[:name], :description => options[:message])\n Album.new(response, user)\n end", "title": "" }, { "docid": "1fbbd7825a9219805295160ec1bbd421", "score": "0.5988669", "text": "def album!(options = {})\n response = user.photos.createAlbum(:title => options[:name], :description => options[:message])\n Album.new(response, user)\n end", "title": "" }, { "docid": "645b306ba9151a9241cfbd7a095394cf", "score": "0.5948466", "text": "def store_dir\n \"photos/#{model.id}/\"\n end", "title": "" }, { "docid": "0cf69288a927d7309bce74ea1274ec92", "score": "0.59349394", "text": "def create_path path\n if path.include? 'public' # path is absolute\n FileUtils.mkdir_p(\"#{path}\")\n else # path is relative\n FileUtils.mkdir_p(\"#{PUBLIC_IMAGES_ROOT}/#{path}\")\n end\n end", "title": "" }, { "docid": "15c927e39c05bacec088eadfcfca3bbd", "score": "0.59035337", "text": "def create\n location.mkdir\n end", "title": "" }, { "docid": "2e66d875e39b2f245db45d4ffe4be125", "score": "0.5901671", "text": "def new_album(set_albumName, params = {})\n params = { :cmd => 'new-album', :set_albumName => set_albumName }.merge(params)\n send_request(params)\n end", "title": "" }, { "docid": "c7716fc8196a6525add8f81bb0f1a6be", "score": "0.5892722", "text": "def create\r\n @album = Album.new(params[:album])\r\n if (params[:album][:coverpage])\r\n tem_coverPage = upload_file(@album.coverpage,\"app/assets/images/album_images\")\r\n @album.coverpage = \"album_images/\"+tem_coverPage\r\n else\r\n @album.coverpage = \"album_images/album_default.jpg\"\r\n end\r\n @album.owner = session[:user_id]\r\n respond_to do |format|\r\n if @album.save\r\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\r\n format.json { render json: @album, status: :created, location: @album }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @album.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "db1f78edcb6f17a7681322ad35246c31", "score": "0.5877568", "text": "def normalize_album(albid)\n require 'fileutils'\n FileUtils.mkdir_p(_(albid, 'thumbs'))\n FileUtils.mkdir_p(_(albid, 'trash'))\n all_images(albid).each{|tuple|\n source, target = _(tuple[:path]), _(tuple[:thumb])\n unless File.exists?(target)\n IMagick.create_thumbnail(source, target)\n end\n }\n end", "title": "" }, { "docid": "95378607f03b99444bd62a447fb7cc11", "score": "0.5853738", "text": "def google_create_folder(client)\n path = CGI::unescape(@fields[:path].to_s)\n result = client.create_folder_by_path(path)\n end", "title": "" }, { "docid": "4edafb618062466907cc28042167ae21", "score": "0.5853321", "text": "def store_dir\n \"photos\"\n end", "title": "" }, { "docid": "f92f6ff1dc514c1d1f755f1737cd6a9d", "score": "0.5849468", "text": "def get_metadata_file album\n Albatross::ThrowIf.is_nil? album, \"album\"\n \"storage/dropbox/#{album}.yml\"\nend", "title": "" }, { "docid": "272b7d6d0db20174e88d5fea1a996a83", "score": "0.58440894", "text": "def generate_name\n self.name = \"#{album.name}-#{self.image_file_file_name}\"\n end", "title": "" }, { "docid": "0f961deb0192fd58796462558aa3574e", "score": "0.5841839", "text": "def mkpath path\n end", "title": "" }, { "docid": "45b40dabdbdf03ee15c2a7ef3eca2a09", "score": "0.5800695", "text": "def create\n @album = current_user.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'You created a #Album. Now share your #album around the internets' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "869837ca6d9a1d2b1de8e58db6a27d32", "score": "0.57906055", "text": "def create\n \t@album = Album.find(params[:album_id])\n \t@photo = @album.photos.create!(params[:photo])\n \tredirect_to @album, :notice => 'Photo created'\n end", "title": "" }, { "docid": "594a8af580a2001cb5224c0fc851ec6f", "score": "0.57899594", "text": "def create\n @album = current_user.albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42d95b62c13380bc600a9b824f80ced3", "score": "0.578062", "text": "def create\n @album = current_account.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n flash[:notice] = 'album was successfully created.'\n format.html { redirect_to( :action => 'edit', :id => @album.id) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4edea982d9745cc4b61771784200be2e", "score": "0.5758735", "text": "def album\n alb = super\n if alb.nil?\n alb = Album.new\n alb.title = \"Unknown Album\"\n end\n alb\n end", "title": "" }, { "docid": "3a815401a617eab7e6e07731aa7d1120", "score": "0.5747846", "text": "def store_dir\n \"photo/#{model.id}\"\n end", "title": "" }, { "docid": "3a2c096ac0a9bd2b7ea5ef6650705312", "score": "0.57438904", "text": "def create\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n respond_to do |format|\n if @album.save\n if @album.user.locations.any?\n add_location_to_user_albums(@album.user.locations.where(status: 'current').first) if @album.user.locations.where(status: 'current').any?\n end\n create_activity(@album.class.name, @album.id, 'create')\n format.html { \n if album_params.has_key?(:cover)\n render 'crop' \n else \n redirect_to @album, notice: 'Portfolio was successfully created.' \n end \n }\n format.json { render action: 'show', status: :created, location: @album } \n \n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b02be3b02d4970d1d497ea2d38bfb37a", "score": "0.5739998", "text": "def image_fs_path(issue, basename)\n debugger\n dir_path = Rails.root.join('public', \"photos/#{@issue.date.strftime('%m-%d-%y')}\")\n if not File.exists?(dir_path)\n FileUtils.mkdir_p(dir_path)\n end\n \"#{dir_path}/#{basename}\"\nend", "title": "" }, { "docid": "abff73cefecca83234141c12c6a2e749", "score": "0.57309955", "text": "def mkpath\n @path.mkpath\n end", "title": "" }, { "docid": "015409109931f9cbf7f7768490c1322a", "score": "0.5726556", "text": "def album(value)\n @ole.Album = value\n nil\n end", "title": "" }, { "docid": "ab19d2d7b89cd62263415c59808217b0", "score": "0.5714717", "text": "def art_file\n \"#{Digest::SHA1.hexdigest(\"#{artist_name}/#{album_name}\")}.png\"\n end", "title": "" }, { "docid": "27344ece2f7858ac0ce3896821f95f00", "score": "0.5711698", "text": "def create\n @album = current_user.albums.build(album_params)\n \n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "ac771b68d690be61010ee7977db7f3b0", "score": "0.5667687", "text": "def create\n\t\tAlbum.create({\n\t\t\tname: params[:name]\n\t\t\t})\n\t\tredirect_to albums_path\n\tend", "title": "" }, { "docid": "1fbc0d3abea8f27d7e7ef40eedef6544", "score": "0.56262666", "text": "def create\n FileUtils.mkdir_p path\n end", "title": "" }, { "docid": "d9c5e9f07ea4c10f7dfca15d4aeb1835", "score": "0.56255287", "text": "def dir\n \"/photos\"\n end", "title": "" }, { "docid": "a414edb87b122289a686a9af4e2462b2", "score": "0.56251633", "text": "def create\n respond_to do |format|\n @album.user = current_user\n if @album.save\n format.html { redirect_to artist_album_path(@artist,@album), notice: 'album was successfully created.' }\n format.json { render action: 'show', status: :created, location: artist_album_path(@artist,@album) }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4696624b19cd04032551cc7db6db40fb", "score": "0.562172", "text": "def album!(options = {})\n raise NotImplementedError(\"Subclasses should implement this!\")\n end", "title": "" }, { "docid": "d5888dc30d6ef54cf046c70c66bfa65d", "score": "0.5615282", "text": "def photo_path\n \t\"/photo_store/#{id}.#{extension}\"\n end", "title": "" }, { "docid": "fd6273784a86379105c1372ae136bbb0", "score": "0.5608665", "text": "def create\n @album = current_user.albums.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'El album a sido creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01e08e29a81c5e6bb82feab7dc169dc5", "score": "0.56029266", "text": "def create_paths\n @storage_folders_path = File.join(@storage_path, \"folders\") # Not need date because we use rsync\n FileUtils.mkdir_p @storage_folders_path\n\n today = Time.now\n @storage_databases_path = File.join(@storage_path, \"databases\", today.year.to_s, today.month.to_s, today.day.to_s)\n FileUtils.mkdir_p @storage_databases_path\n end", "title": "" }, { "docid": "155eb716d7f0c5bfd317382d5e2df3a1", "score": "0.55987114", "text": "def create_uri\n end", "title": "" }, { "docid": "71cf1f6dd77eb98458ff83d85ebb4665", "score": "0.55941284", "text": "def photo_path\n \"/photo_store/#{id}.#{extension}\"\n end", "title": "" }, { "docid": "da2543adfcffeb4f785b6227d8925e65", "score": "0.55927306", "text": "def create\r\n @album = Album.new(:account_id => session[:account_id])\r\n \r\n @album.name = params[:album_name]\r\n @album.description = params[:album_description]\r\n if @album.save\r\n return jump_to(\"/albums/#{@album.id}/upload\")\r\n else\r\n flash.now[:error_msg] = \"操作失败, 再试一次吧\"\r\n end\r\n \r\n render(:action => \"new\")\r\n end", "title": "" }, { "docid": "e6d54c6cccb1e6ffec524c29a03bd227", "score": "0.557688", "text": "def create\n @album = Album.new(album_params)\n @album.owner = @current_owner\n @album.owner_id = @current_owner.id\n if @album.creation_date.blank?\n @album.creation_date=Date.current#new(year: Time.now.year,day: Time.now.day,month: Time.now.month)\n end\n @album.cover=nil\n if @album.save\n redirect_to @album, notice: 'Альбом успешно создан.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "54472be8e00929de6abd62b5d7a2122a", "score": "0.5566717", "text": "def album\n Spotify::SDK::Album.new(super, parent)\n end", "title": "" }, { "docid": "7b4f2a03b869ec789a583cac60a99650", "score": "0.55403304", "text": "def create\n @album = Album.new(params[:album])\n respond_to do |format|\n if @user.albums << @album\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to user_albums_path(@user) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0575b031987ddafac27053a0cd6c89fe", "score": "0.5538091", "text": "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4c2d95c9b7ab4a491e675ee3a7381fa", "score": "0.5525305", "text": "def create\n \n @album = Album.new(params[:album])\n \n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81c57aac0e4ad4f79f8c920b6240c1d9", "score": "0.55235374", "text": "def create\n @band = Band.find(params[:band_id])\n @album = Band.find(params[:band_id]).albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to new_band_album_song_path(@album.band.id, @album.id), notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4073cca52ee9696d81168f52881f32f9", "score": "0.55221564", "text": "def path\n folder.path + name\n end", "title": "" }, { "docid": "d54bcb853345360a422128106a551a35", "score": "0.5520241", "text": "def create\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n after_create()\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c87c46d5acdbeb1309b67f05976b372a", "score": "0.5512387", "text": "def mkpath\n FileUtils.mkpath( expand_tilde )\n end", "title": "" }, { "docid": "76653c7292744aa4b5e9a2e7fe055013", "score": "0.5510957", "text": "def set_album\n if token = album_token\n @album = Album.find_or_create_by(token: token)\n else\n @album = Album.find_by(uuid: params[:id])\n end\n end", "title": "" }, { "docid": "2da258a9a88a33a2ed736b53abe5a458", "score": "0.55107874", "text": "def photo_path\n\"/photo_store/#{id}.#{extension}\"\nend", "title": "" }, { "docid": "ec32a2245a1a971204dde0d7113f4265", "score": "0.551023", "text": "def full_path\n if path[0] == '/'\n path\n else\n File.join(Play.music_path,path)\n end\n end", "title": "" }, { "docid": "e9f7d45125e4f39c6807a919961a6255", "score": "0.5506227", "text": "def store_dir\n \"uploads/photos\"\n end", "title": "" }, { "docid": "c474dce0d606b43c8efa5402662b0d2e", "score": "0.5485833", "text": "def create\n @album = Album.new(album_params)\n if @album.save\n redirect_to albums_path\n else \n render 'new'\n end\n end", "title": "" }, { "docid": "357eed1ba9af80c03dd6788c9647a4e2", "score": "0.5481604", "text": "def create_album(name, description=nil)\n body = {}\n body['name'] = name\n body['description'] = description\n post(\"/albums\", body: body, code: 201 )\n end", "title": "" }, { "docid": "e62fd5db2745181646387f2612bf83a9", "score": "0.5479211", "text": "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e62fd5db2745181646387f2612bf83a9", "score": "0.5479211", "text": "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e62fd5db2745181646387f2612bf83a9", "score": "0.5479211", "text": "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14adf2cb9eeab823cf0ee55b4ed84703", "score": "0.5476825", "text": "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to group_url(@album.group), notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "040b61be48cfb905d58ab4988cfc3a3a", "score": "0.5463772", "text": "def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend", "title": "" }, { "docid": "a734ff744a594bab251145f0add2e754", "score": "0.54636467", "text": "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "title": "" }, { "docid": "437afe6a57f4dbf8c55e22421e8fb0b6", "score": "0.54546404", "text": "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "437afe6a57f4dbf8c55e22421e8fb0b6", "score": "0.54546404", "text": "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a6281287e9b4efcbe1b2d1a4c7eaa8e", "score": "0.5454362", "text": "def create\n file = upload_params;\n file[:album_id]=params[:photo][:album_id];\n @photo = Photo.create(file)\n\n end", "title": "" }, { "docid": "49ff48f49b616b90e766ab2cb5f1efd6", "score": "0.54503036", "text": "def photo_path\n \"/photo_store/people/#{id}.#{extension}\"\n end", "title": "" }, { "docid": "f7478e0ed6c05a705d13948d09e51017", "score": "0.5445936", "text": "def create \n \n respond_to do |format|\n @photo_album = current_user.photo_albums.build(params[:photo_album])\n if @photo_album.save\n flash[:notice] = 'Новый альбом создан.'\n format.html {\n # if current_user.photo_albums.size > 1\n # redirect_to(@photo_album)\n # else\n redirect_to(new_photo_path)\n # end\n }\n format.xml { render :xml => @photo_album, :status => :created, :location => @photo_album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbb48b77beef3a067c8db2eac3a6dc4a", "score": "0.5445267", "text": "def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend", "title": "" }, { "docid": "248830df1cec5134350e60988abc5652", "score": "0.5443818", "text": "def draw_albums(albums)\n i = 0\n x1 = 50\n y1 = 100\n x2 = 250\n y2 = 300\n while i < albums.length\n if i == 1\n x1 += 220\n x2 += 220\n elsif i == 2\n x1 = 50\n x2 = 250\n y1 += 220\n y2 += 220\n elsif i==3\n x1+=220\n x2+=220\n end \n albums[i].artfile.bmp.draw_as_quad(x1, y1, @image_color, x2, y1, @image_color, x1, y2, @image_color, x2, y2, @image_color,ZOrder::UI)\n i+=1\n end\n end", "title": "" }, { "docid": "808b0b0f17dae1b8d58e82424e064a39", "score": "0.54370904", "text": "def create(object)\n if(object.is_a? Collection)\n uri = @uri.merge(object.url)\n self.mkdir(uri)\n self.proppatch(uri, object.properties)\n return uri.to_s\n end\n end", "title": "" }, { "docid": "7a31d461f25b026ab28e38c5d2e68126", "score": "0.5435792", "text": "def create\n new_album = Album.new\n new_album.title = params[:title]\n new_album.artist = params[:artist]\n new_album.year = params[:year]\n new_album.album_art = params[:album_art]\n new_album.save\n end", "title": "" }, { "docid": "abbf8122c4d8e009c69e95d2262ebe1a", "score": "0.5431418", "text": "def create_media_path(path, type)\n folders = path.split('/')[1..-2]\n\n str = mediaize_path('', type) + '.'\n\n folders.each do |f|\n str = str + '/' + f\n\n unless $r.exists(str + '/')\n EzPub::MediaFolder.store(str + '/')\n end\n end\n end", "title": "" }, { "docid": "be6175dfab50b70f5d26ada6d56946a4", "score": "0.54295224", "text": "def create\n @photoalbum = Photoalbum.new(params[:photoalbum])\n\n respond_to { |format|\n if @photoalbum.save\n\tflash[:notice] = \"New photoalbum! It's parent is <em>\" +\n\t Photoalbum.find(session[:pa_parent]).name + \"</em>.\"\n\n\t# Go to index.\n\tformat.html { redirect_to photoalbums_url }\n\tformat.xml { head :created, :location => photoalbum_url(@photoalbum) }\n else\n\tformat.html { render :action => 'new' }\n\tformat.xml { render :xml => @photoalbum.errors.to_xml }\n end\n }\n end", "title": "" }, { "docid": "b6a2eb85a5f21cc34400cbc2b5058bd3", "score": "0.542826", "text": "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86dc83182c02751d88ba8172e32a2f4d", "score": "0.54260755", "text": "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba5cabccd5cde3d5d5aa2c019d8ce3c3", "score": "0.5423392", "text": "def create\n @album = Album.new(allowed_params_album)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01788155dca7fc4532e819df39420d69", "score": "0.5422722", "text": "def create\n @photo = Photo.new(params[:photo])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c6f24ca3719f1d05c333a2f718b12e8", "score": "0.5412807", "text": "def albums\n Dir[_(\"*\")].collect do |alb| \n album(File.basename(alb))\n end\n end", "title": "" }, { "docid": "e79c8fff9d624d1b14ff75703ea2e610", "score": "0.5403318", "text": "def path!(id)\n path = path(id)\n FileUtils.mkdir_p(path.dirname, mode: directory_permissions)\n path\n end", "title": "" }, { "docid": "1945904c12e50fec15c476d41e95c25e", "score": "0.53986865", "text": "def path\n \"#{RAILS_ROOT}/photos/#{self.visit.user_id}/#{self.visit_id}\"\n \n# \"#{RAILS_ROOT}/public/images/#{self.class.to_s.underscore.pluralize}\"\n end", "title": "" }, { "docid": "7a652424270801151ef5ce45d87cebfa", "score": "0.539423", "text": "def resource\n\t\t@album\n\tend", "title": "" }, { "docid": "fdb0fac2ef42b47395001621b204b347", "score": "0.53903985", "text": "def create\n \n @album = @user.albums.new(params[:album])\n \n if @album.save\n flash[:notice] = 'User was successfully created.'\n if params[:album][:avatar].blank?\n redirect_to @album\n else\n \n render :action => 'cropping'\n end\n else\n render :action => 'new'\n end\n end", "title": "" }, { "docid": "229f58a73f758050e4faf3db43287199", "score": "0.538471", "text": "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: \"Album was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb287b13d578268675b586c060764072", "score": "0.5380959", "text": "def graph_full_path(graph_filename)\n path = Rails.root.join('public', graph_relative_path)\n # path = Rails.root.join('app', 'assets', 'images', graph_relative_path)\n FileUtils.mkdir_p path\n File.join(path, graph_filename)\n end", "title": "" }, { "docid": "3ea0965d00a8a107f9932fff7f0dda78", "score": "0.53699285", "text": "def full_path(settings)\n return File.join( settings.music_dir_path , self.path )\n end", "title": "" }, { "docid": "d401e3eb58825f17dd9be6feeb096ff3", "score": "0.5367912", "text": "def create\n @song = Song.new(song_params)\n\n respond_to do |format|\n if @song.save\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd98e5ab7b674876341d25717b546b52", "score": "0.5364662", "text": "def path\n prefix.push(identifier, region.to_s, size.to_s, rotation.to_s, resource)\n .join('/').prepend '/'\n end", "title": "" }, { "docid": "77e1fbeb0df84de0a86365082010e7e7", "score": "0.5352081", "text": "def folder_create(command)\n pp @client.files.folder_create(clean_up(command[1]))\n end", "title": "" }, { "docid": "9f869b392ed59a48b5d4385444986c72", "score": "0.5350978", "text": "def generates_path\n return File.join(\"./medias\", self.created_at.year.to_s,\n self.created_at.month.to_s, self.file_name)\n end", "title": "" }, { "docid": "40fc54254ea76a747b906604f2a2d580", "score": "0.53501064", "text": "def path\n File.expand_path File.join(songs.first.path, '..').gsub(' ','\\ ')\n end", "title": "" } ]
f1d00012e839fb0572f9f892b37c1e74
Read an unsigned 64bit (8byte) integer.
[ { "docid": "3739a0824cba5defb324a38ee605b964", "score": "0.8534804", "text": "def read_uint64_be\n reader.read(8).unpack(\"Q>\").first\n end", "title": "" } ]
[ { "docid": "80fe116697c0f9ad63e353f69b036713", "score": "0.86962515", "text": "def read_uint64\n reader.read(8).unpack(\"Q<\").first\n end", "title": "" }, { "docid": "bc613a18a7721b5ea77387a8d8bef835", "score": "0.85433495", "text": "def read_uint64\n read_varint\n end", "title": "" }, { "docid": "4919311d5f47ec5ee5527c9897ece17b", "score": "0.83672565", "text": "def uint64; BinData::Uint64le.read(scan(8)); end", "title": "" }, { "docid": "3eebf0ad21a6cb66b1c11d026b158dfa", "score": "0.83404076", "text": "def get_uint64(offset=nil)\n seek(offset)\n data = read_and_advance(8)\n BinData::Uint64be.read(data)\n end", "title": "" }, { "docid": "25a3454aee31f7b9c0dc7e376cfc552c", "score": "0.82567316", "text": "def read_int64\n value = read_varint\n value -= (1 << 64) if value > Integer::MAX_SIGNED_64BIT\n value\n end", "title": "" }, { "docid": "7668b5898b4a4be3adfd2e974bd37e9c", "score": "0.80887824", "text": "def readU64; io.read(SIZE_64).unpack('Q'); end", "title": "" }, { "docid": "ae81ddc6d21a9876c99fd33ac04dd6b7", "score": "0.7891252", "text": "def read_int64\n hi = read_long\n lo = read_long\n return ( hi << 32 ) + lo\n end", "title": "" }, { "docid": "4984332d630d1ad2ea6cf4ba1b5c0126", "score": "0.7873516", "text": "def read_int64\n hi = read_long or return nil\n lo = read_long or return nil\n return (hi << 32) + lo\n end", "title": "" }, { "docid": "64c770725dff9b92e5250cbec3728a8f", "score": "0.7724741", "text": "def readI64; io.read(SIZE_64).unpack('q'); end", "title": "" }, { "docid": "1347c593b507794679e9bc45eff8cf22", "score": "0.76644385", "text": "def int64\n read(8).unpack(\"q>\").first\n end", "title": "" }, { "docid": "9d18960dbcfa50be9951c32f7a06597b", "score": "0.762889", "text": "def uint64\n @content.unpack('Q>')[0]\n end", "title": "" }, { "docid": "59e8e889ab7a528c1963bff151e8afbd", "score": "0.7538552", "text": "def get_i_sint64\n data = read_and_advance(8)\n BinData::Int64be.read(data) ^ (-1 << 63)\n end", "title": "" }, { "docid": "fcadc98f65d63a2a42bd874b8e810f5c", "score": "0.73311424", "text": "def uint8ToUint64(bytes)\n bytes.unpack('Q*')[0]\n end", "title": "" }, { "docid": "271919711a68ec3960ac8db3de90f0c7", "score": "0.7294217", "text": "def read_int64(signed=true)\n primitive_read_long_long(signed)\n end", "title": "" }, { "docid": "e2acca9a727919a2b10d98a9014903af", "score": "0.7208299", "text": "def read_fixed64\n values = read(8).unpack(\"VV\")\n values[0] + (values[1] << 32)\n end", "title": "" }, { "docid": "5ffff10c2e69a29fbe42bf22f5f86088", "score": "0.7206234", "text": "def read_sint64\n un_zig_zag(read_varint)\n end", "title": "" }, { "docid": "afe0d7cc9602d807632bf0fa20cc6b20", "score": "0.72050244", "text": "def read_long\r\n l = (read_int & 0xffffffff).long\r\n l1 = (read_int & 0xffffffff).long\r\n return ((l << 32) + l1).long\r\n end", "title": "" }, { "docid": "a34c7aea6843ef1f95cb50f14b4f9894", "score": "0.68844724", "text": "def read_uint32\n read_varint\n end", "title": "" }, { "docid": "be808f8a0f2da71cb6bc6225cd7c41bc", "score": "0.68749636", "text": "def read_long\n b = read(4) or return nil\n b.unpack(\"N\").first\n end", "title": "" }, { "docid": "b7fc94218bba2f6e164a0882e15f7efa", "score": "0.68571985", "text": "def readU32; io.read(SIZE_32).unpack('L'); end", "title": "" }, { "docid": "bfd75a1946975f9a89224f960ca7e968", "score": "0.684627", "text": "def int64\n @content.unpack('q>')[0]\n end", "title": "" }, { "docid": "399fd77c4c55e1fa44237125cca7e8a2", "score": "0.68456215", "text": "def unpack_uint64(str)\n [str.unpack('Q').first, str[8..-1]]\n end", "title": "" }, { "docid": "398bb30bcee3b3de5b73f2ee61a2bc9c", "score": "0.6843635", "text": "def read_long\n read_num 8\n end", "title": "" }, { "docid": "08ef192050a44e407571c40f0119d2d9", "score": "0.68373984", "text": "def get_uint64(name)\n ptr = FFI::MemoryPointer.new :uint64\n mallctl name, ptr, size_pointer(ptr), nil, 0\n ptr.read_uint64\n end", "title": "" }, { "docid": "cefc4293e33513365c9fac5df997dc68", "score": "0.675399", "text": "def read_long\n b = read( 4 ) or return nil\n b.unpack( \"N\" ).first\n end", "title": "" }, { "docid": "02acce86b861590b52d9d74a1589a206", "score": "0.6693264", "text": "def read_uint32_be\n reader.read(4).unpack(\"N\").first\n end", "title": "" }, { "docid": "30a6cf2ba650012ee5380b5f9115ca77", "score": "0.66787595", "text": "def signed_long\n read(4).unpack('l')[0]\n end", "title": "" }, { "docid": "1f92deeb644588e871a216de6c47fc60", "score": "0.6672652", "text": "def read_uint32_be\n read_safe(4).unpack('N')[0]\n end", "title": "" }, { "docid": "67ddabfacf9e7afd6efd1d413fd1a0de", "score": "0.6671715", "text": "def to_uint64_a(val)\n to_uint_fixed_a(val, 8)\n end", "title": "" }, { "docid": "39c1ccaac607e63fe3079f95cd89f457", "score": "0.6612808", "text": "def read_uint40_be\n a, b = reader.read(5).unpack(\"NC\")\n (a << 8) + b\n end", "title": "" }, { "docid": "ada39b11597c098c4b7e0078471c1662", "score": "0.6583738", "text": "def uint32; BinData::Uint32le.read(scan(4)); end", "title": "" }, { "docid": "79cd18f597eb3a5bb2f0774f6a12a74a", "score": "0.6579487", "text": "def read_uint48\n a, b, c = reader.read(6).unpack(\"vvv\")\n a + (b << 16) + (c << 32)\n end", "title": "" }, { "docid": "92a9094b67f3717e40c5b2d1c2f75d30", "score": "0.65705824", "text": "def read_uint32_le\n read_safe(4).unpack('V')[0]\n end", "title": "" }, { "docid": "f3b836fc7810744709300da8786e5989", "score": "0.65161246", "text": "def readI32; io.read(SIZE_32).unpack('l'); end", "title": "" }, { "docid": "a1697cf1be998264309e3ba340affff9", "score": "0.65084666", "text": "def long\n read(4).unpack('V')[0]\n end", "title": "" }, { "docid": "44d087fd14dafd007df243c7eac61bb1", "score": "0.6474927", "text": "def read_uint32\n reader.read(4).unpack(\"V\").first\n end", "title": "" }, { "docid": "72fa703f1d5515a839ed644e68c86316", "score": "0.6470769", "text": "def read_int32\n read_int64\n end", "title": "" }, { "docid": "33b1b9115e18ec1cd2c006c579197b88", "score": "0.64654076", "text": "def read_int\r\n (read_ubyte << 24) + (read_ubyte << 16) + (read_ubyte << 8) + read_ubyte\r\n end", "title": "" }, { "docid": "cec13bb7d78fde7bd986b2f062dd21f4", "score": "0.6464079", "text": "def read_long\n get_long(0)\n end", "title": "" }, { "docid": "415b4aa05ec88c0dbd2d84f613a3e1ec", "score": "0.64554787", "text": "def decode64(s)\n s.unpack('m').first\n end", "title": "" }, { "docid": "686a99066e2c63027be395279afec75a", "score": "0.6444006", "text": "def read_uint32\n read(4).unpack(UINT32).first\n end", "title": "" }, { "docid": "686a99066e2c63027be395279afec75a", "score": "0.6444006", "text": "def read_uint32\n read(4).unpack(UINT32).first\n end", "title": "" }, { "docid": "ec7d091ebf68c8043460979cf11bd173", "score": "0.6432189", "text": "def uint64=(value)\n @content = [value].pack('Q>')\n end", "title": "" }, { "docid": "36d60018afd768ad28a661723959aa2f", "score": "0.6372336", "text": "def read_long(signed=true)\n primitive_read_long(signed)\n end", "title": "" }, { "docid": "4273e7b671b93796d8d6f3297a597b0c", "score": "0.6370306", "text": "def read_uint24_be\n (\"\\x00\" + read_safe(3)).unpack('N')[0]\n end", "title": "" }, { "docid": "b10f1d130ed199b75db0ac14433b15d0", "score": "0.6365363", "text": "def read_varint\n value, shift = 0, 0\n while (byte = read(1).ord) do\n value |= (byte & 0x7F) << shift\n shift += 7\n return value if (byte & 0x80) == 0\n end\n end", "title": "" }, { "docid": "46bf38d49c8eda14746f4a9de7791a06", "score": "0.6356013", "text": "def read_u32\n read_bytes(4).unpack('N').first\n end", "title": "" }, { "docid": "18a99b6d928b5081930d7c04bb5e0eb0", "score": "0.6348176", "text": "def read_integer\n value = IO.binread(@file_path, INTEGER_LENGTH, @offset).unpack('I')[0]\n skip_integer\n value\n end", "title": "" }, { "docid": "73b16b0844c0a1c35d16646e3e7afe4c", "score": "0.6346575", "text": "def get_long\n get_bytes(8).unpack('q')[0]\n end", "title": "" }, { "docid": "a79959a1d855a4f3ccd86bfb1fc9e262", "score": "0.6335529", "text": "def get_u64_at(addr)\n if (addr % 8) != 0\n puts \"Addresses must be a multiple of 8!\"\n exit\n end\n\n S.write(\"\\x03%d\\n\" % queue_for(addr / 8));\n\n return S.recv(8)\nend", "title": "" }, { "docid": "9e9b6d35dac5d1375465b18690f0d852", "score": "0.63283396", "text": "def uint32\n io.read(4).unpack('N')[0]\n end", "title": "" }, { "docid": "1617730ed27df675edf8c0f9c12549b6", "score": "0.6305945", "text": "def little_ui64\n\tend", "title": "" }, { "docid": "45fb7d865994d16a53c6952efeb0d8da", "score": "0.6286059", "text": "def decode64(str)\n str.unpack(\"m\")[0]\n end", "title": "" }, { "docid": "ce6a9f146fc2beef73691944922aa5c9", "score": "0.6278889", "text": "def read_long\n Rubinius.primitive :pointer_read_long\n raise PrimitiveFailure, \"Unable to read long\"\n end", "title": "" }, { "docid": "3bb5725cecd7ae54603c48d66dce78d3", "score": "0.62751997", "text": "def readUnsignedByte_2(offset, filestream)\n #// most significant byte first\n #// |byte0|byte1| <= |unsigned int|\n byteArray = \"\"\n filestream.seek(offset, IO::SEEK_SET)\n byteArray = filestream.read(2, byteArray)\n return (byteArray.getbyte(0) << 8) | byteArray.getbyte(1)\n end", "title": "" }, { "docid": "d819d55cb18c5c5aba710fb0528acc86", "score": "0.6262544", "text": "def readInt\n @bytes.read(4).unpack(\"L\")[0]\n end", "title": "" }, { "docid": "86ec17259711c4c718f8edeecaa80f65", "score": "0.62552524", "text": "def readLong(bytes,signed)\n # handle sign as well\n a = bytes[0] & 0xff\n b = bytes[1] & 0xff\n c = bytes[2] & 0xff\n d = bytes[3] & 0xff\n if (!signed.nil? && signed && bytes[0] & 0x80 != 0) then\n # process with twos complement - invert the bits, bitwise and with 0xff, add 1, multiply by -1\n a = -1*((~a & 0xff)+1)\n end\n ret = (a << 24) | (b << 16) | (c << 8) | d\n return (ret)\n end", "title": "" }, { "docid": "332996bee2fcd1f832b1056b65c4727a", "score": "0.6253956", "text": "def make_uint64(low, high)\n low + (high * (2**32))\n end", "title": "" }, { "docid": "a5e2d3edf60f4bb14e64d687148b94fa", "score": "0.62533486", "text": "def read_int\n @io.read(4).unpack('L').first\n rescue => e\n raise IOError, e.message\n end", "title": "" }, { "docid": "afde4127ecd6df085e968365081ab8e1", "score": "0.62214625", "text": "def u64(num)\n @packed << [num].pack(\"Q>\")\n end", "title": "" }, { "docid": "fee9f03503f034cd38d9fcd0e9a1dc43", "score": "0.6220809", "text": "def readUnsignedByte_4(offset, filestream)\n byteArray = \"\"\n filestream.seek(offset, IO::SEEK_SET)\n byteArray = filestream.read(4, byteArray)\n #// most significant byte first\n #// |byte0|byte1|byte2|byte3| <= |unsigned int|\n return (byteArray.getbyte(0)<<24) | (byteArray.getbyte(1)<<16) | (byteArray.getbyte(2)<<8) | byteArray.getbyte(3)\n end", "title": "" }, { "docid": "67e19bc40b75cff8b7ad5be647af0592", "score": "0.6207957", "text": "def read_signed_integer\n value = IO.binread(@file_path, INTEGER_LENGTH, @offset).unpack('i')[0]\n skip_integer\n value\n end", "title": "" }, { "docid": "a46908da7d0e1078fcc147d984db516e", "score": "0.6202739", "text": "def read_uint40\n a, b = reader.read(5).unpack(\"CV\")\n a + (b << 8)\n end", "title": "" }, { "docid": "67e26e19682e73c0e3a3716ea7618bf7", "score": "0.6187681", "text": "def read_int(io)\n io.read(4).unpack('l').shift\n end", "title": "" }, { "docid": "46a96fe6bd92afc80b04a58b25ede32c", "score": "0.61798525", "text": "def read_long_long(signed=true)\n primitive_read_long_long(signed)\n end", "title": "" }, { "docid": "d4179d96ae73a85c302dccac0f18336b", "score": "0.61726266", "text": "def read_varint\n first_byte = read_uint8\n\n case\n when first_byte <= 250\n first_byte\n when first_byte == 251\n nil\n when first_byte == 252\n read_uint16\n when first_byte == 253\n read_uint24\n when first_byte == 254\n read_uint64\n when first_byte == 255\n raise \"Invalid variable-length integer\"\n end\n end", "title": "" }, { "docid": "2132711811bf67a2c9762fe13c1a5a08", "score": "0.61652184", "text": "def uint64ToUint8LE(n)\n [n % 0x100000000].pack(\"V\") + [n / 0x100000000].pack(\"V\")\n end", "title": "" }, { "docid": "b7a173cbf6adf61fe3780cdf8c02bebb", "score": "0.6164162", "text": "def read_uint8\n reader.read(1).unpack(\"C\").first\n end", "title": "" }, { "docid": "cd4759cc3c1732c6855b518871f754a3", "score": "0.6163821", "text": "def getLong(s)\n x = 0.chr * 4\n x[0] = get_byte(s).chr\n x[1] = get_byte(s).chr\n x[2] = get_byte(s).chr\n c = get_byte(s)\n x[3] = c.chr\n\n s.z_err = Z_DATA_ERROR if c == Z_EOF\n\n x.unpack('v').first\n end", "title": "" }, { "docid": "d5ff3f7f0af4736ab883b5151359391c", "score": "0.6161571", "text": "def ulid_bitmath\n (x, y) = raw.unpack('Q>Q>')\n (x << 64) | y\n end", "title": "" }, { "docid": "53b644018ab541230c27f94503f36e8f", "score": "0.6141057", "text": "def write_uint64(value)\n write_varint(value)\n end", "title": "" }, { "docid": "3e2f9802dcb7a6d305be0a21333f4008", "score": "0.61361986", "text": "def read_long\n Ruby.primitive :memorypointer_read_long\n raise PrimitiveFailure, \"Unable to read long\"\n end", "title": "" }, { "docid": "fbc8648653b3ab918fbce876249e3b48", "score": "0.61360687", "text": "def read_int32_be\n reader.read(4).unpack('l>').first\n end", "title": "" }, { "docid": "6c76aba518df49f704d302c087d42a46", "score": "0.6135841", "text": "def get_uint32(offset=nil)\n seek(offset)\n data = read_and_advance(4)\n BinData::Uint32be.read(data)\n end", "title": "" }, { "docid": "cf8cb247285d4e6bd8ec78bcad894619", "score": "0.6133677", "text": "def get_i_sint8\n data = read_and_advance(1)\n BinData::Int8.read(data) ^ (-1 << 7)\n end", "title": "" }, { "docid": "eb841eca51308f327bdf40d6be18bcdd", "score": "0.61313236", "text": "def read_uint24_be\n a, b = reader.read(3).unpack(\"nC\")\n (a << 8) + b\n end", "title": "" }, { "docid": "bca15644b179180f442b77736ac9fc75", "score": "0.61150515", "text": "def read_long_long\n Rubinius.primitive :pointer_read_long_long\n raise PrimitiveFailure, \"Unable to read long long\"\n end", "title": "" }, { "docid": "fe516071713e67da9577bde62bd8b705", "score": "0.61082196", "text": "def shift_u64(bytes)\n bytes.slice!(0,8)\n end", "title": "" }, { "docid": "a5230d2fda8ccae8eac2ae0c2ec86e85", "score": "0.6103584", "text": "def two_byte_le_unsigned_to_i(s) \n\t\treturn s.to_byte_string.unpack(\"<S\")[0] \n\tend", "title": "" }, { "docid": "376f910c7bb23d89382aaba47d10c819", "score": "0.60998374", "text": "def read_integer(bits); end", "title": "" }, { "docid": "274c39d65d49ccc91cbe2426fd8274fe", "score": "0.608632", "text": "def read_int(address, signed, bit_size)\n byte_size = bit_size / 8\n mem = read_raw_bytes(address, byte_size)\n mem.unpack(get_integer_unpack(signed, byte_size))[0]\n end", "title": "" }, { "docid": "8db7afbb02a44900a26ea4fbfab47a12", "score": "0.60840875", "text": "def ulong\n Cproton.pn_data_get_ulong(@data)\n end", "title": "" }, { "docid": "5e3d1e1e329faef6c1ac15e81d490a3f", "score": "0.60783225", "text": "def read_integer(bits)\n\t\t\t\tlimit = 2**bits - 1\n\t\t\t\tvalue = bits.zero? ? 0 : (read_byte & limit)\n\t\t\t\t\n\t\t\t\tshift = 0\n\t\t\t\t\n\t\t\t\twhile byte = read_byte\n\t\t\t\t\tvalue += ((byte & 127) << shift)\n\t\t\t\t\tshift += 7\n\t\t\t\t\t\n\t\t\t\t\tbreak if (byte & 128).zero?\n\t\t\t\tend if (value == limit)\n\t\t\t\t\n\t\t\t\treturn value\n\t\t\tend", "title": "" }, { "docid": "0e8f600d4890464ca8a8e6a50187e67f", "score": "0.6068863", "text": "def p_ulong64\n FFI::MemoryPointer.new :uint64\n end", "title": "" }, { "docid": "60b6f5eff92aeef5d06774a8ac1ab2a6", "score": "0.6063086", "text": "def p_ulong64\n MemoryPointer.new :uint64\n end", "title": "" }, { "docid": "5f8789dabf6e2f8316243a2a3caa54e4", "score": "0.60451806", "text": "def pack_int64le(val); end", "title": "" }, { "docid": "3b35f3065e6271a88c452e2e20312215", "score": "0.6037811", "text": "def read_uint8\n read(1).unpack('C')[0]\n end", "title": "" }, { "docid": "425225a3976ceff8576711d144d0b555", "score": "0.60374534", "text": "def read_next_uint(content)\n\t\tbyte_count, uint_byte_string = read_next_uint_bytes(content)\n\n\t\t# TODO: really stupid way to convert golang integer to ruby but I wanted to move forward\n\t\t# Problem with unpack is that I would need to know which size it is, and for now I'm just too lazy to figure out\n\t\t# This would propably make the encoder much faster if written properly\n\t\tuint = uint_byte_string.bytes.map{ |b| b.to_s(2).rjust(8,\"0\") }.join.to_i(2)\n\t\t\n\t\t# Returns the integer and tells how many bytes were needed to read it\n\t\t[uint, byte_count]\n\tend", "title": "" }, { "docid": "626c4f6fd2c8c96f4ff1e41612f5cd4d", "score": "0.5969046", "text": "def ulong\n Cproton.pn_data_get_ulong(@impl)\n end", "title": "" }, { "docid": "c132e57c34f5d8affa956ad76ed43c1b", "score": "0.5952295", "text": "def read_sfixed64\n un_zig_zag(read_fixed64)\n end", "title": "" }, { "docid": "e4ea891ec99c692f4ce89564583374ec", "score": "0.59236", "text": "def get_i_sint32\n data = read_and_advance(4)\n BinData::Int32be.read(data) ^ (-1 << 31)\n end", "title": "" }, { "docid": "89d738744f7f4eee1d46e4232cd37f0e", "score": "0.5918881", "text": "def readU8; io.getbyte; end", "title": "" }, { "docid": "2121afc72efe1d60099aae7a58a083d6", "score": "0.59092", "text": "def u32\n return nil if @bytes_read > @buf.size - 4\n x = @buf[@bytes_read]\n x |= @buf[@bytes_read + 1] << 8\n x |= @buf[@bytes_read + 2] << 16\n x |= @buf[@bytes_read + 3] << 24\n @bytes_read += 4\n x\n end", "title": "" }, { "docid": "7c5256d2fb618af8f9f96ee0e9c9af5d", "score": "0.58994836", "text": "def uint32\n @content.unpack('N')[0]\n end", "title": "" }, { "docid": "dd74432659f1b1825ff37618185597be", "score": "0.58864987", "text": "def test_unsigned_decode\n i = Counter32.decode(\"\\201\\264\\353\\331\")\n assert_equal(2176117721, i.to_i)\n\n i = TimeTicks.decode(\"\\201\\264\\353\\331\")\n assert_equal(2176117721, i.to_i)\n end", "title": "" }, { "docid": "dab959c04d7b9302a16b1cb7f69ba59a", "score": "0.588093", "text": "def uid64\n md5.unpack(\"LL\").inject { |a,b| (a << 31) + b }\n end", "title": "" }, { "docid": "c2f0bc90213791875b9b3a19d631c164", "score": "0.58351475", "text": "def get_uint24(offset=nil)\n seek(offset)\n data = read_and_advance(3)\n BinData::Uint24be.read(data)\n end", "title": "" }, { "docid": "d49180f553d22560042fefce2fec56b6", "score": "0.5830278", "text": "def read_ubyte\r\n read_byte.ubyte\r\n end", "title": "" }, { "docid": "9ebb56f5bc8fd8cd86d506fc955ab99e", "score": "0.58291084", "text": "def get_uint_by_size(size)\n case size\n when 1\n get_uint8\n when 2\n get_uint16\n when 3\n get_uint24\n when 4\n get_uint32\n when 8\n get_uint64\n else\n raise \"Not implemented\"\n end\n end", "title": "" }, { "docid": "c08b6ebc4bac9f98e3953dacd0473043", "score": "0.58248883", "text": "def uint(data)\n if narray?(data)\n Numo::UInt32.cast(data).to_binary\n else\n Fiddley::Utils.array2str(:uint32, data.to_a.flatten)\n end\n end", "title": "" } ]
8f20d91abb107454be62c36d9430ae37
GET /case_recs/new GET /case_recs/new.xml
[ { "docid": "9b2070b7061ce5ee1ac24f5f8d7a3fd4", "score": "0.7716178", "text": "def new\n @case_rec = CaseRec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case_rec }\n end\n end", "title": "" } ]
[ { "docid": "da6397c9851b1f4bf753fa330b35d1fe", "score": "0.7220025", "text": "def new\n @case = Case.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case }\n end\n end", "title": "" }, { "docid": "d91f886ec1f52d22bae5aac314e785bf", "score": "0.68212116", "text": "def new\n @record = Record.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @record }\n end\n end", "title": "" }, { "docid": "b89eb31c88075e4263e11040864177a4", "score": "0.6796664", "text": "def new\n @case = Case.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case }\n end\n end", "title": "" }, { "docid": "41433d74e36719684775ad2d50c3eabe", "score": "0.67936224", "text": "def new\n @new = New.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new }\n end\n end", "title": "" }, { "docid": "a02a6b133b0badd56dc1b9741be4ce0e", "score": "0.6733691", "text": "def new\n @usercase = Usercase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usercase }\n end\n end", "title": "" }, { "docid": "0bf4e01d01db63ddf8ac0bba49f0c058", "score": "0.6719683", "text": "def new\n @day_rec = DayRec.new\n @day_recs = DayRec.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day_rec }\n end\n end", "title": "" }, { "docid": "1f0be4316ffbc8dc2bca83507b163d9a", "score": "0.67096937", "text": "def new\n @case_study = CaseStudy.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case_study }\n end\n end", "title": "" }, { "docid": "c44085ac63e24f65a73bc0c5d35484f8", "score": "0.6706623", "text": "def new\n @lookup_ref = LookupRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_ref }\n end\n end", "title": "" }, { "docid": "c44085ac63e24f65a73bc0c5d35484f8", "score": "0.6706623", "text": "def new\n @lookup_ref = LookupRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_ref }\n end\n end", "title": "" }, { "docid": "77f9cea5fe5f6e1057681447acd734ca", "score": "0.66875166", "text": "def create\n @case_rec = CaseRec.new(params[:case_rec])\n\n respond_to do |format|\n if @case_rec.save\n flash[:notice] = 'CaseRec was successfully created.'\n format.html { redirect_to(@case_rec) }\n format.xml { render :xml => @case_rec, :status => :created, :location => @case_rec }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @case_rec.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c6fea231b17235aa5d5be1212d6a8cc", "score": "0.66762733", "text": "def new\n @rel = Rel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rel }\n end\n end", "title": "" }, { "docid": "4273130498cfdc1fb4be661e81c2ff0c", "score": "0.6631884", "text": "def new\n @scrap_xml = ScrapXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrap_xml }\n end\n end", "title": "" }, { "docid": "12fecc8be729af0c1a247177087c1353", "score": "0.66109115", "text": "def new\n @visitor_records = VisitorRecords.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visitor_records }\n end\n end", "title": "" }, { "docid": "ed9545340581aad9841f7fcaecbd2b2e", "score": "0.6601121", "text": "def new\n @reoccurrence = Reoccurrence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reoccurrence }\n end\n end", "title": "" }, { "docid": "94ceaaf9250cdc3d062aeb18bbab1a52", "score": "0.6583028", "text": "def new\n @newstuff = Newstuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newstuff }\n end\n end", "title": "" }, { "docid": "be1c00acbabb6a60c7ad50571d0b02fb", "score": "0.65789473", "text": "def new\n @cdr_entries = CdrEntries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cdr_entries }\n end\n end", "title": "" }, { "docid": "0e15c4af3f1aed87167f03b8d55d56bc", "score": "0.65721464", "text": "def new\n @casewatching = Casewatching.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @casewatching }\n end\n end", "title": "" }, { "docid": "b421aa91646683428f5a36fc51cfd64e", "score": "0.65717417", "text": "def new\n @lookup_recruitsource = LookupRecruitsource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_recruitsource }\n end\n end", "title": "" }, { "docid": "dc8ad0097ccdb54bb39fa8494629ff16", "score": "0.65285635", "text": "def new\n @rt = Rt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rt }\n end\n end", "title": "" }, { "docid": "b5bae3c9961e7915a001f959158a2b1c", "score": "0.6522789", "text": "def new\n @counter = Counter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counter }\n end\n end", "title": "" }, { "docid": "ad608889ec4ba0b3173ca382079546c5", "score": "0.65201265", "text": "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "title": "" }, { "docid": "df7ba2de926d73634bed12a6f9372170", "score": "0.6515099", "text": "def new\n @temp_doc = TempDoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temp_doc }\n end\n end", "title": "" }, { "docid": "8b11e90fcae099b99530b9e52bb1bc19", "score": "0.6513219", "text": "def new\n @change = Change.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @change }\n end\n end", "title": "" }, { "docid": "b4c191741da8f5ecc7fe842f3c8a9982", "score": "0.6499934", "text": "def new\n @con = Con.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @con }\n end\n end", "title": "" }, { "docid": "7e0567eaa5771c49fb3def03eaa4a14b", "score": "0.64980924", "text": "def new\n \n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "title": "" }, { "docid": "de7b611abe02c75cca90de772324c43f", "score": "0.64710265", "text": "def new\n @lookup = Lookup.new\n\n @new_key = \" \"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup }\n end\n end", "title": "" }, { "docid": "978d233360db0990b19396faf7f88e8c", "score": "0.6457617", "text": "def new\n @reged = Reged.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reged }\n end\n end", "title": "" }, { "docid": "d06cda476612c3091903c4ca9a66f2e4", "score": "0.64555377", "text": "def new\n @casefile = Casefile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casefile }\n end\n end", "title": "" }, { "docid": "96d9d28a27dca2271004cfdec0e3df1c", "score": "0.6452685", "text": "def new\n @my_record = MyRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_record }\n end\n end", "title": "" }, { "docid": "644825181405e6f39adb2d177951ec81", "score": "0.64519477", "text": "def new\n @occurrence = Occurrence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurrence }\n end\n end", "title": "" }, { "docid": "ca800590d3c7689914aecbdc28664657", "score": "0.64499736", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @contact_data_client }\n end\n end", "title": "" }, { "docid": "41650db805ea0751d4314f77d3199296", "score": "0.6449953", "text": "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "title": "" }, { "docid": "41650db805ea0751d4314f77d3199296", "score": "0.6449953", "text": "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "title": "" }, { "docid": "b28a86ea4f8271d2c372d5053727f79e", "score": "0.6440383", "text": "def new\n @crm_case = CrmCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_case }\n end\n end", "title": "" }, { "docid": "22616341a45d0cdf015d956e39aaaf5f", "score": "0.6426717", "text": "def new\n @r_i = RI.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @r_i }\n end\n end", "title": "" }, { "docid": "3a8d06d96d3c26804a73df788579303b", "score": "0.64260536", "text": "def new\n @crane = Crane.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crane }\n end\n end", "title": "" }, { "docid": "908c5a72ed13dbfb6fbaff6794d95fd4", "score": "0.6419718", "text": "def new\n @cup = Cup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cup }\n end\n end", "title": "" }, { "docid": "63b49308a29ea7bca029301b41b8b9cd", "score": "0.64195216", "text": "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end", "title": "" }, { "docid": "63b49308a29ea7bca029301b41b8b9cd", "score": "0.64195216", "text": "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end", "title": "" }, { "docid": "896e3aa3048c8731ca245a71685ba361", "score": "0.64191914", "text": "def new\n @case_file = CaseFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_file }\n end\n end", "title": "" }, { "docid": "dc0c6d009d5296751f773b1f7cf2a069", "score": "0.64097387", "text": "def new\n @requeststatus = Requeststatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requeststatus }\n end\n end", "title": "" }, { "docid": "4e4130af53a4bb06332a601fe8bf0963", "score": "0.6409335", "text": "def new\n @docdb = Docdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docdb }\n end\n end", "title": "" }, { "docid": "44a8aa483e8a9d236e5b0a181f7a039c", "score": "0.6408781", "text": "def new\n @recibo = Recibo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recibo }\n end\n end", "title": "" }, { "docid": "44a8aa483e8a9d236e5b0a181f7a039c", "score": "0.6408781", "text": "def new\n @recibo = Recibo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recibo }\n end\n end", "title": "" }, { "docid": "60437cbfe48cf6d06979101abefded34", "score": "0.6406232", "text": "def new\n @mycv = Mycv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mycv }\n end\n end", "title": "" }, { "docid": "37ee9cfe67a1012c0e33ba27bc8b5b92", "score": "0.6398965", "text": "def new\n @newcomment = Newcomment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newcomment }\n end\n end", "title": "" }, { "docid": "41d447ceefa1e1d0142f88f0af489fde", "score": "0.6395242", "text": "def new\n @cticket = Cticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cticket }\n end\n end", "title": "" }, { "docid": "5dc560d9d8e8868353201a97790caf62", "score": "0.6390089", "text": "def new\n @contactss = Contactss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contactss }\n end\n end", "title": "" }, { "docid": "bcbb8cc71ef79caf1ad9460a38712078", "score": "0.6381972", "text": "def new\n @citation = Citation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @citation }\n end\n end", "title": "" }, { "docid": "7a90595f5535d86c30414a9545ecc144", "score": "0.63788044", "text": "def new\n @caseinventor = Caseinventor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @caseinventor }\n end\n end", "title": "" }, { "docid": "cf5e6954fbd243f808c021bbfe28a03d", "score": "0.6378792", "text": "def new\n @criteria = Criteria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @criteria }\n end\n end", "title": "" }, { "docid": "e284720809fd9693be4160c34e056810", "score": "0.63721555", "text": "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "title": "" }, { "docid": "ce2782f3dafb5faeea2cf1deabd754f4", "score": "0.6369781", "text": "def new\n @lookup_cogstatus = LookupCogstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_cogstatus }\n end\n end", "title": "" }, { "docid": "60745ffb868d94b0834965709e56f9f2", "score": "0.6369322", "text": "def new\n @testcase_bug_xref = TestcaseBugXref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testcase_bug_xref }\n end\n end", "title": "" }, { "docid": "47e0816a0beeb2faf87b0f8ecfe163df", "score": "0.63604766", "text": "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @contact }\n end\n end", "title": "" }, { "docid": "85392504c0944d5dda8689d6ed634614", "score": "0.6360006", "text": "def new\n @comic_request = ComicRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comic_request }\n end\n end", "title": "" }, { "docid": "d2babd32fceba49dc92e0e411c9aad59", "score": "0.6359295", "text": "def new\n @collectionnode = Collectionnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collectionnode }\n end\n end", "title": "" }, { "docid": "3f4bb2e9da52ee59d631099f559eeb94", "score": "0.6358327", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_family_case_study }\n end\n end", "title": "" }, { "docid": "1fa53b9e031d433c56e9273a4ed598c0", "score": "0.63569826", "text": "def new\n @case = Case.find(params[:case_id])\n @survey = Survey.find(params[:survey_id])\n @case_answers = @survey.case_answers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case_answers }\n end\n end", "title": "" }, { "docid": "265d91952f8898affb0ca34eb2ed6eca", "score": "0.6353375", "text": "def new\n # puts \"\\n--calls#new\".yellowish\n \n @call = Call.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @call }\n end\n end", "title": "" }, { "docid": "d59d214ef2cb7e922f225e634ffa9f0e", "score": "0.6351358", "text": "def new\n @prac = Prac.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prac }\n end\n end", "title": "" }, { "docid": "8c6730e17e55b31e09d2684369a894e1", "score": "0.63510823", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @contact_tag }\n end\n end", "title": "" }, { "docid": "aa369a7a0d4e32e28b6d3fdb223f709e", "score": "0.6347872", "text": "def new\n @cite = Cite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cite }\n end\n end", "title": "" }, { "docid": "e6d6f96327b73972e03e4728093da894", "score": "0.6344838", "text": "def new\n @receit = Receit.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @receit }\n end\n end", "title": "" }, { "docid": "687774477ce647451f05e639b30c0f54", "score": "0.63431776", "text": "def new\n @contact_request = ContactRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact_request }\n end\n end", "title": "" }, { "docid": "9e3fadf1fc941e200f58d40d8c699f77", "score": "0.6340945", "text": "def new\n @creation = Creation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creation }\n end\n end", "title": "" }, { "docid": "9101be0a1a1a4e0a576d9d66c06db38c", "score": "0.6339984", "text": "def new\n @contest_entry = ContestEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest_entry }\n end\n end", "title": "" }, { "docid": "afa429c920e975a4eb1ec6f76c54ee7c", "score": "0.6332407", "text": "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "title": "" }, { "docid": "198183775a4a9c4a011e8ca88663aef8", "score": "0.6328912", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @model }\n end\n end", "title": "" }, { "docid": "fd841dfeabe4f05a90cf8ec8e533b25d", "score": "0.63198745", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_source }\n end\n end", "title": "" }, { "docid": "7b4c901b2100e267e7713bec0a64d2a1", "score": "0.63168645", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exam }\n end\n end", "title": "" }, { "docid": "86d7e5001304b2ec899dc066855630ce", "score": "0.63087654", "text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "title": "" }, { "docid": "86d7e5001304b2ec899dc066855630ce", "score": "0.63087654", "text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "title": "" }, { "docid": "86d7e5001304b2ec899dc066855630ce", "score": "0.63087654", "text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "title": "" }, { "docid": "d4c65daa75d576af0ce44e0d4f3e98e8", "score": "0.6307382", "text": "def new\n @fold_change = FoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fold_change }\n end\n end", "title": "" }, { "docid": "0ba707c5683fac93c535545c609922aa", "score": "0.63035303", "text": "def new\n @cat = Cat.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end", "title": "" }, { "docid": "2460457392866f657706761dfb373f44", "score": "0.63018566", "text": "def new\n @retrospective = Retrospective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retrospective }\n end\n end", "title": "" }, { "docid": "58c37fcb01d263debbb5a9ccfdda7585", "score": "0.630016", "text": "def new\n @page_change = PageChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_change }\n end\n end", "title": "" }, { "docid": "ddf761cdb4f4b162c59da7bf2b4f601c", "score": "0.6294819", "text": "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reference }\n end\n end", "title": "" }, { "docid": "5e65416e4bf9f76fb8c6bf4a2594bac5", "score": "0.6293413", "text": "def show\n respond_to do |format|\n format.html\n format.xml { render xml: @new_record.xml }\n end\n end", "title": "" }, { "docid": "8aa98cf7be0531cecf380a2d852ae248", "score": "0.6292591", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cursus }\n end\n end", "title": "" }, { "docid": "3b67635fdae2104771c4170ad5384f20", "score": "0.62912464", "text": "def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end", "title": "" }, { "docid": "1b41fedf5f23eac86ecd452a8c8c9134", "score": "0.6290742", "text": "def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dummy }\n end\n end", "title": "" }, { "docid": "dab62a78bc500886d7e0e0b8c67d831a", "score": "0.6285865", "text": "def new\n @case = Case.new\n @clients = Client.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case }\n end\n end", "title": "" }, { "docid": "1080ee712cd174c5440b5843d66c31e1", "score": "0.6285769", "text": "def new\n @recent = Recent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recent }\n end\n end", "title": "" }, { "docid": "912327a8c755efdbcac3ff39da546f13", "score": "0.6282584", "text": "def new\n @cc_detail = CcDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cc_detail }\n end\n end", "title": "" }, { "docid": "a090ddaf839578568ed168d021c93cf0", "score": "0.6281274", "text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "title": "" }, { "docid": "a090ddaf839578568ed168d021c93cf0", "score": "0.6281274", "text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "title": "" }, { "docid": "edcf1eb3145d4846b33ddfdd0b61c7a9", "score": "0.62808084", "text": "def new\n @tst_conn = TstConn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tst_conn }\n end\n end", "title": "" }, { "docid": "f3cd7b33bd59bc828e05b3b0f9496089", "score": "0.62789047", "text": "def new\n @ricfile = Ricfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ricfile }\n end\n end", "title": "" }, { "docid": "a09840e76ef27ef8caeba5b7dd57aeac", "score": "0.62779945", "text": "def new\n @record = Record.new\n @record.date = params[:new_date] || Time.now.to_s\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @record }\n end\n end", "title": "" }, { "docid": "bc3968147541effafc698e4a51b537c9", "score": "0.62773824", "text": "def new\n @stuff = Stuff.new\n @days_to_njcee = get_days_to_njcee()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stuff }\n end\n end", "title": "" }, { "docid": "ad25b7a450bc44c782a9e9b340ec32e1", "score": "0.6277255", "text": "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research }\n end\n end", "title": "" }, { "docid": "09659b5e0a0b570d5c8019b81ae00efa", "score": "0.6273044", "text": "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "title": "" }, { "docid": "20f8802c9b7e692d3553aedd69e750eb", "score": "0.6272527", "text": "def new\n @bcr = Bcr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bcr }\n end\n end", "title": "" }, { "docid": "58c3d6f5dcce162b0e8503b4003820ae", "score": "0.6272086", "text": "def new\n @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @something }\n end\n end", "title": "" }, { "docid": "58c3d6f5dcce162b0e8503b4003820ae", "score": "0.6272086", "text": "def new\n @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @something }\n end\n end", "title": "" }, { "docid": "b47d70607489846a54f78f2c71487d2f", "score": "0.62715834", "text": "def new\n @clicks = Click.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clicks }\n end\n end", "title": "" }, { "docid": "d1711de07286425bf4d451f48c5399ff", "score": "0.62706757", "text": "def new\n @cg = Cg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cg }\n end\n end", "title": "" }, { "docid": "be659584083f8fd0666b0a10b9321761", "score": "0.6269563", "text": "def new\n @xml_file_download = XmlFileDownload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @xml_file_download }\n end\n end", "title": "" } ]
fc1557ce5e72f4c2a8c910fade614e5d
=begin Problem: Write a method that takes a number as an argument. If the argument is a positive number, return the negative of that number. If the number is 0 or negative, return the original number. Rephrase: Examples/tests: negative(5) == 5 negative(3) == 3 negative(0) == 0 There's no such thing as 0 in ruby INPUT: int OUTPUT: int Rules: Explicit: Implicit: D: int Approach: C: =end
[ { "docid": "f5c19f9600c3dacfb18a737fd80dd77c", "score": "0.8392101", "text": "def negative(int)\n int.positive? ? int * -1 : int\nend", "title": "" } ]
[ { "docid": "a6f50b5173c8f4135035cecf9bf27d9c", "score": "0.889662", "text": "def negative(number)\n if number.positive?\n return -(number)\n elsif number.negative?\n return number\n elsif number.zero?\n return 0\n end\nend", "title": "" }, { "docid": "37ad5aa59ba13be0acb7c782c6c91907", "score": "0.8781791", "text": "def negative(number)\n if number > 0\n number * -1\n else\n number\n end\nend", "title": "" }, { "docid": "d84770b75a657482a5b36f1c73012544", "score": "0.87335396", "text": "def negative(num)\n if num > 0\n num * -1\n else\n num\n end\nend", "title": "" }, { "docid": "e850757f6685d12cbfb0f30fc2a2c600", "score": "0.87037283", "text": "def negative(num)\n if num <= 0\n num\n else\n -num\n end\nend", "title": "" }, { "docid": "a8e473342bc66ab3ea8ea880030d8532", "score": "0.8680352", "text": "def negative(integer)\n return -integer if integer >= 0\n integer\nend", "title": "" }, { "docid": "3d2b2481a1b882a111dab372028aab8c", "score": "0.86575073", "text": "def negative(num)\n return num * -1 if num > 0\n num\nend", "title": "" }, { "docid": "4d6c8a20e43b3e79c5bd677dd89e5c80", "score": "0.8644464", "text": "def negative(int)\n if int > 0\n int * -1\n elsif int < 0\n int\n else\n 0\n end\nend", "title": "" }, { "docid": "b62291e48a411e0f430a3dbae92692d5", "score": "0.8641126", "text": "def negative_number_returner(number)\n if number <= 0\n number\n else \n number * (-1)\n end\nend", "title": "" }, { "docid": "5da3e830d987a6023222c0f22ec85e5b", "score": "0.8620737", "text": "def negative(num)\n if num > 0\n num*-1 \n else \n num\n end \nend", "title": "" }, { "docid": "466ba6b7ab6d666e78bd1cc07a5dd646", "score": "0.86165494", "text": "def negative(number)\n if number.positive?\n -number\n elsif number.negative?\n number\n else\n number\n end\nend", "title": "" }, { "docid": "442aa14999c7fa2e6280930458bf354a", "score": "0.8563293", "text": "def negative(number)\n\n return number if number < 1\n\n number * -1\nend", "title": "" }, { "docid": "d3bfbedb54d65ca0bbe3482722fb6d71", "score": "0.85193247", "text": "def makeNegative(num)\n if num > 0\n return num * -1\n elseif num == 0\n return 0\n else num < 0\n return num\n end\nend", "title": "" }, { "docid": "46ed61a8022d30813888756e5909ad87", "score": "0.8498007", "text": "def negative(number)\n number > 0 ? -number : number\nend", "title": "" }, { "docid": "46ed61a8022d30813888756e5909ad87", "score": "0.8498007", "text": "def negative(number)\n number > 0 ? -number : number\nend", "title": "" }, { "docid": "46ed61a8022d30813888756e5909ad87", "score": "0.8498007", "text": "def negative(number)\n number > 0 ? -number : number\nend", "title": "" }, { "docid": "cfc83f87fecba6eafd3ed51be3368546", "score": "0.84835166", "text": "def negative(int)\n return -int if int > 0\n return int if int <= 0\nend", "title": "" }, { "docid": "ff8564afe083e4b7d3a72bdcd0098ebf", "score": "0.8458965", "text": "def negative(num)\n num > 0 ? -num : num\nend", "title": "" }, { "docid": "ff8564afe083e4b7d3a72bdcd0098ebf", "score": "0.8458965", "text": "def negative(num)\n num > 0 ? -num : num\nend", "title": "" }, { "docid": "ff8564afe083e4b7d3a72bdcd0098ebf", "score": "0.8458965", "text": "def negative(num)\n num > 0 ? -num : num\nend", "title": "" }, { "docid": "ff8564afe083e4b7d3a72bdcd0098ebf", "score": "0.8458965", "text": "def negative(num)\n num > 0 ? -num : num\nend", "title": "" }, { "docid": "7fb38af9ac1e48c3f0e24ddc36f9194d", "score": "0.84548414", "text": "def negative(number)\n number > 0 ? number * -1 : number\nend", "title": "" }, { "docid": "95cd8eee31ee7a517ab7fc451fe974b9", "score": "0.84541553", "text": "def negative(integer)\n return integer if integer * -1 > 0\n return integer * -1\nend", "title": "" }, { "docid": "869c56657c55b9f11304db0d398ba8b9", "score": "0.8450094", "text": "def negative(num)\n num <= 0 ? num : num * -1\nend", "title": "" }, { "docid": "869c56657c55b9f11304db0d398ba8b9", "score": "0.8450094", "text": "def negative(num)\n num <= 0 ? num : num * -1\nend", "title": "" }, { "docid": "c2f6fe0cd8ce16fc852542f8726a4d3c", "score": "0.84477246", "text": "def make_numbers_negative(number)\n if number < 0\n return number\n else\n return - number\n end\nend", "title": "" }, { "docid": "13a0e2cbdeb666c78f77a15cda521bf5", "score": "0.8446605", "text": "def makeNegative(num)\n\nif num.to_i >= 0 \nreturn num.to_i * -1\nelse \nreturn num.to_i\nend\n\nend", "title": "" }, { "docid": "8b34c340dcf26e634709c7108bdd54c3", "score": "0.84455514", "text": "def negative(integer)\r\n integer > 0 ? -integer : integer\r\nend", "title": "" }, { "docid": "547dc838a3e8ee2e359315e788919b62", "score": "0.8439468", "text": "def negative(num)\n num > 0 ? -num : num\nend", "title": "" }, { "docid": "c61cf2b9091ed480d59d576b6ec9af59", "score": "0.8433679", "text": "def makeNegative(num)\n if num > 0\n return num - 2*num\n\n elsif num <= 0\n return num\n end\nend", "title": "" }, { "docid": "3617b1340c6cb71daf5accde4d010926", "score": "0.84258676", "text": "def negative(num)\n num <= 0 ? num : -num\nend", "title": "" }, { "docid": "785964def392f23157ea2b239c5f55e0", "score": "0.84149766", "text": "def negative(num)\n num <= 0 ? num : -num \nend", "title": "" }, { "docid": "85e6903019d7df369a6e725e5969bc51", "score": "0.8403831", "text": "def negative(num)\n num > 0 ? num * -1 : num\nend", "title": "" }, { "docid": "54e7893da18f5bc7214bd4c2d6c67472", "score": "0.8385094", "text": "def negative(num)\n num > 0 ? -num : num\n # case num <=> 0\n # when 1 then num * -1\n # when 0, -1 then num\n # end\nend", "title": "" }, { "docid": "13ef26ed5854b0535a9e54c10a32bafa", "score": "0.83829284", "text": "def negative(number)\n number.abs > 1 ? number : 0\nend", "title": "" }, { "docid": "260fd68539280678f002e8e59d70fe09", "score": "0.83781147", "text": "def negative(num)\n num > 0 ? (-num) : (num)\nend", "title": "" }, { "docid": "3c07858b3cea735ef53b446af5b68d27", "score": "0.83717436", "text": "def negative(number)\n number.negative? ? number : -number\nend", "title": "" }, { "docid": "695fbf3fc5d929f49f539f0e40797248", "score": "0.83666116", "text": "def negative(int)\n int > 0 ? -int : int\nend", "title": "" }, { "docid": "accd254567544837e0fbe24e73a45c1e", "score": "0.8354828", "text": "def negative(num)\n return num <= 0 ?\n num\n : -num\nend", "title": "" }, { "docid": "13211f471a0c871fdfae26905e679d21", "score": "0.83543116", "text": "def negative(num)\n\tnum > 0 ? -num : num\nend", "title": "" }, { "docid": "3cd39f63da189db58e1f1a23ea2c6230", "score": "0.8353765", "text": "def negative(num)\n num < 0 ? num : -num\nend", "title": "" }, { "docid": "3cd026bc7b80263cec21b52b1e0bc699", "score": "0.83397573", "text": "def negative(int)\n int > 0 ? int * -1 : int\nend", "title": "" }, { "docid": "6a64361e508db8c3cd41b0e17df7ada6", "score": "0.8323964", "text": "def negative(num)\n num.positive? ? -num : num\nend", "title": "" }, { "docid": "6a64361e508db8c3cd41b0e17df7ada6", "score": "0.8323964", "text": "def negative(num)\n num.positive? ? -num : num\nend", "title": "" }, { "docid": "ba9d0c1664beccc6a9b0dcb39cbd4762", "score": "0.82649255", "text": "def negative(integer)\n (integer.abs == integer && !integer.zero?) ? -integer : integer\nend", "title": "" }, { "docid": "4ebc18edc19cc5db213f966f4189b32b", "score": "0.8253523", "text": "def makeNegative(num)\n if num <= 0\n return num\n else\n num = num - num * 2\n return num\n end\nend", "title": "" }, { "docid": "8ce62761d55fe3632e1a5c5a08ab6110", "score": "0.82467157", "text": "def makeNegative(num)\n num > 0 ? -num : num\nend", "title": "" }, { "docid": "641988dbcc5b2b3b9e9ae7d3c810f59f", "score": "0.82452834", "text": "def negative(num)\n # your code goes here\n -(num.abs)\n end", "title": "" }, { "docid": "43a123f8e307d3aa8b94e471e33b0d2b", "score": "0.8237002", "text": "def makeNegative(num)\n num *= -1 if num.positive?\n num\nend", "title": "" }, { "docid": "b9188c57083eff0771689a7089aad8de", "score": "0.8235021", "text": "def negative(num)\n -(num.abs)\nend", "title": "" }, { "docid": "61ecedf4df2c23f6df3c461281f0dde9", "score": "0.8221316", "text": "def negative(num)\n num.abs * -1\nend", "title": "" }, { "docid": "61ecedf4df2c23f6df3c461281f0dde9", "score": "0.8221316", "text": "def negative(num)\n num.abs * -1\nend", "title": "" }, { "docid": "99ea5c489ae97bd30e2ac8332d96f84e", "score": "0.8204692", "text": "def negative(number)\n -number.abs\nend", "title": "" }, { "docid": "99ea5c489ae97bd30e2ac8332d96f84e", "score": "0.8204692", "text": "def negative(number)\n -number.abs\nend", "title": "" }, { "docid": "99ea5c489ae97bd30e2ac8332d96f84e", "score": "0.8204692", "text": "def negative(number)\n -number.abs\nend", "title": "" }, { "docid": "e24cc8064fcae8580bce946f630ab450", "score": "0.820297", "text": "def make_numbers_negative(number)\n (number > 0)? -number : number\nend", "title": "" }, { "docid": "fd616001742abd55b0b7439643fd6420", "score": "0.82027495", "text": "def makeNegative(num)\n num <= 0 ? num : -num\nend", "title": "" }, { "docid": "108149814b9e3290388c75b2bdd4eea0", "score": "0.8192473", "text": "def negative(int)\n - int.abs\nend", "title": "" }, { "docid": "2b73b3f3e3a93a52c56dc05103a35119", "score": "0.8164437", "text": "def negative(int)\n -int.abs\nend", "title": "" }, { "docid": "e53f17328f171ace1bb301edb9000e7b", "score": "0.8155658", "text": "def negative(num)\n -num.abs\nend", "title": "" }, { "docid": "e53f17328f171ace1bb301edb9000e7b", "score": "0.8155658", "text": "def negative(num)\n -num.abs\nend", "title": "" }, { "docid": "1022da3c1b3cd19f0fd42605ddca701a", "score": "0.8110532", "text": "def negative(n)\n n < 1 ? n : -n\nend", "title": "" }, { "docid": "bc7122fb57d0a6b7e10dbb214eda5188", "score": "0.8108716", "text": "def make_negative(num)\n -num.abs\nend", "title": "" }, { "docid": "85f0078f288a81345cb9c910492875c6", "score": "0.809961", "text": "def make_numbers_negative(number)\n number < 0 ? number : number * -1\nend", "title": "" }, { "docid": "95e16f4e329cb65f25a68f881d3ff11e", "score": "0.809136", "text": "def make_numbers_negative(number)\n -(number.abs)\nend", "title": "" }, { "docid": "266e4b5df62c4215e47435809a1b9fc2", "score": "0.8060289", "text": "def negative(num)\n num > 0 ? (num - (num * 2)) : (num)\nend", "title": "" }, { "docid": "a2197ca0620574fe7878805fccd801bc", "score": "0.80173886", "text": "def is_negative(number)\n if number < 0\n output = true\n else\n output = false\n end\n return output\nend", "title": "" }, { "docid": "f382818f816c99d63b3db6f9075d47eb", "score": "0.80159956", "text": "def make_numbers_negative(number)\n\tnumber <= 0 ?\tnumber : -number\nend", "title": "" }, { "docid": "c6232faabd16c1d8843617d5ba1cc31c", "score": "0.7974294", "text": "def negative(number)\n\n if number > 0\n puts \"false, you number is positive\"\n elsif number < 0\n puts \"true, your number is negative\"\n else number = 0\n puts \"neither positive nor negative\"\n end\nend", "title": "" }, { "docid": "1900268cd529d818ccb00349e3bdeea6", "score": "0.7973153", "text": "def zero_if_negative the_number\n\t\treturn the_number < 0 ? 0 : the_number\n\tend", "title": "" }, { "docid": "1ddc90a518752dad253c45a249bf506f", "score": "0.79683393", "text": "def Absolute(number)\n return number*=-1 if number < 0\n return number \nend", "title": "" }, { "docid": "bfffb2a01e15f303eab7032b82828089", "score": "0.79596716", "text": "def absolute(number)\n if number < 0\n output = number * (-1)\n else\n output = number\n end\n return output\nend", "title": "" }, { "docid": "58f2d68c03285abc3f78e30b3750a320", "score": "0.795063", "text": "def makeNegative(num)\n if num >= 0\n return num * (-1)\n else\n return num * 1\n end\n end", "title": "" }, { "docid": "fe07d9be1ef205671b8631e6b4f9c587", "score": "0.794892", "text": "def make_numbers_negative(number)\n\treturn number < 0 ? number : number*(-1)\nend", "title": "" }, { "docid": "4711aad0c9ad0fcfa77063d431abc983", "score": "0.7948003", "text": "def absolute(number)\n if is_negative(number) == true\n return number * -1\n end\n return number\nend", "title": "" }, { "docid": "416f0162caf261374de9b20eb45f8e92", "score": "0.7942222", "text": "def is_negative(number)\n return number < 0\nend", "title": "" }, { "docid": "416f0162caf261374de9b20eb45f8e92", "score": "0.7942222", "text": "def is_negative(number)\n return number < 0\nend", "title": "" }, { "docid": "71a5b421f523d8de37805701019f307f", "score": "0.7928343", "text": "def absolute(number)\n output = number\n if number < 0\n output = number * -1\n end\n return output \nend", "title": "" }, { "docid": "66d7ec4fab23351d96a1eb56a17e46f9", "score": "0.7904143", "text": "def negative2(num)\n -num.abs\nend", "title": "" }, { "docid": "051272cd349f961e83c61f5f0683cc0c", "score": "0.78888416", "text": "def fixNegativeNumbers(number)\n\tif number < 0\n\t\treturn 0\n\telse\n\t\treturn number\n\tend\nend", "title": "" }, { "docid": "67c3f23f9553e56bb0ceacf36eff87bd", "score": "0.78747", "text": "def is_negative(number)\n if !number.is_a?(Integer)\n return nil\n else \n return number < 0\n end\nend", "title": "" }, { "docid": "963b69336aea772bc3851551c7ef34bb", "score": "0.7852025", "text": "def is_negative(number)\n if number < 0\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "5c71ea7c9c464a30c93676443544f4c4", "score": "0.7850945", "text": "def absolute(num)\n if num = 0\n return num\n end\n return num * -1\nend", "title": "" }, { "docid": "f363043764a61556b1ee942f66064814", "score": "0.7849942", "text": "def is_negative(number)\n if number < 0\n return true \n else\n return false\n end\nend", "title": "" }, { "docid": "59d4f08239c5a5caa45b9b2c8fc04372", "score": "0.78415966", "text": "def absolute(number)\n if number <0\n return number * -1\n else \n return number\n end\nend", "title": "" }, { "docid": "0e070b82ce21363df29cdde3a1f0aa93", "score": "0.7829458", "text": "def absolute(number)\n if number < 0\n return 0 - number\n else \n return number\n end\nend", "title": "" }, { "docid": "f0ef00d2e504c4d96807994f3e703e8e", "score": "0.78247774", "text": "def is_negative(input)\n if input < 0\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "6103b0663400a2ff432640d1d5b62be5", "score": "0.7820787", "text": "def negative(num)\n # your code goes here\n p (num * (-1)) if num>0\n p (num)\nend", "title": "" }, { "docid": "18620d4b3520f8cae9385c65bb317192", "score": "0.7815877", "text": "def is_negative(number)\n if number < 0 \n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "b08b55407b852a22645fd0ed45017d93", "score": "0.7813802", "text": "def absolute(number)\n if number < 0\n return number * -1\n else\n return number\n end\nend", "title": "" }, { "docid": "d54a79de7ebc1f1a171bbb104fd206b8", "score": "0.7805236", "text": "def is_negative(num)\n return num < 0\nend", "title": "" }, { "docid": "c2939496d8ccd47246accfc788d94b9a", "score": "0.7799969", "text": "def absolute(num)\n return num*-1 if num < 0\n return num\nend", "title": "" }, { "docid": "a5160c7668aa1b5e7b25fa39d429890d", "score": "0.77916265", "text": "def negative(num)\n # your code goes here\n puts -(num).abs\n# -1 becomes 1 then multiplied by negative sign equals negative number\n# -1 * (-) = 1; 1 * (-) = -1 \nend", "title": "" }, { "docid": "00998a3cd90f35d6ad3a5e38e6896a8a", "score": "0.7789016", "text": "def absolute(num)\n if num < 0 \n return num * -1\n else \n return num\n end\nend", "title": "" }, { "docid": "f60fddf9e33eb72022e1decaaff25e28", "score": "0.77873677", "text": "def make_numbers_negative(number)\nend", "title": "" }, { "docid": "22e8a6111ed628bc928cddf189bd4e83", "score": "0.7785551", "text": "def absolute_value(number)\n if number > 0\n number \n elsif number > 0\n number * -1\n elsif number == 0\n 0\n end\nend", "title": "" }, { "docid": "d47c80f4911eeb17d742e4f00c47dc45", "score": "0.7783922", "text": "def is_negative(num)\n if num < 0\n return true\n else return false\n end\nend", "title": "" }, { "docid": "ea0d6a0ad07e8fad0952df858da7c61e", "score": "0.777163", "text": "def is_negative(num)\n if num < 0\n return true\n else \n return false\n end\nend", "title": "" }, { "docid": "ea0d6a0ad07e8fad0952df858da7c61e", "score": "0.777163", "text": "def is_negative(num)\n if num < 0\n return true\n else \n return false\n end\nend", "title": "" }, { "docid": "32274f34beaca66234e1ecf0c536c4d7", "score": "0.7752828", "text": "def make_numbers_negative(number)\n number.negative? ? number : \"-#{number}\".to_i\nend", "title": "" }, { "docid": "eb3c9c9ebe0bf639a48e9e5638ee570b", "score": "0.7743697", "text": "def absolute(num)\n if num < 0\n return num * -1\n else\n return num\n end\nend", "title": "" } ]
43f324341569ec5f39123c65125f6222
Set the value of the Movie input for this Choreo.
[ { "docid": "9ffc3a1800d28f65e8383c386372e5e6", "score": "0.7850535", "text": "def set_Movie(value)\n set_input(\"Movie\", value)\n end", "title": "" } ]
[ { "docid": "4b14246abb0768540f2667863475902c", "score": "0.73132885", "text": "def set_movie\n @movie = Movie.find(params[:movie_id] || params[:id])\n end", "title": "" }, { "docid": "6371def826443ba542547f25bffa4cac", "score": "0.72987", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "6371def826443ba542547f25bffa4cac", "score": "0.72987", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "6371def826443ba542547f25bffa4cac", "score": "0.72987", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "6371def826443ba542547f25bffa4cac", "score": "0.72987", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "6371def826443ba542547f25bffa4cac", "score": "0.72987", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "8f8964490224d6ae0a1a0161f03090f4", "score": "0.72628975", "text": "def set_movie\n @movie = Movie.find(params[:id])\n @movies = true\n end", "title": "" }, { "docid": "dffeaacd5977966236ee532d687efd0e", "score": "0.72382265", "text": "def set_movie\n @movie = Movie.find(params[:movie_id])\n end", "title": "" }, { "docid": "dffeaacd5977966236ee532d687efd0e", "score": "0.72382265", "text": "def set_movie\n @movie = Movie.find(params[:movie_id])\n end", "title": "" }, { "docid": "2cc27af3d63152a7b773af3eee3f56df", "score": "0.7220651", "text": "def set_movie\n\t\t\tif !@movie = Movie.find_by(id: params[:id])\n\t\t\t render json: {message: \"Invalid params\"}, status: :bad_request\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "ad8ea8551675b97213cb8390d89458f6", "score": "0.72180855", "text": "def set_movie\n @movie = Movie.find( params[:id] )\n end", "title": "" }, { "docid": "cbfe691355f2315d444b557757f0643a", "score": "0.7194248", "text": "def set_movie\n\t\t@movie = Movie.find(params[:movie_id])\n\tend", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "c5a80d05965663f6d5a4d8be83da137e", "score": "0.7108312", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "d4cb5f211588448f0b737f737692003c", "score": "0.70956635", "text": "def set_movie \n @movie = Movie.find(params[:movie_id])\n end", "title": "" }, { "docid": "8d47d8c45a42920c0d0411af700c002a", "score": "0.7077445", "text": "def set_movie\n @movie = Movie.find_by(id: params[:id])\n check_for_instance(@movie, 'Movie', params[:id])\n end", "title": "" }, { "docid": "e67128baf4c722db6fa186c8ea89a808", "score": "0.6977074", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "500313e3c3f3eb8b37a61adb3b88eb3a", "score": "0.6917879", "text": "def set_movie\r\n @movie = Movie.find(params[:id])\r\n end", "title": "" }, { "docid": "6079547eadf5420f5233838a96a0a704", "score": "0.6894987", "text": "def set_movie\n @movie = Movie.active.find(params[:id])\n end", "title": "" }, { "docid": "0ec6ca2ba545e47cfcc9454355ea14d3", "score": "0.6809535", "text": "def set_movie\n @movie = Movie.find(params[:id]) \n end", "title": "" }, { "docid": "5d7704b079df6c2f19146f53800a6ba9", "score": "0.6806483", "text": "def set_movie\n @movie = Movie.find_or_initialize_by(id: params[:id])\n end", "title": "" }, { "docid": "258701f9f6fbcf0c40ed2d94304c6410", "score": "0.67686725", "text": "def set_movie\n @movie = Movie.find(params[:movie_id])\n end", "title": "" }, { "docid": "845b43be832924022756e2a226263fb4", "score": "0.67475814", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "845b43be832924022756e2a226263fb4", "score": "0.67475814", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "234a6053bb86019750dbd487fad75f6c", "score": "0.67113656", "text": "def set_actor_movie\n @actor_movie = ActorMovie.find(params[:id])\n end", "title": "" }, { "docid": "234a6053bb86019750dbd487fad75f6c", "score": "0.67113656", "text": "def set_actor_movie\n @actor_movie = ActorMovie.find(params[:id])\n end", "title": "" }, { "docid": "0f786c51c3afef3dfdb616f2f9c7eec1", "score": "0.66337186", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "0f786c51c3afef3dfdb616f2f9c7eec1", "score": "0.66337186", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "0f786c51c3afef3dfdb616f2f9c7eec1", "score": "0.66337186", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "0f786c51c3afef3dfdb616f2f9c7eec1", "score": "0.66337186", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "0f786c51c3afef3dfdb616f2f9c7eec1", "score": "0.66337186", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "0f786c51c3afef3dfdb616f2f9c7eec1", "score": "0.66337186", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "0f786c51c3afef3dfdb616f2f9c7eec1", "score": "0.66337186", "text": "def set_movie\n @movie = Movie.find(params[:id])\n end", "title": "" }, { "docid": "3b533f9d31bcb47749d9a400915a525b", "score": "0.6476142", "text": "def set_movie\n begin\n @movie = Movie.find_by!(id: params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render json: '{error: \"not_found\"}', status: :not_found\n end\n end", "title": "" }, { "docid": "b3b92d35ac61a20b8122a9ddc30a333f", "score": "0.6465304", "text": "def set_user_movie\n @user_movie = UserMovie.find(params[:id])\n end", "title": "" }, { "docid": "5f326431e9301283dfaa602c0aaede0b", "score": "0.6393611", "text": "def set_movie_actor\n @movie_actor = MovieActor.find(params[:id])\n end", "title": "" }, { "docid": "95b081ecebe9033544c2d8ac3f8b970e", "score": "0.6312463", "text": "def set_movie\n @movie = Movie.find_by_slug(params[:id])\n end", "title": "" }, { "docid": "059bd63c814757daf4906c06fb1a19e7", "score": "0.6309269", "text": "def set_movie\n @movies = OmdbGateway.new\n end", "title": "" }, { "docid": "e265921121765cbbcf5aef421651d030", "score": "0.62864697", "text": "def set_movies_actor\n @movies_actor = MoviesActor.find(params[:id])\n end", "title": "" }, { "docid": "99b204549bf8d3c46be38558c337a7e7", "score": "0.62467456", "text": "def set_movie\n @movie = Movie.find(params[:id])\nend", "title": "" }, { "docid": "44d5fb7a7cff6df69ea8f6b56b3767b9", "score": "0.6229885", "text": "def set_movieu\n @movieu = Movieu.find(params[:id])\n end", "title": "" }, { "docid": "67c746e9834ba13124e411e679565fbb", "score": "0.61987406", "text": "def set_request_movie\n @request_movie = RequestMovie.find(params[:id])\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "52659ff6e8177674df2d2726edeaa89e", "score": "0.0", "text": "def set_modifier_instance\n @modifier_instance = ModifierInstance.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
cdfe704f063dd32dec25f0ee49678375
index is relative to the phrase itself, negative is left, positive is right
[ { "docid": "f76de0b3e582451fc663964b4185d36c", "score": "0.0", "text": "def kwic_sort(phrase, results, index)\n index -= 1 if index > 0\n\n results.sort_by do |result|\n\n parts = result.sentence.downcase.partition(phrase)\n\n part = index < 0 ? parts.first : parts.last\n\n part.strip.split(/[^[[:word:]]]+/)[index] || 'z'\n end\n end", "title": "" } ]
[ { "docid": "673123c3c0697d40a5cc14b78e40d36f", "score": "0.6528371", "text": "def find_rotation_point(words)\n floor_index = 0\n ceiling_index = words.length\n\n\n while floor_index + 1 < ceiling_index\n half_distance = (ceiling_index - floor_index) / 2\n guess_index = floor_index + half_distance\n\n if words[guess_index] >= words.first\n floor_index = guess_index\n else\n ceiling_index = guess_index\n end\n end\n\n ceiling_index\nend", "title": "" }, { "docid": "6d46b59202683dd1c7071ae73b8fd11f", "score": "0.65236527", "text": "def left_index(i)\n 2*i+1 \n end", "title": "" }, { "docid": "85589080afa71a491ee8872bc769bf97", "score": "0.6504816", "text": "def positive_index(index)\n index >= 0 ? index : contents.length+index\n end", "title": "" }, { "docid": "2cd747d380c7fc9017535b41d8e6f361", "score": "0.64474887", "text": "def rindex(substr[, pos]) \n end", "title": "" }, { "docid": "13d7822514244570b3d424070ff4713f", "score": "0.6433376", "text": "def left_index(i)\n\t\t2*i + 1\n\tend", "title": "" }, { "docid": "3314d26c0395f155d5173899473b5579", "score": "0.6399471", "text": "def find_rotation_point words\n first_word = words[0]\n\n floor_index = 0\n ceiling_index = words.length - 1\n\n while floor_index < ceiling_index\n distance = ceiling_index - floor_index\n half_distance = distance / 2\n guess_index = floor_index + half_distance\n\n if words[guess_index] > first_word\n floor_index = guess_index\n else\n ceiling_index = guess_index\n end\n\n if floor_index + 1 == ceiling_index\n return ceiling_index\n end\n\n end\nend", "title": "" }, { "docid": "3314d26c0395f155d5173899473b5579", "score": "0.6399471", "text": "def find_rotation_point words\n first_word = words[0]\n\n floor_index = 0\n ceiling_index = words.length - 1\n\n while floor_index < ceiling_index\n distance = ceiling_index - floor_index\n half_distance = distance / 2\n guess_index = floor_index + half_distance\n\n if words[guess_index] > first_word\n floor_index = guess_index\n else\n ceiling_index = guess_index\n end\n\n if floor_index + 1 == ceiling_index\n return ceiling_index\n end\n\n end\nend", "title": "" }, { "docid": "913fc3316c22440d0239aebd8cb17170", "score": "0.6388537", "text": "def rotation_point(words)\n starting_index = 0\n ending_index = words.length - 1\n \n while starting_index < ending_index\n \n puts \"\\n#{words[starting_index]}\"\n puts \"#{words[ending_index]}\"\n \n mid = (starting_index + ending_index) /2\n puts \"#{mid}\"\n puts \"#{words[mid]}\"\n if words[mid] < words[0]\n ending_index = mid \n else\n starting_index = mid\n end\n \n return ending_index if starting_index + 1 == ending_index\n end\nend", "title": "" }, { "docid": "bb4a390db16bff479028d2fbe5889363", "score": "0.63518953", "text": "def index(substr[, pos])\n end", "title": "" }, { "docid": "3e9aa430f371457868fb457119d3ba1b", "score": "0.6327076", "text": "def get_phoneme_at_index(word, index)\n phonemes = ['qu']\n\n phonemes.each do |phoneme|\n differential = 0\n\n phoneme.each_char do |char|\n if char == word[index + differential]\n differential += 1\n else\n break\n end\n end\n\n if phoneme.length == differential\n return phoneme\n end\n end\n\n return -1\nend", "title": "" }, { "docid": "e25f77ac815991d0f172867d467ef96c", "score": "0.62603617", "text": "def absolute_index(index)\n (index>0)? \n ((index > 25)? absolute_index(index-=26): index) : \n ((index < -26)? absolute_index(index+=26): index)\n \nend", "title": "" }, { "docid": "d3ead640d1054b79a792e3e6179916c9", "score": "0.62537634", "text": "def center_of(phrase)\n center = phrase.length/2\n if phrase.length % 2 == 1\n phrase[center]\n else\n phrase.values_at(center-1, center)\n end\nend", "title": "" }, { "docid": "6fe18f6456832289bdc762ccdf4d15f6", "score": "0.62076825", "text": "def start_of_word(word, index)\n word[0...index]\nend", "title": "" }, { "docid": "e4cbbd88bcf23fbdb8badc332feb3c9f", "score": "0.61745703", "text": "def relative_position_of_word(line_ind, word_ind, grid)\n return 0 if grid.flatten.length == 0 # border case: empty array\n\n flattened_index = if (line_ind == 0)\n word_ind\n else\n no_of_nested_items(line_ind - 1, grid) + word_ind\n end\n\n # Return \"relative position\" of word = float between 0 and 1)\n flattened_index.to_f / grid.flatten.length\n end", "title": "" }, { "docid": "af7c8a730b9a2d9be9e18908437715d0", "score": "0.61573493", "text": "def phrase_at index\r\n word = ''\r\n cursor = index - 1\r\n while cursor > -1\r\n char = @code[cursor, 1]\r\n break if char.nil? or char == ''\r\n break unless char.match(/[\\s;=\\(\\)\\[\\]\\{\\}]/).nil?\r\n word = char + word\r\n cursor -= 1\r\n end\r\n word\r\n end", "title": "" }, { "docid": "b9affed63d601cbeff4e379b3f26ef4e", "score": "0.6142276", "text": "def get_following_word(index_string, sentence)\n return \"\" if index_string.empty?\n precede_index = index_string.split(\",\").map { |e| e.to_i }.sort.reverse.first\n return sentence.split(\" \")[precede_index + 1]\n end", "title": "" }, { "docid": "563acc237ec4f7a991eefa90e3c9adde", "score": "0.6139335", "text": "def left_child_idx(i)\n 2 * i + 1\n end", "title": "" }, { "docid": "1e9dadbe238b14ea64e843dc49be96c4", "score": "0.611109", "text": "def word(word, position)\n word[position]\nend", "title": "" }, { "docid": "1706392ac86b38961da9590c7349f620", "score": "0.6091407", "text": "def get_index(pos=[0, 0])\r\n return pos[0]*9+pos[1]\r\n end", "title": "" }, { "docid": "3ba0dc0b5ffbebbe7003bfdb77af2883", "score": "0.60523945", "text": "def start_of_word(text, v)\n\ttext[0...v]\n\tend", "title": "" }, { "docid": "28bf31f8129bc60f62f0da0966fd2f50", "score": "0.60461456", "text": "def left_child_idx i\n i*2 + 1\nend", "title": "" }, { "docid": "c21073b702d6a4efd1a78a9ca431b2b6", "score": "0.6036108", "text": "def find_position(pass) = pass.gsub(/./, {\n FRONT => 0,\n LEFT => 0,\n BACK => 1,\n RIGHT => 1\n}).to_i(2)", "title": "" }, { "docid": "f3e1ee6c803eead85db8501089e75c0f", "score": "0.602547", "text": "def right_index(i)\n\t\t2*i + 2\n\tend", "title": "" }, { "docid": "69e4274bfec0a69809f008a6839c4fcb", "score": "0.60182756", "text": "def index_2\n left = 0\n right = @array.inject(:+)\n\n @array.each_with_index do |element, i|\n right -= element\n return i if left == right \n left += element\n end\n\n return -1 \n end", "title": "" }, { "docid": "74dacf6fb93bdfb1a4ec6aa64f5e03d5", "score": "0.59908617", "text": "def rparen_index( tokens )\n li = 1\n phrase = false\n tokens.index do |tt|\n if phrase\n phrase = false if @rquote === tt\n else\n case tt\n when @rparen\n li -= 1\n when @lparen\n li += 1\n when @lquote\n phrase = true\n end\n end\n (li == 0)\n end\n end", "title": "" }, { "docid": "961ffba30c57aa3ce86f9c90f36174d5", "score": "0.5989853", "text": "def right_index(i)\n 2*i+2\n end", "title": "" }, { "docid": "b20cdaed173ca40e6bac292ccae48eb5", "score": "0.5975127", "text": "def start_of_word(phrase, num)\n phrase[0...num]\nend", "title": "" }, { "docid": "c56d89deb6b26ba305ac97fb9790d798", "score": "0.59702563", "text": "def word_index(word)\r\n word.downcase.chars.sort.join\r\nend", "title": "" }, { "docid": "79164f0bfa2bd315e37fbbbc243d8690", "score": "0.59690946", "text": "def answer(words)\n floor_index = 0\n ceiling_index = words.length - 1\n\n while floor_index < ceiling_index\n guess_index = (floor_index + ceiling_index) / 2\n if words[guess_index] >= words.first\n floor_index = guess_index\n else\n ceiling_index = guess_index\n end\n return ceiling_index if floor_index + 1 == ceiling_index\n end\nend", "title": "" }, { "docid": "85870341b530cc54336e2f1f78415cce", "score": "0.59581953", "text": "def rest; pos; end", "title": "" }, { "docid": "91b9092a8c8a61729ac08378dfa10986", "score": "0.59517103", "text": "def parent_index(i)\n (i+1)/2 - 1\n end", "title": "" }, { "docid": "cc652dc1b19e79468b602e189edcbe78", "score": "0.59405434", "text": "def solution_two\n @x = 0\n @contents.map { |x| x == '(' ? 1 : -1 }.each_with_index do |i, index|\n @x += i\n\n if @x == -1\n @position = index + 1\n break\n end\n end\n\n @position\n end", "title": "" }, { "docid": "cc5b7656525845476b473968dd927a2a", "score": "0.5930245", "text": "def start_of_word(s, i)\n s[0..i-1]\nend", "title": "" }, { "docid": "9285b9748d27095ecc9ada9e01fb92b9", "score": "0.59257835", "text": "def get_pos(index)\n\t\t\t\n\t\t\tln = @buffer.line.number\n\n\t\t\treturn nil unless page.range.include? ln\n\n\t\t\t[line_space(index), ln - page.start]\n\t\tend", "title": "" }, { "docid": "43ea2998af8b0ea97fc0406e1d848f9d", "score": "0.5918918", "text": "def start_of_word string, index\n string[0..index-1]\nend", "title": "" }, { "docid": "842c24cda0b8c58dfc53b085703f81ea", "score": "0.591347", "text": "def find_next_index(term, start, reverse)\n i = start\n while i < data.size && i >= 0\n if data[i].content =~ /#{term}/\n return i\n end\n i += reverse ? -1 : 1\n end\n nil\n end", "title": "" }, { "docid": "78225a107213360998bb4d560e4f076f", "score": "0.591333", "text": "def left_child_index(n)\n (n + 1) * 2 - 1\nend", "title": "" }, { "docid": "3267e7cf85e1b3ad7e41c891412b83fc", "score": "0.5910354", "text": "def current_word_and_range_and_index\n iterated_chars = 0\n this_is_the_word = false\n words.each.with_index do |word, index|\n word_started_on = iterated_chars\n word.each_char do |char|\n this_is_the_word = true if iterated_chars == line.cursor_index - 1\n iterated_chars = iterated_chars + 1\n end\n word_ended_on = iterated_chars - 1\n return [word, word_started_on..word_ended_on, index] if this_is_the_word\n\n # For the space character\n iterated_chars = iterated_chars + 1\n end\n return [\"\", line.cursor_index..line.cursor_index, words.count]\n end", "title": "" }, { "docid": "fffeb41e7ac64c1b17893b4afe49027c", "score": "0.58984035", "text": "def get_pos(index)\r\n return [index/9, index%9]\r\n end", "title": "" }, { "docid": "935770d5b8587c8e4521864d6fe6bd2b", "score": "0.58978397", "text": "def test_that_getPhrase_invalid_index\n words = [\"this\", \"is\", \"an\", \"awesome\", \"test\"]\n phrasesLength = 2\n index = -1\n expected = \"\"\n actual = DetectPlagiarism::getPhrase(words, index, phrasesLength)\n assert_equal(expected, actual)\n end", "title": "" }, { "docid": "7021f9e182c8a92afac112f7f754afc8", "score": "0.58940303", "text": "def find_rotation_point(words)\n\n\tfirst_word = words.first\n\n\tfloor_index = 0\n\tceiling_index = words.length - 1\n\n\twhile floor_index < ceiling_index\n\n\t\trandom_guess = (floor_index + ceiling_index) / 2\n\n\t\tif words[random_guess] >= first_word\n\t\t\tfloor_index = random_guess\n\t\telse\n\t\t\tceiling_index = random_guess\n\t\tend\n\t\treturn ceiling_index if floor_index + 1 == ceiling_index\n\tend\t\nend", "title": "" }, { "docid": "9b868272098dc93416e966180d3f20ac", "score": "0.58822817", "text": "def reverse_pos(pos)\n if pos==@tokens.size\n return 0\n else\n return tokens.size-(pos + 1)\n end\n end", "title": "" }, { "docid": "5755cf00e0d449b19b15e14697c49429", "score": "0.5878403", "text": "def input_to_index(position)\n position.to_i - 1\nend", "title": "" }, { "docid": "d587861b1f7d6930c2d4ca737b0a197f", "score": "0.5870912", "text": "def one_left arr, index\n arr[index-1]\n end", "title": "" }, { "docid": "ec36f0c31d523d9625b0a527c1a3a8a0", "score": "0.5856292", "text": "def pos(*) end", "title": "" }, { "docid": "ec36f0c31d523d9625b0a527c1a3a8a0", "score": "0.5856292", "text": "def pos(*) end", "title": "" }, { "docid": "1ba5d4bd83634eb6d37f76afa2830d7a", "score": "0.5855354", "text": "def parent_index\n (@index-1) / 2 if @index > 0\n end", "title": "" }, { "docid": "ae75c35fe13383cb829d21bb20e6a987", "score": "0.5851289", "text": "def word_at index\n @code[beginning_of_word_at(index)..index - 1]\n end", "title": "" }, { "docid": "dee4f7ef158f07fe2059db136c5d7db3", "score": "0.58383256", "text": "def start_of_word(word,number)\n word[0,number]\nend", "title": "" }, { "docid": "b61ca86e0ef8820bea527301a852cbef", "score": "0.58322614", "text": "def index_of (sentence, letter)\n\tsentence.each do |l|\n\t\tif l==letter.char\n\t\t\tputs sentence.index(l)\n\t\t\n\t\telse \n\t\t\tputs \"-1\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "4f42b8ce79eb149e1492da2a27150764", "score": "0.5831487", "text": "def solve arr\n\tarr.reverse.map.with_index { |s, i| (i == 0 ? 'Begin ' : arr[-i].start_with?('Left') ? 'Right ' : 'Left ') + s.split[1..-1].join(' ') }\nend", "title": "" }, { "docid": "840796112893a8e9eb76b6274e9c60a3", "score": "0.5811205", "text": "def parenthetical_matcher(sentence, pos)\n\n par_number = 0\n test_number = nil\n sentence.each_char.with_index do |char, idx|\n if char == '('\n par_number += 1\n elsif char == ')'\n par_number -=1\n return idx if test_number && test_number > par_number\n end\n if idx == pos\n test_number = par_number\n end\n end\n nil\nend", "title": "" }, { "docid": "e17978e466ce55211ad9628acaffe37e", "score": "0.58078206", "text": "def original_word_offset(slot_index)\n word_alignment = case word\n when :source\n segment.source_alignment\n when :dest\n segment.dest_alignment\n else\n raise RuntimeError.new(\"Invalid word value #{word}\")\n end\n word_alignment[0..slot_index].find_all do |p|\n not p.nil?\n end.length - 1\n end", "title": "" }, { "docid": "fd64880c4001cfd682b63bae2a0fb3ec", "score": "0.5806854", "text": "def get_precede_word(index_string, sentence)\n return \"\" if index_string.empty?\n precede_index = index_string.split(\",\").map { |e| e.to_i }.sort.first\n return sentence.split(\" \")[precede_index - 1]\n end", "title": "" }, { "docid": "04781d835f5df83b87e82dab00bc08b1", "score": "0.5806579", "text": "def input_to_index(position) \n position.to_i - 1 #.to_i changes to an integer\nend", "title": "" }, { "docid": "72617dd0afd26b818593b39edc08b692", "score": "0.5805566", "text": "def start_of_word(word, n)\n\tword[0,n]\nend", "title": "" }, { "docid": "657e1970960acc48cd23c68ba6a272d7", "score": "0.5802291", "text": "def input_to_index(position)\n pos = position.to_i\n pos = pos - 1\n return pos\nend", "title": "" }, { "docid": "7114acfee6d50fe0843379a654de2679", "score": "0.57950217", "text": "def change_to_idx(ltr, idx)\n ltr_to_idx = -1\n\n case ltr\n when 'a'\n ltr_to_idx = 0\n when 'b'\n ltr_to_idx = 1\n when 'c'\n ltr_to_idx = 2\n when 'd'\n ltr_to_idx = 3\n when 'e'\n ltr_to_idx = 4\n when 'f'\n ltr_to_idx = 5\n when 'g'\n ltr_to_idx = 6\n when 'h'\n ltr_to_idx = 7\n end\n\n [idx.to_i - 1, ltr_to_idx]\n end", "title": "" }, { "docid": "dc6ad0d74de9173d387d3be71e36ec23", "score": "0.57944554", "text": "def start_of_word(word, position)\r\n #puts word.length\r\n result = [] #declare array\r\nif position > 0 #as array inital position starts at zero\r\n endat = position-1\r\n else\r\n endat = position\r\nend\r\n 0.upto(endat) do |idx|\r\n result << word[idx]\r\n end\r\n result.join(\"\")\r\nend", "title": "" }, { "docid": "b97be17f9700d1004e08e69eb79dd011", "score": "0.5789031", "text": "def alphabet_position(text)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n alphabetLetters = alphabet.split(\"\")\n textLetters = text.split(\"\")\n translated = []\n textLetters.map{|eachLetter|\n alphabetLetters.map.with_index { |letter, index| \n if eachLetter.downcase === letter\n translated.push(index+1)\n end\n }\n } \n return translated.join(\" \")\nend", "title": "" }, { "docid": "97c74e28f4c19d11e54488dbdf78db43", "score": "0.57867163", "text": "def right_child_index(n)\n (n + 1) * 2\nend", "title": "" }, { "docid": "5b44cc186ab35d20230b0ff578c48cd5", "score": "0.57658076", "text": "def other_index(index)\n if index == 1 \n index = 0\n else\n index = 1\n end\n return index\n end", "title": "" }, { "docid": "75586b4178e5d74a41ae2eca8ae04864", "score": "0.57641894", "text": "def input_to_index(ind_str)\n ind_str.to_i - 1\nend", "title": "" }, { "docid": "75586b4178e5d74a41ae2eca8ae04864", "score": "0.57641894", "text": "def input_to_index(ind_str)\n ind_str.to_i - 1\nend", "title": "" }, { "docid": "8350514fdef7e14c10ab9997d9be8ec4", "score": "0.5758925", "text": "def range_correct_index( at )\n index = at\n# index = self.length + at if at < 0\n raise \"index not integer #{at.class}\" unless at.is_a?(::Integer)\n raise \"index must be positive , not #{at}\" if (index < 0)\n raise \"index too large #{at} > #{self.length}\" if (index >= self.length )\n return index + Word.type_length * 4\n end", "title": "" }, { "docid": "55bcba211a46c86d0045520a008dd8c9", "score": "0.5753175", "text": "def two_left arr, index\n arr[index-2]\n end", "title": "" }, { "docid": "70c288d47cf99ed8f9c8de6f2e3a233d", "score": "0.574822", "text": "def at(index)\n rindex = index-@llength\n if rindex<0\n @left.at(index)\n else\n @right.at(rindex)\n end\n end", "title": "" }, { "docid": "1c076db20b5def96128e7ded2532f181", "score": "0.5743704", "text": "def english_to_pig(english)\n print english[1..-1].to_s + english[0].to_s + \"ay\"\n #[1..-1] gives index 1 through end\nend", "title": "" }, { "docid": "582dce5e68f430ec865abf327eaa49fe", "score": "0.574329", "text": "def char_at(index)\n # Translate to positive index if given a negative one\n if index < 0\n index += @length\n end\n\n # Falls outside bounds\n return nil if index >= @length\n\n rindex = index - @left.length\n if rindex < 0\n # Requested index is in the left subtree\n @left.char_at(index)\n else\n # Requested index is in the right subtree\n @right.char_at(rindex)\n end\n end", "title": "" }, { "docid": "20c053cd0a7da0ce814d15fcc5845b9d", "score": "0.57409704", "text": "def parentheticals(sentence, start)\n return nil unless sentence[start] == \"(\"\n to_close = 0\n (start + 1...sentence.length).each do |idx|\n if sentence[idx] == \"(\"\n to_close += 1\n elsif sentence[idx] == \")\"\n return idx if to_close == 0\n to_close -= 1\n end\n end\n nil\nend", "title": "" }, { "docid": "83937aed363d771afb1427b9216068ee", "score": "0.5735538", "text": "def find_index(word, list)\n\n index = 0\n\n while index > 0.length do\n\n if (______[index] == _______)\n\t\n\treturn ______\n end\n end\n\n return ______\nend", "title": "" }, { "docid": "831da614dbc2d88d4c9783eb2c0cf27b", "score": "0.5731764", "text": "def to_pos( ii )\n pos = \"#{INDEX_ALPHA[ ii[0] ]}#{ii[1] + 1}\"\nend", "title": "" }, { "docid": "9711d2bb9046ac64db17c898a9e2dec4", "score": "0.57307285", "text": "def wrap_index(i)\n i < 0 ? (i + length) : i\n end", "title": "" }, { "docid": "534b3cab3a68142730fce2ae45879f30", "score": "0.5729579", "text": "def rotation_point(words)\n alphabet = (\"a\"..\"z\").to_a\n first_letters = words.map { |word| alphabet.index(word.chars.first) }\n for i in 1..first_letters.length - 1\n rotation_index = first_letters[i] if first_letters[i] < first_letters[i - 1]\n end\n rotation_word = words.find { |word| word if word.start_with?(alphabet[rotation_index]) }\n p words.index(rotation_word)\nend", "title": "" }, { "docid": "2f45e1e1f85916d39cf3cc807e09f1f0", "score": "0.5727471", "text": "def __wlang_column_of(index)\n return 1 if index == 0\n newline_index = rindex(\"\\n\", index - 1)\n if newline_index\n index - newline_index\n else\n index + 1\n end\n end", "title": "" }, { "docid": "9b6d744440edd26cc48dd3373dae9924", "score": "0.5724246", "text": "def input_to_index(position)\n index = position.to_i - 1\n #index = position - 1\n return index\nend", "title": "" }, { "docid": "97c35554566df9a7c169c3cebe904909", "score": "0.5720724", "text": "def words_index(my_words)\r\n words_index = []\r\n holder = my_words[0] != \" \"\r\n\r\n if my_words[0] != \" \"\r\n words_index << 0\r\n end\r\n\r\n my_words.length.times do |i|\r\n if holder == true\r\n words_index << i-1 if my_words[i] == \" \"\r\n elsif holder == false\r\n words_index << i if my_words[i] =~ /[A-Za-z]/ ? true : false\r\n end\r\n holder = my_words[i] != \" \"\r\n end\r\n\r\n if words_index.length % 2 == 1\r\n words_index << my_words.length - 1\r\n end\r\n\r\n return words_index\r\nend", "title": "" }, { "docid": "ed8651a749fa6bc0752a6964817fd5d5", "score": "0.5715419", "text": "def find_next_index(term, start, reverse)\n i = start\n while i < data.size && i >= 0\n if data[i][1] =~ /#{term}/\n return i\n end\n i += reverse ? -1 : 1\n end\n nil\n end", "title": "" }, { "docid": "7d074a68a16d931d811dfe9e0ab86f93", "score": "0.5715347", "text": "def index(x, y)\n (y - 1) * width + (x - 1)\n end", "title": "" }, { "docid": "56f8451fa12c9870e210fed27556a0a8", "score": "0.57144684", "text": "def start_of_word (mots,s)\n return mots[0,s]\n \n end", "title": "" }, { "docid": "006107e52089373f4350e427188268e2", "score": "0.5711782", "text": "def pair_pos\n right? ? position - 1 : position + 1\n end", "title": "" }, { "docid": "ee32172d410c4e6a7fee600a772a0f43", "score": "0.56951046", "text": "def start_of_word(word, x)\r\n word[0..(x-1)]\r\nend", "title": "" }, { "docid": "8b47fdc0219a15482938e0c9d1bf8bfd", "score": "0.56941915", "text": "def token_start(line,idx)\n (0...idx).reduce(0) { |pos, i|\n line.index(\" \",pos+1) || 0\n }\nend", "title": "" }, { "docid": "4dffba54592c16db7f22c397bede7fa5", "score": "0.5683551", "text": "def find_match_forward(text)\n @position = -1 if @position == length - 1 && @cycle\n offset = @position ? @position + 1 : 0\n @history[offset..-1].detect.with_index do |item, index|\n if item.start_with?(text)\n @position = index + offset\n end\n end\n end", "title": "" }, { "docid": "24e13ab7d07a22592172e08b30fb67a5", "score": "0.5680152", "text": "def index_from_start(index); end", "title": "" }, { "docid": "179c90b38d1a742b2f3442a68dacef4b", "score": "0.5677351", "text": "def prepend_idx\n @text_field.text.index('<')\n end", "title": "" }, { "docid": "72437be833fecf8999d9e39661586311", "score": "0.5676793", "text": "def index str, offset = 0\n result = 0\n _end = 0\n @chunks.each { |e| txt = e.text; \n _end += txt.length \n if _end < offset\n result += e.text.length \n next\n end\n\n ix = txt.index(str) \n if ix\n _off = result + ix\n return _off if _off > offset\n end\n result += e.text.length \n }\n return nil\n end", "title": "" }, { "docid": "c57896e7dbaae37de7cd104ebd5cdbbb", "score": "0.56753814", "text": "def index_of_x(string)\n\nend", "title": "" }, { "docid": "62108af4ae40357b4ae99c1e45496f44", "score": "0.56737655", "text": "def spliced_motif_index(main, motif)\n\t\tindices = []\n\t\tstarter = 0\n\n\t\t(0...motif.length).each do |a|\n\t\t\tindices << (main[starter..-1].split(\"\").index(motif[a]).to_i + 1 + starter)\n\t\t\tstarter = indices[-1] \n\t\tend\n\t\tindices.join(\" \")\n\tend", "title": "" }, { "docid": "64d8b5967e3f3506ab67b427b187e960", "score": "0.5669681", "text": "def adj(str)\n words = str.split(\" \")\n index = words.find_index(\"is\")\n words[index + 1]\nend", "title": "" }, { "docid": "68a909306a00028f2673aea435964b8f", "score": "0.5667318", "text": "def search(text)\n n = text.length\n i,j = 0, 0\n for i in (0...n)\n for j in (0...m)\n j = @dfa[text[i]][j]\n end\n if (j == m)\n return (i - m)\n else\n return n\n end\n end\n end", "title": "" }, { "docid": "f420b86ec588366e9c95cbe1ba89a5ca", "score": "0.56660235", "text": "def start_pos; end", "title": "" }, { "docid": "b26200e28835202ed4b615f58db0aee5", "score": "0.56655324", "text": "def from_line_index\n from_line - 1\n end", "title": "" }, { "docid": "c766cfd7f22cf8b7020297a495a3b310", "score": "0.56651896", "text": "def pos\n return 0\n end", "title": "" }, { "docid": "48412710c08492591f41ec0553b303ce", "score": "0.56577814", "text": "def starting_position; end", "title": "" }, { "docid": "6c86abc666aa60387fbf88cf47790bc6", "score": "0.5656483", "text": "def binary_search(str, min_index, max_index)\n while min_index < max_index\n check_index = min_index + ((max_index - min_index) / 2).floor\n check = @sorted_words[check_index]\n case str <=> check\n when -1 \n max_index = check_index-1\n when 0\n return check_index\n when 1\n min_index = check_index+1\n end\n end\n min_index\n end", "title": "" }, { "docid": "705ecd99ba3690c9b7137d76abb7edce", "score": "0.56555635", "text": "def left_child(index)\n tree[2 * index]\n end", "title": "" }, { "docid": "753328643f0be95e452c21600c43accd", "score": "0.5648569", "text": "def start_of_word(sentence, n)\n return sentence[0, n]\nend", "title": "" }, { "docid": "46892e8e1516308fb0996cb5315ad26a", "score": "0.5647313", "text": "def input_to_index(input)\nposition = input.to_i\nposition - 1\nend", "title": "" }, { "docid": "1d7e1c3b7db82e384cd5803a6419ed9b", "score": "0.5646127", "text": "def go_back(phrase)\r\n\tletters = \"abcdefghijklmnopqrstuvwxyz\"\r\n\torder = letters.index(phrase)\r\n\tnew_order = order - 1\r\n\r\n\tletters[new_order]\r\nend", "title": "" }, { "docid": "f9f0c7e8229863e99c986084ab00d917", "score": "0.56451476", "text": "def front_back(txt)\n txt[-1] << txt[1...-1] << txt[0]\nend", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "91efde31de9b53868e3bc31102de3b81", "score": "0.0", "text": "def group_update_params\n params.fetch(:group_update, {})\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943033", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69584733", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68889844", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.6767867", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.67359334", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.6714304", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.67059153", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6661157", "text": "def filtered_parameters; end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.6618084", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6617327", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.6589899", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.65775245", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.657274", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6572679", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f5e3a87909b3e5022047b4b0a64ca154", "score": "0.6534389", "text": "def parameter_params\n params.require(:parameter).permit(:name, :code, :description, :user_id, :value, :cargapp_model_id, :active)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6514836", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "58d1451e57b0e767db2fc6721dfaa6be", "score": "0.6513042", "text": "def allowed_parameters\n parameters.keys\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.650018", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "52d4c66cc205503f7ad6a4feaedab9b8", "score": "0.6493443", "text": "def parameter_params\n params.require(:parameter).permit(:name, :value, :description)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6489167", "text": "def need_params\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.64777386", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "e64490ed35123aafa1b4627bd165517d", "score": "0.6458361", "text": "def allowed_params\n [:title, :description, :is_template, :template_id, :user_id, :color]\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.6440062", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6432751", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.64270836", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.64221114", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.64221114", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.6380081", "text": "def filter_parameters; end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.6374248", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.635511", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.635511", "text": "def check_params; true; end", "title": "" }, { "docid": "cac0774e508766d2f487cbca3db95df0", "score": "0.6337061", "text": "def allow_params?\n definition[:param_tokens]\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.632006", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "55aa899fab0dfa44916f71c499998ca8", "score": "0.6313847", "text": "def parameter_params\n params.require(:parameter).permit(:key, :value)\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6294214", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6294214", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291491", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291491", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "64ea65f903dbe0c9c0cc0e9a20ed2e7f", "score": "0.629129", "text": "def good_option_params\n permit_params\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6274489", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6267347", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "572f75fa86537d103ddf7b5503f06515", "score": "0.62666017", "text": "def parameter_params\n params.require(:parameter).permit(:title)\n end", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.62635964", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.6259396", "text": "def filtered_params_config; end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.624394", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "63944d10aa4cde014b8332874db87cb9", "score": "0.62374204", "text": "def excluded_from_filter_parameters=(_arg0); end", "title": "" }, { "docid": "6fc2bac4c842e4285d685333ba68e5e9", "score": "0.62284017", "text": "def admin_parameter_params\n params.require(:admin_parameter).permit(:name, :inss_hour_price, :private_hour_price, :is_eval)\n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6227613", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6226146", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6226146", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.62250316", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "6008e8707eafce375988b3c7ccf098c3", "score": "0.62144554", "text": "def original_params; end", "title": "" }, { "docid": "4ba8f5cdb0399571d60b7242794ce47f", "score": "0.6204504", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "356c5fd5dcbe9214f1330792fa2e18b5", "score": "0.61944324", "text": "def param_whitelist\n whitelist = [\n :name,\n :details,\n :completed,\n :started_at, :finished_at,\n :team_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:team_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b977c2daceb28f26ee659336b2b98aa9", "score": "0.6188639", "text": "def params\n raise \"Override protected method `params'.\"\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6182235", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "706df0e25391ed2b932f54a646bb0a10", "score": "0.617931", "text": "def list_name_param opts={}\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6175902", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "8e54eaded22dd280d836e96375fed9a4", "score": "0.6174455", "text": "def paramun_params\n params.require(:parametre).permit!\n end", "title": "" }, { "docid": "19080b9212dc7ba3727f80cc9430e426", "score": "0.6172903", "text": "def special_params\n params.require(:special).permit(:name, :description, :function)\n end", "title": "" }, { "docid": "d3732ff42abd0a618a006d1f24e31e38", "score": "0.6172377", "text": "def add_to_filter_parameters; end", "title": "" }, { "docid": "f8c05c05fb596260a51d3ab4fb42243d", "score": "0.61711174", "text": "def required_parameters\n [ ]\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6165318", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "3da9117a80cdfd040f0f0ed9d3ffed55", "score": "0.61470264", "text": "def allowable_params(unfiltered_params)\n unfiltered_params.permit(:property_id, :branch_id, :client_name, :branch_name,\n :department, :reference_number, :address_name, :address_number, :address_street,\n :address2, :address3, :address4, :address_postcode, :country, :display_address,\n :property_bedrooms, :property_bathrooms, :property_ensuites, :property_reception_rooms,\n :property_kitchens, :display_property_type, :property_type, :property_style,\n :property_age, :floor_area, :floor_area_units, :property_feature1, :property_feature2,\n :property_feature3, :property_feature4, :property_feature5, :property_feature6,\n :property_feature7, :property_feature8, :property_feature9, :property_feature10,\n :price, :for_sale_poa, :price_qualifier, :property_tenure, :sale_by,\n :development_opportunity, :investment_opportunity, :estimated_rental_income,\n :availability, :main_summary, :full_description, :date_last_modified,\n :featured_property, :region_id, :latitude, :longitude,\n flags_attributes: [:title],\n images_attributes: [:url, :modified],\n floorplans_attributes: [:url, :modified],\n epc_graphs_attributes: [:url, :modified],\n epc_front_pages_attributes: [:url, :modified],\n brochures_attributes: [:url, :modified],\n virtual_tours_attributes: [:url, :modified],\n external_links_attributes: [:url, :description, :modified])\n end", "title": "" }, { "docid": "b9e34b5ac2955add85639f9ca0a07b7f", "score": "0.6146287", "text": "def resource_params\n permits = resource_whitelist\n params.require(model_symbol).permit(permits)\n end", "title": "" }, { "docid": "d646c7ba579499db9edadb606c8b9910", "score": "0.61461055", "text": "def permitted_params\n logger.warn \"#{self}: please override `permitted_params` method.\"\n params.require(resource_request_name).permit!\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143754", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143754", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6137156", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "c4a951d3ba89c6d098a96d3d5a2b8643", "score": "0.6127593", "text": "def collection_permitted_params\n params.permit(:format, :page, :per_page, :sort, :include, :locale, fields: {}, filter: {})\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.61149454", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "34fb76d8decc10cd29ada824ff70ae63", "score": "0.6112337", "text": "def permitted_resource_params\n p params[object_name].present? ? params.require(object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.61076903", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "11f5f8959aba1f4022c60509f20e40af", "score": "0.61070174", "text": "def permit_params\n params[:permit]\n end", "title": "" }, { "docid": "45791845cef485d15b7014088dd0be8d", "score": "0.6103891", "text": "def allowed_params\n %i[title body]\n end", "title": "" }, { "docid": "4632c7949842c8534d66b50254032add", "score": "0.6094513", "text": "def parameterization_params\n params.permit(:name, :user_id, :number_value, :money_value)\n end", "title": "" }, { "docid": "bfa951108b69c8eed106b7ad8acbcbfd", "score": "0.6092657", "text": "def data_param\n params.permit(:value)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.608954", "text": "def filter_params\n end", "title": "" }, { "docid": "63f5e4e9733f9e6b3f98d5e069440292", "score": "0.6083569", "text": "def black_list_params\r\n params.require(:black_list).permit(:user)\r\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.60819185", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6079775", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "44a1ec524e77d2a2c4b85e8341df27db", "score": "0.6077853", "text": "def product_params\n params.permit(:visible)\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.6075715", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "c31ef48e8fd467d94158d7ac7f405a3f", "score": "0.6074042", "text": "def list_params\n params.permit(:id, :public_id, :name, :list, :visibility, values: [])\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.6071067", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.607105", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.60698223", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "c1f13277dbc8ff3a9f65df027f9d915a", "score": "0.60634017", "text": "def permitted_params(unpermitted_params)\n unpermitted_params.permit(\n :controller,\n :action,\n :site_id,\n :format,\n :type,\n :path_contains,\n :new_url_contains,\n :tagged,\n )\n end", "title": "" }, { "docid": "cf963fb451b51d62fcc986deb020a044", "score": "0.6048556", "text": "def permit_params\n\t\t\t\teval(@configuration.get_params)\n\t\t\tend", "title": "" }, { "docid": "77b78ffc267fcf03379cf09c63ad361c", "score": "0.60401976", "text": "def gallery_params\n params.require(:gallery).permit(:name, :white_list)\n end", "title": "" }, { "docid": "be92e82ba93b35cac91b7c02d6a445f7", "score": "0.6034116", "text": "def get_params\r\n #params.require(:view_adm).permit(:name, :action_scope,:caps,:cols)\r\n params.require(:view_adm).permit!\r\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.603029", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "5b72cb3f5ae45681ff116df46f5da01b", "score": "0.6026357", "text": "def provider_params\n params.permit(:name)\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60188574", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60188574", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6018028", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6018028", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6018028", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6018028", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6018028", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6018028", "text": "def params; end", "title": "" } ]
adfcfdc1023ac4eeaf241420a3807f30
Find or create collections referenced by works If the import data also contains records for these works, they will be updated during create works
[ { "docid": "fb09b879d1d90b77ebcf0aeed4840faf", "score": "0.6226408", "text": "def create_collections\n collections.each_with_index do |collection, index|\n next if collection.blank?\n metadata = {\n title: [collection],\n work_identifier => [collection],\n visibility: 'open',\n collection_type_gid: Hyrax::CollectionType.find_or_create_default_collection_type.gid\n }\n new_entry = find_or_create_entry(collection_entry_class, collection, 'Bulkrax::Importer', metadata)\n ImportCollectionJob.perform_now(new_entry.id, current_run.id)\n increment_counters(index, true)\n end\n end", "title": "" } ]
[ { "docid": "b82f560c630f576122037a22783214a0", "score": "0.6122268", "text": "def member_of_collections\n base = model.member_of_collections\n return base unless @controller.params[:add_works_to_collection]\n base + [::Collection.find(@controller.params[:add_works_to_collection])]\n end", "title": "" }, { "docid": "86a675633f63ef49e1f60d0bda461479", "score": "0.56503975", "text": "def create_collections\n self.collections.each do |collection_name|\n self.add_collection(collection_name)\n end\n end", "title": "" }, { "docid": "19fb14de9ad38439883e837e9115444c", "score": "0.5630497", "text": "def work_child_collection_parent(work_id)\n attrs = { id: work_id, collections: [{ id: entry&.factory&.find&.id }] }\n Bulkrax::ObjectFactory.new(attributes: attrs,\n source_identifier_value: child_works_hash[work_id][entry.parser.source_identifier],\n work_identifier: entry.parser.work_identifier,\n collection_field_mapping: entry.parser.collection_field_mapping,\n replace_files: false,\n user: user,\n klass: child_works_hash[work_id][:class_name].constantize).run\n ImporterRun.find(importer_run_id).increment!(:processed_children)\n rescue StandardError => e\n entry.status_info(e)\n ImporterRun.find(importer_run_id).increment!(:failed_children)\n end", "title": "" }, { "docid": "9c25e4b165314f35e30a04e55d584bce", "score": "0.5628174", "text": "def create_new_collection_maybe repo, collection, collection_title, parent_collection, source_base_url, source_collection\n\n\n if all_existing_collections(repo).include? collection\n puts \"Collection #{collection} already exists, skipping\"\n return\n else\n puts \"Creating collection #{collection}, '#{collection_title}', in #{parent_collection}\"\n end\n\n collection = \"info:fedora/#{collection}\" unless collection =~ /^info:fedora/\n parent_collection = \"info:fedora/#{parent_collection}\" unless parent_collection =~ /^info:fedora/\n\n # get all the datastream data we need first, before we create a the\n # destination collection, so on error we don't need to clean up.\n\n thumbnail_image, thumbnail_type = get_thumbnail(source_base_url, source_collection)\n collection_policy = create_new_collection_policy_from_existing(repo, source_collection)\n\n desc_info = get_desc_text(repo, source_collection)\n banner_info = get_banner(repo, source_collection)\n\n collection_object = repo.create(collection)\n\n collection_object.memberOfCollection << parent_collection\n collection_object.models << 'info:fedora/islandora:collectionCModel'\n collection_object.label = collection_title\n collection_object.ownerId = OWNER\n\n if banner_info[:content]\n ds = collection_object.datastreams['BANNER']\n ds.dsLabel = banner_info[:label]\n ds.content = banner_info[:content]\n ds.mimeType = banner_info[:type]\n end\n\n\n if desc_info[:content]\n ds = collection_object.datastreams['DESC-TEXT']\n ds.dsLabel = desc_info[:label]\n ds.content = desc_info[:content]\n ds.mimeType = desc_info[:type]\n end\n\n ds = collection_object.datastreams['TN']\n ds.dsLabel = \"Thumbnail\"\n ds.content = thumbnail_image\n ds.mimeType = thumbnail_type\n\n ds = collection_object.datastreams['COLLECTION_POLICY']\n ds.dsLabel = \"Collection Policy\"\n ds.content = collection_policy\n ds.mimeType = 'text/xml'\n ds.controlGroup = 'X'\n\n collection_object.save\n\n # we'll wait up to 15 seconds for the collection to be created\n\n # for some reason we're not getting these showing up in a timely manner....\n\n # 30.times do\n # sleep 0.5\n # return if all_existing_collections(repo).include? collection\n # end\n # raise \"Could not create collection #{collection}\"\n\nend", "title": "" }, { "docid": "89fbf42bef1291135f97d0096ff3bff0", "score": "0.55850136", "text": "def creatable_works\n all_works.select do |work|\n can?(:create, work)\n end\n end", "title": "" }, { "docid": "d978ac4e059344e3a7e889d67f1e25f8", "score": "0.55485255", "text": "def works_to_solr\n base = {}\n work = self.work\n base[:work_ids] = work ? work.id : nil\n base[:work_genres] = work ? work.genres.map{|g|g.value.split('::').first} : nil# classifiable\n base[:work_title] = work ? work.title : nil\n base[:work_year] = work ? work.year : nil\n base[:work_year_sort] = work ? work.year_integer : nil\n base[:work_literary_period] = work ? LiteraryPeriods.map(work.year_integer).map{|v|v.first} : nil\n base[:work_printer] = work ? work.printer : nil\n base[:work_place_of_publication] = work ? work.place_of_publication : nil\n base[:work_citation] = work ? work.citation : nil\n base[:work_composed] = work ? work.composed : nil\n base[:work_notes] = work ? work.notes : nil\n base\n end", "title": "" }, { "docid": "1a65221972588b971993450b900fa5ba", "score": "0.55391014", "text": "def update_collection(collection, collection_name, constructor, create=true)\n old_collection = @workshop.send(collection_name)\n old_collection_ids = old_collection.map(&:id)\n new_collection_ids = collection.map { |element| element[:id] }\n\n old_collection.each do |element|\n if !new_collection_ids.include?(element.id)\n element.destroy\n end\n end\n\n collection.each do |element|\n\n # The horror is here\n\n if !old_collection_ids.include?(element[:id])\n if create\n object = constructor.new(element.except(:image_id))\n @workshop.send(collection_name).push object\n else\n @workshop.send(collection_name).push constructor.find_by(id: element[:id])\n end\n else\n object = constructor.find_by(id: element[:id])\n object.update(element.except(:id, :image_id))\n end\n\n # And here is really scary too\n\n if element[:image_id].present?\n image = HostImage.find_by(id: element[:image_id])\n object.image = image\n end\n end\n\n @workshop.save\n end", "title": "" }, { "docid": "abd0aeb84c1135ca292a04189c2b55f2", "score": "0.5531564", "text": "def creations\n find_related_frbr_objects( :creates, :which_works?) \n end", "title": "" }, { "docid": "99a53257c3961bb3c3e3f994720d3d7f", "score": "0.5530192", "text": "def make_thesis_collection_structure(mapping_path, foxpath, user)\r\nputs \"running make_collection_structure\"\r\nmapping_file = mapping_path +\"col_mapping.txt\"\r\n# make the top Theses level first, with a CurationConcerns (not dlibhydra) model.\r\n#array of lines including title\r\ntopmapping = []\r\n# we also need a pid:id hash so we can extract id via a pid key\r\nidmap ={}\r\ntoppid = \"york:18179\" #top level collection\r\ntopcol = Object::Collection.new\r\ntopcol.title = [\"Masters dissertations\"]\r\ntopcol.former_id = [toppid]\r\ntopcol = populate_collection(toppid, topcol, foxpath) \r\n#the top collection is visible to the general public but not the underlying records or collections\r\ntopcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\ntopcol.depositor = user\r\ntopcol.save!\r\ntopcol_id = topcol.id.to_s\r\nputs \"topcol.id was \" +topcol.id\r\nmappings_string = toppid + \",\" + + topcol.title[0].to_s + \",\" + topcol_id \r\n\ttopmapping.push(mappings_string) \r\n# write to file as permanent mapping that we can use when mapping theses against collections \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\nopen(mapping_file, \"a+\")do |mapfile|\r\nmapfile.puts(topmapping)\r\nend\r\n\r\n=begin\r\nnow we need to read from the list which I will create, splitting into appropriate parts and for each create an id and add it to the top level collection\r\n=end\r\n# hardcode second level file, but could pass in as param\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2SMALL.txt\")\r\nlevel2file = mapping_path + \"thesescollectionsLevel2.txt\"\r\ncsv_text = File.read(level2file)\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2.txt\")\r\ncsv = CSV.parse(csv_text)\r\n# we also need a file we can write to, as a permanent mapping\r\nmappings_level2 = []\r\n\r\nputs \"starting second level(subjects)\"\r\ncsv.each do |line|\r\n puts line[0]\r\n\tcol = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new\r\n\t#col.title = [line[1]]\r\n\ttitle = line[1]\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\tcol.title = [title]\r\n\tcol.former_id = [line[0].strip]\r\n\tcol = populate_collection(line[0].strip, col, foxpath)\r\n\tcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tcol.depositor = user\r\n\tcol.save!\r\n\tcol_id = col.id.to_s\r\n\tputs \"subject col id was\" + col_id\r\n\ttopcol.members << col\r\n\ttopcol.save!\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + col_id \r\n\tmappings_level2.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = line[0]\t\r\n\tidmap[key] = col.id\r\nend\r\n\r\n# write to file as permanent mapping that we can use when mapping theses against collections\r\nopen(mapping_file, \"a+\")do |mapfile| \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level2)\r\nend\r\n\r\n# but we still have our mappings array, so now use this to make third level collections\r\n\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\n\r\n# read in third level file\r\nmappings_level3 = []\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3SMALL.txt\")\r\nlevel3collsfile = mapping_path + \"thesescollectionsLevel3.txt\"\r\ncsv_text3 = File.read(level3collsfile)\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3.txt\")\r\ncsv_level3 = CSV.parse(csv_text3)\r\n\r\nyearpidcount = 1\r\nputs \"starting third level (years)\"\r\ncsv_level3.each do |line|\r\nyearpidcount = yearpidcount +1\r\n puts \"starting number \" +yearpidcount.to_s+ \" in list\"\r\n puts line[0]\r\n\tyear_col = Object::Collection.new\r\n\tputs \"started new year collection\"\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_st \r\n\tputs \"got level 3 title which was \" + year_col_title\r\n\tyear_col.title = [year_col_title.gsub!(\"&amp;\", \"&\")] #just in case\r\n\tyear_col.former_id = [line[0].strip]\r\n\tyear_col = populate_collection(line[0].strip, year_col, foxpath)\r\n\tyear_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tyear_col.depositor = user\r\n\tputs \"saved permissions and depositor for year collection\"\r\n\tyear_col.save!\r\n\tputs \"saved collection\"\r\n\tyear_col_id = year_col.id.to_s\r\n\tputs \"year col id was \" + year_col_id\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2]# old parent pid, key to find new parent id\r\n\tputs \" subject col pid was \" + parent_pid\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tputs \"mapped parent id was \" + mapped_parent_id\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << year_col\r\n\tputs \"parent id was\" + parent.id.to_s\r\n\tputs \"year collection id was\" + year_col.id.to_s\r\n\tparent.save!\r\n\tputs \"parent.members were\" + parent.members.to_s\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + year_col_id \r\n\tmappings_level3.push(mappings_string)\r\nend\r\n\r\n# and write to permanent mapping file - these can be all the same whether level 2 or 3 or 1\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level3)\r\nend\r\n\r\nputs \"done\"\r\n=begin\r\ninformation we need for each collection is the old pid as a key, plus its parent pid, plus the collection name and the new id once it is created\r\ntop level will be the top level theses ie current Masters Dissertations (york:18179). \r\nsecond level is discipline eg Archaeology, Education etc\r\nOPTIONAL third level is year eg 1973. Not all disciplines have this level\r\n=end\r\nend", "title": "" }, { "docid": "db4fbe7c36a5b4b8656ddc08d06f4453", "score": "0.55026275", "text": "def _find_or_update_or_build_collection!\n return _flexi_collection if _flexi_collection.present?\n\n # Find existing collection\n self._flexi_collection = COLLECTION.find_by_namespace_and_name_and_partition_id(\n self.class.get_flexi_namespace,\n self.class.flexi_collection_name,\n self.class.flexi_partition_id\n )\n\n # Update if schema changed\n if self._flexi_collection\n _update_schema\n else\n _build_collection\n end\n\n self._flexi_collection\n end", "title": "" }, { "docid": "e5a1ed365c55d5914dd3115b9e92c514", "score": "0.5491763", "text": "def import_work_representations\n\n # json file list\n work_representations_url = \"http://telephoneassets.satellitecollective.org/\"\n\n @data_report = \"<h2>Starting work representations import</h2>\";\n\n @data_report << \"<h3>Opening work representations URL: #{work_representations_url}</h3>\";\n work_representations_json = open(work_representations_url).read\n work_representations = JSON.parse(work_representations_json) \n \n worksList = Work.all\n worksList.each do |localWork|\n \n # Work representations\n work_representations_for_this_work = 0 \n work_representations.each do |filename| \n\n if filename.start_with?(localWork.full_orig_id)\n \n tmp_fileext = filename.split(\".\").pop.downcase.chomp\n tmp_url = work_representations_url + URI::encode(filename.chomp)\n # If the file is a markdown file, store the actual text contents instead of a URL to the work\n if tmp_fileext == \"md\"\n localRep = WorkRepresentation.create(\n work_id: localWork.id,\n url: tmp_url,\n fileext: tmp_fileext,\n text_body_markdown: open(tmp_url).read\n )\n # If the file is a text file with just a URL in it, store the contents in URL\n elsif tmp_fileext == \"url\" \n localRep = WorkRepresentation.create(\n work_id: localWork.id,\n url: open(tmp_url).read,\n fileext: tmp_fileext\n ) \n # Otherwise just import a URL to the work representation\n else\n localRep = WorkRepresentation.create(\n work_id: localWork.id,\n url: tmp_url,\n fileext: tmp_fileext,\n )\n end\n work_representations_for_this_work += 1\n end\n \n end # work_representations each \n\n @data_report << \"<div>Work representations added: #{work_representations_for_this_work.to_s}</div>\"\n \n end # works end \n \n end", "title": "" }, { "docid": "a5ed3cffacdaa9cb7455a4f1e169d93d", "score": "0.5491278", "text": "def collection_associations(items)\n items.each_value do |collection|\n puts \"\"\n puts \" #{collection.name}'s records\"\n # dump the collection itself\n write_model(collection)\n\n # add related works.\n # if the work is private or unrevealed it will get culled in the works_associations task\n if MULTI\n collection.collection_items.find_in_batches(:batch_size => collection.collection_items.size/N + 1 ) do |items|\n item = items.sample\n write_model(item)\n work = item.work\n WORKS[work.id] = work if work\n end\n else\n # dunno if you should really get all the works in your collection, but we don't use the\n # non-MULTI version right now anyway so it doesn't really matter\n collection.works.each {|w| WORKS[w.id] = w }\n end\n\n # add participants and their related pseuds\n collection.collection_participants.each {|x| write_model(x)}\n collection.collection_participants.each {|p| PSEUDS[p.pseud.id] = p.pseud if p.pseud }\n\n # add the rest of the associations\n write_model(collection.collection_profile)\n write_model(collection.collection_preference)\n collection.prompts.each {|x| write_model(x)}\n collection.signups.each {|x| write_model(x)}\n collection.assignments.each {|x| write_model(x)}\n collection.claims.each {|x| write_model(x)}\n\n # challenge associations\n c = collection.challenge\n if c\n write_model(c)\n write_model(c.request_restriction)\n write_model(c.prompt_restriction) if c.prompt_restriction\n if collection.challenge_type == \"GiftExchange\"\n write_model(c.offer_restriction) if c.offer_restriction\n end\n end\n\n end\nend", "title": "" }, { "docid": "176967775c382658535732f0579c4bcb", "score": "0.5477715", "text": "def find_or_create_resource_for_collection(name); end", "title": "" }, { "docid": "56395cfed91682f7f883e20af710b8f9", "score": "0.5419894", "text": "def collection_documents\n # allow a standard key to be used for doing defaults in YAML\n fixtures.delete('DEFAULTS')\n\n # track any join collection we need to insert later\n documents = Hash.new\n\n documents[class_name] = fixtures.map do |label, fixture|\n attributes = fixture.to_hash\n\n next attributes if model_class.nil?\n\n set_attributes_timestamps(attributes, model_class)\n \n # interpolate the fixture label\n attributes.each do |key, value|\n attributes[key] = value.gsub(\"$LABEL\", label) if value.is_a?(String)\n end\n\n attributes['_id'] = self.class.identify(class_name, label)\n\n model_class.relations.each do |name, relation|\n case relation.macro\n when :belongs_to\n if value = attributes.delete(relation.name.to_s)\n id = self.class.identify(relation.class_name, value)\n if relation.polymorphic? && value.sub!(/\\s*\\(([^)]*)\\)\\s*/, '')\n type = $1\n attributes[relation.foreign_key.sub(/_id$/, '_type')] = type\n id = self.class.identify(type, value)\n end\n attributes[relation.foreign_key] = id\n end\n when :has_many\n if values = attributes.delete(relation.name.to_s)\n values.each do |value|\n id = self.class.identify(relation.class_name, value)\n if relation.polymorphic?\n self.class.create_or_update_document(relation.class_name.constantize, {\n '_id' => id,\n \"#{relation.as}_id\" => attributes['_id'],\n \"#{relation.as}_type\" => model_class.name,\n })\n else\n self.class.create_or_update_document(relation.class_name.constantize, {\n '_id' => id,\n relation.foreign_key => attributes['_id'],\n })\n end\n end\n end\n when :has_and_belongs_to_many\n if values = attributes.delete(relation.name.to_s)\n key = \"#{relation.name.to_s.singularize}_ids\"\n attributes[key] = []\n\n values.each do |value|\n id = self.class.identify(relation.class_name, value)\n attributes[key] << id\n\n self.class.create_or_update_document(relation.class_name.constantize, {\n '_id' => id,\n relation.inverse_foreign_key => [attributes['_id']]\n })\n end\n end\n end\n end\n\n attributes\n end\n\n return documents\n end", "title": "" }, { "docid": "00af11a9e815921651b0f9b4085752a9", "score": "0.540413", "text": "def admin\n @works = Work.find(:all)\n end", "title": "" }, { "docid": "93cf97bc6e23f503341091309dd51a4f", "score": "0.5399625", "text": "def add_collection(project, collection_id)\n if (project == nil or collection_id == nil or collection_id.blank?)\n add_col_err = true\n return false\n end\n \n collection = Collection.find(collection_id)\n collection.update_attributes(:project_id => project.id) #is this code needed?\n \n collection.documents.each do |doc|\n doc_id = doc.id\n add_doc(project, doc_id)\n end\n \n add_col_err = false\n return true\n end", "title": "" }, { "docid": "c4413cadb79411173434067e9be6bbbe", "score": "0.5385684", "text": "def add_collection_to_solr(solr_parameters)\n solr_parameters[:fq] << \"collection_ss:#{get_repository_admin_code(blacklight_params[:collection])}\" unless get_repository_admin_code(blacklight_params[:collection]).nil?\n end", "title": "" }, { "docid": "a1908addf252d535871912e7806372b0", "score": "0.53832394", "text": "def create_automated_archive_works(archivist, db, options = {})\n # get set up to create the works\n @storyparser ||= StoryParser.new\n storyparser_options = {\n :do_not_set_current_author => true,\n :archivist => archivist,\n :importing_for_others => true,\n :post_without_preview => true,\n :encoding => (options[:encoding] || \"iso-8859-1\")\n }.reverse_merge((options[:storyparser_options] || {}))\n \n work_ids = []\n errors = []\n db.each do |work_params|\n begin\n # clean out any attributes we want to use for processing but that aren't part of AO3 work attributes\n location = work_params.delete(:location)\n filetype = work_params.delete(:filetype)\n url = options[:base_url] + \"/#{location}.#{filetype}\"\n \n # check to see if it's already imported\n work = Work.find_by_imported_from_url(url)\n if work\n # TESTING\n work.destroy\n # collection_names = work_params[:collection_names].split(/,\\s?/)\n # Collection.where(:name => collection_names).each do |c|\n # work.collections << c unless work.collections.include?(c)\n # puts \"Added existing work #{work.title} to #{c.title}\"\n # end\n # next # don't recreate the work\n end \n\n # get the author\n if @author_email\n # we're still testing, use this one\n work_params[:email] = @author_email\n end\n external_author_name = @storyparser.parse_author_common(work_params.delete(:email), work_params.delete(:author))\n \n # create the work and set it up\n work = @storyparser.set_work_attributes(Work.new(work_params), url, \n storyparser_options.merge(:external_author_name => external_author_name,\n :imported_from_url => url))\n\n # check for errors\n if work && work.valid?\n puts \"Loaded work: #{work.external_creatorships.first}\"\n work.chapters.each {|chap| chap.save}\n work.save\n\n # get the comments\n if options[:load_comments] && options[:comment_parse_method]\n load_automated_archive_comments_for_work(work, options[:base_dir], location, options[:comment_parse_method])\n end\n \n work_ids << work.id\n else\n errors << \"Problem with #{work_params[:title]}: \" + work.errors.full_messages.join(', ')\n end\n rescue Exception => e\n errors << \"We ran into a problem on #{work_params[:title]}: \" + e.message # + e.backtrace.join(\"\\n\")\n end\n end\n\n puts errors.join(\"\\n\") \n return work_ids \n end", "title": "" }, { "docid": "b6165f9f8231dd85d2c3b7ccc027671c", "score": "0.5354363", "text": "def to_open_search_collections(document, hits, params, url, for_atom = true, cwic_testing = false)\n # Insert granules descriptor document link\n doc, subtitle_node = to_open_search_common(document, hits, params, 'collection')\n granule_osdd_link = add_link_as_sibling(doc, subtitle_node, \"#{ ENV['opensearch_url']}/granules/descriptor_document.xml\", 'application/opensearchdescription+xml', NEW_REL_MAPPING[:search])\n add_nav_links(doc, granule_osdd_link, hits, params, url)\n\n doc.root.children.each do |node|\n if node.name == 'title'\n node.content = 'CMR collection metadata' if node.content == 'CMR dataset metadata'\n end\n if node.name == 'entry'\n short_name = nil\n version_id = nil\n data_center = nil\n archive_center = nil\n dif_id = nil\n guid = nil\n start_time = nil\n end_time = nil\n id = nil\n id_node = nil\n mbr = nil\n has_granules = false\n create_cwic_osdd_link = false\n is_geoss = false\n is_eosdis = false\n is_fedeo = false\n provider_osdd_link = nil\n collection_specific_osdd_link = nil\n # mark the collection as CEOS if needed\n is_ceos = ceos_collection?(node)\n non_atom = []\n node.children.each do |entry_node|\n\n fix_rel(entry_node) if entry_node.name == 'link'\n add_type(entry_node) if entry_node.name == 'link'\n\n id_node = entry_node if entry_node.name == 'id'\n # this is the CMR concept-id\n id = entry_node.content if entry_node.name == 'id'\n\n entry_node[:type] = 'text' if entry_node.name == 'title'\n entry_node.content = 'CMR collection metadata' if entry_node.content == 'CMR dataset metadata'\n\n provider_osdd_link = provider_granule_osdd_collection_link(entry_node) if provider_osdd_link.nil?\n collection_specific_osdd_link = collection_specific_granule_osdd_link(entry_node, collection_specific_osdd_link)\n short_name = entry_node.content if entry_node.name == 'shortName'\n version_id = entry_node.content if entry_node.name == 'versionId'\n data_center = entry_node.content if entry_node.name == 'dataCenter'\n archive_center = entry_node.content if entry_node.name == 'archiveCenter'\n dif_id = entry_node.content if entry_node.name == 'difId'\n guid = entry_node.content if entry_node.name == 'id'\n entry_node.content = \"#{ENV['opensearch_url']}/collections.atom?uid=#{guid}\" if entry_node.name == 'id'\n start_time = entry_node.content if entry_node.name == 'start'\n end_time = entry_node.content if entry_node.name == 'end'\n entry_node[:type] = 'text' if entry_node.name == 'summary'\n mbr = generate_mbr(doc, entry_node) if entry_node.name == 'georss:polygon' || entry_node.name == 'georss:line' || entry_node.name == 'georss:point'\n # if node is not an ATOM node then remove it and put it into the array\n non_atom << entry_node.remove if !entry_node.namespace.nil? and entry_node.namespace.href != 'http://www.w3.org/2005/Atom' or entry_node.name.include? 'georss:'\n has_granules = true if entry_node.name == 'hasGranules' && entry_node.content == 'true'\n if entry_node.name == 'tag'\n create_cwic_osdd_link = cwic_collection?(entry_node, cwic_testing) unless create_cwic_osdd_link == true\n is_geoss = geoss_collection?(entry_node) unless is_geoss == true\n is_eosdis = eosdis_collection?(entry_node) unless is_eosdis == true\n is_fedeo = fedeo_collection?(entry_node) unless is_fedeo == true\n end\n end\n\n add_author(doc, id_node)\n unless dif_id.blank?\n href = \"http://gcmd.nasa.gov/getdif.htm?#{dif_id}\"\n add_link_as_child(doc, node, href, 'text/html', 'enclosure', short_name)\n end\n\n if collection_specific_osdd_link.present?\n link_title = 'Non-CMR OpenSearch Provider Granule Open Search Descriptor Document'\n add_link_as_child(doc, node, collection_specific_osdd_link, 'application/opensearchdescription+xml', NEW_REL_MAPPING[:search], link_title)\n elsif provider_osdd_link.present?\n link_title = 'Non-CMR OpenSearch Provider Granule Open Search Descriptor Document'\n add_link_as_child(doc, node, provider_osdd_link, 'application/opensearchdescription+xml', NEW_REL_MAPPING[:search], link_title)\n else\n if has_granules\n add_link_as_child(doc, node, \"#{ENV['opensearch_url']}/granules.atom?clientId=#{params[:clientId]}&shortName=#{short_name}&versionId=#{version_id}&dataCenter=#{data_center}\", 'application/atom+xml', NEW_REL_MAPPING[:search], 'Search for granules')\n end\n if create_cwic_osdd_link || has_granules\n link_title = \"Granule OpenSearch Descriptor Document\"\n if Flipper.enabled?(:use_cwic_server)\n href_link = \"#{Rails.configuration.cwic_granules_osdd_endpoint}opensearch/datasets/#{id}/osdd.xml\"\n href_link = href_link + \"?clientId=#{params[:clientId]}\" unless params[:clientId].blank?\n add_link_as_child(doc, node, href_link, 'application/opensearchdescription+xml', NEW_REL_MAPPING[:search], link_title)\n else\n href_link = \"#{ENV['opensearch_url']}/granules/descriptor_document.xml?collectionConceptId=#{id}\"\n href_link = href_link + \"&clientId=#{params[:clientId]}\" unless params[:clientId].blank?\n add_link_as_child(doc, node, href_link, 'application/opensearchdescription+xml', NEW_REL_MAPPING[:search], link_title)\n end\n end\n end\n\n add_link_as_child(doc, node, \"#{ENV['public_catalog_rest_endpoint']}concepts/#{guid}.xml\", 'application/xml', 'via', 'Product metadata')\n\n add_dc_identifier(doc, id, node)\n add_dc_temporal_extent(doc, node, start_time, end_time) unless start_time.nil? and end_time.nil?\n # Add non-atom element array\n non_atom.each do |element|\n node.add_child(element)\n end\n add_geoss(doc, node) if is_geoss\n add_ceos(doc, node) if is_ceos\n add_eosdis(doc, node) if is_eosdis\n add_fedeo(doc, node) if is_fedeo\n node.add_child(mbr) unless mbr.nil?\n end\n end\n\n # Remove all difId, onlineAccessFlag and browseFlag\n doc.xpath('//foo:difId', 'foo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//foo:onlineAccessFlag', 'foo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//foo:browseFlag', 'foo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//time:start', 'time' => 'http://a9.com/-/opensearch/extensions/time/1.0/').remove\n doc.xpath('//time:end', 'time' => 'http://a9.com/-/opensearch/extensions/time/1.0/').remove\n doc.xpath('//foo:originalFormat', 'foo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//foo:hasGranules', 'foo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove if for_atom == true\n raw_string = doc.to_xml\n opensearch_doc = Nokogiri::XML(raw_string) do |config|\n config.default_xml.noblanks\n end\n return opensearch_doc\n end", "title": "" }, { "docid": "b759fea6f57ad2c2f95d655506d2e8a1", "score": "0.53503156", "text": "def works\n\t\t@works = Work.local.with_filters(index_params, current_user).decorate\n\tend", "title": "" }, { "docid": "61c611b2f6027635ee410cb17448052f", "score": "0.5318165", "text": "def sync_tags_to_children_works\n works = works.all\n works.each do |work|\n self.tags.concat(work.tags)\n end\n self.save\n end", "title": "" }, { "docid": "842cbeee53ce6fa2757a10279517604f", "score": "0.5301588", "text": "def show_only_works_and_collections(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << 'internal_resource_ssim:(\"Collection::Archival\" OR \"Collection::Library\"' \\\n 'OR \"Collection::Curated\" OR \"Work::Submission\")'\n end", "title": "" }, { "docid": "e18bce8acd43d49a6a05575b46f1a8e5", "score": "0.52891225", "text": "def load!\n cleanup!\n\n data.each do |database_data|\n database = connection.db(database_data[\"name\"])\n\n (database_data[\"collections\"] || []).each do |collection_data|\n collection = database.create_collection(collection_data[\"name\"])\n\n (collection_data[\"documents\"] || []).each do |document_data|\n collection.insert(document_data)\n end\n end\n end\n end", "title": "" }, { "docid": "5f901c65d778713812b1e6041f143dd4", "score": "0.5285347", "text": "def test_import\n works = Work.find(:all)\n for work in works\n if !work.valid?\n puts work.work_id.to_s+\":\"+work.work_title\n end\n end\n end", "title": "" }, { "docid": "9aaf88f651d3cd8ed1ddfce732e24904", "score": "0.52776885", "text": "def all_associated_works\n results = []\n \n #works_described, superworks_described, expressions_described, manifestations_described,\n #manifestations_documented\n results = works_described + superworks_described.map{|sw| sw.works}\n \n #Now add works for the expressions\n for exp in expressions_described.flatten.uniq\n results = results + [exp.work]\n end\n \n #And now the manifestations\n #manifestations = manifestations_described + manifestations_documented\n # for man in manifestations\n # for exp in man.expressions\n # results = results + [exp.work]\n # end\n # end\n\n\n results.flatten.uniq.sort_by{|w|[w.work_title.downcase]}\n\n end", "title": "" }, { "docid": "202a97c11f699d27e570634b9ebf37f4", "score": "0.52509874", "text": "def existing_collections\n query = \"SELECT DISTINCT ?object ?title FROM <#ri> \" +\n \"WHERE { \" +\n \" ?object <fedora-model:label> ?title ; \" +\n \" <fedora-model:state> <fedora-model:Active> . \" +\n \" { ?object <fedora-model:hasModel> <info:fedora/islandora:newspaperCModel> } UNION { ?object <fedora-model:hasModel> <info:fedora/islandora:collectionCModel> } \" +\n \"}\"\n\n @repository.sparql(query).map{ |row| row[0] }\n end", "title": "" }, { "docid": "d75d1fb01e5f7da208ea10695129ee65", "score": "0.523756", "text": "def load_automated_archive_works(archivist, db, options = {})\n # get set up to create the works\n @storyparser ||= StoryParser.new\n storyparser_options = {\n :do_not_set_current_author => true,\n :archivist => archivist,\n :importing_for_others => true,\n :post_without_preview => true,\n :encoding => (options[:encoding] || \"iso-8859-1\")\n }.reverse_merge((options[:storyparser_options] || {}))\n \n work_ids = []\n errors = []\n db.each do |work_params|\n begin\n # clean out any attributes we want to use for processing but that aren't part of AO3 work attributes\n location = work_params.delete(:location)\n filetype = work_params.delete(:filetype)\n storyfile = options[:base_dir] + \"archive/#{location}.#{filetype}\"\n url = options[:base_url] + \"/#{location}.#{filetype}\"\n \n # check to see if it's already imported\n work = Work.find_by_imported_from_url(url)\n if work\n collection_names = work_params[:collection_names].split(/,\\s?/)\n Collection.where(:name => collection_names).each do |c|\n work.collections << c unless work.collections.include?(c)\n puts \"Added existing work #{work.title} to #{c.title}\"\n end\n work_ids << work.id\n next # don't recreate the work\n end \n\n # read the story file and update the work params accordingly\n story = File.read(storyfile, :encoding => 'ISO-8859-1') rescue \"\"\n work_params = self.send(options[:story_parse_method], work_params, story) \n\n # replace email when testing\n work_params[:email] = options[:author_email] if options[:author_email]\n\n # get the author\n author = work_params.delete(:author)\n emails = work_params.delete(:email)\n external_author_names = emails.split(',').map {|email| @storyparser.parse_author_common(email, author)}\n \n # create the work and set it up\n work = @storyparser.set_work_attributes(Work.new(work_params), url, \n storyparser_options.merge(:imported_from_url => url, :external_author_names => external_author_names))\n\n # check for errors\n if work && work.valid?\n puts \"Loaded work: #{work.external_creatorships.each {|ec| ec.to_s}.join}\"\n work.chapters.each do |chap| \n chap.published_at = work.revised_at\n chap.save\n end\n work.save\n work.set_word_count\n work.save\n\n # get the comments\n if options[:load_comments] && options[:comment_parse_method]\n load_automated_archive_comments_for_work(work, options[:base_dir], location, options[:comment_parse_method])\n end\n \n work_ids << work.id\n else\n errors << \"Problem with #{work_params[:title]}: \" + work.errors.full_messages.join(', ') + work_params.to_yaml\n \n end\n rescue Exception => e\n errors << \"We ran into a problem on #{work_params[:title]}: \" + e.message # + e.backtrace.join(\"\\n\")\n end\n end\n\n puts errors.join(\"\\n\") \n return work_ids \n end", "title": "" }, { "docid": "cd5ad756ff2a0a183d91893737018a9f", "score": "0.52186126", "text": "def find_or_create_collection_ids\n if parser.parser_fields['collection_id'].present?\n self.collection_ids = Array.wrap(parser.parser_fields['collection_id'])\n else\n self.collection_ids = []\n end\n self.collection_ids\n end", "title": "" }, { "docid": "daa6bf5d89e05bee0571b65b988339e2", "score": "0.52165455", "text": "def perform(work_ids, collection_id)\n Collection.find(collection_id).add_member_objects(work_ids)\n end", "title": "" }, { "docid": "e45c5462d2c65ce37c96ada3110fdc99", "score": "0.5206276", "text": "def superworks_described\n find_related_frbr_objects( :describes, :which_superworks?) \n end", "title": "" }, { "docid": "192e273eead81049fbdbe6bf51dc39fc", "score": "0.52043676", "text": "def save_building_collections(options = nil)\n if @pending_building_collections\n for rel in self.class.relations\n next unless rel.class.ann(:self, :collection)\n collection = send(rel.name.to_s)\n collection.save_building_members\n end\n @pending_building_collections = false\n end\n end", "title": "" }, { "docid": "9cdd6568f37ad70daabf27fe2c6c27ff", "score": "0.5203399", "text": "def make_exam_collection_structure(mapping_path, foxpath, user)\r\nputs \"running make_exam_collection_structure\"\r\nmapping_file = mapping_path +\"exam_col_mapping.txt\"\r\n# make the top Exams level first, with a CurationConcerns (not dlibhydra) model.\r\n#array of lines including title\r\ntopmapping = []\r\n# we also need a pid:id hash so we can extract id via a pid key\r\nidmap ={}\r\ntoppid = \"york:21267\" #top level collection\r\ntopcol = Object::Collection.new\r\ntopcol.title = [\"Exam papers\"]\r\ntopcol.former_id = [toppid]\r\ntopcol = populate_collection(toppid, topcol, foxpath)\r\n#the top collection is visible to the general public but not the underlying records or collections\r\ntopcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\ntopcol.depositor = user\r\ntopcol.save!\r\ntopcol_id = topcol.id.to_s\r\nputs \"topcol.id was \" +topcol.id\r\nmappings_string = toppid + \",\" + topcol.title[0].to_s + \",\" + topcol_id \r\ntopmapping.push(mappings_string) \r\n# add to hash, old pid as key, new id as value\r\nkey = toppid\t\r\nidmap[key] = topcol.id\r\n# write to file as permanent mapping that we can use when mapping theses against collections \r\nopen(mapping_file, \"a+\") do |mapfile|\r\nmapfile.puts(topmapping)\r\nend\r\n\r\n=begin\r\nnow we need to read from the list which I will create, splitting into appropriate parts and for each create an id and add it to the top level collection\r\n=end\r\n# hardcode second level file, but could pass in as param\r\nlevel2file = mapping_path + \"exam_colls_level2.txt\"\r\ncsv_text = File.read(level2file)\r\ncsv = CSV.parse(csv_text)\r\n# we also need a file we can write to, as a permanent mapping\r\nmappings_level2 = []\r\n\r\nputs \"starting second level(subjects)\"\r\ncsv.each do |line|\r\n puts line[0]\r\n\tcol = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new\r\n\ttitle = line[1]\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\tcol.title = [title]\r\n\tcol.former_id = [line[0].strip]\r\n\tcol = populate_collection(line[0].strip, col, foxpath) \r\n\tcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tcol.depositor = user\r\n\tcol.save!\r\n\tcol_id = col.id.to_s\r\n\tputs \"subject col id was\" + col_id\r\n\ttopcol.members << col\r\n\ttopcol.save!\r\n\tmappings_string = line[0] + \",\" + line[1] + \",\" + col_id \r\n\tmappings_level2.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = line[0]\t\r\n\tidmap[key] = col.id\r\nend\r\n\r\n# write to file as permanent mapping that we can use when mapping theses against collections\r\nopen(mapping_file, \"a+\")do |mapfile| \r\n\tmapfile.puts(mappings_level2)\r\nend\r\n\r\n# but we still have our mappings array, so now use this to make third level collections\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\n\r\n# read in third level file\r\nmappings_level3 = []\r\nlevel3collsfile = mapping_path + \"exam_colls_level3.txt\"\r\ncsv_text3 = File.read(level3collsfile)\r\ncsv_level3 = CSV.parse(csv_text3)\r\nyearpidcount = 1\r\nputs \"starting third level (years)\"\r\ncsv_level3.each do |line|\r\nyearpidcount = yearpidcount +1\r\n puts \"starting number \" +yearpidcount.to_s+ \" in list\"\r\n puts line[0]\r\n\tyear_col = Object::Collection.new\r\n\tputs \"started new year collection\"\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_s\r\n\tputs \"got level 3 title which was \" +year_col_title\r\n\tyear_col_title.gsub!(\"&amp;\",\"&\")\r\n\tyear_col.title = [year_col_title]\r\n\tyear_col.former_id = [line[0].strip]\r\n\tyear_col = populate_collection(line[0].strip, year_col, foxpath)\r\n\tyear_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tyear_col.depositor = user\r\n\tyear_col.save!\r\n\tyear_col_id = year_col.id.to_s\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2]# old parent pid, key to find new parent id\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << year_col\r\n\tparent.save!\r\n\tmappings_string = line[0] + \",\" + line[1] + \",\" + year_col_id \r\n\tmappings_level3.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = line[0].strip\t\r\n\tidmap[key] = year_col.id\r\nend\r\n# and write to permanent mapping file - these can be all the same file whatever level\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level3)\r\nend\r\n\r\n# level 4\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\nmappings_level4 = []\r\nlevel4collsfile = mapping_path + \"exam_colls_level4_physics.txt\"\r\ncsv_text4 = File.read(level4collsfile)\r\ncsv_level4 = CSV.parse(csv_text4) \r\nyearpidcount = 1\r\nputs \"starting fourth level (physics years)\"\r\ncsv_level4.each do |line|\r\n\tyearpidcount = yearpidcount +1\r\n puts \"starting number \" + yearpidcount.to_s + \" in list\"\r\n puts line[0]\r\n\tphysics_year_col = Object::Collection.new\r\n\tputs \"started new physics year collection\"\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_s\r\n\tyear_col_title.gsub!(\"&amp;\",\"&\")\r\n\tputs \"got level 4 title which was \" +year_col_title\r\n\tphysics_year_col.title = [year_col_title]\r\n\tphysics_year_col.former_id = [line[0].strip]\r\n\tphysics_year_col = populate_collection(line[0].strip, physics_year_col, foxpath) \r\n\tphysics_year_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tphysics_year_col.depositor = user\r\n\tphysics_year_col.save!\r\n\tphysics_year_col_id = physics_year_col.id.to_s\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2]# old parent pid, key to find new parent id\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << physics_year_col\r\n\tparent.save!\r\n\tmappings_string = line[0] + \",\" + line[1] + \",\" + physics_year_col.id \r\n\tmappings_level4.push(mappings_string)\r\nend\r\n# write to permanent mapping file - these can be all the same file whatever level\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level4)\t\r\nend\r\n#end of level 4\r\nputs \"all collections done\"\r\nend", "title": "" }, { "docid": "04d6a8b8067c5cf741feb67948420c71", "score": "0.51914364", "text": "def works_described\n find_related_frbr_objects( :describes, :which_works?) \n end", "title": "" }, { "docid": "9937123f6dd99bd9b4b8ae6d9fadd48b", "score": "0.51647836", "text": "def collection_solr_document(resource)\n coll_sdb = GDor::Indexer::SolrDocBuilder.new(resource, logger)\n\n fields_to_add = GDor::Indexer::SolrDocHash.new(\n druid: resource.bare_druid,\n url_fulltext: \"https://purl.stanford.edu/#{resource.bare_druid}\",\n access_facet: 'Online',\n collection_type: 'Digital Collection',\n display_type: coll_display_types_from_items(resource),\n format_main_ssim: 'Archive/Manuscript', # per INDEX-12, add this to all collection records (does not add dups)\n building_facet: 'Stanford Digital Repository' # INDEX-53 add building_facet = Stanford Digital Repository here for collection\n )\n\n logger.info \"Indexing collection object #{resource.druid}\"\n doc_hash = coll_sdb.doc_hash\n doc_hash.combine fields_to_add\n validation_messages = doc_hash.validate_collection(config)\n validation_messages.concat doc_hash.validate_mods(config)\n @validation_messages.puts(validation_messages.join(\"\\n\"))\n doc_hash.to_h\n end", "title": "" }, { "docid": "7f5fe741a402cc4336240fb69c32bc73", "score": "0.51601845", "text": "def associate_collection\n if params[\"collection_id\"] && collection = Collection.find_by_sha(params[\"collection_id\"])\n collection.ideas << @idea if collection.open?\n end\n end", "title": "" }, { "docid": "7268989b1d14ec9376964e6df2ff1478", "score": "0.51519686", "text": "def make_restricted_exam_collection_structure(mapping_path, foxpath, user)\r\nputs \"running make_exam_collection_structure\"\r\nmapping_file = mapping_path +\"exam_col_mapping.txt\"\r\n# make the top Exams level first, with a CurationConcerns (not dlibhydra) model.\r\n#array of lines including title\r\ntopmapping = []\r\n# we also need a pid:id hash so we can extract id via a pid key\r\nidmap ={}\r\ntoppid = \"york:796226\" #top level collection\r\ntopcol = Object::Collection.new\r\ntopcol.title = [\"Restricted exam papers\"]\r\ntopcol.former_id = [toppid]\r\ntopcol = populate_collection(toppid, topcol, foxpath)\r\n#the top collection is NOT visible to the general public \r\ntopcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"admin\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\ntopcol.depositor = user\r\ntopcol.save!\r\ntopcol_id = topcol.id.to_s\r\nmappings_string = toppid + \",\" + topcol.title[0].to_s + \",\" + topcol_id \r\ntopmapping.push(mappings_string) \r\n# add to hash, old pid as key, new id as value\r\nkey = toppid\t\r\nidmap[key] = topcol.id\r\n# write to file as permanent mapping that we can use when mapping theses against collections \r\nopen(mapping_file, \"a+\") do |mapfile|\r\nmapfile.puts(topmapping)\r\nend\r\n\r\n=begin\r\nnow we need to read from the list which I will create, splitting into appropriate parts and for each create an id and add it to the top level collection\r\n=end\r\n# hardcode second level file, but could pass in as param\r\nlevel2file = mapping_path + \"restrictedExamCollsLevel2.txt\"\r\ncsv_text = File.read(level2file)\r\ncsv = CSV.parse(csv_text)\r\n# we also need a file we can write to, as a permanent mapping\r\nmappings_level2 = []\r\n\r\nputs \"starting second level(subjects)\"\r\ncsv.each do |line|\r\n puts line[0]\r\n\tcol = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new\r\n\ttitle = line[1]\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\tcol.title = [title]\r\n\tformer_id = line[0].strip\r\n\tcol.former_id = [former_id]\r\n\tcol = populate_collection(former_id, col, foxpath) \r\n\tcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"admin\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tcol.depositor = user\r\n\tcol.save!\r\n\tcol_id = col.id.to_s\r\n\ttopcol.members << col\r\n\ttopcol.save!\r\n\tmappings_string = former_id + \",\" + title + \",\" + col_id \r\n\tmappings_level2.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = former_id\t\r\n\tidmap[key] = col.id\r\nend\r\n\r\n# write to file as permanent mapping that we can use when mapping theses against collections\r\nopen(mapping_file, \"a+\")do |mapfile| \r\n\tmapfile.puts(mappings_level2)\r\nend\r\n\r\n# but we still have our mappings array, so now use this to make third level collections\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\n\r\n# read in third level file\r\nmappings_level3 = []\r\nlevel3collsfile = mapping_path + \"restrictedExamCollsLevel3.txt\"\r\ncsv_text3 = File.read(level3collsfile)\r\ncsv_level3 = CSV.parse(csv_text3)\r\nyearpidcount = 0\r\nputs \"starting third level (years)\"\r\ncsv_level3.each do |line|\r\nyearpidcount = yearpidcount +1\r\n puts \"starting number \" +yearpidcount.to_s+ \" in list\"\r\n puts line[0]\r\n\tyear_col = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_s\r\n\tyear_col_title.gsub!(\"&amp;\",\"&\")\r\n\tyear_col.title = [year_col_title]\r\n\tformer_id = line[0].strip\r\n\tyear_col.former_id = [former_id]\r\n\tyear_col = populate_collection(former_id, year_col, foxpath)\r\n\tyear_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"admin\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tyear_col.depositor = user\r\n\tyear_col.save!\r\n\tyear_col_id = year_col.id.to_s\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2].strip# old parent pid, key to find new parent id\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << year_col\r\n\tparent.save!\r\n\tmappings_string = former_id + \",\" + year_col_title + \",\" + year_col_id \r\n\tmappings_level3.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = former_id\t\r\n\tidmap[key] = year_col.id\r\nend\r\n# and write to permanent mapping file - these can be all the same file whatever level\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level3)\r\nend\r\n\r\n# level 4\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\nmappings_level4 = []\r\nlevel4collsfile = mapping_path + \"restrictedExamCollsLevel4.txt\"\r\ncsv_text4 = File.read(level4collsfile)\r\ncsv_level4 = CSV.parse(csv_text4) \r\nyearpidcount = 0\r\nputs \"starting fourth level (physics years)\"\r\ncsv_level4.each do |line|\r\n\tyearpidcount = yearpidcount +1\r\n puts \"starting number \" + yearpidcount.to_s + \" in list\"\r\n puts line[0]\r\n\tphysics_year_col = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_s\t\r\n\tyear_col_title.gsub!(\"&amp;\",\"&\")\r\n\tyear_col_pid = line[0].strip\r\n\tphysics_year_col.title = [year_col_title]\r\n\tphysics_year_col.former_id = [year_col_pid]\r\n\tphysics_year_col = populate_collection(year_col_pid, physics_year_col, foxpath) \r\n\tphysics_year_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"admin\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tphysics_year_col.depositor = user\r\n\tphysics_year_col.save!\r\n\tphysics_year_col_id = physics_year_col.id.to_s\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2].strip # old parent pid, key to find new parent id\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << physics_year_col\r\n\tparent.save!\r\n\tmappings_string = year_col_pid + \",\" + year_col_title + \",\" + physics_year_col_id \r\n\tmappings_level4.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = year_col_pid\t\r\n\tidmap[key] = physics_year_col_id\r\nend\r\n# write to permanent mapping file - these can be all the same file whatever level\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level4)\t\r\nend\r\n#end of level 4\r\n\r\n\r\n# level 5\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\nmappings_level5 = []\r\nlevel5collsfile = mapping_path + \"restrictedExamCollsLevel5.txt\"\r\ncsv_text5 = File.read(level5collsfile)\r\ncsv_level5 = CSV.parse(csv_text5) \r\nyearpidcount = 0\r\nputs \"starting fifth level (physics solution years)\"\r\ncsv_level5.each do |line|\r\n\tyearpidcount = yearpidcount +1\r\n puts \"starting number \" + yearpidcount.to_s + \" in list\"\r\n\tsize = line.size\r\n formerpid = line[0].strip\r\n\tlevel5title = line[1].strip\r\n\tlevel5title.gsub!(\"&amp;\",\"&\")\r\n\tlevel5parent = line[2].strip\r\n\tlevel5_col = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\t\t\r\n\tlevel5_col.title = [level5title]\r\n\tlevel5_col.former_id = [formerpid]\r\n\tlevel5_col = populate_collection(formerpid, level5_col, foxpath) \r\n\tlevel5_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"admin\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tlevel5_col.depositor = user\r\n\tlevel5_col.save!\r\n\tnew_id = level5_col.id.to_s\r\n\t# need to find the right parent collection here\t\r\n\tmapped_parent_id = idmap[level5parent]\t\r\n\tparentColl = Object::Collection.find(mapped_parent_id)\r\n\tparentColl.members << level5_col\r\n\tparentColl.save!\r\n\tmappings_string = formerpid + \",\" + level5title + \",\" + new_id \r\n\tmappings_level5.push(mappings_string)\r\nend\r\n# write to permanent mapping file - these can be all the same file whatever level\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level5)\t\r\nend\r\n#end of level 5\r\n\r\n\r\n\r\nputs \"all collections done\"\r\n\r\nend", "title": "" }, { "docid": "4c8a48b065273a0a6a970f5152af9f1c", "score": "0.51469606", "text": "def approved_works\n works.merge(CollectionItem.approved).posted\n end", "title": "" }, { "docid": "5a57d43382336ee685ea53b931f1d0ad", "score": "0.5128784", "text": "def add_documents\n # remove documents\n (representing_resource.documents.map(&:id) - document_ids).each do |old_id|\n resource = ActiveFedora::Base.find(old_id)\n new_list = resource.documents.map { |r| r unless r.id == curation_concern.id }.compact\n resource.documents = new_list\n resource.save\n resource.reload\n end\n\n # add new ones\n document_ids.each do |id|\n resource = ActiveFedora::Base.find(id)\n resource.documents += [curation_concern]\n resource.save\n resource.reload\n end\n end", "title": "" }, { "docid": "843d2ac02659200e024778e4b574b9a2", "score": "0.51076895", "text": "def set_collection_creation\n @collection_creation = CollectionCreation.find(params[:id])\n end", "title": "" }, { "docid": "ae7e22710d34f3d1b844da41b6e3b342", "score": "0.51046324", "text": "def select\n #find the arry\n works_array = Work.find(params[:work_id])\n api_info = works_array.apidata[params[:work_index].to_i] #construct the actual work here\n #find or create this work based on the unique ID from spotify\n @new_work = Work.find_or_create_by(unique_id: api_info[\"id\"].to_s)\n #if it didn't previously exist, now we enter information\n if !@new_work.apidata\n @new_work.update(medium: \"Album\", title: works_array.title, apidata: api_info)\n end\n #destroy all album lists that were entered into the works table. these won't be used again, so I cleared them out\n #again, there's definitely a better way to do this\n Work.where(medium: \"albumlist\").destroy_all\n #redirect\n redirect_to new_work_albumreview_path (@new_work)\n end", "title": "" }, { "docid": "e28022faa7077e3ab332a39cb65a544c", "score": "0.5087692", "text": "def works\n\t\t@works = FictionDecorator.decorate(Work.fiction.with_filters(index_params, current_user))\n\tend", "title": "" }, { "docid": "86f22fdaf6e08e1d190b65382393b29e", "score": "0.5087571", "text": "def change_collection_permissions(id_list_path)\r\nwork_ids = IO.readlines(id_list_path)\r\n\twork_ids.each do |i|\r\n\ti = i.strip #trailing white space, line ends etc will cause a faulty uri error\t\r\n\t\tc = Object::Collection.find(i) \r\n\t\tputs \"got collection for \" + i\r\n\t\tc.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\tc.save!\t\t\r\n\tend\r\nend", "title": "" }, { "docid": "7e7dd47f81b5430209ff424b87681488", "score": "0.5085394", "text": "def lookup_existing\n filter_by = {\n name: name\n }\n\n pass_options = {\n to_record_type: 'nfs_store__manage__container',\n filter_by: filter_by,\n active: true\n }\n\n case skip_if_exists\n when 'master'\n ModelReference.find_references master, **pass_options\n when 'user_is_creator'\n pass_options[:ref_created_by_user] = 'user_is_creator'\n ModelReference.find_references item, **pass_options\n end\n end", "title": "" }, { "docid": "0c74ef99b107a51c66cf82f9d077d48d", "score": "0.50825334", "text": "def add_collection_reference!\n return if cocina_object.collection? || cocina_object.structural&.isMemberOf.blank?\n\n collections = Dor::Services::Client.object(cocina_object.externalIdentifier).collections\n\n remove_related_item_nodes_for_collections!\n\n collections.each do |cocina_collection|\n add_related_item_node_for_collection! cocina_collection\n end\n end", "title": "" }, { "docid": "7a3786131aff8b8a73490f6ebaf4574a", "score": "0.5068706", "text": "def hydrate_collections(task)\n concept_ids = task.fetch('collection-statuses', []).map { |status| status['concept-id'] }\n return unless concept_ids.any?\n\n collections_response = cmr_client.get_collections_by_post({ concept_id: concept_ids, page_size: concept_ids.count }, token)\n return unless collections_response.success?\n\n collections_response.body['items'].each do |collection|\n task.fetch('collection-statuses', []).find { |status| status['concept-id'] == collection.fetch('meta', {})['concept-id'] }['collection'] = collection\n end\n end", "title": "" }, { "docid": "3867d7492b8e475c2614c52408376039", "score": "0.5067663", "text": "def create\n extracted_work_params = work_params({work: JSON.parse(params[:work_metadata_json])})\n\n files_params = (params[:cached_files] || []).\n collect { |s| JSON.parse(s) }.\n sort_by { |h| h && h.dig(\"metadata\", \"filename\")}\n\n Kithe::Model.transaction do\n files_params.each do |file_data|\n asset = Asset.new\n asset.file = file_data\n asset.title = (asset.file&.original_filename || \"Untitled\")\n asset.save!\n\n work = Work.new(extracted_work_params)\n work.title = asset.title\n work.representative = asset\n work.save!\n\n asset.parent = work\n asset.save!\n end\n end\n\n redirect_to admin_works_path, notice: \"#{helpers.pluralize(files_params.count, \"work\")} batch created.\"\n end", "title": "" }, { "docid": "10eb73c58cec86161b47b908648f3481", "score": "0.5062603", "text": "def work_transform( work_hashes )\n\n res = []\n work_hashes.each do |w|\n res << SolrDocument.new( w )\n end\n return res\n end", "title": "" }, { "docid": "df571f5ef5231f418eac894c58bfd6e6", "score": "0.5057832", "text": "def populate_index!\n # Load only new references from the DB\n new_references = index_references - loaded_references\n # And store which references we've already loaded\n loaded_references.merge(new_references)\n\n # Initialize index in nil\n self.index ||= {}\n\n return if new_references.blank? # Return if all references are already loaded\n\n # TODO(lsmola) selected need to contain also :keys used in other InventoryCollections pointing to this one, once\n # we get list of all keys for each InventoryCollection ,we can uncomnent\n # selected = [:id] + attribute_names.map { |x| model_class.reflect_on_association(x).try(:foreign_key) || x }\n # selected << :type if model_class.new.respond_to? :type\n # load_from_db.select(selected).find_each do |record|\n\n full_references = references[index_name].select { |key, _value| new_references.include?(key) } # O(1) include on Set\n full_references = full_references.values.map(&:full_reference)\n\n schema = get_schema(full_references)\n paths = schema.keys\n rails_friendly_includes_schema = get_rails_friendly_includes_schema(paths)\n\n all_values = full_references.map do |ref|\n schema.map do |schema_item_path, arel_column|\n arel_column.eq(fetch_hash_path(schema_item_path, ref))\n end.inject(:and)\n end\n\n # Return the the correct relation based on strategy and selection&projection\n projection = nil\n\n db_relation(rails_friendly_includes_schema, all_values, projection).find_each do |record|\n process_db_record!(record, paths)\n end\n end", "title": "" }, { "docid": "f1e490cb85098124d59d1376921e75f6", "score": "0.5044039", "text": "def file_sets_for(work)\n Hyrax.query_service.custom_queries.find_child_filesets(resource: work)\n end", "title": "" }, { "docid": "d5da440cca0f64077a1de44c423142d8", "score": "0.50412726", "text": "def find_or_create_collection_by_name(name)\n col = find_collection_by_name(name)\n\n if col.nil?\n col = @obj.createCollection\n\n # TODO: Look up this function\n col.setMetadataSingleValue('dc', 'title', nil, nil, name)\n col.update\n end\n\n col\n end", "title": "" }, { "docid": "9e9a792e61fe9f7a7a3b4bbfc3f3052f", "score": "0.50319666", "text": "def create_collections(models = ::Mongoid.models, force: false)\n models.each do |model|\n if !model.embedded? || model.cyclic?\n model.create_collection(force: force)\n logger.info(\"MONGOID: Created collection for #{model}:\")\n else\n logger.info(\"MONGOID: collection options ignored on: #{model}, please define in the root model.\")\n end\n end\n end", "title": "" }, { "docid": "1a783e0a410ac0ec6ac8ed88ccffd186", "score": "0.50305563", "text": "def add\n coll = Collection.find_by(id: params[:collection_id])\n work = Artwork.find_by(id: params[:artwork_id])\n ac = ArtworkCollection.new(collection_id: coll.id, artwork_id: work.id)\n if ac.save\n render json: ac\n else\n render json: ac.errors.full_messages, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c18cb30ac69f6ff2db0e5e6d063b11be", "score": "0.5012778", "text": "def hydrate_collections(task)\n concept_ids = task.fetch('collection-statuses', []).map { |status| status['concept-id'] }\n return unless concept_ids.any?\n\n collections_response = cmr_client.get_collections_by_post({ concept_id: concept_ids, page_size: concept_ids.count }, token)\n return unless collections_response.success?\n\n Array.wrap(collections_response.body['items']).each do |collection|\n task.fetch('collection-statuses', []).find { |status| status['concept-id'] == collection.fetch('meta', {})['concept-id'] }['collection'] = collection\n end\n end", "title": "" }, { "docid": "25932bbe96c1c2d017afb728b205963c", "score": "0.50114703", "text": "def works\n\t\t@works = WorksDecorator.decorate(Record.with_filters(index_params, current_user))\n\tend", "title": "" }, { "docid": "606b24787aa0cce2be38006dc2bad26e", "score": "0.5010968", "text": "def test_works_exist\n publication = AuthorWork.find_by_id(author_works(:publication3).id)\n assert publication.work \n end", "title": "" }, { "docid": "faf5280dc785e9361a289ad1c9add72f", "score": "0.5005784", "text": "def superworks_to_whom_source_material_is_provided\n find_related_frbr_objects( :provides_source_material_for, :which_superworks?) \n end", "title": "" }, { "docid": "ae1c93c5a00fe66cc6b83685d9e68cd4", "score": "0.50023067", "text": "def create_collection_no_images(folder_name)\n logger.debug(\"create parent_collection: #{folder_name}\")\n\n #get collection name from folder name\n begin_index = folder_name.rindex(\"/\")\n if (begin_index.present?)\n title = folder_name.slice(begin_index+1, folder_name.length-1)\n else\n title = folder_name\n end\n\n #create new collection, update it's metadata and save\n collection = DILCollection.new({:pid=>mint_pid(\"dil-local\")})\n collection.apply_depositor_metadata('mcs680')\n collection.edit_users=DIL_CONFIG['admin_staff'] + [\"\"]\n #collection.set_collection_type('dil_collection')\n collection.descMetadata.title = title\n collection.save!\n\n #if this collection has a parent collection, get it's pid and update the RELS-EXT in both collections\n if (has_parent_collection?(folder_name))\n parent_pid = get_parent_collection_pid(folder_name)\n #logger.debug(\"parent pid: #{parent_pid}\")\n parent_collection = DILCollection.find(parent_pid)\n parent_collection.insert_member(collection)\n end\n\n #logger.debug(\"New pid: #{collection.pid}\")\n # return the pid of the new collection\n collection.pid\nend", "title": "" }, { "docid": "4042f8ecb4c56970c3bbb1a6d409e60f", "score": "0.49984184", "text": "def import_work_item(row)\n if @work_item_insert.nil?\n stmt = \"insert into work_items(intellectual_object_id, generic_file_id, \" +\n \"name, etag, bucket, user, note, action, stage, status, outcome, \" +\n \"bag_date, date, retry, object_identifier, generic_file_identifier, \" +\n \"node, pid, needs_admin_review, institution_id, queued_at, size, \" +\n \"stage_started_at, created_at, updated_at) \" +\n \"values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\"\n @work_item_insert = @dest_db.prepare(stmt)\n end\n @work_item_insert\n .execute(\n @id_for_name[row['object_identifier']],\n @id_for_name[row['generic_file_identifier']],\n row['name'],\n row['etag'],\n row['bucket'],\n row['user'],\n row['note'],\n row['action'],\n row['stage'],\n ucfirst(row['status']),\n ucfirst(row['outcome']),\n row['bag_date'],\n row['date'],\n row['retry'],\n row['object_identifier'],\n row['generic_file_identifier'],\n row['node'],\n row['pid'],\n row['needs_admin_review'],\n @id_for_name[row['institution']],\n row['updated_at'],\n nil,\n nil,\n row['created_at'],\n row['updated_at'])\n return last_insert_id\n end", "title": "" }, { "docid": "f08828d31041db15773e31a6840bc557", "score": "0.49927837", "text": "def new_collection(collection_data) # {{{\n Her::Model::ORM.initialize_collection(self.to_s.underscore, collection_data)\n end", "title": "" }, { "docid": "3a8b746839ade1000875876c09f731cf", "score": "0.49873585", "text": "def referent_pass\n # For each collection page, add where it is referenced\n collection_documents.each do |doc|\n # Put the reference data on the doc\n doc.data['referenced_by'] = @graph.document_references(doc)\n\n # If the references table option is configured, append the table\n table = ReferenceTable.new(@site, doc).html\n doc.content = doc.content + table\n end\n end", "title": "" }, { "docid": "d64207b5a8323d9fdf738858b8a250ef", "score": "0.49824688", "text": "def related_works\n @related_works ||= Work.where(\n friendlier_id: related_link_filter.related_work_friendlier_ids,\n published: true\n ).includes(:leaf_representative).all\n end", "title": "" }, { "docid": "4c2f787b2c6c0dea536487c94cdbead1", "score": "0.498014", "text": "def initialize_document_definitions\n unless db.collection_names.include?('document_definitions')\n # TODO: Work out a class recursive way to handle one or both of these statements. Try and keep all of the direct collection(name) statements inside of the crud proper.\n collection('document_definitions').insert(\n 'name' => 'document_definitions',\n 'fields' => {\n 'name' => { 'type' => :string, 'limit' => nil, 'precision' => nil, 'scale' => nil, 'default' => nil, 'null' => false, 'first' => nil, 'after' => nil, 'primary_key' => true},\n # TODO: Umm type idunno? Return to this when you get AR to deal with flux types.\n 'fields' => { 'type' => :string, 'limit' => nil, 'precision' => nil, 'scale' => nil, 'default' => nil, 'null' => false, 'first' => nil, 'after' => nil, 'primary_key' => nil}\n }\n )\n\n collection('document_definitions').insert(\n 'name' => 'system.indexes',\n 'fields' => {\n 'v' => { 'type' => :integer, 'limit' => nil, 'precision' => nil, 'scale' => nil, 'default' => nil, 'null' => false, 'first' => nil, 'after' => nil, 'primary_key' => nil},\n 'key' => { 'type' => :string, 'limit' => nil, 'precision' => nil, 'scale' => nil, 'default' => nil, 'null' => false, 'first' => nil, 'after' => nil, 'primary_key' => nil},\n 'ns' => { 'type' => :string, 'limit' => nil, 'precision' => nil, 'scale' => nil, 'default' => nil, 'null' => false, 'first' => nil, 'after' => nil, 'primary_key' => true},\n 'name' => { 'type' => :string, 'limit' => nil, 'precision' => nil, 'scale' => nil, 'default' => nil, 'null' => false, 'first' => nil, 'after' => nil, 'primary_key' => nil}\n }\n )\n\n end\n end", "title": "" }, { "docid": "acd14b5c98115d397c5d77dc94208e0a", "score": "0.49752235", "text": "def persist\n documents = resources.map do |resource|\n generate_id(resource) if resource.id.blank?\n solr_document(resource)\n end\n results = add_documents(documents)\n versions = results[\"adds\"]&.each_slice(2)&.to_h\n documents.map do |document|\n document[\"_version_\"] = versions.fetch(document[:id])\n resource_factory.to_resource(object: document.stringify_keys)\n end\n end", "title": "" }, { "docid": "a12cf427638b6d867ea1f3b3fd3402fa", "score": "0.49549615", "text": "def assign_collection\n source, collection = get_source_and_collection\n collection.updatable_by?(current_user) || raise(Hobo::PermissionDeniedError, \"#{self.class.name}#assign_collection\")\n collection.real_source << source unless(collection.real_source.include?(source))\n collection.save!\n end", "title": "" }, { "docid": "820881502d43afa888168072a912ee9e", "score": "0.4952771", "text": "def find_existing_sca_projects(school)\n self.sca_projects.find {|sca_projects| sca_projects[:project_dsf] == school[:project_dsf]}\n end", "title": "" }, { "docid": "3bfbefeb064fbc51940fa738c598094c", "score": "0.4950899", "text": "def retrieve_set_collections_for_user\n workouts = scope.workouts\n @set_collections_for_user = []\n\n set_collections = workouts.each do |workout|\n # grab all of the workotus and stuff in an array\n end\n @set_collections_for_user\n end", "title": "" }, { "docid": "9a11f3262af6dcbb1fb00afc6c54e070", "score": "0.49508408", "text": "def associatePlateFSCuploads(incol, uploads_key)\n # check if have associated uploads, if not - return\n ups=Item.find(incol.id).get(uploads_key)\n if(ups.nil?)\n return\n end\n \n # input hash, info - create if nil\n dims=incol.dimensions\n inplate=incol.matrix\n inhash=Item.find(incol.id).get(\"item_info\")\n # are we appending to or creating collection's hash?\n if (inhash.nil?) \n inhash=Hash.new() \n end\n inhash_names = Item.find(incol.id).get(\"item_info_names\")\n if (inhash_names.nil?) \n inhash_names=Array.new()\n end\n \n # copy item ids to collection.matrix[i][j] and info to hash\n ups.each do |up| \n # find unique name of upload, format is uploadID_wellName, where wellName is in A0 to H11 range\n mymatch=/(?<myrow>[A-H]{1,1})(?<mycol>[0-9]{1,2}).fcs/.match(up[:name])\n if(!mymatch.nil?) # in case there is no match\n rr=mymatch[:myrow].ord.to_i-\"A\".ord # subtract ascii value of \"A\" from A-H to get row integer, 0-7\n cc=mymatch[:mycol].to_i # col integer, 0-11\n # add to hash at correct row rr, column cc\n inhash.store(\"R#{rr}C#{cc}_upload\", up) # we are associating upload item using regular association, not upload association\n end\n end\n \n # add new association name \"upload\" to hash item_info strings\n Item.find(incol.id).associate :item_info_names, inhash_names.concat([\"upload\"])\n Item.find(incol.id).associate :item_info, inhash # in case there was no hash for this collection. replaces previous hash.\n \n incol.save # may not be needed\n end", "title": "" }, { "docid": "f259dd7bc508942c8a8b116b05336876", "score": "0.49412817", "text": "def attach_to_work(work, file_set_params = {})\n acquire_lock_for(work.id) do\n # Ensure we have an up-to-date copy of the members association, so that we append to the end of the list.\n work.reload unless work.new_record?\n file_set.visibility = work.visibility unless assign_visibility?(file_set_params)\n work.ordered_members << file_set\n # heliotrope change: don't assign representative_id and thumbnail_id\n # work.representative = file_set if work.representative_id.blank?\n # work.thumbnail = file_set if work.thumbnail_id.blank?\n # Save the work so the association between the work and the file_set is persisted (head_id)\n # NOTE: the work may not be valid, in which case this save doesn't do anything.\n work.save\n Hyrax.config.callback.run(:after_create_fileset, file_set, user)\n end\n end", "title": "" }, { "docid": "77722c3108c305a41f5b96cacee770b7", "score": "0.4936885", "text": "def set_doc_overwork\n @overwork = current_ou.doc_overworks.find(params[:id])\n end", "title": "" }, { "docid": "a395d0e10e5181626afe29f67143af94", "score": "0.49336824", "text": "def normalize_work(*works)\n Array.wrap(works).map do |work|\n mapper.map(work, target: 'orcid/work')\n end\n end", "title": "" }, { "docid": "5cf6e3ebb7ba47ca44bcc4845ee0a18c", "score": "0.49264222", "text": "def auto_solr_create\n\n documents = []\n\n if self.class.solr_powered? and self.solr_saveable?\n documents << self.solr_document\n end\n\n indexed_assocs = {}\n SolrPowered.observers_for(self.class).each do |observer|\n ra = observer[:return_assocation]\n unless indexed_assocs[ra]\n indexed_assocs[ra] = true\n assoc_objs = self.send(observer[:return_association])\n assoc_objs = [assoc_objs] unless assoc_objs.is_a?(Array)\n assoc_objs.each do |obj|\n documents << obj.solr_document if obj.solr_saveable?\n end\n end\n end\n\n SolrPowered.add(*documents)\n end", "title": "" }, { "docid": "64b2f9fe440141abe108212b12fb7b31", "score": "0.49253616", "text": "def index\n @standard_works = StandardWork.all\n end", "title": "" }, { "docid": "4c2fcd86e72a648a0912e09b6074928a", "score": "0.49192238", "text": "def join_for_works_from_files\n \"{!join from=#{ActiveFedora.id_field} to=file_set_ids_ssim}#{dismax_query}\"\n end", "title": "" }, { "docid": "e0f596cbcafe1149e350a1986e08222c", "score": "0.491681", "text": "def works_ids\n @works_ids ||= begin\n where_clause = \"type_w IN (#{Unan::Program::AbsWork::CODES_BY_TYPE[:pages].join(',')}) AND item_id = #{id}\"\n search_works_where(where_clause).collect { |h| h[:id] }\n end\n end", "title": "" }, { "docid": "72d64aa8adf8f54aa451190773c5e925", "score": "0.4910446", "text": "def add_thesis_main_labels(id_list_path)\r\n#work_ids = CSV.parse(id_list_file)\r\nwork_ids = IO.readlines(id_list_path) \r\n\twork_ids.each do |i|\r\n\ti = i.strip #trailing white space, line ends etc will cause a faulty uri error\t\r\n\t\tt = Object::Thesis.find(i) \r\n\t\tputs \"got thesis for \" + i\r\n\t\tthesis_title = t.title[0]\r\n\t\tputs \"thesis_title was \" + thesis_title\r\n\t\tmembers = t.members\r\n\t\t\tmembers.each do |m|\r\n\t\t\t\tid = m.id\r\n\t\t\t\tfs = Object::FileSet.find(id)\r\n\t\t\t\ttitle = fs.title[0]\r\n\t\t\t\tif title.start_with?('THESIS_MAIN') \r\n\t\t\t\t\tif fs.label != \"THESIS_MAIN\"\r\n\t\t\t\t\t\tfs.label = \"THESIS_MAIN\"\r\n\t\t\t\t\t\tfs.save!\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\tend\r\nend", "title": "" }, { "docid": "0cc6c203c6d59c9507b8ac89d5087d5f", "score": "0.4906644", "text": "def to_solr\n base = {\n :id => self.id,\n :category_ids => self.categories.map{|c|c.id},\n :types => self.types.map{|c|c.name}.uniq,\n :type_ids => self.types.map{|c|c.id}\n }\n base.merge!(works_to_solr)\n base.merge!(authors_to_solr)\n end", "title": "" }, { "docid": "4e64ff5cfc7c56d9df8cb54c7e66d2ee", "score": "0.49055043", "text": "def add_to_collection(relation_name, *args)\n metadata = self.relations[relation_name.to_s]\n args.flatten.each do |doc|\n return doc unless doc\n doc.class.collection.update(doc._selector, {\"$addToSet\"=>{metadata.inverse_foreign_key => self.id}})\n doc.send(metadata.inverse_foreign_key).push self.id\n self.send(metadata.foreign_key).push doc.id\n self.class.collection.update(self._selector, {\"$addToSet\"=>{metadata.foreign_key => doc.id}})\n end\n end", "title": "" }, { "docid": "151550b38c52844f95a0b5b16d59aebf", "score": "0.49013922", "text": "def set_work_schema\n @work_schema = WorkSchema.find(params[:id])\n end", "title": "" }, { "docid": "82f95b5a78bfa6c6b38fcdab0f502878", "score": "0.4899136", "text": "def listing_saves\n ListingCollectionAttachment.joins(:collection).where(collections: {user_id: self.id})\n end", "title": "" }, { "docid": "d3ebe80ca2be6064caaad5a97c8ffb45", "score": "0.48983258", "text": "def join_for_works_from_files\n \"{!join from=#{Hyrax.config.id_field} to=file_set_ids_ssim}#{dismax_query}\"\n end", "title": "" }, { "docid": "2f4fe83762238cf956753c0349017fdd", "score": "0.48957655", "text": "def populate_collection(former_id, collection, foxpath)\r\n# title is already set\r\n#former_id is already set\r\n#creator_string\r\n#description[]\r\n#rights[]\r\n#subject_resource_ids??????? \r\n#read old collection file\r\ncollFileName = former_id.strip\r\ncollFileName = collFileName.sub ':', '_'\r\ncollFileName = collFileName + \".xml\"\r\npath = foxpath + collFileName\r\ndoc = File.open(path){ |f| Nokogiri::XML(f, Encoding::UTF_8.to_s)}\r\n# doesnt resolve nested namespaces, this fixes that\r\nns = doc.collect_namespaces\t\r\n# find max dc version (we will only want dc)\r\nnums = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion/@ID\",ns)\t\r\nall = nums.to_s\r\ncurrent = all.rpartition('.').last \r\ncurrentVersion = 'DC.' + current\r\ncreatorArray = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:creator/text()\",ns).to_s\r\ncollection.creator_string = [creatorArray.to_s]\r\ndescription = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:description/text()\",ns).to_s\r\ncollection.description = [description]\r\n#subjects (for now)\r\nkeywords = []\r\ndoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:subject/text()\",ns).each do |s|\r\n\tkeywords.push(s.to_s)\r\nend\r\ndefaultLicence = \"http://dlib.york.ac.uk/licences#yorkrestricted\"\r\n#fr = FoxmlReader.new\r\ncommon = CommonMigrationMethods.new\r\ncoll_rights = defaultLicence\r\ncoll_rights = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[contains(.,'http')]\",ns).to_s\r\nnewrights = common.get_standard_rights(coll_rights)# all theses currently York restricted \t\r\nif newrights.length > 0\r\n\tcoll_rights = newrights\t\r\nend\t\r\ncollection.rights=[coll_rights]\r\nreturn collection\r\nend", "title": "" }, { "docid": "e0f4abcdc320ef61349ab786dd5e66c8", "score": "0.48946065", "text": "def set_work_representation\n @work_representation = WorkRepresentation.find(params[:id])\n end", "title": "" }, { "docid": "9e732e33ca5cb6ac2472b6cc114e13f3", "score": "0.48902807", "text": "def populate_index!\n # Load only new references from the DB\n new_references = index_references - loaded_references\n # And store which references we've already loaded\n loaded_references.merge(new_references)\n\n # Initialize index in nil\n self.index ||= {}\n\n return if new_references.blank? # Return if all references are already loaded\n\n # TODO(lsmola) selected need to contain also :keys used in other InventoryCollections pointing to this one, once\n # we get list of all keys for each InventoryCollection ,we can uncomnent\n # selected = [:id] + attribute_names.map { |x| model_class.reflect_on_association(x).try(:foreign_key) || x }\n # selected << :type if model_class.new.respond_to? :type\n # load_from_db.select(selected).find_each do |record|\n\n # Return the the correct relation based on strategy and selection&projection\n selection = extract_references(new_references) unless strategy == :local_db_cache_all\n projection = nil\n\n db_relation(selection, projection).find_each do |record|\n process_db_record!(record)\n end\n end", "title": "" }, { "docid": "7c12977199fd35f00896171e33c5363d", "score": "0.4889439", "text": "def example_collection(name = 'Stripwell')\n c = Collection.new_collection(name)\n c.save\n raise \"Got save errors: #{c.errors.full_messages}\" if c.errors.any?\n\n c\n end", "title": "" }, { "docid": "6f9f7019fb10bc6bf83da2f8fd6c53cd", "score": "0.4886666", "text": "def merge_similar(externals)\n for external_work in externals\n unless external_work == self\n if external_work.bookmarks\n external_work.bookmarks.each do |bookmark|\n bookmark.bookmarkable = self\n bookmark.save!\n end\n end\n if external_work.related_works\n external_work.related_works.each do |related_work|\n related_work.parent = self\n related_work.save!\n end \n end\n external_work.reload\n if external_work.bookmarks.empty? && external_work.related_works.empty?\n external_work.destroy\n end\n end\n end\n end", "title": "" }, { "docid": "51942e946deea20b679c4d6556ca5784", "score": "0.48833323", "text": "def set_posts_with_collection_and_file\n @posts_with_collection_and_file = PostsWithCollectionAndFile.find(params[:id])\n end", "title": "" }, { "docid": "f73c811892f17efb4b408bc8d79ff053", "score": "0.48813647", "text": "def in_work_presenters\n PresenterFactory.build_for(ids: in_works_ids,\n presenter_class: work_presenter_class,\n presenter_args: presenter_factory_arguments)\n end", "title": "" }, { "docid": "f73c811892f17efb4b408bc8d79ff053", "score": "0.48813647", "text": "def in_work_presenters\n PresenterFactory.build_for(ids: in_works_ids,\n presenter_class: work_presenter_class,\n presenter_args: presenter_factory_arguments)\n end", "title": "" }, { "docid": "2ef226a985b59fb1e538de68cb78c2c9", "score": "0.4878982", "text": "def add_collection_creator_to_component(node, solr_doc)\n field_name = Solrizer.solr_name('collection_creator', :displayable)\n repository = solr_doc[Solrizer.solr_name('repository', :displayable)]\n creators = node.xpath('//archdesc/did/origination[@label=\"creator\"]/*/text()').map(&:text)\n solr_doc[field_name] = creators - [repository]\n end", "title": "" }, { "docid": "4de2ecad6bfe4f0693b4e711a36775ed", "score": "0.48785558", "text": "def collection_create_if_not_exists(args = { }, options = { })\n return args.map { |v| collection_create_if_not_exists(v, options) } if args.is_a?(Array)\n args = args.is_a?(Hash) ? args : { :collection_name => args }\n\n collection_name = args[:collection_name] || args[:name]\n raise ArgumentError, 'collection_name is required.' unless collection_name\n case_sensitive = options.fetch(:case_sensitive, true)\n\n collection = collection_get_by_name( :collection_name => collection_name, :case_sensitive => case_sensitive )\n collection_already_existed = collection && !collection.empty? ? true : false\n collection ||= collection_create(collection_name)\n options[:extended_response] ?\n { :collection => collection, :collection_already_existed => collection_already_existed } :\n collection\n end", "title": "" }, { "docid": "adcea260333003a3b746aea490fc1ddb", "score": "0.48782584", "text": "def create_work_from_routine routine\n cur_date = date\n new_work = {\n :from => Time.utc(cur_date.year, cur_date.month, cur_date.day, get_hour_from_time(routine.from), get_minute_from_time(routine.from)),\n :to => Time.utc(cur_date.year, cur_date.month, cur_date.day, get_hour_from_time(routine.to), get_minute_from_time(routine.to)),\n :description => routine.description,\n :category_ids => routine.category_ids\n }\n current_user.works.build( new_work )\n end", "title": "" }, { "docid": "4f4dd339e2ec289f33f06eaa4f8f7d63", "score": "0.48675713", "text": "def add_to_collections(new_collection_ids)\n return true unless new_collection_ids\n # remove from old collections\n (curation_concern.in_collection_ids - new_collection_ids).each do |old_id|\n collection = ::Collection.find(old_id)\n collection.members.delete(curation_concern)\n collection.save\n end\n\n # add to new\n new_collection_ids.each do |coll_id|\n collection = ::Collection.find(coll_id)\n collection.members << curation_concern\n collection.save\n end\n true\n end", "title": "" }, { "docid": "98606b3f0b72c6842a63a270165e74d2", "score": "0.48624396", "text": "def update_collection(collection, collection_name, constructor, create=true)\n old_collection = @report.send(collection_name)\n old_collection_ids = old_collection.map(&:id)\n new_collection_ids = collection.map { |element| element[:id] }\n\n old_collection.each do |element|\n if !new_collection_ids.include?(element.id)\n element.destroy\n end\n end\n\n collection.each do |element|\n\n # The horror is here\n\n if !old_collection_ids.include?(element[:id])\n if create\n object = constructor.new(element.except(:image_id))\n @report.send(collection_name).push object\n else\n @report.send(collection_name).push constructor.find_by(id: element[:id])\n end\n else\n object = constructor.find_by(id: element[:id])\n object.update(element.except(:id, :image_id))\n end\n end\n\n @report.save\n end", "title": "" }, { "docid": "5591ef1f8a56c73947b12a83e2471159", "score": "0.4855993", "text": "def create\n\n saved = false\n if not (params[:days].blank? || params[:work].blank?)\n params[:days].each { |key ,day|\n if day[:length] != \"0\"\n @plan_work = Work.new(\n :length => day[:length],\n :time => Time.parse(day[:date]) + day[:time].to_i.minutes,\n :place_id => day[:place_id],\n :reserved => day[:reserved],\n :sub_project_id => params[:work][:sub_project_id],\n :project_id => params[:work][:project_id],\n :user_id => params[:work][:user_id],\n :job_type_id => params[:work][:job_type_id]\n )\n @plan_work.update_attributes(params[:work])\n\n @operations = @plan_work.operations\n if not @current_user.admin? || @current_user.produce?\n @plan_work.edited = true;\n end\n\n if @plan_work.save\n saved = true\n end\n end\n\n }\n end\n\n respond_to do |format|\n if saved\n flash[:notice] = 'Work was successfully created.'\n if @plan_work.project_id.blank?\n format.html { redirect_to(@current_user)}\n else\n format.html { redirect_to(@plan_work.project) }\n end\n format.xml { render :xml => @plan_work, :status => :created, :location => @work }\n else\n format.html { redirect_to :controller => \"plan_works\", :action => \"new\" }\n format.xml { render :xml => @plan_work.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57aedb9a95f2ce202a15c588b2242678", "score": "0.48506364", "text": "def add_attributes_to_collections(collection_mapping_path, foxpath)\r\nmapping_text = File.read(collection_mapping_path)\r\n\tcsv = CSV.parse(mapping_text)\r\n\tcsv.each do |item| \r\n\t\told_id = item[0]\r\n\t\tnew_id = item[2]\t\t\r\n\t\ttitle = item[1]\r\n\t\tputs \"working on \" + title\r\n\t\tcol = Object::Collection.find(new_id)\r\n\t\tcol.former_id = [old_id]\r\n\t\tcol = populate_collection(old_id, col, foxpath)\r\n\t\tcol.save!\r\n\tend\r\nend", "title": "" }, { "docid": "e0f5c04f76c2add18de44e0d81f5b775", "score": "0.48406327", "text": "def create_collection(name, config)\n solr_run \"/opt/solr/bin/solr create_collection -c #{name} -d #{config}\"\n end", "title": "" }, { "docid": "7f33ee4f2b09495ec58c50bc2d94876d", "score": "0.48307464", "text": "def\tcreateAndAddContent(content_data, index, user_id, collection_id)\n # create the content\n ref_id = generateWidgetId()\n \n title = content_data[\"title\"]\n content = content_data[\"content\"]\n \n print \"\\n~* creating the content page '#{title}' for the collection...\"\n \n data = {\n \"mimeType\" =>\t\"x-sakai/document\",\n \"structure0\" =>\tJSON.generate({\"page1\"=>{\"_ref\"=>ref_id,\"_order\"=>index,\"_title\"=>title,\"main\"=> {\"_ref\"=>ref_id,\"_order\"=>index,\"_title\"=>title}}})\n }\n response = prim_post(\"/system/pool/createfile\", data)\n json = JSON.parse(response.body())\n content_id = json[\"_contentItem\"][\"poolId\"]\n \n print \"\\n~* '#{title}' has a content id of #{content_id} \"\n \n \n # set the content\n data = {\n \":content\"=> JSON.generate({\n \"#{ref_id}\" => {\"page\" =>content}\n }),\n \":contentType\"=> \"json\",\n \":operation\"=> \"import\",\n \":replace\"=> true,\n \":replaceProperties\"=> true\n }\n \n response = prim_post(\"/p/#{content_id}\", data) \n print \"\\n~~ set content for '#{title}': \"\n print response\n \n # set filename and link access\n requests = [\n {\"url\"=>\"/p/#{content_id}\",\"method\"=>\"POST\",\"parameters\"=>{\n \"sakai:pooled-content-file-name\"=>title,\n \t\t \"sakai:pool-content-created-for\" => user_id,\n \"sakai:description\"=>\"\",\n \"sakai:permissions\"=>@collection_access,\n \"sakai:copyright\"=>\"creativecommons\",\n \"sakai:allowcomments\"=>\"true\",\n \"sakai:showcomments\"=>\"true\"\n }\n }\n ]\n \n if content_data.has_key?(\"skin\") then\n requests[0][\"parameters\"][\"sakai:customStyle\"] = content_data[\"skin\"]\n\tend\n \n response = post_batch(requests)\n print \"\\n~~ batch access for '#{title}': \"\n print response\n \n # set access\n if @collection_access === \"everyone\" then\n\t\trequests = [\n\t\t\t{\"url\"=>\"/p/#{content_id}.members.html\",\"method\"=>\"POST\",\"parameters\"=>{\":viewer@Delete\"=>\"anonymous\", \":viewer\"=>@collection_access}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.modifyAce.html\",\"method\"=>\"POST\",\"parameters\"=>{\"principalId\"=>@collection_access,\"privilege@jcr:read\"=>\"granted\"}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.modifyAce.html\",\"method\"=>\"POST\",\"parameters\"=>{\"principalId\"=>\"anonymous\",\"privilege@jcr:read\"=>\"denied\"}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.members.json\",\"method\"=>\"POST\",\"parameters\"=>{\":manager@Delete\"=>@user}}, \n\t\t\t{\"url\"=>\"/p/#{content_id}.members.json\",\"method\"=>\"POST\",\"parameters\"=>{\":manager\"=>user_id,\":viewer@Delete\"=>user_id}}\n\t\t]\n elsif @collection_access === \"public\" then\n\t\trequests = [\n\t\t\t{\"url\"=>\"/p/#{content_id}.members.html\",\"method\"=>\"POST\",\"parameters\"=>{\":viewer\"=>[\"everyone\",\"anonymous\"]}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.modifyAce.html\",\"method\"=>\"POST\",\"parameters\"=>{\"principalId\"=>[\"everyone\"],\"privilege@jcr:read\"=>\"granted\"}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.modifyAce.html\",\"method\"=>\"POST\",\"parameters\"=>{\"principalId\"=>[\"anonymous\"],\"privilege@jcr:read\"=>\"granted\"}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.members.json\",\"method\"=>\"POST\",\"parameters\"=>{\":manager\"=>user_id,\":manager@Delete\"=>@user}}\n\t\t]\n elsif @collection_access === \"private\" then\n\t\trequests = [\n\t\t\t{\"url\"=>\"/p/#{content_id}.members.html\",\"method\"=>\"POST\",\"parameters\"=>{\":viewer@Delete\"=>[\"anonymous\",\"everyone\"]}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.modifyAce.html\",\"method\"=>\"POST\",\"parameters\"=>{\"principalId\"=>[\"everyone\"],\"privilege@jcr:read\"=>\"denied\"}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.modifyAce.html\",\"method\"=>\"POST\",\"parameters\"=>{\"principalId\"=>[\"anonymous\"],\"privilege@jcr:read\"=>\"denied\"}},\n\t\t\t{\"url\"=>\"/p/#{content_id}.members.json\",\"method\"=>\"POST\",\"parameters\"=>{\":manager\"=>user_id,\":manager@Delete\"=>@user}}\n\t\t]\n\n end \n response = post_batch(requests)\n print \"\\n~~ batch access (again) for '#{title}': \"\n print response\n \n # add to collection\n prim_post(\"/p/#{content_id}.members.html\", {\":viewer\"=>\"c-#{collection_id}\"})\n print \"\\n~~ add '#{title}' to collection: \"\n print response \nend", "title": "" }, { "docid": "79df13b08015561d866834837dc1d05f", "score": "0.4829226", "text": "def find_or_create_library_collection(description, user, params)\n collection = LibraryCollection.where(desc_metadata__description_tesim: description).first\n if collection.nil?\n collection = LibraryCollection.new\n collection.attributes = params\n collection.apply_depositor_metadata(user.user_key)\n collection.save!\n end\n collection\nend", "title": "" }, { "docid": "c21790c4e1fb3cf5e4f69f1558d3f443", "score": "0.48193142", "text": "def set_sca_projects\n # set new this array to empty each time database is queried\n new_sca_projects_array = []\n\n # LCGMS data does not have districts and subdistricts, so we have to loop through each subdistrict,\n # and check whether a school intersects the subdistrict's geom\n # in the final object, district and subdistrict values come from the subdistricts table\n subdistricts.each do |subdistrict|\n subdistrict_geom = subdistrict[:geom]\n\n sca_schools = CeqrData::ScaCapitalProjects.version(\n data_package.table_for(\"sca_capital_projects\")\n ).sca_projects_intersecting_subdistrict_geom(\n subdistrict_geom\n )\n\n # here we push the reformatted objects into new_sca_projects_array\n # for school_object_lcgms (defined in private methods) we have two arguments:\n # 1-the school object that we query the database for,\n # 2-the subdistrict object that we query the database for (this is used to populate the district & subdistrict properties)\n sca_schools.each do |school|\n new_sca_projects_array << school_object_sca_projects(school, subdistrict)\n end\n end\n\n self.sca_projects = new_sca_projects_array\n end", "title": "" }, { "docid": "750fced3875cfe1f1bb952850e2dede6", "score": "0.48182547", "text": "def work_params\n params.require(:work).permit(:title, :existed_works_id)\n end", "title": "" } ]
350eb2e133c6323011710f2015ab2209
.css file paths array
[ { "docid": "bdb232e46af82db5c816dc8ae1a95fc8", "score": "0.0", "text": "def css_files\n exclude_dist_folder(Dir.glob(\"./**/*.css\"))\n end", "title": "" } ]
[ { "docid": "d3f6ad849c39346b3efbb81aab2a21c5", "score": "0.76195574", "text": "def ar_CSS_files_array\n ar_out=Dir::glob(@s_project_fp_prefix_1+\"/demo_2_file_v*.css\")\n return ar_out\n end", "title": "" }, { "docid": "a694937236933ac519d9393a90a803df", "score": "0.7538923", "text": "def custom_css_paths\n @user_configuration.custom_css_files.map do |css_file|\n css_file.to_s.empty? ? nil : File.join(@user_configuration.public_url, css_file)\n end.compact\n end", "title": "" }, { "docid": "693db9b35523baf9b84c0cd6b6b14f90", "score": "0.72951096", "text": "def sub_file_stylesheet_locs\n \"<link href=\\\"#{bootstrap_cdn}\\\" rel=\\\"stylesheet\\\">\n <link href=\\\"../css/styles.css\\\" rel=\\\"stylesheet\\\">\n <link href=\\\"../css/rubyhighlights.css\\\" rel=\\\"stylesheet\\\">\"\n end", "title": "" }, { "docid": "46ec9af3ea7c71b7122a8eafdbc3ea73", "score": "0.71744245", "text": "def find_css(path = @path)\n Dir.glob(path).select { |f| File.file? f }.map { |file| file }\n end", "title": "" }, { "docid": "80c9ac0f34456720bb0a327fd70f7700", "score": "0.708365", "text": "def main_file_stylesheet_locs\n \"<link href=\\\"#{bootstrap_cdn}\\\" rel=\\\"stylesheet\\\">\n <link href=\\\"css/styles.css\\\" rel=\\\"stylesheet\\\">\n <link href=\\\"css/rubyhighlights.css\\\" rel=\\\"stylesheet\\\">\"\n end", "title": "" }, { "docid": "d656811624b043e64171207454ca12f5", "score": "0.7063097", "text": "def css_logical_paths\n select_by_extension(logical_paths, '.css')\n end", "title": "" }, { "docid": "3d1fb38ceebc8e059d9a11a0c6ac99f4", "score": "0.7027933", "text": "def css_files\n @css_files ||= Jasmine::Core.css_files\n end", "title": "" }, { "docid": "ff1d7ef1e9812a5468a26028effbace2", "score": "0.7000333", "text": "def css_digest_paths\n select_by_extension(digest_paths, '.css')\n end", "title": "" }, { "docid": "257ea326ca913758b7955f82299f0dde", "score": "0.6956938", "text": "def css_file_names\n path = css_path\n unlisted = path && Dir.exists?(path) ? Dir.entries(path).reject{|e| e[0] == '.'} : []\n names = (config.css_file_order || []) | unlisted\n names = names.select { |name| name =~ css_suffixes_regexp }\n names\n end", "title": "" }, { "docid": "2beae0e99d534d2ff9e834c60d125f30", "score": "0.69288623", "text": "def linked_css_files\n @_linked_css_files ||= @doc.search('link[@type=\"text/css\"]').collect do |l|\n href = l.attributes['href']\n if href.include? '?'\n href[0..(href.index('?') - 1)]\n else\n href\n end\n end\n end", "title": "" }, { "docid": "7d11b8e6c92f363dc18bd6486ea7245c", "score": "0.68289286", "text": "def linked_style_array(theme_names_array)\n links = []\n theme_names_array.each do |l|\n url = File.join( \"#{options[:themes_css_url]}\" ,\"#{l}.css\")\n links << \"<link rel='stylesheet' href='#{url}' type='text/css' media='screen' charset='utf-8'>\"\n end\n links\n end", "title": "" }, { "docid": "3d8added3d7dcda678c04b0f52d7f4c3", "score": "0.6822785", "text": "def all_paths\n [File.join(themes_dir, special_subdir), File.join(themes_dir, base_subdir)] \n end", "title": "" }, { "docid": "e1d009eae9a264046ce591cbbc0e0bbd", "score": "0.68115145", "text": "def files; @files ||= [{style_path => 'EPUB/style'}]; end", "title": "" }, { "docid": "6e1d416928325242d6fcf72b67725eba", "score": "0.6810799", "text": "def dependencies\n list = []\n File.open(@local_path) do |file|\n file.each_line do |line|\n case line\n when %r' href=\"([^\"]+\\.css)\"' ; list << I3.resource($1)\n when %r' src=\"([^\"]+\\.js)\"' ; list << I3.resource($1)\n end #case\n end #each_line\n end #open\n list.find_all { |path| File.exist?(path) }\n end", "title": "" }, { "docid": "0959ec3bfbe1fca430c7b8d629689088", "score": "0.6809058", "text": "def uniq_css_path(*assets)\n paths = []\n assets.collect.flatten.each do |filename|\n paths.push(Merb::Assets::UniqueAssetPath.build(asset_path(:stylesheet,filename)))\n end\n paths.length > 1 ? paths : paths.first\n end", "title": "" }, { "docid": "9f45986cb286f8e06d850c88e9c72983", "score": "0.6759921", "text": "def custom_css_files\n custom_resource \"css\" do |path|\n css path\n end\n end", "title": "" }, { "docid": "32d322d8b291b805cd3be05597baaa80", "score": "0.67185766", "text": "def css_sources\n @css_sources ||= preferred_sources([*@css_resource])\n end", "title": "" }, { "docid": "b1aaa9e6dde197531deb192d2c7b793a", "score": "0.66918755", "text": "def get_css_files(site, relative_dir)\n # not sure if we need to do this, but keep track of the current dir\n pwd = Dir.pwd\n Dir.chdir(File.join(site.config['source'], relative_dir))\n # read css files\n css_files = Dir.glob('*.css').map{ |f| File.join(relative_dir, f) }\n Dir.chdir(pwd)\n\n return css_files\n end", "title": "" }, { "docid": "b1aaa9e6dde197531deb192d2c7b793a", "score": "0.66918755", "text": "def get_css_files(site, relative_dir)\n # not sure if we need to do this, but keep track of the current dir\n pwd = Dir.pwd\n Dir.chdir(File.join(site.config['source'], relative_dir))\n # read css files\n css_files = Dir.glob('*.css').map{ |f| File.join(relative_dir, f) }\n Dir.chdir(pwd)\n\n return css_files\n end", "title": "" }, { "docid": "c6a09c45ac774e36b2ab7ea9acd19002", "score": "0.6644855", "text": "def stylesheets\n sheets = File.expand_path(\"public/stylesheets\")\n sheets_ary = Dir.entries(sheets).select{|x| x[0..0] != \".\"}\n sheets_ary.map!{|f| f.split(\".\")[0]}\n footer = \"#{sheets_ary.length} Stylesheets\"\n sheets_ary << [\"=\"*footer.length,footer ]\n y sheets_ary.flatten!\n end", "title": "" }, { "docid": "2e128c421c2179842553e4d5b253434e", "score": "0.66269815", "text": "def files\n @files ||= (css_sources.empty? ? combination_sources : css_sources)\n end", "title": "" }, { "docid": "7206611d7ef9e6f1c58815c4cf66d7f0", "score": "0.6564907", "text": "def possible_files(context, path, base_path)\n path = Pathname.new(path)\n base_path = Pathname.new(base_path).dirname\n partial_path = partialize_path(path)\n additional_paths = [Pathname.new(\"#{path}.css\"), Pathname.new(\"#{partial_path}.css\"), Pathname.new(\"#{path}.css.#{syntax(path)}\"), Pathname.new(\"#{partial_path}.css.#{syntax(path)}\")]\n paths = additional_paths.concat([path, partial_path])\n\n # Find base_path's root\n paths, root_path = add_root_to_possible_files(context, base_path, path, paths)\n [paths.compact, root_path]\n end", "title": "" }, { "docid": "63929703ede22e001c047033f420db18", "score": "0.6532965", "text": "def load_scss_load_paths\n Dir.glob(@path).select { |d| File.directory? d}.each do |directory|\n Sass.load_paths << directory\n end\n end", "title": "" }, { "docid": "157bc426a9c32e8b909c8c3a11d716d2", "score": "0.65035325", "text": "def get_files(files, path)\n files.map do |file|\n item = @items.find { |i| i.identifier.to_s[%r{/#{path}/#{file}(?:\\.css)?/}] }\n puts \"File #{file} doesn't exist!\" unless item\n item.compiled_content\n end.join(\"\\n\")\nend", "title": "" }, { "docid": "1cc28aaacf4ed4cb8868081b505c23bf", "score": "0.6464805", "text": "def stylesheets\n @stylesheets ||= Array.new()\n return @stylesheets\n end", "title": "" }, { "docid": "bd408625afadc30f18bc17bed067123b", "score": "0.6446446", "text": "def stylesheet_path(path); end", "title": "" }, { "docid": "bd408625afadc30f18bc17bed067123b", "score": "0.6446446", "text": "def stylesheet_path(path); end", "title": "" }, { "docid": "bd408625afadc30f18bc17bed067123b", "score": "0.6446446", "text": "def stylesheet_path(path); end", "title": "" }, { "docid": "bd408625afadc30f18bc17bed067123b", "score": "0.6446446", "text": "def stylesheet_path(path); end", "title": "" }, { "docid": "b1fd1e1c502d916589cd3d83304b2db0", "score": "0.6445192", "text": "def rc_files(path)\n path = rewrite(path)\n rcs = []\n Pathname.new(\"/\"+path.to_s).ascend { |pa| rcs << (pa + Scrapple.config['rc_file']) }\n rcs.map { |rc| relative(rc) }.select { |rc| exist?(rc) }\n end", "title": "" }, { "docid": "26afed3877d6384bf01cee70ac92a75f", "score": "0.639984", "text": "def sass_load_paths\n @sass_load_paths ||= [project_src_directory] + Compass::Frameworks::ALL.map{|f| f.stylesheets_directory}\n end", "title": "" }, { "docid": "e9fbc68ef1adac5e93293e976e2401e3", "score": "0.63793653", "text": "def stylesheet_path\n files = Dir.glob(\"#{@path}#{File::SEPARATOR}*.css\") \n if files.size > 0\n files[0]\n else\n nil\n end\n end", "title": "" }, { "docid": "e325e9d3a43768a2a6184b270c7ad1ff", "score": "0.6336376", "text": "def set_css_files(files)\n # define class method to get the data out\n m = class << self; self; end\n m.send :define_method, :css_files do\n files\n end\n \n class_eval do\n define_method :css_files do\n files\n end\n end\n end", "title": "" }, { "docid": "928b95630e17f1f773bec9b7c356f18e", "score": "0.63320583", "text": "def css_sprite_directories\n\t\tDir.entries(@image_path).collect do |d|\n\t\t\tFile.join(@image_path, d) if File.directory?(File.join(@image_path, d)) and d =~ /css_sprite$/\n\t\tend.compact\n\tend", "title": "" }, { "docid": "cf5426bc9e5dacd294a2bc55040c034b", "score": "0.6321789", "text": "def paths\n [\n {\n \"name\" => \"system\",\n \"path\" => @ruhoh.paths.system\n }, \n {\n \"name\" => \"base\",\n \"path\" => @ruhoh.paths.base\n }, \n {\n \"name\" => \"theme\",\n \"path\" => @ruhoh.paths.theme\n }\n ]\n end", "title": "" }, { "docid": "22617d39d6c95d3d186ce15e6af2774d", "score": "0.6315138", "text": "def get_stylesheets\n return [] unless page_exists?\n\n # Get all the stylesheet links (URLs), using Nokogiri\n css_links = get_doc.css('link').select{ |css_link| css_link['rel'] == 'stylesheet' }\n .map{ |css_link| css_link['href'] }\n .compact\n\n # Create the absolute path of the CSS links\n css_links.map!{ |css_link| create_absolute_url( css_link ) }\n\n return css_links.uniq # Return links to CSS files without duplicates\n end", "title": "" }, { "docid": "a04526cc8777f98bb028547676a87a59", "score": "0.6307711", "text": "def stylesheets\n @stylesheets ||= Array(settings.stylesheets.clone)\n end", "title": "" }, { "docid": "8ade1260acb9399633d21f686763ab1a", "score": "0.6235437", "text": "def stylesheets(*paths)\n paths.push '/stylesheets' if paths.empty?\n paths.each do |route|\n match \"#{route}/*path.:format\", :to => 'assets/stylesheets#go'\n end\n end", "title": "" }, { "docid": "5fca4052a047265caaa12a508ea8762b", "score": "0.6232944", "text": "def css_sprite_directories\n Dir.entries(@source_images_path).collect do |d|\n File.join(@source_images_path, d) if File.directory?(File.join(@source_images_path, d)) and d =~ /css_sprite$/\n end.compact\n end", "title": "" }, { "docid": "993c606e8b4c02a52b9055d1280b5e6e", "score": "0.6214823", "text": "def all_assets_path\r\n Dir.glob( File.join(self.base_root, \"*\") ).map do |theme_name|\r\n assets_path( File.basename(theme_name) )\r\n end.flatten\r\n end", "title": "" }, { "docid": "8eb06a89aa26f05d33ea2b5011650b4c", "score": "0.6207962", "text": "def search_paths(path)\r\n # [\"#{path}/theme/#{this_auth[:theme]}/\",\r\n # ]\r\n end", "title": "" }, { "docid": "d395ba036bb37a5aeabf9ea39eee724f", "score": "0.61973554", "text": "def paths\n a = [\n {\n \"name\" => \"system\",\n \"path\" => system\n },\n {\n \"name\" => \"base\",\n \"path\" => base\n }\n ]\n a << {\n \"name\" => \"theme\",\n \"path\" => theme\n } if theme\n\n a\n end", "title": "" }, { "docid": "e5acff09f4f75af38ae1b278850956e0", "score": "0.61948794", "text": "def asset_paths; end", "title": "" }, { "docid": "e243b328e5788d3f36c09730c233db5d", "score": "0.6182511", "text": "def stylesheet_folder(path)\n if use_cache? # or browser_is? :ie\n return stylesheet(\"min/#{path}.css\")\n else\n result = []\n Dir[\"#{Rails.public_path}/stylesheets/#{path}/**/*.css\"].each do |css|\n result << css.gsub(\"#{Rails.public_path}/stylesheets/\", \"\")\n end\n return stylesheet(result)\n end\n end", "title": "" }, { "docid": "808a73066494bc033961ebbf7f0c8a01", "score": "0.6177915", "text": "def stylesheet_url(path); end", "title": "" }, { "docid": "808a73066494bc033961ebbf7f0c8a01", "score": "0.6177915", "text": "def stylesheet_url(path); end", "title": "" }, { "docid": "53d8f351888eb37f122e6843a647309e", "score": "0.6139673", "text": "def get_additional_styles\n ctrl_style_url = \"skins/\" + SKIN + \"/page/\" + params[:controller] + \"/overall.css\"\n page_style_url = \"skins/\" + SKIN + \"/page/\" + params[:controller] + \"/\" + params[:action] + \".css\"\n\n res = Array.new\n\n if check_asset_existency ctrl_style_url\n res << \"/assets/#{ctrl_style_url}\"\n end\n\n if check_asset_existency page_style_url\n res << \"/assets/#{page_style_url}\"\n end\n\t\n\tlogger.info \"styles res: \" + res.to_s\n\n return res\n end", "title": "" }, { "docid": "f3999f06e67a03a2be117aae36079501", "score": "0.6128988", "text": "def find_custom_css\n\n # loop through all of the css files in the output dir\n # to see if any are custom files.\n default_files = ['skeleton.css', 'normalize.css', 'rain.css']\n custom_css = []\n Dir.foreach('./rain_out/css') do |file_name|\n if !default_files.include?(file_name) && file_name != '.' && file_name != '..'\n custom_css << \"css/#{file_name}\"\n end\n end\n\n custom_css\n end", "title": "" }, { "docid": "0b82f98921e9c8ddb0e51afca42f8064", "score": "0.61281574", "text": "def filepaths\n list = []\n list += documents\n list += bins\n list += etcs\n return list\n end", "title": "" }, { "docid": "95aa4526b8526df6333f7ec7fc86dac2", "score": "0.6127713", "text": "def css\n [\"#{ @domain }/application.css\"]\n end", "title": "" }, { "docid": "0d9dcea958da0651d56490f816bbc352", "score": "0.6109793", "text": "def fb_css *sheets \r\n @lib_imports ||= {}\r\n styles = \"\"\r\n sheets.each do |sheet|\r\n next if @lib_imports[sheet]\r\n @lib_imports[sheet] = true\r\n path = File.join(\"public\",stylesheet_path(sheet)).gsub(/\\?\\d+/,'')\r\n File.open(path,\"r\") do |f|\r\n styles << f.read\r\n end\r\n end\r\n #return content_tag(:style,styles,:assetserver=>ApplicationController::APP_ASSET_SERVER)\r\n parse_styles styles,ApplicationController::APP_ASSET_SERVER\r\n end", "title": "" }, { "docid": "35380a7b17f0844ea3f6da469bf9d32a", "score": "0.61017936", "text": "def css_in_a_folder\n @css_in_a_folder ||= begin\n if path_folder_css.exists?\n Dir[\"#{path_folder_css}/**/*.css\"]\n end\n end\n end", "title": "" }, { "docid": "5a609b6b7ac48d93488a39ac98016ab1", "score": "0.6101447", "text": "def sass_import_paths\n @sass_import_paths ||= [Rails.root.join(\"app/assets/stylesheets\")]\n end", "title": "" }, { "docid": "90b09e251f56f20fe3bf58254e5600e4", "score": "0.6098466", "text": "def asset_files\n asset_files = []\n Find.find(ENGINE.assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(ENGINE.stylesheets_sass_path)\n asset_files << path.sub(ENGINE.assets_path, 'assets')\n end\n asset_files\n end", "title": "" }, { "docid": "349e791eaf7c32c74cd3f2d286b73317", "score": "0.6095086", "text": "def style(*args)\n args.map do |path|\n tag :link, \"\", :rel => 'stylesheet', :href => to_relative('css/'+path+'.css')\n end.join ''\n end", "title": "" }, { "docid": "c31787437876b23f2495dce37b21d6da", "score": "0.60902965", "text": "def themes()\n source = \"./themes/\"\n \n cluster = []\n \n if File.directory? source\n Dir.foreach(source) do |cf|\n unless cf == '.' || cf == '..' \n cluster << cf.split('.').first\n end \n end\n end \n \n return cluster\n \n end", "title": "" }, { "docid": "eb0878d04d9bde80eaae7a453c2d01cb", "score": "0.608374", "text": "def stylesheet_links\n @stylesheet_links ||= []\n end", "title": "" }, { "docid": "699521318740a70b951b70a863785c94", "score": "0.6066812", "text": "def all_css\n css_files = Dir.glob File.join(RAILS_ROOT, \"public/stylesheets/\",\"*.css\")\n css_content = \"\"\n css_files.each {|file| css_content << IO.read(file)}\n \n css_content.instance_eval do\n \n # opens with less command\n def open\n less self\n # system('echo \"' << self << '\"|less')\n end\n \n end\n \n css_content\n end", "title": "" }, { "docid": "b64ea04b22c0033303a7e7261dc19caf", "score": "0.6063053", "text": "def assets\n # This singleton guard removes ordering coupling between assets() & static()\n @doc ||= compile\n\n # matches url(<path>) and returns the path as a capture group\n urlsrc = /url\\([\\\"\\']?(.*?)(?:[#\\?].*)?[\\\"\\']?\\)/\n\n # get all image and url() sources\n files = @doc.search('img').map {|img| img[:src] }\n @doc.search('*').each do |node|\n next unless node[:style]\n next unless matches = node[:style].match(urlsrc)\n files << matches[1]\n end\n\n # add in images from css files too\n css_files.each do |css_path|\n data = File.read(File.join(Showoff::Config.root, css_path))\n\n # @todo: This isn't perfect. It will match commented out styles. But its\n # worst case behavior is displaying a warning message, so that's ok for now.\n data.scan(urlsrc).flatten.each do |path|\n # resolve relative paths in the stylesheet\n path = File.join(File.dirname(css_path), path) unless path.start_with? '/'\n files << path\n end\n end\n\n # also all user-defined styles and javascript files\n files.concat css_files\n files.concat js_files\n files.uniq\n end", "title": "" }, { "docid": "0c63991061ed7c94e8d832432bc792d4", "score": "0.6058534", "text": "def paths\n @paths ||= pathnames.map(&:to_s)\n end", "title": "" }, { "docid": "94c4b8c3bec056a3e15ca813a48cba5b", "score": "0.605126", "text": "def chili_pdf_stylesheets(wants_html)\n file_type_list(:css, PLUGIN_CSS_DIR, wants_html) {|asset_path|\n \"<link href='#{asset_path}' rel='stylesheet' type='text/css' />\\n\"\n }.join(\"\\n\")\n end", "title": "" }, { "docid": "8994b0b6cf1543e9bf52606f66b45794", "score": "0.604623", "text": "def stylesheet_links\n @stylesheet_links ||= []\n end", "title": "" }, { "docid": "69cb08dfe40fc61c017987b16d886e12", "score": "0.6023063", "text": "def paths\n [\n File.join(\n ENV[\"HOME\"],\n \".crowbarrc\"\n ),\n File.join(\n \"/etc\",\n \"crowbarrc\"\n )\n ]\n end", "title": "" }, { "docid": "a5316b881feed7876cdcb080978f757c", "score": "0.6019356", "text": "def urls\n return { :original => file.url(:original) } unless image?\n file.styles.keys.inject({}) do |hash, style|\n hash.merge!(style => file.url(style))\n end\n end", "title": "" }, { "docid": "674b142fd8ff6eeaaa25d3c17bb6c1bf", "score": "0.60191154", "text": "def get_style_values\n return styles_with_relative_path\n end", "title": "" }, { "docid": "ca6306b5b43ab43885aa3915988e4c6f", "score": "0.60140383", "text": "def used_paths\n files = source_files(false) + resources(false) + preserve_paths + [ readme_file, license_file, prefix_header_file ]\n files.compact\n end", "title": "" }, { "docid": "15255d8f261eb602a9b2ebdc76db62ca", "score": "0.5987453", "text": "def css_path\n path.split(%r{/}).map do |part|\n part.empty? ? nil : part.gsub(/\\[(\\d+)\\]/, ':nth-of-type(\\1)')\n end.compact.join(\" > \")\n end", "title": "" }, { "docid": "65bfac409c739b7858643eafd5cd0add", "score": "0.5986367", "text": "def stylesheet_group(files)\n # Check for overrides\n browser = nil\n overrides = []\n if ie6?\n # IE6 does it differently -- it needs both ie7 and ie6 stylesheets\n browser = 'ie6'\n files.each do |f|\n overrides << \"#{f}_ie7\" if File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, \"#{f}_ie7.css\"))\n overrides << \"#{f}_ie6\" if File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, \"#{f}_ie6.css\"))\n end\n else\n # Other browsers need just the single override stylesheet\n ['ie7', 'safari'].each do |b|\n if self.send(\"#{b}?\")\n browser = b\n files.each { |f| overrides << \"#{f}_#{b}\" if File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, \"#{f}_#{b}.css\")) }\n end\n \tend\n end\n \t\n \t# If overrides exist, merge them with ordinary files and create cached copy tagged by browser\n \tstyle_tag_args = []\n \tif browser.nil? || overrides.empty?\n style_tag_args += files\n else\n style_tag_args += files\n style_tag_args += overrides\n end\n \n # Return style tag(s)\n stylesheet_link_tag(*style_tag_args)\n end", "title": "" }, { "docid": "49f8d813a26fdcc6e73a6d10d523dc62", "score": "0.5977922", "text": "def getIncludesCssFiles(a)\n page = @context.registers[:page]\n page[\"pIncludesCss\"]\n end", "title": "" }, { "docid": "a5d72a2422ef5cc5afe996fa01866f7c", "score": "0.59720904", "text": "def path_folder_css\n @path_folder_css ||= folder_parent+\"#{affixe}/css\"\n end", "title": "" }, { "docid": "d752a1fa349427b1bc85b9293495f577", "score": "0.59704137", "text": "def middleman_resources\n [vendor_css, app_css, vendor_js, app_js]\n end", "title": "" }, { "docid": "e97c2b0c1b758053370110ca5e2f6f3d", "score": "0.5957516", "text": "def files\n FileUtils.cd(@ruhoh.cascade.theme) {\n return Dir[\"**/*\"].select { |filepath|\n is_valid_asset?(filepath)\n }\n }\n end", "title": "" }, { "docid": "898467cb3e32ddeb86072584015b3321", "score": "0.59498155", "text": "def assets_path(name)\r\n [ images_path(name), javascripts_path(name), stylesheets_path(name) ]\r\n end", "title": "" }, { "docid": "2ceac4d38c3562c9963bd21cdc3bd880", "score": "0.5946392", "text": "def stylesheet(*files)\n\t\tcontent_for(:stylesheets) { stylesheet_link_tag(*files) } \n\tend", "title": "" }, { "docid": "ab893cda1103e484f1af87fc85ff2301", "score": "0.5943515", "text": "def paths\n @paths ||= []\n end", "title": "" }, { "docid": "76e30b8cdcb8aa28081352957aec10ad", "score": "0.59230065", "text": "def css_path\n if File.exist? File.join(main_folder, 'css')\n File.join(main_folder, 'css', \"#{affixe}.css\")\n else\n File.join(folder, \"#{affixe}.css\")\n end\n end", "title": "" }, { "docid": "a28d6f2a880e36af9257fd03cd4088f2", "score": "0.5918692", "text": "def concatenate_and_tag_assets(paths, variant=nil)\n stylesheets = [paths].flatten.map do |css_path|\n contents = read_binary_file(css_path)\n contents.gsub(EMBED_DETECTOR) do |url|\n ipath, cpath = Pathname.new($1), Pathname.new(File.expand_path(css_path))\n is_url = URI.parse($1).absolute?\n is_url ? url : \"url(#{construct_asset_path(ipath, cpath, variant)})\"\n end\n end\n stylesheets.join(\"\\n\")\n end", "title": "" }, { "docid": "3da56295817fbd6f12c268c75070f790", "score": "0.5901675", "text": "def ui_css(files=nil)\n return raw \"<link rel=\\\"stylesheet\\\" href=\\\"/stylesheets/themes/ui-lightness/jquery.ui.all.css\\\"/><br/>\"\n return raw \"<link rel=\\\"stylesheet\\\" href=\\\"/stylesheets/themes/ui-lightness/jquery.ui.base.css\\\"/><br/>\"\nend", "title": "" }, { "docid": "3250e78f4503b49286c18b638e3111fc", "score": "0.5896144", "text": "def stylesheet_links_for_controller\n controller_css = \"#{@controller.controller_path}.css\"\n path = \"#{RAILS_ROOT}/public/stylesheets/#{controller_css}\"\n stylesheet_link_tag(controller_css) if File.exists? path\n end", "title": "" }, { "docid": "4fa01609c46afe6149fc9d69d4dd9500", "score": "0.5895095", "text": "def resolve_wildcard_import(context, path, cwd)\n trail = context.environment.instance_variable_get(:@trail)\n pathnames = []\n\n _path = File.join(cwd, path)\n trail.entries(_path[0...-1]).each do |candidate|\n candidate = _path.gsub(\"*\", candidate.to_s)\n pathnames << candidate if \"text/css\" == context.environment.content_type_of(candidate) \n end if pathnames.blank?\n\n _path = File.join(cwd, path).gsub(/.+\\/assets\\/stylesheets\\//, \"\")\n trail.entries(_path[0...-1]).each do |candidate|\n candidate = _path.gsub(\"*\", candidate.to_s)\n pathnames << candidate if \"text/css\" == context.environment.content_type_of(candidate) \n end if pathnames.blank?\n\n _path = path\n trail.entries(_path[0...-1]).each do |candidate|\n candidate = _path.gsub(\"*\", candidate.to_s)\n pathnames << candidate if \"text/css\" == context.environment.content_type_of(candidate) \n end if pathnames.blank?\n\n pathnames\n end", "title": "" }, { "docid": "fff3c036006d44d3d5f112d0d70f38ee", "score": "0.5894328", "text": "def mhtml_css_filepath(path)\n @file_manager.cache_path_with_prefix(IE_FILE_PREFIX, path)\n end", "title": "" }, { "docid": "34360b91b50b5c92d17ddab84508f67f", "score": "0.58899134", "text": "def stylesheets(*params)\n options = (params.last.is_a? Hash) ? params.pop : {}\n \n options[:media] = 'all' unless options.has_key?(:media)\n options[:rel] = 'stylesheet'; options[:type] = 'text/css'\n\n src_files = @staticmatic.src_file_paths('sass','scss','css')\n output = \"\"\n\n if params.length == 0\n # no specified files; include them all!\n src_files.each {|path| output << format_output(:link,path,options) }\n else\n # specific files requested and in a specific order\n params.each do |file|\n\n if file.to_s.match %r{^https?://}\n output << format_output(:link,file,options)\n else\n idx = src_files.index do |src|\n %w{sass scss css}.map {|t| src.match /#{file}\\.#{t}$/ }.any?\n end\n output << format_output(:link,src_files[idx],options) unless idx.nil?\n end\n end\n end\n output\n end", "title": "" }, { "docid": "ab8106e0c871d544ecf665fa7d091eca", "score": "0.5881642", "text": "def file_path\n paths = {}\n (attachment.styles.keys+[:original]).each{|style|\n paths[style] = attachment.url(style)\n }\n return paths\n end", "title": "" }, { "docid": "db8dcbd81dbdc02ce1b0c6a41aae6729", "score": "0.58810747", "text": "def paths\n @paths ||= Config::AssetsPaths.new(@root)\n end", "title": "" }, { "docid": "f1dce0e84af7ed3a6415f273c3640205", "score": "0.5874936", "text": "def urls\n styles_from_options.map { |style, _|\n [style, attachment.url(style)]\n }.to_h\n end", "title": "" }, { "docid": "a01998caf7a507c3746827ed1fb93c33", "score": "0.58613884", "text": "def source_paths\n [File.dirname(__FILE__)]\n end", "title": "" }, { "docid": "8ba2a726e5634d93b5a50ad31f7d335c", "score": "0.5856236", "text": "def stylesheets(*params)\n options = {}\n if params.last.is_a?(Hash)\n options = params.last\n params.slice!(-1, 1)\n end\n options[:media] = 'all' unless options.has_key?(:media)\n options[:rel] = 'stylesheet'; options[:type] = 'text/css'\n\n relative_path = current_page_relative_path\n\n output = \"\"\n if params.length == 0\n # no specific files requested so include all in no particular order\n stylesheet_dir = File.join(@staticmatic.src_dir, 'stylesheets')\n stylesheet_directories = Dir[File.join(stylesheet_dir, '**','*.{sass,scss}')]\n\n # Bit of a hack here - adds any stylesheets that exist in the site/ dir that haven't been generated from source sass\n Dir[File.join(@staticmatic.site_dir, 'stylesheets', '*.css')].each do |filename|\n search_filename = File.basename(filename).chomp(File.extname(filename))\n already_included = false\n stylesheet_directories.each do |path|\n if File.basename(path).include?(search_filename)\n already_included = true\n break\n end\n end\n\n stylesheet_directories << filename unless already_included\n end\n\n stylesheet_directories.each do |path|\n\n filename_without_extension = File.basename(path).chomp(File.extname(path))\n\n if !filename_without_extension.match(/^\\_/)\n\n path = path.gsub(/#{@staticmatic.src_dir}/, \"\").\n gsub(/#{@staticmatic.site_dir}/, \"\").\n gsub(/#{filename_without_extension}\\.(sass|scss|css)/, \"\")\n\n options[:href] = File.join(relative_path, path, \"#{filename_without_extension}.css\")\n output << tag(:link, options)\n end\n end\n else\n #specific files requested and in a specific order\n params.each do |file|\n if File.exist?(File.join(@staticmatic.src_dir, 'stylesheets', \"#{file}.sass\")) ||\n File.exist?(File.join(@staticmatic.src_dir, 'stylesheets', \"#{file}.scss\")) ||\n File.exist?(File.join(@staticmatic.site_dir, 'stylesheets', \"#{file}.css\"))\n options[:href] = File.join(relative_path, \"stylesheets\", \"#{file}.css\")\n output << tag(:link, options)\n end\n end\n end\n\n output\n end", "title": "" }, { "docid": "ba04dd5e24b79f5fd2ccd7a263e58d5a", "score": "0.5855525", "text": "def files\n load_paths.flatten.compact.uniq.flat_map{ |path| Dir[\"#{path}/**/*.rb\"] }\n end", "title": "" }, { "docid": "ef102c352c2334859b6aaebb6e71481f", "score": "0.58523506", "text": "def css(page_css) \n page_css.split(' ').each do |item|\n content_for(:css) do\n \"<link href=\\\"/stylesheets/#{page_css}.css\\\" rel='stylesheet' type='text/css'/>\\n\" \n end \n end\n end", "title": "" }, { "docid": "a9642364177427fc46292bda504b79de", "score": "0.5845544", "text": "def css_filepath(base_file_path)\n File.join(@settings[:cache_dir], FILE_PREFIX + File.basename(base_file_path))\n end", "title": "" }, { "docid": "276370b3c52d0f082429130113accf27", "score": "0.583695", "text": "def paths\n map{ |dir| Pathname.new(dir) }\n end", "title": "" }, { "docid": "89dc7aea1864e9d1296f924b6821a4f1", "score": "0.5836721", "text": "def ultraviolet_css(theme)\n Uv.path.each do |path|\n Dir[path/\"render/xhtml/files/css/*.css\"].each do |css|\n return css if File.basename(css, '.css') == theme\n end\n end\n end", "title": "" }, { "docid": "97eb4f9dce9de6ee551e97edc0104661", "score": "0.58358806", "text": "def paths\n @paths ||= [ custom_path, default_path ]\n end", "title": "" }, { "docid": "0520b41ae77f2ebd357e04e61f1cd29e", "score": "0.5834543", "text": "def add_css stylesheets\n stylesheets = [stylesheets] unless stylesheets.class == Array\n @css_added ||= []\n @css_added += stylesheets\n end", "title": "" }, { "docid": "3596fbe6fafb28eb2878ba4e7a1dd705", "score": "0.58330256", "text": "def stylesheets\n [\n [\"syntax/#{theme}\", {:plugin => \"redmine_syntaxhl_ultraviolet\"}]\n ]\n end", "title": "" }, { "docid": "cee27f106e98a486c5853e567e1e6883", "score": "0.5831521", "text": "def stylesheets(*paths, &block)\n @assets ||= Assets.new binding, controller, logger\n @assets.stylesheets *paths, &block\n end", "title": "" }, { "docid": "326695b7db1f4d38f5361436acb4fdf1", "score": "0.5818735", "text": "def files\n\t\tfiles_paths = get_directory_files('')\n\t\t\n\t\tfiles_paths\n\tend", "title": "" }, { "docid": "7be8914d8bfce27542b52af36da188f1", "score": "0.58160037", "text": "def css(path)\n dom.css(path).map {|n| n.text }\n end", "title": "" }, { "docid": "bac7532d4da489fa6eae7bb8224fa2de", "score": "0.5815765", "text": "def rewrite_css_paths\n [\"fonts\", \"images\"].each do |folder|\n pattern = %Q{url(\"..\\\\/#{folder}\\\\/}\n replacement = %Q{url(\"\\\\/packages\\\\/meteor-flat-ui\\\\/assets\\\\/#{folder}\\\\/}\n `sed -e 's/#{pattern}/#{replacement}/g' -i '' assets/css\\/flat-ui.css`\n end\nend", "title": "" }, { "docid": "93329a2c9d6a74f753f143f5cfabc0ae", "score": "0.58136123", "text": "def find_asset_files\n @css_files = Dir[File.join(@source_templates_dir, 'OEBPS', '*.css')].\n map { |f| File.basename(f) }\n @image_files = Dir[File.join(@source_templates_dir, 'OEBPS', 'images', '*')].\n map { |f| File.basename(f) }\n @font_files = Dir[File.join(@source_templates_dir, 'OEBPS', 'fonts', '*')].\n map { |f| File.basename(f) }\n end", "title": "" }, { "docid": "8d8a31833b5751dc0f06def0092f221b", "score": "0.58126163", "text": "def cpaths; end", "title": "" } ]
9ecdb2bd2f4055ed93105629c50192f2
===> we ask players if they want to play again
[ { "docid": "fdb9493113b75184b4bea43fde342668", "score": "0.6790549", "text": "def play_again\n if winner? == true || @valid_moves == []\n loop do\n puts \"Voulez-vous refaire une partie ? (O/N)\"\n print \"> \"\n answer = gets.chomp.upcase\n if answer == \"O\"\n return true\n elsif answer == \"N\"\n return false\n end\n break if answer == \"O\" || answer == \"N\"\n if answer != \"O\" && answer != \"N\"\n puts \"Choix invalide.\"\n end\n end\n end\n end", "title": "" } ]
[ { "docid": "ba50eb98c17b3b4d6e379d5036cc89ab", "score": "0.78976876", "text": "def play_again?\n\t\tplay_again = VR::Dialog.ok_box(\"Would you like to play again\")\n\n\t\tif play_again\n\t\t\treset_board\n\t\t\tif current_player_is_a_bot?\n\t\t\t\tbot_move\n\t\t\tend\n\t\telse\n\t\t\tquit\n \t\tend\n\tend", "title": "" }, { "docid": "51ee6af64a12170d42db6d9631d11034", "score": "0.7832917", "text": "def play_again_check\n\t\tputs \"Would you like to play again?\"\n\t\tinput = gets.chomp.downcase\n\t\tif input != \"no\" && input != \"n\"\n\t\t\tif input == \"yes\" || input == \"y\"\n\t\t\t\t@players.reverse!\n\t\t\t\tplay\n\t\t\telse\n\t\t\t\tputs \"Respond yes or no\"\n\t\t\t\tplay_again_check\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "9785ff61e6d0756595f8ed952f2c6872", "score": "0.7742776", "text": "def play_again\n\t \tputs \"Do you want to play again ? yes or no ?\"\n\t \tanswer = gets.chomp\n\t \t\tif answer == \"yes\"\n\t \t\tputs \"Here we go again\"\n\t \t\tGame.new.go\n\t \t else puts \"That is OK, we can stop playing\"\n\t \t\tend\n\tend", "title": "" }, { "docid": "6563ee6299fd94af4fd3d41a495584cd", "score": "0.7728752", "text": "def does_player_want_to_restart()\r\n\r\n\t\tbegin\r\n\t\t\tputs\r\n\t\t\tputs \"Do you want to play again? y/n\".colorize(:light_cyan)\r\n\t\t\tprint \"=> \"; play_again = STDIN.gets.strip.downcase[0]\r\n\t\t\tputs play_again\r\n\t\t\tif play_again == \"\"\r\n\t\t\t\traise StandardError\r\n\t\t\tend\r\n\t\trescue => exception\r\n\t\t\tputs\r\n\t\t\tputs \"Not a valid input sorry\\nPlease try again\".colorize(:light_red)\r\n\t\t\tpress_any_key()\r\n\t\t\tretry\r\n\t\tend\r\n\r\n\t\t# player wants to play again\r\n\t\treturn true if play_again == \"y\"\r\n\t\t# otherwise player does NOT want to play again\r\n\t\treturn false if play_again != \"y\"\r\n\tend", "title": "" }, { "docid": "fbd608f2ef5a2118e88778ab7b377d73", "score": "0.7542189", "text": "def want_to_play_again?\n\t\tputs\n\t\tputs \"Do you want to play again? y or n\"\n\t\tputs\n\t\tplay_again = gets.chomp.downcase\n\t\tif play_again == \"n\"\n\t\t\t@this_turn = @max_turns + 1\n\t\telse\n\t\t\t@letters_remain = true\n\t\t\t@bad_guesses = 0\n\t\tend #if\n\tend", "title": "" }, { "docid": "1261ba54e2ffd8f08f26b9102e10e794", "score": "0.7519993", "text": "def playagain(played = false)\n played ? (puts \"Would you like to play again?\") : (puts \"Welcome to the game, #{name}. Would you like to play?\")\n @player.name = \"You\"\n\n loop do\n puts \"(please answer 'yes' or 'no')\"\n answer = gets.chomp\n case answer.downcase\n when 'yes'\n self.resetgame\n return true\n when 'no'\n puts 'Please come again soon!'\n exit\n end\n end\n end", "title": "" }, { "docid": "232a0b2e139e1df98c848a14ac9421ee", "score": "0.75153434", "text": "def play_again\n\t\tagain = false\n\t\twhile !again\n\t\t\tputs 'Press 1 to play again, 2 to quit'\n\t\t\tresponse = gets.chomp.to_i\n\t\t\tif(response == 1)\n\t\t\t\tagain = true\n\t\t\t\tnew_game\n\t\t\telsif response == 2\n\t\t\t\texit\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "76c2dd73a2b8c91b34fccd6672f2dec5", "score": "0.748958", "text": "def play_again\n\tputs 'Would you like to play again? Type y or n'\n\tplay_game if gets.chomp.downcase == 'y'\n\t\tend", "title": "" }, { "docid": "96240ed076738b1d2b5c8afe8bdc8b15", "score": "0.7483021", "text": "def play_again?\n\t\tputs \"Want to play again? [Y/N]\"\n\t\twhile true\n\t\t\tresponse = gets.chomp.upcase\n\t\t\tcase response\n\t\t\t\twhen \"Y\"\n\t\t\t\t\trefresh_screen\n\t\t\t\t\t@board = Board.new\n\t\t\t\t\t@player = Player.new(@player.name, @board)\n\t\t\t\t\treturn true\n\t\t\t\t\tbreak\n\t\t\t\twhen \"N\"\n\t\t\t\t\trefresh_screen\n\t\t\t\t\tputs \"Goodbye!\"\n\t\t\t\t\treturn false\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tputs \"Press 'Y' to play again or 'N' to quit.\"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "e4c9399b32dc9078adf85aa4c8d71326", "score": "0.7481734", "text": "def play_again?\n out_list = []\n players.each do |player|\n if player.parent != player\n out_list << player\n next\n end\n puts say(\"Hi #{player.name},\")\n puts say('Would you like to play again? 1) Yes 2) No')\n loop do\n case gets.chomp\n when '1'\n puts say('Next round is coming soon...')\n break\n when '2'\n puts say('Have a good one.')\n out_list << player\n break\n else\n puts error_prompt('Input 1 or 2!')\n end\n end\n end\n out_list.each do |player|\n players.delete(player)\n end\n reset\n start_game\n end", "title": "" }, { "docid": "e919f4f8aab0d0568fb20f6dad6a8b73", "score": "0.7446262", "text": "def play_again?\n puts \"Would you like to play again? Type 'yes' or 'no':\"\n answer = gets.chomp\n if answer == \"yes\"\n puts \"\\n\\n\\n\"\n new_players = [\n player1 = Player.new(\"Player 1\"),\n player2 = Player.new(\"Player 2\")\n ]\n game = Game.new(new_players)\n game.play_game\n elsif answer ==\"no\"\n puts \"Good Bye!\"\n puts\n else\n play_again?\n end\n end", "title": "" }, { "docid": "145aaf4926eff60d42c0637278f97494", "score": "0.7399352", "text": "def play_again?\n while true\n play_again = (get_response_for \"Play again (y/n)\").downcase\n case play_again\n when 'y', 'yes' then return true\n when 'n', 'no' then return false\n end\n end\n end", "title": "" }, { "docid": "e9257ce15269358b47071174c99e9d08", "score": "0.7398839", "text": "def play_again\n\t\tputs \"\\nPlay again ('yes' or 'no')?\"\n\t\tresponse = gets.chomp.strip.downcase\n\t\tif response == \"yes\"\n\t\t\tinitialize\n\t\telsif response == \"no\"\n\t\t\tputs \"\\nGoodbye!\\n\\n\"\n\t\telse\n\t\t\tinvalid_input\n\t\t\tplay_again\n\t\tend\t\t\t\t\n\tend", "title": "" }, { "docid": "48e6eb87f12df576cbffb0ea08bea7b1", "score": "0.73665106", "text": "def playAgain\n #print final ranking order of a players\n puts \"********* Final Ranking **********\"\n @completed_players.each do |k,v|\n puts \"#{k} Rank #{v}\"\n end\n puts \"**********************************\"\n @completed_players = {}\n # if players want to continue again\n puts \"Would you like to start over? (Y/N)\\n\"\n answer = gets.chomp.upcase\n if answer == \"Y\"\n @players = {}\n # generate new set of players - destroy old data\n generate_players\n start_game\n elsif answer == \"N\"\n # exit in case they don't want to proceed\n puts \"Thank you for playing.\\n\"\n exit\n else\n # repeat if user types other than Y/N\n playAgain\n end \n end", "title": "" }, { "docid": "d5d1ddacf84afbe4db2fc173d90a7e30", "score": "0.7343834", "text": "def try_again\n @active_player.decrease_points(1)\n puts 'Wrong! Lost your turn!'\n puts \"#{@active_player.name}: your score is now #{@active_player.score}!\"\n puts ' '\n @hint_type_one = false\n @hint_type_two = false\n @active_player = @players.switch_players\n end", "title": "" }, { "docid": "50b843447b7fdb5b76fbe9d7a3c82886", "score": "0.7343052", "text": "def play_again\n\t\tbegin\t\t\n\t\t\tprint \"Would you like to play again?(Y/n): \"\n\t\t\tchoice = gets.chomp\n\t\t\traise RuntimeError unless choice.to_s.downcase == \"y\" || choice.to_s.downcase == \"n\"\n\t\trescue\n\t\t\tputs \"Choice must be Y/n. Please try again\"\n\t\t\tretry\n\t\tend\n\n\t\tif choice.downcase == \"y\"\n\t\t\t@players = []\n\t\t\tmake_board\n\t\t\tmake_players\n\t\t\tputs @board\n\t\t\tstart\n\t\telse\n\t\t\tabort(\"Thank you for playing!\")\n\t\tend\n\tend", "title": "" }, { "docid": "69ee1bf8497f361ae467fc31b7f1678f", "score": "0.7339481", "text": "def play_again?\n play_again = \"\"\n until play_again.downcase == \"n\" || play_again.downcase == \"no\"\n puts \"\\nWould you like to play again?\"\n play_again = gets.strip.downcase\n if play_again.downcase == \"y\" || play_again.downcase == \"yes\"\n start\n end\n end\n end", "title": "" }, { "docid": "7c1f37feb319c9f3731008bff90f0128", "score": "0.7326499", "text": "def play_again\n\tputs \"Hit any key to play again #{colourize(\"(0 to quit)\", \"red\")}:\"\n\tplay = gets.chomp\n\tif play == \"0\"\n\t\treturn false\n\tend\nend", "title": "" }, { "docid": "9b957b4849164b16c29976982912550d", "score": "0.7317425", "text": "def continue_play?\n return @io.continue_play?(@game_num)\n end", "title": "" }, { "docid": "b66b1ded662487e89e5ba66efe61a426", "score": "0.7313416", "text": "def play_again\n print \"Do you want to play again?(y/n): \"\n get_choice\n start_or_end\n end", "title": "" }, { "docid": "ec27fc1861330a098883a09f389d17b1", "score": "0.7299208", "text": "def play\n while true\n play_game\n break unless play_again?\n end\n puts \"Thanks for playing...come back soon :-)\"\n end", "title": "" }, { "docid": "43da6ee5a3a8afe2403b5328a1e7bb24", "score": "0.726622", "text": "def play_again\n\n puts \"\\nWould you like to play again? (y/n)\"\n again = gets.strip.upcase\n\n if again == \"Y\" || again == \"YES\"\n start\n else\n exit_game\n end\n end", "title": "" }, { "docid": "706776a1290b6ac988b00e87b80b1913", "score": "0.7263996", "text": "def play\n while not game_over?\n current_player = @turn_manager.current_player\n target_player = @turn_manager.target_player\n \n q = Question.new\n \n puts \"\\n-----NEW TURN------\"\n puts \"#{current_player.name}: #{q.ask_question}\"\n print_and_flush(\"> \") \n input = gets.chomp.to_i\n\n if q.check_answer(input) == true \n puts \"#{current_player.name}: YES! You are correct.\"\n swap_players\n print_summary\n end\n if q.check_answer(input) == false\n puts \"#{current_player.name}: Seriously? No!\"\n current_player.take_dmg\n swap_players\n print_summary\n\n end\n end \n\n \n\n end", "title": "" }, { "docid": "47ab16d743a28112dc90de7fa2684b70", "score": "0.72442317", "text": "def replay\n prompt = TTY::Prompt.new\n if prompt.yes?(\"\\u{1F399} Nelson Monfort : Amazing game ! Do you want to rejouer?\")\n @player1, @player2 = [@player2, @player1]\n perform\n else\n Done.new\n end\n end", "title": "" }, { "docid": "1cdf29cf4e784a84a4ec90cd46a1f24b", "score": "0.7221706", "text": "def play_again?\n\t\twhile true\n\t\t\tplay_again = Mastermind::get_user_input(\"Play again (y/n): \")\n\t\t\tcase play_again.downcase\n\t\t\twhen 'y', 'yes' then return true\n\t\t\twhen 'n', 'no' then return false\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "356b80d3b6288530e0c3bbb8d1e83585", "score": "0.7207047", "text": "def confirm_play_again(data)\n \n # Only proceed if play-again request has not timed out.\n expires = Time.at(data['expires'])\n return if expires < Time.now\n \n # Create game, switching player 1 and player 2\n new_game = Game.create player1_id: @game.player2_id, player2_id: @game.player1_id\n \n # Broadcast notification of play-again confirmation with location of new game.\n GameChannel.broadcast_to @game, action: 'confirm_play_again',\n user_id: current_user.id,\n location: game_path(new_game)\n end", "title": "" }, { "docid": "2aac801fe90182eefadb052a13b36b11", "score": "0.7200513", "text": "def play_again?\n\t\tputs \"\\nDo you want to play again? (Y/N)\"\n\t\tchoice = gets.strip\n\t\twhile choice != \"Y\" && choice != \"N\"\n\t\t\tputs \"Please type Y or N\"\n\t\t\tchoice = gets.strip\n\t\tend\n\t\tchoice\n\tend", "title": "" }, { "docid": "3b5d4d7578fa30c82abf92e43d356b52", "score": "0.7190558", "text": "def play_again?\n puts 'Would you like to play again?'\n puts 'Y/N?'\n response = gets.chomp\n @restart = if response.casecmp('Y').zero?\n true\n else\n false\n end\n end", "title": "" }, { "docid": "64dfcbbd20f8a230b68934b1b2812d39", "score": "0.71777564", "text": "def play_again\n if @cases.aligned == true \n puts \"Pour rejouer, tape 'Y'. Pour quitter le jeu, appuie sur une autre touche pour quitter le jeu : \"\n response = gets.chomp.to_s.upcase\n if response == \"Y\"\n Game.new.perform\n else\n exit\n end\n end\n end", "title": "" }, { "docid": "fd9904b4d6887afb21a9a3fa36f6a7ec", "score": "0.71639645", "text": "def play_again?()\n # keep playing unless user enters 'y' to quit\n puts \"Play again? (Y/N)\"\n @keep_playing = false if gets.chomp.downcase != 'y' \n return @keep_playing\n end", "title": "" }, { "docid": "5aae9c2b8b71b4cee9b83caa394a486f", "score": "0.7135475", "text": "def continue?\n puts \"Would you like to play again? (yes/no)\"\n require_yes_no == \"yes\" ? true : false\n end", "title": "" }, { "docid": "85ab281ceafe99e1ebcda47c2a017a44", "score": "0.7122782", "text": "def repeat\n @player1.score = 3\n @player2.score = 3\n puts \"Do you want to play again? (yes/no)\"\n answer = gets.chomp.downcase\n rungame if answer == \"yes\"\nend", "title": "" }, { "docid": "570f4ad698da9dbe07c7611c56f9d5ee", "score": "0.7111556", "text": "def play_again?\n puts \"\\nDo you want to play again? (yes/no)\"\n answer = gets.strip.downcase\n if answer == \"yes\"\n game_type\n start\n elsif answer == \"no\"\n puts \"╭∩╮(︶︿︶)╭∩╮\"\n puts \"\\n\"\n puts \"*~*~*~*~*~*~~**~*~*~*~*~*~*~*~*~*~*~*~*\"\n puts \"*~* Thanks for playing Tic Tac Toe! *~*\"\n puts \"*~*~*~*~*~*~~**~*~*~*~*~*~*~*~*~*~*~*~*\"\n exit\n else\n play_again?\n end\n end", "title": "" }, { "docid": "e1f7e1c0cc28053b67ae7596c9495b65", "score": "0.71074134", "text": "def playAgain\n\tputs \"Want to play again? (y/n)\"\n\tresponse = gets.chomp.downcase\n\toverwrite(2,true)\n\tif response == \"y\" || response == \"yes\"\n\t\treturn true\n\telsif response == \"n\" || response == \"no\"\n\t\treturn false\n\telse\n\t\toverwrite(1,true)\n\t\tputs \"Invalid input. Please respond with y or n.\"\n\t\tplayAgain\n\tend\nend", "title": "" }, { "docid": "036cef0b1b931a09aeba906ab27e394a", "score": "0.7101041", "text": "def unplayed?\n !played\n end", "title": "" }, { "docid": "c98f10472c50b97a75f77a26d6b465ce", "score": "0.71002907", "text": "def play_again?\n answer = gets.chomp\n if over? || draw?\n puts \"Play again? (Y/N)\"\n if answer == Y || answer == \"y\"\n Board.reset!\n self.begin_game\n else\n puts \"Ok, see you later!\"\n end\n end\n end", "title": "" }, { "docid": "fea861b2d440089a2441a187893c45db", "score": "0.70956516", "text": "def play\n\t\twhile true\n\t\t\tplay_game\n\t\t\tbreak unless play_again?\n\t\tend\n\t\tputs \"Thanks for playing\"\t\n\tend", "title": "" }, { "docid": "3857437284aa1ae681c84704cc13c7c9", "score": "0.7066773", "text": "def play_again? \n puts \"Do you want to play again? (yes or no)\"\n @play_again = gets.chomp.to_s\n\n if @play_again == 'yes'\n @player_1[:lives] = 3\n @player_2[:lives] = 3\n play_game\n else\n end\nend", "title": "" }, { "docid": "6f434b4a3be8e3b36cb568a4e867c323", "score": "0.7062288", "text": "def play_again?\n\t\tagain = false\n\t\twhile again == false\n\t\t\tprint \"Do you want to play again? (y/n): \"\n\t\t\tinput = gets.chomp.downcase\n\t\t\tif input == \"y\"\n\t\t\t\tagain = true\n\t\t\t\tload './mastermind.rb'\n\t\t\t\tsystem 'clear'\n\t\t\t\tset_up_game\n\t\t\telsif input == \"n\"\n\t\t\t\tagain = true\n\t\t\t\texit\n\t\t\telse\n\t\t\t\tputs \"Invalid input, Please enter either 'y' or 'n'.\"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "0b29abc78c013ccbb00b2c934c38a618", "score": "0.70594484", "text": "def play_again\n print 'Play again? '.green\n answer = gets.chomp.downcase\n if answer[0] == 'y'\n @player_turn = true\n @bust = false\n puts \"You've got $#{@cash} left.\".green\n double_draw\n hit_or_stay\n else\n puts 'Goodbye!'.yellow\n exit\n end\n end", "title": "" }, { "docid": "929a56535030e0133ecb1bb594a3fff0", "score": "0.7047831", "text": "def play_again?\n loop do\n puts \"Would you like to play again #{human.name} ? (y/n)\"\n answer = gets.chomp.downcase\n return answer == 'y' if ['y', 'n'].include?(answer)\n puts \"Sorry, must enter y or n\"\n end\n end", "title": "" }, { "docid": "00446c2cfee1264365fa776a310fde08", "score": "0.704761", "text": "def request_play_again\n \n # Broadcast notification of request, including a time of its expiration\n # to prevent unreasonable delays.\n GameChannel.broadcast_to @game, user_id: current_user.id,\n action: 'request_play_again',\n expires: Time.now.to_i + 60\n end", "title": "" }, { "docid": "cc0d5e7a468863bcfc2d3ddfeb8d11bb", "score": "0.70447904", "text": "def play_again\n puts 'Would you like to play Tic-Tac-Toe again? If so say Yes or No'\n play_again_response = gets.chomp\n while play_again_response != 'no'\n if play_again_response.downcase == 'yes'\n puts 'OK, lets play again!'\n tic_tac_toe\n exit\n elsif play_again_response == 'no'\n puts 'Ok, Thanks for playing'\n exit\n else\n puts 'You didn\\'t enter Yes or No to the question if you wanted to play again. Please try again.'\n play_again_response = gets.chomp\n end\n end\n end", "title": "" }, { "docid": "dafeebf739829c7da7a39a22a0a95884", "score": "0.7038256", "text": "def play \n prng1 = Random.new()\n prng2 = Random.new()\n \n i = 1\n while i \n @plays += 1 \n #make question and get answer\n self.turn(prng1.rand(0..20), prng2.rand(0..20), @player1)\n #update message\n self.update(@player1, @player2)\n\n #p \"i = #{i}\"\n\n if @player1.lives === 0 \n then i = 0\n #p \"inside if\"\n exit(0)\n end\n\n self.turn(prng1.rand(0..20), prng2.rand(0..20), @player2)\n #update message\n self.update(@player1, @player2)\n\n #p \"i = #{i}\"\n\n if @player2.lives === 0 \n then i = 0\n #p \"inside if\"\n exit(0)\n end\n end\n end", "title": "" }, { "docid": "c1c39fc6450085e7ebd226703b346cc2", "score": "0.7037953", "text": "def replay_game?\n puts \"\\nGreat game, #{@user_name}! Would you like to play again?\"\n loop do\n print '[y/n]: '\n input = gets.chomp.downcase\n puts ''\n if input == 'y' || input == 'yes'\n user = Player.new(@user_name)\n jeeves = Player.new('Jeeves')\n return true\n elsif input == 'n' || input == 'no'\n puts 'Very well. Thank you for playing and I hope to see you again soon!'\n return false\n else\n puts \"I didn't quite get that. Would you like to play again?\"\n end\n end\n end", "title": "" }, { "docid": "3ae98bf6f5fdddd0e18b0d8ac11578a4", "score": "0.70246005", "text": "def play_again?\n puts \"\\nDo you want to play again? (y/n)\"\n while answer = gets.chomp.downcase\n case answer\n when \"y\"\n generate_key\n @board = []\n answer = false\n puts \"\\nStarting New Game.\"\n break\n when \"n\"\n puts \"\\nGoodbye.\"\n answer = true\n break\n else\n puts \"Invalid response. Try again.\" \n end\n end\n answer \n end", "title": "" }, { "docid": "d0c873e7ea8df3b5bed0007b27d3a04e", "score": "0.7023895", "text": "def lose_life()\n # if player_x answer = true\n # do nothing\n # else\n # deduct 1 live\n\nend", "title": "" }, { "docid": "0e24eb5f14b5a109142db1f7ece33b36", "score": "0.70232147", "text": "def play_again\n print \"Do you want to play again ? (Y/n)\"\n STDOUT.flush\nresponse = gets.chomp\ncase response\nwhen \"Y\" || \"y\" then Game.new.play\nwhen \"N\" || \"n\" then abort!\nend \nend", "title": "" }, { "docid": "fc9f4fee1116058bda7b4577a6f0ee42", "score": "0.7012188", "text": "def play_again?\n puts \"Would you like to play again? y/n?\"\n answer = gets.chomp\n case answer\n when \"n\"\n false\n when \"y\"\n true\n end\n end", "title": "" }, { "docid": "a415d4ef821bfb982176e63f4d4790eb", "score": "0.7011995", "text": "def play_again\n puts 'Would you like to play again? Type \"Y\" or \"N\".'\n puts \"\\n\"\n answer = gets.chomp.downcase\n\n # if they said yes\n if answer == 'y'\n puts 'Yay, another game!'\n puts \"\\n\"\n initialize_game\n else\n # if they didn't say yes\n puts 'Thanks for playing!'\n exit\n end\n end", "title": "" }, { "docid": "8c52911f63c27f7c36d49216d91bf22f", "score": "0.7010058", "text": "def play_again\n puts \"Play again? y/n:\"\n input = gets.strip.upcase\n if input == \"Y\"\n self.start\n elsif input == \"N\"\n exit\n else\n play_again\n end\n end", "title": "" }, { "docid": "7f01527f987611c0330d092d0788df20", "score": "0.70055693", "text": "def play_again?()\n sleep 1\n puts \"\\nDo you wish to play again?: Y/N\"\n input = gets.chomp.upcase\n\n case input \n when \"Y\"\n clear_board()\n sleep 1\n self.clear\n display_board(@@board)\n get_input()\n when \"N\"\n sleep 1\n self.clear\n puts \"\\n\\n\\n ---GOODBYE!!!---\\n\\n\\n\".send(:yellow).send(:bold)\n else\n play_again?()\n end\n end", "title": "" }, { "docid": "ed7ceaba2148e4e9fd6e79f5776d6690", "score": "0.70042753", "text": "def play_again?\n\t\tputs \"\\nPlay again? (Y/N):\"\n\t\tprompt = gets.chomp\n\t\treturn prompt.to_s.downcase == \"y\"\n\tend", "title": "" }, { "docid": "cde931dac9af15b7bbbc750b018393e3", "score": "0.69918704", "text": "def ask_to_play\r\n\t\tputs \"Would you like to play?\"\r\n\t\tplayer_choice = gets.chomp.upcase\r\n\r\n\t\tif player_choice == \"YES\"\r\n\t\t\r\n\t\telse\r\n\t\t\tputs \"Good Bye!\"\r\n\t\t\texit\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "4260c5a74a75c985cbe5112e09959167", "score": "0.69717425", "text": "def play_again?\n return if funds.broke?(dealer.min_bet)\n\n display_play_again\n answer = gets.chomp.downcase\n clear\n\n answer.start_with? 'y'\n end", "title": "" }, { "docid": "cca033c5aeb643fd436c02b693757b77", "score": "0.69627386", "text": "def play_again?\n puts \"Would you like to play another round of Blackjack? Please type 'yes' or 'no'.\"\n reply = gets.chomp.downcase\n if reply == 'yes'\n puts \"Ok, let's go for another round then. Starting the new game.....\"\n deck = Deck.new # has to have a new deck because card count from deck decreased from the previous game\n player.cards = [] # both player and dealer's cards need to be reset from the previous game\n dealer.cards = []\n run\n else\n puts \"Exiting the game....Thanks for playing.\"\n exit\n end\n end", "title": "" }, { "docid": "1f4964e9bb2287db092092bd79b650df", "score": "0.6956543", "text": "def ask_to_continue\n if !@game_over\n if the_loser_is :player1\n print_losing_message_for :player1\n elsif the_loser_is :player2\n print_losing_message_for :player2\n else\n @results += \"<a href='/play/battle'>Click to play next turn.</a>\"\n end\n end\n end", "title": "" }, { "docid": "e4ee29002384cb1e052f2e76cab2664f", "score": "0.6954162", "text": "def play_again\n puts \"\"\n puts \"--------- ?? Again ?? ----------\"\n @won = false \n puts \"Would you like to play again? Yes or No\"\n answer = gets.chomp \n case answer \n when /^y/i\n start\n when /(^n)/i\n puts \"Have a great day\"\n else\n puts \"Can not understand\"\n play_again \n end \n end", "title": "" }, { "docid": "1c1c6ea6e4b21a41cb57e7a093e3f7ca", "score": "0.694985", "text": "def play_again\n puts 'Would you like to play another hand of BlackJack? If so say Yes or No'\n play_again_response = gets.chomp\n while play_again_response != 'no'\n if play_again_response.downcase == 'yes'\n puts 'OK, lets play again!'\n blackjack\n exit\n elsif play_again_response == 'no'\n puts 'Ok, Thanks for playing'\n exit\n else\n puts 'You didn\\'t enter Yes or No to the question if you wanted to play again. Please try again.'\n play_again_response = gets.chomp\n end\n end\n end", "title": "" }, { "docid": "c6f85b01c4122494216181cb80e34cb1", "score": "0.6949399", "text": "def playAgain\n\tuntil false\n\t\tputs \"Play again? y/n\"\n\t\tinput = gets.chomp\n\t\tif input == \"n\"\n\t\t\treturn true\n\t\telsif input == \"y\"\n\t\t\treturn false\n\t\telse\n\t\t\tputs \"please enter y/n\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "56babc0850f5aa4a93047c54d5fc5414", "score": "0.69459575", "text": "def new_game?\n puts \"Would you like to play again? (Yes / No)\"\n self.answer = gets.strip.downcase\n if self.answer == \"yes\" || self.answer == \"y\"\n self.set_players\n self.player_count == \"WARGAMES\"? self.game.wargames : self.game.start\n end\n end", "title": "" }, { "docid": "961c17eaf473bced257ada8cabcd980d", "score": "0.6945201", "text": "def keep_playing\n puts \"Would you like to play another hand? Yes or no\"\n response = gets.chomp\n response.upcase!\n if response == \"YES\" || response == \"Y\"\n @flag = true\n elsif response == \"NO\" || response == \"N\"\n @flag = false\n else\n puts \"Invalid input\"\n keep_playing\n end\n end", "title": "" }, { "docid": "ae2c0c1b186ad4a2c314e88b00ae1d26", "score": "0.69283086", "text": "def play_again\n\tputs \"do you want to play again? (type 'Y' or 'N')\"\n\tagain = gets.chomp\n\t\n\tif again == 'Y' || again == 'y'\n\t\tgame\n\telse\n\t\tputs '>>> laytaz <<<'\n\t\t# ???? need to break out loop ????\n\t\t# break\n\tend\nend", "title": "" }, { "docid": "94f56d30b182e9cf7ff3c722bb9b2a32", "score": "0.69259775", "text": "def quit_game\n puts \"Thank you for playing!\"\n @again = false\n end", "title": "" }, { "docid": "85c0265c50ef229a5d95e5ef50cdde86", "score": "0.69248426", "text": "def play_again\n puts \"Play Again?\"\n yn = gets.chomp.downcase\n if yn == \"yes\"\n run\n else\n puts \"Thanks for playing, Goodbye.\"\n end\nend", "title": "" }, { "docid": "ed83455914d383db770e2fcd57834ae6", "score": "0.6921194", "text": "def play_again?\n\t\tputs \"Would you like to play again (Y or N) \"\n\t\tanswer = gets.chomp.upcase\n\t\tif answer == \"Y\"\n\t\t\ttrue\n\t\t\tnew_game = Game.new\n\t\telsif answer == \"N\"\n\t\t\tfalse\n\t\t\tputs \"***** THANKS FOR PLAYING! GOODBYE! *****\"\n\t\telse\n\t\t\tputs \"Invalid option. You did not enter Y or N. Please try again.\"\n\t\t\tplay_again?\n\t\tend\n end", "title": "" }, { "docid": "650a24be4bc05a276ca573285c0bb1ba", "score": "0.6915177", "text": "def play_again\n\t\t \tputs \"Try again? (Y/n)\"\n\t\t \tans = gets.chomp\n\t\t \tans.downcase == \"y\" || ans == \"\"\n\t\t\t\n\t\t\tif ans == \"y\" then dataprog\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "3d6641edc7162cd00cfa9d456fe25135", "score": "0.6911214", "text": "def again?\n \tputs \"Would you like to play again? 'Y' or 'N'\"\n \tanswer = gets.chomp.to_i\n \tanswer == 'Y' ? true : false\n end", "title": "" }, { "docid": "7c6f030fee4f950e97b5ea514120c7fa", "score": "0.68897617", "text": "def play\n\t\t\twhile (win? || tie?) == false\n\t\t\t\twhose_turn\n\t\t\t\tchoice\n\t\t\t\tcheck\n\t\t\t\tmark_choice\n\t\t\t\twin?\n\t\t\t\ttie?\n\t\t\t\t@turn += 1\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "ddcac381113ec5ba1cebbde9ea9d8f2f", "score": "0.68831867", "text": "def play_again \n puts \"Play again? Type Yes or No\"\n response = gets.chomp.capitalize\n if response == \"Yes\"\n start_game(@player_name)\n elsif response == \"No\"\n puts \"Thanks for playing.\"\n Process.exit()\n else\n puts \"Does '#{response}' look like 'Yes' or 'No' to you? Do you know how to type?\"\n play_again()\n end\nend", "title": "" }, { "docid": "74c992605bba3b5800c9d61b9c155e9b", "score": "0.6879002", "text": "def play\n loop do\n puts \"GAME LOGIC HERE\"\n puts \"again?\"\n answer = gets.chomp.downcase\n answer == \"y\" ? redo : (puts \"Thanks for playing!\")\n break\n end\nend", "title": "" }, { "docid": "409f1c3ee591e6289d296f89306c644d", "score": "0.6877093", "text": "def play_again?()\n keep_playing = true\n # keep playing unless user enters 'y' to quit\n puts \"Play again? (Y/N)\"\n keep_playing = false if gets.chomp.downcase != 'y' \n return keep_playing\nend", "title": "" }, { "docid": "e29d9df1cac2b4ba46c13a101c9bf717", "score": "0.68548393", "text": "def play_again\n puts \"Would you like to play again yes or no.\"\n play_again = gets.chomp\n if play_again == \"no\"\n exit\n elsif play_again == \"yes\"\n difficulty_level\n\n end\n end", "title": "" }, { "docid": "5020340da7adcc317bcf4c807ea4443a", "score": "0.68544334", "text": "def playing?; end", "title": "" }, { "docid": "0221c38ef518034e34b8cae1523e4c5a", "score": "0.68536645", "text": "def play_again?\n answer = \"\"\n while answer !=\"Y\" && answer != \"N\"\n puts \"Play again? (Y/N)\"\n answer = gets.chomp\n end\n if answer == \"Y\"\n game = GamePlay.new\n elsif answer == \"N\"\n exit\n end\n end", "title": "" }, { "docid": "ae85f749309a52e0fa2d24c83a1a0ddd", "score": "0.6846366", "text": "def play_again\n\n puts \"\\nWould you like to play again? (y/n)\"\n again = gets.strip.upcase\n\n if again == \"Y\" || again == \"YES\"\n start\n else\n exit_game\n end\nend", "title": "" }, { "docid": "9b5acfc5d099f57a09a3fd494d9fd2bf", "score": "0.68441033", "text": "def play_again\n puts 'Would you like to play again? Type \"Y\" or \"N\". '\n answer = gets.chomp\n\n # if they want to play, trigger another game, otherwise exit\n if answer == 'Y'\n input\n else\n exit\n end\nend", "title": "" }, { "docid": "3eb6b7b416b6faaf63c03b86f08874cc", "score": "0.684374", "text": "def play()\n # Array of possible choices in RPS\n rps = ['Rock', 'Paper', 'Scissors']\n \n # Welcome message\n puts \"Play Paper Rock Scissors!\"\n\n # play until keep_playing is false\n keep_playing = true\n \n # main game loop\n begin \n user_selection = get_user_selection()\n\n # get the computer's random pick\n computer_selection = rand(0..2)\n \n puts \"You picked #{rps[user_selection]} and computer picked #{rps[computer_selection]}.\"\n \n # determine outcome\n who_won(user_selection, computer_selection)\n\n # determine if we should keep playing\n keep_playing = play_again?\n\n end while keep_playing == true\nend", "title": "" }, { "docid": "e3cf62fcc175e3d29b8be3f3451a1d64", "score": "0.68434715", "text": "def playAgain\n\t\tselection = \"\"\n\t\tprint \"\",\"Do you want to play again [Y/N]? \"\n\t\twhile selection != \"N\" do\n\t\t\tselection = gets().chomp.upcase\n\t\t\tif selection == \"Y\"\n\t\t\t\treturn true\n\t\t\telsif selection == \"N\"\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\tputs \"\",\"ERROR: Invalid option. Try again!\"\n\t\t\t\tprint \"\",\"Do you want to play again [Y/N]? \"\n\t\t\tend\n\t\tend\t\t\n\tend", "title": "" }, { "docid": "33a88897999301fbad3d4350d519b453", "score": "0.68335897", "text": "def playAgain\n puts \"Want to play again? (y/n)\"\n response = gets.chomp.downcase\n overwrite(2,true)\n if response == \"y\" || response == \"yes\"\n return true\n elsif response == \"n\" || response == \"no\"\n return false\n else\n overwrite(1,true)\n puts \"Invalid input. Please respond with y or n.\"\n playAgain\n end\nend", "title": "" }, { "docid": "479237e434fa11ed958c08f64800edda", "score": "0.6830383", "text": "def reject_play_again\n GameChannel.broadcast_to @game, action: 'reject_play_again', user_id: current_user.id\n end", "title": "" }, { "docid": "54f734969466690d404a039ff1311de9", "score": "0.68290484", "text": "def play_again?\n print \"\\nWould you like to play again? (Y/N)]\\n>> \"\n input = gets.chomp.downcase\n input == \"y\"\n end", "title": "" }, { "docid": "7f358ee1a72dc994a2c0698d0a57357e", "score": "0.6828561", "text": "def check_status\n if thirty?(@player1) || thirty?(@player2)\n self.end_game(@player1, @player2)\n else\n return \"Keep playing!\"\n end\n end", "title": "" }, { "docid": "864d2d9ec0998713ab6b9b8c6037128a", "score": "0.6823121", "text": "def play_rps_game\r\n begin\r\n system 'clear'\r\n opening\r\n user_player.choose_hand\r\n computer_player.choose_hand\r\n who_win = check_who_win(user_player.hand, computer_player.hand)\r\n print_result(user_player.hand, computer_player.hand, who_win)\r\n end while continue? == \"Y\"\r\n ending\r\n end", "title": "" }, { "docid": "beda8d8d9098f70992d65b45b3942c18", "score": "0.68198", "text": "def play_again?\n loop do\n prompt \"Would you like to play again? (Y or N)\"\n answer = gets.chomp\n if answer.downcase.start_with?('y')\n break\n elsif answer.downcase.start_with?('n')\n prompt \"Have a nice day!\"\n sleep(1)\n exit\n else\n prompt \"Not a valid choice!\"\n end\n end\nend", "title": "" }, { "docid": "ce9972df2cf76c11b25b8a161b7c92de", "score": "0.68080705", "text": "def try_again?\n puts ' ...try again?'\n print '(y/n): '\n input = gets.chomp.upcase\n @play = input == 'Y'\nend", "title": "" }, { "docid": "2b09bcf6a7c7c7d5e732cfbc140b2dab", "score": "0.68057436", "text": "def play_game\n @game_play = true \n while @game_play\n if players_turn\n @game_play = false\n end\n end\n puts \"---- Game Over ----\"\n puts \"Good bye!\"\n end", "title": "" }, { "docid": "df796f69048aeab866203e8dc062327d", "score": "0.680544", "text": "def play_again\n\tprint \"Would you like to play again (y or n)? \"\n\t@answer = gets.chomp.strip\n\tputs \"\\n\"\n\n\tif @answer.downcase == \"y\"\n\t\t@userPoints = []\n\t\t@computerPoints = []\n\n\t\tdic_game()\n\telsif @answer.downcase == \"n\"\n\t\texit\n\telse\n\t\tplay_again()\n\tend\nend", "title": "" }, { "docid": "6ca1fb436550f998f4641532d0d60b3e", "score": "0.67823696", "text": "def playing\n on = ask \"is_playing\"\n return false unless on\n [false, true][on.to_i]\n end", "title": "" }, { "docid": "848a9d3980b12ab46234d5934154280c", "score": "0.6778671", "text": "def play_again?\n\t\tentry = nil\n\t\tuntil entry != nil\n\t\t\tprint \"\\nWould you like to play again? \"\n\t\t\tentry = case gets.chomp.downcase\n\t\t\t\twhen \"yes\", \"y\" then true\n\t\t\t\twhen \"no\", \"n\" then false\n\t\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid option, yes or no\" if entry.nil?\n\t\tend\n\t\tentry\n\tend", "title": "" }, { "docid": "7fa5a9cb34087d7d757824876ab3fe40", "score": "0.67640245", "text": "def check_for_encore()\n\t\t@utils.get_input(\"Press 'y' if you want to play again, or any other key to quit\").strip.downcase == 'y'\n\tend", "title": "" }, { "docid": "af2e559d3113e2f25843ad914d12236e", "score": "0.6759664", "text": "def play_again?\n print \"\\n\\nAnother game? enter y for another game, anything else to quit: \"\n answer = gets\n answer.delete! \"\\n\"\n answer.downcase == 'y'\n end", "title": "" }, { "docid": "5983893d9ffbe14efa9594ae3405f0b5", "score": "0.6745203", "text": "def play \n# keep playing a game until one of the players has no lives \nwhile @player1.lives > 0 && @player2.lives > 0\n\n puts \"--------------------\"\n puts \" Game starts \"\n puts \"--------------------\"\n p \"#{current_player.name}, get ready for your question\"\n\n\n # initialize a question \nquestion = Question.new(current_player.name)\nprint question.question_text\n# Propmt for player's answer\nanswer = gets.chomp.to_s\nputs \"You answer is #{answer}. Let's check if it's the correct one...\"\n# check if the answer is right\n # player will loose a live (-1) for wrong answer\nif question.validate_answer(answer) == false\nputs \"We are taking 1 life from your lives\"\n@current_player.lives -=1\nend\n\nputs \"This is how many lives left for #{@current_player.name} ----- #{@current_player.lives}/3\"\n# switching turns \n@current_player==@player1 ? @current_player = @player2 : @current_player = @player1\n\nputs \"--------------------\"\nputs \" NEW TURN \"\nputs \"--------------------\"\n\nputs \"#{current_player.name} is playing now\"\nputs \"This is how many lives left for this player #{@current_player.name} ----- #{@current_player.lives}/3\"\n\n # check if game_over, someone has 0 lives?\n if @player1.lives == 0 || @player2.lives == 0\n puts \"--------------------\"\n puts \" GAME OVER \"\n puts \"--------------------\"\n #who is the winner \n if @player1.lives > 0\n puts \"#{@player1.name} is the WINNER with a score #{@player1.lives}/3 \"\n else \n puts \"#{@player2.name} is the WINNER #{@player2.lives}/3\"\n end\n end\nend\n\n\n\nend", "title": "" }, { "docid": "c1d8019fe113f38aa637554ce64be7d7", "score": "0.6743047", "text": "def play()\n # Array of possible choices in RPS\n rps = ['Rock', 'Paper', 'Scissors']\n \n # Welcome message\n puts \"Play Paper Rock Scissors!\"\n \n # main game loop\n begin \n user_selection = @player.get_selection\n\n # get the computer's random pick\n computer_selection = @computer.get_selection\n \n puts \"You picked #{rps[user_selection]} and computer picked #{rps[computer_selection]}.\"\n \n # determine outcome\n who_won(user_selection, computer_selection)\n\n # determine if we should keep playing\n keep_playing = @player.play_again?\n\n end while keep_playing == true\n end", "title": "" }, { "docid": "976c37939bf9ad96fab379644e0b69c9", "score": "0.6731507", "text": "def not_in_play!\n\t\t@in_play = false\n\t\tself\n\tend", "title": "" }, { "docid": "00b848e76f3ebc3f2a417564a9f440e1", "score": "0.67193955", "text": "def play_again?\n answer = \"\"\n while answer != \"Y\" && answer != \"N\"\n puts \"Play again? Y/N\"\n answer = gets.chomp\n answer.upcase\n end\n if answer == \"Y\" \n game = GamePlay.new\n elsif answer == \"N\"\n exit\n end\n end", "title": "" }, { "docid": "eb17893b9e6f12f5eb17a6f1f261de33", "score": "0.671674", "text": "def cancel_play_again\n GameChannel.broadcast_to @game, action: 'cancel_play_again', user_id: current_user.id\n end", "title": "" }, { "docid": "5ffbffba0362532cc59761da77247c1e", "score": "0.671576", "text": "def run\n play until game_over?\n p 'Oops, you lost!'\n end", "title": "" }, { "docid": "3269d4c45f4486b94a47d40d1c83368e", "score": "0.67149776", "text": "def play_repeatedly\n show_title if @show_title\n\n loop do\n new_game\n play\n\n break unless yesno\n end\n end", "title": "" }, { "docid": "aeba9726f548fa5df289d1dae5c9b97e", "score": "0.67127347", "text": "def repeat\n\t\tprint \"\\n Do you want to keep playing with #{@name}? (y/n): \"\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"y\"\n\t\t\tscary_stuff\n\t\telse\n\t\t\tprint \"\\n Here's a recap of your monster adventure: \"\n\t\t\tprint_scoreboard\n\t\tend\n\tend", "title": "" } ]
c3871d5222723b5d7f73ef24ab11e035
Add more helper methods to be used by all tests here...
[ { "docid": "e1bb33586723ac93e33ff22b5be2eef9", "score": "0.0", "text": "def create_test_agreement(formtype = \"multi\")\n agreement = Agreement.new\n agreement.note = 'UNIT_ TESTING'\n agreement.formtype = formtype;\n agreement.audituser = 'UNIT_TESTING'\n agreement.auditdate = Date.today\n agreement.createdate = Date.today\n agreement.createuser = 'UNIT_TESTING'\n agreement.agreementdate = Date.today\n agreement.status_lu_id = StatusLu.draft\n agreement.save\n agreement\n end", "title": "" } ]
[ { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "16a6d5e8eabd975007f205c109c50890", "score": "0.67117864", "text": "def testing; end", "title": "" }, { "docid": "8fbc98d9068bd9c82033a031286f0a1e", "score": "0.6679903", "text": "def tests; end", "title": "" }, { "docid": "8fbc98d9068bd9c82033a031286f0a1e", "score": "0.6679903", "text": "def tests; end", "title": "" }, { "docid": "0bc667af6f6e131c7f186907e9871e17", "score": "0.6595852", "text": "def testable; end", "title": "" }, { "docid": "0bc667af6f6e131c7f186907e9871e17", "score": "0.6595852", "text": "def testable; end", "title": "" }, { "docid": "69183812dabe6ebac3d8677793cde36c", "score": "0.65507036", "text": "def test_legacy\n # Set up legacy handlers\n setup_legacy_handling\n\n common_tests\n end", "title": "" }, { "docid": "92e7871a59de07150a4a4a4ac22e985b", "score": "0.6546819", "text": "def tests\n raise \"Not implemented\"\n end", "title": "" }, { "docid": "18dccc4e509a937b27ab700928bdba8e", "score": "0.6535218", "text": "def helper; end", "title": "" }, { "docid": "18dccc4e509a937b27ab700928bdba8e", "score": "0.6535218", "text": "def helper; end", "title": "" }, { "docid": "18dccc4e509a937b27ab700928bdba8e", "score": "0.6535218", "text": "def helper; end", "title": "" }, { "docid": "7e888d80ce2cff18a12a45c9b93b96c3", "score": "0.6386201", "text": "def test_helper\n cart = Cart.new\n cart.add_product(Product.find(1))\n \n [:items_to_buy, :items_saved].each do |method|\n [:summary, :full].each do |style|\n [true, false].each do |display_total|\n [true, false].each do |ab_show_purchase_price_basket|\n ab_test_set(:show_purchase_price_basket, ab_show_purchase_price_basket)\n CartHelper.cart_display_for(cart, method, { :style => style, :display_total => display_total })\n # just test that we don't blow up\n assert(true)\n end\n end\n end\n end\n\n end", "title": "" }, { "docid": "4b29fbc54d4f7408b4f328350fc9e00d", "score": "0.63530505", "text": "def test_should_do_stuff\n\t\t\n\tend", "title": "" }, { "docid": "1068832c8229c37488788b46a0871f26", "score": "0.63399005", "text": "def testing\n end", "title": "" }, { "docid": "ef246dab90b77bd1ada863628af8fbbf", "score": "0.6324288", "text": "def default_test \n end", "title": "" }, { "docid": "8d3e2f6695659386a9f5d95e1daf8385", "score": "0.6321844", "text": "def utilities\n end", "title": "" }, { "docid": "8d3e2f6695659386a9f5d95e1daf8385", "score": "0.6321844", "text": "def utilities\n end", "title": "" }, { "docid": "8d3e2f6695659386a9f5d95e1daf8385", "score": "0.6321844", "text": "def utilities\n end", "title": "" }, { "docid": "8d3e2f6695659386a9f5d95e1daf8385", "score": "0.6321844", "text": "def utilities\n end", "title": "" }, { "docid": "a9f4c2a19b80ba89e2afaa1cdd14095b", "score": "0.6249786", "text": "def test_case; end", "title": "" }, { "docid": "a9f4c2a19b80ba89e2afaa1cdd14095b", "score": "0.6249786", "text": "def test_case; end", "title": "" }, { "docid": "dfd68b234277cbceadd2cc9abad83e15", "score": "0.62337136", "text": "def test_placeholder\r\n end", "title": "" }, { "docid": "48fd2da2926fa6432da0aa973551b69c", "score": "0.6231185", "text": "def test_all\n\t\ttest_simple_upload\n\t\ttest_config\n\t\ttest_recursive_copy\n\t\ttest_safe_copy_without_overwriting\n\t\ttest_safe_copy_with_overwriting\n\tend", "title": "" }, { "docid": "b18a1e60f10bfa30e8a7debd6f8abd8c", "score": "0.61843294", "text": "def testing\n\tend", "title": "" }, { "docid": "ef7f2dbe149ad04c6bd7c2bee2f74ddb", "score": "0.61669576", "text": "def utility_method\n end", "title": "" }, { "docid": "a96a942327ce5e57187e66e79658e3af", "score": "0.61552566", "text": "def helpers(&block); end", "title": "" }, { "docid": "a96a942327ce5e57187e66e79658e3af", "score": "0.61552566", "text": "def helpers(&block); end", "title": "" }, { "docid": "3c56049dd66f1032f1691f17f56e4323", "score": "0.6142927", "text": "def default_test; end", "title": "" }, { "docid": "3c56049dd66f1032f1691f17f56e4323", "score": "0.6142927", "text": "def default_test; end", "title": "" }, { "docid": "3c56049dd66f1032f1691f17f56e4323", "score": "0.6142927", "text": "def default_test; end", "title": "" }, { "docid": "3c56049dd66f1032f1691f17f56e4323", "score": "0.6142927", "text": "def default_test; end", "title": "" }, { "docid": "ea08f86fbf94a490d3e42ea7c464ff82", "score": "0.6141205", "text": "def test_campground_open # half tested\n end", "title": "" }, { "docid": "21f3ab5304735fac1b5ee717ee4e068c", "score": "0.6138411", "text": "def test_test\n end", "title": "" }, { "docid": "07f06dd08df6ab05400a01766c8b346c", "score": "0.61233175", "text": "def test_setup\n \n end", "title": "" }, { "docid": "fd3002bddc15309761c18ce8e2b2b153", "score": "0.61106706", "text": "def testcase_setup\n end", "title": "" }, { "docid": "bd6b54127999967816776cf5fa6859d1", "score": "0.61011976", "text": "def test_one_ruby\r\n helper = Helpers.new\r\n rubies = helper.plural_rub(1)\r\n assert_equal 'ruby', rubies \r\nend", "title": "" }, { "docid": "3b2179b7d3d4cce66e93bf5ab5f00078", "score": "0.6095763", "text": "def test_helper(type)\n #return test_helper_4(type) if ENV['minitest'] == \"4\"\n\n \"require 'minitest/autorun'\"\nend", "title": "" }, { "docid": "7da93d6e0098782db3433080218bbd39", "score": "0.60897624", "text": "def resource_tests(resource)\n integration_tests(resource) << controller_test(resource) << system_tests(resource) << view_tests(resource)\nend", "title": "" }, { "docid": "b6a34c1cdc4af361a5503050daa524bc", "score": "0.6085482", "text": "def default_test\n end", "title": "" }, { "docid": "1afec7fbe1e105b9ed35245cc8038955", "score": "0.60837877", "text": "def default_test\n end", "title": "" }, { "docid": "8a537f5b80dca7f5747d4fe824dcebca", "score": "0.6077922", "text": "def helper\n failed = false\n @helper ||= begin\n testing = Java::ComGoogleAppengineToolsDevelopmentTesting\n @datastore_config = testing::LocalDatastoreServiceTestConfig.new\n configs = [\n @datastore_config,\n testing::LocalBlobstoreServiceTestConfig.new,\n testing::LocalImagesServiceTestConfig.new,\n testing::LocalMailServiceTestConfig.new,\n testing::LocalMemcacheServiceTestConfig.new,\n testing::LocalTaskQueueTestConfig.new,\n testing::LocalURLFetchServiceTestConfig.new,\n testing::LocalUserServiceTestConfig.new,\n testing::LocalXMPPServiceTestConfig.new,\n ].to_java(testing::LocalServiceTestConfig)\n testing::LocalServiceTestHelper.new(configs)\n rescue => ex\n if failed\n raise ex\n else\n failed = true\n require 'appengine-sdk'\n AppEngine::SDK.load_local_test_helper\n retry\n end\n end\n end", "title": "" }, { "docid": "657ca09ded2c7918af57a835c38ccfdb", "score": "0.6040025", "text": "def test_ok; end", "title": "" }, { "docid": "657ca09ded2c7918af57a835c38ccfdb", "score": "0.6040025", "text": "def test_ok; end", "title": "" }, { "docid": "82e1d978aed8224d922bff615ab084d7", "score": "0.6027712", "text": "def test_get_recipe\n\n end", "title": "" }, { "docid": "c30f5ca126ca19b10da2fe0dd191922f", "score": "0.60252905", "text": "def test_dry_usage\n DSLHelper.new(String => [:upcase, :downcase]) do \n Kernel.load relative('dsl_helper_test_extensions1.rb')\n assert_equal \"hello\", \"hello\".upcase\n assert_equal \"HELLO\", \"HELLO\".downcase\n end\n assert_equal \"HELLO\", \"hello\".upcase\n assert_equal \"hello\", \"HELLO\".downcase\n end", "title": "" }, { "docid": "3e4e7997b2834188aba855f0fa4e2f68", "score": "0.5980877", "text": "def test_two_rubies\r\n helper = Helpers.new\r\n rubies = helper.plural_rub(2)\r\n assert_equal 'rubies', rubies \r\nend", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.5973282", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.5973282", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.5973282", "text": "def spec; end", "title": "" }, { "docid": "f6592c738c27ed89bfaecebf7ae74efa", "score": "0.59634334", "text": "def test_setup\n end", "title": "" }, { "docid": "5a8d20cfa19c8f0f1093c48065c1412c", "score": "0.59185725", "text": "def test\n \n end", "title": "" }, { "docid": "5a8d20cfa19c8f0f1093c48065c1412c", "score": "0.59185725", "text": "def test\n \n end", "title": "" }, { "docid": "329fbe415d9cde1f188261f949358ffe", "score": "0.5908739", "text": "def main_test_harness\n test__dnd_backstabber_attack\n test__bag_of_lost_coins_leads_to_lottery_ticket\n test__dice_battle__naruto_vs_sasuke\n\n puts \"\\n----- Extra Testing -----\\n\\n\"\n test__bag_cloning\n test__rc_randomizers_cloning\n test__random_select_and_add_items_from_player1_to_player2\nend", "title": "" }, { "docid": "0d4b620075906cbc657bf6965cdeaf0c", "score": "0.59057903", "text": "def test\n end", "title": "" }, { "docid": "0d4b620075906cbc657bf6965cdeaf0c", "score": "0.59057903", "text": "def test\n end", "title": "" }, { "docid": "1b148252dd3b5ccc15fae09f370850b1", "score": "0.5895861", "text": "def test_acknowledgement \n\n end\n\n def test_send_acknowledgement\n end\n\n def test_respond_to_acknowledge\n assert @<%= name %>.respond_to?(:acknowledge)\n end\n\n private\n def http_raw_data\n \"\"\n end \nend", "title": "" }, { "docid": "8e69a909467865e86a98398e3b159112", "score": "0.58938485", "text": "def test_get_food\n \n end", "title": "" }, { "docid": "ffc850710186fcd9239eacdea566962f", "score": "0.5885474", "text": "def test_nothing; end", "title": "" }, { "docid": "e3f0a2dd9f422e724296c3010b0f16ea", "score": "0.5870909", "text": "def helper_module; end", "title": "" }, { "docid": "e3f0a2dd9f422e724296c3010b0f16ea", "score": "0.5870909", "text": "def helper_module; end", "title": "" }, { "docid": "3e75b08d32ccdbb9fac6182b06b6d320", "score": "0.58688533", "text": "def resource_tests(resource = :all)\n if resource != :all\n resource_for_model = resource.to_s.chop\n else\n resource_for_model = :all\n end\n [integration_tests(resource), controller_test(resource), model_test(resource_for_model), helper_test(resource)]\nend", "title": "" }, { "docid": "cda2e70ad0dfbf963c2a437c425d7b3e", "score": "0.58683985", "text": "def tests(klass); end", "title": "" }, { "docid": "d3971c291a70a5f2d24e5aba9d9b385a", "score": "0.5865266", "text": "def test_design_information\n\n end", "title": "" }, { "docid": "1a329cc28c04b44fc44cbca2869e3d69", "score": "0.5864269", "text": "def test_constants\n end", "title": "" }, { "docid": "e9748b85ddb9d5afe3a6b48a9795e53c", "score": "0.5860731", "text": "def test\n\n end", "title": "" }, { "docid": "8f1f1497a640a3bfcd54a18bd7b0ca1f", "score": "0.58596855", "text": "def test_get_command\n end", "title": "" }, { "docid": "81ac3b79817162bce3a09a87a9dcc661", "score": "0.58586293", "text": "def test_method\n __method__\nend", "title": "" }, { "docid": "e1b9dd9dff7aada610b2f76a73ad9784", "score": "0.58586264", "text": "def test_harness_common(tests, id)\n tests[id][:ensure] = :present if tests[id][:ensure].nil?\n tests[id][:state] = false if tests[id][:state].nil?\n tests[id][:desc] = '' if tests[id][:desc].nil?\n tests[id][:log_desc] = tests[id][:desc] + \" [ensure => #{tests[id][:ensure]}]\"\n logger.info(\"\\n--------\\n#{tests[id][:log_desc]}\")\n\n test_manifest(tests, id)\n test_resource(tests, id)\n test_show_cmd(tests, id, tests[id][:state]) unless tests[id][:show_pattern].nil?\n test_idempotence(tests, id)\n tests[id].delete(:log_desc)\nend", "title": "" }, { "docid": "1ea0145f1766317f8875773e74bd2a56", "score": "0.584998", "text": "def assertions; end", "title": "" }, { "docid": "1ea0145f1766317f8875773e74bd2a56", "score": "0.584998", "text": "def assertions; end", "title": "" }, { "docid": "f268b6f3e733618806c1aad8ef0f8638", "score": "0.584716", "text": "def test_valid_args_result_two_victorious\r\n helper = Helpers.new\r\n strs = helper.prints(3, 4, 10, 3)\r\n assert_equal 'Going home victorious!', strs[1]\r\nend", "title": "" }, { "docid": "09a26817b92d1635c62635d98197d558", "score": "0.584359", "text": "def helper\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.5825902", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "8e5e5c1f3496d6dd26d8f72e76bdacc7", "score": "0.58244556", "text": "def test_accessors\n assert_equal true, @seb_est.complete?\n assert_equal 'Completed', @seb_est.status\n assert_equal \"88\", @seb_est.item_id\n assert_equal \"2774\", @seb_est.transaction_id\n assert_equal '33', @seb_est.gross\n assert_equal \"EEK\", @seb_est.currency\n assert_equal '26.11.2007', @seb_est.received_at.strftime(\"%d.%m.%Y\")\n assert_equal true, @seb_est.test?\n end", "title": "" }, { "docid": "5a7d18a52ab9a4aaebe5be42092e0ee6", "score": "0.58181316", "text": "def test_all_fav_foods\nresult = all_fav_foods(@people)\nassert_equal(\" charcuterie soup bread Scooby snacks spaghetti ratatouille spinach \", result)\nend", "title": "" }, { "docid": "cf962b55de96fd9b9b7a11d5f78e0233", "score": "0.5814711", "text": "def test_10_Store\n\t\t\n\tend", "title": "" }, { "docid": "5a628fb61130e971532ad3ae10b6ec45", "score": "0.58033717", "text": "def test_setup\r\n \r\n end", "title": "" }, { "docid": "343416ea60146f7abcff03721ade0199", "score": "0.58019984", "text": "def test_function_return\n\n\nend", "title": "" }, { "docid": "d4dfc744b0352d14b1829f59dfed7cfc", "score": "0.57992065", "text": "def test_builder_methods\n\t\t# helpers to test\n\t\thelpers = {\n\t\t\t# standard helpers for input tags\n\t\t\t'input' => %w{ hidden_field password_field text_field },\n\t\t\t# helpers for select tags\n\t\t\t'select' => [\n\t\t\t['date_select', \"<%= f.date_select :name %>\", Date.parse('2000-01-01')],\n\t\t\t['datetime_select', \"<%= f.datetime_select :name %>\", Time.parse('2000-01-01 00:00:00')]\n\t\t\t],\n\t\t\t# other helpers\n\t\t\t'textarea' => %w{ text_area }\n\t\t}\n\t\t\n\t\tfield_partials = []\n\t\tassertions = []\n\t\t\n\t\t# build a collection of partials and assertions\n\t\thelpers.each do |tag, tag_helpers|\n\t\t\ttag_helpers.each do |helper|\n\t\t\t\tif helper.respond_to?(:to_ary)\n\t\t\t\t\t# custom partial\n\t\t\t\t\thelper, partial, value = helper\n\t\t\t\t\tfield_partials << [partial, value]\n\t\t\t\telse\n\t\t\t\t\t# standard\n\t\t\t\t\tfield_partials << \"<%= f.#{helper} :name %>\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# this assertion checks for a wrapped tag of the correct type\n\t\t\t\t# and also replaces the long, useless error from assert_tag\n\t\t\t\tassertions << lambda do\n\t\t\t\t\tbegin\n\t\t\t\t\t\tfield_class = %w(date_select datetime_select).include?(helper) ?\n\t\t\t\t\t\t'field' : 'value_field field'\n\t\t\t\t\t\tassert_tag({\n\t\t\t\t\t\t\t:tag => 'div',\n\t\t\t\t\t\t\t:attributes => {:class => field_class},\n\t\t\t\t\t\t\t:descendant => {:tag => tag}\n\t\t\t\t\t\t})\n\t\t\t\t\trescue Test::Unit::AssertionFailedError => e\n\t\t\t\t\t\tif e.message =~ /expected tag/\n\t\t\t\t\t\t\tflunk(\"Helper failed: #{helper}\\nHelper result: #{@response.body}\")\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\traise\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\t\t\n\t\t# render each partial and run its assertion\n\t\tfield_partials.each do |partial|\n\t\t\tif partial.respond_to?(:to_ary)\n\t\t\t\t# non-standard helpers provide a partial\n\t\t\t\t# and a value to test for the variable\n\t\t\t\t# (because of date_select, etc)\n\t\t\t\tpartial, value = partial\n\t\t\telse\n\t\t\t\t# standard helpers just use a test string\n\t\t\t\tvalue = 'test'\n\t\t\tend\n\t\t\ttemplate = <<-end_template\n\t\t\t\t<% labelled_form_for :var do |f| %>\n\t\t\t\t#{partial}\n\t\t\t\t<% end %>\n\t\t\tend_template\n\t\t\trender(template, :name => value)\n\t\t\tassertions.shift.call\n\t\tend\n\t\t\n\tend", "title": "" }, { "docid": "0e5be02bf4c1c3f23cf50c9a7fc1985d", "score": "0.5797752", "text": "def test_contains_food\n\t \n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.5794802", "text": "def test_truth\n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.5790733", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "981d812eeed0ad1873c3b1b526f2a979", "score": "0.5788527", "text": "def test_basics\n boring = %w(clobber_docs clobber_package gem redocs repackage)\n expected = %w(audit\n announce\n check_manifest\n clean\n config_hoe\n debug_gem\n default\n deps:email\n deps:fetch\n deps:list\n docs\n email\n generate_key\n install_gem\n multi\n package\n post_blog\n post_news\n publish_docs\n release\n ridocs\n test\n test_deps)\n expected += boring\n\n spec = Hoe.new('blah', '1.0.0') do |h|\n h.developer(\"name\", \"email\")\n end\n\n assert_equal [\"name\"], spec.author\n assert_equal [\"email\"], spec.email\n\n tasks = Rake.application.tasks\n public_tasks = tasks.reject { |t| t.comment.nil? }.map { |t| t.name }.sort\n\n assert_equal expected.sort, public_tasks\n end", "title": "" }, { "docid": "d064fc4f561d5227761cbe992bf3b994", "score": "0.5784802", "text": "def test_feature_add_righteous\n #skip\n response = \"Bro, that's righteous!\"\n assert_equal(response, @bob.response_for(\"Bro\"))\n end", "title": "" }, { "docid": "b1efec5b541fd82fedd8fa2665471f04", "score": "0.5779547", "text": "def test_harness_common(tests, id)\n tests[id][:ensure] = :present if tests[id][:ensure].nil?\n tests[id][:state] = false if tests[id][:state].nil?\n tests[id][:desc] = '' if tests[id][:desc].nil?\n tests[id][:log_desc] = tests[id][:desc] + \" [ensure => #{tests[id][:ensure]}]\"\n logger.info(\"\\n--------\\n#{tests[id][:log_desc]}\")\n\n test_manifest(tests, id)\n test_resource(tests, id)\n test_idempotence(tests, id)\n tests[id].delete(:log_desc)\nend", "title": "" }, { "docid": "1047edfce1200112a5fa2fe6e26713c9", "score": "0.5769235", "text": "def test_acknowledgement\n\n end\n\n def test_send_acknowledgement\n end\n\n def test_respond_to_acknowledge\n assert @<%= identifier %>.respond_to?(:acknowledge)\n end\n\n private\n def http_raw_data\n \"\"\n end\nend", "title": "" }, { "docid": "18938862ec170ba5111841b2b09d0cb0", "score": "0.57691133", "text": "def make_assertions_on_tests( tests, method )\n assert_equal false, tests[:bad].__send__( method )\n assert_equal true, tests[:good].__send__( method )\n assert_equal true, tests[:extra_good].__send__( method )\n end", "title": "" }, { "docid": "36d6426b60095cdd1428a9f39841eb63", "score": "0.576717", "text": "def expected; end", "title": "" }, { "docid": "265987cf204d0cc1da8192c0ab07b302", "score": "0.5765857", "text": "def test_convert_declarations_when_helper_in_the_name\n rspec_in = <<~IT_SPEC\n RSpec.describe Admin::TestableHelper do\n RSpec.describe 'Admin::QuotedTestableHelper' do\n IT_SPEC\n\n minitest_exp = <<~MINITEST_TEST\n class Admin::TestableHelperTest < ActionView::TestCase\n class Admin::QuotedTestableHelperTest < ActionView::TestCase\n MINITEST_TEST\n\n assert_capture(minitest_exp, rspec_in) do |file|\n SpecConvector.new(Command.new).convert_declarations(file)\n end\n end", "title": "" }, { "docid": "83fb7bfbd0700b1d2cf6e17bb20b283a", "score": "0.5762971", "text": "def before_test\n end", "title": "" } ]
552bb09cee5b8a91ba91c8ccc23edb10
The results from the response object
[ { "docid": "044964de47d046cf1aca75263b396d30", "score": "0.8709408", "text": "def results\n response.results\n end", "title": "" } ]
[ { "docid": "8438ced2518a16b4d6d2a330fce52655", "score": "0.86789626", "text": "def results\n self.response\n end", "title": "" }, { "docid": "8438ced2518a16b4d6d2a330fce52655", "score": "0.86789626", "text": "def results\n self.response\n end", "title": "" }, { "docid": "e0108af878804c27b9fc3acaeadb2962", "score": "0.86307997", "text": "def results\n self.response\n end", "title": "" }, { "docid": "24cd4a73053edfdb8dfe407f29a6dd1d", "score": "0.8232847", "text": "def results\n self.response[1].to_json\n end", "title": "" }, { "docid": "dafe1899f644586c377dbcf926525d89", "score": "0.7847872", "text": "def results\n get_data_elements('result')\n end", "title": "" }, { "docid": "1dba8003616c487d271cf5816f5fb6ff", "score": "0.76871425", "text": "def get_results\n @results\n end", "title": "" }, { "docid": "179b7ef2d7bd5cbaf9f24ebb4c86be2b", "score": "0.7643522", "text": "def results\n return error if error?\n response if response?\n end", "title": "" }, { "docid": "9360739e29807be5dabc29df66688dc9", "score": "0.7598969", "text": "def results\n @results\n end", "title": "" }, { "docid": "a97d4ffa09a6aaf6fa4909708c6accfd", "score": "0.75578475", "text": "def result\n response['result']\n end", "title": "" }, { "docid": "07a32cda02b09ab7b1bd773368b6171b", "score": "0.7503743", "text": "def results\n @my_results\n end", "title": "" }, { "docid": "bf658962690f9aa0d07d536cd8b1a1c7", "score": "0.7483808", "text": "def results; @result[:results] if @result != nil; end", "title": "" }, { "docid": "421d6f6b95e5990fc5fd4353e9288f68", "score": "0.7373567", "text": "def results\n return @results\n end", "title": "" }, { "docid": "58231adab928b1cae077db1c5465f09f", "score": "0.7344173", "text": "def results_from(response)\n results = []\n response.data.each do |obj|\n results << self.new(obj)\n end\n results\n end", "title": "" }, { "docid": "d0e7dec13d12840ec32e37603527805c", "score": "0.73218226", "text": "def results\n self[:results]\n end", "title": "" }, { "docid": "b4be875a742dba037bbaed85f3e27ba2", "score": "0.72897464", "text": "def results\n end", "title": "" }, { "docid": "da6486e50181839d445a978b42a0cef0", "score": "0.728382", "text": "def results\n return get_entities(Result, data.id)\n end", "title": "" }, { "docid": "0a1e634c3537a0ea1757798ae8c75be9", "score": "0.72774273", "text": "def results\n parse_response @raw_response = @client.fql_multiquery(query_map)\n end", "title": "" }, { "docid": "8765ee0d93195d82a2c5d9b7f13dc25a", "score": "0.7236741", "text": "def results\n array\n end", "title": "" }, { "docid": "f684305ae1f7f08790e9bc0e34ad7120", "score": "0.7227404", "text": "def fetch\n fetch_response['results']\n end", "title": "" }, { "docid": "f684305ae1f7f08790e9bc0e34ad7120", "score": "0.7227404", "text": "def fetch\n fetch_response['results']\n end", "title": "" }, { "docid": "b125a512bdf06109c7e9dc10d336b894", "score": "0.7226065", "text": "def results\n Marshal.load(Marshal.dump(@results))\n end", "title": "" }, { "docid": "67db6dc33f9a8aaead9145ab41bd93a1", "score": "0.7174548", "text": "def results\n @results.flatten\n end", "title": "" }, { "docid": "7a1ed30690120cfe6d98929462fab7f4", "score": "0.71716416", "text": "def responses\n perform\n queries.map(&:response)\n end", "title": "" }, { "docid": "6f48c889d0733b3171bfe51ba97ef4ca", "score": "0.7171533", "text": "def response\n query.response\n end", "title": "" }, { "docid": "7ff8954f04c094a6cae247d198bc1bfa", "score": "0.71405625", "text": "def result\n @result ||= hpricot && self.response.items\n end", "title": "" }, { "docid": "62ece3d29f39c94d3d833c21092a7e78", "score": "0.7136778", "text": "def results\n {}\n end", "title": "" }, { "docid": "924b523559b8739fc42e893d8a26156c", "score": "0.71167165", "text": "def get_Results()\n \t return @outputs[\"Results\"]\n \tend", "title": "" }, { "docid": "73e228d381c8a036ec624967f6f09edd", "score": "0.7099145", "text": "def results\n @results ||= hits[\"hits\"].map { |hit| Result.from_hit(hit) }\n end", "title": "" }, { "docid": "f8edf5a89d7ea55d02b49bcbc6389e0a", "score": "0.708984", "text": "def fetch\n responses\n end", "title": "" }, { "docid": "9e7d202e6b1f7b6216dc3fc2124354f9", "score": "0.70267034", "text": "def result\n [status, headers, content]\n end", "title": "" }, { "docid": "4f9d1cd84352680f3270ed98842c94fd", "score": "0.70247954", "text": "def results\n @results ||= fetch_results\n end", "title": "" }, { "docid": "9a9c413c8a449c6070ba8da1a9aa7780", "score": "0.7022133", "text": "def responses\n @responses\n end", "title": "" }, { "docid": "9362d7ce1dbbbd332ff32b09696ae2eb", "score": "0.7007303", "text": "def results\n @@results\n end", "title": "" }, { "docid": "f7b28a52d489ae7f81f9d09590a501fb", "score": "0.69975185", "text": "def results\n require_run\n @results\n end", "title": "" }, { "docid": "8269fe6a0847c459a062421475ee3535", "score": "0.69954693", "text": "def get_results\n res = Array.new(@results)\n @results.clear\n res\n end", "title": "" }, { "docid": "2d5d0702e55912cbc242c94b4a9044d4", "score": "0.699147", "text": "def results\n @stats.data\n end", "title": "" }, { "docid": "71a01db62f6c235efb0e2191c0622009", "score": "0.69742143", "text": "def results\n @results_mutex.synchronize do\n @results\n end\n end", "title": "" }, { "docid": "bd65f9700baa4c69ba5836a1acd3ccb9", "score": "0.6956657", "text": "def results\n begin\n access_token = authenticate\n response = nil\n \n ## Issue an Exception If it is taking too long.\n Timeout.timeout(3) {\n response = access_token.get(self.url).body\n }\n \n json_response = ActiveSupport::JSON.decode(response)\n \n if json_response['businesses'].present?\n json_response['businesses'].map do |c|\n {\n :id => c['id'], \n :name => c['name'], \n :street => c['location']['address'].join(\" \"),\n :city => c['location']['city'],\n :state => c['location']['state_code'],\n :phone => c['phone'],\n :rating => c['rating'],\n :rating_img => c['rating_img_url'],\n :url => c['url'],\n :review_count => c['review_count']\n }\n end\n else\n puts response\n return []\n end\n rescue Timeout::Error => e\n puts e.message\n return []\n rescue => e\n puts e.message\n return []\n end\n end", "title": "" }, { "docid": "bcf1003b12920c4567bf85a8d8a786d0", "score": "0.6955671", "text": "def result(response)\n raise Zenaton::ExternalError, format_errors(response) \\\n if response['errors']\n\n response['data']\n end", "title": "" }, { "docid": "1543bfa682783120fb3da7bf5f227571", "score": "0.69238496", "text": "def data\n @response\n end", "title": "" }, { "docid": "70f2ffbfb4f6c488c7008d2d794a6df3", "score": "0.69069386", "text": "def results\n raise ApplicationIDNotSet if Yahoo::SE.application_id.nil?\n @request = Yahoo::SE::Request.new(Yahoo::SE::Pages::SERVICE_PATH, @options)\n @results = @request.results\n end", "title": "" }, { "docid": "b437e072c232318fb8a9cdb3c54f41f3", "score": "0.6905091", "text": "def results\n @results ||= load_results\n end", "title": "" }, { "docid": "71d20fd7f8b67e7ee7fedfb75a5af166", "score": "0.690111", "text": "def results\n end", "title": "" }, { "docid": "4c994684b893d0044cd88f1d1aaf869a", "score": "0.68989444", "text": "def get_results\n puts @result.to_s\n end", "title": "" }, { "docid": "0c1e39db64830dac28565564e5be8ed8", "score": "0.6892744", "text": "def response\n data = (@response['response'] && @response['response']['data']) || []\n data.map { |v| @cls.new(v) }\n end", "title": "" }, { "docid": "0e0743ac2e96d0ad2546c574aa4321b7", "score": "0.6889775", "text": "def responses\n { successes: @successes, errors: @errors }\n end", "title": "" }, { "docid": "8007e750441e6a2aaa919dcc40530d40", "score": "0.6874861", "text": "def getResult(response)\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\tresult = jsonObject[\"response\"]\r\n\t\t\t\treturn result\r\n\t\t\tend", "title": "" }, { "docid": "8007e750441e6a2aaa919dcc40530d40", "score": "0.6874861", "text": "def getResult(response)\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\tresult = jsonObject[\"response\"]\r\n\t\t\t\treturn result\r\n\t\t\tend", "title": "" }, { "docid": "8007e750441e6a2aaa919dcc40530d40", "score": "0.6874861", "text": "def getResult(response)\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\tresult = jsonObject[\"response\"]\r\n\t\t\t\treturn result\r\n\t\t\tend", "title": "" }, { "docid": "8007e750441e6a2aaa919dcc40530d40", "score": "0.6874861", "text": "def getResult(response)\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\tresult = jsonObject[\"response\"]\r\n\t\t\t\treturn result\r\n\t\t\tend", "title": "" }, { "docid": "8007e750441e6a2aaa919dcc40530d40", "score": "0.6874861", "text": "def getResult(response)\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\tresult = jsonObject[\"response\"]\r\n\t\t\t\treturn result\r\n\t\t\tend", "title": "" }, { "docid": "634800d0b8af92e93c77e3ea7ca277ca", "score": "0.68669456", "text": "def retrieve_result_array\n retrieve_result['results']\n end", "title": "" }, { "docid": "f07f73dcf0d0362deb38908bffde88d4", "score": "0.68648463", "text": "def print_results(response)\nresponse.to_json\nend", "title": "" }, { "docid": "568b3c172d32bcf077b3d9097f67bc0b", "score": "0.68587935", "text": "def results\n @batch.results\n end", "title": "" }, { "docid": "92c7dea288efab5b817719f40f60e4d8", "score": "0.684655", "text": "def return_search_results\n \n #ecode results\n result = ActiveSupport::JSON.decode(open(@url).read)[\"responseData\"][\"results\"]\n \n #for each result, add to an array to an array\n result.each do |page|\n @search_results << [ page['title'], page['url'], page['content'] ] \n end\n \n return @search_results\n \n end", "title": "" }, { "docid": "02a930469038687c6b570c455f18ce8a", "score": "0.68431497", "text": "def results\n run_data\n end", "title": "" }, { "docid": "a3232fbc1e1b93a24793bfcdf52823cc", "score": "0.6843012", "text": "def results\n @results ||= {}\n end", "title": "" }, { "docid": "150d3cb430f6e51627e6d26860cb51ec", "score": "0.6836401", "text": "def results; end", "title": "" }, { "docid": "150d3cb430f6e51627e6d26860cb51ec", "score": "0.6836401", "text": "def results; end", "title": "" }, { "docid": "150d3cb430f6e51627e6d26860cb51ec", "score": "0.6836401", "text": "def results; end", "title": "" }, { "docid": "b592f4020455487dde990faef340d802", "score": "0.68336475", "text": "def result\n to_hash['results']\n end", "title": "" }, { "docid": "ff9230c3a315f17023828174a306dab1", "score": "0.6824163", "text": "def results\n @results ||= hydrate_results\n end", "title": "" }, { "docid": "a27cdb7ac448f2de7ac64e31163d8dbc", "score": "0.68145514", "text": "def parse_results responses\n @operations.zip responses.write_results, responses.status do |operation, write_result, status|\n begin\n status&.code&.zero? ? operation.on_success(write_result) : operation.on_failure(status)\n rescue StandardError\n # TODO: Log the error while parsing response\n end\n end\n end", "title": "" }, { "docid": "f2a0c03ceb6d2edb863ce8e58003404b", "score": "0.6780781", "text": "def results\n # ============================================\n # = FIXME Maybe this can have better warnings if the results aren't ready yet. =\n # ============================================\n master_results\n end", "title": "" }, { "docid": "331d8cb0c81e8b59a13f63511e22faa0", "score": "0.67783344", "text": "def all\n @my_results\n end", "title": "" }, { "docid": "f311c49484380038793053a384ef427b", "score": "0.6770295", "text": "def response\n @response ||= HashWrapper.new(search.execute!)\n end", "title": "" }, { "docid": "b918cc042e361e52f8c219bef07e3591", "score": "0.67627984", "text": "def results(params={})\n @conn.get(\"/#{API_VERSION}/results\", params)\n end", "title": "" }, { "docid": "7c7fbe3784f646822eae06d96fa39214", "score": "0.6755376", "text": "def all()\n if @type == :complete\n @build_query = {:query => @build_query}\n request = BASE_URL + \"&#{@build_query.to_query}\"\n Rails.logger.info \"request url: #{request}\"\n response = HTTParty.get(request)\n # save the result set here\n response.each do |element|\n @result << klass.new(element)\n end\n\n @result\n else\n raise 'An error has occurred'\n end\n end", "title": "" }, { "docid": "ae568d6848b53ca418d7f3a18508e750", "score": "0.6752116", "text": "def parsed_response\n self.response\n end", "title": "" }, { "docid": "4b50ceb850f465aec23e680c37d5e487", "score": "0.6743524", "text": "def results\n return nil unless done?\n return nil unless @grpc.grpc_op.result == :response\n @grpc.results\n end", "title": "" }, { "docid": "097fa3b0425594191e61d28759ddd366", "score": "0.6742214", "text": "def list_results\n # Interface method\n end", "title": "" }, { "docid": "ea38ce57bf8148cfaf61f1033a1cd87d", "score": "0.6742025", "text": "def results\n end", "title": "" }, { "docid": "ea38ce57bf8148cfaf61f1033a1cd87d", "score": "0.6742025", "text": "def results\n end", "title": "" }, { "docid": "d97a946b7f1fa313cf185a2e89c21ec4", "score": "0.674136", "text": "def get_results()\n ret = {}\n ret[:links] = @links\n ret[:post_forms] = @post_forms\n ret[:get_forms] = @get_forms\n ret\n end", "title": "" }, { "docid": "82abc7575c4b66ed288f3e38c157fd09", "score": "0.67366344", "text": "def results\n vars = {\"trt_id\"=> @test_id}\n vars[\"type\" => @results_type] if @results_type\n\n path = \"test/results\"\n path = \"try_it_now/results\" if login_name == \"try_it_now\"\n response = api_request path, vars\n response[\"results\"]\n end", "title": "" }, { "docid": "9ec1ca3a96bb54434830ed12f2f201aa", "score": "0.6710187", "text": "def results\n @results ||= _results.elements.inject({}) { |h,r| h.merge!({ r._result.name => r._result.value }) }\n end", "title": "" }, { "docid": "50954b34299590188220aa15680b1bd6", "score": "0.6704123", "text": "def results\n @results ||= _results.text_value\n end", "title": "" }, { "docid": "9f55597b722275fea7166e6b4db3f473", "score": "0.6699318", "text": "def response\n @response\n end", "title": "" }, { "docid": "9f55597b722275fea7166e6b4db3f473", "score": "0.6699318", "text": "def response\n @response\n end", "title": "" }, { "docid": "9f55597b722275fea7166e6b4db3f473", "score": "0.6699318", "text": "def response\n @response\n end", "title": "" }, { "docid": "9f55597b722275fea7166e6b4db3f473", "score": "0.6699318", "text": "def response\n @response\n end", "title": "" }, { "docid": "b6dfea5e3ad6751dec27aa2bb9376e8e", "score": "0.667915", "text": "def get_results()\n if !@result_set\n get_status()\n end\n return @result_set\n end", "title": "" }, { "docid": "d6543e5e4890949106b601d679a87ec7", "score": "0.6674916", "text": "def all\n @@responses\n end", "title": "" }, { "docid": "d0229bd8e36337f2d5879257540c3858", "score": "0.6673893", "text": "def results\n materialize(true)\n @results\n end", "title": "" }, { "docid": "1f6497eb326a3815dd2c81b9b1d9e418", "score": "0.6662422", "text": "def all\n result['hits']['hits']\n end", "title": "" }, { "docid": "f14569403233f879d74eae24b07fa415", "score": "0.66576", "text": "def api_response\n @response\n end", "title": "" }, { "docid": "6eb4e1ac63a9348f5d59f8cd7bce7652", "score": "0.66540205", "text": "def results\n @results ||= normalized_results\n end", "title": "" }, { "docid": "59ea932f4989f0e6076fde3a7dfc7423", "score": "0.66501063", "text": "def index\n @extractor_responses = ExtractorResponse.all\n end", "title": "" }, { "docid": "4689a0151bf99ef8dfb8a78463770f05", "score": "0.6643393", "text": "def extract_data response \n @parser.parse(response.http_response.body)\n end", "title": "" }, { "docid": "4a6f331a9c619ea18a3c97d1e1361ead", "score": "0.66343564", "text": "def response\n @_response\n end", "title": "" }, { "docid": "0fda700dd65ce72e22ff2eee0f3c5924", "score": "0.66293436", "text": "def execute\n results\n end", "title": "" }, { "docid": "0fda700dd65ce72e22ff2eee0f3c5924", "score": "0.66293436", "text": "def execute\n results\n end", "title": "" }, { "docid": "6f49c798fcba966880fd401da71a5d70", "score": "0.6627539", "text": "def results\n @engine.results\n end", "title": "" }, { "docid": "c70fb57b96b8ca40114dcc5d109655bd", "score": "0.6616534", "text": "def results\n results_html.map do |result_html|\n KindleUnlimitedEbookResult.new(result_html)\n end\n end", "title": "" }, { "docid": "359c906f170268be2bbd19622a57c60b", "score": "0.6611939", "text": "def index\n @responses = ResponseSet.all\n @res = Response.all\n end", "title": "" }, { "docid": "ff689b1353679b822af80836fbd0157c", "score": "0.6609336", "text": "def response\n [status, headers, [body]]\n end", "title": "" }, { "docid": "e917e5853fea4e27175eb2548de09f30", "score": "0.6597758", "text": "def responses\n @@responses ||= []\n end", "title": "" }, { "docid": "f15e99b95aa59e904a5a41badc173af1", "score": "0.6595462", "text": "def response\n raise \"Must send a request before you can get a response. Run the results method first!\" if @request.nil?\n @response = @request.response\n end", "title": "" }, { "docid": "61cc1abdf6ba896e7213d62f2dfe90cb", "score": "0.65936345", "text": "def results\n result_list.map{ |result| formatted_result(result) }.compact\n end", "title": "" } ]
f51072127df51d2b415518fceef0b5dc
Retrieves the builtin html5 converter. Returns the instance of the Asciidoctor::Converter::Html5Converter associated with this node.
[ { "docid": "05cf11a95ff0601b061cde3bbfd4e063", "score": "0.7714577", "text": "def html5_converter\n converter.instance_variable_get(\"@delegate_converter\")\n end", "title": "" } ]
[ { "docid": "a467ee3409524478083b3ff1644464c2", "score": "0.79476976", "text": "def html5_converter\n converter.instance_variable_get(\"@delegate_converter\")\n end", "title": "" }, { "docid": "512d62140432dd29ec5fa8ec7661660a", "score": "0.52147734", "text": "def converter_type\n self.read_attribute(:converter_type)\n end", "title": "" }, { "docid": "44454666329629a0a40e3d3bdceac4a3", "score": "0.5022684", "text": "def converter(renderer)\n result = nil\n renderer_config = read_config[renderer.to_s]\n result = render_type(renderer_config) if renderer_config\n result ||= DefaultConverter.new(nil)\n result\n end", "title": "" }, { "docid": "3d14939534a066ddb47dcd60259885a3", "score": "0.50155956", "text": "def html5\n raw \"<!DOCTYPE html>\\n\"\n end", "title": "" }, { "docid": "eb02463b6fbc34136706d1ae4bf5c3c4", "score": "0.49698743", "text": "def converters\n default.converters\n end", "title": "" }, { "docid": "6c2c6c5cd79eaa08a8342643978a7243", "score": "0.4766741", "text": "def converter\n unit.converter\n end", "title": "" }, { "docid": "492e426ad2621814a607aaf492b36c47", "score": "0.4670158", "text": "def converter(aesthetic)\n @converters[aesthetic]\n end", "title": "" }, { "docid": "99402ea41bac51b74bf934626869cc6e", "score": "0.46522197", "text": "def to_html\n output, warnings = Kramdown::Converter::Html.convert(@root, @options)\n @warnings.concat(warnings)\n output\n end", "title": "" }, { "docid": "99402ea41bac51b74bf934626869cc6e", "score": "0.46522197", "text": "def to_html\n output, warnings = Kramdown::Converter::Html.convert(@root, @options)\n @warnings.concat(warnings)\n output\n end", "title": "" }, { "docid": "30bc9a6d0adb5ee008066f1977a5a52c", "score": "0.4587689", "text": "def to_html\n html_exporter.html\n end", "title": "" }, { "docid": "01edb595ecaa1b6484c536ecb4784198", "score": "0.45244154", "text": "def converter(name, &blk)\n if blk\n (converters[name.to_sym] ||= new(name.to_sym)).instance_eval(&blk)\n else\n converters[name.to_sym] or raise ::ArgumentError, \"No converter #{name.to_s.dump} found\"\n end\n end", "title": "" }, { "docid": "e54ded009f7e93808ef0b72fec200e33", "score": "0.4408755", "text": "def converter_for transform\n @converter_cache[transform]\n end", "title": "" }, { "docid": "98fb4540f82b0bf969802354d5797900", "score": "0.4398354", "text": "def converter; end", "title": "" }, { "docid": "98fb4540f82b0bf969802354d5797900", "score": "0.4398354", "text": "def converter; end", "title": "" }, { "docid": "98fb4540f82b0bf969802354d5797900", "score": "0.4398354", "text": "def converter; end", "title": "" }, { "docid": "819c11899dec5c2e0f3663dad447de36", "score": "0.43823382", "text": "def to_s\n (@name.to_s if @name) || \"#<Converter:#{object_id.to_s(16)}>\"\n end", "title": "" }, { "docid": "cc57a0082372e127fe4bff4986e79bbf", "score": "0.4351016", "text": "def to_xml\n\t\treturn self.formatted_as( self.class.formatters['xml'][:uri] )\n\tend", "title": "" }, { "docid": "8ea65e731aa2500c6ec278ccf489df8f", "score": "0.42682102", "text": "def html\n if self[\"type\"] == \"xhtml\" or self[\"type\"] == \"html\"\n to_s\n elsif self[\"type\"] == \"text\"\n REXML::Text.new(to_s).to_s\n end\n end", "title": "" }, { "docid": "814243887e1eb663005aa6a563cbf834", "score": "0.42648047", "text": "def convert(output_type)\n msg = self.dup\n msg.convert!(output_type)\n return msg\n end", "title": "" }, { "docid": "f101559d7f8fe1071ab23a58e941a28a", "score": "0.4259223", "text": "def html_exporter\n ArticleJSON::Export::HTML::Exporter.new(elements)\n end", "title": "" }, { "docid": "b69c6daa2b061b69ef704b5370260ba3", "score": "0.42500144", "text": "def convert(el, opts = {})\n send(\"convert_#{el.type}\", el, opts)\n end", "title": "" }, { "docid": "6599e25696e9bc66a79cb448b25335a5", "score": "0.423394", "text": "def converters\n @converters.map do |converter|\n name = Converters.rassoc(converter)\n name ? name.first : converter\n end\n end", "title": "" }, { "docid": "32d1bf759f6a9a043ed18b7645c444e2", "score": "0.42036253", "text": "def html\n node.to_xml\n end", "title": "" }, { "docid": "16363406e268f537d239f92eca407bf3", "score": "0.41929218", "text": "def to_html\n output = ASUtils.tempfile('ead2html.html') \n begin \n output.write(transform.to_s) \n ensure\n output.close\n end\n output\n end", "title": "" }, { "docid": "b190b2dfc9dde398f1d5be7950a60ebc", "score": "0.41925207", "text": "def set_converter\n @converter = Converter.find(params[:id])\n end", "title": "" }, { "docid": "d854a43b5f40646905712a7f47dba898", "score": "0.41920105", "text": "def output_ext\n @output_ext ||= (permalink_ext || converter_output_ext)\n end", "title": "" }, { "docid": "b61c025e9649a52da9d3972f86445387", "score": "0.41894448", "text": "def sass_converter\n @sass_converter ||= begin\n Octopress.site.converters.find do |c|\n c.kind_of?(Jekyll::Converters::Sass) \n end\n end\n end", "title": "" }, { "docid": "86c22b1797ae10786660ae24fe8332b4", "score": "0.4188591", "text": "def convert node, transform = nil, opts = nil\n (converter_for transform ||= node.node_name).convert node, transform, opts\n end", "title": "" }, { "docid": "de0f1eb9e2d3cd14cf8075d46f93bca7", "score": "0.41839322", "text": "def conversion\n return internal_conversion(@name)\n end", "title": "" }, { "docid": "95e173391f5adb937e8b4a0f7ea3c7d7", "score": "0.41799408", "text": "def set_admin_converter\n @admin_converter = Admin::Converter.find(params[:id])\n end", "title": "" }, { "docid": "ce5cff9610bb07e7752a5e4a054fa6a3", "score": "0.4171622", "text": "def html5(&block)\n @buffer << S_HTML5_DOCTYPE\n self.html(&block)\n end", "title": "" }, { "docid": "291e407a009fc8ab9efc1a7a4bff1227", "score": "0.41686887", "text": "def converter_for transform\n @converter_map[transform] ||= find_converter transform\n end", "title": "" }, { "docid": "c23f4f249dec0125b8d3321b7366388d", "score": "0.41641608", "text": "def html\n to_rgb.html\n end", "title": "" }, { "docid": "c23f4f249dec0125b8d3321b7366388d", "score": "0.41641608", "text": "def html\n to_rgb.html\n end", "title": "" }, { "docid": "c23f4f249dec0125b8d3321b7366388d", "score": "0.41641608", "text": "def html\n to_rgb.html\n end", "title": "" }, { "docid": "2e88f638c95645fe6e4d0354cd0fdae0", "score": "0.41548413", "text": "def to_html\n\t\t\tto_rgb.to_html\n\t\tend", "title": "" }, { "docid": "5ef7b281cb94434f7563055d751a350d", "score": "0.4141357", "text": "def renderer\n HtmlRenderer.new(self)\n end", "title": "" }, { "docid": "5ef7b281cb94434f7563055d751a350d", "score": "0.4141357", "text": "def renderer\n HtmlRenderer.new(self)\n end", "title": "" }, { "docid": "5ef7b281cb94434f7563055d751a350d", "score": "0.4141357", "text": "def renderer\n HtmlRenderer.new(self)\n end", "title": "" }, { "docid": "5ef7b281cb94434f7563055d751a350d", "score": "0.4141357", "text": "def renderer\n HtmlRenderer.new(self)\n end", "title": "" }, { "docid": "1909f4914ebebc19c3ae8e7c883c877b", "score": "0.4139063", "text": "def html\n if self.textile\n RedCloth.new(self.content).to_html if self[:content]\n elsif self.markdown\n BlueCloth.new(self.content).to_html if self[:content]\n else\n self.content\n end\n end", "title": "" }, { "docid": "581a37bc7f1ed47bd0062bba017a9eea", "score": "0.41331357", "text": "def convert(_el)\n raise NotImplementedError\n end", "title": "" }, { "docid": "4f2a9e75aba8185f22b87e8343a786a2", "score": "0.4127939", "text": "def convert node, transform = nil\n transform ||= node.node_name\n # QUESTION is there a way we can control whether to use convert or send?\n (converter_for transform).convert node, transform\n end", "title": "" }, { "docid": "1fe912dab13993ccbf36d8023cee3578", "score": "0.4119903", "text": "def convert_to_html\n require 'RedCloth'\n formatted = RedCloth.new(self.data, [:filter_html])\n return formatted.to_html\n end", "title": "" }, { "docid": "ff1aaa6d8053743a6fcd3edd900837f6", "score": "0.4111092", "text": "def to_html\n xsl_html.transform(@metadata).to_html\n end", "title": "" }, { "docid": "bdfa382b1f516a4172bc7374cae3c808", "score": "0.41082355", "text": "def convert_better_html(node); end", "title": "" }, { "docid": "4ac48d66a7b3bd77117efc318a416e3b", "score": "0.41053998", "text": "def to_html\n fail NoMethodError, \"Engines need to implement this method\"\n end", "title": "" }, { "docid": "69f722069c0940946614ef36627988ed", "score": "0.410511", "text": "def to_html\n \n html_node = to_html_node\n \n # check the root node to make sure we output valid html\n unless html_node.document.root.name == 'html'\n old_root = html_node.document.root\n new_root = ::Nokogiri::XML::Node.new( 'html', html_node.document )\n has_head = false\n has_body = false\n head = nil\n body = nil\n content = nil\n case old_root.name\n when 'head'\n has_body = true\n when 'body'\n has_head = true\n end\n if has_head\n head = old_root\n else\n head = ::Nokogiri::XML::Node.new( 'head', html_node.document )\n end\n if has_body\n body = old_root\n else\n body = ::Nokogiri::XML::Node.new( 'body', html_node.document )\n end\n unless has_head or has_body\n content = old_root\n body.add_child( content )\n end\n new_root.add_child( head )\n new_root.add_child( body )\n html_node.document.root = new_root\n end\n \n # Make sure that we have a head/html/body\n return html_node.document.to_xhtml( self.class::FrameConfiguration )\n\n end", "title": "" }, { "docid": "ce8d6b67e368edc117caf2d83393bdd5", "score": "0.4097032", "text": "def idml_story_converter\n ::Kramdown::Converter::IdmlStory\n end", "title": "" }, { "docid": "9217acbbb425ff2609edc172b60b3314", "score": "0.40901756", "text": "def to_html\n processor.convert :content, @url, normalized_options(path: nil)\n end", "title": "" }, { "docid": "595d9149a6bdf85434db9fc6fda208bc", "score": "0.40617087", "text": "def to_kramdown(kramdown_converter=nil)\n kramdown_converter ||= ::Kramdown::Converter::KramdownRepositext.send(\n :new, nil, {}\n )\n return '' if :gap == type\n\n el = ::Kramdown::ElementRt.new(\n type,\n nil,\n ke_attrs,\n { category: :block, ial: ke_attrs }\n )\n # combine contents with block_ial. Normalize to two trailing newlines.\n (\n [\n contents,\n kramdown_converter.send(:ial_for_element, el),\n \"\\n\\n\"\n ].join\n ).gsub(/\\n+\\z/, \"\\n\\n\")\n end", "title": "" }, { "docid": "4a8adcf77ebc5f7bcf64357b4ecb73f3", "score": "0.40600738", "text": "def to_html\n self\n end", "title": "" }, { "docid": "f5039c41ccbef69324f6f58d1e203392", "score": "0.40595984", "text": "def converters\n @converters ||= site.converters.select do |converter|\n if converter.method(:matches).arity == 1\n converter.matches(document.extname)\n else\n converter.matches(document.extname, document)\n end\n end.sort\n end", "title": "" }, { "docid": "a759e5182a7422086399d493d8aa63c1", "score": "0.40369743", "text": "def to_amp\n amp_exporter.html\n end", "title": "" }, { "docid": "bf68ced73cc14b1fcc2242cc140df79b", "score": "0.40366587", "text": "def get_encoder_class\n end", "title": "" }, { "docid": "eaf80e9ccd9ec9f5a6f1281eb23b76c0", "score": "0.4026308", "text": "def to_uri\n self.class.const_get(:URI)\n end", "title": "" }, { "docid": "d4fcf12996a7a13cd96097222dc6c9d4", "score": "0.40168068", "text": "def register converter, backends = ['*']\n default.register converter, backends\n end", "title": "" }, { "docid": "af8a508713856d9af4441a0575cd1422", "score": "0.40144226", "text": "def to_html\n generator.generate\n end", "title": "" }, { "docid": "707e8f4baf06089836bfc3e1f92d144a", "score": "0.40082407", "text": "def convert(content, convertible)\n return content if convertible.data[:template_engine] != \"haml\"\n\n haml_view = Bridgetown::HamlView.new(convertible)\n\n haml_renderer = Haml::Template.new(convertible.relative_path) { content }\n\n if convertible.is_a?(Bridgetown::Layout)\n haml_renderer.render(haml_view) do\n convertible.current_document_output\n end\n else\n haml_renderer.render(haml_view)\n end\n end", "title": "" }, { "docid": "9d5828d450a8ca25d6595a6a5130e2a6", "score": "0.4007832", "text": "def convert_save(*)\n RPF::Plugin::Kramdown.convert_save_to_html\n end", "title": "" }, { "docid": "178d15c7278bffdbec31af7a8a35a298", "score": "0.4005099", "text": "def to_element\n normalize.produce_element\n end", "title": "" }, { "docid": "e8c018464bf2a81a4655d27bef1410c6", "score": "0.39981", "text": "def converter_registry\n @converter_registry ||= Registry.new(default_converters)\n end", "title": "" }, { "docid": "588cfd09efb1aa155c145b211f25744c", "score": "0.39947432", "text": "def to_html\n md = SLOGGER_HOME + '/lib/multimarkdown'\n return %x{echo #{self.e_sh}|\"#{md}\"}\n end", "title": "" }, { "docid": "b28369d3061d3551bac8fadb04a91043", "score": "0.39867878", "text": "def html_content_to_html\n html = Nokogiri::HTML(self.html_content)\n end", "title": "" }, { "docid": "b28369d3061d3551bac8fadb04a91043", "score": "0.39867878", "text": "def html_content_to_html\n html = Nokogiri::HTML(self.html_content)\n end", "title": "" }, { "docid": "e69a1b1651a04d3315d29cb87abef721", "score": "0.3983621", "text": "def to_html\n self.to_color(AllCompliance, true, 8, true)\n end", "title": "" }, { "docid": "d7a65afbe723f4bcd579e898746a368a", "score": "0.39816797", "text": "def to_burlap\n doc = Nokogiri::XML::Document.new\n root = Nokogiri::XML::Node.new(self.name, doc)\n\n if self.value.to_s == \"\"\n root.children = self.value.to_s\n else\n root << self.value.to_s\n end\n\n convert_hex_entities_to_decimal root.to_xml(nokogiri_xml_options)\n end", "title": "" }, { "docid": "fed2dca30953c3f0168ee0dc319a175e", "score": "0.39729303", "text": "def conversion_type\n @conversion_type\n end", "title": "" }, { "docid": "7457ba9af1ddaa336883b0f56853cd8c", "score": "0.3967574", "text": "def header_converter=(converter)\n @header_converter = if converter.is_a?(Symbol)\n converter_registry[converter]\n else\n converter\n end\n end", "title": "" }, { "docid": "ab561bddccf86310bd733f79a771e783", "score": "0.3954332", "text": "def generate_html\n return self.to_s\n end", "title": "" }, { "docid": "a2e159fadf5b55ba4e3c82d75a59c2e7", "score": "0.3951505", "text": "def converter_factory\n case @options[:format]\n when \"html\"\n HtmlConverter.new @paths, @deploy_info, @options\n when \"pdf\"\n PdfConverter.new @paths, @deploy_info, @options\n else\n raise ArgumentError, \"Unknown conversion format: #{@options[:format]}\"\n end\n end", "title": "" }, { "docid": "29c645ce04197b03506978444cae027e", "score": "0.39473164", "text": "def convert_to_html\n @text = RedCloth.new(@text).to_html\n end", "title": "" }, { "docid": "9ed9a6e8e979e3a60081cc955b17e91a", "score": "0.39410973", "text": "def translations_converter\n @translations_converter || ->(raw_data) { raw_data.to_yaml }\n end", "title": "" }, { "docid": "05f3e8223c939e7f9b9c6eba6e51b289", "score": "0.3940234", "text": "def use_html5_parsing; end", "title": "" }, { "docid": "176920c914d930df33c5f5da27fdef42", "score": "0.39386013", "text": "def to_html\n raise NotImplementedError\n end", "title": "" }, { "docid": "c7b308f43700c545ffdcf21981b1dc19", "score": "0.39380535", "text": "def to_html( body=nil )\n body ||= @body\n\n convertor = for_syntax( lang )\n body = \"<link rel='stylesheet' type='text/css' \" +\n \"href='/stylesheets/#{lang}.css' />\" +\n \"<div class='#{lang}'>\" +\n convertor.convert( body ) +\n \"</div>\"\n\n super body\n end", "title": "" }, { "docid": "b8320b111cf74de883b66fcfdcb81427", "score": "0.39332315", "text": "def header_converter\n @header_converter ||= converter_registry[:header_column]\n end", "title": "" }, { "docid": "e80d7bf2c6cde319087e094e07e4f98c", "score": "0.39181226", "text": "def to_css_class\r\n to_default_css_class\r\n end", "title": "" }, { "docid": "d048c5362bb7e3f08e2fc818244ef78d", "score": "0.39174792", "text": "def register(converter)\n self.converters ||= []\n self.converters << converter\n end", "title": "" }, { "docid": "9bab7d80770564cca82ef66f4cffadbd", "score": "0.39114383", "text": "def convert(content)\n document = Kramdown::Document.new(content, @config)\n html_output = document.to_html.chomp\n if @config[\"show_warnings\"]\n document.warnings.each do |warning|\n Jekyll.logger.warn \"Kramdown warning:\", warning.sub(%r!^Warning:\\s+!, \"\")\n end\n end\n html_output\n end", "title": "" }, { "docid": "c0b379bf0adf437a35bb82a647a6f592", "score": "0.3911277", "text": "def use_html5_parsing=(_arg0); end", "title": "" }, { "docid": "3a5e172e93bd5688022b913550500c3a", "score": "0.3905386", "text": "def to_diff_value(options = nil)\n to_html options\n end", "title": "" }, { "docid": "8cff672cc2a66777b431783a158591ef", "score": "0.39016646", "text": "def converter(type = nil, enforce_type = true)\n return DefaultConverter unless type\n @converters ||= begin\n Neo4r::TypeConverters.constants.find_all do |c|\n Neo4r::TypeConverters.const_get(c).respond_to?(:convert?)\n end.map do |c|\n Neo4r::TypeConverters.const_get(c)\n end\n end\n found = @converters.find {|c| c.convert?(type) }\n raise \"The type #{type.inspect} is unknown. Use one of #{@converters.map{|c| c.name }.join(\", \")} or create a custom type converter.\" if !found && enforce_type\n found or DefaultConverter\n end", "title": "" }, { "docid": "5e17fc7d63705a0acaf5a1533b250e8d", "score": "0.39010376", "text": "def to_html\n @root_node.to_html\n end", "title": "" }, { "docid": "652247a9b8c9a70bd6b01eaf2306fffa", "score": "0.38958701", "text": "def type_html\n\t\treturn nil if(vulntype == 0) \n\n\t\tvt = VulnType.get(vulntype)\n\t\treturn vt.html\n\tend", "title": "" }, { "docid": "6fd243c590fac66672107982535148ab", "score": "0.38886407", "text": "def resource\n OrmConverter.new(object: container, adapter: value.adapter).convert\n end", "title": "" }, { "docid": "ca6649ff763f7e55df60b59638816e07", "score": "0.3885072", "text": "def convertor_for(conversion)\n convertor_class(conversion).new(conversion)\n end", "title": "" }, { "docid": "9666b4dced6e15a972ec47a41a8a55ec", "score": "0.38766822", "text": "def color_to_html(color)\n case color.downcase\n when 'aqua'\n return '#00E8D5'\n when 'cyan'\n return '#00B0A2'\n when 'gray'\n return '#6C6C6C'\n when 'red'\n return '#DC0000'\n when 'blue'\n return '#3000DC'\n when 'green'\n return '#007F17'\n when 'lime'\n return '#00DA28'\n when 'yellow'\n return '#ffea00'\n when 'orange'\n return '#EC9200'\n when 'purple'\n return '#C500EC'\n when 'pink'\n return '#EC00D8'\n else\n return 'none'\n end\nend", "title": "" }, { "docid": "afb680af6c3d9c4cc973401d2117c823", "score": "0.38747457", "text": "def html\n @java_node.as_xml\n end", "title": "" }, { "docid": "561e26ae816d2497a5d5f24d3d6a67f7", "score": "0.3871069", "text": "def convert_better_html(node)\n definition = Parser::Source::Map::Definition.new(\n node.location.begin,\n node.location.begin,\n node.location.begin,\n node.location.end\n )\n Parser::AST::Node.new(\n node.type,\n node.children.map { |child| child.is_a?(BetterHtml::AST::Node) ? convert_better_html(child) : child },\n {\n location: definition\n }\n )\n end", "title": "" }, { "docid": "1cafbbffab3579bb9abc10cfeda0cae0", "score": "0.38702634", "text": "def new\n @converter_ms = MsConverter.new\n end", "title": "" }, { "docid": "c14b3c922eb796ef74b3a9467343bb01", "score": "0.386291", "text": "def convert_save(_el, _indent)\n RPF::Plugin::Kramdown.convert_save_to_html\n end", "title": "" }, { "docid": "4b897cb3cab39548eedd1f1ab49365b1", "score": "0.3855464", "text": "def html5_shim\n %{<!--[if lt IE 9]><script src=\"http://html5shim.googlecode.com/svn/trunk/html5.js\"></script><![endif]-->}.html_safe\n end", "title": "" }, { "docid": "1830a70b262f76dd49aab035dbb297ba", "score": "0.38482276", "text": "def to_blamed_ruby\n Blaml::ToRuby.new.accept self\n end", "title": "" }, { "docid": "f8fdee9ef324fdd6780a2a6a0ab413bb", "score": "0.38442922", "text": "def to_s\n '<Twilio.FlexApi.V2.WebChannelsPage>'\n end", "title": "" }, { "docid": "9e64c72f295bb00f038505f9193ca08b", "score": "0.38418454", "text": "def ead_to_html\n default_html\n full_html\n end", "title": "" }, { "docid": "3db40a1af6e17eddb7df9f2eca45f833", "score": "0.3840653", "text": "def method_missing(id, *attr, &block)\n if id.to_s =~ /^to_(\\w+)$/ && (name = Utils.camelize($1)) &&\n try_require('converter', name) && Converter.const_defined?(name)\n output, warnings = Converter.const_get(name).convert(@root, @options)\n @warnings.concat(warnings)\n output\n else\n super\n end\n end", "title": "" }, { "docid": "fb17e12155eee526646570f31ed18b74", "score": "0.38386095", "text": "def parser\n @parser ||= MarkupParser::Markdown.html_parser\n end", "title": "" }, { "docid": "74b28bf27da2e024173e476817ddb5fe", "score": "0.38384345", "text": "def convert\n @content\n end", "title": "" }, { "docid": "39cabf5108c7dcb46eaad41c58170a6b", "score": "0.38336807", "text": "def find_converter transform\n @converters.each do |candidate|\n return candidate if candidate.handles? transform\n end\n raise %(Could not find a converter to handle transform: #{transform})\n end", "title": "" } ]
1f75fd4be09c15a5645fda80cae87885
def get_days(arg) LeavesHolidaysDates.get_days(arg, self.user, self) end
[ { "docid": "5a78fa65b63cbfcd60c06f3797f415a6", "score": "0.0", "text": "def get_days_remaining_with\n remaining = self.user.days_remaining(from_date)\n if !is_actually_deduced? && !is_non_deduce_leave\n remaining -= actual_leave_days\n end\n return remaining\n end", "title": "" } ]
[ { "docid": "806ed4480c2ca33a986eb96b4751c759", "score": "0.6704487", "text": "def holidays\n ScheduleDataManager.holidays(@holiday_schedule_name)\n end", "title": "" }, { "docid": "d412e6ea5245dfafd2906682b32668bc", "score": "0.66269636", "text": "def days(*args)\n if args.first.is_a?(Range)\n @dow = format_range(args.first)\n else\n list = args.map {|day| day_value(day) unless day.is_a?(Fixnum) }\n @dow = list.join(',')\n end\n self\n end", "title": "" }, { "docid": "d412e6ea5245dfafd2906682b32668bc", "score": "0.66269636", "text": "def days(*args)\n if args.first.is_a?(Range)\n @dow = format_range(args.first)\n else\n list = args.map {|day| day_value(day) unless day.is_a?(Fixnum) }\n @dow = list.join(',')\n end\n self\n end", "title": "" }, { "docid": "a388554d718d1fe22f918c04d436c3fd", "score": "0.65607417", "text": "def calculate_days\n\n data = BookingDataSystem::Booking.calculate_days(@date_from, @time_from, @date_to, @time_to)\n\n @days = data[:days]\n @date_to_price_calculation = data[:date_to_price_calculation]\n unless data[:valid]\n @valid = data[:valid]\n @error = data[:error]\n end\n\n end", "title": "" }, { "docid": "63b976ae96cddff31c611d8d7376e1c4", "score": "0.65064955", "text": "def days()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Days::DaysRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "2c0b6d5c1da974d10d09ed4f6609e9da", "score": "0.64161384", "text": "def days \n object.days\n end", "title": "" }, { "docid": "1325f0de4b7b324ff1078aa86343b1ef", "score": "0.64072454", "text": "def holidays\n @holidays ||= days.select(&:holiday?)\n end", "title": "" }, { "docid": "14fbcc95ba1b7458a649216696ceb0b5", "score": "0.64028406", "text": "def days\n monday..sunday\n end", "title": "" }, { "docid": "b2b36a5f1a6912be0fb3d34e4a2fad60", "score": "0.6339458", "text": "def business_days\n @business_days ||= days.select(&:business_day?)\n end", "title": "" }, { "docid": "a893c03f8c81bf561df3f08ac29979ea", "score": "0.6335524", "text": "def day(date)\n \n days = self.days(14)\n \n day = Object\n \n days.each do |dayEach|\n break day = dayEach if dayEach.dia == date.strftime(\"%d-%m-%Y\") \n end\n \n day\n \n end", "title": "" }, { "docid": "1006b7ed63e20377ae452dccd9fde17e", "score": "0.6303782", "text": "def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end", "title": "" }, { "docid": "62345eb8560cf0e0645b1be24207181b", "score": "0.6239626", "text": "def days\n Advert.days_for_months(months)\n end", "title": "" }, { "docid": "e3caa16a3983c983f2954bc9d8e9c8f2", "score": "0.6218342", "text": "def list_of_days_worked_out\n array = []\n workouts = Workout.all.find_all do |workout| \n workout.user_id == self.id \n end\n dates = workouts.each do |workout|\n array << workout.date\n end\n array\n end", "title": "" }, { "docid": "2bc7ed9e377d2fc1105f91737b5be692", "score": "0.62106085", "text": "def days\n attendances.order(date: :asc).map(&:date)\n end", "title": "" }, { "docid": "2436f573445c0cc59f2e6ae149030530", "score": "0.6205357", "text": "def days(from_date = first_day.date, to_date = last_day.date)\n from_date = Date.new(2017, 1, 1)\n to_date = Date.new(2017, 12, 31)\n\n @days ||= workdays.select { |day| day.hours > 0 && (from_date..to_date).include?(day.date) }\n end", "title": "" }, { "docid": "efa4dea8144f61ca4b7226fda130b570", "score": "0.61797756", "text": "def days\n self * SECONDS_IN_DAY\n end", "title": "" }, { "docid": "2b170ec21411ee5c4bcc972669ad6b86", "score": "0.61700046", "text": "def days_habits(date, habit)\n Dailyhabit.where(\n user_id: @user.id,\n habit_id: habit.id\n ).where(\n date: todays_date_range(date)\n )\n end", "title": "" }, { "docid": "da4d72682ef531371abf4efbbff1f764", "score": "0.61642444", "text": "def lead_days\n 1\n end", "title": "" }, { "docid": "da4d72682ef531371abf4efbbff1f764", "score": "0.61642444", "text": "def lead_days\n 1\n end", "title": "" }, { "docid": "da4d72682ef531371abf4efbbff1f764", "score": "0.61642444", "text": "def lead_days\n 1\n end", "title": "" }, { "docid": "da4d72682ef531371abf4efbbff1f764", "score": "0.61642444", "text": "def lead_days\n 1\n end", "title": "" }, { "docid": "ac7b67874ac1ace40e0d16ab046ada09", "score": "0.6152423", "text": "def return_days=(days)\n \tself.return_date = Date.today + days.to_i\n end", "title": "" }, { "docid": "8435628c6da1ebb7ead8b09d0e1ee0ad", "score": "0.60895663", "text": "def days ; self * 24.hours ; end", "title": "" }, { "docid": "afe5f0cbd59e84354199a2f7e16e6f52", "score": "0.6071549", "text": "def week_days(options={}, &block)\n start_date = self\n result = []\n (start_date-wday_offset).step 7 do |a_day|\n a_day.week_day_start = self.week_day_start\n if block_given?\n yield a_day\n else\n result.push(a_day)\n end\n end\n result\n end", "title": "" }, { "docid": "01813414eb7fb9d71a6c97d21fed5a3b", "score": "0.60642153", "text": "def get_days\n return 0b0 if @params[:type] != 'advanced'\n\n return get_weekday_bitmask(['weekday_sun', 'weekday_mon', 'weekday_tue', 'weekday_wed', 'weekday_thu', 'weekday_fri', 'weekday_sat']) if @params[:schedule] == 'weekly'\n\n return get_month_bitmask(@params[:dates_picked]) if @params[:schedule] == 'monthly' && @params[:days] == 'specific'\n\n return get_unspecific_days\n\n end", "title": "" }, { "docid": "acc324367e412ee95c4d75277208ce94", "score": "0.59957457", "text": "def holiday_available(staff)\n\t\t@staff = staff\n\t\t@used_days = 0\n\t\t@remaining = 0\n\t\t@allowance = current_holiday_entitlement_id(@staff).try(:holiday_days)\n\t\tused = Holiday.joins('LEFT OUTER JOIN leave_types ON holidays.leave_type_id = leave_types.id').select('distinct leave_types.title, leave_types.paid, holidays.start_date, holidays.end_date').where(\"holidays.staff_id = ? AND holidays.start_date >= ? AND holidays.end_date <= ? AND leave_types.paid = ?\", @staff.id, current_holiday_entitlement_id(@staff).holiday_year_start, current_holiday_entitlement_id(@staff).holiday_year_end, true)\n\t\tused.each do |h|\n\t\t\tdate1 = Date.parse(h.start_date.strftime(\"%Y-%m-%d\"))\n\t\t\tdate2 = Date.parse(h.end_date.strftime(\"%Y-%m-%d\"))\n\t\t\t@used_days = @used_days + date1.business_days_until(date2).to_i\n\t\tend\n\t\t@remaining = @allowance - @used_days\n\t\t@remaining\t\t\n\tend", "title": "" }, { "docid": "6fe3f136bdc16ac553c515ee5c3be826", "score": "0.5977684", "text": "def days\n self.to_i * 86_400\n end", "title": "" }, { "docid": "c5a689fac6e0625eedcfd170a87a7fc2", "score": "0.597293", "text": "def lead_days\n 0\n end", "title": "" }, { "docid": "5c841cf26c6e3bd51fcdbe1d71e75192", "score": "0.5949278", "text": "def list_days(start_on=start_date,end_on=end_date,show_empty=false,show_ids=false)\n (parse_date_param(start_on)..parse_date_param(end_on)).to_a.map { |_date|\n format_events_for(_date,show_empty,show_ids)\n }.compact\n end", "title": "" }, { "docid": "e4ec63cdb29e7cb86b7b37119f882de5", "score": "0.5922744", "text": "def index\n @days = current_user.days.paginate(page: params[:page], per_page: 7)\n end", "title": "" }, { "docid": "31f6f043f574c2a830174c8049116370", "score": "0.5901684", "text": "def weekdays\n Weekdays.new(self)\n end", "title": "" }, { "docid": "ea724d78ea2c9c790d8784b60ebda1dc", "score": "0.5888805", "text": "def days(n)\n n * 3600 * 24\nend", "title": "" }, { "docid": "6281852fd68ea21fc9169c0c190d6411", "score": "0.58884144", "text": "def day\n end", "title": "" }, { "docid": "01e1ce91ee99772e5f132829d343ad7a", "score": "0.5854339", "text": "def day() end", "title": "" }, { "docid": "51e22bf8654143ae8991f000dcc2bb31", "score": "0.58340776", "text": "def check_rest_days\n\n\t\temp=Employee.find(employee_id)\n\t\tcalendar=Calendar.where(:department_id => emp.department_id,:anio => Date.parse(desde.to_s).year.to_i).first\n if !calendar.nil?\n\n \t\tdias_requested=weekdays_in_date_range(desde..hasta,calendar)\n \t\trt=RequestType.find(request_type_id)\n \t\tdias=0\n \t\t#get all requests from employee\n requests=Request.joins(:request_type).where(:employee_id => employee_id,status: [1,2],:request_type_id => request_type_id).where('extract(year from desde)= ?',\"#{desde.year.to_i}\")\n\n \t #working days requested.\n \t requests.each do |rq| \n \t dias+=weekdays_in_date_range(rq.desde..rq.hasta,calendar)\n \t end\n\n \t #get rest days\n \t num_dias_max=Request.rest_days(desde.year.to_i,employee_id,rt.num_dias_max)\n\n \t if dias_requested>(num_dias_max-dias)\n \t errors.add(:desde,\"Debe seleccionar un periodo igual o inferior a los días restantes. (#{(num_dias_max-dias)} dias)\")\n \t end\n end\n\tend", "title": "" }, { "docid": "7ed6cb75c64053749b3a4eab24e74fa5", "score": "0.5812486", "text": "def getHolidays(locationId, from, to)\n\t\tholidays = Array.new\n\t\tunless isScheduleOnWeekEnd\n\t\t\tholidays = WkPublicHoliday.where(:location_id => locationId, :holiday_date => from .. to).pluck(:holiday_date)\n\t\tend\n\t\tholidays\n\tend", "title": "" }, { "docid": "b62b306de8e52bbc22777be5b1c1f5ca", "score": "0.58111477", "text": "def days\n\t\treturn self * 24.hours\n\tend", "title": "" }, { "docid": "b62b306de8e52bbc22777be5b1c1f5ca", "score": "0.58111477", "text": "def days\n\t\treturn self * 24.hours\n\tend", "title": "" }, { "docid": "66f6f4e5684544763b5de2c8bd8abe17", "score": "0.5798305", "text": "def set_days_of_the_week\n days_of_the_week = DaysOfTheWeek.find(params[:id])\n end", "title": "" }, { "docid": "b59aaa3315c0be3132be7c43f6dafed3", "score": "0.57867134", "text": "def cwday\n end", "title": "" }, { "docid": "f67a4b9e2874c8f9a0570fb89ecc7db3", "score": "0.5775565", "text": "def day\n self.range('day')\n end", "title": "" }, { "docid": "75994e35310a9b303aa9960759190077", "score": "0.57647115", "text": "def dates\n end", "title": "" }, { "docid": "63b2a3a1f3e0b25099a9fde2a6ad7bf5", "score": "0.5759652", "text": "def days(qtdDays)\n \n days = Array.new\n \n urlPadrao = \"http://servicos.cptec.inpe.br/XML/cidade/7dias/#{@codCity}/previsao.xml\"\n \n urlEstendida = \"http://servicos.cptec.inpe.br/XML/cidade/#{@codCity}/estendida.xml\"\n \n loadDays(urlPadrao,days,qtdDays)\n \n if(qtdDays > 4)\n \n loadDays(urlEstendida,days,qtdDays)\n \n end\n \n days\n \n end", "title": "" }, { "docid": "bf2a01176e1a819c91f371ed58d0914b", "score": "0.57593274", "text": "def days\n @days ||= months.map(&:days).flatten\n end", "title": "" }, { "docid": "0bb5355f7d9529766f213b1a05800116", "score": "0.5753667", "text": "def lunch(day)\n\nend", "title": "" }, { "docid": "f18287337c887c4f1fa4cb30b902c261", "score": "0.57465255", "text": "def method_missing(symbol, *args, &block)\n if @days.methods.include? symbol.to_s\n @days.send(symbol, *args, &block)\n else\n super\n end\n end", "title": "" }, { "docid": "57b4934fb9b80fac4f4e99b05d2177b6", "score": "0.5731704", "text": "def addDays(date)\n\n #puts 'in addDays'\n #puts date\n if date.saturday? then\n #puts \"sat\"\n date1 = date.next_day(7)\n return date1\n elsif date.sunday? then\n #puts \"sun\"\n date1 = date.next_day(8)\n return date1\n else\n #puts 'other'\n date1 = date.next_day(7)\n end\n return date1\n end", "title": "" }, { "docid": "2aa994e536527d2aa5b37733a3140902", "score": "0.57154924", "text": "def get_not_worked_days start_date, end_date, employee_id\n not_worked_days = []\n if start_date != \"\" && end_date != \"\"\n start_date = DateTime.parse(start_date)\n end_date = DateTime.parse(end_date)\n for i in 0..get_difference_days(start_date, end_date) + 1\n current_date = start_date + i.days\n if !is_weekend?(current_date) && didnt_come_to_work?(employee_id, current_date)\n not_worked_days << current_date\n end\n end\n end\n return not_worked_days\n end", "title": "" }, { "docid": "2bf0a3ebff98405e1aa39aaab8c93ec6", "score": "0.57132965", "text": "def yday\n end", "title": "" }, { "docid": "1250f589e658a716b984ef86fa1bf8da", "score": "0.56868714", "text": "def select_days\n days_menu = []\n days_selected = []\n select_days_menu(days_menu)\n select_days_selection(days_selected, days_menu)\n return days_selected\n end", "title": "" }, { "docid": "9e6c58299a941bbeb70b24584a244726", "score": "0.56838983", "text": "def network_days()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::NetworkDays::NetworkDaysRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "55d74fa6ac6d00699d35796ffd0ced70", "score": "0.5673429", "text": "def get_national_holidays\n national_holidays = Event.all.select { |event| event.event_type == \"National Holiday\"}\n return national_holidays \n end", "title": "" }, { "docid": "57f15538c2e6f02d986c89dcdd60f109", "score": "0.5645415", "text": "def coup_days()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::CoupDays::CoupDaysRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "4da536270a7646200a51a46fe6890890", "score": "0.5641765", "text": "def workdays(calendar = Spok.default_calendar)\n (@start_date..@end_date).to_a.delete_if{ |date| Workday.restday?(date, calendar: calendar) }\n end", "title": "" }, { "docid": "2536153e6176dce890ad597e437b5f2f", "score": "0.5629793", "text": "def days; self * DAY; end", "title": "" }, { "docid": "2536153e6176dce890ad597e437b5f2f", "score": "0.5629793", "text": "def days; self * DAY; end", "title": "" }, { "docid": "3f762562c85f572e0a3e49be25d73c16", "score": "0.5612332", "text": "def days() 24 * hours end", "title": "" }, { "docid": "091670870cbd4db3fc96e38016eba830", "score": "0.56012934", "text": "def get_days\n\t\tbool_array = []\n\n\t\tbool_array << self[:monday]\n\t\tbool_array << self[:tuesday]\n\t\tbool_array << self[:wednesday]\n\t\tbool_array << self[:thursday]\n\t\tbool_array << self[:friday]\n\t\tbool_array << self[:saturday]\n\t\tbool_array << self[:sunday]\n\n\t\treturn bool_array\n\tend", "title": "" }, { "docid": "60d7126e05094d32557fc58d52010070", "score": "0.55965924", "text": "def dayOfWeek\n days = 0;\n tempYear = MIN_YEAR\n while tempYear < @year\n days += SimpleDate.daysInYear(tempYear).to_i\n tempYear+=1\n end\n\n days = days + ordinalDate\n #puts \"days #{days}\"\n days = days % 7\n\n end", "title": "" }, { "docid": "cdc2f8bc7d8732b2e744ef00e82d57b3", "score": "0.5594889", "text": "def getDatesToDisplay()\n\n\t\tnumDays = 10\n\t\tretDays = []\n\n\t\tfor i in 0..10\n\t\t\ta_date = (DateTime.now + i.days)\n\t\t\tretDays.push(a_date)\n\t\tend\n\n\t\treturn retDays\n\tend", "title": "" }, { "docid": "c21ad8a4f9b6a1d14b15d41357b5f8d7", "score": "0.55948114", "text": "def getSundays(d1,d2)\n d1 += 1 while (d1.wday != 0) # add days till starting on sunday\n sundays = []\n d1.step(d2,7) do |date| # move forward seven days for every sunday\n sundays .push date\n end\n sundays\nend", "title": "" }, { "docid": "d0d7fb9e6e1f055cb613de1efd2b7a5e", "score": "0.558633", "text": "def days_until_xmas(date)\n return 0\nend", "title": "" }, { "docid": "64ca1f2f7b839b45133075816a7303df", "score": "0.5585151", "text": "def network_days_intl()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::NetworkDays_Intl::NetworkDaysIntlRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "bf6d21e674e98641d4866f8802eedd45", "score": "0.5582492", "text": "def index\n @user_days = UserDay.all\n end", "title": "" }, { "docid": "dec39da78a820d45a53d390e3dabc889", "score": "0.5578989", "text": "def calc_days_till\n (calc_hours_till / 24.00).round(2)\n end", "title": "" }, { "docid": "08d287fc30f80231f7155dcbf43b4d76", "score": "0.5572946", "text": "def day; end", "title": "" }, { "docid": "6c988452ae3f4bd0df5ebbc711a5dd0b", "score": "0.55722547", "text": "def list_days\n puts \"This Week's Forecast:\"\n\n Scraper.scrape_cast \n\n days = Project1::Forecast.all\n days.map.with_index(1) do |day, i|\n puts \"#{i}. #{day.name}\"\n end\n end", "title": "" }, { "docid": "c578e96af6eb0af39b8d03ed74e450e1", "score": "0.5567528", "text": "def calorie_sum_by_day\n\n end", "title": "" }, { "docid": "cbed8ac1ecdb242a7ec74c37da0a3b7b", "score": "0.55673873", "text": "def days_validation\n @start_cycle = @vote_setting.start_cycle.to_date \n @end_cycle = @vote_setting.end_cycle.to_date\n @days_count = (@end_cycle - @start_cycle).round\n end", "title": "" }, { "docid": "1855b7e9144eb326a6b4bc908d896b5f", "score": "0.55618924", "text": "def get_days_with_fare(outbound=true)\n page = get_page(outbound)\n\n parse_page(page, find_cheap=true).merge(parse_page(page, find_cheap=false))\n end", "title": "" }, { "docid": "db1f7ac836b90037bce6e1ba6605a1ca", "score": "0.5549165", "text": "def index\n @day_of_week = event_days\n end", "title": "" }, { "docid": "88073966d10f1c9d7c9db625bbd07bed", "score": "0.5548418", "text": "def days\n 1 + (@end_date - @start_date).to_i\n end", "title": "" }, { "docid": "33f78f7b81a0d43380247b3d11da8ba3", "score": "0.55483794", "text": "def list(params={})\n date_str = params[:date_str]\n user_cats = Aurita.user.categories.map { |c| c.category_id }\n date_str = param(:day) unless date_str\n date = Date.civil(date_str[0..3].to_i, \n date_str[5..6].to_i, \n date_str[8..9].to_i)\n\n plugin_get(Hook.calendar.event.list_day, :date => date)\n end", "title": "" }, { "docid": "b613592e82de56810c7d0f2cc971edab", "score": "0.55426514", "text": "def get_days(date)\n return [date.day] if date.month == date.next.month\n date.day.upto(date.day + 3).to_a\n end", "title": "" }, { "docid": "099df7e04be6544af61c55fc7eabd6e6", "score": "0.55413955", "text": "def dates\n dates_query.all\n end", "title": "" }, { "docid": "247fa2300b248e0f5d17156429bfebe8", "score": "0.5538199", "text": "def index\n @holidays = Holiday.all.where(\"day > ?\", Time.now).order(:day)\n end", "title": "" }, { "docid": "6a48ede2ca587de8f017064480a3c666", "score": "0.5537673", "text": "def chart_days\n daily_requests = self.daily_requests.limit(10)\n days = daily_requests.map(&:created_at)\n days.map { |d| d.strftime(\"%b %e\") }\n end", "title": "" }, { "docid": "6722f140e79f5533aea1e2a5e28abd50", "score": "0.55360484", "text": "def business_hours_on_day(date, in_time_zone)\n # puts \"in time zone #{in_time_zone}\"\n date = date.in_time_zone(in_time_zone)\n weekends = [6,7]\n if weekends.include?(date.to_date.cwday)\n return [0,0]\n end\n holidays = find_holidays_on_date(date, in_time_zone)\n if holidays.empty?\n default_business_hours\n else\n # puts \"default_business_hours: \" + default_business_hours.inspect\n start_time, end_time = default_business_hours\n effective_start = start_time\n effective_end = end_time\n holidays.each do |holiday_start, holiday_end|\n # puts \"holiday_start: #{holiday_start}\"\n # puts \"holiday_end: #{holiday_end}\"\n \n if holiday_start.to_date < date.to_date\n holiday_start = date.to_date.beginning_of_day\n end\n if holiday_end.to_date > date.to_date\n holiday_end = date.to_date.end_of_day\n end\n \n # puts \"determined holiday_start: #{holiday_start}\"\n # puts \"determined holiday_end: #{holiday_end}\" \n\n # puts \"business begins: #{date.beginning_of_day + start_time}\"\n # puts \"business ends: #{date.beginning_of_day + end_time}\"\n \n #if holiday starts before business and ends after business, return 0\n if holiday_start <= (date.beginning_of_day + start_time) && holiday_end >= (date.beginning_of_day + end_time)\n return [0,0]\n end\n #if holiday starts before business then set business day to start effectively when the holiday ends\n if holiday_start <= (date.beginning_of_day + start_time)\n # puts \"holiday starts before business then set business day to start effectively when the holiday ends\"\n # puts \"holiday_end:\" + holiday_end.inspect\n # puts \"holiday_end.beginning_of_day:\" + holiday_end.beginning_of_day.inspect\n \n seconds_for_holiday_end = seconds_from_day_start(holiday_end)\n if seconds_for_holiday_end > effective_start\n effective_start = seconds_for_holiday_end\n end\n end\n #if holiday ends after business then set business day to end effectively when the holiday start\n if holiday_end >= (date.beginning_of_day + end_time)\n # puts \"holiday ends after business then set business day to end effectively when the holiday start\"\n # puts \"holiday_start:\" + holiday_start.inspect\n # puts \"holiday_start.beginning_of_day:\" + holiday_start.beginning_of_day.inspect\n \n seconds_for_holiday_start = seconds_from_day_start(holiday_start)\n if seconds_for_holiday_start < effective_end\n effective_end = seconds_for_holiday_start\n end\n end\n end\n if effective_start > effective_end\n effective_start = effective_end\n end\n # puts \"effective start and end \" + [effective_start.to_i, effective_end.to_i].inspect\n [effective_start.to_i, effective_end.to_i]\n end\n end", "title": "" }, { "docid": "83bb17df07ce2096256fe77a97be0676", "score": "0.5533704", "text": "def makeDays\n\t\thowManyDaysAgo = (rand()*CONFERENCE_START).round(0)+18\n\t\tlengthDays = (rand()*CONFERENCE_DAYS_MAX_DIFF).round() + CONFERENCE_DAYS_BASIC\n\t\t@startDate = (Date.today-howManyDaysAgo)\n\t\t@endDate = (Date.today-howManyDaysAgo+lengthDays)\n\t\t# That's the end of fields you want to print\t\n\t\t@days = Array.new\n\t\t(howManyDaysAgo-lengthDays..howManyDaysAgo).each{|x| @days << (CDay.new((Date.today-x), self))\t}\n\t\t@days.reverse! # If we want them in correct order\n\t\t# Discounts, some weird stuff may happen here, like functional programming\n\t\t@discounts = Array.new\n\t\tdays = DISCOUNT_DAYS.map{|x| x+((rand()-0.5)*DISCOUNT_DAYS_MAX_DIFF).round(0)}\n\t\tammounts = DISCOUNT_AMMOUNTS.map{|x| x+((rand()-0.5)*DISCOUNT_AMMOUNTS_MAX_DIFF).round(2)}\n\t\t(0..2).each{|x| @discounts << Discount.new(((@startDate)-days[x].to_i-1), ((@startDate)-days[x+1].to_i), self, ammounts[x])}\n\tend", "title": "" }, { "docid": "1e96b824796b19ed5be3c2d17815e4e7", "score": "0.55301905", "text": "def calculate(from_date, to_date)\n calendar_days_between(from_date, to_date)\n end", "title": "" }, { "docid": "0d2e2f3c35342623660ecb5d5c171a1d", "score": "0.55175877", "text": "def create_calendar_dates(interval, ed_org_id)\n calendar_dates = []\n begin_date = interval.get_begin_date\n end_date = interval.get_end_date\n holidays = interval.get_holidays\n (begin_date..end_date).step(1) do |date|\n if DataUtility.rand_float_to_int(@prng, @scenarioYAML['HACK_PERCENTAGE_CALENDAR_DATES'] || 1) > 0\n if holidays.include?(date)\n calendar_dates << {\"date\" => date, \"event\" => :HOLIDAY, \"ed_org_id\" => ed_org_id}\n else\n calendar_dates << {\"date\" => date, \"event\" => :INSTRUCTIONAL_DAY, \"ed_org_id\" => ed_org_id} if date.wday != 0 and date.wday != 6\n end\n end\n end\n calendar_dates\n end", "title": "" }, { "docid": "9389050694f00ca6478961fa4bd9e3d6", "score": "0.55064183", "text": "def day \n\t\t(self.check_out - self.check_in).to_i\n\tend", "title": "" }, { "docid": "574d7ea56d6f5bc13715b197b29300f1", "score": "0.550326", "text": "def get_work_days\n puts \"Getting work days...\"\n work_days = []\n biweek = get_biweek\n week_1 = @schedule[biweek[0]].compact.uniq\n week_2 = @schedule[biweek[1]].compact.uniq\n\n @schedule.each_with_index do |row, i|\n DAYS.each_with_index do |day, j|\n date = ( i < biweek[1] ? week_1[j] : week_2[j] )\n day_name = day[:day]\n name = row[day[:name]]\n hours = row[day[:hours]]\n if name && hours && name.downcase.include?(@person.downcase)\n work_days.push({\n :name => @person,\n :date => get_date(date, hours)\n })\n end\n end\n end\n puts \"Work days:\\n#{work_days}\"\n return work_days\nend", "title": "" }, { "docid": "5e4794ef1b1e6c1444cce29453e7727d", "score": "0.54937774", "text": "def index\n #@event_days = EventDay.all\n @event_days = Event.find(params[:event_id]).event_days\n end", "title": "" }, { "docid": "2255251c163d72e162b29b5a2deb8f89", "score": "0.5486652", "text": "def event_days\n time_span / (24 * 60 * 60)\n end", "title": "" }, { "docid": "f64b22bc2581a46d99c43cebde3fd1bd", "score": "0.54799527", "text": "def days(value)\n merge(pvipdays: value.to_s)\n end", "title": "" }, { "docid": "878d8bda66cc6c315c03d3f0dbb7f04a", "score": "0.5466191", "text": "def days\n return \"There are #{self * (24 * 60 * 60)} seconds in #{self} days\"\n end", "title": "" }, { "docid": "87dbe01679594235d1d7e48cf2de9107", "score": "0.54377246", "text": "def get_public_holidays( year )\n PublicHoliday.factory( @localization ).all( year ) \n end", "title": "" }, { "docid": "282f45957ab804eeb106527b44c724f8", "score": "0.5433759", "text": "def all_day\n beginning_of_day..end_of_day\n end", "title": "" }, { "docid": "c9fc620043e3d173a27a40d992a726b2", "score": "0.5430415", "text": "def working_days_from_date(date)\r\n date = date + 1.day if date.cwday == 6\r\n day_of_the_week = date.cwday == 7 ? 0 : date.cwday\r\n calendar_days, business_days = self, self\r\n result_date = day_of_the_week + business_days\r\n if (result_date >= 6)\r\n business_days -= (6 - day_of_the_week)\r\n calendar_days += 2\r\n weeks = business_days / 5\r\n calendar_days += (weeks * 2)\r\n end\r\n date + calendar_days.days\r\n end", "title": "" }, { "docid": "fef287697b790b0a81790342d44e4b41", "score": "0.54221195", "text": "def birthdaysearch\n end", "title": "" }, { "docid": "68fd3d40f62eb541380f832e1ba41d58", "score": "0.54211134", "text": "def working_days_count(from_date, to_date, include_sat = false, include_sun = false, include_bank_holidays = false)\r\n\t\t \tdates_interval = (from_date..to_date).to_a\r\n\r\n\t\t\t\tuser_region = LeavesHolidaysLogic.user_params(self, :region)\r\n\r\n\t\t\t\tif !include_bank_holidays\r\n\t\t\t\t\tbank_holidays_list = Holidays.between(from_date, to_date, user_region.to_sym, :observed).map{|k| k[:date]}\r\n\t\t\t\t\tdates_interval -= bank_holidays_list\r\n\t\t\t\tend\r\n\r\n \t\t\tdates_interval.delete_if {|i| i.wday == 6 && !include_sat || #delete date from array if day of week is a saturday (6)\r\n \t\t\t i.wday == 0 && !include_sun } #delete date from array if day of week is a sunday (0)\r\n\r\n \t\treturn dates_interval.count\r\n\t\t\tend", "title": "" }, { "docid": "9d1035c733f880f828f89d46c0530d23", "score": "0.54117423", "text": "def days ; Duration[self * 86400] ; end", "title": "" }, { "docid": "ecfea8a3878a507f833afccb84d52430", "score": "0.54107946", "text": "def day()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Day::DayRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "5d3f6e53321767362dac82dfa0abc4b1", "score": "0.54097176", "text": "def visa_date_overstay_days\n return nil unless exit_date\n return 0 unless visa_date_overstay?\n visa = schengen_visa\n return no_days unless visa\n exit_date <= visa.end_date ? 0 : exit_date - visa.end_date\n end", "title": "" }, { "docid": "05e6d4770ffdb8a765187e31df78bdb0", "score": "0.5406495", "text": "def events_seven_days()\n events = []\n today = Date.today\n for i in 0..6 do\n events += events_by_date(today + i)\n end\n return events\nend", "title": "" }, { "docid": "988f77ddb7c91fa0572b5cbf64eccbeb", "score": "0.5401745", "text": "def day\n set_function_and_argument(:day, nil)\n end", "title": "" }, { "docid": "635eaecdea999d195f6a5d58dc77ad68", "score": "0.53885657", "text": "def hours_to_days(hours)\n hours / 24\nend", "title": "" }, { "docid": "4572792574900e11b76fa694a536e719", "score": "0.5375515", "text": "def index\n @days = Day.all\n end", "title": "" }, { "docid": "dea08b8e433087e7268eeba0746496e3", "score": "0.5368789", "text": "def days\n\t\tif self.date.past?\n\t\t\t'Past'\n\t\telse\n\t\t\t((self.date - Date.today).to_i).to_s + ' Days'\n\t\tend\n\tend", "title": "" }, { "docid": "1f188794535baaeb18f3c4dc49ee0c68", "score": "0.5368763", "text": "def w_day; end", "title": "" } ]
00d01f2cd02289e46e262557ec47a8a2
def has_access(project) return is_admin || is_proj_mem(project) end def is_proj_mem(project) return current_user.project_id == project.id end
[ { "docid": "a18856659173725f17504d7a211b1c26", "score": "0.6886284", "text": "def redirect_if_no_access\r\n @project = Project.find(params[:id]) if params[:id] != nil\r\n # if !has_access(@project)\r\n # dev_redirect\r\n # end\r\n dev_redirect unless (is_admin || ( params[:id] != nil && @project.id == current_user.project_id))\r\n end", "title": "" } ]
[ { "docid": "17c7ab9e533944d9c6dee63bddbdbcce", "score": "0.82293075", "text": "def can_manage_project(project)\n @project = project\n @project.user_id == self.id ? true : false\n end", "title": "" }, { "docid": "1a9880b015e0ed7a010db30cb98441af", "score": "0.80246", "text": "def check_project_privacy\r\n unless @project.active?\r\n @project = nil\r\n render_404\r\n return false\r\n end\r\n return true if @project.is_public?\r\n return false unless logged_in_user\r\n return true if logged_in_user.admin? || logged_in_user_membership\r\n render_403\r\n false\r\n end", "title": "" }, { "docid": "b3caa7008befb53fba0e4594ceff43eb", "score": "0.8015658", "text": "def can_access_project?\n developer = Developer.where(gamer_id: current_gamer.id).first\n owned = Project.where(owner_id: developer.id)\n shared = developer.projects_shared\n current_project = Project.find(params[:project_id])\n if !owned.include?(current_project) && !shared.include?(current_project)\n flash[:error] = t(:developer_cant_see_project)\n redirect_to projects_path, flash: flash\n end \n end", "title": "" }, { "docid": "1c6c4d4d22bf4d524d518918f7b71b16", "score": "0.7960135", "text": "def check_project_privacy\n unless @project.active?\n @project = nil\n render_404\n return false\n end\n return true if @project.is_public?\n return false unless logged_in_user\n return true if logged_in_user.admin? || logged_in_user_membership\n render_403\n false\n end", "title": "" }, { "docid": "a2a12101322e6c8b89500300a6afdb25", "score": "0.79090387", "text": "def project_admin?\n member_projects = current_member.projects.where(id: current_project_id)\n return false if member_projects.empty?\n current_member.id == member_projects.first.admin_id\n end", "title": "" }, { "docid": "cd854f4b2fb1be6f1d073be55c199603", "score": "0.7906543", "text": "def can_read? _project\n return true if Setting.admin_users.include? self.login\n\n _m = find_memberships_by_project _project\n return false if _m.blank?\n !_m.find{|x| x.repository_read_role?(self)}.blank?\n end", "title": "" }, { "docid": "f16f4af318593c73083e8b92930d5314", "score": "0.7876161", "text": "def current_user_can_edit_public_project?(p = @project)\n logged_in? && current_user.projects_editable_on_public_site.include?(p)\n end", "title": "" }, { "docid": "3b36e93aa486a3b0c147e3cf5c898700", "score": "0.78636354", "text": "def have_permission?(project, user)\n member = space_memberships.find_by(user: user)\n project.present? && member.lead_or_admin_or_contributor?\n end", "title": "" }, { "docid": "44c5d4da57dcea3fe8a66be81b84ae88", "score": "0.78313184", "text": "def check_project_privacy\n if @project && !@project.archived?\n if @project.visible?\n true\n else\n deny_access\n end\n else\n @project = nil\n render_404\n false\n end\n end", "title": "" }, { "docid": "2775cbec39332fc096db49539ef787a1", "score": "0.78209335", "text": "def is_admin_or_project_admin?\n is_admin? || ProjectMembershipsService.is_user_an_admin_of_project?(object.id, scope.id)\n end", "title": "" }, { "docid": "bfbb9d238f90ad5b74cd32b0d59da6a6", "score": "0.780079", "text": "def check_acess(project, user)\n return true unless project.private\n ProjectMember.member? project, user\n end", "title": "" }, { "docid": "436e48aed62d649e47c9060b5d3e350e", "score": "0.777412", "text": "def user_has_project_access?(record)\n subject_rule_project_id = record.subject_rule.workflow.project_id\n credential.project_ids.include?(subject_rule_project_id)\n end", "title": "" }, { "docid": "516f62df8dcd53ec716937da92abe601", "score": "0.77671266", "text": "def check_project_privacy\n unless @project.active?\n @project = nil\n render_404\n return false\n end\n return true if @project.is_public? || User.current.member_of?(@project) || User.current.admin?\n User.current.logged? ? render_403 : require_login\n end", "title": "" }, { "docid": "363d3d8d789cec8b5ac796242b7ae974", "score": "0.7751971", "text": "def is_admin_on?(project)\n user_projects.filter { |up| up.project_id == project.id }.first&.role == UserProject::ADMIN_ROLE\n end", "title": "" }, { "docid": "011249ea9fd71c19eab4214757d2285b", "score": "0.77360654", "text": "def can_write? _project\n return true if Setting.admin_users.include? self.login\n _m = find_memberships_by_project _project\n return false if _m.blank?\n !_m.find{|x| x.repository_write_role?(self)}.blank?\n end", "title": "" }, { "docid": "344ef904387ba57ff453cd7904727f7d", "score": "0.77320045", "text": "def can_view_project?(project)\n is_part_of_project?(project)\n end", "title": "" }, { "docid": "344ef904387ba57ff453cd7904727f7d", "score": "0.77320045", "text": "def can_view_project?(project)\n is_part_of_project?(project)\n end", "title": "" }, { "docid": "6c601c1b9aa013f46d458755166da21e", "score": "0.7697475", "text": "def can_read?(project)\n return true if Setting.admin_users.include? self.username\n has_permission_value(project, 20)\n end", "title": "" }, { "docid": "39872b9311bdd73124adf5ab2c36722a", "score": "0.76900065", "text": "def may_access?\n\t\tret=!self.role.nil? && !self.group.nil? && !self.project.nil?\n\t\t#puts \"User.may_access?:#{ret}\"\n\t\tret\n\tend", "title": "" }, { "docid": "83bb9cee0de701f2ce2690f027b20d7d", "score": "0.76739454", "text": "def grant_access project\n \n if !self.projects.include? project\n self.projects << project\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "d373931158b98af39efe5875963a49b6", "score": "0.7671944", "text": "def is_admin_or_project_team_admin?\n return true if is_admin?\n return false if object.project.blank?\n ProjectMembershipsService.is_user_an_admin_of_project?(object.project.id, scope.id)\n end", "title": "" }, { "docid": "fc59b168f2a0c7ce1dac735fa02cec3f", "score": "0.76264024", "text": "def can_view\n render json: { errors: ['No privileges.'] }, status: :unauthorized unless @current_user.projects.include?(@project)\n end", "title": "" }, { "docid": "85aa9d844eaecdcbf7518c02fb544a60", "score": "0.7624967", "text": "def can_access?(project_id)\n # find_by_id returns nil (~false) if there is no such project within the clients projects\n self.class != Contact || self.client.projects.where(:id => project_id).exists?\n end", "title": "" }, { "docid": "0a79a81be7f29ed69320361aa3110271", "score": "0.75655085", "text": "def is_project_administrator?\n sessions_signed_in? && sessions_project_selected? &&\n sessions_current_project.project_members.exists?(is_project_administrator: true, user_id: sessions_current_user_id)\n end", "title": "" }, { "docid": "f1699a626eec311275c74d3643947438", "score": "0.75223434", "text": "def can_manage?(user = User.current_user)\n return false unless user\n person = user.person\n return false unless person\n is_proj_or_prog_admin = person.is_project_administrator_of_any_project? || person.is_programme_administrator_of_any_programme?\n user.is_admin? || (is_proj_or_prog_admin && (is_admin? || self != person))\n end", "title": "" }, { "docid": "d5b6078dbb991aa25ac96b17c8d8857f", "score": "0.75173336", "text": "def edit?\n if credential.admin?\n true\n else\n user_has_project_access?(record)\n end\n end", "title": "" }, { "docid": "4ac3e2068b7dbcbb36f91d6b5efcc180", "score": "0.7516948", "text": "def visible?(user=User.current)\n user.allowed_to?(:view_project, self)\n end", "title": "" }, { "docid": "3ca50832104223628e340a13ba89cc8e", "score": "0.74970067", "text": "def can_write?(project)\n return true if Setting.admin_users.include? self.username\n has_permission_value(project, 30)\n end", "title": "" }, { "docid": "1d3c8dd53f3b67dd8b77c8969c6742df", "score": "0.74863094", "text": "def visible?\n record.public || admin? || user && user.is_project_member?(record)\n end", "title": "" }, { "docid": "1d3c8dd53f3b67dd8b77c8969c6742df", "score": "0.74863094", "text": "def visible?\n record.public || admin? || user && user.is_project_member?(record)\n end", "title": "" }, { "docid": "d44cc7ec54f650d4aaa0f494acba191f", "score": "0.74783695", "text": "def has_access_to_active_projects?\n self.security_settings.inject(0){|sum, ss| sum += 1 if ss.level > 0} > 0\n end", "title": "" }, { "docid": "0b59dbbd16d0274a54c8655d1962c677", "score": "0.74613", "text": "def setup_project_not_protected\n @project = Project.find(params[:project_id]) rescue nil\n @can_edit_project = false\n @can_edit_project = @project.can_edit?(current_user) if @project\n end", "title": "" }, { "docid": "ecdb5b079816941b6faf18f882f453c0", "score": "0.74300236", "text": "def own_projects?(user_id)\n #self.users.find \n projects = find_by(:owner => user_id) \n projects && projects.size > 0\n end", "title": "" }, { "docid": "4881e1e8757d8b65afb6d0de7c21b68c", "score": "0.7426799", "text": "def is_project_administered_by?(person)\n person.is_project_administrator?(projects)\n end", "title": "" }, { "docid": "f9d08b00bb8635ff78b1239ee28b0710", "score": "0.7382877", "text": "def user_is_member\n project = Project.find(params[:project_id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this project\"\n redirect_to projects_path, notice: 'You are not a member of this project' # halts request cycle\n end\n end", "title": "" }, { "docid": "f9d08b00bb8635ff78b1239ee28b0710", "score": "0.7382877", "text": "def user_is_member\n project = Project.find(params[:project_id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this project\"\n redirect_to projects_path, notice: 'You are not a member of this project' # halts request cycle\n end\n end", "title": "" }, { "docid": "f9d08b00bb8635ff78b1239ee28b0710", "score": "0.7382877", "text": "def user_is_member\n project = Project.find(params[:project_id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this project\"\n redirect_to projects_path, notice: 'You are not a member of this project' # halts request cycle\n end\n end", "title": "" }, { "docid": "f9d08b00bb8635ff78b1239ee28b0710", "score": "0.7382877", "text": "def user_is_member\n project = Project.find(params[:project_id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this project\"\n redirect_to projects_path, notice: 'You are not a member of this project' # halts request cycle\n end\n end", "title": "" }, { "docid": "d20229bd06e8d76f2a7ede9660df2c5c", "score": "0.7353004", "text": "def ensure_project_access(id = nil)\n u = session[:user_id] && current_user\n id ||= params[:project_id] || params[:id]\n if !u || !u.can_access?(id)\n flash[:notice] = I18n.t('general.access_denied')\n redirect_to root_url\n false\n else\n true\n end\n end", "title": "" }, { "docid": "feafe9cb519f909c7a41c9ea07458f6d", "score": "0.7351697", "text": "def can_associate_projects?(user = User.current_user)\n can_manage?(user) || allows_user_projects?\n end", "title": "" }, { "docid": "ef8be41b44a610d4f9b1bf3808707544", "score": "0.73302394", "text": "def member_of?(project)\n projects.to_a.include?(project)\n end", "title": "" }, { "docid": "41f0f3f6ed764c045cc22593f48c6716", "score": "0.7327016", "text": "def if_project_admin(project)\n if logged_in?\n member = project.members.find_by_user_id(session[:user_id])\n if member and (member.member_role.role == \"creator\" or member.member_role.role = \"administrator\")\n yield if block_given?\n return\n end\n end\n end", "title": "" }, { "docid": "3f790f931c7894d19c4ac07a2c9fb3c0", "score": "0.7326169", "text": "def can_access?(client)\n return false if client.projects.empty?\n client.projects.each do |p|\n if self.projects.include?(p)\n return true\n else\n false\n end\n end\n end", "title": "" }, { "docid": "ad3cce110aae25da858b2947bab7240e", "score": "0.7310602", "text": "def project_allowed(project)\n Chef::Cache::KNOWN_PROJECTS.include? project\n end", "title": "" }, { "docid": "0be9c89e3c04df8137ca7e41a6e77b61", "score": "0.72990596", "text": "def pm_authorized?\n role = session[:user].role\n\n user_authorized? && (role == 'project_manager' || role == 'admin')\n end", "title": "" }, { "docid": "82feb78a88803690a86e3578d9998967", "score": "0.7283805", "text": "def has_developer_access?(project_gitlab_id)\n data = project_info(project_gitlab_id)\n\n return false unless data && data[\"permissions\"]\n\n permissions = data[\"permissions\"]\n\n if permissions[\"project_access\"] && permissions[\"project_access\"][\"access_level\"] >= DEVELOPER_ACCESS\n return true\n end\n\n if permissions[\"group_access\"] && permissions[\"group_access\"][\"access_level\"] >= DEVELOPER_ACCESS\n return true\n end\n end", "title": "" }, { "docid": "512b6e1fe94cb2cc9bf674824e28e58b", "score": "0.72755224", "text": "def user_is_member\n project = Project.find(params[:id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this project\"\n redirect_to projects_path, notice: 'You are not a member of this project' # halts request cycle\n end\n end", "title": "" }, { "docid": "66eba671150f09a54cfac4c85e39373a", "score": "0.7258736", "text": "def has_edit_project_right?\n Rails.logger.info \"--> filter has_edit_right?\"\n if @project.writer?(@auth_user)\n Rails.logger.info \"--> true\"\n true\n else\n Rails.logger.info \"--> false\"\n forbidden # See ApiErrorHelper\n end\n end", "title": "" }, { "docid": "2b536bdd5fc59238be8db42b3be98ae5", "score": "0.7226783", "text": "def can_administer_projects?\n redirect_to root_url, notice: 'Please sign in as a project administrator or administrator.' unless administers_projects?\n end", "title": "" }, { "docid": "d29394ef3bd7dd015791b2e52bfa53e0", "score": "0.7195329", "text": "def projects_accessible?(projects)\n policy.projects_accessible?(projects, self.is_downloadable?)\n end", "title": "" }, { "docid": "d95a81d64bbdfdaeb339f63c48fe5ec9", "score": "0.71935385", "text": "def is_project_manager\n user = current_user\n return false if ! user\n return false if ! session[:project_id]\n project = Project.find_by_id(session[:project_id])\n return false if ! project\n @project_manager = (project.user_id == user.id)\n end", "title": "" }, { "docid": "385e93605f79794e33312cb292314c1e", "score": "0.7191371", "text": "def check_auth\n if @project.project_owner_id != current_user.id && !current_user.admin? && current_user.id != @project.project_manager_id && !(current_user.company == @project.project_owner.company && current_user.company_admin?)\n redirect_to projects_path, :alert => \"Access denied.\" and return\n end\n end", "title": "" }, { "docid": "385e93605f79794e33312cb292314c1e", "score": "0.7191371", "text": "def check_auth\n if @project.project_owner_id != current_user.id && !current_user.admin? && current_user.id != @project.project_manager_id && !(current_user.company == @project.project_owner.company && current_user.company_admin?)\n redirect_to projects_path, :alert => \"Access denied.\" and return\n end\n end", "title": "" }, { "docid": "385e93605f79794e33312cb292314c1e", "score": "0.7191371", "text": "def check_auth\n if @project.project_owner_id != current_user.id && !current_user.admin? && current_user.id != @project.project_manager_id && !(current_user.company == @project.project_owner.company && current_user.company_admin?)\n redirect_to projects_path, :alert => \"Access denied.\" and return\n end\n end", "title": "" }, { "docid": "385e93605f79794e33312cb292314c1e", "score": "0.7191371", "text": "def check_auth\n if @project.project_owner_id != current_user.id && !current_user.admin? && current_user.id != @project.project_manager_id && !(current_user.company == @project.project_owner.company && current_user.company_admin?)\n redirect_to projects_path, :alert => \"Access denied.\" and return\n end\n end", "title": "" }, { "docid": "43e6acd29373c5e7a9ff2e97caf78bde", "score": "0.71865106", "text": "def project?\r\n false\r\n end", "title": "" }, { "docid": "deedfd2b47bef8881919d269f2481edc", "score": "0.7162905", "text": "def visible?(user=User.current)\n return true if user.admin?\n return false unless project.nil? ||\n user.allowed_to?(:view_projects, project)\n case visibility\n when VISIBILITY_PUBLIC\n true\n when VISIBILITY_ROLES\n if project\n (user.roles_for_project(project) & roles).any?\n else\n Member.where(user_id: user.id).joins(:roles).\n where(member_roles: { role_id: roles.map(&:id) }).any?\n end\n else\n user == self.user\n end\n end", "title": "" }, { "docid": "e75173c817aaf510213395dffe1321d6", "score": "0.71560174", "text": "def is_for_project?\n not self.project.nil?\n end", "title": "" }, { "docid": "b71e4df64f262bb40640083108c589af", "score": "0.715459", "text": "def developer_can_see_this_project?\n developer = Developer.where(:gamer_id => current_gamer.id).first\n projects_owned = Project.where(:owner_id => developer.id)\n projects_shared1 = developer.projects_shared\n current_project = Project.find(params[:id])\n if !projects_owned.include?(current_project) && !projects_shared1.include?(current_project)\n flash[:error] = t(:developer_cant_see_project)\n redirect_to projects_path\n end \n end", "title": "" }, { "docid": "c3fb14872cb8fef44ad251cc55f48757", "score": "0.7152002", "text": "def is_project_manager?(project = nil)\n if project.nil?\n current_user.projects.size > 0\n else\n project.owner == current_user\n end\n end", "title": "" }, { "docid": "ed9ccab87eddbb14cecc5ef99e5e4536", "score": "0.710937", "text": "def can_critique?(project)\n (self.is_guest? || (self.id != project.user.id && (SkillLevel.compare(self.skill_level, project.user.skill_level) || SkillLevel.compare(self.skill_level.lower_tier, project.user.skill_level))))\n end", "title": "" }, { "docid": "6dae6dbb649a6eae21393b36b4180efc", "score": "0.710877", "text": "def is_in_project?(project)\n self.projects.include?(project)\n end", "title": "" }, { "docid": "a59b29a47880b0f416a7bc3960f9fb73", "score": "0.71018684", "text": "def has_permission?(action, project = nil)\n return true if self.admin?\n self.roles(:projects => project).any?{ |role| role.has_permission?(action) }\n end", "title": "" }, { "docid": "70c21344a5a8f1e55851bb2eae1e7af3", "score": "0.70854676", "text": "def project?\n true\n end", "title": "" }, { "docid": "70c21344a5a8f1e55851bb2eae1e7af3", "score": "0.70854676", "text": "def project?\n true\n end", "title": "" }, { "docid": "3c397fcc1683d3905e3666024da78055", "score": "0.70785415", "text": "def project_as_user?(project)\n Rails.cache.fetch(\"#{cache_key_with_version}/#{project}\") do\n Medium.where(sort: sort[project],\n released: ['all', 'users', 'subscribers'],\n teachable: self).exists?\n end\n end", "title": "" }, { "docid": "bf816f8fe87c70cdd6b09a16a4294eb4", "score": "0.7062969", "text": "def modifiable_by?(current_user)\n Project.current.with_user(current_user.id, true).where(id: id).count == 1\n end", "title": "" }, { "docid": "964056e091c9e42c637b17ce3476eb77", "score": "0.70551187", "text": "def editable_by?(current_user)\n current_user.all_projects.where(id: id).count == 1\n end", "title": "" }, { "docid": "fd66d3660ffe3b280ad89ae7be22e841", "score": "0.7048417", "text": "def project?\n !(@project.nil? || @project.id.nil?)\n end", "title": "" }, { "docid": "c9f87df907b53333d82d19f027010909", "score": "0.7041338", "text": "def project_admin?(project = nil)\n return false unless project.is_a?(Array)\n # => parse_auth.include?(user) && parse_auth[user]['roles'].any? { |r| ['admin', project].include? r.to_s.downcase }\n auth['roles'].any? { |r| ['admin', project].include? r.to_s.downcase }\n end", "title": "" }, { "docid": "4006dd3c3500d0c776d4719c3472cb78", "score": "0.7031982", "text": "def belong_to_own_project(user)\n\t users = self.projects.collect {|x| x.user_projects }.flatten\n\t\tusers.include?(user) or self.has_role?(\"admin\")\n\tend", "title": "" }, { "docid": "4a00c0428026b88ac03b30efe1361f8c", "score": "0.7015083", "text": "def is_managed_by?(user)\n match = projects.find do |p|\n user.person.is_project_administrator?(p)\n end\n !match.nil?\n end", "title": "" }, { "docid": "5cc8d55341cd6926d4d0ddba0d09e02f", "score": "0.6994501", "text": "def projects_editable_on_public_site\n if self.is_a_citizen_effect_admin?\n @projects ||= Project.everything\n elsif self.is_a_cp?\n @projects ||= self.cped_projects\n# self.projects_donated_to\n else\n [] # no dice\n end\n end", "title": "" }, { "docid": "23d5c1b17bf45b1c717c02e61530ea1c", "score": "0.69935673", "text": "def hide_project_membership?(p)\r\n return true unless p.project?\r\n return false if p.private?\r\n rel = Relationship.locate_me(self, p, Relationshiptype.founders)\r\n return true if rel && rel.privacylevel.to_i > 0\r\n false\r\n end", "title": "" }, { "docid": "7db0ed2bc1916d107797ba77543ff8e2", "score": "0.6992481", "text": "def is_managed_by? user\n match = self.projects.find do |p|\n user.person.is_project_manager?(p)\n end\n !match.nil?\n end", "title": "" }, { "docid": "0c2ef6957815c7a03021e2a769be1da6", "score": "0.6981712", "text": "def get_current_student_project\n get_current_project &&\n Member.where(is_enabled: true, user_id: current_user.id, project_id: get_current_project.id).present?\n end", "title": "" }, { "docid": "d9677675256111de6980f2a838358267", "score": "0.69792086", "text": "def visible?(user=User.current)\n return true if user.admin?\n return false unless project.nil? || user.allowed_to?(:view_issues, project)\n case visibility\n when VISIBILITY_PUBLIC\n true\n when VISIBILITY_ROLES\n if project\n (user.roles_for_project(project) & roles).any?\n else\n Member.where(:user_id => user.id).joins(:roles).where(:member_roles => {:role_id => roles.map(&:id)}).any?\n end\n else\n user == self.user\n end\n end", "title": "" }, { "docid": "efb7f48b7b617c9359863fa2cf4fcb22", "score": "0.6978865", "text": "def check_permission\n\t\tif current_user.id != current_object.project.user_id\n\t\t\tflash[:error] = 'Permission denied!'\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "title": "" }, { "docid": "77c9c04033dabe549d02eaf33d3b738e", "score": "0.69633925", "text": "def show\n if !current_user.isAdmin?\n if !@project.belongsToProject?(current_user)\n redirect_to projects_path\n flash[:notice] = 'You can only access your projects'\n end \n end \n end", "title": "" }, { "docid": "ff3e31c20c56f40c7d510f80f065418f", "score": "0.6952262", "text": "def administered_projects\n projects.select{|project| person.is_project_administrator?(project)}\n end", "title": "" }, { "docid": "3f02ae5c8316502ba02156791f25fab3", "score": "0.694592", "text": "def is_project_administered_by?(user_or_person)\n return false if self.is_admin?\n return false if user_or_person.nil?\n person = user_or_person.person\n match = projects.find do |p|\n person.is_project_administrator?(p)\n end\n !match.nil?\n end", "title": "" }, { "docid": "c8fa4a8aa21e62fb00ed409102155cf2", "score": "0.6944861", "text": "def projects_accessible?(projects, downloadable_asset)\n lowest_access_type = downloadable_asset ? Policy::ACCESSIBLE : Policy::VISIBLE\n return true if access_type >= lowest_access_type\n Array(projects).select do |project|\n !permission_granted?(project,lowest_access_type)\n end.empty?\n end", "title": "" }, { "docid": "48951b2e6c425807965d7f8d3a8759d8", "score": "0.6939433", "text": "def member?(project_id)\n\t\tself.members.find_by(project_id: project_id)\n\tend", "title": "" }, { "docid": "e249060ff90c2685f31354fe99b014b3", "score": "0.69373834", "text": "def is_assigned?(project)\n projects.include?(project)\n end", "title": "" }, { "docid": "574ebdf2471baaf513168c2297e7346c", "score": "0.69283646", "text": "def has_delete_project_right?\n Rails.logger.info \"--> filter has_delete_right?\"\n if @project.user_id == @auth_user.id\n Rails.logger.info \"--> true\"\n true\n else\n Rails.logger.info \"--> false\"\n forbidden # See ApiErrorHelper\n end\n end", "title": "" }, { "docid": "7783bef5bfe5b849413c6fdaf00a5e6a", "score": "0.69243747", "text": "def user_has_access?\n case @isr_agreement.current_task\n when 0\n user_has_ifm_access?( :to_create )\n when 1, 4, 5 # create, archive, modify\n user_has_ifm_access?( :to_update )\n when 2\n user_has_ifl_access?\n when 3\n user_has_ifp_access?\n else\n false\n end\n end", "title": "" }, { "docid": "decce160c907bdf6292299dfdea32eed", "score": "0.69172424", "text": "def check_auth_admin\n if !current_user.admin? && current_user.id != @project.project_manager_id\n redirect_to projects_path, :alert => \"Access denied.\" and return\n end\n end", "title": "" }, { "docid": "553706908d3c68ed8fb39aac25e3484a", "score": "0.6915792", "text": "def manage\n \t@project = Project.find(params[:project_id])\n if @project.lead_users.include? current_user || current_user.is_admin?\n \t@project_users = User.get_users_for_project(@project.id, current_user)\n \t@user_project_roles = UserProjectRole.new\t\t\n else\n render inline: \"<h3> You are not authorized to perform this action.</h2>\"\n end\n end", "title": "" }, { "docid": "18a712b56a223d4f1977c4b8ccfa65ac", "score": "0.69133484", "text": "def my_project?(project_id, user_id)\n\t\t#user = User.find(user_id)\n\t\tproject = Project.my_project(project_id, user_id)\n\n\t\tif project.blank?\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "title": "" }, { "docid": "f35dae6ff5ed437bb3b8690d3459340e", "score": "0.69120234", "text": "def create?\n @current_user.permission('Project', :clerk)\n end", "title": "" }, { "docid": "e7e4129741e3ac79606f04fe221860de", "score": "0.6905783", "text": "def update?\n @current_user.permission('Project', :clerk)\n end", "title": "" }, { "docid": "cf86a94928b5380771595a580b3db4c8", "score": "0.6900958", "text": "def is_owned_by?(user)\n user.present? && record.project.user == user\n end", "title": "" }, { "docid": "40f72412e89ff05fb6c1d149218f547f", "score": "0.68916166", "text": "def can_edit?(user = User.current_user)\n return false unless user\n return true if new_record? && self.class.can_create?\n user = user.user if user.is_a?(Person)\n (user == self.user) || user.is_admin? || (is_project_administered_by?(user.person) && self.user.nil?)\n end", "title": "" }, { "docid": "b2dbc6c95ebf12a0bece3bff821f5dd2", "score": "0.68807566", "text": "def github_public_organization_access?(name)\n github_user.publicized_organization_member?(name)\n end", "title": "" }, { "docid": "970e6657e5ac4ed17287cefbf8b70649", "score": "0.687576", "text": "def can_create_project?\n raise CanCan::AccessDenied unless can? :create, Project\n end", "title": "" }, { "docid": "10feb5287ab16e19308796f6f0678634", "score": "0.6875615", "text": "def create_project?\n return true if self.admin? # admin always true\n \n # False if they have not paid and they have added at least one project\n return false if self.subscription.nil? && self.projects.count >= 1\n \n # False if they have not paid\n return false if self.subscription.nil? && 14.days.ago > self.created_at \n return true\n end", "title": "" }, { "docid": "6eb6c06fbd764b51a9d294f37753abd3", "score": "0.6874428", "text": "def load_and_authorize_project\n @project ||= user_projects.find(user_session.delete(:project_id))\n authorize @project, :access?\n\n @access_scope = user_session.delete(:access_scope)\n end", "title": "" }, { "docid": "4a06223848cb7b430545dcf3001ede7d", "score": "0.6872152", "text": "def is_authorised\n redirect_to root_path, alert: \"Hmm...Sorry, but you don't have permission to do this.\" unless current_user.id == @project.user_id\n end", "title": "" }, { "docid": "251ac924d1a999b7a06011fbd6f03949", "score": "0.6846045", "text": "def has_advanced_permissions?\n if policy.sharing_scope==Policy::ALL_SYSMO_USERS\n !(policy.permissions.collect{|p| p.contributor} - projects).empty?\n else\n policy.permissions.count > 0\n end\n end", "title": "" }, { "docid": "e3990072500f1c1368a9f449176b6954", "score": "0.684522", "text": "def project?\n !@project.nil? and @project.name?\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "635f2661fd2d527c247c12ff88ac6c8a", "score": "0.0", "text": "def set_operacione\n @operacione = Operacione.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59229624", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5899037", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889287", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.5877498", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5862599", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5810375", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.5740072", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57316417", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.5718692", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5700777", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.5692726", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5668117", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56531155", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.565059", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56384724", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5625417", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.56102014", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5596785", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5596253", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.55899394", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55090857", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55058104", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.54677796", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465028", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.5448835", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.5447902", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.54402983", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54168683", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5400121", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392725", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.53884417", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53783494", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53593004", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53494495", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5349437", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53471607", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.53441674", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5342784", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53281486", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53036916", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.528415", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.52831894", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.5258319", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5256983", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52521855", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52472556", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.52398384", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52329665", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.5229699", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5225785", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.52239066", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.5219224", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.52147436", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.52146924", "text": "def pick_action; end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.5211636", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52089876", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5206151", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.5204869", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.520361", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5201687", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5198511", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5198511", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.51926094", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5181837", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.5178642", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51642865", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5153578", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.51448536", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5142863", "text": "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", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51412", "text": "def code_action_provider; end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.5139861", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.5134318", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.51167125", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5115634", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.51111007", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5106379", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.510497", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51013684", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.5096925", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.5093146", "text": "def config(action, *args); end", "title": "" } ]
f0ee382ca0e59d43e1cc81393faed7ab
Get value that parameter must be divisible by. Result is 1 when this property is not defined. :rtype: int
[ { "docid": "3e7cb4415f3fd79f75fb1cb80b47d626", "score": "0.0", "text": "def get_multiple_of\n return @payload.get_path(\"multiple_of\"){-1}\n end", "title": "" } ]
[ { "docid": "0dcfd49b40d31d90aa69d954b5b0835c", "score": "0.6458679", "text": "def evaluate_result(num)\n if num == 0\n return 0\n else\n num % num.to_i == 0 ? num.to_i : num\n end\nend", "title": "" }, { "docid": "ea19c607f7c85b73437b573ac27240dd", "score": "0.6095838", "text": "def modulo( value )\n return ((value - self.min)%self.size + self.min)\n end", "title": "" }, { "docid": "d5fa33a330f0082220d675c99368d684", "score": "0.6089864", "text": "def multipleof(number, multiple)\n result = number % multiple\n if result == 0\n return 1 \n end\n return 0\nend", "title": "" }, { "docid": "eb2c167e50e8f6100633a84182efd8cf", "score": "0.5990594", "text": "def factor?(num)\n @max % num == 0\nend", "title": "" }, { "docid": "96a4eeb307f378e33f4a4b42407af1fc", "score": "0.598135", "text": "def divisible_by(numbers, divisible)\n divisible_number = numbers.select { |x| (x % divisible).zero? }\n divisible_number.nil? ? 0 : divisible_number\nend", "title": "" }, { "docid": "2fbc43b0a19e018cc7a63f68882a6cff", "score": "0.5964082", "text": "def div(n)\n `parseInt(this/n)`\n end", "title": "" }, { "docid": "efae89712003e4a94a90261bbca6a4d2", "score": "0.59193766", "text": "def div (x) to_i.div(x.to_i) end", "title": "" }, { "docid": "edeb5561b9c8ff27967e33c450f77e51", "score": "0.5918669", "text": "def divisor\n options['divisor']\n end", "title": "" }, { "docid": "c188d1d4666ad3fe00a4580d57689cab", "score": "0.58676016", "text": "def paranoid_divisor\n 2\n end", "title": "" }, { "docid": "db6545619b227612e696942a403d905d", "score": "0.5836345", "text": "def divisible(other)\n (other.value != 0) && (@value % other.value == 0)\n end", "title": "" }, { "docid": "0a457e9e4c2952bc951dcd71961dcf0b", "score": "0.58330894", "text": "def value\n if [0, 13, 25, 37].member(@index)\n return 11\n elsif @index % 13 <= 4\n return 10\n else \n return @index + 1\n end \n end", "title": "" }, { "docid": "94e4bde9c8316f3c1171c1befa4f6f8a", "score": "0.582507", "text": "def mod(x); x; end", "title": "" }, { "docid": "9e233313b569d5ff6d3a3461dffd27b9", "score": "0.5815328", "text": "def is_divisible_by?(factor)\n self%factor == 0\n end", "title": "" }, { "docid": "6f9ba30f00252efd7de946f5a95c55d0", "score": "0.580866", "text": "def is_div(num)\n (num % 3).zero?\nend", "title": "" }, { "docid": "00ded4dabe076f6ba6a223c0a18e7f63", "score": "0.58082145", "text": "def divisible_by(n, divisor)\n n % divisor == 0\nend", "title": "" }, { "docid": "3de58ce979589e1016807e50cb56c15a", "score": "0.5780427", "text": "def valid_value_for_test\n value = @options[:equal_to] || @options[:less_than_or_equal_to] || @options[:greater_than_or_equal_to]\n\n value ||= @options[:less_than] - 1 if @options[:less_than]\n value ||= @options[:greater_than] + 1 if @options[:greater_than]\n\n value ||= 10\n\n if @options[:even]\n value = (value / 2) * 2\n elsif @options[:odd]\n value = ((value / 2) * 2) + 1\n end\n\n value\n end", "title": "" }, { "docid": "1163175e44ac8b3e157e89f3b4f00137", "score": "0.5761129", "text": "def can_divide_by?(number)\n return false if number.zero?\n true\nend", "title": "" }, { "docid": "f4549f2135960fe1e151653b9a89f2a9", "score": "0.5755272", "text": "def calculate_value(lb, value)\n return value if lb == 0\n value / lb\nend", "title": "" }, { "docid": "15b1e8d97fe0fa95b5d55913f70dbe17", "score": "0.57514095", "text": "def can_divide_by?(number)\r\n return false if number.zero?\r\n true # altrimenti\r\nend", "title": "" }, { "docid": "030401516c191bdab9b70cad79171106", "score": "0.5726704", "text": "def denominator\n 1\n end", "title": "" }, { "docid": "276bfe253f1707b4f81ca711fd48560e", "score": "0.57263595", "text": "def valid_num(num)\n (num % 3 == 0 || num % 5 == 0) ? num : 0\nend", "title": "" }, { "docid": "0139576d73e7a011da84add4711fca44", "score": "0.5719978", "text": "def chance\n self.chance_float.ceil\n end", "title": "" }, { "docid": "7b857ea120165f320074250707ca0cff", "score": "0.5717919", "text": "def par(num)\n (num % 2).zero?\nend", "title": "" }, { "docid": "093af4b11dfe91cbf0c12f166b42c21f", "score": "0.5709434", "text": "def divisor?(num, div)\n num % div == 0\nend", "title": "" }, { "docid": "94dc2f36aa2ca927c87f687abac08f42", "score": "0.57090396", "text": "def multiple?(number, divisor)\r\n number % divisor == 0\r\nend", "title": "" }, { "docid": "c2643a2cae613aa5b8aa5dcb5805af74", "score": "0.5702079", "text": "def /(other)\n @value / other.to_i\n end", "title": "" }, { "docid": "57eff22211f22f0b8bf741e0e171947f", "score": "0.5693531", "text": "def mod_it(number, divider)\n number % divider == 0\nend", "title": "" }, { "docid": "ff3f0d18e0bfaae3c4cc750e58ff1f0b", "score": "0.56885195", "text": "def multiple(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "1974493ccff7c48df15843b6fb115edd", "score": "0.5688068", "text": "def divmod\n end", "title": "" }, { "docid": "97049779f6cd4a28d4342567ef92c618", "score": "0.56841576", "text": "def choose_counter(remainder, denominator)\n remainder > denominator ? denominator : remainder\n end", "title": "" }, { "docid": "836098f388e25479c4a2dbf1ac1a3bb6", "score": "0.56824356", "text": "def divide(dividend, divisor)\n factor = divisor \n result = 1\n until factor >= dividend do \n factor += divisor \n result += 1 \n end\n # if factor == dividend\n # result\n # else\n # nil \n # end\n result\nend", "title": "" }, { "docid": "79cd85a6ff858015cd90d4672761dfbd", "score": "0.56767476", "text": "def cm(n, multiple)\n\t a = 1 == 2\n if num % multiple == 0\n a = true\n end\n return a\nend", "title": "" }, { "docid": "bbc8c6ad62c9ca1e2ab8e1201ce045b2", "score": "0.565652", "text": "def multiple_of_given?(number, given)\n number % given == 0\n end", "title": "" }, { "docid": "98ebcc46ee4810520a8b1662bc2867a3", "score": "0.5646129", "text": "def is_divisible_by?(divisor)\n self % divisor == 0 ? true : false\n end", "title": "" }, { "docid": "4e6340de308079419b38cadc1cc9143e", "score": "0.5645955", "text": "def divide numerator, denominator\n step = denominator\n return 1 if numerator == denominator\n result = 0\n\n until step >= numerator\n step += denominator\n result += 1\n end\n\n result\nend", "title": "" }, { "docid": "a2240369b471a9c09e6153b869af03bb", "score": "0.56453544", "text": "def checkmultiple(n, multiple)\n n % multiple == 0\nend", "title": "" }, { "docid": "189e4d5ed94bc84c9178f95642a6cc56", "score": "0.5643341", "text": "def check_for_factor(base, factor)\n base % factor == 0\nend", "title": "" }, { "docid": "dde89b315f95cdd0f09a85caffa3eb37", "score": "0.56423694", "text": "def divByThree?(num)\n\nend", "title": "" }, { "docid": "166edd20e8dd82fb0e129f68a3e35462", "score": "0.5640328", "text": "def alg_one(num)\r\n (1).step(num / 2) do |div|\r\n if div.divides? num && Prime.prime? num / div\r\n return num / div\r\n end\r\n end\r\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "237469d6ea0b99d138e2ba72f22e365a", "score": "0.5640113", "text": "def multiple?(number, divisor)\n number % divisor == 0\nend", "title": "" }, { "docid": "579869e17f7863ededb2aca2dcf22509", "score": "0.5634418", "text": "def divisible_by?(num)\n @year.divisible_by? num\n end", "title": "" }, { "docid": "bc5ba3bdc81d164fd7ffe3df6b153dc6", "score": "0.5634314", "text": "def check_divisible(check_number, input_number)\n (input_number % check_number).zero?\n end", "title": "" }, { "docid": "adc173e952d2b206ab9f983324b614c8", "score": "0.5631884", "text": "def even_valid_value_for_test\n (valid_value_for_test / 2) * 2\n end", "title": "" }, { "docid": "c524ba7587da1e7a2fc80eaacfb16166", "score": "0.56224585", "text": "def can_divide_by?(number)\n\treturn false if number.zero?\n\ttrue\nend", "title": "" }, { "docid": "c524ba7587da1e7a2fc80eaacfb16166", "score": "0.56224585", "text": "def can_divide_by?(number)\n\treturn false if number.zero?\n\ttrue\nend", "title": "" }, { "docid": "b7f27f72723a65cceb620d1ce257a38e", "score": "0.55976", "text": "def divisible_by?(amount)\n num % amount == 0\n end", "title": "" }, { "docid": "b7f27f72723a65cceb620d1ce257a38e", "score": "0.55976", "text": "def divisible_by?(amount)\n num % amount == 0\n end", "title": "" }, { "docid": "b7f27f72723a65cceb620d1ce257a38e", "score": "0.55976", "text": "def divisible_by?(amount)\n num % amount == 0\n end", "title": "" }, { "docid": "29f0dc81f40ef7b31ac4c3326a838eec", "score": "0.5595885", "text": "def divisible_by_x?(num, x)\n num % x == 0 ? true : false\nend", "title": "" }, { "docid": "d51815020e97ec3cc405af4309a6b9aa", "score": "0.55952436", "text": "def validate_divisibleBy(current_schema, data, fragments)\n if data.is_a?(Numeric)\n if current_schema.schema['divisibleBy'] == 0 || \n current_schema.schema['divisibleBy'] == 0.0 ||\n (BigDecimal.new(data.to_s) % BigDecimal.new(current_schema.schema['divisibleBy'].to_s)).to_f != 0\n message = \"The property '#{build_fragment(fragments)}' was not divisible by #{current_schema.schema['divisibleBy']}\"\n raise ValidationError.new(message, fragments, current_schema)\n end\n end\n end", "title": "" }, { "docid": "02ea7c8c9b571e7bd99c76bd696c2e1e", "score": "0.55877197", "text": "def is_multiple_of(multiple, n)\n n % multiple == 0\nend", "title": "" }, { "docid": "87eb15ed8ca13d7deab983f99598e6ec", "score": "0.55735457", "text": "def unitary\n self / self.modulus\n end", "title": "" }, { "docid": "8a629e95e4872f0071cc1517e934bb78", "score": "0.55588704", "text": "def final_result(equals_to)\n if equals_to % 1 == 0\n equals_to = equals_to.to_i\n return equals_to\n end # equals_to is not equal to integer value\n return equals_to\nend", "title": "" }, { "docid": "85ec7c716955a33f3f7ee1900a69c4bd", "score": "0.5555265", "text": "def multiple?(number, divisor) # true if the given number is an exact multiple of 3/5\n number % divisor == 0\nend", "title": "" }, { "docid": "be9f48ae2b2f27c0ef8e43612defdeca", "score": "0.55546546", "text": "def modulus; end", "title": "" }, { "docid": "756f02745242566d901d527a3b45e488", "score": "0.55511516", "text": "def divisible_by?(numerator, denominator)\n numerator % denominator == 0\nend", "title": "" }, { "docid": "4195b554ee66bc20a40e7065547790cf", "score": "0.55427945", "text": "def divisible_by? i, d\n i % d == 0\nend", "title": "" }, { "docid": "1913f95c527b79ad40d793135ca52dc7", "score": "0.5542692", "text": "def multiple?(number, multiple)\n number % multiple == 0\nend", "title": "" }, { "docid": "7973de3b2fe6ee1a0c8fcf3d17108532", "score": "0.55388933", "text": "def multiples_by? (num, div_by_num)\n (num % div_by_num).zero?\nend", "title": "" }, { "docid": "bc236ab221d1f6165f05f2da2d0fca71", "score": "0.5534243", "text": "def is_effective?(value)\n value % @step_value == 0\n end", "title": "" }, { "docid": "d884566f8fbde823c0233bbceea57e29", "score": "0.5529028", "text": "def div_by_three?(num)\n num % 3 == 0\nend", "title": "" }, { "docid": "7f1f83869f3bb85fb73ebc492f5aa6d3", "score": "0.5525941", "text": "def divisible_by?(number, divisor)\n result = (number.to_f / divisor.to_f)\n represents_a_whole_number?(result)\nend", "title": "" }, { "docid": "1048cb6cccf0e6be56cbc100d0cfda0d", "score": "0.55057514", "text": "def sumOfDivisibleBy(n)\n largest = @limit / n\n return largest * (largest + 1) * n / 2\nend", "title": "" }, { "docid": "f588dec156d1e283554606a0fa025828", "score": "0.5502469", "text": "def integer?\n `this%1===0`\n end", "title": "" }, { "docid": "15980e9e914323de995d84221aae6d26", "score": "0.5483579", "text": "def % (other)\n value = (self / other).to_i\n return self - other * value\n end", "title": "" }, { "docid": "03b426927f9be7cdb62430c31393bc06", "score": "0.5479872", "text": "def get_number(number)\n print \"What number would you like to test to see if it is divisible by 3? \"\n return gets.chomp.to_i\nend", "title": "" }, { "docid": "0e51078feae2d169f85fbb6e1aaff864", "score": "0.54787904", "text": "def /(int)\n self.to_i / int\n end", "title": "" }, { "docid": "7d29d2cdd592c819474b076f721d4153", "score": "0.54762614", "text": "def my_modulo(dividend, divisor)\n dividend % divisor\nend", "title": "" }, { "docid": "a340b979c70d19abb44c7df68d501272", "score": "0.54689676", "text": "def alg_three(num)\r\n (num / 2).step(1, -1) do |divisor|\r\n if divisor.divides? num && Prime.prime? divisor\r\n return divisor\r\n end\r\n end\r\nend", "title": "" }, { "docid": "ac8f714cfe0d715675c32d56187f19b8", "score": "0.546539", "text": "def divider(num, divider)\n num % divider == 0\nend", "title": "" }, { "docid": "d1513ae8b8b65ad9d1ecd8ad5eb7bd66", "score": "0.5462565", "text": "def has_property(number)\n\tnumber = number.to_s\n\treturn (\n\t\tnumber[3].to_i % 2 == 0 and\n\t\tnumber[2..4].to_i % 3 == 0 and\n\t\tnumber[5].to_i % 5 == 0 and\n\t\tnumber[4..6].to_i % 7 == 0 and\n\t\tnumber[5..7].to_i % 11 == 0 and\n\t\tnumber[6..8].to_i % 13 == 0 and\n\t\tnumber[7..9].to_i % 17 == 0\n\t)\nend", "title": "" }, { "docid": "1fe742237c007f50554588ced8d7910d", "score": "0.54621327", "text": "def get_number\n print \"What's your number to check if it's divisible by 3?\"\n return gets.chomp.to_i\nend", "title": "" }, { "docid": "ba67842cffed7295f8b83dffbffa4e03", "score": "0.5450112", "text": "def is_divisible_by?(number, divisor)\n number % divisor == 0\n end", "title": "" }, { "docid": "fcb61f7ba86e600e2a82fb16246123c7", "score": "0.5447319", "text": "def getPercentage\n params.fetch(:percentage).to_i\n end", "title": "" }, { "docid": "dfe047c955138f820b80b3c1cdb2968a", "score": "0.5443921", "text": "def get_percent_of_input\n input_id = params[:id]\n begin\n input = Input.find(:first,:conditions => ['id = ? and status <> ?', input_id,Input::KILLED])\n value = input.percentage \n rescue \n value = -1\n end\n render :text => value\n end", "title": "" }, { "docid": "9cd1e0c314cebc9dc138c689080f5335", "score": "0.5442383", "text": "def factor\n super || 1\n end", "title": "" }, { "docid": "9cd1e0c314cebc9dc138c689080f5335", "score": "0.5442383", "text": "def factor\n super || 1\n end", "title": "" }, { "docid": "d55f4620fdacfc11cb664343b69f3c92", "score": "0.54399025", "text": "def my_modulo(dividend, divisor)\n # your code goes here\n dividend%divisor\n end", "title": "" }, { "docid": "2a0c236eb286abe226ebd4f31eeda1b2", "score": "0.5438178", "text": "def _PERCENTAGE\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_num)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"%\")\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_PERCENTAGE unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "fd44a7b04f193f2d6a2c6a45b9a21db9", "score": "0.5435392", "text": "def fuel_needed_per_module num\n (num/3).floor - 2\nend", "title": "" }, { "docid": "2875dcec575a7a7ed7ef2d7416f1a5ef", "score": "0.54351515", "text": "def test_modulus_function\n assert_equal 0, 9 % 3\n end", "title": "" }, { "docid": "324a2450ea2c599d2158829bde4f9da4", "score": "0.54316396", "text": "def to_i; (self.value * 100).to_i; end", "title": "" }, { "docid": "048269997aafcbc4badac6f0690d37a8", "score": "0.54252917", "text": "def my_modulo(dividend, divisor)\n # your code goes here\n dividend.modulo(divisor)\nend", "title": "" }, { "docid": "82a9dbfbdf8e57b5509618668f6f7dd0", "score": "0.5424813", "text": "def divisble_by? (num, div_by_num)\n (num % div_by_num).zero?\n end", "title": "" }, { "docid": "d296184f5c7ebc3d3fa0896b69b7ea7d", "score": "0.5420137", "text": "def divisible_by?(num, div_by_num)\n (num % div_by_num).zero?\n end", "title": "" }, { "docid": "908ea8b9c26b03a408c187246aad2a50", "score": "0.541618", "text": "def find_trinum(divisor_limit)\n i = 1\n value = i * (i + 1)/2\n\n while divisor_count(value) <= divisor_limit\n i += 1\n value = i * (i + 1)/2\n end\n return value\nend", "title": "" }, { "docid": "6f6043d115cbd684a9e1170ad47a9777", "score": "0.54062086", "text": "def %(other) # Calcula el resto al dividir dos fracciones (modulo)\n result = self./(other)\n result = (result.numerador%result.denominador).to_i\n end", "title": "" }, { "docid": "a2d6f4e7719a92f52658b63c4e98dad7", "score": "0.54046625", "text": "def >>(n)\n `Math.floor(parseInt(this)/Math.pow(2,parseInt(n)))`\n end", "title": "" }, { "docid": "32344638b270ebe9bc5266a45f8b65fd", "score": "0.540462", "text": "def divby5(number)\n (number % 5).zero?\nend", "title": "" }, { "docid": "8ce02aae33f73f56808e6a53ede2f8c9", "score": "0.54028755", "text": "def test_divisible\n assert(@solucion.divisible?(2520, 1..10))\n end", "title": "" }, { "docid": "df9baface6d945fe39ed0393546a05fb", "score": "0.5400745", "text": "def div_three(num)\n num % 3 == 0\nend", "title": "" }, { "docid": "48963171431ead579be332c99cf9e24d", "score": "0.5400548", "text": "def sum_divisible_by(n, limit)\n num = limit/n\n (n * num * (num + 1))/2\nend", "title": "" } ]
741ff09d7112bfb3aceb6e3e52214922
The hostmask is the contrary of the subnet mask, as it shows the bits that can change within the hosts prefix = IPAddress::Prefix32.new 24 prefix.hostmask => "0.0.0.255"
[ { "docid": "bdfb2775ff698a674e5680a562fbb327", "score": "0.8000568", "text": "def hostmask\n [~to_u32].pack(\"N\").unpack(\"CCCC\").join(\".\")\n end", "title": "" } ]
[ { "docid": "86f785e96a1e600484a1fcd803a3c1c6", "score": "0.76371664", "text": "def packed_hostmask()\n return(@hostmask)\n end", "title": "" }, { "docid": "925cbd0658476c01a964dbc13655ca8a", "score": "0.7563164", "text": "def netmask\n @prefix.to_ip\n end", "title": "" }, { "docid": "b4f2f5f48e3809f4cc7048866312bc0c", "score": "0.755367", "text": "def netmask\n @network_conf[:mask] ||= IPAddr.new('255.255.255.255').mask(prefix).to_s if prefix\n end", "title": "" }, { "docid": "8553af167c8877938a3fcafdb0386e57", "score": "0.74892545", "text": "def host_prefix()\n return @ip_bits.bits - @num\n end", "title": "" }, { "docid": "853b239229a9309e8c3a4908a42386a6", "score": "0.7440345", "text": "def prefix\n return(0) if (@mask_addr == 0)\n length=32\n if (ipv6?)\n length=128\n end\n\n mask = nil\n netmask_int = @mask_addr\n if (netmask_int < 2**length)\n mask = length\n else\n mask = 128\n end\n\n mask.times do\n if ((netmask_int & 1) == 1)\n break\n end\n netmask_int = netmask_int >> 1\n mask = mask - 1\n end\n return(mask)\n end", "title": "" }, { "docid": "0b61acbab9475b267a1bcf09150dc85d", "score": "0.7155529", "text": "def host_mask()\n ret = Crunchy.zero()\n (@ip_bits.bits - @num).times do\n ret = ret.shl(1).add(Crunchy.one())\n end\n\n return ret\n end", "title": "" }, { "docid": "e29cbac8f02ee9d0e4163abae01b0039", "score": "0.71179694", "text": "def netmask()\n\t\t\t@m32\n\t\tend", "title": "" }, { "docid": "486f8172c404fd588f1dfe272b000431", "score": "0.7107834", "text": "def mask_to_prefixlen(mask)\n mask = '255.255.255.255' unless mask\n NetAddr::CIDR.create('0.0.0.0/' + mask).netmask_ext\n end", "title": "" }, { "docid": "05a1c0575a10c3ddd7e09d88658c6b4c", "score": "0.70821834", "text": "def netmask\n _to_string(@mask_addr)\n end", "title": "" }, { "docid": "a4bbf2d7c9e7ffa6bcb3f23f66ddef07", "score": "0.7068032", "text": "def host_prefix\n 128 - @prefix\n end", "title": "" }, { "docid": "4fcf15895ed9382cf72fc15f518d459a", "score": "0.6975218", "text": "def subnet_mask\n @cidr.instance_variable_get(\"@mask_addr\").to_s(2).count('1')\n end", "title": "" }, { "docid": "e7a0f73887184e1ec96809cec748ef24", "score": "0.6964517", "text": "def host_prefix\n 32 - @prefix\n end", "title": "" }, { "docid": "4671bec1719179dc39be4779736dda26", "score": "0.69589347", "text": "def hostmask_ext()\n if (@version == 4)\n hostmask = IPAdmin.unpack_ip_addr(:Integer => @hostmask, :Version => @version)\n else\n raise \"IPv6 does not support extended hostmask notation.\" \n end\n\n return(hostmask)\n end", "title": "" }, { "docid": "81f13fac96b66473402682fda5927ceb", "score": "0.6793059", "text": "def mask!(mask)\n if mask.kind_of?(String)\n if mask =~ /\\A\\d+\\z/\n prefixlen = mask.to_i\n else\n m = IPAddr.new(mask)\n if m.family != @family\n raise InvalidPrefixError, \"address family is not same\"\n end\n @mask_addr = m.to_i\n @addr &= @mask_addr\n return self\n end\n else\n prefixlen = mask\n end\n case @family\n when Socket::AF_INET\n if prefixlen < 0 || prefixlen > 32\n raise InvalidPrefixError, \"invalid length\"\n end\n masklen = 32 - prefixlen\n @mask_addr = ((IN4MASK >> masklen) << masklen)\n when Socket::AF_INET6\n if prefixlen < 0 || prefixlen > 128\n raise InvalidPrefixError, \"invalid length\"\n end\n masklen = 128 - prefixlen\n @mask_addr = ((IN6MASK >> masklen) << masklen)\n else\n raise AddressFamilyError, \"unsupported address family\"\n end\n @addr = ((@addr >> masklen) << masklen)\n return self\n end", "title": "" }, { "docid": "7c2042583f689177f492e3d127aed5ff", "score": "0.67554", "text": "def supernet(new_prefix)\n if (new_prefix >= @prefix.num)\n return nil\n end\n\n if new_prefix < 0\n new_prefix = 0\n end\n\n # new_ip = @host_address.clone()\n # for _ in new_prefix..@prefix.num {\n # new_ip = new_ip << 1\n # }\n return from(@host_address, @prefix.from(new_prefix)).network()\n end", "title": "" }, { "docid": "81d2a6517eb166b0b82c1979ad232766", "score": "0.6745687", "text": "def network_u32\n address_u32 & prefix_u32\n end", "title": "" }, { "docid": "a0b59f13fab635ab9fc06008fcd71f42", "score": "0.6743608", "text": "def host_to_mask(value, proto)\n match = value.match %r{(!)\\s?(.*)$}\n return host_to_ip(value, proto) unless match\n\n cidr = host_to_ip(match[2], proto)\n return nil if cidr.nil?\n \"#{match[1]} #{cidr}\"\n end", "title": "" }, { "docid": "89909ccc8a51f4213bf1ea6883d9762e", "score": "0.6734741", "text": "def netmask()\n\t\t\t@m128\n\t\tend", "title": "" }, { "docid": "04f2d0e9650a96aeb5377dc39d22d35e", "score": "0.6641919", "text": "def initialize(host, mask = 32)\n @mask, @mask_length, @mask_bytes = process_mask(mask)\n if host.class == String\n ip = host.split(/\\./)\n (0..3).each { |i| ip[i] = '0' if ip[i] == nil}\n @host = ((ip[0].to_i << 24) | (ip[1].to_i << 16) | (ip[2].to_i << 8) | ip[3].to_i)\n elsif host.class == Integer\n @host = host\n else\n @host = nil\n return\n end\n @network = @host & @mask\n @broadcast = (~@network & ~@mask & 0xFFFFFFFF) | @network\n @last_host = @broadcast - 1\n end", "title": "" }, { "docid": "1074ae2c171a9a33df8ab0e23c6f3b69", "score": "0.66210514", "text": "def ip_prefix\n\t\t\t\t\t@ip && (@ip.to_s + (@prefix ? \"/#{@prefix}\" : \"\"))\n\t\t\t\tend", "title": "" }, { "docid": "6b64e704bad500ab430bd77b8c18d94c", "score": "0.661766", "text": "def netmask\n return IPAddr.new(@mask_addr, family)\n end", "title": "" }, { "docid": "df0c5519001a3dde505be8f624893865", "score": "0.6587159", "text": "def calc_cidr_mask(mask)\n mask_splitter = mask.split(\".\")\n @cidr_mask = 0\n mask_splitter.each do |octet|\n @cidr_mask += octet.to_i.to_s(2).count(\"1\")\n end\n end", "title": "" }, { "docid": "09fcafb7f06caeec6d1ea5502e3ef6e0", "score": "0.6574169", "text": "def netmask=(addr)\n @prefix = Prefix32.parse_netmask(addr)\n end", "title": "" }, { "docid": "31c89a35642c254d58bc562147efd05f", "score": "0.64745766", "text": "def net_interface(host, mac, ip, id, mask)\n if mask == ''\n h = { 'network_if_static' => { id => {\n 'ensure' => 'up',\n 'macaddress' => mac,\n 'ipaddress' => ip,\n 'hostname' => host,\n }}}\n else\n h = { 'network_if_static' => { id => {\n 'ensure' => 'up',\n 'macaddress' => mac,\n 'ipaddress' => ip,\n 'hostname' => host,\n 'netmask' => mask\n }}}\n\n end\nend", "title": "" }, { "docid": "b42a31fb199629c67ff09969008cbb91", "score": "0.64715", "text": "def calc_network\n addr_splitter = @address.split(\".\")\n mask_splitter = @mask.split(\".\")\n network_arr = []\n for i in 0...addr_splitter.length do\n network_arr << (addr_splitter[i].to_i & mask_splitter[i].to_i).to_s\n end\n @network = network_arr.join(\".\")\n end", "title": "" }, { "docid": "9fb47f15ef272bcaceacf3d13cae820a", "score": "0.64575154", "text": "def network_u32\n address_u32 & prefix_u32\n end", "title": "" }, { "docid": "2fd79935650c22d3390767b0622995b3", "score": "0.6455713", "text": "def calc_full_mask(cidr_mask)\n cidr_bits = \"1\"*cidr_mask + \"0\"*(32-cidr_mask)\n cidr_bits_arr = [ \n cidr_bits[0...8].to_i(2).to_s, \n cidr_bits[8...16].to_i(2).to_s,\n cidr_bits[16...24].to_i(2).to_s,\n cidr_bits[24...32].to_i(2).to_s\n ]\n @mask = cidr_bits_arr.join(\".\")\n end", "title": "" }, { "docid": "65044c227c8b812bdf89a56353fc91a3", "score": "0.6445136", "text": "def netmask\n @netmask\n end", "title": "" }, { "docid": "c5e184036d6f9df035ee342c612c1635", "score": "0.64438874", "text": "def hash\n return ([@addr, @mask_addr].hash << 1) | (ipv4? ? 0 : 1)\n end", "title": "" }, { "docid": "6de63b640237a5aa339ff9d421f03384", "score": "0.64089406", "text": "def mask\n \"#{@nick}!#{@user}@#{@host}\"\n end", "title": "" }, { "docid": "0c97b1247c77b94b4fd2ebdfa5ab04c3", "score": "0.6387792", "text": "def GetNetMask()\n manager = Client.new(:host => @host,:community => 'security',:version => :SNMPv1)\n oid = \"1.3.6.1.2.1.4.20.1.3.\"+@host\n value = manager.get(oid: oid)\n return value\nend", "title": "" }, { "docid": "f1d9e341f2f5ca085d2a1891cd1eeff4", "score": "0.636068", "text": "def describe_as_ip\n parts = strip.split('.')\n bytes = parts.zip(parts.map(&:to_i)).map {|(str,val)|\n val if ((1..255) === val) || (val == 0 && str == '0')\n }.squash\n\n if bytes.length != 4\n false\n elsif bytes.starts_with? 0 # Source hosts on \"this\" network\n :reserved\n elsif bytes.starts_with? 127 # Loopback network; RFC1700\n :loopback\n elsif bytes.starts_with? 10 # Class-A private; RFC1918\n :private\n elsif bytes.starts_with?(172) && ((16..31) === bytes[1]) # Class-B private; RFC1918\n :private\n elsif bytes.starts_with? 169, 254 # Link-local range; RFC3330/3927\n bytes[2].in?(0, 255) ? :reserved : :self_assigned\n elsif bytes.starts_with? 192, 0, 2 # TEST-NET - used as example.com IP\n :reserved\n elsif bytes.starts_with? 192, 88, 99 # 6-to-4 relay anycast; RFC3068\n :reserved\n elsif bytes.starts_with? 192, 168 # Class-C private; RFC1918\n :private\n elsif bytes.starts_with? 198, 18 # Benchmarking; RFC2544\n :reserved\n else\n :public\n end\n end", "title": "" }, { "docid": "d53acc6002e6935f79a8ea0811bce77a", "score": "0.63307685", "text": "def netmask\n return super.to_ip if super\n rescue\n super\n end", "title": "" }, { "docid": "477abb826af5a6df93037050577e273a", "score": "0.63235515", "text": "def netmask_binary\n @netmask_binary ||= (\"1\" * cidr).ljust(32, \"0\")\n end", "title": "" }, { "docid": "2b99950ba65172211245c9f7330e078c", "score": "0.6315805", "text": "def netmask\n @netmask ||= IPAddr.new(\"0b#{netmask_binary}\".oct, Socket::AF_INET)\n end", "title": "" }, { "docid": "f3e2a8addbdef8d1e27ebe70f3a2481d", "score": "0.6314232", "text": "def masked_addrs(addr, mask)\n floats = mask.count(\"X\")\n\n bin = (\"%036b\" % addr.to_i).chars.zip(mask.chars).map do |b, m|\n m == \"0\" ? b : m\n end\n\n bit_combos = (0...2**floats).map do |float|\n (\"%0#{floats}b\" % float).chars\n end\n\n bit_combos.map do |combo|\n addr = bin.dup\n addr.map.with_index do |b, i|\n if b == \"X\"\n addr[i] = combo.shift\n else\n b\n end\n end.join.to_i(2)\n end\nend", "title": "" }, { "docid": "efd61d471cffc189e33d308e5e040154", "score": "0.6304145", "text": "def netmask\n super\n end", "title": "" }, { "docid": "fee1e15f51c54f7563623152f7d6a407", "score": "0.6296297", "text": "def subnet_address_prefix(subnet)\n subnet.address_prefix\n end", "title": "" }, { "docid": "008895d144039f45e0c3f08542bf6de7", "score": "0.6294583", "text": "def cmd_hostmask(irc, line)\n irc.reply \"Your current hostmask is #{irc.from.mask}\"\n end", "title": "" }, { "docid": "008895d144039f45e0c3f08542bf6de7", "score": "0.6294583", "text": "def cmd_hostmask(irc, line)\n irc.reply \"Your current hostmask is #{irc.from.mask}\"\n end", "title": "" }, { "docid": "435119046df48ee997c917fbd849933e", "score": "0.6293398", "text": "def netmask\n\t\taddr = read_attribute(:netmask)\n\t\tIP.new([(read_attribute(:ip_v4))?\"v4\":\"v6\",addr]).to_s\n\tend", "title": "" }, { "docid": "626e61dea50b7c81bd1e939bbe75edfe", "score": "0.62565976", "text": "def get_broadcast_ip(network, mask)\n IPAddr.new(network).|(IPAddr.new(mask).~).to_s\n end", "title": "" }, { "docid": "3fdef1cea5346c0b1a99f526aeb227aa", "score": "0.62309057", "text": "def network_u32\n @u32 & @prefix.to_u32\n end", "title": "" }, { "docid": "bc21b6cfa8d5ee2b6a625d472324135a", "score": "0.6230117", "text": "def mask\n @_mask ||= if @version == 1\n [\n 0x08, 0x40, 0x80, 0x01, 0x20, 0x02, 0x04, 0x10, 0x04, 0x10, 0x01, 0x80,\n 0x08, 0x02, 0x40, 0x20, 0x40, 0x80, 0x08, 0x20, 0x04, 0x10, 0x02, 0x01,\n 0x02, 0x04, 0x10, 0x01, 0x80, 0x40, 0x20, 0x08, 0x80, 0x04, 0x02, 0x20,\n 0x01, 0x08, 0x10, 0x40, 0x01, 0x40, 0x04, 0x20, 0x10, 0x80, 0x08, 0x02,\n 0x10, 0x04, 0x08, 0x40, 0x20, 0x80, 0x01, 0x02, 0x20, 0x40, 0x08, 0x10,\n 0x01, 0x04, 0x02, 0x80\n ]\n else\n [\n 0x08, 0x40, 0x80, 0x01, 0x20, 0x02, 0x04, 0x10, 0x04, 0x10, 0x01, 0x80,\n 0x08, 0x02, 0x40, 0x20, 0x40, 0x80, 0x08, 0x20, 0x04, 0x10, 0x02, 0x01,\n 0x02, 0x04, 0x10, 0x01, 0x80, 0x40, 0x20, 0x08, 0x80, 0x04, 0x02, 0x20,\n 0x01, 0x08, 0x10, 0x40, 0x01, 0x40, 0x04, 0x20, 0x10, 0x80, 0x08, 0x02,\n 0x10, 0x04, 0x08, 0x40, 0x20, 0x80, 0x01, 0x02, 0x20, 0x40, 0x08, 0x10,\n 0x01, 0x04, 0x02, 0x80\n ]\n end\n end", "title": "" }, { "docid": "de45a1ba315ff18443489e4324d25147", "score": "0.61942065", "text": "def cidr_host_addr(network, offset)\n # + 2 to avoid the network and router addresses\n IPAddr.new(network.to_i + RESERVED_ADDRESSES + offset, Socket::AF_INET).to_s\nend", "title": "" }, { "docid": "7a861ccc38e9081e8840a823cd4d12d1", "score": "0.6186922", "text": "def netmask(family, length)\n IPAddr.new(fullmask(family) & ~mask(family, length) , family)\n end", "title": "" }, { "docid": "5c5f3d39ad557ad5db58b81e2ef6787b", "score": "0.61756533", "text": "def netmask()\n bits = IPAdmin.unpack_ip_netmask(:Integer => @netmask)\n return(\"/#{bits}\")\n end", "title": "" }, { "docid": "795f27a796955a3759409d0f4c2cc904", "score": "0.61719704", "text": "def extended()\n\t\t\treturn @base.to_s + \" \" + Util.int_to_IPv4(@m32.mask)\n\t\tend", "title": "" }, { "docid": "54f6b5041ae85fa238e1e70cc35e3de2", "score": "0.6102666", "text": "def network()\n return from(IPAddress.to_network(@host_address, @prefix.host_prefix()), @prefix)\n end", "title": "" }, { "docid": "dbefdce0b6b6ba17aadaba66335cac68", "score": "0.6077501", "text": "def netmask=(val)\n\t\t@ip = mask(@ip, val)\n\t\t@netmask = val\n\tend", "title": "" }, { "docid": "e2593326fc9f85797c1cea044842eeb1", "score": "0.6062292", "text": "def get_network_range(ip, mask)\n formatted_ip = \"#{ip}/#{mask}\"\n ip_range = []\n IPAddr.new(formatted_ip).to_range.each do |ip_object|\n ip_range.push(ip_object.to_s)\n end\n return ip_range\nend", "title": "" }, { "docid": "08c725e9d0c7a0174ab3a807783cf591", "score": "0.60588884", "text": "def get_ip_and_mask()\n IO.popen(@options['ifconfig'] + \" \" + @options['interface']) {|io|\n io.each() { |line|\n case line\n when /\\s*inet\\saddr:([.\\d]+).*Mask:([.\\d]+)/\n @options['address'] = $1\n @options['netmask'] = $2\n end\n }\n }\n end", "title": "" }, { "docid": "a9163f9641ed74b274906efd7a2699a4", "score": "0.6049912", "text": "def packed_netmask()\n return(@netmask)\n end", "title": "" }, { "docid": "0fe09fed78eaae86f0d9569647092ba0", "score": "0.60357714", "text": "def ipv4_masklen\n ipv4_cidr&.netmask&.prefix_len\n end", "title": "" }, { "docid": "08659b289ccc3881cfcaf84c8eeea1b9", "score": "0.6035006", "text": "def cidr_notation\n \"#{self.to_s}/#{self.prefix_length}\"\n end", "title": "" }, { "docid": "ed3590f7c4acaed00641a89728765e06", "score": "0.6032645", "text": "def mask_to_subnet(mask)\n invalid(\"mask\") if mask < 8 || mask > 30\n subnet = []\n for i in 0...mask/8 do subnet[i] = (2**8)-1 end\n mask = mask%8\n while subnet.length < 4\n subnet[subnet.length] = 255-((2**(8-mask))-1)\n mask = 0\n end\n subnet\nend", "title": "" }, { "docid": "e8555eb2fa1910506da6571878a1c7b0", "score": "0.6027828", "text": "def to_u32\n (IN4MASK >> host_prefix) << host_prefix\n end", "title": "" }, { "docid": "4bb86eec7b1100bc71fb5101947c84e0", "score": "0.6020581", "text": "def to_s\n ip_address.size > 1 ? \"#{network}/#{prefix}\" : ip_address.to_s\n end", "title": "" }, { "docid": "887580c7f10f9a5890eca464ace6b624", "score": "0.60103524", "text": "def prefix(netmask)\n CIDR.wrap(self, netmask).min\n end", "title": "" }, { "docid": "783a72c9a8dd1171e4a76e1209511e98", "score": "0.6009301", "text": "def divide_network(address_prefix)\n network_address = IPAddress(address_prefix)\n prefix = nil\n\n case network_address.count\n when 4097..65536\n prefix = \"20\"\n when 256..4096\n prefix = \"24\"\n end\n\n ## if the given network is small then do not divide it else divide using\n ## the prefix value calculated above ##\n prefix.nil? ? address_prefix : network_address.network.address.concat(\"/\" + prefix)\n end", "title": "" }, { "docid": "c17faf11cea5b5a15a159917a649e830", "score": "0.59945023", "text": "def createNethash(subnet, netmask)\n return { \"netmask\" => IPAddr.new(netmask).to_i,\n \"subnet\" => IPAddr.new(subnet).to_i }\nend", "title": "" }, { "docid": "b9216576d023dcd9086f1dce5dff6671", "score": "0.5987249", "text": "def mask(value)\n base_int = @integer & IpAddress.coerce(value, :integer, @version)\n Range.new(IpAddress.new(base_int, @version),\n\t IpAddress.new(base_int + IpAddress.mask_size(value, @version) - 1))\n end", "title": "" }, { "docid": "146cf77f5363d5f938357197b46042b5", "score": "0.5979014", "text": "def bits()\n num = @host_address.toString(2)\n ret = \"\"\n _ = num.length\n while _ < @ip_bits.bits\n ret += \"0\"\n _ += 1\n end\n\n ret += num\n return ret\n end", "title": "" }, { "docid": "a5acd0cc3f9ec0fd93c0486d924f86f9", "score": "0.5970682", "text": "def mask(mask)\n self.class.new(@addr & mask)\n end", "title": "" }, { "docid": "f390cd9a2831a55edc134333d2efe815", "score": "0.5967326", "text": "def mac_address(prefix: '')\n prefix_digits = prefix.split(':').map { |d| d.to_i(16) }\n address_digits = Array.new((6 - prefix_digits.size)) { rand(256) }\n (prefix_digits + address_digits).map { |d| format('%02x', d) }.join(':')\n end", "title": "" }, { "docid": "dc02dbac1743e93b6f211e63100e298f", "score": "0.5966813", "text": "def to_string\n \"::ffff:#{@ipv4.address}/#@prefix\"\n end", "title": "" }, { "docid": "3db9f8dd4ed07aaff43bf479d6fca2bf", "score": "0.59639084", "text": "def bits()\n return netmask().toString(2)\n end", "title": "" }, { "docid": "c98783df0d96fcc79c23c5cfe64cab8a", "score": "0.5963206", "text": "def netmask\n bits = ~ ((1 << (BITS - @subnet)) - 1)\n res = []\n PARTS.times do\n res << (bits & PART_MASK)\n bits >>= BITS_PER_PART\n end\n res.reverse.join('.')\n end", "title": "" }, { "docid": "8927276405e6a4591beb0d5d940ee167", "score": "0.5963013", "text": "def validate(str,\n max_host_bits: nil,\n min_ipv4prefix: nil,\n min_ipv6prefix: nil,\n exclude_0: false,\n exclude_private: false,\n exclude_local: false,\n exclude_loopback: false\n )\n if max_host_bits.present?\n min_ipv4prefix ||= 32 - max_host_bits\n min_ipv6prefix ||= 128 - max_host_bits\n end\n min_ipv4prefix ||= 0\n min_ipv6prefix ||= 0\n ip = IPAddr.new(str)\n if min_ipv4prefix > 0 && ip.ipv4? && ip.prefix < min_ipv4prefix\n return \"prefix is too short (#{ip.prefix}); minimum allowed is #{min_ipv4prefix}\"\n end\n if min_ipv6prefix > 0 && ip.ipv6? && ip.prefix < min_ipv6prefix\n return \"prefix is too short (#{ip.prefix}); minimum allowed is #{min_ipv6prefix}\"\n end\n if exclude_0 && ['0.0.0.0', '::'].include?(ip.to_s)\n return \"address #{ip.to_s} is not allowed\"\n end\n if exclude_private && ip.private?\n return \"private addresses are not allowed\"\n end\n if exclude_local && ip.link_local?\n return \"link local addresses are not allowed\"\n end\n if exclude_loopback && ip.loopback?\n return \"loopback addresses are not allowed\"\n end\n nil\n rescue IPAddr::AddressFamilyError, IPAddr::InvalidAddressError => error\n error.message\n end", "title": "" }, { "docid": "ce946d3910356c20be37927ada9bf02f", "score": "0.59553754", "text": "def prefix_length(netmask)\n mask_addr = netmask.to_i\n return 0 if mask_addr == 0\n length=32\n if (netmask.ipv6?)\n length=128\n end\n\n mask = mask_addr < 2**length ? length : 128\n\n mask.times do\n if ((mask_addr & 1) == 1)\n break\n end\n mask_addr = mask_addr >> 1\n mask = mask - 1\n end\n mask\n end", "title": "" }, { "docid": "3a4e8348c4862eee52fe37af4d450095", "score": "0.5951215", "text": "def wildmask(family, length)\n IPAddr.new(mask(family, length) , family)\n end", "title": "" }, { "docid": "61060c27f8cd7d076e10393691a299f5", "score": "0.5940256", "text": "def to_host\n mask(maxlength)\n end", "title": "" }, { "docid": "6054b646e5ce8c09c8ad9fa729a010f4", "score": "0.5927211", "text": "def valid_ip_prefixes=(value)\n @children['valid-ip-prefixes'][:value] = value\n end", "title": "" }, { "docid": "6054b646e5ce8c09c8ad9fa729a010f4", "score": "0.5927211", "text": "def valid_ip_prefixes=(value)\n @children['valid-ip-prefixes'][:value] = value\n end", "title": "" }, { "docid": "44fbc5b7acd151f499da9f648a852a46", "score": "0.5925092", "text": "def match_hostnames(mask, host)\n mask_pieces = (mask || '').split('.').reverse\n host_pieces = (host || '').split('.').reverse\n return 1 if mask && host && mask_pieces==host_pieces\n return 0 if match_pieces(mask_pieces, host_pieces, :ignore_depth => false)\n nil\n end", "title": "" }, { "docid": "eb095bfd8a485ac53f3741a0ad50a807", "score": "0.5924934", "text": "def to_cidr_s\r\n \"#{ to_s }/#{ self.class.mask2mlen(@mask_addr) }\"\r\n end", "title": "" }, { "docid": "8e6e221b92df3a74bf2b7a25e3f4308e", "score": "0.5917968", "text": "def initialize(arg = nil, prefix: nil, prefix_binary: nil, length: nil, mask: nil, **args)\n\n @fullmask = MASK\n @length = 128\n @max_length = 128\n @address_class = IPv6Addr\n @if_address_class = IPv6IfAddr\n\n if arg\n if arg.kind_of?(Integer)\n @prefix = IPv6Addr.new(arg)\n @length = 128\n elsif arg.respond_to?(:to_ipv6net)\n @prefix = IPv6Addr.new(arg.to_ipv6net.prefix)\n @length = arg.to_ipv6net.length\n elsif defined?(::IPAddr) && arg.kind_of?(::IPAddr)\n @prefix = IPv6Addr.new(arg.to_i)\n @length = arg.prefix\n elsif arg.is_a?(IPv6Addr)\n @prefix = arg\n @length = 128\n elsif arg.respond_to?(:to_s)\n net = arg.to_s\n\n if net =~ /^(.+)\\/(0|[1-9][0-9]*)$/\n @prefix = IPv6Addr.new($1, **args)\n @length = Integer($2, 10)\n else\n raise FormatNotRecognized, \"#{net.inspect}: Format not recognized\"\n end\n else\n raise ArgumentError, \"Cannot initialize from #{arg.inspect}\"\n end\n else\n if prefix\n @prefix = IPv6Addr.new(prefix, **args)\n elsif prefix_binary\n @prefix = IPv6Addr.new(binary: prefix_binary)\n else\n raise ArgumentError, 'Neither prefix or prefix_binary specified'\n end\n\n if length\n @length = length\n elsif mask\n @length = IPv4Net.mask_to_length(IPv4Addr.new(mask).to_i)\n else\n raise ArgumentError, 'Neither length or mask specified'\n end\n end\n\n raise InvalidAddress, \"Length #{@length} less than zero\" if @length < 0\n raise InvalidAddress, \"Length #{@length} greater than #{@max_length}\" if @length > @max_length\n\n @prefix = @prefix.mask(self.mask)\n\n freeze\n end", "title": "" }, { "docid": "f73403a2b857057f4f19f6b0712d61f0", "score": "0.5914669", "text": "def netmask=(value)\n @netmask = value\n end", "title": "" }, { "docid": "12ac120fa911bbfccd10da3ca0543991", "score": "0.5910836", "text": "def validate_ip_netmask(options)\n packed = false\n version = 4\n max_bits = 32\n \n if (options.kind_of?(Hash))\n if (!options.has_key?(:Netmask))\n raise ArgumentError, \"Missing argument: Netmask.\"\n end\n netmask = options[:Netmask]\n \n if (options.has_key?(:Packed) && options[:Packed] == true)\n packed = true\n end\n \n if (options.has_key?(:Version))\n version = options[:Version]\n if (version != 4 && version != 6)\n raise ArgumentError, \":Version should be 4 or 6, but was '#{version}'.\"\n elsif (version == 6)\n max_bits = 128\n else\n max_bits = 32\n end\n end\n \n elsif (options.kind_of?(String) || options.kind_of?(Integer))\n netmask = options\n else\n raise ArgumentError, \"String, Integer, or Hash expected, but #{options.class} provided.\"\n end\n \n if (netmask.kind_of?(String))\n if(netmask =~ /\\./)\n all_f = 2**32-1\n packed_netmask = 0\n \n # validate & pack extended mask\n begin\n validate_ip_addr(:IP => netmask)\n packed_netmask = pack_ip_addr(:IP => netmask)\n rescue Exception\n raise \"#{netmask} is an improperly formed IPv4 address.\"\n end\n\n # cycle through the bits of hostmask and compare\n # with packed_mask. when we hit the firt '1' within\n # packed_mask (our netmask boundary), xor hostmask and\n # packed_mask. the result should be all 1's. this whole\n # process is in place to make sure that we dont have\n # and crazy masks such as 255.254.255.0\n hostmask = 1\n 32.times do \n check = packed_netmask & hostmask\n if ( check != 0)\n hostmask = hostmask >> 1\n unless ( (packed_netmask ^ hostmask) == all_f)\n raise \"#{netmask} contains '1' bits within the host portion of the netmask.\" \n end\n break\n else\n hostmask = hostmask << 1\n hostmask = hostmask | 1\n end\n end\n\n else\n # remove '/' if present\n if (netmask =~ /^\\// )\n netmask[0] = \" \"\n netmask.lstrip!\n end\n\n # check if we have any non numeric characters\n if (netmask =~ /\\D/)\n raise \"#{netmask} contains invalid characters.\"\n end\n\n netmask = netmask.to_i\n if (netmask > max_bits || netmask == 0 )\n raise \"Netmask, #{netmask}, is out of bounds for IPv#{version}.\" \n end\n\n end\n \n elsif (netmask.kind_of?(Integer) )\n if (!packed)\n if (netmask > max_bits || netmask == 0 )\n raise \"Netmask, #{netmask}, is out of bounds for IPv#{version}.\" \n end\n else\n if (netmask >= 2**max_bits || netmask == 0 )\n raise \"Packed netmask, #{netmask}, is out of bounds for IPv#{version}.\"\n end\n end\n \n else\n raise ArgumentError, \"Expected String or Integer, but #{netmask.class} provided.\"\n end\n\n return(true)\nend", "title": "" }, { "docid": "3b5d06f6f2ea5e9d30bad432cacfe346", "score": "0.59073734", "text": "def broadcast_u32\n network_u32 + ((2 ** (32 - @prefix)) - 1)\n end", "title": "" }, { "docid": "1a7059cd9bcc442a53f6f1a56c51d41b", "score": "0.5900306", "text": "def subnet(subprefix)\n if (subprefix < @prefix.num || @ip_bits.bits < subprefix)\n return nil\n end\n\n ret = []\n net = network()\n net.prefix = net.prefix.from(subprefix)\n (1 << (subprefix - @prefix.num)).times do\n ret.push(net.clone())\n net = net.from(net.host_address, net.prefix)\n size = net.size()\n net.host_address = net.host_address.add(size)\n end\n\n return ret\n end", "title": "" }, { "docid": "1fd054e93088dc52c2edfb642ebc6f9b", "score": "0.5894123", "text": "def nic\n @addr & 0x000000ffffffffff\n end", "title": "" }, { "docid": "216038d3dedbc04579839c97aea43499", "score": "0.5893556", "text": "def /(bits)\n mask(IpAddress.mask_from_slash_bits(bits, @version))\n end", "title": "" }, { "docid": "88a3aa90694b9ac9d51bedfc3cdd3753", "score": "0.5891299", "text": "def build_ip(nomask=0, ip=\"#{@resource[:ip]}\", mask=\"#{@resource[:mask]}\")\n k = ip.split('.')\n ip_out = ''\n for i in (0..3)\n if i == 3\n ip_out += \"#{k[i]}\"\n else\n ip_out += \"#{k[i]}.\"\n end\n end\n unless nomask == 0\n ip_out += \"/#{mask}\"\n end\n ip_out\n end", "title": "" }, { "docid": "02d8ead1a2f2ed5da776eca7507514d2", "score": "0.5876863", "text": "def nic\n @addr & 0x000000ffffff\n end", "title": "" }, { "docid": "61433b42efe7afa1ec573c0b21d28a2c", "score": "0.58671314", "text": "def block_address_mask\n return @block_address_mask unless @block_address_mask.nil?\n @block_address_mask = 31\n @block_address_mask\n end", "title": "" }, { "docid": "3dc45cf8d87f4b9dff257f6fd73f5551", "score": "0.5854119", "text": "def addHost(ip, mask)\n hostSnippet = <<SCRIPT\nauto eth1\niface eth1 inet manual\n bond-master bond0\n\nauto eth2\niface eth2 inet manual\n bond-master bond0\n\nauto bond0\niface bond0 inet static\n address %s\n netmask %s\n bond-slaves none\n bond-mode 802.3ad\n bond-miimon 100\n bond-min-links 1\n bond-xmit_hash_policy layer3+4\n bond-lacp-rate 1\n\nSCRIPT\n\n return hostSnippet % [ip, mask]\nend", "title": "" }, { "docid": "09d997124e56636bd21f967d2732ebc0", "score": "0.58468384", "text": "def hexs\n groups(address).map {|i| \"%04x\" % i}\n end", "title": "" }, { "docid": "e9e1ffff2dffdcc1df845dce3317084a", "score": "0.584646", "text": "def network\n self & _netmask\n end", "title": "" }, { "docid": "5571b562811ea3356e57d3fde6486bdf", "score": "0.58403695", "text": "def prefix\n @network_conf[:prefix]\n end", "title": "" }, { "docid": "eeb89a6b85cac4b2af1248aa0a8c12a7", "score": "0.5838534", "text": "def mask; end", "title": "" }, { "docid": "f816e5cb5245eff867c762f7ce094a5f", "score": "0.58222836", "text": "def initialize(arg = nil, prefix: nil, prefix_binary: nil, length: nil, mask: nil, **args)\n\n # TODO implement all inet_aton formats with hex/octal and classful addresses\n\n @fullmask = MASK\n @length = 32\n @max_length = 32\n @address_class = IPv4Addr\n @if_address_class = IPv4IfAddr\n\n if arg\n if arg.kind_of?(Integer)\n @prefix = IPv4Addr.new(arg)\n @length = 32\n elsif arg.respond_to?(:to_ipv4net)\n @prefix = IPv4Addr.new(arg.to_ipv4net.prefix)\n @length = arg.to_ipv4net.length\n elsif defined?(::IPAddr) && arg.kind_of?(::IPAddr)\n @prefix = IPv4Addr.new(arg.to_i)\n @length = arg.prefix\n elsif arg.is_a?(IPv4Addr)\n @prefix = arg\n @length = 32\n elsif arg.respond_to?(:to_s)\n net = arg.to_s\n\n if net =~ /^(.+)\\/(0|[1-9][0-9]*)$/\n @prefix = IPv4Addr.new($1, **args)\n @length = Integer($2, 10)\n else\n raise FormatNotRecognized, \"#{net.inspect}: Format not recognized\"\n end\n else\n raise ArgumentError, \"Cannot initialize from #{arg.inspect}\"\n end\n else\n if prefix\n @prefix = IPv4Addr.new(prefix, **args)\n elsif prefix_binary\n @prefix = IPv4Addr.new(binary: prefix_binary)\n else\n raise ArgumentError, 'Neither prefix or prefix_binary specified'\n end\n\n if length\n @length = length\n elsif mask\n @length = IPv4Net.mask_to_length(IPv4Addr.new(mask).to_i)\n else\n raise ArgumentError, 'Neither length or mask specified'\n end\n end\n\n raise InvalidAddress, \"Length #{@length} less than zero\" if @length < 0\n raise InvalidAddress, \"Length #{@length} greater than #{@max_length}\" if @length > @max_length\n\n @prefix = @prefix.mask(self.mask)\n\n freeze\n end", "title": "" }, { "docid": "5e67c693b08d78186f671eb40353a4a7", "score": "0.58144283", "text": "def FIRST_IPADDRESS(x) x >> 24 & 0xff; end", "title": "" }, { "docid": "9464cbdb24cab4c308af9f660b4eea9b", "score": "0.58134377", "text": "def static_persistence_cidr_mask(opts)\n opts = check_params(opts,[:v6])\n super(opts)\n end", "title": "" }, { "docid": "c782dde322d5802143e9f103e1506cef", "score": "0.5799928", "text": "def hash_ip_address\n # server address refers to the server hosting this rails app\n (\"%02X%02X%02X%02X\" % self.getserveraddress.split('.')).gsub('0', '#')\n end", "title": "" }, { "docid": "94a02dd5392630099dbb5679a345c3ec", "score": "0.57988673", "text": "def customer_ips\n a = (@ip_addr || IPAddr.new(\"#{address}/#{mask}\")).to_range\n if a.to_a.size <= 2 then\n return [a.first]\n end\n \n ar = a.to_a\n \n ar - [ar[0], ar[-1], ar[1]] # network-descr, broadcast and first ip\n end", "title": "" }, { "docid": "0fec9a2ae40b6e4d21ad00b1a5a461b8", "score": "0.5788225", "text": "def GetSubnet()\n \"192.168.3.0/24\"\n end", "title": "" }, { "docid": "de61408a69ab20df1a58f410db4e05ea", "score": "0.5787129", "text": "def nic\n return @addr[3..5].map{|i| \"%02x\" % i }.join(':')\n end", "title": "" }, { "docid": "91b2a2d547f1569d39f2906c742dd27c", "score": "0.5786483", "text": "def netmask_ext() \n if (@version == 4)\n netmask = IPAdmin.unpack_ip_addr(:Integer => @netmask)\n else\n raise \"IPv6 does not support extended netmask notation. \" +\n \"Use netmask() method instead.\"\n end\n\n return(netmask)\n end", "title": "" }, { "docid": "587f0135aa2d72541092226c807903be", "score": "0.57856953", "text": "def network_ip(ip, netmask)\n parts = apply_netmask(ip, netmask)\n parts[3] += 1;\n parts.join(\".\")\n end", "title": "" } ]
415592250385d6fa6f37380671772be8
GET /shops GET /shops.json
[ { "docid": "32ffcf56c85b88d0bfe55a28bb7676e4", "score": "0.0", "text": "def index\n @shops = Shop.all.sort_by{|sh| sh.name.downcase}\n end", "title": "" } ]
[ { "docid": "d4e0ea1f652fc99b8823b20dc3e2214f", "score": "0.8048584", "text": "def index\n @shops = current_user.shops\n\n respond_to do |format|\n format.html\n format.json { render json: @shops }\n end\n end", "title": "" }, { "docid": "26f904ff6663f4ba86a5cd4c9381cd73", "score": "0.77482134", "text": "def index\n @shops = Shop.all\n render json: @shops\n end", "title": "" }, { "docid": "2905e5c1cc31ee3aa6f51f338364cc2b", "score": "0.77251345", "text": "def index\n @shops = Shop.by_user(current_user).all\n\n render json: @shops\n end", "title": "" }, { "docid": "ea478de322d11f81a258775f1a520901", "score": "0.76440763", "text": "def shops (params={})\r\n url = api_url \"/shops\"\r\n \r\n feed_or_retry do\r\n RestClient.get url, request_params(params)\r\n end \r\n end", "title": "" }, { "docid": "dd33a4eef227358978fae1f3abb18c63", "score": "0.7544756", "text": "def index\n @shops = Shop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n end", "title": "" }, { "docid": "dd33a4eef227358978fae1f3abb18c63", "score": "0.7544756", "text": "def index\n @shops = Shop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n end", "title": "" }, { "docid": "c3a02afeeb2acc6f69db17546c62f485", "score": "0.70072764", "text": "def index\n @shops = Shop.all\n end", "title": "" }, { "docid": "c3a02afeeb2acc6f69db17546c62f485", "score": "0.70072764", "text": "def index\n @shops = Shop.all\n end", "title": "" }, { "docid": "c3a02afeeb2acc6f69db17546c62f485", "score": "0.70072764", "text": "def index\n @shops = Shop.all\n end", "title": "" }, { "docid": "c3a02afeeb2acc6f69db17546c62f485", "score": "0.70072764", "text": "def index\n @shops = Shop.all\n end", "title": "" }, { "docid": "c7d5bb6a5c16cc1861e733b70c26d8ff", "score": "0.6892051", "text": "def show\n @shops = Shop.all\n end", "title": "" }, { "docid": "44e25cd5ab731068091aa77124d638dc", "score": "0.6869153", "text": "def show\n @scoop = Scoop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scoop }\n end\n end", "title": "" }, { "docid": "3616e0bc8a1243b407d788b87fb44289", "score": "0.68212074", "text": "def retrieve_shops\n book_ids = @publisher.books.pluck(:id)\n @shops = Shop.selling_books(book_ids).uniq\n if @shops.nil?\n render status: 404, json: {\n message: \"Record not found - cannot find the particular shop that sells books from this publisher\",\n }\n else\n render status: 200, json: @shops, root: \"shops\"\n end\n end", "title": "" }, { "docid": "66e20527a44b112602383b17d91115c1", "score": "0.6780061", "text": "def index\n @shops = Shop.all\n @search = Shop.search(params[:q])\n @shops = @search.result.page(params[:page]).per(30)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end", "title": "" }, { "docid": "ebc8dfd019010de427819737ec2fc39d", "score": "0.67538404", "text": "def show\n render json: @shop\n end", "title": "" }, { "docid": "93cc1e83d42b2deac5f0662799dc146d", "score": "0.67156655", "text": "def index\n @shop_items = ShopItem.all\n render json: @shop_items\n end", "title": "" }, { "docid": "0a267f884b323b3d1e8493fc6eb81951", "score": "0.6701909", "text": "def show\n render json: @shop\n\n end", "title": "" }, { "docid": "915be1be290fbc54326d4d19e3bda774", "score": "0.66115826", "text": "def index\n @workshops = Workshop.all\n end", "title": "" }, { "docid": "915be1be290fbc54326d4d19e3bda774", "score": "0.66115826", "text": "def index\n @workshops = Workshop.all\n end", "title": "" }, { "docid": "60c74890ed0c50531124b6205d65d832", "score": "0.65611607", "text": "def index\n @barber_shops = BarberShop.all\n\n\n\n # render json: @barber_shops\n end", "title": "" }, { "docid": "99fe22b1f8c60a40cc5cfebd0d9c62dd", "score": "0.6548883", "text": "def index\n @workshops = Workshop.all\n\n\n end", "title": "" }, { "docid": "ac307c6bdfc57b81f464460406d667f6", "score": "0.6534419", "text": "def show\n @sop = Sop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sop }\n end\n end", "title": "" }, { "docid": "b1a5795481e0c0013e12dca116a6efe5", "score": "0.6531948", "text": "def show\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end", "title": "" }, { "docid": "b1a5795481e0c0013e12dca116a6efe5", "score": "0.6531948", "text": "def show\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end", "title": "" }, { "docid": "b1a5795481e0c0013e12dca116a6efe5", "score": "0.6531948", "text": "def show\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end", "title": "" }, { "docid": "23ac720392f17fb5a7fba6bd3e0f69a2", "score": "0.65213275", "text": "def retrieve(params = {})\n req = WebPay::ShopIdRequest.create(params)\n raw_response = @client._request(:get, 'shops' + '/' + req.id.to_s, req)\n WebPay::ShopResponse.new(raw_response)\n end", "title": "" }, { "docid": "3ab2e6350f0f714a9dc0424b3122be36", "score": "0.6515741", "text": "def show\n @workshop = Workshop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workshop }\n end\n end", "title": "" }, { "docid": "164caf814762f41c6257b191f1e9ee5d", "score": "0.65094244", "text": "def index\n # FIXME: eventually implement \"load more\" or auto-load more on scroll to bottom\n @workshops = Workshop.order(:created_at).reverse_order\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workshops }\n end\n end", "title": "" }, { "docid": "8ee8ceba1249ed56aae16205d91f4074", "score": "0.6501265", "text": "def index\n @shops = if current_manager\n Organization.find(current_manager.organization_id).shops\n else\n Shop.newest_first\n end\n end", "title": "" }, { "docid": "8c547dd8a297bdb7612b8e3a9d687f73", "score": "0.6483792", "text": "def display_shop_choices\n @shop = api.get_shops.each.with_index(1) do |shop, idx|\n puts <<-REST \n #{idx}. #{shop}\n REST\n end \n end", "title": "" }, { "docid": "ce2c4648e84c9161c09d3478d7dd06de", "score": "0.6455773", "text": "def show\n @shops = Shop.all\n @users = User.all\n end", "title": "" }, { "docid": "84bf9132e7ea9836e9ee17448898ec36", "score": "0.6417297", "text": "def index\n @shoppers = Shopper.all\n\n render json: @shoppers\n end", "title": "" }, { "docid": "4ec21dc9eb51b82bad51d5979b9bee41", "score": "0.6414598", "text": "def show\n @home_indices_shop = Home::Indices::Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_indices_shop }\n end\n end", "title": "" }, { "docid": "654cf70630236fa0011acbce723cae25", "score": "0.63820946", "text": "def index\n @pops = Pop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pops }\n end\n end", "title": "" }, { "docid": "0608de7f18eef28726480e8762ecdf97", "score": "0.6338112", "text": "def index\n @admin_shops = Shop.all\n end", "title": "" }, { "docid": "ba9022cb5494e3e59416be98688606ab", "score": "0.6281029", "text": "def shop\n get(::ShopifyAPI::Shop, :shop) do\n PrefetchWorker.perform_async(@url)\n ::ShopifyAPI::Shop.current\n end\n end", "title": "" }, { "docid": "1cb3086563af4148e8c83343d0cf25c6", "score": "0.62620485", "text": "def top_stories\n get('/topstories.json')\n end", "title": "" }, { "docid": "173d80665f39fac174369e16a5a2fed2", "score": "0.6252974", "text": "def index\n @shop_reviews = ShopReview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_reviews }\n end\n end", "title": "" }, { "docid": "4fb14e118be68a1389499e9cedc1132f", "score": "0.6250193", "text": "def index\n @workshops = Workshop.all\n @workshops = @workshops.order(:name).page(params[:page] || 1)\n end", "title": "" }, { "docid": "fb51261533d8969ac217a8bab977907c", "score": "0.62462217", "text": "def show\n @product_shop = ProductShop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_shop }\n end\n end", "title": "" }, { "docid": "1fb60047039b5bc1e4dfa3ea8c5c1f6b", "score": "0.6233274", "text": "def index\n @shops = current_user.shops.order('position')\n end", "title": "" }, { "docid": "362ee189a9bc27aa84c5c721b1912e40", "score": "0.62220573", "text": "def index\n @shopkeepers = Shopkeeper.all\n\n render json: @shopkeepers\n end", "title": "" }, { "docid": "a52d04a2864a7af4701679d01d46c8d5", "score": "0.62186474", "text": "def index\n @coffe_shops = CoffeShop.all\n end", "title": "" }, { "docid": "28a93b4ea1509b78b9127f4c89ce243f", "score": "0.62180007", "text": "def index\n #検索結果に合うものだけを表示\n @search = Shop.search(params[:q])\n @shops = @search.result\n # @hash = Gmaps4rails.build_markers(@shops) do |shop, marker|\n # marker.lat shop.latitude\n # marker.lng shop.longitude\n # marker.infowindow shop.desc\n # marker.json({title: shop.name, icon: '/images/a.png'})\n #end\n render json: @shops\n end", "title": "" }, { "docid": "f12b5714f97f96dba1f76fdf22c8aeab", "score": "0.6211959", "text": "def index\n @client_shops = ClientShop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client_shops }\n end\n end", "title": "" }, { "docid": "1d058aa96c6bc993412052cde2094efd", "score": "0.62066305", "text": "def show\n render json: @shopkeeper\n end", "title": "" }, { "docid": "bf6bf3459a0ec58ccb56a07282ff0ce9", "score": "0.6200356", "text": "def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'shops', req)\n WebPay::ShopResponseList.new(raw_response)\n end", "title": "" }, { "docid": "5029975566bda817e548806d0020156d", "score": "0.6189134", "text": "def show\n @salesrep = Salesrep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salesrep }\n end\n end", "title": "" }, { "docid": "da82fb5750b3a6f5164828b96c92f446", "score": "0.6178772", "text": "def index\n @karaoke_shops = KaraokeShop.all\n end", "title": "" }, { "docid": "c89dd596b1b88ff71e9f707f7455019b", "score": "0.6171722", "text": "def index\n @orderinshops = Orderinshop.all\n end", "title": "" }, { "docid": "8fce4a271470406dc0f4be3e40875230", "score": "0.6166012", "text": "def show\n render json: @shopper\n end", "title": "" }, { "docid": "c9e89f61326fdd856bc983d1754bbe96", "score": "0.6157975", "text": "def show\n @shop_activity = ShopActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_activity }\n end\n end", "title": "" }, { "docid": "f44c58db0f5f716ba211b3552b42e9cb", "score": "0.61454767", "text": "def index\n @shop_collections = ShopCollection.all\n end", "title": "" }, { "docid": "01dd95864f1f327dea09b8ad1c4395ae", "score": "0.6118628", "text": "def index\n response.headers['X-Total-Count'] = @shops.count.to_s\n if params[:page].present?\n @shops = @shops.page(params[:page])\n @shops = @shops.per(params[:per]) if params[:per].present?\n response.headers[\"X-total\"] = @shops.total_count.to_s\n response.headers[\"X-offset\"] = @shops.offset_value.to_s\n response.headers[\"X-limit\"] = @shops.limit_value.to_s\n end\n\n _render collection: @shops\n end", "title": "" }, { "docid": "c54825469f1edc366e581a0ad5dd4f0c", "score": "0.6093995", "text": "def index\n @assets = Asset.find(\n :all,\n :conditions => { :shop_id => current_user.shop.id }\n )\n render :json => @assets \n end", "title": "" }, { "docid": "dc42d7f7f9930b19d86eb8dc9e8e5184", "score": "0.6079222", "text": "def index\n @sops = Sop.all\n end", "title": "" }, { "docid": "33b236fc820c4031b68957f25473baa8", "score": "0.60784894", "text": "def show\n @shop = current_mall.shops.find(params[:id])\n @activities = @shop.activities\n end", "title": "" }, { "docid": "a2d613e6296a7e87e1c6350704d66d05", "score": "0.60751045", "text": "def show\n @shop = Shop.find_by_uuid(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @shop }\n end\n end", "title": "" }, { "docid": "c24c6a6be451c2b97088789d6b7493ef", "score": "0.60739714", "text": "def index\n result = @shop.get_wares 'ALL'\n render json: result.to_json\n end", "title": "" }, { "docid": "519cdd1cd538e8af225daabbe8de662b", "score": "0.60712", "text": "def index\n @shops = apply_scopes(Shop).paginate :page => params[:page], :per_page => params[:per_page]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shops }\n end\n end", "title": "" }, { "docid": "eeb88d61b68d8975195251c93e2be5c6", "score": "0.60679793", "text": "def show\n @shopping = Shopping.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopping }\n end\n end", "title": "" }, { "docid": "2300b46882d481d96b9fa980f737bb6d", "score": "0.6064305", "text": "def index\n @shop_directors = ShopDirector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_directors }\n end\n end", "title": "" }, { "docid": "ab914a10725f780bd54c2d47dcfb5a97", "score": "0.60623664", "text": "def index\n @wents = Went.all\n if params[:shop_id].present?\n went = Went.find_by(user_id: current_user.id, shop_id: params[:shop_id])\n render json: {status: 'success', went: went, counts: Went.where(shop_id: params[:shop_id]).count, wented: went.present?}\n end\n end", "title": "" }, { "docid": "93c53a044626f2f0ba93c79b442cc639", "score": "0.6056748", "text": "def index\n @sodapops = Sodapop.all\n end", "title": "" }, { "docid": "f15c9679448fc4de3ac6b169e0348beb", "score": "0.6042017", "text": "def get_shop\n @shop = Shop.find(params[:shop_id])\n end", "title": "" }, { "docid": "651c202f9f75edfe352f0e4b5d48925b", "score": "0.6032333", "text": "def index\n @shop_stores = ShopStore.all\n end", "title": "" }, { "docid": "4bd0c6d11793767fc5c8e9b6609d9778", "score": "0.60296094", "text": "def index\n @shipping_categories = @shop.shipping_categories\n respond_to do |format|\n format.html\n format.json { render json: @shipping_categories }\n end\n end", "title": "" }, { "docid": "ab8b36e0e8eedd1067d8b58772370d6f", "score": "0.6028603", "text": "def index\n @stores = Store.all\n\n render json: @stores\n end", "title": "" }, { "docid": "37d0768281530126496eb6cdf4478e67", "score": "0.6003062", "text": "def index\n @shop_items = ShopItem.all\n end", "title": "" }, { "docid": "8238f694f5a94d19c8dee3260843b6be", "score": "0.59982085", "text": "def shop\n @shop = Shop.all\n end", "title": "" }, { "docid": "7227d4692c24f06e08f4768c7576fa7e", "score": "0.5982603", "text": "def show\n render json: @sales_rep\n end", "title": "" }, { "docid": "30710fbff9b2e60130ff076f8f922855", "score": "0.5980067", "text": "def index\n @stroops = Stroop.all\n end", "title": "" }, { "docid": "39f2271dd861d7077f88793792757157", "score": "0.59791464", "text": "def index\n @sales_reps = SalesRep.all\n\n render json: @sales_reps\n end", "title": "" }, { "docid": "25ac868a29871913707a0e1106ad1b24", "score": "0.59775037", "text": "def index\n @shops = Shop.all.paginate :page => params[:page], :order=>'created_at desc',\n :per_page => @@per_page_item\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shops }\n end\n end", "title": "" }, { "docid": "a91a3cd7faadabd08b068e44ad14943d", "score": "0.59762555", "text": "def show\n @shop_review = ShopReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_review }\n end\n end", "title": "" }, { "docid": "665fac0fa307347578807b8664b55dfc", "score": "0.59758997", "text": "def index\n @yoga_workshops = YogaWorkshop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @yoga_workshops }\n end\n end", "title": "" }, { "docid": "e49e0d36703e9af3c1dad62f723eacdf", "score": "0.5974269", "text": "def show\n @shopping = Shopping.find(params[:id])\n\n @companies_count = @shopping.companies.all.count\n\n @user = current_user\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopping }\n end\n end", "title": "" }, { "docid": "d892d66ad470309fc2f6a28ffdf484f7", "score": "0.59724325", "text": "def show\n @shops = ShopService.get_shops_with_books_by_publisher(params[:slug])\n @shop_keys = @shops.keys\n render 'publishers/show'\n end", "title": "" }, { "docid": "2a28e0a86e9ef7aa4d17264a49ccc61c", "score": "0.5955816", "text": "def index\n @promotions = @shop.promotions\n\n respond_to do |format|\n format.html\n format.json { render json: @promotions }\n end\n end", "title": "" }, { "docid": "755ea1e4411a31641934741d3b00fd74", "score": "0.5941786", "text": "def index\n @drink_shops = DrinkShop.all\n end", "title": "" }, { "docid": "9f7ff9c5fa2662387037684066c4ce5e", "score": "0.5937799", "text": "def index\n @shop_sections = ShopSection.all\n end", "title": "" }, { "docid": "3bc8f0d070c0b38b332711be8726c2d7", "score": "0.59363794", "text": "def index\n @sprints = Sprint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end", "title": "" }, { "docid": "2bcdde306a9e529b480990e7730b3b88", "score": "0.59342265", "text": "def show\n @shop = Shop.find_by(:name => params[:id])\n unless @shop.blank?\n @content = PanamaCore::Contents.fetch_for(@shop, :index, :locals => { :shop_name => @shop.name })\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @shop }\n end\n end", "title": "" }, { "docid": "0266651cd5099f12adc39b55630056c2", "score": "0.5915005", "text": "def show\n @pawnshop = Pawnshop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pawnshop }\n end\n end", "title": "" }, { "docid": "32b346e5ef1b1ae3dd03582f7dc2eb69", "score": "0.59146726", "text": "def stories(options = {})\n # v1/public/stories\n get('stories', options)\n end", "title": "" }, { "docid": "85f624b9ca21e24fec1a59dafa0c20e1", "score": "0.5909196", "text": "def index\n @sites = Site.all\n render json: @sites\n end", "title": "" }, { "docid": "93d7b36794b96380caa881cc274f58ea", "score": "0.5898964", "text": "def show\n render json: MangaBookshelf.find_shelves(params[:id])\n end", "title": "" }, { "docid": "02d360100576f6bdda5b89922ab50ee1", "score": "0.5889718", "text": "def show\n @shops_request = ShopsRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shops_request }\n end\n end", "title": "" }, { "docid": "6b8e41480ceba0bc7c11ec749f909323", "score": "0.58761543", "text": "def show\n @shoe = current_user.shoes.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shoe }\n end\n end", "title": "" }, { "docid": "324916f9e1a0bf512fd84fd88b3c33fc", "score": "0.5872568", "text": "def index\n @stocks = Stock.all\n\n render json: @stocks\n end", "title": "" }, { "docid": "a61df344da8bff4fa36c76804fc88c06", "score": "0.58698124", "text": "def index\n @stocker_items = StockerItem.all\n render json: @stocker_items\n end", "title": "" }, { "docid": "c61af28186346db48ff6c48bc42da2b8", "score": "0.58586824", "text": "def index\n @scat2s = Scat2.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scat2s }\n end\n end", "title": "" }, { "docid": "3de8b553c1bd2362da0e66716369524e", "score": "0.5858396", "text": "def show\n @shop_director = ShopDirector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_director }\n end\n end", "title": "" }, { "docid": "235fc962767efa7b748df1dd23560f34", "score": "0.58575857", "text": "def index\n @siteships = Siteship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @siteships }\n end\n end", "title": "" }, { "docid": "5ddb11c1dd7e371bebc83f44f607c64b", "score": "0.5854196", "text": "def index\n @shop_stylists = ShopStylist.all\n end", "title": "" }, { "docid": "3b47d22f46c981904284b7e081aa556b", "score": "0.5852237", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopping_list }\n end\n end", "title": "" }, { "docid": "10fbfc221e5d395f491e3b4f03c96c89", "score": "0.5849839", "text": "def index\n @meetup_shops = MeetupShop.all\n end", "title": "" }, { "docid": "0ce5890d301b14b0afc923ab592fca09", "score": "0.58482987", "text": "def index\n @sales = Sale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales }\n end\n end", "title": "" }, { "docid": "0ce5890d301b14b0afc923ab592fca09", "score": "0.58482987", "text": "def index\n @sales = Sale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales }\n end\n end", "title": "" }, { "docid": "7c65a7f97d03b6b3e2d3e47eb9feed35", "score": "0.58451986", "text": "def show\n render json: @repo\n end", "title": "" }, { "docid": "ac037eab4dafd3365938045763364055", "score": "0.5835721", "text": "def index\n @shoes = current_user.shoes.sichtbar\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\n end\n end", "title": "" } ]
bdde50edc827d51e5b84280762a1030a
returns actual URI object
[ { "docid": "4ce84c6023f325fd1ae7fdbfb051d3a6", "score": "0.0", "text": "def fedora_uri\n # We hope this is the right way to get the actual uri to fetch cheaply?\n # a bit sketchy we're calling it on FileSet not File, but File doesn't\n # have this API, and it seems to work.\n @fedora_uri ||= URI.parse(FileSet.translate_id_to_uri.call(file_id))\n end", "title": "" } ]
[ { "docid": "8dfabbfefa23185830dba3b95458932b", "score": "0.80390424", "text": "def to_uri\n URI.parse self\n end", "title": "" }, { "docid": "605b17a0458c33cf9b01f2a75af0a709", "score": "0.8028456", "text": "def uri\n URI.new :scheme => scheme,\n :host => host,\n :path => path,\n :query => query\n end", "title": "" }, { "docid": "886e2940802342f0baef24a89c1d6219", "score": "0.79802316", "text": "def uri\n @uri ||= URI.parse @url if @url\n @uri\n end", "title": "" }, { "docid": "c60e079deba817feb489be2d7c8589c3", "score": "0.79747224", "text": "def uri\n @uri ||= URI(url)\n end", "title": "" }, { "docid": "ed4eabd8373baf5a475627dddfc114d8", "score": "0.79575086", "text": "def getURI()\n return @uri.to_s\n end", "title": "" }, { "docid": "6beb900f4b5a799ba8122f3207d71380", "score": "0.7906486", "text": "def uri\n @uri ||= select { |type,value| type == :uri }.map do |(type,value)|\n URI.parse(value)\n end\n end", "title": "" }, { "docid": "9b3edfa430d86f0aa8ad6c13a7e78ad0", "score": "0.7900021", "text": "def uri\n @uri.to_s\n end", "title": "" }, { "docid": "b06f06a29b690bdbd48239ed09139e5b", "score": "0.78946847", "text": "def uri\n @_uri ||= URI(@url)\n end", "title": "" }, { "docid": "b06f06a29b690bdbd48239ed09139e5b", "score": "0.78946847", "text": "def uri\n @_uri ||= URI(@url)\n end", "title": "" }, { "docid": "e1dd4705bc628aa3c881d9491f65f9b2", "score": "0.78086054", "text": "def to_uri\n build_uri\n end", "title": "" }, { "docid": "e5db5001a7fe2d1ced768381f76b84ed", "score": "0.77961695", "text": "def uri\n @uri\n end", "title": "" }, { "docid": "e5db5001a7fe2d1ced768381f76b84ed", "score": "0.77961695", "text": "def uri\n @uri\n end", "title": "" }, { "docid": "f4bd94d4267c13e3ec22e4591e0b4b68", "score": "0.7749685", "text": "def uri\n @uri\n end", "title": "" }, { "docid": "f4bd94d4267c13e3ec22e4591e0b4b68", "score": "0.7749685", "text": "def uri\n @uri\n end", "title": "" }, { "docid": "0e25422f42e5a3c17126ee29ccd2c3e3", "score": "0.77338034", "text": "def uri\n uri_for({}, nil)\n end", "title": "" }, { "docid": "66de355365f4ee7b1795b0a96ff52133", "score": "0.7727054", "text": "def uri\n N::URI.new(self[:uri])\n end", "title": "" }, { "docid": "66de355365f4ee7b1795b0a96ff52133", "score": "0.7727054", "text": "def uri\n N::URI.new(self[:uri])\n end", "title": "" }, { "docid": "844ef8f32faa7721f1abdd675a685e7d", "score": "0.7721076", "text": "def uri\n @uri ||= URI.parse(url)\n end", "title": "" }, { "docid": "868db399cd86254fd2178eb92411c53a", "score": "0.77108175", "text": "def uri\n @uri ||= if @href then\n begin\n URI.parse @href\n rescue URI::InvalidURIError\n begin\n URI.parse(Addressable::URI.escape(@href))\n rescue Addressable::URI::InvalidURIError\n raise URI::InvalidURIError\n end\n end\n end\n end", "title": "" }, { "docid": "fe4d43b96397a81c2b8f9e8c47b3d014", "score": "0.76578945", "text": "def url\n uri.to_s\n end", "title": "" }, { "docid": "3b9e3de2c9f293e9a5edad9cf2ddc3f1", "score": "0.7619893", "text": "def uri_path\n __getobj__.uri.path\n end", "title": "" }, { "docid": "a274f88ab3f5ededcef8a2001c247da7", "score": "0.76158303", "text": "def url\n uri\n end", "title": "" }, { "docid": "a274f88ab3f5ededcef8a2001c247da7", "score": "0.76158303", "text": "def url\n uri\n end", "title": "" }, { "docid": "f098da8fc98a644a0e79d688095511d8", "score": "0.76096404", "text": "def uri\n self + \"\"\n end", "title": "" }, { "docid": "f098da8fc98a644a0e79d688095511d8", "score": "0.76096404", "text": "def uri\n self + \"\"\n end", "title": "" }, { "docid": "db0efa8dcba2a74efcb5ccfa25b955f0", "score": "0.76086354", "text": "def to_s\n uri\n end", "title": "" }, { "docid": "aa92f8bb554cb34f7779cb417470b5a9", "score": "0.76045257", "text": "def uri\n return @uri\n end", "title": "" }, { "docid": "aa92f8bb554cb34f7779cb417470b5a9", "score": "0.76045257", "text": "def uri\n return @uri\n end", "title": "" }, { "docid": "0fc165d0edf51f59bf19f34f286545b8", "score": "0.7604224", "text": "def to_uri\n uri_class = ::URI.const_get scheme.upcase\n uri_class.build host: host, path: path\n end", "title": "" }, { "docid": "072e56c4f213454db598f3201912ea34", "score": "0.75978935", "text": "def get_uri\n request_object.uri\n end", "title": "" }, { "docid": "ba23f747e9dff87e2596fd2e8d5af39e", "score": "0.7593574", "text": "def URI(url); end", "title": "" }, { "docid": "04feb660b535ee5e74e35c2bde68bf51", "score": "0.7587656", "text": "def uri\n raise NotImplementedError\n end", "title": "" }, { "docid": "ec365231a4ea296b61d93c4d79ee3b0e", "score": "0.7555696", "text": "def url\n uri.to_s\n end", "title": "" }, { "docid": "6f7640b67e9f62305830f6c7008e3f1e", "score": "0.75276476", "text": "def to_uri\n URI.parse(url)\n end", "title": "" }, { "docid": "beca7a76762f69dcb4c7165b46daacaf", "score": "0.7510801", "text": "def to_s\n uri_string\n end", "title": "" }, { "docid": "e8d623568753545bc21f9ae54ecb0c9e", "score": "0.7502812", "text": "def full_uri\n \"#{host_uri}#{uri}\"\n end", "title": "" }, { "docid": "1a1ea32f885872bd9285bc8d4b105037", "score": "0.74903053", "text": "def to_uri\n URI.parse(to_s)\n end", "title": "" }, { "docid": "55acb10df3a1717d9678e2c8b0f719f7", "score": "0.74324596", "text": "def resolved_uri; end", "title": "" }, { "docid": "a462cbc79a1e66bb27ac0fe5b9c2f172", "score": "0.74088454", "text": "def to_addressable_uri\n @uri\n end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "8a7e8a002f85b45785529684a7ec5703", "score": "0.7399413", "text": "def uri; end", "title": "" }, { "docid": "d62589d845e4f53057d8246e376f3817", "score": "0.7397287", "text": "def uri\n @uri ||= begin\n uri = Addressable::URI.parse(sanitize_link(@link_string))\n uri.normalize\n uri.query_values = nil\n uri\n end\n end", "title": "" }, { "docid": "97621b00d37cc4d21a1e5ee86ab25a17", "score": "0.7382737", "text": "def uri\n \"#{base_uri}#{path}\"\n end", "title": "" }, { "docid": "ac9f8959e4d52abed4590fc14f07be79", "score": "0.7365076", "text": "def uri\n uri_prefix + Digest::MD5.hexdigest(self.address)\n end", "title": "" }, { "docid": "155eb716d7f0c5bfd317382d5e2df3a1", "score": "0.73320585", "text": "def create_uri\n end", "title": "" }, { "docid": "e897a58cd8c0ce6737e9e8ccdf513a84", "score": "0.7318326", "text": "def uri\n read_attr :uri\n end", "title": "" }, { "docid": "7fc63ba1ea5704c2a0f1765d7f31079c", "score": "0.72935134", "text": "def uri\n if host && !request_uri.host\n request_uri.dup.tap do |uri|\n uri.scheme = 'http'\n uri.host = host\n end\n else\n request_uri\n end\n end", "title": "" }, { "docid": "3f862f00aaaf8ed89bb99dfa3074cfd0", "score": "0.7287381", "text": "def uri_for(uri_or_path, params = nil)\n if uri_or_path.kind_of? URI\n u = uri_or_path.dup\n\n u.host = @uri.host\n u.port = @uri.port\n u.scheme = @uri.scheme\n else\n u = uri.dup\n u.path = File.join(uri.path, uri_or_path)\n end\n\n u.query = query_string_for(params) if params\n u.to_s\n end", "title": "" }, { "docid": "45f971a8f0633bf50fa7b983852537c5", "score": "0.7286621", "text": "def to_s\n self.uri.to_s\n end", "title": "" }, { "docid": "db9a2a4be3987efac544bcfb6206f858", "score": "0.7286401", "text": "def full_uri(path)\n raise NotImplementedError\n end", "title": "" }, { "docid": "0e399de021211bb4f9a3b16267cf8b1c", "score": "0.72834563", "text": "def to_s\n uri.to_s\n end", "title": "" }, { "docid": "26e60e90716bfd014ff48922ee80d415", "score": "0.72505116", "text": "def to_s\n @uri\n end", "title": "" }, { "docid": "eb765ecda8a35c8c8f3e81d9469b4262", "score": "0.7239065", "text": "def uri( new_uri=nil )\n\t\tif new_uri\n\t\t\t@uri = URI( new_uri )\n\t\t\t@uri.host ||= self.addresses.first.to_s\n\n\t\t\tself.app_protocol( @uri.scheme )\n\t\t\tself.port( @uri.port )\n\t\tend\n\n\t\treturn @uri.to_s\n\tend", "title": "" }, { "docid": "d3b7cb488d771cc95e57e6ed93ceea9f", "score": "0.7230271", "text": "def get\n uri\n super()\n end", "title": "" }, { "docid": "d3b7cb488d771cc95e57e6ed93ceea9f", "score": "0.7230271", "text": "def get\n uri\n super()\n end", "title": "" }, { "docid": "d3b7cb488d771cc95e57e6ed93ceea9f", "score": "0.7230271", "text": "def get\n uri\n super()\n end", "title": "" }, { "docid": "9753ffefb12649483f6a014baa4bc418", "score": "0.7217838", "text": "def to_uri\n URI(normalise)\n end", "title": "" }, { "docid": "b9678702430196c3c5b94b534fc986b2", "score": "0.72134113", "text": "def process_uri(uri)\n ret = uri\n\n require 'open-uri'\n require 'open_uri_redirections'\n begin\n open(uri, :allow_redirections => :safe) do |r|\n ret = r.base_uri.to_s\n end\n end\n\n ret\n end", "title": "" }, { "docid": "d22e7c59a8674992f85d442c0e14b37c", "score": "0.721157", "text": "def to_uri\n URI(normalize)\n end", "title": "" }, { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.7188939", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.7188939", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "264df5224f98da6df32a00f94a296efe", "score": "0.71829563", "text": "def uri_endpoint\n URI( self.endpoint )\n end", "title": "" }, { "docid": "c8cb17c291b447223818a659d712b2bd", "score": "0.71555877", "text": "def to_s\n @uri\n end", "title": "" }, { "docid": "deb3177c2879e871a1a6c6ac8f1211a5", "score": "0.71497315", "text": "def uri\n nil\n end", "title": "" }, { "docid": "92224534e9399cbdaa346a6d935460a1", "score": "0.71356285", "text": "def uri\n \n end", "title": "" }, { "docid": "f68f59e93864264be42cb8008b6ff3bc", "score": "0.7129969", "text": "def to_s\n reconstruct_uri\n end", "title": "" }, { "docid": "dca0465e235e2844bcd1adfa2a359f67", "score": "0.7129733", "text": "def uri\n URI::Generic.build(host: addr, port: port)\n end", "title": "" }, { "docid": "dca0465e235e2844bcd1adfa2a359f67", "score": "0.7129733", "text": "def uri\n URI::Generic.build(host: addr, port: port)\n end", "title": "" }, { "docid": "da5906cb3c535f56783cfde50fca3929", "score": "0.71222746", "text": "def uri=(_arg0); end", "title": "" }, { "docid": "da5906cb3c535f56783cfde50fca3929", "score": "0.71222746", "text": "def uri=(_arg0); end", "title": "" }, { "docid": "da5906cb3c535f56783cfde50fca3929", "score": "0.71222746", "text": "def uri=(_arg0); end", "title": "" }, { "docid": "da5906cb3c535f56783cfde50fca3929", "score": "0.71222746", "text": "def uri=(_arg0); end", "title": "" }, { "docid": "b5edd962e8a7bf9cbea6ae125569a635", "score": "0.7092421", "text": "def get_uri\n unless self.uri == nil\n return self.uri\n else \n return repository.generate_uri(title)\n end\n end", "title": "" }, { "docid": "bfd5bdb5dab2597c68ca5926a51478a2", "score": "0.7039826", "text": "def path\n @uri.path\n end", "title": "" }, { "docid": "97ec2192052fb50d067d6b0c0fbde555", "score": "0.70317864", "text": "def uri\n @uri ||= URI.parse(\"http://\" + domain)\n end", "title": "" }, { "docid": "ab9208c61b5cae8494054e0f028b9f22", "score": "0.7029037", "text": "def result\n ::RDF::URI.new(value.sub(/^uri-/, ''))\n end", "title": "" }, { "docid": "be9cd1db18135a8fa052e12332ae90cc", "score": "0.7027607", "text": "def uri\n # special parsing is done to remove the protocol, host, and port that\n # some Handlers leave in there. (Fixes inconsistencies.)\n URI.parse(self.env['REQUEST_URI'] || self.env['PATH_INFO']).path\n end", "title": "" }, { "docid": "2deb5d2dea2cb0606ceaacdcc1ebbe4c", "score": "0.7013731", "text": "def uri\n attributes.fetch(:uri)\n end", "title": "" }, { "docid": "2deb5d2dea2cb0606ceaacdcc1ebbe4c", "score": "0.7013731", "text": "def uri\n attributes.fetch(:uri)\n end", "title": "" }, { "docid": "8cbf6b745a2764cf824b1006fbb591a0", "score": "0.7012358", "text": "def path\n @uri.request_uri\n end", "title": "" }, { "docid": "a71bccd795d88f4d31a9d0084adf53a3", "score": "0.6996016", "text": "def process_uri(uri)\n require 'open-uri'\n require 'open_uri_redirections'\n open(uri, :allow_redirections => :safe) do |r|\n r.base_uri.to_s\n end\n end", "title": "" }, { "docid": "7cc4a027cf6ac2d556c529b375281090", "score": "0.6972957", "text": "def uri(path)\n return File.join(@base_url, path)\n end", "title": "" }, { "docid": "c043080926ebb1f35d2f31b791b05d94", "score": "0.6968683", "text": "def uri\n \"http://example.com#{base_path}#{anchor}\"\n end", "title": "" }, { "docid": "84fec59c7efdd7d155135930491898c7", "score": "0.69660586", "text": "def uri\n\t\turi = self.directory.uri\n\t\turi.dn = self.dn\n\t\treturn uri\n\tend", "title": "" }, { "docid": "aa1bd15228fbe2703998aede9c6f3c23", "score": "0.69450974", "text": "def square_uri\n square_params\n uri\n end", "title": "" }, { "docid": "c76f86a54840f0151114e7287196f5b3", "score": "0.69235224", "text": "def to_uri info: false\n if info\n URI(_info_uri)\n else\n URI(_http_url)\n end\n end", "title": "" }, { "docid": "cb67d950369ae419cdc78abd086ab244", "score": "0.6921926", "text": "def uri\n \"http://#{hostname}:#{port}#{path}\"\n end", "title": "" }, { "docid": "688b9fd7f485a82fb1cb4686b27e63ee", "score": "0.6902008", "text": "def uri(*parts)\n # If an absolute URI already\n return parts.first if parts.first.is_a?(URI) && parts.first.host\n\n joined = [url, *parts].map(&:to_s).reject(&:empty?) * '/'\n\n URI.parse(joined)\n end", "title": "" }, { "docid": "90e60aef11b728588c64d6b320f89f8f", "score": "0.689982", "text": "def uri\n Util.join_uri(self.class.uri, self.id)\n end", "title": "" }, { "docid": "48254e23f15699497dc98665574ed980", "score": "0.6893436", "text": "def get_URI()\n \t return @outputs[\"URI\"]\n \tend", "title": "" }, { "docid": "48254e23f15699497dc98665574ed980", "score": "0.6893436", "text": "def get_URI()\n \t return @outputs[\"URI\"]\n \tend", "title": "" } ]
cdcd6e35d38fb796be35db215b4f8d8a
GET /series GET /series.json
[ { "docid": "d2852c948b6039bcfa0dc0d68bafc128", "score": "0.0", "text": "def index\n if user_signed_in?\n if current_user.admin\n @series = Serie.all\n else\n @admins = User.where(admin: true)\n @series = Serie.where(user_id: current_user.id)\n @series = @series + Serie.where(user_id: current_user.parent_id)\n @admins.each do |adm|\n @series = @series.or(Serie.where(:user_id => adm.id))\n end\n end\n else\n @admins = User.where(:admin => true)\n @series = Serie.where(user_id: -1)\n @admins.each do |adm|\n @series = @series.or(Serie.where(:user_id => adm.id))\n end\n end\n unless @series.empty?\n @series = @series.where('lower(name) LIKE ?', \"%#\"+params[:search]+\"%\".downcase) if params[:search].present?\n @series = @series.where(\"tipo_id = ?\", :tipo_id) if params[:tipo_id].present?\n end\n end", "title": "" } ]
[ { "docid": "51c45b66ed383b19456d9045db0bef39", "score": "0.8057892", "text": "def series(options = {})\n # v1/public/series\n get('series', options)\n end", "title": "" }, { "docid": "1a6d89ef91f80408d72ff8bff03c0fd5", "score": "0.79581946", "text": "def index\n @series = Series.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @series }\n end\n end", "title": "" }, { "docid": "93dccc466499f75a1592abbc7bd7240d", "score": "0.78792185", "text": "def show\n @series = Series.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series }\n end\n end", "title": "" }, { "docid": "6a9d26d938daa4a03513b0b6930b5caf", "score": "0.7868217", "text": "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series }\n end\n end", "title": "" }, { "docid": "9c46e2c3e34f6fd61d57da94994be49c", "score": "0.78121066", "text": "def show\n @series = Serie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @series }\n end\n end", "title": "" }, { "docid": "5ce97ae37a357cb38a020590a10f930c", "score": "0.7641617", "text": "def index\n @series = Serie.where(ativo: true).where(usuario: current_usuario)\n render json: @series.map(&:encode)\n end", "title": "" }, { "docid": "97a10297f976dd44142712e25b4697d0", "score": "0.752809", "text": "def index\n @series = Serie.all\n end", "title": "" }, { "docid": "4b54ed94ba94ab9bb46044af503ebe60", "score": "0.7438118", "text": "def show\n respond_with(@series)\n end", "title": "" }, { "docid": "3edbf04b685a473371126b26776fa1a8", "score": "0.73919153", "text": "def show\n @series = Series.where(:id => params[:id].split(','))\n @data = @series.flat_map(&:data)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series }\n end\n end", "title": "" }, { "docid": "ad876f9ce804acfcad80e3da0c3591d8", "score": "0.73842645", "text": "def show\n @series_list = SeriesList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series_list }\n end\n end", "title": "" }, { "docid": "31b6154ed40e52776f96d627bf7a2caf", "score": "0.7311368", "text": "def show\n @tv_series = TvSerie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_series }\n end\n end", "title": "" }, { "docid": "4ae2a0eca51845ae3c618fa53627f6dd", "score": "0.72168136", "text": "def resource\n @series\n end", "title": "" }, { "docid": "538c7f6a76d8b7aa177cd10b2788d9ad", "score": "0.7137515", "text": "def event_series(id, options = {})\n # vi/public/events/{eventId}/series\n get(\"events/#{id}/series\", options)\n end", "title": "" }, { "docid": "9e047d005177225444d35064e1ed66eb", "score": "0.7104788", "text": "def set_series\n begin\n @series = Series.find(params[:id])\n rescue\n render json: @series, status: :not_found\n end\n end", "title": "" }, { "docid": "489574bc60e3290b58070a2cc69eacc9", "score": "0.71037585", "text": "def index\n @series = Series.all\n end", "title": "" }, { "docid": "57b90e90b0954951b0dfb32ad80e62c7", "score": "0.70999396", "text": "def show\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "1367c7875b1b76246974fbae31c1da60", "score": "0.7070179", "text": "def index\n @series = Serie.viewable_series(current_user)\n end", "title": "" }, { "docid": "8657c466683240d2ba8afaee5f874cce", "score": "0.7061328", "text": "def time_series\n respond_to do |format|\n format.json {\n render json: Api::V1.time_series(params[:time_series_id], clean_filtered_params(request.filtered_parameters)), each_serializer: TimeSeriesSerializer, callback: params[:callback]\n }\n end\n end", "title": "" }, { "docid": "a2927420f6d7bd24a8066a0d6ae09dc6", "score": "0.7054354", "text": "def new\n @series = Serie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @series }\n end\n end", "title": "" }, { "docid": "a0e1c00b7faac6f6c9bc8a0e8ee6b06a", "score": "0.70372176", "text": "def serie(id, options = {})\n # v1/public/series/{seriesId}\n get(\"series/#{id}\", options)\n end", "title": "" }, { "docid": "9f0a1b653eeccaf591a028b131bcefbc", "score": "0.70065296", "text": "def new\n @series = Series.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @series }\n end\n end", "title": "" }, { "docid": "882c165d7daceb9ba0af3bb9a9c147cd", "score": "0.6931838", "text": "def story_series(id, options = {})\n # v1/public/stories/{storyId}/series\n get(\"stories/#{id}/series\", options)\n end", "title": "" }, { "docid": "88317ca15172a52c2565ab1618005627", "score": "0.69090307", "text": "def show\n @series = Series.find params[:id]\n end", "title": "" }, { "docid": "52b72f2080283800ca0fbff5c2567a43", "score": "0.68420124", "text": "def index\n @charts = Chart.all\n\n render json: @charts\n end", "title": "" }, { "docid": "b76a9e80c2fcd3ca9c871f4cdea7b2cd", "score": "0.6837483", "text": "def show\n stock = @alphavantage_client.stock symbol: @stock.symbol\n interval = params[:interval].presence || \"5min\"\n data_path = \"./stock_data/#{@stock.symbol}-#{interval}.json\"\n Dir.mkdir('./stock_data') unless Dir.exist?('./stock_data')\n if !File.exist?(data_path)\n timeseries = stock.timeseries type: \"intraday\", interval: interval, outputsize: \"full\"\n File.open(data_path, 'w') do |file|\n file.write(timeseries.hash.to_json)\n json_response(timeseries.hash)\n end\n else\n timeseries = File.read(data_path)\n json_response(timeseries)\n end\n end", "title": "" }, { "docid": "9c84573b3bf10c0352ee9dc212a1863a", "score": "0.6818952", "text": "def time_series_catalog\n respond_to do |format|\n format.json {\n render json: Api::V1.time_series_catalog, each_serializer: TimeSeriesCatalogSerializer, root: 'time_series', callback: params[:callback]\n }\n end\n end", "title": "" }, { "docid": "05cb3f4b0fb9f4b499740764dc480d0c", "score": "0.68164724", "text": "def index\n @episodes = series.episodes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @episodes }\n end\n end", "title": "" }, { "docid": "3d003a25da61ea5fc0b5ef53bbdad907", "score": "0.6803283", "text": "def index\n @series = Serie.find(:all,:order => 'id ASC')\n end", "title": "" }, { "docid": "71f1433f0b4828ca579daba7c41c7d6a", "score": "0.6797251", "text": "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series }\n end\n end", "title": "" }, { "docid": "f89988fb6523077fa13a1c03d6dd4612", "score": "0.6719122", "text": "def index\n @series = Series.includes(:team, :bowler, :scores).order('id DESC')\n respond_with(@series)\n end", "title": "" }, { "docid": "4e32afa341f39e245aa3eaaa83f847a4", "score": "0.67016834", "text": "def set_series\n @series = Serie.find(params[:id])\n end", "title": "" }, { "docid": "8e9eb2f1a755ef8b0b490a9838c66d14", "score": "0.6694733", "text": "def series\n \n return if invalid?\n \n params = {\n 'data[metodo]' => 'series',\n 'data[userg]' => self.user,\n 'data[sucursalg]' => self.sucursal\n }\n request = Net::HTTP.post_form(URI.parse(self.url), params)\n #puts request.body\n \n series = Array.new\n if request.kind_of? Net::HTTPSuccess\n JSON.parse(request.body.to_s).each do |serie|\n series.push Serie.new({:id => serie['id'], :nombre => serie['nombre']})\n end\n end\n return series\n \n end", "title": "" }, { "docid": "6f1ed1216a7acf5ba60802bc27f76636", "score": "0.6682726", "text": "def index\n @series_has_manifestations = SeriesHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_has_manifestations }\n end\n end", "title": "" }, { "docid": "8fae7ac507ffdfa15b58ff0ac143a9e3", "score": "0.66748005", "text": "def set_series\n @series = Serie.find(params[:id])\n end", "title": "" }, { "docid": "8fae7ac507ffdfa15b58ff0ac143a9e3", "score": "0.66748005", "text": "def set_series\n @series = Serie.find(params[:id])\n end", "title": "" }, { "docid": "8fae7ac507ffdfa15b58ff0ac143a9e3", "score": "0.66748005", "text": "def set_series\n @series = Serie.find(params[:id])\n end", "title": "" }, { "docid": "4616f2df6043173fc7ce6ebf88036cec", "score": "0.65725905", "text": "def list_data_series\n @data_series\n end", "title": "" }, { "docid": "4616f2df6043173fc7ce6ebf88036cec", "score": "0.65725905", "text": "def list_data_series\n @data_series\n end", "title": "" }, { "docid": "06351fda519ce3b76248c4c0f60fcdeb", "score": "0.6558689", "text": "def show\n render json: @chart\n end", "title": "" }, { "docid": "06351fda519ce3b76248c4c0f60fcdeb", "score": "0.6558689", "text": "def show\n render json: @chart\n end", "title": "" }, { "docid": "b33342d93761d064aaea698be2a6577d", "score": "0.6555693", "text": "def index\n @charts = Chart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charts }\n end\n end", "title": "" }, { "docid": "44c52686a32444c3ce01c876fd44c90d", "score": "0.6554055", "text": "def evolution_chart_data\n hashtag = Hashtag.find(params[:hashtag_id])\n result = [hashtag.get_stacked_evolution_data(from: hashtag.created_at)]\n \n render json: result\n end", "title": "" }, { "docid": "0f04bbc42d11107a9b67dfb6e717f40a", "score": "0.65415055", "text": "def index\n @newseries = Newseries.all\n end", "title": "" }, { "docid": "9bc706723643c458f5a0e328487b8a48", "score": "0.65380317", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @series_has_manifestation }\n format.js\n end\n end", "title": "" }, { "docid": "6df41b44a68ef91a13e2d246282f2e7d", "score": "0.6533138", "text": "def get_chart(time = '1m')\n response = RestClient.get(\"https://api.iextrading.com/1.0/stock/#{self.ticker}/chart/#{time}\")\n JSON.parse(response.body)\n end", "title": "" }, { "docid": "ae710ba7c47a25e34b132579bea1c74d", "score": "0.65330774", "text": "def series_params\n res = ActiveModelSerializers::Deserialization.jsonapi_parse(params, {})\n end", "title": "" }, { "docid": "0ad2dbadb0c291264bd2aa553643ec3d", "score": "0.65132165", "text": "def future_series\n data.fetch('future_series', nil)\n end", "title": "" }, { "docid": "0ad2dbadb0c291264bd2aa553643ec3d", "score": "0.65132165", "text": "def future_series\n data.fetch('future_series', nil)\n end", "title": "" }, { "docid": "73b53d70b437336533c311810e2d3914", "score": "0.649057", "text": "def search(series_name)\n series = []\n response = XmlSimple.xml_in(http_get(\"#{@host}/GetSeries.php?seriesname=#{series_name}\"), { 'ForceArray' => false })\n\n case response[\"Item\"].class.name\n when \"Array\"\n response[\"Item\"].each { |item| series << Series.new(item)}\n when \"Hash\"\n series << Series.new(response[\"Item\"])\n end\n\n series \n end", "title": "" }, { "docid": "7030d9832d69ba77ea5768dbae0366dc", "score": "0.648515", "text": "def index\n @tv_series = TvSeries.all\n end", "title": "" }, { "docid": "f2f6ecd26b5cc452a2f7f31a50066d0a", "score": "0.64794636", "text": "def index\n @stocks = Stock.all\n json_response(@stocks)\n end", "title": "" }, { "docid": "14b64b552e7b629e064355c51460672f", "score": "0.6478177", "text": "def index\n @collections = @book_series.collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end", "title": "" }, { "docid": "4e8d2962e1d438e096d65378b1df361e", "score": "0.64715177", "text": "def index\n @galeries = Galery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galeries }\n end\n end", "title": "" }, { "docid": "4c91e0df37a1292fb855442a15b1a5f4", "score": "0.64614964", "text": "def series\n Series.find_by id: self.series_id\n end", "title": "" }, { "docid": "5b9cddf07c2d5a4e9519beb5bd2ebc2a", "score": "0.6440008", "text": "def find_series_by_id(series_id)\n self.class.get(\"/api/#{@api_key}/series/#{series_id}/en.xml\")[\"Data\"][\"Series\"]\n end", "title": "" }, { "docid": "1c69475adb2582ee1fb7947c7f05702b", "score": "0.643942", "text": "def index\n @series = Serie.order(abbr: :asc)\n end", "title": "" }, { "docid": "0f4464949da46750944dac0fba639804", "score": "0.6425919", "text": "def fetch_series(id, language = language)\n Series.new(fetch(\"series/#{id}/all/#{language}.xml\"))\n end", "title": "" }, { "docid": "423fdbf8ab6cc6047c450eab8fec0e26", "score": "0.6424746", "text": "def current_series\n data.fetch('current_series')\n end", "title": "" }, { "docid": "423fdbf8ab6cc6047c450eab8fec0e26", "score": "0.6424746", "text": "def current_series\n data.fetch('current_series')\n end", "title": "" }, { "docid": "3cfa0ff6eb57b344ee2b00da8486b254", "score": "0.64028555", "text": "def index\n @seating_charts = SeatingChart.all\n\n end", "title": "" }, { "docid": "324916f9e1a0bf512fd84fd88b3c33fc", "score": "0.63921696", "text": "def index\n @stocks = Stock.all\n\n render json: @stocks\n end", "title": "" }, { "docid": "97ef2e26d3ba59c9f9e9bc664294ba0c", "score": "0.6377943", "text": "def index\n @charts = Chart.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charts }\n end\n end", "title": "" }, { "docid": "d97041ff757ae76d32f1ac6c3c8dd450", "score": "0.63639647", "text": "def get_series(code, period, variables, territorial_level, classification)\n\t\turl = @webservice_url + \"/values\"\n\n\t\tif code != '' and code != nil then\n\t\t\turl += \"/t/#{code}\"\n\t\tend\n\n\t\tif period != '' and period != nil then\n\t\t\turl += \"/p/#{period}\"\n\t\telse\n\t\t\turl += \"/p/all\"\n\t\tend\n\n\t\tif variables != '' and variables != nil then\n\t\t\turl += \"/v/#{variables}\"\n\t\telse\n\t\t\turl += \"/v/all\"\n\t\tend\n\n\t\tif territorial_level != '' and territorial_level != nil then\n\t\t\tterritorial_level.split(';').each do |word|\n\t\t\t\tws = word.split('|')\n\t\t\t\turl += \"/n#{ws[0]}/#{ws[1]}\"\t\n\t\t\tend\n\t\telse\n\t\t\turl += \"/n1/all\"\n\t\tend\n\t\t\n\t\tif classification != '' and classification != nil then\n\t\t\tclassification.split(';').each do |word|\n\t\t\t\tws = word.split('|')\n\t\t\t\turl += \"/c#{ws[0]}/#{ws[1]}\"\n\t\t\tend\n\t\tend\n\t\n\t\treturn consume_json(Net::HTTP.get(URI(url)), code)\n\tend", "title": "" }, { "docid": "0f657aa26458164582452c83490be7d2", "score": "0.63606024", "text": "def find_all_charts #(working)\n\t\tid = params[:id]\n\t\t#user_token = params[:user_token]\n\t\turl = \"https://sdpm-appointment-service.herokuapp.com/appointment/#{id}/charts\"\n\t\t#user_token = params[:user_token]\n\t\tresponse = RestClient::Request.execute(\n \t\tmethod: :get, \n \t\t\turl: url\n\t\t)\n\t\trender :json => response\n\tend", "title": "" }, { "docid": "f3ea7b6efd4579a1bb7cf171ccccf06d", "score": "0.63575983", "text": "def new\n @series_list = SeriesList.new\n @categories = Category.where(:name => ['iPhones', 'iPod','iPad'])\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @series_list }\n end\n end", "title": "" }, { "docid": "2b135034d966669dcce00860d785881f", "score": "0.6348631", "text": "def show\n @series_set = SeriesSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series_set }\n end\n end", "title": "" }, { "docid": "3b6ba8b4bbe10dfbc4bded49bbf17d31", "score": "0.63349205", "text": "def new\n @series = Series.new\n @series.added_by = User.current.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @series }\n end\n end", "title": "" }, { "docid": "178afb39ac0bb694052acd0919c711ef", "score": "0.6325509", "text": "def new\n @tv_series = TvSerie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv_series }\n end\n end", "title": "" }, { "docid": "a2df83f118362bb1021df5d088b67d5d", "score": "0.6318726", "text": "def index\n @series = Series.get_series_by_role(current_user).includes(:user)\n end", "title": "" }, { "docid": "b5cb4bdf2a81ec3869139af18a37d82f", "score": "0.63045084", "text": "def series_json(params={})\n goals = self.goals.incomplete\n series = []\n goals.find_each do |goal| \n data = []\n goal.grades.find_each{|grade| \n data << [grade.due_date, (grade.accuracy*100).round / 100.0]\n }\n #data << [goal.due_date, goal.accuracy]\n #Sort data by due date\n unless data.empty?\n data = data.sort_by { |hsh| hsh[0] } \n series << {\n :name => goal.name,\n :data => data,\n :item_id => goal.id\n }\n end\n end\n series.to_json\n end", "title": "" }, { "docid": "856c6e29d9a534b6b8561e767d42bf02", "score": "0.6297848", "text": "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chart }\n end\n end", "title": "" }, { "docid": "db7f85739ff21bd2847c1278bfbbd49f", "score": "0.62839085", "text": "def series; end", "title": "" }, { "docid": "90fee12076bdeb7d1b02311ad5391781", "score": "0.6278424", "text": "def getPrices\n @prices = History.where(:symbol => params[:symbol]).last(30).map {|x| x.price}\n render json: @prices\n end", "title": "" }, { "docid": "52065065fc6e83bdcb09d885586b9801", "score": "0.62743133", "text": "def series_names\n doc = Nokogiri::HTML.parse(open(SERIES_LIST))\n res = JSON.parse(doc.xpath('/html/body/p/text()').text)\n\n @series = {}\n res['data'].each do |val|\n raw_series_name = val['title'].safe.downcase\n series_number = val['artist']\n\n @series[raw_series_name] = series_number.to_i\n end\n\n @series\n end", "title": "" }, { "docid": "ad77ae36f70879c0328c2ed8b2c0d982", "score": "0.6268977", "text": "def index\n if current_user && current_user.admin?\n @series = Serie.all\n else\n p current_user\n @series = User.find(current_user).series\n end\n end", "title": "" }, { "docid": "e9205d799e40fe958dedf1073ab96a85", "score": "0.6267253", "text": "def index\n @webseries = Webseries.all\n end", "title": "" }, { "docid": "b84a72a7c13af21d95e903c69855c7e8", "score": "0.6265307", "text": "def time_series(url)\n _params = {:url => url}\n return @master.call 'urls/time-series', _params\n end", "title": "" }, { "docid": "063c5272ada916734d2db65f22aa3687", "score": "0.6251964", "text": "def time_series(url)\n _params = {:url => url}\n return @master.call 'urls/time-series', _params\n end", "title": "" }, { "docid": "0cd11125b0211fff3682d9cbd50cbebc", "score": "0.62517065", "text": "def api_index\n @sensors = Sensor.all\n json_response(@sensors)\n end", "title": "" }, { "docid": "c045a27af1c87c31cde771dd4156ca54", "score": "0.6250788", "text": "def show\n render json: @service_history\n end", "title": "" }, { "docid": "7b91836b31dce772c7139dd032d260d3", "score": "0.62374574", "text": "def index\n if params[:id]\n @volumes = Series.find(params[:id]).volumes\n else\n @volumes = Volume.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @volumes }\n end\n end", "title": "" }, { "docid": "2a6d4774faa24c3648d1703885a8c306", "score": "0.62154496", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "2a6d4774faa24c3648d1703885a8c306", "score": "0.62154496", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "3c8a5ed3b4e1979c59a8b7d1b3a4d889", "score": "0.6215327", "text": "def index\n @time_series_data = TimeSeriesDatum.all\n end", "title": "" }, { "docid": "47bc927b1e44b16a37787945c1644429", "score": "0.62150615", "text": "def show\n @chart = Chart.find(params[:id])\n @data = @chart.songs.map { |song| song.attributes }\n\n render :json => @data.to_json\n end", "title": "" }, { "docid": "2fd9157db548c96fe4a00462c9c409bd", "score": "0.6209813", "text": "def index\n @series = Series.all.order('updated_at DESC')\n end", "title": "" }, { "docid": "1f5b7bc567add3dc0b31d10d59aafccc", "score": "0.6204512", "text": "def find_series(name, language = language)\n xml = open(\"#{base_uri}/GetSeries.php?seriesname=#{name}&language=#{language}\").read\n results = []\n REXML::Document.new(xml).elements.each('Data/Series') do |node|\n results << Series.new(node)\n end\n results\n end", "title": "" }, { "docid": "2f935f11cb1622fca926b49a92727a25", "score": "0.6202939", "text": "def character_series(id, options = {})\n # vi/public/characters/{characterId}/series\n get(\"characters/#{id}/series\", options)\n end", "title": "" }, { "docid": "4501081b7651a536884aba9f125aea90", "score": "0.6198905", "text": "def catalogs_get_series_with_http_info(doc_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogsApi.catalogs_get_series ...\"\n end\n # verify the required parameter 'doc_type' is set\n if @api_client.config.client_side_validation && doc_type.nil?\n fail ArgumentError, \"Missing the required parameter 'doc_type' when calling CatalogsApi.catalogs_get_series\"\n end\n # resource path\n local_var_path = \"/api/Series\"\n\n # query parameters\n query_params = {}\n query_params[:'docType'] = doc_type\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Series>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogsApi#catalogs_get_series\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "434436ad91a1807294a3e07541a03d62", "score": "0.6196212", "text": "def set_series\n @series = Series.find(params[:id])\n end", "title": "" }, { "docid": "79fc9a82a2cdd3d2834c79107eb6b495", "score": "0.61878777", "text": "def new\n @book_series = BookSeries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_series }\n end\n end", "title": "" }, { "docid": "3cb4129500e8b51ea0a47889d9b011c1", "score": "0.61846673", "text": "def index\n \tcurrent_user = User.first\n \tcharts = current_user.charts.all\n\t\t\n\t\t#include in chart respond also chart_config, regular_serie and regular_serie_datum (data) => all nested with chart\n respond_with(charts) do |format|\n \n \t#get all charts as json string\n \tcharts_str = charts.to_json(\n \t\t:include => [\n \t\t\t'chart_config',\n \t\t\t'regular_serie' => { \n \t\t\t\t:include => ['regular_serie_datum']\n \t\t}]\n \t)\n \n \t#response string in specified format\n \tresponse_str = \"{\\\"success\\\": true, charts: #{charts_str}}\"\n \t\n format.json { render :json => response_str }\n end\n end", "title": "" }, { "docid": "8b2c3904737d50a57ecfc0c13f2b6e1d", "score": "0.6184125", "text": "def show\n render json: @stock\n end", "title": "" }, { "docid": "1688614154d0f3c2ae1a6fe0e5559349", "score": "0.61771035", "text": "def show\n render json: @stock_index\n end", "title": "" } ]
da77dd195c278f2bb9a11e7dea108e53
=begin get article as raw (e. g. if it's a email, the raw email) article = Ticket::Article.find(123) article.as_raw returns: file Store =end
[ { "docid": "f7d7c7ca40b46d4fb94a3ba4c020e4ea", "score": "0.7040287", "text": "def as_raw\n list = Store.list(\n object: 'Ticket::Article::Mail',\n o_id: id,\n )\n return if list.blank?\n\n list[0]\n end", "title": "" } ]
[ { "docid": "e5793007bea6e27136735a1515d23350", "score": "0.6694676", "text": "def get_raw\n\n path = File.join(self.get_dir, self.id.to_s + Email::EXT_RAW)\n\n if File.exist?(path)\n return open(path) { |f| f.read }\n else\n return ''\n end\n end", "title": "" }, { "docid": "f1defc4efd9410293a7ee142e14671fa", "score": "0.6396347", "text": "def raw\n\t\treturn @content\n\tend", "title": "" }, { "docid": "f1defc4efd9410293a7ee142e14671fa", "score": "0.6396347", "text": "def raw\n\t\treturn @content\n\tend", "title": "" }, { "docid": "ecd61d4707f9812f5190d2069ef0e529", "score": "0.61028874", "text": "def raw\n #\n end", "title": "" }, { "docid": "2e419ee657f78b1baf113f4d5aeb8a85", "score": "0.6080826", "text": "def raw\n\n @raw\n\n end", "title": "" }, { "docid": "817e27e7ec8abaeafa0d2ecf4b6b0a3a", "score": "0.6042912", "text": "def raw; end", "title": "" }, { "docid": "817e27e7ec8abaeafa0d2ecf4b6b0a3a", "score": "0.6042912", "text": "def raw; end", "title": "" }, { "docid": "817e27e7ec8abaeafa0d2ecf4b6b0a3a", "score": "0.6042912", "text": "def raw; end", "title": "" }, { "docid": "817e27e7ec8abaeafa0d2ecf4b6b0a3a", "score": "0.6042912", "text": "def raw; end", "title": "" }, { "docid": "5617d593081725c44aa991b3b9f1cd81", "score": "0.58997923", "text": "def _raw\n @_raw\n end", "title": "" }, { "docid": "3d5e5bc1897c66a0c1db8c7c37676bee", "score": "0.58918774", "text": "def raw_body\n if @rev\n @raw_body ||= blob.contents\n else\n @raw_body ||= File.exists?(@filename) ? File.read(@filename) : ''\n end\n end", "title": "" }, { "docid": "874a8c50e3dfeee3b3f28e5bd89e33bc", "score": "0.5856943", "text": "def content\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n\n file.content\n end", "title": "" }, { "docid": "5e3697d965385c2ed593917a5efc68ed", "score": "0.58155966", "text": "def article_body\n respond_to?(:body) ? body : ''\n end", "title": "" }, { "docid": "a0cefa4f2c3b0a6a23c3030186e87602", "score": "0.5792699", "text": "def article\n Journal::Article.find_by_articleid self.articleid\n end", "title": "" }, { "docid": "e8da27a938ede8dbf5563ce282c11153", "score": "0.5783125", "text": "def raw_plain\n @raw_plain\n end", "title": "" }, { "docid": "0a973e39625c15703609bf3874e8560e", "score": "0.57678014", "text": "def raw(id)\n self.class.get(\"/archive/raw/#{id}\", {:basic_auth => @auth})\n end", "title": "" }, { "docid": "163c1c1caf13d603e80c7d5cd672f63b", "score": "0.5759789", "text": "def read\n object.content\n end", "title": "" }, { "docid": "2ad8a6fdd9f06beda710e502f57062fb", "score": "0.57530093", "text": "def raw\n @xbrl_content\n end", "title": "" }, { "docid": "3a93def35e3a6d5fa0a355ad99eec42d", "score": "0.57183266", "text": "def to_raw; end", "title": "" }, { "docid": "849ed97304262713c43f41d16b631489", "score": "0.56592953", "text": "def read_article\n\torig_article\n\tdancing_man\n\tin_chrome\n\tgo_back\n\tgo_back\nend", "title": "" }, { "docid": "38bbefe57a5f93f5f0708b22c6b84be4", "score": "0.56501186", "text": "def raw\n\t\t#puts \"raw, line \" + \"27\"\n\t\t@raw = ssl.find({id: params[:id]}).to_a.first\n\t\tif @raw.nil?\n\t\t\tredirect_to doc_index_path, notice: 'No record of doc with id: ' + params[:id].to_s \n \t\telse\n \t\t\trender json: @raw \n\t\tend\n \tend", "title": "" }, { "docid": "087b8bb543b73a7fb7c79767c6b3f77f", "score": "0.56440616", "text": "def raw\n @raw ||= ''\n end", "title": "" }, { "docid": "3b90b75991802ab08ba1c039f062b1af", "score": "0.5613132", "text": "def load(raw)\n raw\n end", "title": "" }, { "docid": "e8351a9ec2e079a8c84a2c046cb27778", "score": "0.56125283", "text": "def raw_source\n @raw_source\n end", "title": "" }, { "docid": "e8351a9ec2e079a8c84a2c046cb27778", "score": "0.56125283", "text": "def raw_source\n @raw_source\n end", "title": "" }, { "docid": "e8351a9ec2e079a8c84a2c046cb27778", "score": "0.56125283", "text": "def raw_source\n @raw_source\n end", "title": "" }, { "docid": "7a244d36c367d518828fc44816419d61", "score": "0.560642", "text": "def contents\n if persisted?\n f=Photo.mongo_client.database.fs.find_one(:_id=>BSON::ObjectId.from_string(@id))\n if f \n buffer = \"\"\n f.chunks.reduce([]) do |x,chunk| \n buffer << chunk.data.data \n end\n return buffer\n end \n end\n end", "title": "" }, { "docid": "25dca61befe893257989eedb9bda7137", "score": "0.5587983", "text": "def get_mail_raw\n Log.add_info(request, params.inspect)\n\n email = Email.find(params[:id])\n email_name = email.subject + Email::EXT_RAW\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n ie_ver = nil\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n email_name = CGI::escape(email_name) unless ie_ver.nil?\n end\n\n filepath = File.join(email.get_dir, email.id.to_s + Email::EXT_RAW)\n if FileTest.exist?(filepath)\n send_file(filepath, :filename => email_name, :stream => true, :disposition => 'attachment')\n else\n send_data('', :type => 'application/octet-stream;', :disposition => 'attachment;filename=\"'+email_name+'\"')\n end\n end", "title": "" }, { "docid": "d2ca7135fb735641b96641a5862f664b", "score": "0.5585976", "text": "def raw\n results\n end", "title": "" }, { "docid": "80c169a52303edef84da4fb6f85cff35", "score": "0.5572094", "text": "def get_article(article_id, props=nil)\n # overwrite with your own storage mechanism.\n end", "title": "" }, { "docid": "3e120fcc3f91759cdd5612d007d95709", "score": "0.55670404", "text": "def content\n return @raw if @raw\n\n if self.uri\n @raw = HTTParty.get(self.uri.to_s).body\n # elsif self.precompiled?\n # template = Tilt.new(self.filepath)\n # @raw = template.render\n else\n @raw = File.read(self.filepath)\n end\n end", "title": "" }, { "docid": "101b9155c812d4f2e8a05e420b6295f4", "score": "0.55644244", "text": "def raw\n raise(ActionController::RoutingError, 'Not Found') unless blacklight_config.raw_endpoint.enabled\n\n @document = search_service.fetch(params[:id])\n render json: @document\n end", "title": "" }, { "docid": "e57fbbb0d1fa14788300da3e64e52282", "score": "0.5563207", "text": "def readArticle(iArticleName)\n return `php #{@WEACELibDir}/Slave/Adapters/Mediawiki/Mediawiki_getContent.php #{@ProductConfig[:MediawikiDir]} #{iArticleName}`.split(\"\\n\")\n end", "title": "" }, { "docid": "e9a1a741ae1228cea19010822ff90904", "score": "0.556212", "text": "def raw_text\n text = ''\n\n objects = get_objects(get_data(@file))\n objects = decode_objects(objects)\n\n objects.each { |o| text += o[:data] if(o[:data] and is_text_header?(o[:header])) }\n\n text\n end", "title": "" }, { "docid": "dd3d80739b26de200091e20c61806985", "score": "0.5561442", "text": "def show\n @article = Thumbwebs::Article.find(params[:id])\n \n \n #see http://dev.rubyonrails.org/ticket/8305, to_xml does not work with namespaced models\n #\n respond_to do |format|\n format.html{render :template => \"show\"} # show.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "f49d6ec5b1ba41ffe0c5b81dafb60c8b", "score": "0.55275667", "text": "def body\n @raw\n end", "title": "" }, { "docid": "16b94b1eceb7441f90c8cda39f549d2d", "score": "0.5485525", "text": "def raw\n content = ''\n File.open(path) { |f| content = f.read }\n content\n rescue IOError\n raise \"cannot open #{path}\"\n end", "title": "" }, { "docid": "7bd7f78b4ccaf56626e3e66075aae3d4", "score": "0.54755324", "text": "def raw_body\n @attributes[:raw_body]\n end", "title": "" }, { "docid": "7d96de507a492fcaca7d232a05d04bc5", "score": "0.5464516", "text": "def get_raw_information\n @infos[RAW]\n end", "title": "" }, { "docid": "4af8dcd2d21251a4a0dedd18a887982f", "score": "0.54407674", "text": "def data_record\n object.content\n end", "title": "" }, { "docid": "7b86b400991dbc3f89983b0b0c9831f9", "score": "0.5417343", "text": "def entity content\n end", "title": "" }, { "docid": "8411e2ad121b14f43217d92c3c3b1d1a", "score": "0.53999734", "text": "def entity content\r\n # Don't care\r\n end", "title": "" }, { "docid": "3c74614142da73626881a79b1d279d65", "score": "0.539695", "text": "def raw_source\n @raw_source ||= Envelope::MessageTools.normalize(message.raw_source)\n end", "title": "" }, { "docid": "547e29a1a0a6a193895cf9847ab1d71d", "score": "0.5392315", "text": "def set_raw\n @raw = Raw.find(params[:id])\n end", "title": "" }, { "docid": "61368192277a0ef5bbc7f745073f8c6e", "score": "0.53837276", "text": "def raw\n workhorse_set_content_type!\n\n # Until we don't migrate all snippets to version\n # snippets we need to support old `SnippetBlob`\n # blobs\n if defined?(blob.snippet)\n send_data(\n convert_line_endings(blob.data),\n type: 'text/plain; charset=utf-8',\n disposition: content_disposition,\n filename: Snippet.sanitized_file_name(blob.name)\n )\n else\n send_snippet_blob(snippet, blob)\n end\n end", "title": "" }, { "docid": "ef8f65b03ef1d5cc8eba6c5bba84c594", "score": "0.5370331", "text": "def show\n respond_to do |format|\n format.html { render locals: { article: @article } }\n format.epub { send_ebook({ article: @article }, :epub, \"#{@article.slug}.epub\") }\n format.mobi { send_ebook({ article: @article }, :mobi, \"#{@article.slug}.mobi\") }\n end\n end", "title": "" }, { "docid": "7ae5c2a0563815c6fea2cd7bbca0c8a9", "score": "0.5369624", "text": "def raw(name = nil)\n if name.nil?\n @raw\n else\n field(name).extract(@raw)\n end\n end", "title": "" }, { "docid": "e0fe8179370b35b2f706379e1a6e6f09", "score": "0.53583306", "text": "def contents\n f = self.class.mongo_client.database.fs.find_one({:_id=>BSON::ObjectId.from_string(@id)})\n if f\n buffer = \"\"\n f.chunks.reduce([]) do |x, chunk|\n buffer << chunk.data.data\n end\n return buffer\n end\n end", "title": "" }, { "docid": "735a9edaec5183cbd5e7f56c547c2097", "score": "0.5344182", "text": "def raw_contents\n File.read(path)\n end", "title": "" }, { "docid": "aa28d45630564022186777a7abe771e4", "score": "0.53401953", "text": "def article_data\n @article = Article.find(params[:article_id])\n end", "title": "" }, { "docid": "60ff26872cf15b1367cd3f370ba929ac", "score": "0.53284794", "text": "def item_format(_bib)\n 'article'\n end", "title": "" }, { "docid": "d4d6fa874926b33562d3ebbbcb60257e", "score": "0.53124624", "text": "def content\n return IO.read(@file)\n end", "title": "" }, { "docid": "5db359972a79cc26f6f8467a766a5e73", "score": "0.53026474", "text": "def body\n revision.body\n end", "title": "" }, { "docid": "6a297f917dc395ddab915cee94bd3e45", "score": "0.5288065", "text": "def read\n @epub.file.read(abs_filepath)\n end", "title": "" }, { "docid": "667b35c42e2d4909b044bf2bf511416c", "score": "0.52866304", "text": "def raw_read(context)\n raw(context)\n end", "title": "" }, { "docid": "efcb4c04c335200f84ae483d964c7293", "score": "0.52853274", "text": "def read\n result = model.fetch_attachment(@path)\n @headers = result.headers\n result.body\n end", "title": "" }, { "docid": "41c4fe93a1c35a552e51b9a7ccaaac41", "score": "0.52734226", "text": "def get_raw_page_content(article_titles)\n query_parameters = { titles: article_titles,\n prop: 'revisions',\n rvprop: 'content' }\n info = mediawiki('query', query_parameters)\n return if info.nil?\n page = info.data['pages']\n page.nil? ? nil : page\n end", "title": "" }, { "docid": "f3acce0c570b10edf11ff04aa0f67a9e", "score": "0.52700806", "text": "def raw\n repr.raw\n end", "title": "" }, { "docid": "e8a5311b93a055760e5122fff731bc00", "score": "0.5262831", "text": "def show\n @article = Article.unscoped.find(params[:id])\n\n if !@article.is_verified? and (@article.author != current_user) and !current_user.is_admin?\n raise ActionController::RoutingError.new('Not Found')\n end\n\n @article.read\n\n @comment = Comment.new\n @subcomment = SubComment.new\n \n respond_to do |format|\n format.html {\n if params[:raw]\n render layout: false\n else\n render\n end\n }\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "7165a202fdc116e69fcffac66618cf48", "score": "0.52627766", "text": "def raw_report\n @raw ||= build_data\n end", "title": "" }, { "docid": "777d7bedca4d779f2b9b84f17c0f5a14", "score": "0.5254019", "text": "def return_raw_for raw_object_class\n raws.each { |tc, t| return t if tc == raw_object_class }\n nil\n end", "title": "" }, { "docid": "4deb8abf60180e97fa646ce9dfb6c922", "score": "0.5252832", "text": "def article_representation article\n # Get the hash table which contains information\n hash_source = article.attributes\n \n # Get the key arrays of the hash table\n key_arr = hash_source.keys\n len = key_arr.length\n \n # Start with article tag \n result = \" <article>\\n\"\n \n # Iterate the keys\n # Set 'count' variable to make this loop stop at 5th attribute\n count = 0\n key_arr.each do |ele|\n # If the first 4 attributes are done, break this loop\n if(count>5)\n break\n end\n \n # If the value is not nil then put it into result\n if(hash_source[ele] != nil)\n # convert inappropriate symbols into entities\n key = convertEntities(ele)\n value = convertEntities(hash_source[ele])\n temp = \" <#{key}>#{value}</#{key}>\\n\"\n result+=temp\n end\n count+=1\n end\n \n #put guid and isPermaLink in one tag as the original source\n guid = hash_source[key_arr[len-1]]\n isPermaLink = hash_source[key_arr[len-2]]\n result += \" <guid isPermaLink=\\\"#{guid}\\\">\"\n result+=\"#{isPermaLink}</guid>\\n\"\n \n # Return the representation with closing article tag \n result += \" </article>\\n\"\n end", "title": "" }, { "docid": "b54623bc3c1bcb4fba4554b3ce46fd22", "score": "0.5247208", "text": "def contents\n \tdoc = self.class.mongo_client.database.fs.find_one(:_id => BSON::ObjectId(@id))\n \tif doc\n \t buffer = \"\"\n \t doc.chunks.reduce([]) do |x, chunk|\n \t buffer << chunk.data.data\n \t end\n \t return buffer\n \tend\n end", "title": "" }, { "docid": "86ee8cc8c5067409d1a2e0d3a0ffdf75", "score": "0.5239245", "text": "def perform_raw; end", "title": "" }, { "docid": "71942a5ff20f4a1889fc18e2c67e5b60", "score": "0.52358854", "text": "def get_article_metadata(article_id)\n if $ddb_client.nil?\n $ddb_client = Aws::DynamoDB::Client.new\n end\n\n resp = $ddb_client.get_item({\n key: { id: article_id },\n projection_expression: \"contentUri\",\n table_name: ARTICLES_TABLE\n })\n\n Article.new(resp.item['contentUri'])\nend", "title": "" }, { "docid": "f5a0912580e740ac5e7268e0b5d07735", "score": "0.5233919", "text": "def body\n @document.to_s\n end", "title": "" }, { "docid": "0a44e66a1a7636658bd7fb04a6ee9fe0", "score": "0.52269125", "text": "def get_content_from_data(raw_xml)\n Nokogiri::XML(raw_xml)\n end", "title": "" }, { "docid": "18a0c75ebc87495ae04132b45ff3bf5a", "score": "0.5225084", "text": "def article(id:)\n Article.find(id)\n end", "title": "" }, { "docid": "76af5a8b1dab8dcdbd682393eb2de33d", "score": "0.52215207", "text": "def contents\n\tRails.logger.debug {\"getting gridfs content #{@id}\"}\n f=self.class.mongo_client.database.fs.find_one(:_id=>BSON::ObjectId.from_string(@id))\n # read f into buffer, array of chunks is reduced to single buffer and returned to caller.\n # this is how file is broken apart and put together and assembled. Buffer is sent back to browser\n # to disaply on the screen\n if f \n buffer = \"\"\n f.chunks.reduce([]) do |x,chunk| \n buffer << chunk.data.data \n end\n return buffer\n end \n\nend", "title": "" }, { "docid": "1a745ab7085c0096cb16399b15b4b9fc", "score": "0.5220275", "text": "def article(cps_id)\n @client.request(:get, \"articles/#{cps_id}\")[\"article\"]\n end", "title": "" }, { "docid": "d731703e5df71a2711b14e6e8425ffe6", "score": "0.5217162", "text": "def raw\n @raw ||= Hashie::Mash.new(@raw_plain)\n end", "title": "" }, { "docid": "e9c515c1c03c8d46d40b41f48682e721", "score": "0.5209136", "text": "def contents\n self.content\n end", "title": "" }, { "docid": "1a849f7f49af97c1305f920d6089e86f", "score": "0.51957697", "text": "def content\n return @content_ unless @content_.nil?\n @note.nil? and get\n @content_ = !@note.nil? && !@note.guid.nil? ? @auth_store.note_store.getNoteContent(@auth_store.auth_token, @note.guid) : \"\"\n end", "title": "" }, { "docid": "80d4034e813d6ac263c9d3be7a1f0d26", "score": "0.51939845", "text": "def get_article()\n @engine.content_loader.articles[@request.name]\n end", "title": "" }, { "docid": "e87b56fcc7acc293fa261e681d0995cb", "score": "0.51928973", "text": "def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end", "title": "" }, { "docid": "cb2c569b80108195b10033dbc6dd12b9", "score": "0.5190897", "text": "def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n article.author = (name[0..2] == 'By ') ? name.slice(3..name.size) : name\n\n article.link = !i.link.nil? ? i.link : 'n/a'\n article.summary = !i.description.nil? ? i.description : 'n/a'\n article.image = (!i.enclosure.nil? && i.enclosure.type == 'image/jpeg') ? i.enclosure.url : 'n/a' \n article\n end", "title": "" }, { "docid": "a181b990c2aecc2448a4021c27b189cc", "score": "0.5187988", "text": "def download_raw\n document = Document.find(params[:id])\n authorize! :download_raw, document\n \n begin\n upload = Upload.find( document.stuffing_upload_id )\n rescue ActiveRecord::RecordNotFound => e\n puts \"### ERROR: \" + e.message\n redirect_to show_data_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end", "title": "" }, { "docid": "4e3fdd9211a20fe16cf7a42bbc00c481", "score": "0.5167819", "text": "def raw_content(snip, part)\n selected_part = (part || :content).to_sym\n snip.__send__(selected_part) if snip.respond_to?(selected_part)\n end", "title": "" }, { "docid": "2b7a3b9469d2b8590f316ac0ccbf455a", "score": "0.51644295", "text": "def raw_source\n @raw ||= File.read source_path\n end", "title": "" }, { "docid": "2b7a3b9469d2b8590f316ac0ccbf455a", "score": "0.51644295", "text": "def raw_source\n @raw ||= File.read source_path\n end", "title": "" }, { "docid": "7e0764eae5df5a1e1e55868ea90e003a", "score": "0.5163658", "text": "def raw\n @raw ||= connection[name]\n end", "title": "" }, { "docid": "5e83b2fb017adad406c20dc56276ca2a", "score": "0.51621544", "text": "def type_specific_part_raw\n return @type_specific_part_raw unless @type_specific_part_raw.nil?\n @type_specific_part_raw = type_specific_part_raw_with_io.data\n @type_specific_part_raw\n end", "title": "" }, { "docid": "088cba2b9234695ad8781915c0de7b39", "score": "0.5160082", "text": "def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end", "title": "" }, { "docid": "94ed3689c0caf11d0dfe29dfd7739690", "score": "0.5159812", "text": "def firstArticle\n @magissue = Magissue.find(params[:id])\n @article = @magissue.articles.first\n end", "title": "" }, { "docid": "9cd2bda8142f3a529a0af9a229ac1929", "score": "0.51596665", "text": "def news_body\n body\n end", "title": "" }, { "docid": "6a8c1adf8333a500987295c1368dffff", "score": "0.5155954", "text": "def my_articles\n store._articles.find user_id: current_user._id\n end", "title": "" }, { "docid": "a0e483110aece7d162bad6f621530ce3", "score": "0.51543343", "text": "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @article.to_xml }\n end\n end", "title": "" }, { "docid": "ec74b30fb424cb1cab47e098237ec7a8", "score": "0.515241", "text": "def data_format\n object.content\n end", "title": "" }, { "docid": "10f420096e09e5edc41dac010b8481f4", "score": "0.5142562", "text": "def raw\n @template\n end", "title": "" }, { "docid": "cbad6965c4209dfab24b5634ca7e8ca7", "score": "0.5142152", "text": "def content\n if GalleryConfig.storage.database_notebooks\n notebookFile = NotebookFile.where(save_type: \"stage\", uuid: uuid).first\n notebookFile.content if !notebookFile.nil?\n else\n File.read(filename, encoding: 'UTF-8') if File.exist?(filename)\n end\n end", "title": "" }, { "docid": "e3d485e391de3773c22832d1f859847f", "score": "0.5137656", "text": "def raw\n @raw ||= []\n end", "title": "" }, { "docid": "352a71f49ab0cd33c4df0309689eba9d", "score": "0.5127035", "text": "def to_raw_object(opener = nil)\n RawObject.construct(hash_id, opener, PREFIX_NAME_LOOKUP[type], content)\n end", "title": "" }, { "docid": "4ff2164958f4582c2befcd187ebfe7a5", "score": "0.5126506", "text": "def find_article\n\n @article = Article.find(params[:id]) # Fetch the article by ID\n\n end", "title": "" }, { "docid": "b0b688a58463f5d4c448b321e211b5a0", "score": "0.51179147", "text": "def getContent(mail)\n#Converts some characters back to what they should be\n text = mail.text_part.body.decoded\n text.encode!(\"UTF-8\", \"Windows-1250\")\n text.gsub!(\"’\", \"\\'\") #fixes apostrophe bug for parsing\n text.gsub!(/(\\n){3,}/, \"\\n\\n\") #remove excess newlines\n return text\n end", "title": "" }, { "docid": "84eafb3d6b515db825d489e6da79ae69", "score": "0.5103084", "text": "def get_content()\n if @state == RedXmlResource::STATE_LAZY\n @document = @doc_service.find_document(@doc_name)\n @state = RedXmlResource::STATE_LOADED\n end\n return \"#{@document}\"\n end", "title": "" }, { "docid": "f88507fc4f195953ca1d0cb31fe3d955", "score": "0.5102198", "text": "def article_representation article\r\n if @@count == 0 then\r\n @@count = 1\r\n\t\t \"\\\"articles\\\":\"+article.attributes.to_json\r\n else\r\n \", \\\"articles\\\":\"+article.attributes.to_json\r\n end\r\n\tend", "title": "" }, { "docid": "b6108d9680fe60b17c6d00e047be56a0", "score": "0.5098338", "text": "def raw(s)\n Forme.raw(s)\n end", "title": "" }, { "docid": "68139dd95e6c525be5c325d345da8035", "score": "0.50908846", "text": "def find_article\n @article = Article.find(params[:id])\n end", "title": "" }, { "docid": "d97ecb3fa280deadcf7ec7e063d5f9a4", "score": "0.5083225", "text": "def to_s\n contents.to_s\n end", "title": "" }, { "docid": "6b00cdc21758c05af6f1a69743e5d5dc", "score": "0.5077953", "text": "def to_s\n raw\n end", "title": "" } ]
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "4c36104a57460de51903ca3e0c19e455", "score": "0.0", "text": "def bug_ticket_params\n params.require(:bug_ticket).permit(:bug_behavior, :environment, :status, :priority, :owner, :comment, :category, :main_image, :project_id)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "7ac5f60df8240f27d24d1e305f0e5acb", "score": "0.6803639", "text": "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6795365", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.67448795", "text": "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", "title": "" }, { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.67399913", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.6526815", "text": "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", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.6518771", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "7a24fee4eabdabf0eae6fc4a9442b5d4", "score": "0.64931697", "text": "def whitelisted_args\n args.select &:allowed\n end", "title": "" }, { "docid": "89821ecc64d69b0e108ff0205d42848d", "score": "0.6430388", "text": "def safe_list_sanitizer; end", "title": "" }, { "docid": "89821ecc64d69b0e108ff0205d42848d", "score": "0.6430388", "text": "def safe_list_sanitizer; end", "title": "" }, { "docid": "89821ecc64d69b0e108ff0205d42848d", "score": "0.6430388", "text": "def safe_list_sanitizer; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.63983387", "text": "def filtered_parameters; end", "title": "" }, { "docid": "21b124098cb3c128802e22b776b3f0ec", "score": "0.6356042", "text": "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.63535863", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.63464934", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "9f3b62fe05ad1542504f6ef13056ac4e", "score": "0.63444513", "text": "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.6337208", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "ecb9b1c8e860f69081e55e2f9432197e", "score": "0.6326454", "text": "def safe_list_sanitizer=(_arg0); end", "title": "" }, { "docid": "ecb9b1c8e860f69081e55e2f9432197e", "score": "0.6326454", "text": "def safe_list_sanitizer=(_arg0); end", "title": "" }, { "docid": "ecb9b1c8e860f69081e55e2f9432197e", "score": "0.6326454", "text": "def safe_list_sanitizer=(_arg0); end", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.63140553", "text": "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", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6299814", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.62642586", "text": "def check_params; true; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.626006", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.62578833", "text": "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", "title": "" }, { "docid": "0e757d0df3a64e9e53edcc2ec32e976f", "score": "0.6236823", "text": "def allowed?(*_)\n true\n end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.6227561", "text": "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", "title": "" }, { "docid": "aabfd0cce84d7f71b1ccd2df6a6af7c3", "score": "0.6221758", "text": "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "title": "" }, { "docid": "d06d4a4f5db50f0e92ab46e724235bf9", "score": "0.62200165", "text": "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.620879", "text": "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", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.61983657", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.6195055", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "d17287b48784257580d7e0971173c983", "score": "0.6172993", "text": "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6156856", "text": "def valid_params?; end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.61558664", "text": "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", "title": "" }, { "docid": "014122b5717338df29c0e4d5adba899e", "score": "0.61521494", "text": "def url_allowlist=(_arg0); end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6135789", "text": "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", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.6121145", "text": "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", "title": "" }, { "docid": "2b19f8222e09c2518b0d19b4bf1f69d3", "score": "0.61118174", "text": "def list_params\n params.permit(:list_name)\n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.60736513", "text": "def valid_params_request?; end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.6071645", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "64a51034b538cd75dee66f5200107c1f", "score": "0.60632104", "text": "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "title": "" }, { "docid": "030323bf4ecb827028514f0ceb36cb9b", "score": "0.60549796", "text": "def safelists; end", "title": "" }, { "docid": "4c4d28432d3282cbb227f3039cf94caf", "score": "0.6043906", "text": "def authorize_own_lists\n authorize_lists current_user.lists\n end", "title": "" }, { "docid": "bc65ba6d2f3ef5cb8923d613e49b8274", "score": "0.6034662", "text": "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "title": "" }, { "docid": "44ade9754ddcdac40382d0923cd63048", "score": "0.60207325", "text": "def lists_params\n params.require(:list).permit(:name)\n\n end", "title": "" }, { "docid": "39096b2b2caa0b5a8223deec5f5b0f9f", "score": "0.6018568", "text": "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "title": "" }, { "docid": "e3b7e73d151796bb56ed85e0f3116fa9", "score": "0.6016575", "text": "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.60103434", "text": "def check_params\n true\n end", "title": "" }, { "docid": "c341544076effe9e0db47fa6752829ff", "score": "0.60084206", "text": "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "title": "" }, { "docid": "b7a657010a7f394737d8c2d719a06993", "score": "0.600763", "text": "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "title": "" }, { "docid": "66334278044b7f2b0463ae63d80ca602", "score": "0.6007443", "text": "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.6003619", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.6003619", "text": "def filter_parameters; end", "title": "" }, { "docid": "6bc2c20d55fe920f0edd90f300d70955", "score": "0.5995791", "text": "def whitelist; end", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5993301", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "ad2d2efdf4826b61db96adbdcdb0135b", "score": "0.5993231", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.5984926", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "09ccbed54e2a0b8847b53b642b40efb5", "score": "0.597122", "text": "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "title": "" }, { "docid": "93783c9b6c03c3bd41f75234b31911f8", "score": "0.5968121", "text": "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "title": "" }, { "docid": "54e04b941ee9071107179fe993e57c26", "score": "0.5965808", "text": "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "title": "" }, { "docid": "29eec3df393336ba76ae5f63ed9b4858", "score": "0.59640145", "text": "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "title": "" }, { "docid": "3697f53f660a77b18ff5af51bcf1ca8d", "score": "0.59632224", "text": "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.59602356", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "ab49b0baeea5bf6f204adca9e864094e", "score": "0.59332967", "text": "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.5927556", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.5922805", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "31fc4d8ac77808ea64c22b8bff20997d", "score": "0.5909745", "text": "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "title": "" }, { "docid": "1791be75c23b0ab94b8d566561cf903e", "score": "0.5905083", "text": "def params(list)\n @declared_params = list\n end", "title": "" }, { "docid": "4658b5ebaf35abb1b89c071aed7e018c", "score": "0.5904304", "text": "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "title": "" }, { "docid": "ca90e8f0ec041d26b42d00aa2cbda1e5", "score": "0.5893434", "text": "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "title": "" }, { "docid": "043c7c33fa58658709ce0014319e7aec", "score": "0.58888215", "text": "def allow(ids); end", "title": "" }, { "docid": "34c6b2119736eea4b71998dec50f5f1a", "score": "0.58823985", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "34c6b2119736eea4b71998dec50f5f1a", "score": "0.58823985", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "34c6b2119736eea4b71998dec50f5f1a", "score": "0.58823985", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "e310f8ae001392da6281c299a2572677", "score": "0.5873434", "text": "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "title": "" }, { "docid": "4d77abbae6d3557081c88dad60c735d0", "score": "0.58619875", "text": "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "title": "" }, { "docid": "37656a050c4e4765c2ea464cd3d4e764", "score": "0.58533794", "text": "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "title": "" }, { "docid": "102e96b584d087beda32598a28a382f5", "score": "0.5845531", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7befdf5d03aadb61b4c6e74ed07cd447", "score": "0.58426666", "text": "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "title": "" }, { "docid": "2554d771097b60c5d766de7d29c2dfe5", "score": "0.58360124", "text": "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "title": "" }, { "docid": "43f8788590c98e3b2ddf0bd6c62b24c8", "score": "0.583218", "text": "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "title": "" }, { "docid": "81d27d51beb59227f68929587fe9a1be", "score": "0.5828041", "text": "def safelist; end", "title": "" }, { "docid": "d6bf948034a6c8adc660df172dd7ec6e", "score": "0.5827927", "text": "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "title": "" }, { "docid": "68815c1979e028984e7c2d5abadc2552", "score": "0.5816121", "text": "def valid_for_params_auth?; end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.5814705", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.5812719", "text": "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", "title": "" }, { "docid": "d4c0e2d7913e01bfa09b10bbeb5341ac", "score": "0.581121", "text": "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.5803423", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.5803423", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.57995003", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "7c51a57439a63c303a45aca2ac638401", "score": "0.5794207", "text": "def permitters\n @_parametrizr_permitters || {}\n end", "title": "" }, { "docid": "c8d1b09827dbe3a963c60c741dc68594", "score": "0.5784923", "text": "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "title": "" }, { "docid": "0cbc6ed0eac413e6d26c1e1418b6c62e", "score": "0.5781365", "text": "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "title": "" }, { "docid": "7a108e48bed2cdf492c12286b1c59903", "score": "0.5776385", "text": "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "title": "" }, { "docid": "572ddb6fcaa0b57a2624259cc183bdb0", "score": "0.5774859", "text": "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "title": "" }, { "docid": "09edac0c32ae61b998679363610353e6", "score": "0.57671493", "text": "def url_allowlist; end", "title": "" }, { "docid": "0b6129d775136b0d6037453613f331dd", "score": "0.5766998", "text": "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "title": "" }, { "docid": "2be6c6279f55d8b4842688b8f3cc75f1", "score": "0.57618684", "text": "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.5758038", "text": "def quote_params\n params.permit!\n end", "title": "" } ]
25413bf132396d0c2ef105c86b019fd4
Create a new transformer with Locally Linear Embedding.
[ { "docid": "90f31fc44632842f2c415bc4dd6d3c40", "score": "0.0", "text": "def initialize(n_components: 2, n_neighbors: 10, reg_param: 1e-3)\n super()\n @params = {\n n_components: n_components,\n n_neighbors: [1, n_neighbors].max,\n reg_param: reg_param\n }\n end", "title": "" } ]
[ { "docid": "ccde1a61816167e186dae77ea6ab3359", "score": "0.5945641", "text": "def fit(x, _y = nil)\n raise 'LocallyLinearEmbedding#fit requires Numo::Linalg but that is not loaded' unless enable_linalg?(warning: false)\n\n x = Rumale::Validation.check_convert_sample_array(x)\n\n n_samples = x.shape[0]\n tol = @params[:reg_param].fdiv(@params[:n_neighbors])\n distance_mat = Rumale::PairwiseMetric.squared_error(x)\n neighbor_ids = neighbor_ids(distance_mat, @params[:n_neighbors], true)\n\n affinity_mat = Numo::DFloat.eye(n_samples)\n n_samples.times do |n|\n x_local = x[neighbor_ids[n, true], true] - x[n, true]\n gram_mat = x_local.dot(x_local.transpose)\n gram_mat += tol * gram_mat.trace * Numo::DFloat.eye(@params[:n_neighbors])\n weights = Numo::Linalg.solve(gram_mat, Numo::DFloat.ones(@params[:n_neighbors]))\n weights /= weights.sum + 1e-8\n affinity_mat[n, neighbor_ids[n, true]] -= weights\n end\n\n kernel_mat = affinity_mat.transpose.dot(affinity_mat)\n _, eig_vecs = Numo::Linalg.eigh(kernel_mat, vals_range: 1...(1 + @params[:n_components]))\n\n @embedding = @params[:n_components] == 1 ? eig_vecs[true, 0].dup : eig_vecs.dup\n @x_train = x.dup\n\n self\n end", "title": "" }, { "docid": "cc2b2821150f54220d48402f5b63b181", "score": "0.58246845", "text": "def fit_transform(x, _y = nil)\n unless enable_linalg?(warning: false)\n raise 'LocallyLinearEmbedding#fit_transform requires Numo::Linalg but that is not loaded'\n end\n\n fit(x).transform(x)\n end", "title": "" }, { "docid": "c91753aeef2d5290438ecfc27366d241", "score": "0.57683235", "text": "def embedding\n @embedding ||= from.embedding(label)\n end", "title": "" }, { "docid": "a4ffcfa2038db6feec246613e2129a7e", "score": "0.5024301", "text": "def fit_transform(x, _not_used = nil)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n fit(x)\n @embedding.dup\n end", "title": "" }, { "docid": "00cacc7532ed03fb2d4ef961495ac9df", "score": "0.50042367", "text": "def translate\n call_deepl(language, to_language)\n end", "title": "" }, { "docid": "203a90ea8c9f0e51ef5819781503c7a0", "score": "0.48628768", "text": "def load_embedding_tf(sess, word_to_index, tf_embeddings_file_path, nb_dims)\n\n # 1. Define the variable that will hold the embedding:\n tf_embedding = TensorStream.variable(\n TensorStream.constant(0.0, shape: [word_to_index.size-1, nb_dims]),\n trainable: false,\n name: \"Embedding\"\n )\n\n # 2. Restore the embedding from disks to TensorFlow, GPU (or CPU if GPU unavailable):\n variables_to_restore = [tf_embedding]\n embedding_saver = TensorStream::Train::Saver.new(variables_to_restore)\n embedding_saver.restore(sess, tf_embeddings_file_path)\n puts \"TF embeddings restored from '#{tf_embeddings_file_path}'.\"\n\n tf_embedding\nend", "title": "" }, { "docid": "db21456bfdb82bdc90d1b07adc070ce0", "score": "0.4776654", "text": "def lemmatization_annotate(text)\n preset_nlp(:lemmatization, text)\n end", "title": "" }, { "docid": "ba3b626a1e902a0a7300b3b6993150ca", "score": "0.4744346", "text": "def linear_transform( mat )\n @start = mat * @start\n @end = mat * @end\n self\n end", "title": "" }, { "docid": "2b2951b9b9aa5725cf3e320e833d4f61", "score": "0.4724279", "text": "def transform(x)\n x = Rumale::Validation.check_convert_sample_array(x)\n\n distance_mat = Rumale::PairwiseMetric.squared_error(x, @x_train)\n neighbor_graph = k_neighbor_graph(distance_mat, @params[:n_neighbors], false)\n affinity_mat = if @params[:gamma].nil?\n neighbor_graph\n else\n neighbor_graph * Numo::NMath.exp(-@params[:gamma] * distance_mat)\n end\n normalizer = Numo::NMath.sqrt(affinity_mat.mean * affinity_mat.mean(axis: 1))\n n_train_samples = @x_train.shape[0]\n weight_mat = 1.fdiv(n_train_samples) * (affinity_mat.transpose / normalizer).transpose\n weight_mat.dot(@embedding)\n end", "title": "" }, { "docid": "146d8b9ae50d5612adc48c534296aed4", "score": "0.4724144", "text": "def create_local_coordinate_system(name, datum, unit, axes)\n LocalCoordinateSystem.create(name, datum, unit, axes)\n end", "title": "" }, { "docid": "6cf75e481a3c0fd874afd4520e51f390", "score": "0.46976697", "text": "def using_translator(attr_trans)\n @single_attribute_translator = attr_trans\n return self\n end", "title": "" }, { "docid": "6396e487492e63ee521aa8e7979b2b55", "score": "0.46612352", "text": "def fit(x, _y = nil)\n raise 'LaplacianEigenmaps#fit requires Numo::Linalg but that is not loaded' unless enable_linalg?(warning: false)\n\n x = Rumale::Validation.check_convert_sample_array(x)\n\n distance_mat = Rumale::PairwiseMetric.squared_error(x)\n neighbor_graph = k_neighbor_graph(distance_mat, @params[:n_neighbors], true)\n affinity_mat = if @params[:gamma].nil?\n neighbor_graph\n else\n neighbor_graph * Numo::NMath.exp(-@params[:gamma] * distance_mat)\n end\n degree_mat = affinity_mat.sum(axis: 1).diag\n laplacian_mat = degree_mat - affinity_mat\n\n _, eig_vecs = Numo::Linalg.eigh(laplacian_mat, degree_mat, vals_range: 1...(1 + @params[:n_components]))\n\n @embedding = @params[:n_components] == 1 ? eig_vecs[true, 0].dup : eig_vecs.dup\n @x_train = x.dup\n\n self\n end", "title": "" }, { "docid": "7d56dae029796a2a046e93226f91c4ee", "score": "0.46210974", "text": "def embed(name, model)\n embedding << name unless embedding.include?(name)\n\n define_method(name) do\n return nil unless @embedding.has_key? name\n @_memo[name] ||= begin\n model = Ork::Utils.const(self.class, model)\n new_embedded model, @embedding[name]\n end\n end\n\n define_method(:\"#{name}=\") do |object|\n assert_embeddable object\n\n @embedding[name] = object.attributes\n object.__parent = self\n\n @_memo[name] = object\n end\n end", "title": "" }, { "docid": "f94fc0a875e1cfa4a9c2a28cc38664cc", "score": "0.46123815", "text": "def lax\n Lax.new(Member.new(primitive, **options, member: member.lax, meta: meta))\n end", "title": "" }, { "docid": "ac3b0594449b13cc3803e33bb95abd2f", "score": "0.46056083", "text": "def linearize(pdf_linearize_parameters, opts = {})\n data, _status_code, _headers = linearize_with_http_info(pdf_linearize_parameters, opts)\n data\n end", "title": "" }, { "docid": "b950e132fc856b7d4ea43264bfee0d6c", "score": "0.46028528", "text": "def add_translation_from\n \n end", "title": "" }, { "docid": "2db4e38ab066e461517f0dde78c685ac", "score": "0.45840433", "text": "def transform(x)\n x = Rumale::Validation.check_convert_sample_array(x)\n\n n_samples = x.shape[0]\n tol = @params[:reg_param].fdiv(@params[:n_neighbors])\n distance_mat = Rumale::PairwiseMetric.squared_error(x, @x_train)\n neighbor_ids = neighbor_ids(distance_mat, @params[:n_neighbors], false)\n weight_mat = Numo::DFloat.zeros(n_samples, @x_train.shape[0])\n\n n_samples.times do |n|\n x_local = @x_train[neighbor_ids[n, true], true] - x[n, true]\n gram_mat = x_local.dot(x_local.transpose)\n gram_mat += tol * weight_mat.trace * Numo::DFloat.eye(@params[:n_neighbors])\n weights = Numo::Linalg.solve(gram_mat, Numo::DFloat.ones(@params[:n_neighbors]))\n weights /= weights.sum + 1e-8\n weight_mat[n, neighbor_ids[n, true]] = weights\n end\n\n weight_mat.dot(@embedding)\n end", "title": "" }, { "docid": "608cf229bf3186030a5e3a567e2f53e1", "score": "0.45385593", "text": "def create_with_translatable\n create_without_translatable.tap do |saved|\n update_translations if saved\n end\n end", "title": "" }, { "docid": "608cf229bf3186030a5e3a567e2f53e1", "score": "0.45385593", "text": "def create_with_translatable\n create_without_translatable.tap do |saved|\n update_translations if saved\n end\n end", "title": "" }, { "docid": "bf337e7e99a19a5450550880598a628b", "score": "0.45338747", "text": "def lax\n __new__(type.lax).required(false)\n end", "title": "" }, { "docid": "86dbf5333a771c4d37bbca1f7be52517", "score": "0.4524455", "text": "def lax\n Lax.new(self)\n end", "title": "" }, { "docid": "d1445274248b1fdd5d267572c93dd1aa", "score": "0.45127293", "text": "def linear(data)\n Distribution.new :LISTS, data, mk_shape_fn {|x| x }\n end", "title": "" }, { "docid": "15ea3006f04ff08591e54ede6d2af94f", "score": "0.45113662", "text": "def translate_to!(*args)\n point = args[0]\n point = Vertex3d.new(*args) if args.length == 3\n self.position = point\n matrix.translate_to! position\n self\n end", "title": "" }, { "docid": "691222c93238fff8c924fb07b0ad47e2", "score": "0.45037013", "text": "def translate_arm\n translator = Arm::Translator.new\n methods = collect_methods\n translate_methods( methods , translator)\n label = @init.next\n @init = translator.translate( @init)\n @init.append label\n end", "title": "" }, { "docid": "d9167c162756ad606a44b6a36f592bec", "score": "0.4503503", "text": "def world2local(v); end", "title": "" }, { "docid": "d9167c162756ad606a44b6a36f592bec", "score": "0.4503503", "text": "def world2local(v); end", "title": "" }, { "docid": "29dd7835ef31537f870f0c4708f0a9d6", "score": "0.44937745", "text": "def add_translator(type, &block); end", "title": "" }, { "docid": "fa06b30c42e3c154ea9539974be4daed", "score": "0.44850665", "text": "def add_example_transform(tr)\n checker.check_transformation(frames, tr)\n\t if tr.from == tr.to\n\t\traise ArgumentError, \"trying to register a transformation from #{tr.from} onto itself\"\n\t end\n example_transforms[[tr.from, tr.to]] = tr\n end", "title": "" }, { "docid": "65f28336be286bf35e4ae9a98a4ec9db", "score": "0.4434718", "text": "def inject_translatable_block\n inject_into_class model_path, class_name, generate_translatable_block\n end", "title": "" }, { "docid": "10ced99a717ab6fdea0111ee49d3d190", "score": "0.4427692", "text": "def translator\n @translator ||= self.class.translator(@context)\n end", "title": "" }, { "docid": "853376a78eab4972c86c4f4831948a3e", "score": "0.44273868", "text": "def transformer\n @transformer ||= Transformer.new self\n end", "title": "" }, { "docid": "60eeaacd386d6d6dcf3baa20e4f3a5db", "score": "0.44210505", "text": "def l2l\n magic_request 'l2l'\n end", "title": "" }, { "docid": "1fd2a4484f569fb4232d135c5f25bc67", "score": "0.44120568", "text": "def create_translation\n end", "title": "" }, { "docid": "ab4113a0e9bc0edb24d263b86e875e07", "score": "0.4410136", "text": "def initialize(intersectable, transformation)\n @intersectable = intersectable\n @transf = transformation\n @inv_transf = transformation.s_copy.inv\n @trasp_inv_transf = @inv_transf.s_copy.transpose\n end", "title": "" }, { "docid": "7045283336ebe684b77b8b48eec268ed", "score": "0.44010794", "text": "def create_lp\n lp = LPSolve.new(0, variables.size)\n variables.each do |v|\n ix = index(v)\n lp.set_col_name(ix, \"v_#{ix}\")\n lp.set_int(ix, true)\n end\n lp\n end", "title": "" }, { "docid": "cc369efd7f140a5d82ed6b6fea0e2b02", "score": "0.43931502", "text": "def transform\n transformer.rollout\n end", "title": "" }, { "docid": "d6195150be8e52f0f8a5588554d91fcd", "score": "0.43863848", "text": "def _translator\n @_translator ||= Translator.new( self )\n end", "title": "" }, { "docid": "5ac0035bbbaaf6625d6e046b468d8f13", "score": "0.43771377", "text": "def in_words(opts = {})\n translator = opts.delete(:translator) || Translator.new\n raise InvalidTranslatorException unless translator.respond_to?(:translate)\n translator.translate(self, opts)\n end", "title": "" }, { "docid": "d7206d4718ed0dffcc5fb7831a328665", "score": "0.43742648", "text": "def translate!(*args)\n translate(*args, self)\n end", "title": "" }, { "docid": "286b97753819b97ac317e61d68f68968", "score": "0.4363577", "text": "def translate(tx, ty = 0)\n add_transform(:translate, \"#{tx}, #{ty}\")\n self\n end", "title": "" }, { "docid": "40fcecb16016d20cdbf9218fb24c78dc", "score": "0.43385535", "text": "def initialize(source=ModelPath,name=ModelName)\n super()\n \n @datapath = \"data/lda/\"\n @legacy_model = nil\n if false # hack to use RemoteHash. TODO: integrate nicely.\n @legacy_model = RemoteHash.new(\"mcfadden\",9998)\n @legacy_model.caching=false\n return\n end\n if File.exist?(source)\n @legacy_model = Phi.new(ModelPath,name)\n else\n @legacy_model = LDA.new(source,9999)\n end\n end", "title": "" }, { "docid": "21d590f9d444195cc2c7a16d619bfbcf", "score": "0.43366343", "text": "def embed_one(_what)\n fail 'embedding not implemented yet'\n what = _what.to_s\n if what.plural?\n raise NameError, \"embed_one takes a singular association name (not '#{what}')\"\n end\n add_embedding(\n type: __method__,\n local_attr: what.to_sym,\n )\n end", "title": "" }, { "docid": "bf3e36a3318732a187ebfc88e425e752", "score": "0.43321776", "text": "def fit_transform(x, _y = nil)\n unless enable_linalg?(warning: false)\n raise 'LaplacianEigenmaps#fit_transform requires Numo::Linalg but that is not loaded'\n end\n\n fit(x).transform(x)\n end", "title": "" }, { "docid": "3ac4c1625392fa5296e74374976cde5f", "score": "0.43100855", "text": "def vocab(text)\n Lexeme.new(@py_nlp.vocab[text])\n end", "title": "" }, { "docid": "9fe07db78ab9d348b5e21a84c440ab06", "score": "0.43085587", "text": "def build( doc, id=nil )\n translator = Aqua::Translator.new( new, id )\n translator.unpack_object( doc ) \n end", "title": "" }, { "docid": "f59af86e8fd8914246dac054d5e63a14", "score": "0.43030557", "text": "def type\n :linear\n end", "title": "" }, { "docid": "f59af86e8fd8914246dac054d5e63a14", "score": "0.43030557", "text": "def type\n :linear\n end", "title": "" }, { "docid": "f59af86e8fd8914246dac054d5e63a14", "score": "0.43030557", "text": "def type\n :linear\n end", "title": "" }, { "docid": "4f303d1a1d966ee1e7655ca66f5d2e9d", "score": "0.42915574", "text": "def create_with_translatable\n saved = create_without_translatable\n update_translations if saved\n saved\n end", "title": "" }, { "docid": "2a2021baed69a2fd59e40c2e46243db2", "score": "0.42601302", "text": "def _t(*args)\n @warden_session.translate(*args)\n end", "title": "" }, { "docid": "b4e2c4e85f1314517c9350835ab8d486", "score": "0.42518002", "text": "def textEmbed\n cache_stored_file! if !cached?\n embed_color = '#' + model.embed_color\n coords = model.embed_coords.split(\",\")\n coords.map! {|s| s.to_i}\n\n#old model \n# manipulate! do |source|\n# text = model.embed_text_south#\n\n# txt = Draw.new\n# txt.gravity = SouthGravity\n# txt.pointsize = model.embed_size.to_i\n# txt.stroke = embed_color\n# txt.font_weight = BoldWeight\n# txt.font = Rails.root.join('fonts', 'YaHei.ttf').to_s\n# txt.font_family = 'Helvetica'\n# txt.fill = embed_color\n# source = source.resize_to_fill(400, 400)\n# source.annotate(txt, 0, 0, 0, 5, text)\n# end\n# \n# \n# manipulate! do |source|\n# text = model.embed_text_north#\n\n# txt = Draw.new\n# txt.gravity = NorthGravity\n# txt.pointsize = model.embed_size.to_i\n# txt.stroke = embed_color\n# txt.font_weight = BoldWeight\n# txt.font = Rails.root.join('fonts', 'YaHei.ttf').to_s\n# txt.font_family = 'Helvetica'\n# txt.fill = embed_color\n# source = source.resize_to_fill(400, 400)\n# source.annotate(txt, 0, 0, 0, 5, text)\n# end\n\n#new model\n manipulate! do |source|\n text = model.embed_text\n \n txt = Draw.new\n# txt.gravity = Default\n txt.pointsize = model.embed_size.to_i\n txt.stroke = embed_color\n txt.font_weight = BoldWeight\n txt.font = Rails.root.join('fonts', 'YaHei.ttf').to_s\n txt.font_family = 'Helvetica'\n txt.fill = embed_color\n source = source.resize_to_fill(400, 400)\n source.annotate(txt, coords[0], coords[1], coords[2], coords[3]+15, text)\n end\n\n\nend", "title": "" }, { "docid": "67ef73b863df7b348c2aa855794624f6", "score": "0.4250638", "text": "def embed!(part, index, new_word)\n self.meaning[part] = :embedded\n self.word = word.sub(index.to_s, new_word)\n end", "title": "" }, { "docid": "3295ebefe6ac286cec6dbd4cfaf0e713", "score": "0.42392814", "text": "def warp vector\n @shape.body.p = vector\n end", "title": "" }, { "docid": "ad6ca807526a4203959c2c0d10c72cf0", "score": "0.42337364", "text": "def translate!(vec)\n raise TypeError if vec.class == Vector3D\n raise TypeError if vec.size != 3\n self.set_position(@position + Vector3DInternal[ *vec ])\n end", "title": "" }, { "docid": "3fd1578e9efd83e1c9762987a3429dec", "score": "0.4227845", "text": "def transformer(klass = SkoogleDocs::Transformer)\n klass.new(@source)\n end", "title": "" }, { "docid": "020e76cf29d71863579892a47212d6e6", "score": "0.4224904", "text": "def use_sdf_world\n world = sdf_world\n exclude_models = []\n if sdf_model\n exclude_models << sdf_model.name\n end\n transformer.parse_sdf_world(world, exclude_models: exclude_models)\n # There can be only one world ... name it 'world'\n if !transformer.has_frame?('world')\n transformer.static_transform Eigen::Vector3.Zero, world.full_name => 'world'\n end\n end", "title": "" }, { "docid": "ca2c1a031c92c2033ffd8409e6c4038e", "score": "0.42231604", "text": "def from_thrift(*args)\n t = args[0]\n initialize(t.spans.collect { |s| Span.from_thrift(s) })\n end", "title": "" }, { "docid": "a30ecb92b37956f99aa18fe933d8dcc5", "score": "0.42200896", "text": "def add__embedded\n attach_new_node(type: :embedded, name: '_embedded')\n end", "title": "" }, { "docid": "6baad5035fa25628b4ef5774fc4b6415", "score": "0.42005575", "text": "def translator; end", "title": "" }, { "docid": "a61dc4451d8720faacdf0bcbb3a21570", "score": "0.41950133", "text": "def vector(word)\n# return @legacy_model[word]\n return @legacy_model.vector(word)\n end", "title": "" }, { "docid": "44458b990430893676b1ab0c489fcc58", "score": "0.41912484", "text": "def lift\n Lifted.new(self)\n end", "title": "" }, { "docid": "8600da86e6b1611ed87cad565222300b", "score": "0.41871202", "text": "def translate_to_energyplus(model, logger = nil)\n logger ||= ::Logger.new($stdout)\n logger.info 'Translate object to EnergyPlus IDF in preparation for EnergyPlus'\n a = ::Time.now\n # ensure objects exist for reporting purposes\n model.getFacility\n model.getBuilding\n forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new\n model_idf = forward_translator.translateModel(model)\n b = ::Time.now\n logger.info \"Translate object to EnergyPlus IDF took #{b.to_f - a.to_f}\"\n model_idf\n end", "title": "" }, { "docid": "31dce2900dab816d990a0ba7fce3e2fa", "score": "0.41824654", "text": "def translate(_source, _target, _text)\n get_token if expired?\n\n headers = {\n \"Authorization\": token,\n \"Content-Type\": 'text/plain'\n }\n options = {\n body: _text,\n headers: headers,\n query: { \"sourceLang\": _source, \"targetLang\": _target }\n }\n response = HTTParty.post('http://live.lingmo-api.com/v1/translation/dotranslate', options)\n\n response['ResponseText']\n end", "title": "" }, { "docid": "446e01a8a654bcc339fd88c8e3af1b85", "score": "0.41763383", "text": "def translate(vec)\n tmp = Marshal.load(Marshal.dump(self))\n tmp.translate!(vec)\n return tmp\n end", "title": "" }, { "docid": "bbaedc3e92672d25d489165d1d188b6c", "score": "0.41698498", "text": "def transform(*t)\n a11, a12, a21, a22 = t.flatten\n x, y = self.x, self.y\n Vector.new(a11*x + a12*y, a21*x + a22*y)\n end", "title": "" }, { "docid": "0a44ba67e7bed04b82b8694a15c6a6bd", "score": "0.41668823", "text": "def translate(language_code)\n \n term = nil\n \n if term_translation = ::ContentManagerSystem::Translation::TermTranslation.get(id)\n translated_attributes = {}\n term_translation.get_translated_attributes(language_code).each {|term| translated_attributes.store(term.concept.to_sym, term.translated_text)}\n term = Term.new(attributes.merge(translated_attributes){ |key, old_value, new_value| new_value.to_s.strip.length > 0?new_value:old_value})\n else\n term = self\n end\n \n term.language_code = language_code\n \n term\n \n end", "title": "" }, { "docid": "67a4eee6e0c78ae35f4fc66453a52905", "score": "0.41629788", "text": "def language_translation_translate_deu_to_eng_with_http_info(input, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LanguageTranslationApi.language_translation_translate_deu_to_eng ...'\n end\n # verify the required parameter 'input' is set\n if @api_client.config.client_side_validation && input.nil?\n fail ArgumentError, \"Missing the required parameter 'input' when calling LanguageTranslationApi.language_translation_translate_deu_to_eng\"\n end\n # resource path\n local_var_path = '/nlp-v2/translate/language/deu/to/eng'\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', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(input)\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 => 'LanguageTranslationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageTranslationApi#language_translation_translate_deu_to_eng\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3405c517d847ee4fec6884e68e08e84c", "score": "0.41624576", "text": "def translate text, to: nil, from: nil, format: nil, model: nil, cid: nil\n body = {\n q: Array(text), target: to, source: from, format: format,\n model: model, cid: cid\n }.compact.to_json\n\n post \"/language/translate/v2\", body\n end", "title": "" }, { "docid": "602a3c38ec1259d0511b2dd0bed4b35c", "score": "0.41620055", "text": "def setTranslation(t, rel_to = nil, local = true)\n if rel_to\n if local\n @t = rel_to.getTranslation() +\n rel_to.getQuaternion().transform(t)\n else\n @t = rel_to.getTranslation() + t\n end\n else\n @t = t\n end\n end", "title": "" }, { "docid": "234edee0576e6bee189b6775d72b8efc", "score": "0.41605106", "text": "def set_lent_model\n @lent_model = LentModel.find(params[:id])\n end", "title": "" }, { "docid": "ecda893c3d4ab4fe9ddd5591c796f0e2", "score": "0.41356775", "text": "def vector(word)\n return @legacy_model.vector(word)\n end", "title": "" }, { "docid": "b981ff53be622f2add5682e16b320759", "score": "0.41355166", "text": "def translateAndPredict input\r\n\t\tpredict(translateFeatureInput input)\r\n\tend", "title": "" }, { "docid": "8f628aa441f345df431b3e2dac9a5fd7", "score": "0.41310745", "text": "def translate\n\n @translated_object = self.initialize_translated_object.nil? ?\n self.translated_class.new :\n initialize_translated_object.call(self)\n\n self.columns.each do |column|\n column.translate translated_object, self\n end\n @translated_object\n\n end", "title": "" }, { "docid": "2b5d91fdb5ddcf5cecc738803a7dc39e", "score": "0.41304436", "text": "def translate_to_energyplus(model, logger = nil)\n logger ||= ::Logger.new($stdout)\n logger.info 'Translate object to EnergyPlus IDF in preparation for EnergyPlus'\n a = ::Time.now\n # ensure objects exist for reporting purposes\n model.getFacility\n model.getBuilding\n ft = OpenStudio::EnergyPlus::ForwardTranslator.new\n\n ft_options = @options[:ft_options]\n if !ft_options.empty?\n\n msg = \"Custom ForwardTranslator options passed:\\n\"\n\n ft_options.each do |opt_flag_name, h|\n ft_method = h[:method_name]\n opt_flag = h[:value]\n\n # Call the FT setter with the value passed in\n ft.method(ft_method).call(opt_flag)\n\n msg += \"* :#{opt_flag_name}=#{opt_flag} => ft.#{ft_method}(#{opt_flag})\\n\"\n end\n\n logger.info msg\n end\n\n model_idf = ft.translateModel(model)\n b = ::Time.now\n logger.info \"Translate object to EnergyPlus IDF took #{b.to_f - a.to_f}\"\n model_idf\n end", "title": "" }, { "docid": "3eb1c57c5b483a5cddae7536db184cbe", "score": "0.41274923", "text": "def translator\n @@translator ||= Translator.new\n end", "title": "" }, { "docid": "3eb1c57c5b483a5cddae7536db184cbe", "score": "0.41274923", "text": "def translator\n @@translator ||= Translator.new\n end", "title": "" }, { "docid": "75560653e1c9c00f87826d50518e0170", "score": "0.41257474", "text": "def lax\n type.lax\n end", "title": "" }, { "docid": "39832b7c65149d8e635e883213be623d", "score": "0.41227052", "text": "def translate_to_energyplus(model, logger = nil)\r\n logger = ::Logger.new(STDOUT) unless logger\r\n logger.info 'Translate object to EnergyPlus IDF in preparation for EnergyPlus'\r\n a = ::Time.now\r\n # ensure objects exist for reporting purposes\r\n model.getFacility\r\n model.getBuilding\r\n forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new\r\n model_idf = forward_translator.translateModel(model)\r\n b = ::Time.now\r\n logger.info \"Translate object to EnergyPlus IDF took #{b.to_f - a.to_f}\"\r\n model_idf\r\n end", "title": "" }, { "docid": "83073d7523acd170a4071d4d48e8cde8", "score": "0.41212672", "text": "def embed_many(what)\n fail 'embedding not implemented yet'\n what = what.to_s\n unless what.plural?\n raise NameError, \"embeds_many expects a plural association name (not '#{what}')\"\n end\n add_embedding(\n type: __method__,\n local_attr: what.to_sym\n )\n end", "title": "" }, { "docid": "56debd6e2003af70ca43164be38a95c5", "score": "0.41081047", "text": "def translator\n @translator ||= Translator.new\n end", "title": "" }, { "docid": "56debd6e2003af70ca43164be38a95c5", "score": "0.41081047", "text": "def translator\n @translator ||= Translator.new\n end", "title": "" }, { "docid": "56debd6e2003af70ca43164be38a95c5", "score": "0.41081047", "text": "def translator\n @translator ||= Translator.new\n end", "title": "" }, { "docid": "df08df6de20e66c28551b9c7838929e8", "score": "0.40979528", "text": "def train\n response_data = @app.client.model_train @id\n Clarinet::Model.new @app, response_data[:model]\n end", "title": "" }, { "docid": "6ff546e629ba975472cdf78592a914d4", "score": "0.40923402", "text": "def transformers\n [embed_transformer]\n end", "title": "" }, { "docid": "15c78f4d8d2f95065bf9d1487028b6bc", "score": "0.40902767", "text": "def ext_local\n mod = context_module('Local')\n return self if is_a?(mod)\n extend(mod).ext_local\n end", "title": "" }, { "docid": "897e3700ccb5976e2a41f082b50b8f03", "score": "0.40894133", "text": "def add_translations(relation, opts, locale, invert:)\n outer_join = require_outer_join?(opts, invert)\n return relation if already_joined?(relation, table_name, outer_join)\n\n t = model_class.const_get(subclass_name).arel_table\n m = model_class.arel_table\n join_type = outer_join ? ::Arel::Nodes::OuterJoin : ::Arel::Nodes::InnerJoin\n relation.joins(m.join(t, join_type).\n on(t[foreign_key].eq(m[:id]).\n and(t[:locale].eq(locale))).join_sources)\n end", "title": "" }, { "docid": "4c51a1609a53530468b6e81881871975", "score": "0.40851527", "text": "def language_translation_translate_rus_to_eng_with_http_info(input, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LanguageTranslationApi.language_translation_translate_rus_to_eng ...'\n end\n # verify the required parameter 'input' is set\n if @api_client.config.client_side_validation && input.nil?\n fail ArgumentError, \"Missing the required parameter 'input' when calling LanguageTranslationApi.language_translation_translate_rus_to_eng\"\n end\n # resource path\n local_var_path = '/nlp-v2/translate/language/rus/to/eng'\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', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(input)\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 => 'LanguageTranslationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageTranslationApi#language_translation_translate_rus_to_eng\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d82633009c4f5d71ef98786be131872c", "score": "0.4080718", "text": "def fit_transform(x, _y = nil)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n raise 'FactorAnalysis#fit_transform requires Numo::Linalg but that is not loaded' unless enable_linalg?(warning: false)\n\n fit(x).transform(x)\n end", "title": "" }, { "docid": "abdb837f43d3f1e34fadf1c3b0054f51", "score": "0.4076998", "text": "def with_metadata(metadata)\n self.class.new(world, metadata: metadata, **transform_args_hash)\n end", "title": "" }, { "docid": "535abe042a462f521196e953757d4c65", "score": "0.40699816", "text": "def initialize(model = \"en_core_web_sm\")\n @spacy_nlp_id = \"nlp_#{model.object_id}\"\n PyCall.exec(\"import spacy; #{@spacy_nlp_id} = spacy.load('#{model}')\")\n @py_nlp = PyCall.eval(@spacy_nlp_id)\n end", "title": "" }, { "docid": "04871861a991f1c601bec245d6567833", "score": "0.40695307", "text": "def warp(vect)\n @body.p = vect\n end", "title": "" }, { "docid": "130b22e3e9c6e351406964f84b7f65f4", "score": "0.40691242", "text": "def transformer\n MetadataTransformer.instance(self)\n end", "title": "" }, { "docid": "2038f94a621cb861e77da44a37322069", "score": "0.40592688", "text": "def add_lsi(name, key_name)\n local_secondary_indices[name.to_s] = LocalSecondaryIndex.new(name.to_s, key_name.to_s)\n end", "title": "" }, { "docid": "566ad6f0c5f1733518d96bcbf308689a", "score": "0.40591902", "text": "def add_international_text(language, keyword, translated_keyword, text, compressed = false)\n add_chunk(Chunks::ChunkiTXt.assemble(language, keyword, translated_keyword, text, compressed))\n end", "title": "" }, { "docid": "982a391adebe5ab8e8a3d71dee365fde", "score": "0.40567446", "text": "def en_to_ll(ee, nn, proj_type = 'National Grid')\n\n proj = ProjectionInfo.new(proj_type)\n phi_0, lam_0, n_0, e_0, f_0, a, b, e_2 = proj.returnInfo\n\n n = (a-b) / (a+b)\n phi_pr = (nn - n_0) / (a * f_0) + phi_0\n \n # A few useful differences.\n phi_d = phi_pr - phi_0\n phi_p = phi_pr + phi_0\n \n m = 0\n eval(@@m_eqn)\n comp = nn - n_0 - m\n \n while comp >= 0.01e-3\n phi_pr = comp / (a * f_0) + phi_pr\n phi_d = phi_pr - phi_0\n phi_p = phi_pr + phi_0\n m = ''\n eval(@@m_eqn)\n comp = nn - n_0 - m\n end\n\n v \t = a * f_0 * (1-e_2 * sin2(phi_pr))**-0.5\n rho \t= a * f_0 * (1-e_2) * (1-e_2*sin2(phi_pr))**-1.5\n eta_2 = (v / rho) - 1\n\n vii = tan(phi_pr) / (2*rho*v)\n viiia = tan(phi_pr) / (24*rho*v**3)\n viiib = 5+3*tan2(phi_pr) + eta_2 - 9*(tan2(phi_pr))*eta_2\n viii = viiia * viiib\n\n ixa = tan(phi_pr) / (720*rho*v**5) \n ixb = 61 + 90*tan2(phi_pr) + 45*tan4(phi_pr)\n ix = ixa * ixb\n\n x = 1 / (cos(phi_pr)*v)\n\n xia = 1 / (cos(phi_pr)*6*v**3)\n xib = v / rho + 2*tan2(phi_pr)\n xi = xia * xib\n\n xiia = 1 / (cos(phi_pr)*120*v**5)\n xiib = 5 + 28*tan2(phi_pr)+24*tan4(phi_pr)\n xii = xiia * xiib\n\n xiiia = 1 / (cos(phi_pr)*5040*v**7)\n xiiib = 61 + 662*tan2(phi_pr)+1320*tan4(phi_pr)+720*tan6(phi_pr)\n xiii = xiiia * xiiib\n\n # Fancy debug printing.\n if @debug\n [:v, :rho, :eta_2, :vii, :viii, :ix, :x, :xi, :xii, :xiii].each {|n|\n name = n.id2name\n val = eval(n.id2name)\n printf \"%s\\t%10.10e\\n\", name, val\n }\n end\n\n phi = phi_pr - vii*(ee-e_0)**2 + viii*(ee-e_0)**4 - ix*(ee-e_0)**6\n lam = lam_0 + x*(ee-e_0) - xi*(ee-e_0)**3 + xii*(ee-e_0)**5 - xiii*(ee-e_0)**7\n [phi, lam]\n end", "title": "" }, { "docid": "1cd54f16f3afd6ae294e599ee5fddf01", "score": "0.40543073", "text": "def translation *args\n xyz = args.shift if args.first.is_a?(NMatrix) || args.first.is_a?(Array)\n default_dtype = xyz.respond_to?(:dtype) ? xyz.dtype : NMatrix.guess_dtype(xyz)\n opts = {dtype: default_dtype}\n opts = opts.merge(args.pop) if args.size > 0 && args.last.is_a?(Hash)\n xyz ||= args\n\n n = if args.size > 0\n NMatrix.eye(4, opts)\n else\n NMatrix.eye(4, opts)\n end\n n[0..2,3] = xyz\n n\n end", "title": "" }, { "docid": "ae1ce5850380533f6630ce9ff1364cf4", "score": "0.4045661", "text": "def create_translation\n translation.create(translation_attributes)\n #reset_translation_changes\n #reset_translation\n end", "title": "" }, { "docid": "ff29cbbe8c851aaef9e54369bf8754c3", "score": "0.40413743", "text": "def train_from_example sentence, context\n sentence_arr = sentence.split(\" \")\n possible_center_tokens=[]\n sentence_arr.each do |word|\n token_id = self.vocab[word]\n raise Exception, \"Word: \"+word+\" not in vocabulary.\" if token_id.nil?\n possible_center_tokens << self.vocab[word]\n end\n cost=0.0\n delta_out = WordRepresentation.zero(self.outputV.row_count, self.outputV.column_count)\n delta_in = WordRepresentation.zero(self.inputV.row_count, self.inputV.column_count)\n possible_center_tokens.each_with_index do |current_word,i|\n start_i=i-context\n end_i=i+context\n start_i = 0 if start_i<0\n end_i = possible_center_tokens.size-1 if i>possible_center_tokens.size-1\n c,d_in, d_out=skip_gram(current_word, possible_center_tokens[start_i..end_i])\n cost+=c\n delta_in+=d_in\n delta_out+=d_out\n end\n [cost, delta_out, delta_in]\n end", "title": "" }, { "docid": "60562138ec4af5fffb6f718f0958638e", "score": "0.4040479", "text": "def build!\n unless is_built?\n WLang::Dialect::Loader.new(self).instance_eval(&@builder)\n @built = true\n end\n self\n end", "title": "" }, { "docid": "c322aa70d40351ace06e72122c1aff6c", "score": "0.4035583", "text": "def language_translation_translate_eng_to_rus_with_http_info(input, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LanguageTranslationApi.language_translation_translate_eng_to_rus ...'\n end\n # verify the required parameter 'input' is set\n if @api_client.config.client_side_validation && input.nil?\n fail ArgumentError, \"Missing the required parameter 'input' when calling LanguageTranslationApi.language_translation_translate_eng_to_rus\"\n end\n # resource path\n local_var_path = '/nlp-v2/translate/language/eng/to/rus'\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', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(input)\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 => 'LanguageTranslationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageTranslationApi#language_translation_translate_eng_to_rus\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ea47bcd31b96404ab85e165742f236cf", "score": "0.40339372", "text": "def language_translation_translate_eng_to_deu_with_http_info(input, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LanguageTranslationApi.language_translation_translate_eng_to_deu ...'\n end\n # verify the required parameter 'input' is set\n if @api_client.config.client_side_validation && input.nil?\n fail ArgumentError, \"Missing the required parameter 'input' when calling LanguageTranslationApi.language_translation_translate_eng_to_deu\"\n end\n # resource path\n local_var_path = '/nlp-v2/translate/language/eng/to/deu'\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', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(input)\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 => 'LanguageTranslationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageTranslationApi#language_translation_translate_eng_to_deu\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "35164e7f3744d5fae1b7ab42ade25936", "score": "0.0", "text": "def consulting_params\n params.require(:consulting).permit(:name, :description, :user_id, :location)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
1ad2cd96bdeb2e6bda8502b2cf60fdf9
function that draws the background and losing font when the users loses the game
[ { "docid": "7e2b2ffbf76093dbe06f9b68121251e3", "score": "0.59972864", "text": "def draw_lose\n draw_quad( 0, 0, LTOP_COLOR,\n @width, 0, LTOP_COLOR,\n 0, @height, LBOTTOM_COLOR,\n @width, @height, LBOTTOM_COLOR,\n -1 )\n @endFont.draw(\"You lose...\", @width/2 - 150, @height/2, 0, 4, 4, 0xFFFFFFFF)\n end", "title": "" } ]
[ { "docid": "1b9bda5a09b0b7f64e092e7286317bb0", "score": "0.6585171", "text": "def draw_background\r\n Gosu.draw_rect 0, 0, self.width, self.height, Gosu::Color::BLACK\r\n end", "title": "" }, { "docid": "2c7bfec7397e01d58c13ecc55c714bd1", "score": "0.6490509", "text": "def draw\r\n @font.draw_text(\"No Longer Human!\", 50,50,0)\r\n end", "title": "" }, { "docid": "cab4dd4afb50692abc842e9e04ee969c", "score": "0.6441676", "text": "def draw_background\n Gosu.draw_rect(0, 0, 1000, 700, @background, ZOrder::BACKGROUND, mode=:default)\n\tend", "title": "" }, { "docid": "a507fa2fa4c796e5cc8d0836cd6f1e7b", "score": "0.64118695", "text": "def draw\n @background_image.draw 0, 0, ZOrder::BACKGROUND\n case @game_settings.current_screen\n when \"start\"\n start_screen\n when \"levels\"\n levels_screen\n when \"gameover\"\n game_over_screen\n when \"game\"\n @deck.deal_cards! @playing_cards\n\n if @game_settings.is_cpu_player_enabled\n @subtitle_font.draw_text \"Computer:\", 645, 215, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n @subtitle_font.draw_text \"Score : #{@computer_signal.score}\", 645, 245, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n\n # Computer messages\n if @true_mes\n @subtitle_font.draw_text \"I found a set!\", 645, 275, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n if @computer_signal.score > @p1.score\n @subtitle_font.draw_text \"#{@computer_signal.mean_msg}\", 645, 305, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n end\n\n @subtitle_font.draw_text \"Still trying!\", 645, 275, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK if @trying_mes\n\n @subtitle_font.draw_text \"Oops not a set!\", 645, 275, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK if @false_mes\n\n # Creates players if need be.\n if !@players_created\n @p1 = Player.new 1 if @game_settings.p1_init\n @p2 = Player.new 2 if @game_settings.p2_init\n @players_created = true\n end\n\n Gosu.draw_rect 640,0,280,480,Gosu::Color::GRAY,ZOrder::UI\n\n @subtitle_font.draw_text \"Player 1 Statistics:\", 645, 0, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n if @p1.set_times.length > 0\n \t@subtitle_font.draw_text \"Fastest time to find a set: #{@p1.set_times.at 0}\", 645, 30, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t@subtitle_font.draw_text \"Slowest time to find a set: #{@p1.set_times.at -1}\", 645, 60, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t@subtitle_font.draw_text \"Average time to find a set: #{@p1.time_sum / @p1.set_times.length}\", 645, 90, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n else\n \t@subtitle_font.draw_text \"No sets found yet\", 645, 30, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n @subtitle_font.draw_text \"Hints used: #{@p1.hints_used}\", 645, 120, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK if @game_settings.are_hints_enabled\n @subtitle_font.draw_text \"Score: #{@p1.score}\", 645, 150, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n @subtitle_font.draw_text \"Total Game Time: #{@game_timer.current}\", 645, 490, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \n if @game_settings.p2_init\n @subtitle_font.draw_text \"Player 2 Statistics:\", 645, 280, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \tif @p2.set_times.length > 0\n \t @subtitle_font.draw_text \"Fastest time to find a set: #{@p2.set_times.at 0}\", 645, 310, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t @subtitle_font.draw_text \"Slowest time to find a set: #{@p2.set_times.at -1}\", 645, 340, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t @subtitle_font.draw_text \"Average time to find a set: #{@p2.time_sum / @p2.set_times.length}\", 645, 370, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \telse\n \t @subtitle_font.draw_text \"No sets found yet\", 645, 310, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \tend\n \t@subtitle_font.draw_text \"Score: #{@p2.score}\", 645, 430, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n\n num_cols = @playing_cards.length / 3\n count, x_offset, y_offset, x_between, y_between = 0, 5, 35, 90, 135\n (0...3).each do |row|\n (0...num_cols).each do |col|\n @playing_cards[count].image.draw(x_offset + x_between*col, y_offset + y_between*row, ZOrder::CARDS, 0.15, 0.15)\n count += 1\n end\n end\n\n # Prints out hints\n @hint.each do |card_index|\n # initial card corner values.\n left_x ,right_x, top_y, bottom_y = 5, 85, 40, 160\n\n # Highlight for hints\n draw_rect left_x + x_between*(card_index % num_cols), top_y + y_between*(card_index / num_cols),80,10,Gosu::Color::BLACK,ZOrder::CARDS\n draw_rect left_x + x_between*(card_index % num_cols), top_y + y_between*(card_index / num_cols),10,130,Gosu::Color::BLACK,ZOrder::CARDS\n draw_rect left_x + x_between*(card_index % num_cols), bottom_y + y_between*(card_index / num_cols),80,10,Gosu::Color::BLACK,ZOrder::CARDS\n draw_rect right_x + x_between*(card_index % num_cols), top_y + y_between*(card_index / num_cols),10,130,Gosu::Color::BLACK,ZOrder::CARDS\n end\n\n #TO MOVE RECTANGLE:\n # X POSITION = @currentCardIndex % numCols\n # Y POSITION = @currentCardIndex / numCols\n if @game_settings.p1_init\n x_movement = x_offset + (x_between/2.4) + x_between*(@p1.current_card_index % num_cols)\n y_movement = y_offset + (y_between/2) + y_between*(@p1.current_card_index / num_cols)\n\n # Draws current position\n draw_rect x_movement, y_movement, 20, 20, Gosu::Color::CYAN,ZOrder::CARDS\n\n # Draws current selected values\n @p1.chosen_cards_indexes.each {|index| draw_rect(x_offset + (x_between/2.4) + (x_between)*(index % num_cols), y_offset + (y_between/2) + y_between*(index / num_cols), 20, 20, Gosu::Color::CYAN, ZOrder::CARDS)}\n end\n if @game_settings.p2_init\n x_movement = x_offset + (x_between/2.4) + x_between*(@p2.current_card_index % num_cols)\n y_movement = (y_between/2) + y_between*(@p2.current_card_index / num_cols)\n\n # Draws current position\n draw_rect x_movement, y_movement, 20, 20, Gosu::Color::FUCHSIA, ZOrder::CARDS\n\n # Draws current selected values\n @p2.chosen_cards_indexes.each {|index| draw_rect(x_offset + (x_between/2.4) + (x_between)*(index % num_cols), (y_between/2) + y_between*(index / num_cols), 20, 20, Gosu::Color::FUCHSIA, ZOrder::CARDS)}\n end\n end\n end", "title": "" }, { "docid": "7c0706dbad45039bb3f5fd2de8987e90", "score": "0.6376328", "text": "def do_undraw( event )\n undraw( event.screen, event.background )\n end", "title": "" }, { "docid": "a1edcbc96b05f8889a7af6b8e0f5871c", "score": "0.63734424", "text": "def draw\r\n @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)\r\n @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, \"Close\")\r\n draw_border((SCREEN_WIDTH/3) + 105, 305, mouse_x, mouse_y)\r\n @function_UI.big_font.draw_text(\"GAME OVER!\", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Your Score: #{@score}\", @function_UI.pos-100, 200, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Time of Game PLay: #{@game_play_time} Seconds\", @function_UI.pos-140, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n end", "title": "" }, { "docid": "28cd65a85c6a0dfd659a76dca2a42746", "score": "0.6360184", "text": "def draw_background(windowskin)\r\n self.contents.clear\r\n bitmap = RPGCache.windowskin(windowskin)\r\n self.contents.blt(0, 0, bitmap, bitmap.rect)\r\n end", "title": "" }, { "docid": "b9c502bbf2cd4b299966b5b33567d5bd", "score": "0.63423085", "text": "def victory_screen\n system 'clear'\n 'GAME OVER'\n Catpix::print_image \"victory_screen.jpg\",\n :limit_x => 1.0,\n :limit_y => 0,\n :center_x => true,\n :center_y => true,\n :bg => \"white\",\n :bg_fill => true\n abort(\"See you next time.\".red)\nend", "title": "" }, { "docid": "cb294445ec5e5c614786537eabda0288", "score": "0.63115424", "text": "def game_over_text\n Text.new(\"Game Over\", color: 'orange', x: Window.width / 6, y: Window.height / 3, z: 1, size: 80) # need to find a way to make it centered and scaled with window size\n Text.new(\"Press 'R' to restart\", color: 'orange', x: (Window.width / 6) + 45, y: (Window.height / 3) + 85, z: 1, size: 40)\n end", "title": "" }, { "docid": "47e36bbac923bf9b2c01d50c136034d7", "score": "0.627388", "text": "def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend", "title": "" }, { "docid": "5680de3c7ef41d60488163eb01db3a72", "score": "0.6211661", "text": "def hide\n call Screen.setColor(false)\n call draw\n end", "title": "" }, { "docid": "e4df0b00286582cc1d9f44687c1fd07f", "score": "0.6149265", "text": "def game_over\n @scene.window.cursor = true\n x = 0\n y = @scene.height * 0.3\n x1 = 0\n x2 = @scene.width\n y1 = @scene.height * 0.3\n y2 = @scene.height * 0.6\n draw_window(x, y, x1, x2, y1, y2, @game_over_img)\n\n load_gm_btns unless @no_button && @yes_button\n\n @no_button.draw\n @yes_button.draw\n end", "title": "" }, { "docid": "bad381403e4adaa5c0f256048d678c6c", "score": "0.6093106", "text": "def clear\n\t\t@screen.fill_rect 0, 0, @width, @height, @color_bg\n\tend", "title": "" }, { "docid": "d32b6f49f63879998ecf71fdd366f7f2", "score": "0.6080948", "text": "def draw_background\n Gosu.draw_rect(0, 0, 600, 800, @background, ZOrder::BACKGROUND, mode=:default)\n Gosu.draw_rect(40, 40, 510, 710, @player, ZOrder::PLAYER, mode=:default)\n #Gosu.draw_rect(40, 370, 200, 700, @u_background, ZOrder::U_BACKGROUND, mode=:default)\n display_track(@album.tracks[@present_track].name.chomp+ \" from album \" + @album.title)\n draw_albums()\n draw_buttons()\n\tend", "title": "" }, { "docid": "14501a869e82707cb9da397ef86cb7e1", "score": "0.6062328", "text": "def update_text_draw\n if @fade_out == false && !$game_temp.message_text.nil?\n @contents_showing = true\n $game_temp.message_window_showing = true\n @text_stack.dispose\n set_origin(0, 0)\n @fade_in = true\n self.visible = true\n init_window\n @name_window.contents_opacity = self.contents_opacity = 0\n @name_window.opacity = self.opacity = $game_temp.message_text.size == 0 ? 0 : 255\n refresh\n return true\n end\n return false\n end", "title": "" }, { "docid": "c0a1fea4e6735fe16168ebe4cb06a418", "score": "0.60574913", "text": "def draw_background\n @background.draw\n end", "title": "" }, { "docid": "cddf40f038fcb5d00f0aa610aa4d763d", "score": "0.6040265", "text": "def reset\n @victory = false\n @win = false\n drawFromPixmap\n end", "title": "" }, { "docid": "a430fba85dc92ffec31e58525387046b", "score": "0.6027885", "text": "def draw_background\n draw_line(690 ,0, Gosu::Color::RED, 690, 600, Gosu::Color::RED, ZOrder::PLAYER, mode=:default)#Person's torso\n Gosu.draw_rect(0, 0, 1000, 600, @background1 , ZOrder::BACKGROUND, mode = :default)\n end", "title": "" }, { "docid": "d788a61c49198eccc814fa4c2b4ca967", "score": "0.6011838", "text": "def erase\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + @size)\n end", "title": "" }, { "docid": "373b82d40bd015664cbe48ca2f47ad90", "score": "0.5994127", "text": "def unload_font(font_handle)\n end", "title": "" }, { "docid": "a4c9b1c17d2b6268082812513e5a7b2f", "score": "0.59832764", "text": "def update\n if @think_time % 6 == 0\n self.bitmap.clear \n @think_text +=\".\" \n if self.bitmap.text_size(@think_text).width > self.width\n reset_text\n end\n self.bitmap.draw_outline_text(0, 0, self.width, self.height, @think_text)\n end\n super\n if @think_time > 0\n @think_time -= 1\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "a4aa81b2d6e2a9e8ab5d28fdcf219436", "score": "0.5962528", "text": "def reset_window\n @background = $game_message.background\n @position = $game_message.position\n if @background == 0\n self.opacity = 255\n else\n self.opacity = 0\n end\n # Calculate Window X/Y and Size depends on Pop or normal message\n if @pop != nil\n $nms.msg_h = [((@text_line * WLH) + 8), $nms.msg_h_user].min\n $nms.msg_w = @all_text_width + 32\n \n case @pop\n when 0 # Player\n set_window_xy($game_player)\n when -1 # This Event\n set_window_xy($game_map.events[$game_message.event_id])\n else # Event ID\n set_window_xy($game_map.events[@pop])\n end\n else\n $nms.msg_h = ((((@text_line * WLH) + 8) > $nms.msg_h_user) and ($nms.txt_scrl == false)) ? ((@text_line * WLH) + 8) : $nms.msg_h_user\n $nms.msg_w = NMS_MSGWIN_WIDTH\n self.x = $nms.msg_x\n case @position\n when 0 # Down\n self.y = 0\n @gold_window.y = 360\n when 1 # Middle\n self.y = ((Graphics.height - $nms.msg_h) / 2)\n @gold_window.y = 0\n when 2 # Up\n self.y = Graphics.height - $nms.msg_h\n @gold_window.y = 0\n end\n end\n # Temporary Size & Position\n if !$nms.msg_temp_w.nil?\n $nms.msg_w = $nms.msg_temp_w\n $nms.msg_temp_w = nil\n end\n if !$nms.msg_temp_h.nil?\n $nms.msg_h = $nms.msg_temp_h\n $nms.msg_temp_h = nil\n end\n if !$nms.msg_temp_x.nil?\n self.x = $nms.msg_temp_x\n $nms.msg_temp_x = nil\n end\n if !$nms.msg_temp_y.nil?\n self.y = $nms.msg_temp_y\n $nms.msg_temp_y = nil\n end\n # Fix Window Position if it's out of screen\n self.x = 0 if self.x < 0\n self.x = Graphics.width - $nms.msg_w if (self.x + $nms.msg_w) > Graphics.width\n self.y = 0 if self.y < 0\n self.y = Graphics.height - $nms.msg_h if (self.y + $nms.msg_h) > Graphics.height\n end", "title": "" }, { "docid": "2417b35b92b280a6b71e7c999466ac11", "score": "0.596177", "text": "def draw\n # gl will execute the given block in a clean OpenGL environment, then reset\n # everything so Gosu's rendering can take place again.\n \n #gl do\n # glClearColor(0.0, 0.2, 0.5, 1.0)\n # glClearDepth(0)\n # glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n # \n # @gl_background.exec_gl\n #end\n #@background_image.draw(0, 0, ZOrder::Background)\n \n @bullets.each { |o| o.draw }\n @e_bullets.each { |o| o.draw }\n @ennemies.each{|e| e.draw}\n @bonuses.each{|b| b.draw}\n @particles.each{|p| p.draw}\n \n @player.draw\n \n # TODO externalize UI methods\n # Score\n @font.draw(\"Score: #{@player.score}\", 10, 10, ZOrder::UI, 1.0, 1.0, 0xffffff00)\n # Player's lives count\n @font.draw(\"LIVES: #{(@player.lives > -1)? @player.lives : \"GAME OVER\"}\", 10, 30, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n # Current level\n @font.draw(\"LEVEL: #{@w_generator.current_level}\", 10, 50, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n \n # Pause label\n if @state == :paused\n @big_font.draw(\" PAUSE \", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # Game Over label\n if @player.lives < 0\n @big_font.draw(\"GAME OVER\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # End game label\n if @finished\n @big_font.draw(\"THE END\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n end", "title": "" }, { "docid": "bb6c906ad3f0a3e0a385fa9119bdb916", "score": "0.59614486", "text": "def reset_window\n if $game_temp.in_battle\n self.y = 16\n else\n case $game_system.message_position\n when 0 # up\n self.y = 16\n when 1 # middle\n self.y = 160\n when 2 # down\n self.y = 304\n end\n end\n if $game_system.message_frame == 0\n self.opacity = 255\n else\n self.opacity = 0\n end\n#------------------------------------------------------------------------------\n# Begin Multiple Message Windows Edit\n#------------------------------------------------------------------------------\n # transparent speech bubbles don't look right, so keep opacity at 255\n # self.back_opacity = 160\n @tail.opacity = 255\n#------------------------------------------------------------------------------\n# End Multiple Message Windows Edit\n#------------------------------------------------------------------------------\n end", "title": "" }, { "docid": "a64bec4c0a75d40d87fc38de896bc512", "score": "0.596058", "text": "def snapshot_for_background\n $game_temp.background_bitmap.dispose\n $game_temp.background_bitmap = Graphics.snap_to_bitmap\n $game_temp.background_bitmap.blur\n end", "title": "" }, { "docid": "12b44ccb2632b93e8bfed7b82e9fa428", "score": "0.59560007", "text": "def draw\r\n @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)\r\n @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, \"Start!\")\r\n @function_UI.big_font.draw_text(\"SPACE WAR\", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.big_font.draw_text(\"Instructions: \", @function_UI.pos-100, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::RED)\r\n @function_UI.font.draw_text(\"# Press SPACE BAR to fire bullets\", @function_UI.pos-180, 140, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# Use the ARROW KEYS to navigate the Spaceship\", @function_UI.pos-180, 180, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# You have 3 Life Lines\", @function_UI.pos-180, 220, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# Press ESC to leave the Game\", @function_UI.pos-180, 260, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n draw_border((SCREEN_WIDTH/3) + 105, 305)\r\n end", "title": "" }, { "docid": "86d296aef7a70d5ed6f9f97c3b4e8ead", "score": "0.59510934", "text": "def background; end", "title": "" }, { "docid": "62b497d0185d438fc9b981d71cccae61", "score": "0.594856", "text": "def clearMessageWindow\n @sprites[\"messagewindow\"].text=\"\"\n @sprites[\"messagewindow\"].refresh\n @sprites[\"messagebox\"].visible=false\n end", "title": "" }, { "docid": "1108cc88409debd0a2a5bbc23a966e68", "score": "0.5944312", "text": "def render_game_over args\n # get out if the game is still playing\n if args.state.game_state == \"playing\"\n return\n end\n\n # draw a black background\n args.outputs.solids << {\n x: 0,\n y: 0,\n w: 1280,\n h: 720\n }\n\n # show a big \"You win!\"\" or \"You lose!\"\n args.outputs.labels << {\n x: 1280 / 2,\n y: 500,\n text: \"You #{args.state.game_state}!\",\n size_enum: 120,\n alignment_enum: 1,\n r: 255,\n g: 255,\n b: 255\n }\nend", "title": "" }, { "docid": "c0f9655343fa7177e15da7d53c4eb6dc", "score": "0.5934423", "text": "def victory_end\n RPG::BGM.fade(500) unless skip?\n 20.times do; Graphics.update; end\n SceneManager.return\n battle_end(0)\n replay_bgm_and_bgs unless skip? || $BTEST\n end", "title": "" }, { "docid": "df484781ecdc57d880fb0cd2f5df0285", "score": "0.5927909", "text": "def reset_font_settings; set_data_font(:scene_label); end", "title": "" }, { "docid": "3e3576d2beef00da907ee03da58464a7", "score": "0.5907982", "text": "def reset_window\n # This allows Tutorial Windows to be placed at the Top, Middle, and Bottom\n if $game_temp.in_battle and not @tutorial\n self.y = 16\n else\n case $game_system.message_position\n when 0 # up\n self.y = 16\n when 1 # middle\n self.y = 160\n when 2 # down\n self.y = 304\n end\n end\n if $game_system.message_frame == 0\n self.opacity = 255\n else\n self.opacity = 0\n end\n if @tutorial\n self.back_opacity = $game_system.tutorial_window_opacity\n else\n self.back_opacity = 160\n end\n end", "title": "" }, { "docid": "a5e89d17869071e3f9d1b3062fb9c7ab", "score": "0.5904386", "text": "def draw\n @img_background = Game::images[\"background\"]\n @img_background.draw(0, 0, ZOrder::BACKGROUND, (ScreenWidth * 1.0) /@img_background.width, (ScreenHeight * 1.0) /@img_background.height)\n @@game_state.draw\n\n if Game.fading?\n delta = (Gosu::milliseconds - @@start_fade).to_f / (@@end_fade - @@start_fade)\n alpha = @@fading_off ? delta : 1 - delta\n @img_background.draw(0, 0, ZOrder::BACKGROUND, (ScreenWidth * 1.0) /@img_background.width, (ScreenHeight * 1.0) /@img_background.height, Gosu::Color.new((alpha * 0xff).to_i, 0xff, 0xff, 0xff))\n end\n end", "title": "" }, { "docid": "31529c48dc7e4834f96c09dfd6a835a7", "score": "0.5893349", "text": "def main_end\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end", "title": "" }, { "docid": "48e33cc4d7f4f0e3b11194b4e0a9db5b", "score": "0.5891687", "text": "def show_draw\n puts 'No more avalaible spaces, consider it a draw'\n puts 'The game will be re-started'\n puts 'loading................'\n puts 'Press any key to continue'\nend", "title": "" }, { "docid": "396072fccea6ab491cb8964e2d5524b3", "score": "0.5887831", "text": "def draw\n @img_background.draw(0, 0, 0)\n\n color = 0xfff4cc00\n @logo_font.draw_rel(\"Level #{@level}\", Game::ScreenWidth / 2, 120, ZOrder::Hud, 0.5, 0.5, 2, 2, color)\n\n end", "title": "" }, { "docid": "60197e9e613f46128595e76a2d22f4b5", "score": "0.5877223", "text": "def dispose_background\n @background.dispose;\n end", "title": "" }, { "docid": "aebdb098eb8d7b883a15ba664573d86e", "score": "0.58744514", "text": "def no_bg_color\n reset_prev_formatting self, :bg_color\n end", "title": "" }, { "docid": "487dfb22f4d4c0f4744d6e796532de9a", "score": "0.584189", "text": "def half_refresh\n contents.clear_rect(24, 0, contents_width - 24, line_height)\n draw_text(24, 0, contents_width - 24, line_height, $game_system.playtime_s, 2)\n end", "title": "" }, { "docid": "5ac3c5b095f43ca7abf0b47623063d0e", "score": "0.5806732", "text": "def main_end\r\n # Refresh map\r\n $game_map.refresh\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n # If switching from battle test to any screen other than game over screen\r\n if $BTEST and not $scene.is_a?(Scene_Gameover)\r\n $scene = nil\r\n end\r\n end", "title": "" }, { "docid": "79e0c892f42c40994a33eca1dcb02a42", "score": "0.57991046", "text": "def bgm_restore\n bgm_play(@memorized_bgm)\n end", "title": "" }, { "docid": "70e8dbb004e7fcc210aa70d01250c48f", "score": "0.57989043", "text": "def draw\n @hud = Gosu::Image.from_text(self, stats, Gosu::default_font_name, 30) \n @hud.draw(0, 0, 0)\n\n end", "title": "" }, { "docid": "dc8a0d413786ee0dbcdb4ca3ba1919fb", "score": "0.579346", "text": "def game_over\n puts \" ██████╗ █████╗ ███╗ ███╗███████╗\"\n sleep(1)\n puts \"██╔════╝ ██╔══██╗████╗ ████║██╔════╝\"\n sleep(1)\n puts \"██║ ███╗███████║██╔████╔██║█████╗ \"\n sleep(1)\n puts \"██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ \"\n sleep(1)\n puts \"╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗\"\n sleep(1)\n puts \"╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n puts \"██████╗ ██╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██╔═══██╗██║ ██║██╔════╝██╔══██╗ \"\n sleep(1)\n puts \"██║ ██║██║ ██║█████╗ ██████╔╝ \"\n sleep(1)\n puts \"██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗ \"\n sleep(1)\n puts \"╚██████╔╝ ╚████╔╝ ███████╗██║ ██║ \"\n sleep(1)\n puts \"╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ \"\n sleep(1)\n\n\n exit(0)\nend", "title": "" }, { "docid": "f14aa9bd2bbe756f29f23cb5a3bd4166", "score": "0.5787085", "text": "def command_shutdown\n Sound.play_decision\n RPG::BGM.fade(800)\n RPG::BGS.fade(800)\n RPG::ME.fade(800)\n $scene = nil\n end", "title": "" }, { "docid": "32b33010c0240b62d9a5f68fca29016e", "score": "0.5771365", "text": "def exit_still_pp\n TactBattleManager.placing_party = true # party placement highlights\n return_scene\n end", "title": "" }, { "docid": "57c9dddcb9ecc434aff1bf12e64e778d", "score": "0.57617396", "text": "def setBackground\r\n r = g = b = a = 0.0\r\n case $background\r\n when 0\r\n r = g = b = 0.0\r\n when 1\r\n r = g = b = 1.0\r\n when 2\r\n r = 0.1\r\n g = 0.3\r\n b = 0.6\r\n when 3\r\n r = g = b = 0.5\r\n else\r\n r = g = b = 0.0\r\n end\r\n a = 1.0\r\n glClearColor(r,g,b,a)\r\nend", "title": "" }, { "docid": "a181a05064f1a44debc8b34aa3e2836a", "score": "0.57612365", "text": "def restart\n pbBGMStop(0)\n 51.times do\n @viewport.tone.red-=5\n @viewport.tone.green-=5\n @viewport.tone.blue-=5\n self.updateElements\n Graphics.update\n end\n raise Reset.new\n end", "title": "" }, { "docid": "b85220fbe51493547df29975f105ac5e", "score": "0.5744633", "text": "def exit_game_reviews\n system('clear')\n graphic_thanks\n graphic_bottom\n print \"\\n\" + \" \" * 40 + \"Press any key to continue... \"\n STDIN.getch\n puts \"\"\n system('clear')\n exit\nend", "title": "" }, { "docid": "3f63089964c10248ffcc1d19f8b5fa8b", "score": "0.5743679", "text": "def actions_when_game_is_lost\n puts \"\"\n puts \"GAME OVER\".red\n self.quit_game = true\n end", "title": "" }, { "docid": "0fc809c23255f675cc4aae023bcd9286", "score": "0.57323265", "text": "def draw\n if @winner == Const::GAME_ON\n @game.draw\n @o_board.draw\n elsif @winner == Const::GAME_LOST\n @font.draw(Const::GAME_LOST_CAPTION,\n @window.width / 2 - 170, @window.height / 2 - 30, 0)\n else\n @font.draw(Const::GAME_WON_CAPTION,\n @window.width / 2 - 170, @window.height / 2 - 30, 0)\n end\n end", "title": "" }, { "docid": "79062b027371155eda1ab08b739bdc50", "score": "0.57303977", "text": "def draw\n @board.draw\n x = @window.width / 2\n y = @window.height / 2 - 30\n @font.draw(Const::PAUSE_CAPTION, x - 130, y, 0) if @paused\n @font.draw(Const::GAME_OVER_CAPTION, x - 170, y, 0) if @game_over\n end", "title": "" }, { "docid": "681505fc3f470f27c9e0ea2732ed7a9f", "score": "0.57135004", "text": "def displayEndgame\n \tputs \"\\e[#{SCREEN_Y+1};#{1}HGame over.\\e[#{SCREEN_Y+2};#{1}H\"\nend", "title": "" }, { "docid": "3a5bfbda35414aab931aabc9df06975f", "score": "0.57070696", "text": "def game_reset\n\t\tuser_hash = {\n\t\t0 => \" \",\n\t\t1 => \" \",\n\t\t2 => \" \",\n\t\t3 => \" \",\n\t\t4 => \" \",\n\t\t5 => \" \",\n\t\t6 => \" \",\n\t\t7 => \" \",\n\t\t8 => \" \"\n\t\t}\n\t\tstart_game(user_hash)\n\tend", "title": "" }, { "docid": "43f5efcbe835d2e39c0405d8ba952bfb", "score": "0.5704659", "text": "def dispose_gameover_graphic\n @sprite.bitmap.dispose\n @sprite.dispose\n end", "title": "" }, { "docid": "566d651c1d24e5b3429b654c9e794484", "score": "0.5704612", "text": "def render_background\n render_unvisited\n render_grid_lines\n end", "title": "" }, { "docid": "cdc382c70c746a704ebd4ef96c178e8c", "score": "0.56950784", "text": "def dat_menu() \n game_states.size == 1 && exit #fires if this is the only gamestate\n Chingu::Text.create 'Now leaving :(', size: 48, x: 200, y: 200, color: Gosu::Color::RED\n after(500) { $window.pop_game_state(setup: false) }\n end", "title": "" }, { "docid": "bde0315ce1ab0d67c2f3feedbca83144", "score": "0.5691489", "text": "def draw\n if (!@win and @lose) or (@frameCounter == 0 and @game_board.return_count < 5 and @timer.return_time == 0)\n draw_lose\n elsif (@win and !@lose)\n draw_win\n elsif (!@win and !@lose)\n draw_background\n @game_board.draw_board\n @timer.draw \n end\n end", "title": "" }, { "docid": "055e3ba616ed63a28a4fc3168c578f25", "score": "0.56911474", "text": "def erase\n CDK.eraseCursesWindow(@win)\n CDK.eraseCursesWindow(@shadow_win)\n end", "title": "" }, { "docid": "6ff3df8a850665ea13c25a4519ff9022", "score": "0.56860715", "text": "def update_text_draw\n unless $game_temp.message_text.nil?\n @contents_showing = true\n $game_temp.message_window_showing = true\n @text_stack.dispose\n set_origin(0, 0)\n self.visible = true\n init_window\n refresh\n return true\n end\n return false\n end", "title": "" }, { "docid": "b3d8e29a83b1c9ed30368190e8bb158f", "score": "0.56853116", "text": "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, YE::SYSTEM::WINDOW_HELP)\n @system_window = Window_System.new(0, 0, 640, 384)\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cWindowSkinsLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGMVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucSFXVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGSVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cBattleAnimLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cAutoDashLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInstantTextLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cDifficultyLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInGameTutoLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cReturnTitleLabel.rect.y, \n @system_window.width-32, 24)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 384, positions, true)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.z = 1000\n if @menu_index != nil\n @command_window.index = @menu_index\n update_help()\n else\n @command_window.index = 0\n end\n\n @last_index = -1\n end", "title": "" }, { "docid": "a970fa17a764fc9f0b4ec701b8e63737", "score": "0.5683367", "text": "def load_editor_background\n x_extra = (self.width / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil\n y_extra = (self.height / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil\n\n @editor_background = Gosu.record(1, 1) do\n x = -x_extra\n while (x < EDITOR_WIDTH + x_extra)\n y = -y_extra\n while (y < EDITOR_HEIGHT + y_extra)\n color = position_in_bounds?(x, y) ? Gosu::Color::WHITE : Gosu::Color.new(255 / 2, 255, 255, 255)\n background = @background_images[@track.background_type]\n background.draw(x * TILE_SIZE, y * TILE_SIZE, 0, 1, 1, color)\n y += 1\n end\n x += 1\n end\n end\nend", "title": "" }, { "docid": "4ddeae91a8eab5fa0598fbc689a39f9f", "score": "0.56767875", "text": "def draw\n\t\t# Complete the missing code\n\t\tdraw_background\n\t\tdraw_albums\n if @play > -1\n @font.draw(\"Now playing...\\n#{@albums[@selection].tracks[@play].name}\", 650, 550, ZOrder::UI, 1.0, 1.0, Gosu::Color::BLACK)\n end\n\n\tend", "title": "" }, { "docid": "9cd5502d101657aa7c78ebab1dd699fc", "score": "0.56754315", "text": "def main_end\r\n super\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end", "title": "" }, { "docid": "42ab796fd4b18d311c20a7b809e5a10b", "score": "0.5674866", "text": "def ending_screen\n if @winner == @player1\n color = :red\n elsif @winner == @player2\n color = :blue\n else\n color = :green\n end\n puts\n puts \"The game is finished.\"\n if @winner.nil?\n puts \"The game is a draw!\".colorize(color)\n else\n puts \"#{@winner.name} wins the game!\".colorize(color)\n end\n puts\n puts \"Would you like to play again? (Y/N)\"\n print \">> \"\n response = gets.chomp\n reset_board if response.downcase == \"y\"\n end", "title": "" }, { "docid": "5fc8e5461e2af4c69dd81e85489603ff", "score": "0.5669585", "text": "def draw_background\n\t\tGosu::draw_rect(@x,\n\t\t\t\t\t\t@y, \n\t\t\t\t\t\t@bg_width,\n\t\t\t\t\t\t@bg_height, \n\t\t\t\t\t\t@background_colour,\n\t\t\t\t\t\t@z)\n\tend", "title": "" }, { "docid": "3bcd86557641eb273ad9764e95b80080", "score": "0.5668578", "text": "def clear_board\n FXDCWindow.new(@image) do |dc|\n dc.foreground = BACK_COLOR\n dc.fillRectangle(0, 0, IMG_WIDTH, IMG_HEIGHT)\n end\n board_draw\n end", "title": "" }, { "docid": "65e907b75542cbfda24fc3d9ce53d3fe", "score": "0.56554955", "text": "def reset!\n self.background_color = nil\n self.font_color = nil\n self.button_color = nil\n self.font = :helvetica\n self.save\n end", "title": "" }, { "docid": "9f4f72badbf3919296512918212a97d1", "score": "0.56343734", "text": "def display_exiting!(text)\n # create goodbye message\n # display welformatted conclusion message\n system \"clear\"\n msg = colorize(\" #{text.upcase} \", $font_colors[:cyan])\n puts \"\\n#{msg.center(77)}\\n\\n\"\n end", "title": "" }, { "docid": "271e270d522ea17614c3a3de9a65dd1a", "score": "0.5620274", "text": "def draw\n game_name = \"MAD POKEMONS\"\n height = @game_font.height\n width = @game_font.text_width(game_name, scale_x = 1)\n x = Game::ScreenWidth / 2\n y = Game::ScreenHeight / 3\n @game_font.draw(game_name, x - width/2 ,y - height/2, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n \n @buttons.each {|button| button.draw }\n end", "title": "" }, { "docid": "896f2341ee61e678635f08ed459a9049", "score": "0.56108266", "text": "def intro\n\t\t@frame = @frame + 1\n\t\tif @frame == 1 or @frame == 40 \n\t\t\t@screen.fill([0, 0, 0])\n\t\telsif @frame == 10 or @frame == 60\n\t\t\t@map.updateBackground\n\t\t\t@map.sprites.each { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\telsif @frame == 220\n\t\t\t@frame = 0\n\t\t\tstats\n\t\t\tsetMenu\n\t\telsif @frame > 120\n\t\t\t@dialogueText.draw\n\t\tend\n\tend", "title": "" }, { "docid": "604338523959e6b4abf0de3f75b3c5be", "score": "0.56080246", "text": "def draw\n return if @type == Type[:EMPTY]\n\n @window.mvaddstr(@x, @y, @appearance)\n end", "title": "" }, { "docid": "898f31c9e6e2eea342077dc935413ef4", "score": "0.559354", "text": "def test_inactive\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(0, 40, 40, 40), $data_actors[1])\n uc.active = false\n uc.draw()\n }\n return true\n end", "title": "" }, { "docid": "597802adf43cb8583ce76b206e7fc27e", "score": "0.5590778", "text": "def draw\n Gosu.draw_rect(@xpos, @ypos, @width, @height, Gosu::Color.argb(0xff_000000))\n for i in 0..2\n if(@text[i] != nil) \n @text[i].draw(@xpos + 10, @ypos + @height - (i + 1)* (@text[i].getImage().height + 2) -3)\n end\n end \n end", "title": "" }, { "docid": "831f29bac74aeebe7f6acd55595f66cb", "score": "0.55879974", "text": "def dispose_menu_background\n @menuback_sprite.dispose\n end", "title": "" }, { "docid": "f18855f80e24eaa1b511a893d8599db8", "score": "0.55851567", "text": "def draw\n if @show_game != true\n @menu.draw\n @cursor.draw self.mouse_x, self.mouse_y, 0\n else\n if wins\n @font.draw(\"Game over\", WIDTH/4+ 120/2, HEIGHT/2 - 120/2, 0, 2, 5,Gosu::Color::RED)\n @font.draw(\"Player #{wins} wins\", WIDTH/4 +100, HEIGHT/2 +20, 0,1,2)\n \n else\n @font.draw(\"Player 1: #{@player_1.score}\", 10, 10, 2,1,1, Gosu::Color::RED) #,1,1, Gosu::Color::WHITE)\n @font.draw(\"Player 2: #{@player_2.score}\", 10,25,2, 1, 1, Gosu::Color::GREEN) #,1,1, Gosu::Color::WHITE)\n @ball.draw\n @player_1.draw\n @player_2.draw\n end\n end\n end", "title": "" }, { "docid": "97163a7bb00a72fa47b7bd10f8b8b701", "score": "0.5575789", "text": "def points_gfx_reset_colors\r\n @players_on_match.each do |pl_single|\r\n player_label1 = pl_single.name.to_sym\r\n @points_status[player_label1][:widg_scopa].font_color = Fox.FXRGB(0, 0, 0)\r\n end\r\n end", "title": "" }, { "docid": "d1a5fa15a5fc2d9d8253c1841fb0b0b1", "score": "0.5573365", "text": "def redraw\n @terminal.erase_screen\n render\n end", "title": "" }, { "docid": "5e77eb6844a49158c05fed0813cda9aa", "score": "0.55631644", "text": "def updateBackground\n\t\tcase @phase\n\t\twhen \"intro\"\n\t\t\tintro\n\t\twhen \"menu\"\n\t\t\tmenu\n\t\twhen \"combat\"\n\t\t\tcombat\n\t\twhen \"finish\"\n\t\t\tfinish\n\t\tend\n\tend", "title": "" }, { "docid": "321d7adf5b350ef35a6dedd85932a819", "score": "0.55588174", "text": "def setup_unfocus\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n sprset = get_spriteset\n sprset.focus_bg.fadeout(@acts[1])\n batch = sprset.battler_sprites.select do |spr|\n !spr.battler.nil? # Select avalaible battler\n end\n batch.each do |spr|\n spr.fadein(@acts[1]) if spr.battler.alive? || spr.battler.actor?\n end\n end", "title": "" }, { "docid": "a50f9fa27ebe26a8db5cc069e6eeeebc", "score": "0.5557784", "text": "def draw\n @player.draw\n Graphics.render_tail\n Graphics.draw_tiles(@font)\n Graphics.display_centered_title(@message.join(\"\"), @small_font)\n Graphics.display_lives(@small_font)\n Graphics.show_emoticon(Settings.mailbox, @font) if @message.join(\"\") == @completed \n if Position.collide?(@active_tile, @player)\n Graphics.erase_emoticon\n Graphics.show_emoticon(Settings.failbox, @font) \n end\n end", "title": "" }, { "docid": "44ffa89773ddc646dfe54047ca9c8ca9", "score": "0.554426", "text": "def render_background\n render_unvisited\n render_grid_lines\n render_labels\n end", "title": "" }, { "docid": "e37828383b3bcf43848db03eb84c690e", "score": "0.5542681", "text": "def handle_fell_off_screen\n end", "title": "" }, { "docid": "326cb9d25423ab9257e806137d3322e9", "score": "0.5535343", "text": "def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(100, 40, 40, 40), $data_actors[1])\n uc.visible = false\n uc.draw()\n }\n return true\n end", "title": "" }, { "docid": "24b85a8bd538cd6a138b873367ad6176", "score": "0.5532351", "text": "def new_game\n @display = false\n @window.pause = false\n end", "title": "" }, { "docid": "ff8dc9690800701cc01d26e04efd8241", "score": "0.5526374", "text": "def lose\n puts \"I'm sorry, sir. You seem to have lost.\"\n restart\n end", "title": "" }, { "docid": "951718774e4bf8eec634ccd5ae949a0f", "score": "0.5517981", "text": "def dispose_fps_text\n return unless @ingame_fps_text && !@ingame_fps_text.disposed?\n @ingame_fps_text.dispose\n @gpu_fps_text.dispose\n @ruby_fps_text.dispose\n end", "title": "" }, { "docid": "b79b998e02aafbf9c1de3ba08dffe8af", "score": "0.55084544", "text": "def eraseSubwin\n CDK.eraseCursesWindow(@pull_win[@current_title])\n\n # Redraw the sub-menu title.\n self.drawTitle(@current_title)\n @title_win[@current_title].wrefresh\n end", "title": "" }, { "docid": "5551febbf07805ba241897ffb8381a70", "score": "0.5497309", "text": "def draw_text_cs(x, y, w, h, t, a = 0)\r\n original_color = self.font.color.clone\r\n self.font.color = Color.new(0,0,0,100)\r\n draw_text(x + 2, y + 2, w, h, t, a)\r\n self.font.color = original_color\r\n draw_text(x, y, w, h, t, a) \r\n end", "title": "" }, { "docid": "41b9230ce9a0173a4248b58582125ba0", "score": "0.54955643", "text": "def colorize!(fg, bg)\n set_colors(fg, bg)\n num = @cwin.maxx * @cwin.maxy\n self.home\n self.go(0, 0) { @cwin.addstr(' '*num) }\n @cwin.refresh\n end", "title": "" }, { "docid": "9392480ce46588a5237d687a122f7550", "score": "0.5492843", "text": "def ghost_face_check\n @ghostme = 255\n @ghostme = @saveghost if @saveghost != nil\n @keepme = false\n if $game_message.face_name.empty?\n $game_message.face_name = @savename if @savename != nil\n $game_message.face_index = @saveindex if @saveindex != nil\n end\n @keepme = true if @text.include?(\"\\\\keep\") # Sets keeping if true\n @keepme = true if @text.include?(\"\\\\k\")\n @text.gsub!(/\\\\keep/) {\"\"} # Clears keeping modifiers\n @text.gsub!(/\\\\k/) {\"\"}\n @savename = @keepme ? $game_message.face_name : nil # Keep me variables\n @saveindex = @keepme ? $game_message.face_index : nil\n @text.gsub!(/\\\\(?:trans|t)\\[(\\d+)\\]/i) { # Sets transparency\n check_face_trans($1.to_i) }\n @saveghost = @keepme ? @ghostme : nil\n end", "title": "" }, { "docid": "4fb476df472861a886314cfdc9a60507", "score": "0.54913694", "text": "def clear_screen\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\n puts\r\nend", "title": "" }, { "docid": "619cc5d165c4c39734f19e6d71df2bf1", "score": "0.5490908", "text": "def draw\n return if @destoryed\n return unless @verbose\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, $program.width - 200, $program.height - 300, 100, 1, 1, 0xff_000000, :default)\n end", "title": "" }, { "docid": "2e5ee83d066a3ada1ca2eb97024e174a", "score": "0.54815775", "text": "def pbCaveEntranceEx(exiting)\n sprite = BitmapSprite.new(Graphics.width,Graphics.height)\n sprite.z = 100000\n totalBands = 15\n totalFrames = 15\n bandheight = ((Graphics.height/2)-10).to_f/totalBands\n bandwidth = ((Graphics.width/2)-12).to_f/totalBands\n grays = []\n tbm1 = totalBands-1\n for i in 0...totalBands\n grays.push(exiting ? 0 : 255)\n end\n totalFrames.times do |j|\n x = 0\n y = 0\n rectwidth = Graphics.width\n rectheight = Graphics.height\n for k in 0...j\n t = (255.0)/totalFrames\n if exiting\n t = 1.0-t\n t *= 1.0+((k)/totalFrames.to_f)\n else\n t *= 1.0+0.3*(((totalFrames-k)/totalFrames.to_f)**0.7)\n end\n grays[k] -= t\n grays[k] = 0 if grays[k]<0\n end\n for i in 0...totalBands\n currentGray = grays[i]\n sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),\n Color.new(currentGray,currentGray,currentGray))\n x += bandwidth\n y += bandheight\n rectwidth -= bandwidth*2\n rectheight -= bandheight*2\n end\n Graphics.update\n Input.update\n end\n if exiting\n pbToneChangeAll(Tone.new(255,255,255),0)\n else\n pbToneChangeAll(Tone.new(-255,-255,-255),0)\n end\n for j in 0..15\n if exiting\n sprite.color = Color.new(255,255,255,j*255/15)\n else\n sprite.color = Color.new(0,0,0,j*255/15) \n end\n Graphics.update\n Input.update\n end\n pbToneChangeAll(Tone.new(0,0,0),8)\n for j in 0..5\n Graphics.update\n Input.update\n end\n sprite.dispose\nend", "title": "" }, { "docid": "58a946e20c74298e6160e553fae71a7b", "score": "0.5480867", "text": "def draw\n\n if @init\n @background.draw(0, 0, -1, 2.5, 2.5)\n end\n\n if not @playing\n @font.draw(\"Game Over\", 300, 300, 3)\n @font.draw(\"Press the Space Bar to Play Again\", 175, 350, 3)\n @visible = 20\n end\n\n @hammer_image.draw(mouse_x-40, mouse_y-10, 2)\n\n if @visible > 0\n @image.draw(@x-@width/2, @y-@height/2, 1)\n end\n\n if @hit == 0\n c = Gosu::Color::NONE\n elsif @hit == 1\n c = Gosu::Color::GREEN\n elsif @hit == -1\n c = Gosu::Color::RED\n end\n @hit = 0\n\n draw_quad(0, 0, c, 800, 0, c, 800, 600, c, 0, 600, c)\n\n @font.draw(@score.to_s, 700, 20, 2)\n @font.draw(@time_left, 20, 20, 2)\n\n end", "title": "" }, { "docid": "ce5dd7c4a655b62b550c1bf47bd94eec", "score": "0.5480131", "text": "def new_game\n # Start again!\n puts \"\\n\\n\"\n\t\n\t# Clears output from last game\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n \n puts \"Beginning new game:\"\n puts \"\"\n start\nend", "title": "" }, { "docid": "a1b32006b8fbb6229437af25e4539a90", "score": "0.54754925", "text": "def end_game\r\n @game_over = true\r\n end", "title": "" }, { "docid": "c46f4e87c534fab1d1ad32c00b2f31c0", "score": "0.54661936", "text": "def dispose_battleback\n @battleback_sprite.dispose\n end", "title": "" }, { "docid": "236f50ead080e12ac0fdbdbf7812eb2f", "score": "0.54600465", "text": "def on_click\n @status_window_tb.hide\n $game_map.clear_next_highlights\n reset_aoe_follows\n #@spriteset.remove_group(DISPLAY_TB) # @spriteset.dispose_highlights_tb\n remove_show_hls\n end", "title": "" }, { "docid": "ad6860bce32ea0579d62a845218f54b9", "score": "0.5458362", "text": "def continue\n @victory = false\n @level += 1\n drawFromPixmap\n end", "title": "" }, { "docid": "81faf1bc987e630a2fa37b4500c1c185", "score": "0.5441521", "text": "def end_game\n @game_run = false\n puts \"Game Over\"\n puts\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "478927ca00f57a6eb165ec381d3e71d2", "score": "0.0", "text": "def users_account_params\n if params.require(:users_account)[:password].blank? and params.require(:users_account)[:password_confirmation].blank?\n params.require(:users_account).permit(:email, { role_ids:[] })\n else\n params.require(:users_account).permit(:password, :password_confirmation, :email, { role_ids:[] })\n end\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
6665c00b7847a05dfb02594be3100a1f
POST /synonymproteins POST /synonymproteins.json
[ { "docid": "2179bfbfcca72072a226a2499029f657", "score": "0.70951664", "text": "def create\n @synonymprotein = Synonymprotein.new(synonymprotein_params)\n\n respond_to do |format|\n if @synonymprotein.save\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successfully created.' }\n format.json { render :show, status: :created, location: @synonymprotein }\n else\n format.html { render :new }\n format.json { render json: @synonymprotein.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "26d1152b3d70756e1281474145352c2b", "score": "0.63893026", "text": "def synonymprotein_params\n params.require(:synonymprotein).permit(:synonymname)\n end", "title": "" }, { "docid": "ba126a7ec639b1ece307c29f9a28c6c9", "score": "0.6053219", "text": "def set_synonymprotein\n @synonymprotein = Synonymprotein.find(params[:id])\n end", "title": "" }, { "docid": "afb59f5c2d8063011d5492ad62244c9b", "score": "0.6048946", "text": "def index\n @synonymproteins = Synonymprotein.all\n end", "title": "" }, { "docid": "97fddaa46be333a11a85a121192d8937", "score": "0.59464085", "text": "def update\n respond_to do |format|\n if @synonymprotein.update(synonymprotein_params)\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successfully updated.' }\n format.json { render :show, status: :ok, location: @synonymprotein }\n else\n format.html { render :edit }\n format.json { render json: @synonymprotein.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e899507d55edc91f73f98c384e7ad0ec", "score": "0.5818161", "text": "def create\n @syndic = Syndic.new(syndic_params)\n\n respond_to do |format|\n if @syndic.save\n format.html { redirect_to @syndic, notice: \"Syndic was successfully created.\" }\n format.json { render :show, status: :created, location: @syndic }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @syndic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9610e65c6be144071de108c520cc12a5", "score": "0.55742073", "text": "def create\n @syndrome = Syndrome.new(syndrome_params)\n\n respond_to do |format|\n if @syndrome.save\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully created.' }\n format.json { render :show, status: :created, location: @syndrome }\n else\n format.html { render :new }\n format.json { render json: @syndrome.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6dff474393e0f28301202204bcd0a356", "score": "0.5507549", "text": "def syndic_params\n params.require(:syndic).permit(:start, :end, :user_id)\n end", "title": "" }, { "docid": "39fd9a8ae174703c6005eea5df112180", "score": "0.52766776", "text": "def create\n @stoff = Stoff.new(stoff_params)\n @redirect_params = (params[:redirect_params].blank?) ? @stoff : params[:redirect_params] \n \n respond_to do |format|\n if @stoff.save\n # Name als Synonm speichern\n synonym = StoffSynonym.find_by(synonym: @stoff.bezeichnung)\n if synonym.nil?\n synonym = StoffSynonym.new(synonym: @stoff.bezeichnung) \n end\n synonym.stoff = @stoff if synonym.stoff.nil?\n synonym.save \n File.open(\"log/anlagen.log\",\"a\"){|f| f.puts \"syn #{synonym}\"}\n if params[:synonym] && params[:synonym] != @stoff.bezeichnung\n synonym = StoffSynonym.find_by(synonym: params[:synonym])\n if synonym \n synonym.stoff = @stoff\n synonym.save \n end\n end\n flash[:success] = \"Stoff erstellt.\"\n format.html { redirect_to @redirect_params }\n format.json { render :show, status: :created, location: @stoff }\n else\n format.html { render :new }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e80e21d13d1925402d66a204e593f64", "score": "0.5177842", "text": "def create_synonym_set(engine_name, body)\n post(\"engines/#{engine_name}/synonyms\", body)\n end", "title": "" }, { "docid": "5dcd926611db3c4b3b042d7b0468e0e6", "score": "0.5174973", "text": "def create\n @tree = Tree.new(params[:tree])\n @tree.synclatlon\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render json: @tree, status: :created, location: @tree }\n else\n format.html { render 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "769c8c064126a5b55f36d3e02d470c4d", "score": "0.5169528", "text": "def destroy\n @synonymprotein.destroy\n respond_to do |format|\n format.html { redirect_to synonymproteins_url, notice: 'Synonymprotein was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6ca292ce2b63fe3d643c7790537ea204", "score": "0.5147727", "text": "def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end", "title": "" }, { "docid": "8090804a22667aaee7edfda6fbb4d937", "score": "0.50919324", "text": "def create\n @molecule_synonym = MoleculeSynonym.new(molecule_synonym_params)\n\n respond_to do |format|\n if @molecule_synonym.save\n format.html { redirect_to @molecule_synonym, notice: 'Molecule synonym was successfully created.' }\n format.json { render :show, status: :created, location: @molecule_synonym }\n else\n format.html { render :new }\n format.json { render json: @molecule_synonym.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50afb977d56f14adb4ff5825b93fe76d", "score": "0.50548524", "text": "def save_stoffe_zuordnung\n #@logger = File.new(\"log/upload.log\",\"w\")\n #@logger.puts params\n #@logger.puts \"synonym id #{params[:synonym].to_i}\"\n synonym = StoffSynonym.find(params[:synonym].to_i)\n #@logger.puts synonym.attributes\n synonym.stoff = Stoff.find(params[:stoff].to_i)\n #@logger.puts synonym.anlage.attributes\n #@logger.puts synonym.anlage.nil?\n if synonym.save\n #@logger.close\n flash[:success] = \"Zuordnung erfolgreich\"\n redirect_to upload_stoffe_zuordnung_path\n else\n # TODO: Fehlerbehandlung\n end \n end", "title": "" }, { "docid": "d0ef15b4ae9b863026fed3c5ee7d165a", "score": "0.5044419", "text": "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", "title": "" }, { "docid": "c986abb69a2c68b4f43d4a70eec75040", "score": "0.50420624", "text": "def molecule_synonym_params\n params.require(:molecule_synonym).permit(:molecule_id, :synonym)\n end", "title": "" }, { "docid": "ab21b63a9ebaed0acc0d9f0a966bb3be", "score": "0.502215", "text": "def lesson_word_synonym_params\n params.require(:lesson_word_synonym).permit(:lesson_word_id, :synonym_id)\n end", "title": "" }, { "docid": "4330e81da18190826c425c7f264e6ebe", "score": "0.5018927", "text": "def batch_synonyms(synonyms, forward_to_replicas = false, replace_existing_synonyms = false, request_options = {})\n client.post(\"#{Protocol.batch_synonyms_uri(name)}?forwardToReplicas=#{forward_to_replicas}&replaceExistingSynonyms=#{replace_existing_synonyms}\", synonyms.to_json, :batch, request_options)\n end", "title": "" }, { "docid": "2b9c9873a7fc14f957bdb9965d580e2e", "score": "0.5009889", "text": "def update\n respond_to do |format|\n if @syndic.update(syndic_params)\n format.html { redirect_to @syndic, notice: \"Syndic was successfully updated.\" }\n format.json { render :show, status: :ok, location: @syndic }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @syndic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "955a5ffbcbdaa3fa7021cb222bfe114a", "score": "0.50073296", "text": "def create\n #the current user will always be the same when coming from this\n speech_id = params[:data][:speech_id].to_i\n user_id = current_user.id\n snippets = JSON.parse(params[:data][:snippets])\n\n # check if highlight already exists\n if highlights = Highlight.find_by(user_id: user_id, speech_id: speech_id)\n highlights.update(snippets: JSON.parse(highlights.snippets).push(snippets))\n else\n highlights = Highlight.new(speech_id: speech_id, user_id: user_id, snippets: snippets)\n highlights.save\n end\n\n @highlights = highlights\n @speech = Speech.find(speech_id)\n @selected_user = current_user\n\n\n respond_to do |format|\n format.js {}\n end\n end", "title": "" }, { "docid": "4a55153a6879b540efeeb8e53e5d5317", "score": "0.50009173", "text": "def syndrome_params\n params.require(:syndrome).permit(:name, :description, :position)\n end", "title": "" }, { "docid": "dccb428ab756e55e1f5188d049d6fffb", "score": "0.49603012", "text": "def set_syndic\n @syndic = Syndic.find(params[:id])\n end", "title": "" }, { "docid": "3242734e50b94e69bf8bc728a464cb95", "score": "0.49498612", "text": "def save_zuordnung\n synonym = AnlagenSynonym.find(params[:synonym].to_i)\n synonym.anlage = Anlage.find(params[:anlage].to_i)\n if synonym.save\n flash[:success] = \"Zuordnung erfolgreich\"\n redirect_to upload_anlagen_zuordnung_path\n else\n # TODO: Fehlerbehandlung\n end \n end", "title": "" }, { "docid": "9cd526051cd84ac6221bf837a552775b", "score": "0.49236962", "text": "def diseasesynonym_params\n params.require(:diseasesynonym).permit(:synonym)\n end", "title": "" }, { "docid": "f66ec0cabae24eabd5777c2fdb80c1dc", "score": "0.49123", "text": "def create\n @syohin = Syohin.new(syohin_params)\n\n respond_to do |format|\n if @syohin.save\n format.html { redirect_to @syohin, notice: 'Syohin was successfully created.' }\n format.json { render :show, status: :created, location: @syohin }\n else\n format.html { render :new }\n format.json { render json: @syohin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77d5dc7ab8cda9cdbfd73b8d6471a6a7", "score": "0.49101117", "text": "def create\n @ref_sanatorium = Ref::Sanatorium.new(params[:ref_sanatorium])\n\n respond_to do |format|\n if @ref_sanatorium.save\n format.html { redirect_to ref_sanatoria_path, notice: I18n.t(:record_created) }\n format.json { render json: @ref_sanatorium, status: :created, location: @ref_sanatorium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_sanatorium.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba7a6deea4e8af43b6a065eb2fdcc39f", "score": "0.48911196", "text": "def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "title": "" }, { "docid": "3904e5a01ecaf9040bedf075ad33c2d9", "score": "0.4880914", "text": "def create\n\n @word = Word.new(word_params)\n word_params[:meanings_attributes][:word_id] = @word.id\n\n if word_params[:synonymous_attributes]!=nil\n word_params[:synonymous_attributes][:word_id] = @word.id\n end\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e442dccf1a095a32c8d8d07f53a1798", "score": "0.48690286", "text": "def create\n @onsen = Onsen.new(onsen_params)\n\n respond_to do |format|\n if @onsen.save\n format.html { redirect_to @onsen, notice: 'Onsen was successfully created.' }\n format.json { render :show, status: :created, location: @onsen }\n else\n format.html { render :new }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a0bc1f2032117d6cc6f061cabc7c9d4", "score": "0.48603788", "text": "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "title": "" }, { "docid": "bb4625bc63c29a816aee1e04665213f7", "score": "0.48573625", "text": "def create\n @trnodo = Trnodo.new(params[:trnodo])\n\n respond_to do |format|\n if @trnodo.save\n format.html { redirect_to @trnodo, notice: 'Trnodo was successfully created.' }\n format.json { render json: @trnodo, status: :created, location: @trnodo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trnodo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08930cb6d1acad46eafed7c935db381c", "score": "0.48430565", "text": "def create\n @server = Server.new(server_params)\n @neo = Neography::Rest.new\n\n respond_to do |format|\n if @server.save && n = Neography::Node.create(\"name\" => server_params[:name])\n n.add_to_index('servers', 'name', server_params[:name])\n n.id = n.neo_id # this construct should be improved..\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15eaf0550dc778a44ed5792335d807d1", "score": "0.48266202", "text": "def update\n respond_to do |format|\n if @syndrome.update(syndrome_params)\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully updated.' }\n format.json { render :show, status: :ok, location: @syndrome }\n else\n format.html { render :edit }\n format.json { render json: @syndrome.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d189c3d68db1a35583ca078b053d7c6", "score": "0.48083562", "text": "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "title": "" }, { "docid": "dde6533b4cadb8fbe761edd12f7b4e35", "score": "0.4783733", "text": "def add_relation\n #add relation\n @word.word_roots.create(@word_root)\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "91ef504786167a38d5d0bdb0e7a15286", "score": "0.47653273", "text": "def create\n @server_ins_transaction = ServerInsTransaction.new(params[:server_ins_transaction])\n\n respond_to do |format|\n if @server_ins_transaction.save\n format.html { redirect_to @server_ins_transaction, notice: 'Server ins transaction was successfully created.' }\n format.json { render json: @server_ins_transaction, status: :created, location: @server_ins_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_ins_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e0392c63bec2ce34ac3029515f35e41d", "score": "0.47575346", "text": "def create\n @stone = Stone.new(params[:stone])\n\n respond_to do |format|\n if @stone.save\n format.html { redirect_to @stone, notice: 'Stone was successfully created.' }\n format.json { render json: @stone, status: :created, location: @stone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8ec7caf4de69d497414813b1effea9ef", "score": "0.4756497", "text": "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "title": "" }, { "docid": "24619e18505462a3fb9ddce9a3fcc16e", "score": "0.47433013", "text": "def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6807f4c925a8983c012713e79f9e3a3", "score": "0.47383627", "text": "def post\n Rentlinx.client.post(self)\n end", "title": "" }, { "docid": "ab16ac15b178c9077fb0d1d28380a1dc", "score": "0.4734835", "text": "def create\n @stanza = Stanza.new(params[:stanza])\n\n respond_to do |format|\n if @stanza.save\n format.html { redirect_to @stanza, notice: 'Stanza was successfully created.' }\n format.json { render json: @stanza, status: :created, location: @stanza }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stanza.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0734c1084f9af1c492235277a5c68402", "score": "0.47244602", "text": "def create\n @ontology = SYMPH::Ontology.save(params[:ontology])\n \n respond_to do |format|\n if @ontology\n flash[:notice] = 'Ontology was successfully created.'\n else\n flash[:notice] = 'Failed on create ontology.'\n end\n format.html { redirect_to :action => :edit, :id => @ontology }\n format.xml { render :xml => @ontology, :status => :created, :location => @ontology }\n end\n end", "title": "" }, { "docid": "0e562a7d01939bcedede51c8cf5f3fa0", "score": "0.4723441", "text": "def create\n @nineteen = Nineteen.new(nineteen_params)\n\n respond_to do |format|\n if @nineteen.save\n format.html { redirect_to @nineteen, notice: 'Nineteen was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nineteen }\n else\n format.html { render action: 'new' }\n format.json { render json: @nineteen.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.47229254", "text": "def POST; end", "title": "" }, { "docid": "5ca2dab4e6a5829b87c54e2e26a608e9", "score": "0.47206804", "text": "def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "193fa8957bac44d7ba1671c823f4f5d2", "score": "0.47195733", "text": "def postCategorySynonym( category_id, synonym, language)\n params = Hash.new\n params['category_id'] = category_id\n params['synonym'] = synonym\n params['language'] = language\n return doCurl(\"post\",\"/category/synonym\",params)\n end", "title": "" }, { "docid": "11ce2f82fec84acecb6538d41468717b", "score": "0.4712132", "text": "def create\n @noshow = Noshow.new(noshow_params)\n\n respond_to do |format|\n if @noshow.save\n format.html { redirect_to @noshow, notice: 'Noshow was successfully created.' }\n format.json { render :show, status: :created, location: @noshow }\n else\n format.html { render :new }\n format.json { render json: @noshow.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e60609f6f5e6700214cd529766d0a4", "score": "0.47108024", "text": "def create\n @torneo = Torneo.new(params[:torneo])\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo was successfully created.' }\n format.json { render json: @torneo, status: :created, location: @torneo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a939f6b79ae292bfa41f8b2425828d4", "score": "0.4707066", "text": "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "title": "" }, { "docid": "3208906e2549ccca6c0c0ce49ab7ee8f", "score": "0.47048062", "text": "def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end", "title": "" }, { "docid": "377edfafedecede67116b73c5d725850", "score": "0.4696116", "text": "def save_synonym!(objectID, synonym, forward_to_replicas = false, request_options = {})\n res = save_synonym(objectID, synonym, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end", "title": "" }, { "docid": "107cea3bb1d24ca1f2853aaab02e8162", "score": "0.4691586", "text": "def change_synonyms # :prefetch: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @list_members = nil\n @new_names = nil\n @synonym_name_ids = []\n @synonym_names = []\n @deprecate_all = true\n if request.method == :post\n list = params[:synonym][:members].strip_squeeze\n @deprecate_all = (params[:deprecate][:all] == '1')\n\n # Create any new names that have been approved.\n construct_approved_names(list, params[:approved_names], @deprecate_all)\n\n # Parse the write-in list of names.\n sorter = NameSorter.new\n sorter.sort_names(list)\n sorter.append_approved_synonyms(params[:approved_synonyms])\n\n # Are any names unrecognized (only unapproved names will still be\n # unrecognized at this point) or ambiguous?\n if !sorter.only_single_names\n dump_sorter(sorter)\n # Has the user NOT had a chance to choose from among the synonyms of any\n # names they've written in?\n elsif !sorter.only_approved_synonyms\n flash_notice :name_change_synonyms_confirm.t\n else\n now = Time.now\n\n # Create synonym and add this name to it if this name not already\n # associated with a synonym.\n if !@name.synonym_id\n @name.synonym = Synonym.create\n @name.save\n Transaction.post_synonym(\n :id => @name.synonym\n )\n Transaction.put_name(\n :id => @name,\n :set_synonym => @name.synonym\n )\n end\n\n # Go through list of all synonyms for this name and written-in names.\n # Exclude any names that have un-checked check-boxes: newly written-in\n # names will not have a check-box yet, names written-in in previous\n # attempt to submit this form will have checkboxes and therefore must\n # be checked to proceed -- the default initial state.\n proposed_synonyms = params[:proposed_synonyms] || {}\n for n in sorter.all_synonyms\n # Synonymize all names that have been checked, or that don't have\n # checkboxes.\n if proposed_synonyms[n.id.to_s] != '0'\n if n.synonym_id != @name.synonym_id\n @name.transfer_synonym(n)\n Transaction.put_name(\n :id => n,\n :set_synonym => @name.synonym\n )\n end\n end\n end\n\n # De-synonymize any old synonyms in the \"existing synonyms\" list that\n # have been unchecked. This creates a new synonym to connect them if\n # there are multiple unchecked names -- that is, it splits this\n # synonym into two synonyms, with checked names staying in this one,\n # and unchecked names moving to the new one.\n check_for_new_synonym(@name, @name.synonyms, params[:existing_synonyms] || {})\n\n # Deprecate everything if that check-box has been marked.\n success = true\n if @deprecate_all\n for n in sorter.all_names\n if !deprecate_synonym(n)\n # Already flashed error message.\n success = false\n end\n end\n end\n\n if success\n redirect_to(:action => 'show_name', :id => @name.id,\n :params => query_params)\n else\n flash_object_errors(@name)\n flash_object_errors(@name.synonym)\n end\n end\n\n @list_members = sorter.all_line_strs.join(\"\\r\\n\")\n @new_names = sorter.new_name_strs.uniq\n @synonym_name_ids = sorter.all_synonyms.map(&:id)\n @synonym_names = @synonym_name_ids.map {|id| Name.safe_find(id)}.reject(&:nil?)\n end\n end\n end", "title": "" }, { "docid": "96cc65b353cec227450b4f22bfe0a833", "score": "0.46802637", "text": "def synonyms; end", "title": "" }, { "docid": "af49eca004e34a5f19fad943d9672e51", "score": "0.4677159", "text": "def create\n neuron = Neuron.create! params\n render :json => neuron\n # @neuron = Neuron.new(params[:neuron])\n # \n # respond_to do |format|\n # if @neuron.save\n # format.html { redirect_to @neuron, notice: 'Neuron was successfully created.' }\n # format.json { render json: @neuron, status: :created, location: @neuron }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @neuron.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "7e07a071b0877cc404e21e3356f2ae4b", "score": "0.4666646", "text": "def create\n @siren = Siren.new(siren_params)\n\n respond_to do |format|\n if @siren.save\n format.html { redirect_to @siren, notice: 'Siren was successfully created.' }\n format.json { render :show, status: :created, location: @siren }\n else\n format.html { render :new }\n format.json { render json: @siren.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ecfd7032115baf532d585bcce3aa0014", "score": "0.4665433", "text": "def create\n @dino = Dino.new(dino_params)\n\n respond_to do |format|\n if @dino.save\n format.html { redirect_to @dino, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @dino }\n else\n format.html { render :new }\n format.json{ render json: @dino.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "e5ffa52c904717285986d14b48771360", "score": "0.4650935", "text": "def create(input)\n @response = self.request(Net::HTTP::Post.new(\n \"/stikkits.atom?raw_text=#{CGI.escape(input)}\"\n ))\n #-- TODO: This should be processed and useful output presented\n #++\n puts @response.body\n end", "title": "" }, { "docid": "1beb69ff32f317a4ed75af4baf3765b4", "score": "0.4645833", "text": "def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end", "title": "" }, { "docid": "dede26dd2d83472a738e800e15694b82", "score": "0.46341327", "text": "def create\n @shout = Shout.new(params[:shout])\n\n# params[:tags].split(\" \").each do |tag_word|\n# \t @shout.tags.build(:tag_word => tag_word)\n# \tend\n\t\n respond_to do |format|\n if @shout.save\n format.html { redirect_to @shout, notice: 'Shout was successfully created.' }\n format.json { render json: @shout, status: :created, location: @shout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shout.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2acf295503fd96952be9bdf7cf460bd", "score": "0.4633012", "text": "def create\n @swit = Swit.new(swit_params)\n @swit.user_id= current_user.username\n\n @post =@swit.post\n \n\n #render :text => @tags\n respond_to do |format|\n if @swit.save\n @tags= @post.scan(/\\{[^}]*\\}/)\n\n @tags.each do |doortag|\n @doortag = Doortag.new(swit_id: @swit.id, tag: doortag)\n @doortag.save\n end\n format.html { redirect_to swits_path, notice: 'Swit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @swit }\n else\n format.html { render action: 'new' }\n format.json { render json: @swit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9227693db7581978e7b3065748e51e86", "score": "0.4632216", "text": "def create\n @studnet = Studnet.new(params[:studnet])\n\n respond_to do |format|\n if @studnet.save\n format.html { redirect_to @studnet, notice: 'Studnet was successfully created.' }\n format.json { render json: @studnet, status: :created, location: @studnet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @studnet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8269ce95ab70a8dac647d7215e1e9fd4", "score": "0.4629517", "text": "def create\n @wine = Wine.new(wine_params)\n @wine.user= current_user\n \n\n parse_and_insert\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to wine_path(@wine), notice: 'Wine was successfully created.' }\n format.json { render action: 'index', status: :created, location: @wine }\n else\n format.html { render action: 'new' }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff313e1946e462d98c6f6a2f0e8961e8", "score": "0.46266928", "text": "def division_syn_params\n params.require(:division_syn).permit(:name, :email, :phone_number, :address)\n end", "title": "" }, { "docid": "158181569cc3a41d556ad244057d578c", "score": "0.46262196", "text": "def add_synonym(synonym)\n synonyms << synonym\n end", "title": "" }, { "docid": "1a85019b33604a68003bed947c65c34a", "score": "0.4616373", "text": "def create\n @sinnoh = Sinnoh.new(sinnoh_params)\n\n respond_to do |format|\n if @sinnoh.save\n format.html { redirect_to @sinnoh, notice: 'Sinnoh was successfully created.' }\n format.json { render :show, status: :created, location: @sinnoh }\n else\n format.html { render :new }\n format.json { render json: @sinnoh.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "261591f97b67e4a87679d9e79204b0d0", "score": "0.46154186", "text": "def create\n @taxonomy_term = TaxonomyTerm.new(params[:taxonomy_term])\n\n respond_to do |format|\n if @taxonomy_term.save\n format.html { redirect_to admin_taxonomy_term_path(@taxonomy_term), notice: 'Taxonomy term was successfully created.' }\n format.json { render json: @taxonomy_term, status: :created, location: @taxonomy_term }\n else\n \tset_site_entities @taxonomy_term\n \t\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_term.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "baab87ae75e57429edbe0338baec0027", "score": "0.46153504", "text": "def raw_post; end", "title": "" }, { "docid": "f13d212c07813dfaa752ca43005e5a7b", "score": "0.46152097", "text": "def update_synonym_set(engine_name, id, body)\n put(\"engines/#{engine_name}/synonyms/#{id}\", body)\n end", "title": "" }, { "docid": "daa1b9d8ee97c6355be1e76fd5ed6454", "score": "0.46141312", "text": "def create\n @notion = Notion.new(notion_params)\n\n respond_to do |format|\n if @notion.save\n format.html { redirect_to @notion, notice: 'Notion was successfully created.' }\n format.json { render :show, status: :created, location: @notion }\n else\n format.html { render :new }\n format.json { render json: @notion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d448706d0e1963e6e6846efbbb456efc", "score": "0.46105844", "text": "def index\n @syndics = Syndic.all\n end", "title": "" }, { "docid": "46cbae0611e28dcaf1d1c6e71efb5791", "score": "0.4604516", "text": "def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9668f7f5e05473e945b36bf059c0df41", "score": "0.45964265", "text": "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", "title": "" }, { "docid": "15a4d6194dfc524771f43cec29767a02", "score": "0.45952147", "text": "def post_data(graph, context=\"\")\n synchronize do\n # Prepares the dir to connect with the repository\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/statements?context=%3C#{CGI::escape(context)}%3E\"\n data = graph.serialize(:ntriples)\n\n # Adds the data to Sesame\n RestClient.post dir, data, :content_type=>select_type\n end\n end", "title": "" }, { "docid": "c9e5044e8e7bf2166b857a20d273bcb2", "score": "0.4594614", "text": "def create\n @trainbot = Trainbot.new(trainbot_params)\n @org = UttranceService.new\n @org.post_uttrance(trainbot_params[:message],trainbot_params[:intent],trainbot_params[:entity],trainbot_params[:start],trainbot_params[:end],trainbot_params[:body]\n )\n respond_to do |format|\n if @trainbot.save\n format.html { redirect_to @trainbot, notice: 'Trainbot was successfully created.' }\n format.json { render :show, status: :created, location: @trainbot }\n else\n format.html { render :new }\n format.json { render json: @trainbot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5003afef3f1aac7973b1eeae0f3b2f2", "score": "0.45945227", "text": "def create\n @stilage = Stilage.new(stilage_params)\n respond_to do |format|\n if @stilage.save\n format.html { redirect_to @stilage, notice: 'Stilage was successfully created.' }\n format.json { render :show, status: :created, location: @stilage }\n else\n format.html { render :new }\n format.json { render json: @stilage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2aaec8a2fe26126f5f986e2ba1fd1949", "score": "0.4590776", "text": "def post_translation(key, lang, source, new_value)\n return true unless $REAL\n\n new_value_json = {\n 'target_language' => lang,\n 'type' => 'key',\n 'key' => key,\n 'source' => source,\n 'target' => new_value\n }.to_json\n # NOTE: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n # POST https://translation.io/api/v1/segments(.json)\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{$API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'POST',\n 'https://translation.io/api/v1/segments.json',\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend", "title": "" }, { "docid": "1d2464e695011424810cb324ecac2b8f", "score": "0.45891488", "text": "def create\n @meaning = Meaning.new(params[:meaning])\n @meaning.user = current_user\n\n respond_to do |format|\n if @meaning.save\n format.html { redirect_to @meaning.word, notice: 'Meaning was successfully created.' }\n format.json { render json: @meaning, status: :created, location: @meaning }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meaning.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2d31950ae3a1eb28ff4bb02f4258995", "score": "0.45861518", "text": "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "title": "" }, { "docid": "0a8229559846d16cd34d36fc3188f65d", "score": "0.4583382", "text": "def create\n @wynthought = Wynthought.new(wynthought_params)\n\n respond_to do |format|\n if @wynthought.save\n format.html { redirect_to :back, notice: 'Wynthought was successfully created.' }\n format.json { render :show, status: :created, location: @wynthought }\n else\n format.html { render :new }\n format.json { render json: @wynthought.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3eb1b5fd548827ceba7cf3db0c8c3588", "score": "0.45810938", "text": "def create\n @statement = Statement.new(params[:statement])\n\n respond_to do |format|\n if @statement.save\n format.html { redirect_to administration_cms_path, notice: 'Statement was successfully created.' }\n format.json { render json: @statement, status: :created, location: @statement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d716d885ad516550445681de47f6dd8b", "score": "0.45804197", "text": "def create\n @sinistro = Sinistro.new(sinistro_params)\n\n respond_to do |format|\n if @sinistro.save\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully created.' }\n format.json { render :show, status: :created, location: @sinistro }\n else\n format.html { render :new }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c8cbd15e6866b3c7d55f002e34eb8916", "score": "0.45762438", "text": "def create\n #@server_node = ServerNode.new(params[:server_node])\n #@server_node = ServerNode.create() do |n|\n # n.name = params[:node][:name]\n\t# n.region = params[:node][:region]\n\t# n.status = params[:node][:status]\n\n #end\n\n respond_to do |format|\n if @server_node.save\n format.html { redirect_to @server_node, notice: 'Server node was successfully created.' }\n format.json { render json: @server_node, status: :created, location: @server_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "518b43e219dfb00d1a7e9d440c9e1eef", "score": "0.4574163", "text": "def snipet_params\n params.require(:snipet).permit(:title, :content, :execution_output)\n end", "title": "" }, { "docid": "518b43e219dfb00d1a7e9d440c9e1eef", "score": "0.4574163", "text": "def snipet_params\n params.require(:snipet).permit(:title, :content, :execution_output)\n end", "title": "" }, { "docid": "fdecb77e3b4af059bb37d0a164d4826d", "score": "0.45682535", "text": "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", "title": "" }, { "docid": "3fc48c430ce4dd988c069e84b432f1e8", "score": "0.45675078", "text": "def create\n @raw_datum = RawDatum.new(params[:raw_datum])\n\n respond_to do |format|\n if @raw_datum.save\n format.html { redirect_to @raw_datum, notice: 'Raw datum was successfully created.' }\n format.json { render json: @raw_datum, status: :created, location: @raw_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @raw_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ad7d108921271815e5e6583f0843417", "score": "0.45636147", "text": "def create\n @ontology = Ontology.new(ontology_params)\n\n respond_to do |format|\n if @ontology.save\n format.html { redirect_to @ontology, notice: 'Ontology was successfully created.' }\n format.json { render :show, status: :created, location: @ontology }\n else\n format.html { render :new }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b30bb04bc50ba742c3198c7f0ff1f3f", "score": "0.4563212", "text": "def create\n @niveis_ensino = NiveisEnsino.new(params[:niveis_ensino])\n\n respond_to do |format|\n if @niveis_ensino.save\n format.html { redirect_to(@niveis_ensino, :notice => 'Niveis ensino cadastrado com sucesso.') }\n format.xml { render :xml => @niveis_ensino, :status => :created, :location => @niveis_ensino }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @niveis_ensino.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7053ea1dcc165e23481f458fa023ba3d", "score": "0.45536843", "text": "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "title": "" }, { "docid": "fb6ae226b32027d05bdb2c3270186fb9", "score": "0.45496997", "text": "def create\n\n\t\t\t\ttparams = params.require(:testimony).permit :quote,:author\n\n\t\t\t\t@testimony = Testimony.new tparams\n\n\t\t\t\tif @testimony.save\n\n\t\t\t\t\trender json: @testimony,status: 201\n\n\t\t\t\telse\n\n\t\t\t\t\trender json: {errors: @testimony.errors},status: 422\n\n\t\t\t\tend\n\n\t\t\tend", "title": "" }, { "docid": "91a8c0d5e00de5b8f7d14caf206ea9a6", "score": "0.45462313", "text": "def create\n @study_set = StudySet.new(user_id: current_user.id, link_id: params[:study_set][:link_id])\n @study_set.entries << Entry.find(params[:study_set][:entry_id])\n\n respond_to do |format|\n if @study_set.save\n if params.has_key? 'save-return'\n format.html { redirect_to current_user, notice: 'Study set was successfully created.' }\n else\n format.html { redirect_to @study_set, notice: 'Study set was successfully created.' }\n format.json { render json: @study_set.entries }\n end\n else\n format.html { render :new }\n format.json { render json: @study_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b2123aaac2aede47a8d4bbae4f77aff", "score": "0.45450154", "text": "def create\n @wine_oenologist = WineOenologist.new(wine_oenologist_params)\n\n respond_to do |format|\n if @wine_oenologist.save\n format.html { redirect_to @wine_oenologist, notice: \"Wine oenologist was successfully created.\" }\n format.json { render :show, status: :created, location: @wine_oenologist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wine_oenologist.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "700b4c48deee0e6f88a15cd033387caa", "score": "0.45421198", "text": "def create\n @short_message = ShortMessage.new(short_message_params)\n\n client = GlobeLabs.new\n target = @short_message.target\n if target.present?\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n\n recepients = params[:recepients]\n Rails.logger.info(\"==== params:#{params.inspect}\")\n if recepients.present?\n Rails.logger.info(\"==== params:#{params[:recepients].inspect}\")\n recepients.each do |cell_no|\n @short_message = ShortMessage.new(short_message_params)\n @short_message.target = cell_no\n if @short_message.save\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n end\n end\n\n respond_to do |format|\n if @short_message.save\n format.html { redirect_to short_messages_path, notice: 'Short message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @short_message }\n else\n format.html { render action: 'new' }\n format.json { render json: @short_message.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "278f01d952fc6da3c555014c6efc78cc", "score": "0.45406666", "text": "def create\n @taxon_name_relationship = TaxonNameRelationship.new(taxon_name_relationship_params)\n\n respond_to do |format|\n if @taxon_name_relationship.save\n format.html { redirect_to @taxon_name_relationship.metamorphosize, notice: 'Taxon name relationship was successfully created.' }\n format.json { render action: 'show', status: :created, location: @taxon_name_relationship.metamorphosize }\n else\n format.html { render action: 'new' }\n format.json { render json: @taxon_name_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "746115b6f343961c1a701bab15a7de2d", "score": "0.45383143", "text": "def new_synset_word(sax, author_id, word_id)\n RawSynsetWord.new.tap do |synset_word|\n synset_word.author_id = author_id\n synset_word.word_id = word_id\n synset_word.samples_ids = sax.samples.map(&:id)\n synset_word.marks = sax.marks\n end\nend", "title": "" }, { "docid": "f74e58f1524906fc6b0976b43c79c2ce", "score": "0.4534716", "text": "def create\n set_assoc_work_param()\n @transcription = Transcription.new(params[:transcription])\n\n respond_to do |format|\n if @transcription.save\n int_rebuild_value = \"0\"\n if (params[:rebuild])\n int_rebuild_value = params[:rebuild]\n end\n if int_rebuild_value.to_i > 0\n int_tei_ret = doeditiontei(@transcription.digital_edition_id)\n end\n arr_prev_page_data = get_prev_page_last_line_data(@transcription.page_id)\n do_page_lines(arr_prev_page_data[0], arr_prev_page_data[1], @transcription.page_id)\n dopagetei(@transcription.page_id)\n str_redirect_link = \"/pages/\"+@transcription.page_id.to_s+\"/edit?notice=New%20Transcription%20Saved%20With%20ID%20\"+@transcription.id.to_s\n format.html { redirect_to str_redirect_link }\n format.json { render json: @transcription, status: :created, location: @transcription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transcription.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e9dc8639235cddb77e692cc85c49695", "score": "0.45345446", "text": "def create\n @nursery_table = NurseryTable.new(nursery_table_params)\n\n respond_to do |format|\n if @nursery_table.save\n format.html { redirect_to @nursery_table, notice: \"Nursery table was successfully created.\" }\n format.json { render :show, status: :created, location: @nursery_table }\n else\n format.html { render :new }\n format.json { render json: @nursery_table.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4b0228131214766c8d4e85dd093b6f0", "score": "0.4534044", "text": "def post(atom)\n @hive_party.post '/atoms', atom.to_h\n end", "title": "" }, { "docid": "e96344f06a80544d59d61a9378de8d54", "score": "0.45323038", "text": "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", "title": "" }, { "docid": "5134a46994e842ffcd8c387fafb51b6a", "score": "0.45289698", "text": "def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[no negative incorrect false],\n /^update$/i => %w[update change modify revise alter edit adjust],\n /^updated$/i => %w[updated changed modified revised altered edited adjusted],\n /^add$/i => %w[add create],\n /^added$/i => %w[added created],\n /^what|how$/i => %w[how what]\n }\n end", "title": "" } ]
18a44353b19664ce1f6cafb49c548569
Returns a url without the protocol (
[ { "docid": "506b39499c3625a8fc21db63d6e3ce06", "score": "0.6195062", "text": "def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end", "title": "" } ]
[ { "docid": "6b238338d24d0c5c7bb7d6c5ea3c2f21", "score": "0.81098735", "text": "def without_protocol\n self =~ %r(^(.*?)://(.*?)$) ? $2 : self\n end", "title": "" }, { "docid": "dfead82cd7d0d6250bc5a47982103ccb", "score": "0.79064494", "text": "def without_scheme_or_port(url)\n url.gsub(%r{^https?://|:\\d+$}, '')\n end", "title": "" }, { "docid": "720f4ab3cabbb79930a8308a7c0d6021", "score": "0.784464", "text": "def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end", "title": "" }, { "docid": "720f4ab3cabbb79930a8308a7c0d6021", "score": "0.784464", "text": "def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end", "title": "" }, { "docid": "eefb0c6c2864f89e561bf79543b93e78", "score": "0.77646744", "text": "def strip_url(url)\n url.sub!(/https\\:\\/\\//, '') if url.include? \"https://\"\n url.sub!(/http\\:\\/\\//, '') if url.include? \"http://\"\n return url\n end", "title": "" }, { "docid": "7b1ca9b6293ae21e7e822bf3d828b055", "score": "0.76128453", "text": "def strip_http(url = '')\n return url.gsub('http://', '')\n end", "title": "" }, { "docid": "d620d67ab4da8a8a894ab2f0555b840c", "score": "0.7509717", "text": "def url_with_protocol(url)\n /^http/.match(url) ? url : \"http://#{url}\"\n end", "title": "" }, { "docid": "d620d67ab4da8a8a894ab2f0555b840c", "score": "0.7509717", "text": "def url_with_protocol(url)\n /^http/.match(url) ? url : \"http://#{url}\"\n end", "title": "" }, { "docid": "7600db38541ed2604c264494280211b5", "score": "0.7428873", "text": "def url_with_protocol(url)\n \t/^http/.match(url) ? url : \"http://#{url}\"\n end", "title": "" }, { "docid": "626172b4a503133096788c71f7dfc186", "score": "0.7426039", "text": "def strip_http(url)\n \n # remove scheme\n if url.start_with?('http://')\n dest_url = url[7..-1]\n elsif url.start_with?('https://')\n dest_url = url[8..-1]\n else \n dest_url = url\n end\n\n # remove trailing \"meaningless\" characters\n if dest_url.end_with?('/')\n dest_url = dest_url[0..-2]\n end\n\n if dest_url.end_with?('#')\n dest_url = dest_url[0..-2]\n end\n\n return dest_url\n end", "title": "" }, { "docid": "d9f98ed9391f8cef3adf182a6241309a", "score": "0.74092686", "text": "def format_url(url)\n url.gsub(%r{^(https?:\\/\\/)}, '')\n end", "title": "" }, { "docid": "5e1bd785e37a99bf2342f461a1433623", "score": "0.73386633", "text": "def without_query_string\n query = to_query_string\n without_query_string = query ? gsub(query, '') : self\n\n Wgit::Url.new(without_query_string)\n end", "title": "" }, { "docid": "df61b24d1a9d4d823a6c2bfc7ef1b107", "score": "0.7320909", "text": "def remove_proto( url )\n url\n #begin\n # url = URI.parse( url )\n # scheme = url.scheme + '://'\n # escape( url.to_s.gsub( scheme, '' ) )\n #rescue\n # return url\n #end\n end", "title": "" }, { "docid": "58b747dd7805fbcab3f2615a7dd6fc1a", "score": "0.72988725", "text": "def only_path(url)\n URI.parse(url).tap {|uri|\n uri.scheme = nil\n uri.host = nil\n uri.port = nil\n }.to_s\n end", "title": "" }, { "docid": "0ce2e3e19282f3ff33e235895b136714", "score": "0.72728276", "text": "def nice_url\n\t\t# i want to take thr url and remove http:// and www.\n\t\t# gsub is global subsitution\n\t\turl.gsub(\"http://\", \"\").gsub(\"www.\", \"\")\n\tend", "title": "" }, { "docid": "2d2b49543a2050d63cf267370e534325", "score": "0.72632873", "text": "def without_base\n base_url = to_base\n without_base = base_url ? gsub(base_url, '') : self\n\n return self if ['', '/'].include?(without_base)\n\n Wgit::Url.new(without_base).without_slashes\n end", "title": "" }, { "docid": "2b8ea1935faadbd69a32b9f38bcdfad6", "score": "0.71129227", "text": "def relative_url(url)\n url.gsub(%r{\\Ahttp://[^/]*}, '')\n end", "title": "" }, { "docid": "76145b5339345838b768bc5614a30a52", "score": "0.7094246", "text": "def get_stripped_url(url, drop_prefix)\n result = url\n if drop_prefix && result.start_with?(\"http://\", \"https://\")\n prefix = '://'\n result = result[result.rindex(prefix)+prefix.length, result.length]\n end\n if result.end_with?('/')\n result[0...-1]\n else\n result\n end\nend", "title": "" }, { "docid": "ebb10ba21165d5736ea488fbcfbd0edb", "score": "0.70402855", "text": "def without_anchor\n anchor = to_anchor\n without_anchor = anchor ? gsub(anchor, '') : self\n\n Wgit::Url.new(without_anchor)\n end", "title": "" }, { "docid": "704c2a45c199c84c6abfd9efed2810f3", "score": "0.701061", "text": "def full_url\n full_domain(:with_protocol => true)\n end", "title": "" }, { "docid": "704c2a45c199c84c6abfd9efed2810f3", "score": "0.701061", "text": "def full_url\n full_domain(:with_protocol => true)\n end", "title": "" }, { "docid": "0a9eb4e0d8b923c43978c90a7c835e75", "score": "0.7003734", "text": "def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end", "title": "" }, { "docid": "94f8f3b4f56f349a6f5902348d3476eb", "score": "0.69970185", "text": "def clean_url\n url = self.original_url\n url = url.gsub(' ', '')\n url = url.strip\n if url !~ REGEX_PROTOCOL\n url = \"http://#{url}\"\n end\n begin\n self.original_url = URI.parse(url).normalize.to_s\n rescue URI::InvalidURIError\n # handle urls that cannot be parsed\n self.original_url = url\n end\n end", "title": "" }, { "docid": "a7ed77e3565abb95a771ea931b7e214f", "score": "0.694065", "text": "def url\n ''\n end", "title": "" }, { "docid": "304cb869985e53b533cba52934aa5f5b", "score": "0.6892534", "text": "def normalize_url url\n unless url.match(/https?:\\/\\//)\n url = \"http://#{url}\"\n end\n\n url\n end", "title": "" }, { "docid": "a4e77c6ad7b1ad4abe62c2dd190846d5", "score": "0.6870516", "text": "def without_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end", "title": "" }, { "docid": "8a816669f15584035afda78ec0c80b6c", "score": "0.6855534", "text": "def url_with_prefix\n\t\t( url.blank? ) ? '' :\n\t\t\t( url.match(/^http(s)?:\\/\\//) ? url : \"http://#{url}\" )\n\tend", "title": "" }, { "docid": "99ba905ae11082c836618744a7126567", "score": "0.685002", "text": "def url\n u = read_attribute(:url)\n u !~ /\\Ahttp/i ? \"http://#{u}\" : u\n end", "title": "" }, { "docid": "5e9f49968748a67931b14e81243e0215", "score": "0.682611", "text": "def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end", "title": "" }, { "docid": "1757d37314d84fc9079605003d8be765", "score": "0.68227977", "text": "def clean_url url\n return url if url.nil?\n url.gsub('%2F', '/').gsub(/^\\/+/, '').gsub('//', '/')\n end", "title": "" }, { "docid": "a2ca6b53643a7a1997fbec339c460eae", "score": "0.6811104", "text": "def external_url(url)\n if url.blank?\n ''\n else\n url.match(/^http(s?):\\/\\//) ? url : \"http://#{url}\"\n end\n end", "title": "" }, { "docid": "5c99e7b19147fd0d61e40984a7067c09", "score": "0.6788763", "text": "def clean_url(url)\n begin\n url = Addressable::URI.escape(url)\n url = \"http://#{url}\" if Addressable::URI.parse(url).scheme.nil?\n uri = URI(url)\n host = uri.host.downcase\n\n if host.start_with?('www.')\n host = host[4..-1]\n end\n\n host + uri.path.downcase\n rescue\n logger.debug \"Bad URL encountered in clean_url\"\n url\n end\n end", "title": "" }, { "docid": "d172f9fa9eefde82405c434e1d1b56db", "score": "0.6776436", "text": "def format_url\n self.url.chomp\n if self.url.match(\"https://\") || self.url.match(\"http://\")\n else self.url = \"http://\" + url\n end\n self.url\n end", "title": "" }, { "docid": "e05376fa847c260bae6f0ce710b5ba6b", "score": "0.6727996", "text": "def omit_base\n base_url = to_base\n omit_base = base_url ? gsub(base_url, '') : self\n\n return self if ['', '/'].include?(omit_base)\n\n Wgit::Url.new(omit_base).omit_slashes\n end", "title": "" }, { "docid": "13570c12f63f71c8131c5f9e90345414", "score": "0.67182344", "text": "def website_with_protocol\n return nil unless website.present?\n\n if website =~ %r{^https?://}\n website\n else\n \"http://#{website}\"\n end\n end", "title": "" }, { "docid": "7df5cafb412ac059c8565cc92f8e0b51", "score": "0.6703201", "text": "def path_from_url(url)\n\tresult = url.sub(/https*:\\/\\/[^\\/]*/, '') # Eliminate http[s]:// and beyond to first slash\nend", "title": "" }, { "docid": "371c5c44c9c26da43133f5891d0ac089", "score": "0.66806984", "text": "def short_url\n return nil if url.nil?\n url.gsub(\"http://\",\"\").gsub(\"www.\", \"\")\n end", "title": "" }, { "docid": "2144db75d5098f51c62e52a97ff8c7b9", "score": "0.6675638", "text": "def omit(*components)\n omitted = @uri.omit(*components)\n Wgit::Url.new(omitted.to_s)\n end", "title": "" }, { "docid": "f93b83a65b35dd9b0f16593729382e11", "score": "0.6675335", "text": "def absolutize_url(url)\n url =~ /\\Ahttps?/ ? url : \"http://#{url}\"\n end", "title": "" }, { "docid": "e210cff3bd7ffcba2275ae42f43015c8", "score": "0.6612924", "text": "def clean_url\n return # Not yet implemented\n end", "title": "" }, { "docid": "9aacaf4c2ed1394be431e3a080efe5d8", "score": "0.6608232", "text": "def clean_url\n #use try instead for nil?\n unless self.url.nil?\n parsed_url = URI.parse(self.url).host.sub(/\\Awww\\./, '')\n else\n nil\n end\n end", "title": "" }, { "docid": "f19c49ed63ff2a8e817a331731b36acd", "score": "0.66037023", "text": "def uri_scheme_without_suffix(scheme)\n return nil if scheme.blank?\n scheme.sub %r{:/*$}, \"\"\n end", "title": "" }, { "docid": "a575f4129cbcf66809c4c9e5c2f2e228", "score": "0.66023386", "text": "def patched_url\n result = url\n return result if result.start_with?('/', 'http')\n \"/#{result}\"\n end", "title": "" }, { "docid": "09e97517ec20e6b4373267ceb72dc791", "score": "0.65758586", "text": "def clean(url)\n url\n end", "title": "" }, { "docid": "332f42d07d7b888e3003acf3820526f9", "score": "0.6550967", "text": "def omit_query\n query = to_query\n omit_query_string = query ? gsub(\"?#{query}\", '') : self\n\n Wgit::Url.new(omit_query_string)\n end", "title": "" }, { "docid": "fbd43ad94a3bf25dd43e172791876629", "score": "0.6545062", "text": "def long_url_with_protocol\n if self.long_url[0..7]=='https://' or self.long_url[0..6]=='http://'\n return self.long_url\n else\n return 'https://'+ self.long_url\n end\n end", "title": "" }, { "docid": "7f3752cdc2ae0459ac867b48ce4e149a", "score": "0.6542677", "text": "def clean_url!\n remove_urchin\n case uri.host\n when 'www.youtube.com'\n self.url = \"#{uri.scheme}://#{uri.host}/watch?v=#{self.params['v'][0]}\"\n when 'boingboing.net'\n self.url = \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end\n end", "title": "" }, { "docid": "35bfdd70543123f985cdb53f9d3cf5cd", "score": "0.6524334", "text": "def sanitize_url(url)\n return url if url.include?(\"https://\") || url.include?(\"http://\")\n url.prepend(\"http://\")\n end", "title": "" }, { "docid": "54961c50532de37b07edd411abfbb72e", "score": "0.65148383", "text": "def prepend_http_to_url\n self.url = \"http://#{url}\" unless url.blank? || url.starts_with?('http://') || url.starts_with?('https://')\n end", "title": "" }, { "docid": "29d11c5782c7c39a3830756c3cf5c740", "score": "0.6513601", "text": "def without_leading_slash\n start_with?('/') ? Wgit::Url.new(self[1..-1]) : self\n end", "title": "" }, { "docid": "d06997789b4c334713bb2d2ed7607e4d", "score": "0.6513491", "text": "def url\n \"#{scheme}://#{domain}\" + ((port == 80) ? '' : \":#{port}\")\n end", "title": "" }, { "docid": "2956f815416e5542d7e75a469124bdd3", "score": "0.651251", "text": "def omit_origin\n origin = to_origin\n omit_origin = origin ? gsub(origin, '') : self\n\n return self if ['', '/'].include?(omit_origin)\n\n Wgit::Url.new(omit_origin).omit_slashes\n end", "title": "" }, { "docid": "2e27c176a80b9fa5476117a68ac886f9", "score": "0.65087545", "text": "def strip_url(tweet)\n regex = 'https://'\n current = tweet.rpartition(regex)\n\n while current.include? regex\n current = current.first.rpartition(regex)\n end\n current.last\n end", "title": "" }, { "docid": "3bf71120f160a000e172efb608110efb", "score": "0.65036255", "text": "def url\n \"#{scheme}://#{domain}\" + ((port == 80) ? \"\" : \":#{port}\")\n end", "title": "" }, { "docid": "838787162f650652729ec04337f7a4c4", "score": "0.6503416", "text": "def long_url_with_explicit_protocol\n URI.parse(long_url).instance_of?(URI::Generic) ? \"http://#{long_url}\" : long_url\n end", "title": "" }, { "docid": "f8052a7ad76c0c74941838312dbbdaf5", "score": "0.64988947", "text": "def formatted_url\n if @request.scheme == \"https\"\n @request.url.gsub(/:#{@request.port}/, '')\n else\n @request.url\n end\n end", "title": "" }, { "docid": "7d3728654a2e68ddd5171e7219b34c9b", "score": "0.6473644", "text": "def url(link)\n '#'\n end", "title": "" }, { "docid": "3b9ad60f12f474f2cb0e2b003b1c6a70", "score": "0.64624536", "text": "def full_url\n if website.match(/[A-Za-z]:\\/\\//)\n website\n else\n \"http://#{website}\"\n end\n end", "title": "" }, { "docid": "45df862c8a4e7ac59035c9dd9b428261", "score": "0.6444168", "text": "def normalize_base_uri(url) #:nodoc:\n use_ssl = (url =~ /^https/) || url.include?(':443')\n url.chop! if url.ends_with?('/')\n url.gsub!(/^https?:\\/\\//i, '')\n \"http#{'s' if use_ssl}://#{url}\"\n end", "title": "" }, { "docid": "8148e6333eec3e753916b04cd397df8c", "score": "0.6439842", "text": "def smart_add_url_protocol\n return if self.original.blank?\n unless self.original[/\\Ahttp:\\/\\//] || self.original[/\\Ahttps:\\/\\//]\n self.original = \"http://#{self.original}\"\n end\n end", "title": "" }, { "docid": "8c1a7b994f12ff5366f41e21dc806093", "score": "0.6439301", "text": "def fix_urls\n return unless self.url\n self.url.gsub!(/^(.*)/, 'http://\\1') unless self.url =~ %r{^http://} or self.url.empty?\n end", "title": "" }, { "docid": "91b446094ac9299c20857b1c8439cedb", "score": "0.64386123", "text": "def slashless_url(url)\n url.chomp('/')\n end", "title": "" }, { "docid": "5c97996092ec2bcda2dc762058734a86", "score": "0.6435235", "text": "def build_url(host)\n host.protocol + host.url\n end", "title": "" }, { "docid": "e6069b6789ceed77d4c4d84ef2d66edc", "score": "0.642234", "text": "def fix_url\n\t if self.url and not self.url.match(/^(http|https):\\/\\/.*/)\n\t self.url = 'http://' + self.url\n end\n\tend", "title": "" }, { "docid": "863f0f59749748188a00e60167f5fa78", "score": "0.6418818", "text": "def omit_fragment\n fragment = to_fragment\n omit_fragment = fragment ? gsub(\"##{fragment}\", '') : self\n\n Wgit::Url.new(omit_fragment)\n end", "title": "" }, { "docid": "3b8942fdade13ce1274606e46971ccf5", "score": "0.63838166", "text": "def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end", "title": "" }, { "docid": "3819eceebb444003f45572ee53ae5544", "score": "0.6376915", "text": "def url(request_url, delete_link: false)\n uri = URI.parse(request_url)\n if @once || delete_link\n uri.path = \"/once/#{key}/\"\n else\n uri.path = \"/clip/#{key}/\"\n end\n uri.query = nil\n uri.fragment = nil\n\n unless ['http', 'https'].include?(uri.scheme)\n raise ArgumentError.new(\"Bad URI scheme #{uri.inspect}\")\n end\n\n return uri.to_s\n end", "title": "" }, { "docid": "f8f9500acb26acb171870fb12ac50131", "score": "0.6375518", "text": "def external_urlname\n return urlname if urlname =~ /\\A(\\/|[a-z]+:\\/\\/)/\n \"http://#{urlname}\"\n end", "title": "" }, { "docid": "b6c37922b92bc66c16d5927e84ca3f85", "score": "0.6375387", "text": "def omit_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end", "title": "" }, { "docid": "1bcd9456d10c8d2031887cbf0781d915", "score": "0.6359563", "text": "def request_url(url_string)\n return url_string.gsub(/\\/$/, '') if url_string.length > 1\n url_string\n end", "title": "" }, { "docid": "42b896222a913bdf3aff383ae3661ca5", "score": "0.63479656", "text": "def url; (page.url rescue ''); end", "title": "" }, { "docid": "42b896222a913bdf3aff383ae3661ca5", "score": "0.63479656", "text": "def url; (page.url rescue ''); end", "title": "" }, { "docid": "6f7e2342d92f99ce9e827168e78f25d2", "score": "0.63331246", "text": "def full_url(url, path)\n if path.start_with?('http')\n path\n else\n url = url[0..1] if url.end_with?('/')\n path = path[1..-1] if path.start_with?('/')\n \"#{url}/#{path}\"\n end\n end", "title": "" }, { "docid": "c48e4fb43c2ab2ea8130c579c98ca338", "score": "0.6306264", "text": "def with_default_scheme(url)\n URI.parse(url).scheme.nil? ? 'http://' + url : url\n end", "title": "" }, { "docid": "7dfc95b2289b87e4131305765ae2c267", "score": "0.63024116", "text": "def fixup_url\n unless @view.app.url.starts_with?('http')\n unless @view.app.url.starts_with?('www')\n @view.app.url = 'www.' << @view.app.url\n end\n @view.app.url = 'http://' << @view.app.url\n end\n @view.app.url\n end", "title": "" }, { "docid": "6f83364b83b9e3ea7b37314a78412f75", "score": "0.62924767", "text": "def url(url=nil)\n return @url unless url\n @url = URI.parse(set_scheme(url)).to_s\n end", "title": "" }, { "docid": "5f98345bf6ec1081aab4438c41617b83", "score": "0.6291342", "text": "def generate_url(url, params = {})\n uri = URI(url)\n\n res = \"#{uri.scheme}://#{uri.host}\"\n res += \":#{uri.port}\" if (uri.port and uri.port != 80 and uri.port != 443)\n res += \"#{uri.path}\" if uri.path\n res += \"#{uri.fragment}\" if uri.fragment\n res += \"?#{params.to_query}\"\n\n return res\n end", "title": "" }, { "docid": "6f83364b83b9e3ea7b37314a78412f75", "score": "0.62909055", "text": "def url(url=nil)\n return @url unless url\n @url = URI.parse(set_scheme(url)).to_s\n end", "title": "" }, { "docid": "6f83364b83b9e3ea7b37314a78412f75", "score": "0.62909055", "text": "def url(url=nil)\n return @url unless url\n @url = URI.parse(set_scheme(url)).to_s\n end", "title": "" }, { "docid": "033132973cc347cebe7d450c610590a5", "score": "0.6287329", "text": "def to_base\n return nil if @uri.scheme.nil? || @uri.host.nil?\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end", "title": "" }, { "docid": "d4e58b5a1f1767407e40aa3a3bf23a19", "score": "0.6281565", "text": "def url(scheme: false)\n if scheme\n URI::Generic.build(scheme: type, host: addr, port: port).to_s\n else\n URI::Generic.build(host: addr, port: port).to_s\n end\n end", "title": "" }, { "docid": "d170b87001ad28d5296b0072b45954ee", "score": "0.62723523", "text": "def full_url(path)\n uri = URI.parse path\n uri.scheme, uri.host, uri.port = request.scheme, request.host, (request.port == 80 ? nil : request.port)\n uri.to_s\n end", "title": "" }, { "docid": "3de921e7f020222b084ed82cbb10ebb1", "score": "0.626981", "text": "def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end", "title": "" }, { "docid": "76d53465f4780f269892753b7c7f6f59", "score": "0.6268438", "text": "def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end", "title": "" }, { "docid": "0fd95d4f5434aeb73e853b4e8b61fef7", "score": "0.6261632", "text": "def url_with_conditional_ssl(*args)\n url_without_conditional_ssl(*args).sub(/\\Ahttps?:/, '')\n end", "title": "" }, { "docid": "98b76d6da531f1e9487eef72a7029800", "score": "0.62365067", "text": "def uri(url)\n url = URI.parse(url) unless url.is_a?(URI)\n if url.host.nil? && url.scheme.nil?\n url.host = url.path\n url.path = ''\n end\n url.scheme ||= 'http'\n url\n rescue URI::InvalidComponentError, URI::InvalidURIError\n nil\n end", "title": "" }, { "docid": "dbadd1d9d104ccd6545fc3525e381c58", "score": "0.6210438", "text": "def original_url\n url\n end", "title": "" }, { "docid": "1179edf615a139beaffc1008a16fc6b5", "score": "0.62024146", "text": "def remove_url_anchor url\n url.gsub!(/#.*/, '') if url =~ /#/\n url\nend", "title": "" }, { "docid": "081577132c4931009120107c55d83b28", "score": "0.6186908", "text": "def protocol\n @protocol.sub(\"://\",\"\")\n end", "title": "" }, { "docid": "16a5d2937ebcfdd204e92858d2df9f87", "score": "0.61832154", "text": "def urify(url)\n url = url.to_s.downcase\n if %r(^https://) !~ url\n url = 'https://' + url\n end\n URI.parse(url) + '/'\n end", "title": "" }, { "docid": "f2a5e84973baebb68b7a9105673e1dfc", "score": "0.6179815", "text": "def correct_uri( url )\n uri = URI( url )\n if uri.scheme == 'http'\n case\n when uri.host.match( 'github.com' )\n # remove possible subdomain like 'wiki.github.com'\n uri = URI \"https://github.com#{uri.path}\"\n when uri.host.match( 'bitbucket.org' )\n uri = URI \"https://#{uri.host}#{uri.path}\"\n end\n end\n\n uri\n end", "title": "" }, { "docid": "917f08754f8f12fd66891dfc3442b262", "score": "0.61787015", "text": "def full_url display_url\n if display_url.blank?\n return nil\n end\n return (display_url[0..6] == \"http://\" or display_url[0..7] == \"https://\") ? display_url : \"http://#{display_url}\"\n end", "title": "" }, { "docid": "693be8ef84c34a0dc7d51ae152ebc939", "score": "0.6177716", "text": "def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end", "title": "" }, { "docid": "bde7fd9ad73a37841882b27ebf2b1799", "score": "0.6177391", "text": "def normalize_url(url)\n return nil if url.nil?\n begin\n uri = Addressable::URI.heuristic_parse(url)\n uri.host.present? && /^http(s)?$/.match(uri.scheme) ? uri.to_s : nil\n rescue\n nil\n end\n end", "title": "" }, { "docid": "6c61bbe697f826fc6c0e979009c5d6bd", "score": "0.61721486", "text": "def url\n 'https://' + request.host\n end", "title": "" }, { "docid": "6c6ab11c884591c9a7a7ad952e7506f3", "score": "0.61389786", "text": "def full_url\n\t\tcase typ\n\t\twhen /wikipedia_(..)/\n\t\t\treturn \"http://\"+$~[1]+\".wikipedia.org/wiki/\"+url\n\t\twhen \"gutenberg.org\"\n\t\t\treturn \"http://www.gutenberg.org/author/\"+url\n\t\twhen \"gutenberg.spiegel.de\"\n\t\t\treturn \"http://gutenberg.spiegel.de/autoren/\"+url+\".htm\"\n\t\twhen \"fictionfantasy.de\"\n\t\t\treturn \"http://www.fictionfantasy.de/load.php?name=News&file=article&sid=\"+url\n\t\twhen \"homepage\", \"sonstiges\"\n\t\t\t# return url\n\t\telse\n\t\t\t# return url\n\t\tend\n\t\tif url.starts_with? \"http://\" then\n\t\t\treturn url\n\t\telse\n\t\t\treturn \"http://\"+url\n\t\tend\n\t\t# TODO\n\t\t# dsfdb.org, isfdb.org\n\t\t# perrypedia, perry-rhodan.net link\n\t\t# http://www.nemesisarchiv.de.vu/\n\tend", "title": "" }, { "docid": "413161f08cda65afd36cb63cd3cde70a", "score": "0.6137564", "text": "def generate_url(url, params = {})\n uri = URI(url)\n\n res = \"#{uri.scheme}://#{uri.host}\"\n res += \":#{uri.port}\" if (uri.port and uri.port != 80 and uri.port != 443)\n res += \"#{uri.path}#\" if uri.path\n res += \"#{uri.fragment}\" if uri.fragment\n res += \"?#{params.to_query}\"\n\n return res\n end", "title": "" }, { "docid": "76b9a437dbf510f0ee267d3e5c50a0a1", "score": "0.613733", "text": "def clean_url(href)\n # TODO: A better way would be to split by / then take the last section, strip off the anchor then cgi escape\n URI.unescape(href.strip).gsub(\" \", \"%20\")\n end", "title": "" }, { "docid": "e58013288d04fa9b456dc6396bc9e025", "score": "0.6135749", "text": "def add_url_protocol\n unless url[/\\Ahttp:\\/\\//] || url[/\\Ahttps:\\/\\//]\n self.url = \"http://#{self.url}\"\n end\n end", "title": "" } ]
5a0ddcfba3b2744570415d4b270f5639
NOTE : mayber we should just integrate it via params at initialization ? Laurent, 13/07/2017
[ { "docid": "88dce6130a1a47269cea33c921bc472a", "score": "0.0", "text": "def identity_solver\n @identity_solver ||= IdentitySolver.new(request, user)\n end", "title": "" } ]
[ { "docid": "0d496e1887126b69b6d6aa4045da4f61", "score": "0.7719932", "text": "def init(params)\n end", "title": "" }, { "docid": "8fb4989df0b1b036ce4942da036d195e", "score": "0.7356607", "text": "def init_params(params)\n super\n end", "title": "" }, { "docid": "8fb4989df0b1b036ce4942da036d195e", "score": "0.7356607", "text": "def init_params(params)\n super\n end", "title": "" }, { "docid": "5644f33dcaa6e75fea2f34138b4021e6", "score": "0.7260564", "text": "def init\r\n \r\n end", "title": "" }, { "docid": "8ab7b1caf2cb4e077357cd569b34f71c", "score": "0.71056634", "text": "def init\n\t\t\t\t\t\t\t\tend", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.70659536", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.70659536", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.70659536", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.70659536", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.70659536", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.70659536", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.70659536", "text": "def init; end", "title": "" }, { "docid": "4ba8a653144e0b2e0578db97745aa433", "score": "0.70136845", "text": "def at_init\n\t\t\n\t\tend", "title": "" }, { "docid": "4a5b47013b58f944e5da9893afdef915", "score": "0.69942653", "text": "def configure_with(params)\r\n\r\n\t\tend", "title": "" }, { "docid": "8f0b1d36f96a6e1e7f31b841bc0d15fd", "score": "0.6976602", "text": "def set_parameters\n end", "title": "" }, { "docid": "8f0b1d36f96a6e1e7f31b841bc0d15fd", "score": "0.6976602", "text": "def set_parameters\n end", "title": "" }, { "docid": "a01b6901754d1abbc14f050acb35ff5b", "score": "0.6973826", "text": "def init\n end", "title": "" }, { "docid": "a01b6901754d1abbc14f050acb35ff5b", "score": "0.6973826", "text": "def init\n end", "title": "" }, { "docid": "a01b6901754d1abbc14f050acb35ff5b", "score": "0.6973826", "text": "def init\n end", "title": "" }, { "docid": "6da11b6018e9420a7480010c070c9965", "score": "0.6945946", "text": "def post_init; end", "title": "" }, { "docid": "6da11b6018e9420a7480010c070c9965", "score": "0.6945946", "text": "def post_init; end", "title": "" }, { "docid": "6da11b6018e9420a7480010c070c9965", "score": "0.6945946", "text": "def post_init; end", "title": "" }, { "docid": "b1fd88118bc575d18b0b424ae711482e", "score": "0.69134384", "text": "def preinit\n end", "title": "" }, { "docid": "4ba2e0075473f023a8c492a76b2c35df", "score": "0.69055945", "text": "def initialize\n super\n @params = [0.0] * 8\n end", "title": "" }, { "docid": "40769f9969d33ad71cb2389a7e574114", "score": "0.6887561", "text": "def institucional\n\t\t\n\tend", "title": "" }, { "docid": "a747cf4388fb3d14718cf9dda73c555f", "score": "0.6883428", "text": "def initalize; end", "title": "" }, { "docid": "a747cf4388fb3d14718cf9dda73c555f", "score": "0.6883428", "text": "def initalize; end", "title": "" }, { "docid": "aefe16a618f211408b8e95c457b239ee", "score": "0.6866354", "text": "def initialize(params={})\n end", "title": "" }, { "docid": "aefe16a618f211408b8e95c457b239ee", "score": "0.6866354", "text": "def initialize(params={})\n end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "d776711817bf6bc1f145594060bfb5e1", "score": "0.68412966", "text": "def parameters; end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.68285763", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.68285763", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.68285763", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.68285763", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.68200827", "text": "def setup(params)\n end", "title": "" }, { "docid": "dc90d29d71dcbecfbdd1751b07b0b039", "score": "0.6819651", "text": "def init\n end", "title": "" }, { "docid": "dc90d29d71dcbecfbdd1751b07b0b039", "score": "0.6819651", "text": "def init\n end", "title": "" }, { "docid": "dc90d29d71dcbecfbdd1751b07b0b039", "score": "0.6819651", "text": "def init\n end", "title": "" }, { "docid": "99f9fa49d96769f8af6f46a16fc3d026", "score": "0.6797385", "text": "def initialize(*params)\n end", "title": "" }, { "docid": "ae526a7c7e6b1343f593e4712dd51630", "score": "0.67714393", "text": "def initalize\n end", "title": "" }, { "docid": "760da4ff97cbc6b708754fbbef217da1", "score": "0.6766084", "text": "def EXTRA_INIT\n end", "title": "" }, { "docid": "7467c9de634766ee39b41d57ae1f660b", "score": "0.67552024", "text": "def init\n #\n end", "title": "" }, { "docid": "51a03e5f505f31e7d475102bb825063a", "score": "0.6740526", "text": "def before_init; end", "title": "" }, { "docid": "6550c1887fe3e084e2425fad3012b3b5", "score": "0.6739505", "text": "def pre_initialize ; end", "title": "" }, { "docid": "6550c1887fe3e084e2425fad3012b3b5", "score": "0.6739505", "text": "def pre_initialize ; end", "title": "" }, { "docid": "ffef078c1850ae588e1aef809f1c400c", "score": "0.67333853", "text": "def create_params_initializer\n\n\t\tend", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715805", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715805", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6715062", "text": "def params; end", "title": "" }, { "docid": "c9f1af465866d59613fd9e2e2442c2f0", "score": "0.67097944", "text": "def param; end", "title": "" }, { "docid": "c9f1af465866d59613fd9e2e2442c2f0", "score": "0.67097944", "text": "def param; end", "title": "" }, { "docid": "c9f1af465866d59613fd9e2e2442c2f0", "score": "0.67097944", "text": "def param; end", "title": "" }, { "docid": "c9f1af465866d59613fd9e2e2442c2f0", "score": "0.67097944", "text": "def param; end", "title": "" }, { "docid": "c9f1af465866d59613fd9e2e2442c2f0", "score": "0.67097944", "text": "def param; end", "title": "" }, { "docid": "85f5843e102838e41578f93db75096fe", "score": "0.6709597", "text": "def initialize(params = {})\n end", "title": "" }, { "docid": "3da54844f39325e5459ae6836ae36a98", "score": "0.66990715", "text": "def initialize\n @params = default_params()\n end", "title": "" }, { "docid": "262d1aa18bcb697211cd9aa6a117edec", "score": "0.6696727", "text": "def post_init\n end", "title": "" }, { "docid": "ec7f99bd984d5a58fa138af584dee885", "score": "0.6694356", "text": "def iniitialize\n \n end", "title": "" }, { "docid": "8b931bb20d38a644aae5f3b39938a1cb", "score": "0.66937137", "text": "def params=(_arg0); end", "title": "" }, { "docid": "8b931bb20d38a644aae5f3b39938a1cb", "score": "0.66937137", "text": "def params=(_arg0); end", "title": "" }, { "docid": "8b931bb20d38a644aae5f3b39938a1cb", "score": "0.66937137", "text": "def params=(_arg0); end", "title": "" }, { "docid": "8b931bb20d38a644aae5f3b39938a1cb", "score": "0.66937137", "text": "def params=(_arg0); end", "title": "" }, { "docid": "5edac9eb313dd2d82caf4151ca49e7b0", "score": "0.6685749", "text": "def post_init\n end", "title": "" }, { "docid": "4033393fcc1c6a99c9a5ae472ddec937", "score": "0.6681552", "text": "def init\n end", "title": "" }, { "docid": "4033393fcc1c6a99c9a5ae472ddec937", "score": "0.6681552", "text": "def init\n end", "title": "" }, { "docid": "4033393fcc1c6a99c9a5ae472ddec937", "score": "0.6681552", "text": "def init\n end", "title": "" }, { "docid": "4033393fcc1c6a99c9a5ae472ddec937", "score": "0.6681552", "text": "def init\n end", "title": "" }, { "docid": "4033393fcc1c6a99c9a5ae472ddec937", "score": "0.6681552", "text": "def init\n end", "title": "" }, { "docid": "73d8fd895a75b55a07597cbfe0ea1c7c", "score": "0.6677271", "text": "def init\n \n end", "title": "" }, { "docid": "73d8fd895a75b55a07597cbfe0ea1c7c", "score": "0.6677271", "text": "def init\n \n end", "title": "" }, { "docid": "e533d3f339dd4af414772f63b3225cc7", "score": "0.6667686", "text": "def params; {}; end", "title": "" }, { "docid": "e533d3f339dd4af414772f63b3225cc7", "score": "0.6667686", "text": "def params; {}; end", "title": "" }, { "docid": "70bf8cb295fdc2050998983b54d334dd", "score": "0.6666254", "text": "def init\n end", "title": "" }, { "docid": "18250542a2b1999be90588db1d071d92", "score": "0.66600883", "text": "def initialize\n\t\t\n\tend", "title": "" }, { "docid": "4dca9d0e8d2b7ae7871144ff5c8c469c", "score": "0.6659724", "text": "def params=(_); end", "title": "" } ]
cc2dccc8b6132b7df7901d5d005c9c0a
GET /shishas/new GET /shishas/new.xml
[ { "docid": "f78779b24ea3ddacc97d8a588bd48a08", "score": "0.72198296", "text": "def new\n @shisha = Shisha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shisha }\n end\n end", "title": "" } ]
[ { "docid": "be2e3c7fd59c56b7f9d57946e8de297e", "score": "0.6817813", "text": "def new\n @sushi = Sushi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sushi }\n end\n end", "title": "" }, { "docid": "5e0a535ef6a455fbcdf1626fcacef5d4", "score": "0.67870706", "text": "def new\n @title = t(:page_concept_create)\n @shit = Shit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shit }\n end\n end", "title": "" }, { "docid": "33182d04556b4986d3dc65d157641246", "score": "0.6705461", "text": "def new\n @shed = Shed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shed }\n end\n end", "title": "" }, { "docid": "0abcb28afb826270cc89cf51d2e3fc8d", "score": "0.66981125", "text": "def new\n @sifi = Sifi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sifi }\n end\n end", "title": "" }, { "docid": "6e0b5ab49673e9ad802afaff7aa972ad", "score": "0.6576404", "text": "def new\n @ssh = Ssh.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ssh }\n end\n end", "title": "" }, { "docid": "d3e8906a3447391b4d7361c07fab3506", "score": "0.6556748", "text": "def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitio }\n end\n end", "title": "" }, { "docid": "bc51791636b2c8878082256c7c588052", "score": "0.6555673", "text": "def new\n @sisben = Sisben.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sisben }\n end\n end", "title": "" }, { "docid": "8b3e0819d32195d413827ad547663eba", "score": "0.6554071", "text": "def new\n @spiga = Spiga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiga }\n end\n end", "title": "" }, { "docid": "be1aac48a0bc7445874fc9d2f80a10e9", "score": "0.65116864", "text": "def new\n @rse = Rsis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rse }\n end\n end", "title": "" }, { "docid": "8e1e7a9b011cae075fc29c59b03e9492", "score": "0.6504878", "text": "def new\n @sitio = Sitio.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitio }\n end\n end", "title": "" }, { "docid": "dea4f8d222fd2961854c72e0823849c1", "score": "0.6504196", "text": "def new\n @shops_request = ShopsRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shops_request }\n end\n end", "title": "" }, { "docid": "a0fdd7e2070e34e3465e6407512f168c", "score": "0.64839983", "text": "def new\n @thesis = Thesis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thesis }\n end\n end", "title": "" }, { "docid": "2220b5ad4ecc95e42a72b0e80a1fb5b4", "score": "0.64482117", "text": "def new\r\n find_s(params[:id], params[:s])\r\n @btg1har = Btg1har.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @btg1har }\r\n end\r\n end", "title": "" }, { "docid": "7fe95f78cf24f0665afbea6a12735747", "score": "0.64436615", "text": "def new\n @site_stat = SiteStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site_stat }\n end\n end", "title": "" }, { "docid": "65db78cc9bb570f0376ca76f8c2386b0", "score": "0.64325684", "text": "def new\n @shops_visit = ShopsVisit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shops_visit }\n end\n end", "title": "" }, { "docid": "39839b5e1f68190c907394a6f25282d2", "score": "0.6411563", "text": "def new\n @hap = Hap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hap }\n end\n end", "title": "" }, { "docid": "a1182ba7f6c919473938ea06ae847a62", "score": "0.64061093", "text": "def new\n @saison = Saison.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @saison }\n end\n end", "title": "" }, { "docid": "76fccba51954f3768961bfaa7315c3a4", "score": "0.6392064", "text": "def new\n @softdb = Softdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @softdb }\n end\n end", "title": "" }, { "docid": "7b689672fb051affca32a268fdcb4736", "score": "0.63706136", "text": "def new\n\tuuid = SecureRandom.uuid\n\t@new_url = searches_url + \"/\" + uuid # creates http://localhost/search/123-34552-adsfrjha-234\n\tresponse.set_header(\"Location\", @new_url)\n respond_to do |format|\n format.html { render :new, status: 201 }\n format.json { render :new, status: 201 }\n format.jsonld { render :new, formats: :json, status: 201 }\n end\n\t\n end", "title": "" }, { "docid": "18d20d37a72851dfc140ff2f165a42c0", "score": "0.6359757", "text": "def new\n @shelter = Shelter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shelter }\n end\n end", "title": "" }, { "docid": "94ceaaf9250cdc3d062aeb18bbab1a52", "score": "0.6346542", "text": "def new\n @newstuff = Newstuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newstuff }\n end\n end", "title": "" }, { "docid": "552933f91ff480059e0b8835fe4e554e", "score": "0.6346045", "text": "def new\n @satelite = Satelite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @satelite }\n end\n end", "title": "" }, { "docid": "41433d74e36719684775ad2d50c3eabe", "score": "0.63456255", "text": "def new\n @new = New.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new }\n end\n end", "title": "" }, { "docid": "0d744b215e6961b185babae54e4cd282", "score": "0.6343759", "text": "def new\n @ha = Ha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ha }\n end\n end", "title": "" }, { "docid": "e4fc628520c45875953757ec5be82cf2", "score": "0.6343145", "text": "def new\n @shien_keikaku = ShienKeikaku.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shien_keikaku }\n end\n end", "title": "" }, { "docid": "e645013604610a36a9dc4d8e45db0023", "score": "0.63413113", "text": "def new\n @snikk = Snikk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snikk }\n end\n end", "title": "" }, { "docid": "a63d27ca98208e938ac4d48e8db672ee", "score": "0.63338035", "text": "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "title": "" }, { "docid": "7f3824c26e7d307cb2812dbd8b431bcd", "score": "0.63268834", "text": "def new\n @hemo_semestrial = HemoSemestrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hemo_semestrial }\n end\n end", "title": "" }, { "docid": "2377d9e7a0534a5fc4a04100997b6e6c", "score": "0.6315432", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @site }\n end\n end", "title": "" }, { "docid": "127ed1d14e664214631f2b6caa7083eb", "score": "0.6301748", "text": "def new\n @sesion = Sesion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sesion }\n end\n end", "title": "" }, { "docid": "a5813dcaa71b0676cbb1fd98a440d90c", "score": "0.62904036", "text": "def new\n @subrack = Subrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subrack }\n end\n end", "title": "" }, { "docid": "f113f7d955143e85b2c79ad6e9e8335a", "score": "0.6285814", "text": "def new\n @whishlist = Whishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @whishlist }\n end\n end", "title": "" }, { "docid": "4273130498cfdc1fb4be661e81c2ff0c", "score": "0.62838566", "text": "def new\n @scrap_xml = ScrapXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrap_xml }\n end\n end", "title": "" }, { "docid": "45ebec61a2705d99fe67a7c30e2376a1", "score": "0.6282853", "text": "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => sites_path }\n end\n end", "title": "" }, { "docid": "07b271b352e1a27a60cc0cea24781825", "score": "0.6271716", "text": "def new\n @sinapost = Sinapost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sinapost }\n end\n end", "title": "" }, { "docid": "9dfc2a56831966b28176f565347f318b", "score": "0.6267716", "text": "def new\n @selo = Selo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @selo }\n end\n end", "title": "" }, { "docid": "8bccb80476c13b672f165ff0f91c5753", "score": "0.62675637", "text": "def new\n @stein = Stein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stein }\n end\n end", "title": "" }, { "docid": "3cbf411ef7807b9e1c52e23c12bfd02d", "score": "0.62662846", "text": "def create\n @shisha = Shisha.new(params[:shisha])\n\n respond_to do |format|\n if @shisha.save\n format.html { redirect_to(@shisha, :notice => 'Shisha was successfully created.') }\n format.xml { render :xml => @shisha, :status => :created, :location => @shisha }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shisha.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0dcf3da24d721c399f3fffb71f54c60b", "score": "0.6245626", "text": "def new\n @siswa = Siswa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @siswa }\n end\n end", "title": "" }, { "docid": "295cf14d78cbbff88005b0e888a821c5", "score": "0.6245531", "text": "def new\n @sampling_site = SamplingSite.new\n @title = \"Sampling site\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sampling_site }\n end\n end", "title": "" }, { "docid": "295cf14d78cbbff88005b0e888a821c5", "score": "0.6245531", "text": "def new\n @sampling_site = SamplingSite.new\n @title = \"Sampling site\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sampling_site }\n end\n end", "title": "" }, { "docid": "cc1e09d032703a071d52cd987b027a73", "score": "0.6245458", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "title": "" }, { "docid": "32f7c6752475d38fc300baeefb87f9c3", "score": "0.62452227", "text": "def new\n @sma = Sma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sma }\n end\n end", "title": "" }, { "docid": "283e118c4de3a186042fa996ad3f3850", "score": "0.62425184", "text": "def new\n @nsar = Nsar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nsar }\n end\n end", "title": "" }, { "docid": "ca5b6939e21d78a85c39bdda8af90b50", "score": "0.62403107", "text": "def new\n @usesupply = Usesupply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usesupply }\n end\n end", "title": "" }, { "docid": "16b9569dda70acebb63f5bd8a1a2b09a", "score": "0.62338394", "text": "def new_rest\n @page_usage = PageUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage }\n end\n end", "title": "" }, { "docid": "38a6df077c7bbf4443a15e5b3bc61f61", "score": "0.6230217", "text": "def new\n @xpath = Xpath.new\n @xpath.site_id = params[:site_id]\n set_site\n @xpath.pos = @site.xpaths.length + 1\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @xpath }\n end\n end", "title": "" }, { "docid": "9e76a2d9ad2d687cfd8bc458de83ed02", "score": "0.622787", "text": "def new\n @sysadmin = Sysadmin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sysadmin }\n end\n end", "title": "" }, { "docid": "bae65455ee945f91ae3bbbd4f56f761c", "score": "0.622682", "text": "def new\n @sugestion = Sugestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sugestion }\n end\n end", "title": "" }, { "docid": "321a642116c68fd34eb32046004a9590", "score": "0.62260944", "text": "def new\n @site = Site.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "title": "" }, { "docid": "b4a9b514930420335c4520084ae1a554", "score": "0.6222414", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "title": "" }, { "docid": "b4a9b514930420335c4520084ae1a554", "score": "0.6222414", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "title": "" }, { "docid": "b4a9b514930420335c4520084ae1a554", "score": "0.6222414", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "title": "" }, { "docid": "849777449cced5669430788c0cf8becf", "score": "0.6219246", "text": "def new\n @spl = Spl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @spl }\n end\n end", "title": "" }, { "docid": "6290211819de3f0f66090bc7b0faa32f", "score": "0.62191355", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asesoria }\n end\n end", "title": "" }, { "docid": "4dfcb609d813a2e982dabac46fdbb3b9", "score": "0.62084496", "text": "def new\n @stat = Stat.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "title": "" }, { "docid": "c4c40989cbd0bfad6451b2d6b91fd80a", "score": "0.6207764", "text": "def new\n @solexame = Solexame.new\n 2.times { @solexame.solexameis.build }\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solexame }\n end\n end", "title": "" }, { "docid": "61e8a9d7e9b4dc5ef2c68eb2ca47a04c", "score": "0.6206404", "text": "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "title": "" }, { "docid": "b6843e2c9fcf6dd474534635958b8913", "score": "0.6198095", "text": "def new\n @i_sm = ISm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @i_sm }\n end\n end", "title": "" }, { "docid": "0d14ce7c7de221e3e5213bb6054b22cb", "score": "0.6182986", "text": "def new\n @sperren = Sperren.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sperren }\n end\n end", "title": "" }, { "docid": "757704e5f4e463be84e10bea4714a224", "score": "0.61805177", "text": "def new\n @smi = Smi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @smi }\n end\n end", "title": "" }, { "docid": "35013f1f03cf3182e80c70ac7ae04fde", "score": "0.61788493", "text": "def new\n @sitedatum = Sitedatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitedatum }\n end\n end", "title": "" }, { "docid": "b7babb02e44df2563f8f12224bbeb054", "score": "0.61788255", "text": "def new\n @sujit = Sujit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sujit }\n end\n end", "title": "" }, { "docid": "580ac9b93c2d04c6c5e083a4b89ea00e", "score": "0.6177768", "text": "def new\n @hasini = Hasini.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hasini }\n end\n end", "title": "" }, { "docid": "a9a3737fd9727c4618c82ce663c5cbf7", "score": "0.61656404", "text": "def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hack }\n end\n end", "title": "" }, { "docid": "382ddbb00f7cc9ca582801fbe01b1bca", "score": "0.6162167", "text": "def new\n @spieltag = Spieltag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spieltag }\n end\n end", "title": "" }, { "docid": "1e23e4b6c43954b349e045087570391a", "score": "0.616186", "text": "def new_fn\n \t@diksha= Diksha.new(params[:diksha])\n \trespond_to do |format|\n format.html { redirect_to(dikshas_url) }\n format.xml { head :ok }\n end\t\n end", "title": "" }, { "docid": "a6bae8ce87f90ffd16fd18a29c2ef604", "score": "0.61585116", "text": "def new\n @shiftmaster = Shiftmaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shiftmaster }\n end\n end", "title": "" }, { "docid": "46ce7d699061105553f7c23b37884374", "score": "0.6146656", "text": "def new\n @simplace = Simplace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simplace }\n end\n end", "title": "" }, { "docid": "8682bcb341a756334385aa9543c01dfa", "score": "0.6146016", "text": "def new\n @path = Path.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end", "title": "" }, { "docid": "a9d86662b0ce9b70e9727531637e7855", "score": "0.614598", "text": "def new\r\n @st_use = StUse.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @st_use }\r\n end\r\n end", "title": "" }, { "docid": "93d5d7f19a86df346eed35995b2b4202", "score": "0.61426973", "text": "def new\n @stb = Stb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stb }\n end\n end", "title": "" }, { "docid": "9723fda62b32edfe42095eaf074ed6fa", "score": "0.61424565", "text": "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @system }\n end\n end", "title": "" }, { "docid": "9723fda62b32edfe42095eaf074ed6fa", "score": "0.61424565", "text": "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @system }\n end\n end", "title": "" }, { "docid": "9723fda62b32edfe42095eaf074ed6fa", "score": "0.61424565", "text": "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @system }\n end\n end", "title": "" }, { "docid": "3efecbe4a6a69f7ed59cb07c57df6ede", "score": "0.61403716", "text": "def new\n @wpis = Wpis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wpis }\n end\n end", "title": "" }, { "docid": "4150a022e539c442af283c009945dfa2", "score": "0.614029", "text": "def new\n @sites_service = SitesService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sites_service }\n end\n end", "title": "" }, { "docid": "a93193f2dadb2bfe84da0ac725631718", "score": "0.6139613", "text": "def new\n @simeast = Simeast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simeast }\n end\n end", "title": "" }, { "docid": "1cefa35920cd85e09aac31f607f82fde", "score": "0.6135434", "text": "def new\n @stes_e = StesE.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stes_e }\n end\n end", "title": "" }, { "docid": "a9d273b88c4327d0bd19720cf79a8d47", "score": "0.6135086", "text": "def new\n @site = Site.new(:url => \"http://\")\n dictionary\n submenu_item 'sites-new'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "title": "" }, { "docid": "e84fdc2bea1482604100328d6e346333", "score": "0.6134416", "text": "def new\n @sucursal = Sucursal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sucursal }\n end\n end", "title": "" }, { "docid": "e84fdc2bea1482604100328d6e346333", "score": "0.6134416", "text": "def new\n @sucursal = Sucursal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sucursal }\n end\n end", "title": "" }, { "docid": "e84fdc2bea1482604100328d6e346333", "score": "0.6134416", "text": "def new\n @sucursal = Sucursal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sucursal }\n end\n end", "title": "" }, { "docid": "b4650da5d04b53da459540345b8849ec", "score": "0.61335826", "text": "def new\n @shiftinfo = Shiftinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @shiftinfo }\n end\n end", "title": "" }, { "docid": "da1fe7e5eddf7739260f32092ca241dc", "score": "0.6132827", "text": "def new\n @hops_type = HopsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hops_type }\n end\n end", "title": "" }, { "docid": "a0381c42e91e2a7b329e5aa6d5fb73e2", "score": "0.6132611", "text": "def new\n @what_new = WhatNew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @what_new }\n end\n end", "title": "" }, { "docid": "c17297b084fe0c57c647f94b3e0b96bd", "score": "0.6132509", "text": "def new\n @simwest = Simwest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simwest }\n end\n end", "title": "" }, { "docid": "ffb82714f8581cbd257e82b50ce21817", "score": "0.6132147", "text": "def new\n @sdata = Sdata.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sdata }\n end\n end", "title": "" }, { "docid": "5403f01b8b14ce1f8d31efe55363b1d8", "score": "0.6129292", "text": "def create\n @sushi = Sushi.new(params[:sushi])\n\n respond_to do |format|\n if @sushi.save\n flash[:notice] = 'Sushi was successfully created.'\n format.html { redirect_to(@sushi) }\n format.xml { render :xml => @sushi, :status => :created, :location => @sushi }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sushi.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4022560cb858019a8545a6dd135ea47c", "score": "0.6124939", "text": "def new\n @soaplab_server = SoaplabServer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @soaplab_server }\n end\n end", "title": "" }, { "docid": "a3147e096b98c39298ffa78eaf7cc46f", "score": "0.6122994", "text": "def new\n @tah = Tah.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tah }\n end\n end", "title": "" }, { "docid": "2d343810bd7dec23c40b7f08dd575fdc", "score": "0.6118402", "text": "def new\n @sexo = Sexo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sexo }\n end\n end", "title": "" }, { "docid": "9e3fadf1fc941e200f58d40d8c699f77", "score": "0.61108667", "text": "def new\n @creation = Creation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creation }\n end\n end", "title": "" }, { "docid": "611927c565a7feb12e7f45820cfc4b0a", "score": "0.6110271", "text": "def new\n @solicitation = Solicitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation }\n end\n end", "title": "" }, { "docid": "d3536ed4e0dbbf3e71d0f4b7cd0f5814", "score": "0.6109617", "text": "def new\n @saidas = Saida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @saidas }\n end\n end", "title": "" }, { "docid": "4358f8420cf7da6dcb3af1828cc77489", "score": "0.61074966", "text": "def new\n @seenlist = Seenlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seenlist }\n end\n end", "title": "" }, { "docid": "fbb221e0dac1e7043946860433ac438e", "score": "0.61014336", "text": "def new\n @exist = Exist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exist }\n end\n end", "title": "" }, { "docid": "c4383c6a3623a83199c7b4afa780e847", "score": "0.6100334", "text": "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @historial }\n end\n end", "title": "" }, { "docid": "acc2df09930761bbc93d50667640ef89", "score": "0.60967135", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end", "title": "" }, { "docid": "26aec86ac593cef90d2b190cb1d86beb", "score": "0.6093454", "text": "def new\n @soap = Soap.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @soap }\n end\n end", "title": "" } ]
cc797780247e40c2f7428a14687d1b77
POST /fixed_rates POST /fixed_rates.json
[ { "docid": "7fbd3937c0624fa541409b2d3e85d504", "score": "0.72368157", "text": "def create\r\n @fixed_rate = FixedRate.new(fixed_rate_params)\r\n\r\n respond_to do |format|\r\n if @fixed_rate.save\r\n format.html { redirect_to @fixed_rate, notice: 'Fixed rate was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @fixed_rate }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @fixed_rate.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" } ]
[ { "docid": "b5051a64961dae6e80a040f8cb20ed78", "score": "0.6744194", "text": "def fixed_rate_params\r\n params.require(:fixed_rate).permit(:ori_tar, :dest_tar, :costo_tar)\r\n end", "title": "" }, { "docid": "d0932a6e87d91f14f46050b326ab14c6", "score": "0.65485746", "text": "def create\n @rate = Rate.new(rate_params)\n\n if @rate.save\n render json: @rate, status: :created, location: @rate\n else\n render json: @rate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5ccaebf6a03187aef8924c1bc2be5946", "score": "0.6545396", "text": "def rates_create options\n post_request rates_path, options\n end", "title": "" }, { "docid": "ef669bd25d8d871a7159d10a60f1fb13", "score": "0.6522438", "text": "def set_fixed_rate\r\n @fixed_rate = FixedRate.find(params[:id])\r\n end", "title": "" }, { "docid": "2788cce6316df5697d27c2d22c184def", "score": "0.6480285", "text": "def create\n @int_rate = IntRate.new(int_rate_params)\n @int_rate.pull_rates\n\n respond_to do |format|\n if @int_rate.save\n format.html { redirect_to @int_rate, notice: 'Int rate was successfully created.' }\n format.json { render :show, status: :created, location: @int_rate }\n else\n format.html { render :new }\n format.json { render json: @int_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8199129db59627ff95a50eb076f82976", "score": "0.6373698", "text": "def create\n @rate = Rate.new(rate_params)\n if @rate.save \n render json: { status: :created }\n else\n render json: @rate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "acbd36be8a4c950ee391e04a680f20c9", "score": "0.6310196", "text": "def create\n @rate = Rate.new(params[:rate])\n\n respond_to do |format|\n if @rate.save\n format.html { redirect_to @rate, notice: 'Rate was successfully created.' }\n format.json { render json: @rate, status: :created, location: @rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26babbb54a84394cc36d74d40ccf8c76", "score": "0.6292507", "text": "def index\r\n @fixed_rates = FixedRate.all\r\n end", "title": "" }, { "docid": "5f2b7c624638ebeedd8ff871ed4dbf8d", "score": "0.6211396", "text": "def create\n @rate = Rate.new(rate_params)\n\n if @rate.save\n render :show, status: :created, location: @rate\n else\n render json: @rate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c30cf249e840fe876789d1a60c3c8611", "score": "0.6198046", "text": "def create\n @rate = Rate.new(rate_params)\n \n respond_to do |format|\n if @rate.save\n format.html { redirect_to rates_path, notice: 'Registro de tasas creado con exito.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "69d92cf81fdb13f75ca447e3480ace31", "score": "0.6172531", "text": "def create\n\n if Rate.valid_params?(api_params)\n\n ratable = api_params[:ratable_type] == 'Chain' ? Chain.find_by(id: api_params[:ratable_id]) : Exchange.find_by(id: api_params[:ratable_id])\n\n if ratable\n\n ratable.update(rates_source: api_params[:source])\n\n api_params[:currencies].each do |currency|\n\n rate = Rate.find_or_create_by(ratable_type: api_params[:ratable_type], ratable_id: api_params[:ratable_id], currency: currency[:currency])\n\n unless rate.update_by_api(api_params[:source], api_params[:quote], currency)\n render json: {status: 'wrong data for currency ' + currency[:currency]}\n return\n end\n\n end\n\n render json: {status: 'ok'}\n\n else\n render json: {errors: 'ratable not found'}\n end\n\n else\n render json: {errors: 'invalid params'}\n end\n\n end", "title": "" }, { "docid": "51fc74a5898e5d279616c1106ecc1a35", "score": "0.61029124", "text": "def create_rates_table(options = {})\n post(:rates_tables, rates_tables: [options]).pop\n end", "title": "" }, { "docid": "8d346151ab3e62b44398f70b3d12326a", "score": "0.6096016", "text": "def create\n RatesForm.new(rate_params).save\n\n respond_to do |format|\n format.html { redirect_to project_action_state_rates_path(project, action_state) }\n format.json { render :show, status: :created, location: @rate }\n end\n end", "title": "" }, { "docid": "f893d5e18fbd6f2fa3e40b513a35ffd3", "score": "0.6095827", "text": "def create\n @rate = Rate.new(rate_params)\n\n respond_to do |format|\n if @rate.save\n format.html { redirect_to @rate, notice: 'La tasa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a8a92769368bf02fec59a5fa562d91b8", "score": "0.6071678", "text": "def update_rates\n \n Updaterete.update_single_rate(params)\n @get_rates = Updaterete.get_rates(params)\n render :layout=>\"gds\"\n end", "title": "" }, { "docid": "3258188bfdedb3689af1f2fb9f8136fe", "score": "0.60579675", "text": "def create\n @shipping_rate = ShippingRate.new(params[:shipping_rate])\n\n respond_to do |format|\n if @shipping_rate.save\n format.html { redirect_to @shipping_rate, notice: 'Shipping rate was successfully created.' }\n format.json { render json: @shipping_rate, status: :created, location: @shipping_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1083805c49491ab6b320152a51bdb30", "score": "0.60501635", "text": "def create\n @reference_rate = ReferenceRate.new(reference_rate_params)\n\n respond_to do |format|\n if @reference_rate.save\n format.html { redirect_to @reference_rate, notice: 'Reference rate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reference_rate }\n else\n format.html { render action: 'new' }\n format.json { render json: @reference_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b9477dc8a279dcf3b498e9534593ad2", "score": "0.60433483", "text": "def rate_params\n params.require(:rates).permit(:rate, :rateable_type, :rateable_id, :created_by)\n end", "title": "" }, { "docid": "ec8dd66993a4c0ee0db9c37c0eefaac1", "score": "0.6011434", "text": "def create\n @rate = Rate.new(rate_params)\n set_rate_company\n\n respond_to do |format|\n if @rate.save\n format.html {\n html_success_response(@rate, 'Rate was successfully created.')\n }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html {\n html_error_response(@rate, 'new')\n }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4dd3578c9df0871114e1dd856c0d0437", "score": "0.59773916", "text": "def create\n \n @pay_rate = PayRate.new(params[:pay_rate])\n @pay_rate.status = 'proposed'\n\n respond_to do |format|\n if @pay_rate.save\n format.html { redirect_to session[:original_uri], notice: 'Pay rate was successfully created.' }\n format.json { render json: @pay_rate, status: :created, location: @pay_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pay_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "220fc245cbefc43b381ed5cd7ef9b6ff", "score": "0.59710675", "text": "def rate_params\n params.require(:rate).permit(:zone_id, :concept_id, :plan_id, :valor, :estado, :usuario)\n end", "title": "" }, { "docid": "e6edd29571ae0cd11abf9c787a0142e5", "score": "0.5968908", "text": "def update\r\n respond_to do |format|\r\n if @fixed_rate.update(fixed_rate_params)\r\n format.html { redirect_to @fixed_rate, notice: 'Fixed rate was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @fixed_rate.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "b2e7a055d319a23a2f257b79c2445bf6", "score": "0.59514207", "text": "def rate_params\n params.require(:rate).permit(:country, :moneda, :monto_oferta, :rate_argentina, :rate_argentina_min, :rate_brasil, :rate_brasil_min, :rate_chile, :rate_chile_min, :rate_colombia, :rate_colombia_min, :rate_ecuador, :rate_ecuador_min, :rate_españa, :rate_españa_min, :rate_panama, :rate_panama_min, :rate_peru, :rate_peru_min, :rate_portugal, :rate_portugal_min, :rate_usa, :rate_usa_min, :rate_venezuela, :rate_venezuela_min, :monto_min_argentina, :monto_min_brasil, :monto_min_chile, :monto_min_colombia, :monto_min_ecuador, :monto_min_españa, :monto_min_peru, :monto_min_portugal, :monto_min_usa, :monto_min_venezuela, :monto_min_panama , :status_envio) \n end", "title": "" }, { "docid": "2411f2f976e3c2dee5de155a0b501da4", "score": "0.5948338", "text": "def create\n @rate = Rate.new( recipe: Recipe.find( params[:recipe_id] ), value: params[:value], user_id: current_user.id )\n respond_to do |format|\n if @rate.save\n format.json { render :show, status: :created, location: @rate }\n else\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53c7820b8b3c0ed7b5aedf35a470ee46", "score": "0.5942179", "text": "def get_rates\n @response = @client.call(:get_rate_estimate, message: { originPostalCode: @originPostalCode,\n originCountry: @originCountry,\n destinationPostalCode: @destinationPostalCode,\n destinationCountry: @destinationCountry,\n odfl4MeUser: self.odfl4MeUser,\n odfl4MePassword: self.odfl4MePassword,\n odflCustomerAccount: self.odflCustomerAccount,\n tariff: self.tariff,\n movement: self.movement,\n mexicoServiceCenter: self.mexicoServiceCenter,\n currencyFormat: self.currencyFormat,\n requestReferenceNumber: self.requestReferenceNumber,\n freightItems: {\n \"Freight\" => self.freight\n },\n weightUnits: self.weightUnits,\n numberPallets: self.freight.count,\n linearFeet: self.linearFeet,\n accessorials: {\n string: self.accessorials\n },\n totalCubicVolume: @totalCubicVolume,\n cubicUnits: @cubicUnits,\n numberStackablePallets: self.numberStackablePallets,\n pickupDateTime: @pickupDateTime,\n deliveryDateTime: @deliveryDateTime,\n shipType: self.shipType,\n codAmount: @codAmount,\n insuranceAmount: self.insuranceAmount,\n loosePieces: self.loosePieces,\n email: self.email,\n sendEmailOffers: self.sendEmailOffers,\n firstName: self.firstName,\n lastName: self.lastName\n })\n processResult(@response)\n\n if @resultHash[:success]\n true\n else\n false\n end\n end", "title": "" }, { "docid": "ce0c9ddaf377e894bcc32be626a51f77", "score": "0.593856", "text": "def shipping_rate_params\n params.require(:shipping_rate).permit(:rate_cents, :origin, :destination, :currency)\n end", "title": "" }, { "docid": "d7ac0b84e1af565ccef891cf29a6c1c4", "score": "0.59332573", "text": "def create\n @admin_reclaim_rate = Admin::ReclaimRate.new(params[:admin_reclaim_rate])\n\n respond_to do |format|\n if @admin_reclaim_rate.save\n format.html { redirect_to admin_reclaim_rates_url }\n format.json { render json: @admin_reclaim_rate, status: :created, location: @admin_reclaim_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_reclaim_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25681ac775f6b645295a6ef863c3eb7b", "score": "0.5931775", "text": "def rate_new_quick\n @page = params[:page].to_i > 0 ? params[:page].to_i : 1\n params[:price] = -1 if params[:price].to_s.downcase == 'blocked'\n @prefix, @price, destination_id = params[:prefix], params[:price], params[:destination]\n params_effective_date = params[:effective_date]\n @effective_from = params_effective_date.present? ? current_user.system_time(params_effective_date[:year] + '-' + params_effective_date[:month] + '-' +\n params_effective_date[:day] + ' ' + params_effective_date[:hour] +\n ':' + params_effective_date[:minute]) : DateTime.now\n\n unless Destination.where(prefix: @prefix).first\n flash[:notice] = _('Destination_not_found')\n redirect_to(action: :rates_list, id: @tariff.id, st: params[:st], page: @page)\n return false\n end\n if Rate.where('rates.tariff_id = ? AND rates.prefix = ? AND rates.effective_from = ?', @tariff.id, @prefix, @effective_from).first\n flash[:notice] = _('Rate_already_set')\n redirect_to(action: :rates_list, id: @tariff.id, st: params[:st], page: @page)\n return false\n end\n @destination = Destination.find_with_direction(Application.shorter_longest_prefix_string(@prefix)).\n try(:where, \"destinations.id = ?\", destination_id.to_i).try(:first)\n if @destination\n if @tariff.add_new_rate(@destination, @price, params[:increment_s], params[:min_time], params[:connection_fee], params[:ghost_percent], @prefix, @effective_from)\n flash[:status] = _('Rate_was_added')\n else\n flash[:notice] = _('Rate_was_not_added')\n end\n else\n flash[:notice] = _('Prefix_was_not_found')\n end\n redirect_to(action: :rates_list, id: @tariff.id, st: params[:st], page: @page)\n return false\n end", "title": "" }, { "docid": "251cb09465f07b21b13ed57d18d76970", "score": "0.5892278", "text": "def estimate_rates_with_http_info(estimate_rates_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RatesApi.estimate_rates ...'\n end\n # verify the required parameter 'estimate_rates_request_body' is set\n if @api_client.config.client_side_validation && estimate_rates_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'estimate_rates_request_body' when calling RatesApi.estimate_rates\"\n end\n # resource path\n local_var_path = '/v1/rates/estimate'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(estimate_rates_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'Array<Rate>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RatesApi#estimate_rates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "b520405e8d033b2061be980d8740177a", "score": "0.58905053", "text": "def create\n @rate = @shop.rates.new(params[:rate])\n @rate.user = current_user\n\n respond_to do |format|\n if @rate.save\n format.html { redirect_to shop_path(@shop), notice: 'Rate was successfully created.' }\n format.json { render json: @rate, status: :created, location: @rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "27cd754d321373cf3219d95b96576d0e", "score": "0.5838346", "text": "def create\n @payout_rate = PayoutRate.new(payout_rate_params)\n\n respond_to do |format|\n if @payout_rate.save\n format.html { redirect_to @payout_rate, notice: 'Payout rate was successfully created.' }\n format.json { render :show, status: :created, location: @payout_rate }\n else\n format.html { render :new }\n format.json { render json: @payout_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bfe0df295fd1ecc9459bec65ea8a5181", "score": "0.58296406", "text": "def create_fx_rate_bulk_using_post_with_http_info(fx_rate_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.create_fx_rate_bulk_using_post ...'\n end\n # verify the required parameter 'fx_rate_list' is set\n if @api_client.config.client_side_validation && fx_rate_list.nil?\n fail ArgumentError, \"Missing the required parameter 'fx_rate_list' when calling ResourceApi.create_fx_rate_bulk_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/resource/fx_rate'\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(fx_rate_list)\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 => 'Array<FxRate>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#create_fx_rate_bulk_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7b2ca38ca4dd4edc35136634be39b15f", "score": "0.58240616", "text": "def api_rate_rule\n\t\t\tbinance_symbol_info() if @binance_symbol_info.nil?\n\t\t\t# Init from /api/v3/exchangeInfo binance_symbol_info()\n\t\t\tdata = {\n\t\t\t\t'rule' => {\n\t\t\t\t\t'weight' => [@binance_weight_limits['limit'], @binance_weight_limits['second']],\n\t\t\t\t\t'order' => [@binance_order_limits['limit'], @binance_order_limits['second']]\n\t\t\t\t},\n\t\t\t\t'score' => {\n\t\t\t\t\t'weight' => @binance_weight_limits['limit'],\n\t\t\t\t\t'order' => @binance_order_limits['limit'],\n\t\t\t\t},\n\t\t\t\t'his' => [],\n\t\t\t\t'extra' => []\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "48144cb08273bf6eb2728dcd91d01b04", "score": "0.58180916", "text": "def reference_rate_params\n params.require(:reference_rate).permit(:name, :rate)\n end", "title": "" }, { "docid": "b4a8ad61bba16e47a430490e615fe23e", "score": "0.5817395", "text": "def rate_params\n params.require(:rate).permit(:table, :value_currency, :value_pln, :currency, :date, :table_date, :converter, :car_id, :payment, :printed, :description)\n end", "title": "" }, { "docid": "8fc9fcffbccab51b09a7cf221cc8f64b", "score": "0.58009946", "text": "def rate_params\n params.require(:rate).permit(:origin, :destination, :basic, :advance, :premium, :insurance, :vendor_id)\n end", "title": "" }, { "docid": "2160b93a86ed60c8c4582558bf35434d", "score": "0.5793135", "text": "def rate_params\n params.require(:rate).permit(\n :airport_id, :company_id, :vehicle_type_passenger, :service_type, :base_rate, :additional_passenger,\n :zipcode, :hotel_landmark_name, :hotel_landmark_street, :hotel_landmark_city,\n :hotel_landmark_state, :trip_duration, :to_airport_pickup_time_list,\n :from_airport_pickup_time_list, :lat_lng, :hotel_by_zipcode,\n :vehicle_capacity_type_id,\n )\n end", "title": "" }, { "docid": "dcf21360cdae45810fb274e21e2dad78", "score": "0.57914495", "text": "def create\n @rate = Rate.new(params[:rate])\n\n respond_to do |format|\n if @rate.save\n flash[:notice] = 'Rate was successfully created.'\n format.html { redirect_to rates_url }\n format.xml { render :xml => @rate, :status => :created, :location => @rate }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rate.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bdb17c580b023fbfad6895682ad53f63", "score": "0.5790505", "text": "def create\n @rate_service = RateService.new(rate_service_params)\n if @rate_service.save\n render json: @rate_service, status: :created, location: @rate_service\n else \n render json: @rate_service.errors, status: :unprocessable_entity\n end \n end", "title": "" }, { "docid": "6ee1a1f33d35c93d137ae077b1366fb3", "score": "0.57893765", "text": "def extract_rates(data)\n rates = JSON.parse(data)['rates']\n rates.each do |currency, rate|\n store.add_rate(currency, :EUR, 1 / BigDecimal(rate.to_s))\n end\n rescue\n raise FixerCurrencyFetchError\n end", "title": "" }, { "docid": "ab1d156920ac62b880b1b08be75c97e5", "score": "0.57814044", "text": "def shipping_rate_params\n params.require(:shipping_rate).permit(:rate_cents, :currency, :common_rate_cents, :origin, :destination, :belongs_to)\n end", "title": "" }, { "docid": "f17c6db30ada4b9705fcb1dafae66ec1", "score": "0.5773381", "text": "def rate_params\n params.require(:rate).permit(:rate, :overwrite)\n end", "title": "" }, { "docid": "9bc4486239329f8eb577467c777aa4d5", "score": "0.57706904", "text": "def nbg_rates\n data = { valid: true } # assume that at start it is failing\n # http://localhost:3000/en/api/v1/nbg_rates?currency=EUR&start_date=1461758741831&end_date=1457870734966\n params[:currency] ||= 'USD'\n flag = true\n @errors = []\n start_date = to_date('start_date', true)\n end_date = to_date('end_date', true)\n validate_dates(start_date, end_date)\n\n if !@errors.any?\n result = []\n @currencies = Currency.data\n flag = false\n\n params[:currency].split(',').each{|cur_item|\n if @currency_codes.has_key?(cur_item)\n cur = @currencies.select{|c| c[0] == cur_item }.first\n x = Rate.nbg_rates(cur_item,{from: start_date,to: end_date})\n if x.present?\n result << {code: cur[0], name: cur[1], ratio: cur[2], rates: x}\n flag = true\n end\n else\n error(\"currency_does_not_exist\", { pars: [cur_item]})\n end\n }\n end\n\n if !flag\n error(\"missing_data_currency\")\n end\n\n\n if @errors.any?\n data['errors'] = @errors\n data['valid'] = false\n else\n data['result'] = result\n end\n\n respond_to do |format|\n format.json { render json: data, :callback => params[:callback] }\n end\n end", "title": "" }, { "docid": "d89479f58e9f7ed1e5b8aba043daffd7", "score": "0.5766917", "text": "def create\n @rateable = Rateable.new(rateable_params)\n\n respond_to do |format|\n if @rateable.save\n format.html { redirect_to @rateable, notice: 'Rateable was successfully created.' }\n format.json { render :show, status: :created, location: @rateable }\n else\n format.html { render :new }\n format.json { render json: @rateable.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c2449818a6e413aac350ea1f51b5c3f", "score": "0.57648766", "text": "def update\n t = Time.now\n @rate.fechacam = t.strftime(\"%d/%m/%Y %H:%M:%S\")\n if @rate.update(rate_params)\n render json: { :message => \"Success!\" }\n else\n render json: @rate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5ed92c84ba02515fb6c2bdae4bbb367f", "score": "0.57579273", "text": "def create_rates_rule(rates_table, options = {})\n post(\"rates_tables/#{rates_table}/rates_rules\", rates_rules: [options]).pop\n end", "title": "" }, { "docid": "af42a71f6cfd7b9fb0bc59868e684bcf", "score": "0.5755512", "text": "def new\n\n # get the client & contract\n @client, @contract = get_client_and_contract(params[:client_id],params[:contract_id])\n\n # create the new rate\n @rate = Rate.new\n\n # set the default ni_rate and hol_accrual_rate\n @ni_rate = Settings.get_setting('ni_rate', Date.today).value\n @hol_accrual_rate = Settings.get_setting('hol_accrual_rate', Date.today).value\n\n # define a list of rates for the drop down\n @rates_list = {'Overtime' => 'Overtime', 'Bank Holiday' => 'Bank Holiday', 'Sickness' => 'Sickness', 'Other' => 'Other'}\n\n end", "title": "" }, { "docid": "4cfae2c105b1541bb84afe637727957a", "score": "0.5741712", "text": "def destroy\r\n @fixed_rate.destroy\r\n respond_to do |format|\r\n format.html { redirect_to fixed_rates_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "3dc67cde659a984b0e7ffcba43f726f5", "score": "0.57407385", "text": "def rate_estimate(params)\n if @international\n shipment = Element.new 'IntlShipment'\n shipment.attributes['action'] = 'RateEstimate'\n shipment.attributes['version'] = '1.0'\n \n credentials = Element.new 'ShippingCredentials'\n key = Element.new 'ShippingKey'\n key.text = params[:international_shipping_key]\n account = Element.new 'AccountNbr'\n account.text = params[:account_num]\n\n credentials << key\n credentials << account\n shipment << credentials\n\n shipment_details = Element.new 'ShipmentDetail'\n ship_date = Element.new 'ShipDate'\n ship_date.text = date(params[:date])\n shipment_details << ship_date\n\n service = Element.new 'Service'\n service_code = Element.new 'Code'\n service_code.text = service_code(params[:service_code])\n service << service_code\n shipment_details << service\n\n shipment_type = Element.new 'ShipmentType'\n type_code = Element.new 'Code'\n type_code.text = shipment_code(params[:shipment_code])\n shipment_type << type_code\n shipment_details << shipment_type\n\n weight = Element.new 'Weight'\n weight.text = weight(params[:weight], 'P')\n shipment_details << weight\n\n content_description = Element.new 'ContentDesc'\n content_description.text = 'Computer Parts'\n shipment_details << content_description\n\n shipment << shipment_details\n\n dutiable = Element.new 'Dutiable'\n dutiable_flag = Element.new 'DutiableFlag'\n dutiable_flag.text = 'Y'\n dutiable << dutiable_flag\n\n customs_value = Element.new 'CustomsValue'\n customs_value.text = '100'\n dutiable << customs_value\n shipment << dutiable\n\n billing = Element.new 'Billing'\n party = Element.new 'Party'\n party_code = Element.new 'Code'\n party_code.text = 'S'\n party << party_code\n billing << party\n duty_payment_type = Element.new 'DutyPaymentType'\n duty_payment_type.text = 'S'\n billing << duty_payment_type\n shipment << billing\n\n receiver = Element.new 'Receiver'\n address = Element.new 'Address'\n street = Element.new 'Street'\n street.text = params[:to_street]\n address << street\n city = Element.new 'City'\n city.text = params[:to_city]\n address << city\n state = Element.new 'State'\n state.text = params[:to_state]\n address << state\n country = Element.new 'Country'\n country.text = params[:to_country]\n address << country\n postal_code = Element.new 'PostalCode'\n postal_code.text = params[:to_zip]\n address << postal_code\n receiver << address\n\n shipment << receiver\n else\n # <Shipment action=\"RateEstimate\" version=\"1.0\">\n shipment = Element.new \"Shipment\"\n shipment.attributes[\"action\"] = \"RateEstimate\"\n shipment.attributes[\"version\"] = \"1.0\"\n\n # <ShippingCredentials>\n # <ShippingKey>key</ShippingKey> \n # <AccountNbr>number</AccountNbr>\n # </ShippingCredentials>\n credentials = Element.new \"ShippingCredentials\"\n\n key = Element.new \"ShippingKey\"\n key.text = params[:shipping_key] \n account = Element.new \"AccountNbr\"\n account.text = params[:account_num] \n\n credentials << key\n credentials << account\n shipment << credentials\n\n # <ShipmentDetail>\n # <ShiptDate>date</ShipDate>\n shipment_detail = Element.new \"ShipmentDetail\"\n ship_date = Element.new \"ShipDate\" \n ship_date.text = date(params[:date])\n shipment_detail << ship_date\n\n # TODO: Implement SAT and 1030 services\n\n # <Service>\n # <Code>code</Code>\n # </Service>\n service = Element.new \"Service\"\n service_code = Element.new \"Code\"\n service_code.text = service_code(params[:service_code])\n service << service_code\n\n shipment_detail << service\n\n # <ShipmentType>\n # <Code>code</Code>\n # </ShipmentType>\n shipment_type = Element.new \"ShipmentType\"\n shipment_type_code = Element.new \"Code\"\n shipment_type_code.text = shipment_code(params[:shipment_code])\n shipment_type << shipment_type_code\n shipment_detail << shipment_type\n\n # <Weight>weight</Weight>\n weight = Element.new \"Weight\"\n weight.text = weight(params[:weight], params[:shipment_code])\n\n # </ShipmentDetail> \n shipment_detail << weight\n\n shipment << shipment_detail\n\n # <Billing>\n # <Party>\n # <Code>S</Code>\n # </Party>\n # </Billing>\n billing = Element.new \"Billing\"\n billing_party = Element.new \"Party\"\n billing_party_code = Element.new \"Code\"\n\n # Since we're just doing some quick calulations we don't want to be\n # worrying about who's gonna send the package. Just make the calulations \n # assuming the sender pays for the shipping.\n billing_party_code.text = \"S\"\n\n billing << billing_party << billing_party_code\n\n shipment << billing\n\n # <Receiver>\n # <Address>\n # <State>state</State>\n # <Country>country</Country>\n # <PostalCode>code</PostalCode>\n # </Address>\n # </Receiver>\n receiver = Element.new \"Receiver\"\n receiver_addr = Element.new \"Address\"\n receiver_state = Element.new \"State\"\n receiver_country = Element.new \"Country\"\n receiver_zipcode = Element.new \"PostalCode\"\n\n receiver_state.text = state(params[:to_state])\n receiver_country.text = \"US\"\n receiver_zipcode.text = zip_code(params[:to_zip])\n\n receiver_addr << receiver_state\n receiver_addr << receiver_country\n receiver_addr << receiver_zipcode\n receiver << receiver_addr\n\n shipment << receiver\n end\n\n root = @xml.elements[\"eCommerce\"]\n root.add shipment\n end", "title": "" }, { "docid": "704df12dc9e1273c2b2882c5d4d680b2", "score": "0.5732836", "text": "def create\n @rateelem = Rateelem.new(params[:rateelem])\n\n respond_to do |format|\n if @rateelem.save\n format.html { redirect_to @rateelem, notice: 'Rateelem was successfully created.' }\n format.json { render json: @rateelem, status: :created, location: @rateelem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rateelem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85e564ab24db17e020605b0697ae328b", "score": "0.5732504", "text": "def update\n @rate = Rate.find(params[:id])\n\n if @rate.update(rate_params)\n #head :no_content\n render json: @rate, status: :accepted, location: @rate #sera? status accepted? \n else\n render json: @rate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "96cfa727fef96158b68d34bc3db9cf28", "score": "0.57293415", "text": "def interest_rate_params\n # convert to sl locale floating point number (delimiter/separator)\n params[:interest_rate][:rate].gsub!('.', '')\n params[:interest_rate][:rate].gsub!(',','.')\n params.require(:interest_rate).permit(:fixed, :duration_from, :duration_to, :bank_customer, :insured, :rate, :loan_id)\n end", "title": "" }, { "docid": "d8b3f599b10a92b9f647e4b4c294e5f0", "score": "0.5723063", "text": "def rate_params\n params.require(:rate).permit(:country, :value)\n end", "title": "" }, { "docid": "92dfa25a960a2e0c3720f967209b4391", "score": "0.5702291", "text": "def create\n @favorite_exchange_rate = current_user.favorite_exchange_rates.new(favorite_exchange_rate_params)\n\n respond_to do |format|\n if @favorite_exchange_rate.save\n PopulateExchangeRateJob.perform_later('fixer_api', @favorite_exchange_rate.id) if @favorite_exchange_rate.rates.empty?\n\n format.html { redirect_to [:admin, @favorite_exchange_rate], notice: 'Favorite Exchange rate was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_exchange_rate }\n else\n format.html { render :new }\n format.json { render json: @favorite_exchange_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9fa5988c9fee9fb8a44990e9f784e912", "score": "0.5700809", "text": "def new\n @rate = @shop.rates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rate }\n end\n end", "title": "" }, { "docid": "56dad271434e8f83a185a7b2bb093f0e", "score": "0.5696919", "text": "def create\n @tax_rate = TaxRate.new(params[:tax_rate])\n\n respond_to do |format|\n if @tax_rate.save\n format.html { redirect_to @tax_rate, :notice => t('controller.successfully_created', :model => t('activerecord.models.tax_rate')) }\n\tformat.json { render :json => @tax_rate, :status => :created, :location => @tax_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a93d013b448cad0454df0eb21c77f9be", "score": "0.5693408", "text": "def rate_params\n params.require(:rate).permit(:district_origin_id, :district_target_id, :price)\n end", "title": "" }, { "docid": "bbb10cb3d93e3ac2db0b3f5fcd1e6b5e", "score": "0.56902194", "text": "def refresh_rates\n Exchange.save_rates(Exchange::DATA_LATEST, true)\n redirect_to money_index_path\n end", "title": "" }, { "docid": "66f253e6a5502422ef8a843c4473067e", "score": "0.5686106", "text": "def rate_params\n params.require(:rate).permit(:name, :value, :date_begin, :date_end)\n end", "title": "" }, { "docid": "b1e34e74a750fd418669b63ee67a34bf", "score": "0.5664158", "text": "def create\n @rate = Rate.new(rate_params)\n\n @rate.admin_id = current_admin.id\n\n @rate.save\n\n @codevals = Codeval.all\n\n @codevals.each do |codeval|\n factor = Factor.new\n factor.codeval = codeval\n factor.rate = @rate\n factor.factor = @rate.factor\n factor.description = @rate.description\n factor.admin_id = current_admin.id\n factor.price = Value.where(codeval_id: codeval.id, cost_id: params[:rate][:cost_id]).first.value * (1 + (factor.factor / 100))\n factor.cost_id = params[:rate][:cost_id]\n factor.save\n end\n\n redirect_to @rate, notice: 'Tarifa exitosamente creada.'\n end", "title": "" }, { "docid": "3800c5f96b278dc43f571633d9fe79d9", "score": "0.56588024", "text": "def rates\n fail_if_rates_missing\n @rates\n end", "title": "" }, { "docid": "84ffda68baa69738508353159b2d81f3", "score": "0.5658234", "text": "def create\n @quote_shipping_rate = QuoteShippingRate.new(quote_shipping_rate_params)\n\n respond_to do |format|\n if @quote_shipping_rate.save\n format.html { redirect_to @quote_shipping_rate, notice: 'Quote shipping rate was successfully created.' }\n format.json { render :show, status: :created, location: @quote_shipping_rate }\n else\n format.html { render :new }\n format.json { render json: @quote_shipping_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e510d4ba061b495db50e9db03e2bef6d", "score": "0.5652775", "text": "def create\n @rate = Rate.new(params[:rate])\n\n respond_to do |format|\n if @rate.save\n format.js\n format.html { redirect_to(@rate, :notice => 'Rate was successfully created.') }\n format.xml { render :xml => @rate, :status => :created, :location => @rate }\n else\n format.js { render :error }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rate.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "543d88d56b3acdb2774f3d6a06dddde6", "score": "0.56491107", "text": "def parse_simple_rates(speed)\n number = Random.new.rand(1..10)\n amazon_rates_array << {service_name: speed[\"ShippingSpeedCategory\"],\n service_code: \"FBA+#{number}\",\n total_price: (speed[\"EstimatedFees\"][\"member\"][\"Amount\"][\"Value\"]).to_f,\n currency: speed[\"EstimatedFees\"][\"member\"][\"Amount\"][\"CurrencyCode\"],\n min_delivery_date: DateTime.rfc3339(speed[\"FulfillmentPreviewShipments\"][\"member\"][\"EarliestArrivalDate\"]).to_time,\n max_delivery_date: DateTime.rfc3339(speed[\"FulfillmentPreviewShipments\"][\"member\"][\"LatestArrivalDate\"]).to_time}\n end", "title": "" }, { "docid": "3659cd2ed801b443b185987cb13a7eb3", "score": "0.56489265", "text": "def rate_params\n params.permit(:project_id,\n :action_state_id,\n rate: {\n rates: [:id, :name, :value],\n new_rates: [:name, :value],\n })\n end", "title": "" }, { "docid": "a9708c414fb9932c17bafeee586d478e", "score": "0.5639766", "text": "def create\n\n # get the client & contract\n @client, @contract = get_client_and_contract(params[:client_id],params[:contract_id])\n\n # build the rate\n @rate = @contract.rates.build(params[:rate])\n\n # parse the dates\n @rate.effectiveDate = Date.parse(params[:effective_date]) unless params[:effective_date].blank?\n @rate.endDate = Date.parse(params[:end_date]) unless params[:end_date].blank?\n\n if @rate.save\n\n redirect_to(client_contract_rates_path(@client))\n\n else\n\n # define the list of rates\n @rates_list = {'Overtime' => 'Overtime', 'Bank Holiday' => 'Bank Holiday', 'Sickness' => 'Sickness', 'Other' => 'Other'}\n\n render :action => \"new\"\n \n end\n \n end", "title": "" }, { "docid": "c2b10d50681c651e1384583407a1a4e2", "score": "0.5628252", "text": "def rate_estimates(shipment, options:, debug: false)\n freight_rate_request_hash = GenerateFreightRateRequestHash.call(shipment: shipment, options: options)\n request = build_request(:rates, freight_rate_request_hash, debug)\n\n client.post(request).fmap do |response|\n ParseFreightRateResponse.call(response: response, request: request)\n end\n end", "title": "" }, { "docid": "5c7eb4e8285927935b83d1690c4b58c0", "score": "0.5622728", "text": "def rates(date)\n build_rates(date)\n end", "title": "" }, { "docid": "42cec3d4869ef158a7347fe00b91b446", "score": "0.56224114", "text": "def create\n @closing_rate = ClosingRate.new(params[:closing_rate])\n\n respond_to do |format|\n if @closing_rate.save\n flash[:notice] = 'ClosingRate was successfully created.'\n format.html { redirect_to(@closing_rate) }\n format.xml { render :xml => @closing_rate, :status => :created, :location => @closing_rate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @closing_rate.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c8aaf7101969e39bc160624a6b28bd1", "score": "0.56180876", "text": "def create\n @rate = Rate.new(rate_params)\n if @rate.save\n\t flash[:success] = \"Rate successfully created\"\n redirect_to @rate\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "b45ab2ef6c952867dcff030ce945870e", "score": "0.56065005", "text": "def update\n if @rate_service.update(rate_service_params)\n render json: @rate_service, status: :ok, location: @rate_service\n else\n render json: @rate_service.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "61b03cf3941363a9c242cf58b7759ef5", "score": "0.5599804", "text": "def create\n @tax_rate = @shop.tax_rates.build params[:tax_rate]\n\n respond_to do |format|\n if @tax_rate.save\n format.html { redirect_to shop_tax_rates_path(@tax_rate.shop), notice: 'Tax was successfully created.' }\n format.json { render json: @tax_rate, status: :created, location: shop_tax_rate_url(@tax_rate.shop, @tax_rate) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8fcf20e9c35f0385086c17363d6aa1", "score": "0.55971044", "text": "def update\n if @rate.update(rate_params)\n render :show, status: :ok, location: @rate\n else\n render json: @rate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "552c8f09ba8cf0721aa806618e1944be", "score": "0.5591939", "text": "def rate_params\n params.require(:rate).permit :point, :question_id, :flag\n end", "title": "" }, { "docid": "0d3fb425e37123aec7915415e22a3e31", "score": "0.5580748", "text": "def rate_params\n params.require(:rate).permit(:quality, :price, :cleanliness, :punctuality, :dealing, :average, :worker_id, :review, :comment)\n end", "title": "" }, { "docid": "dae188b203563e18d34c668e358eb6d1", "score": "0.5574826", "text": "def create\n subscriptions = Subscription\n .where(subscription_status_id: 11)\n .where(plan_id: params[:plan])\n .select(:id,:plan_id,:user_id,:created_at)\n subscriptions = subscriptions.map{ |x| \n current_plan = Plan.where(id:x.plan_id).select(:id,:price,:expiration_days).first\n profit = ((current_plan.price * params[:daily_value].to_f) / 100).round(2)\n allowed = true\n allowed = x.rewards.where(reward_type_id:11).count == 0 ? (false) : (true)\n allowed = !allowed ? (x.created_at.beginning_of_day + 5.days < Time.zone.now.beginning_of_day) : (true)\n\n x.rewards.create(value: profit, \n reward_type_id: 11,\n reward_status_id: 11,\n currency_id: 11,\n user_id:x.user_id) if allowed\n }.reject(&:blank?) if subscriptions.count(:id) > 0\n render json: subscriptions, status:200\n end", "title": "" }, { "docid": "27ef1e50f50193a61b748955eb47eaef", "score": "0.55719733", "text": "def test_local_json_currency_exchange_is_correct_1\n correct_rate = 112.726\n assert_equal correct_rate, CurrencyExchange.rate(Date.new(2018,12,10), \"USD\", \"JPY\", \"Y\")\n end", "title": "" }, { "docid": "ef2a594997eedb6b9c11946b3ad15979", "score": "0.55520964", "text": "def create\n o = PayRate.new(:id => SecureRandom.uuid, :staff_id => params[:staff_id], \n :month => params[:month], :year => params[:year], \n :hourly_pay_rate => params[:pay_rate])\n \n if o.save\n render :json => { :success => 1, \n :message => 'Pay Rate successfully added.' }\n \n else\n render :json => PayRateHelper.get_errors(o.errors)\n end\n end", "title": "" }, { "docid": "3b42d7dfdabad91c83e720b442f70248", "score": "0.5551802", "text": "def update_interest_rate\n rate = params[:interest_rate]\n current_rate = InterestRate.current_rate\n\n if rate.is_a?(Float) || rate.is_a?(Integer)\n updated_rate = InterestRate.update_current_rate!(rate: [rate.to_f, 0].max)\n render json: {\"new_rate\" => updated_rate.rate, \"old_rate\" => current_rate}\n else\n render json: {\"error\" => \"Parameter rate is not a number. Use a whole number or a decimal. For example: 2.5\"}\n end\n end", "title": "" }, { "docid": "d81150dca62841e74eb1adb12ed35aaa", "score": "0.55482465", "text": "def int_rate_params\n params.require(:int_rate).permit(:InterestRate, :EffectiveDate, :CreationDate)\n end", "title": "" }, { "docid": "a256d680254a7eeb9880fdb3380e3676", "score": "0.5544712", "text": "def rate_params\n params.require(:rate).permit(:name, :description, :admin_id, :factor, :cost_id)\n end", "title": "" }, { "docid": "4f51a41483730ccce0243eb1ad2961de", "score": "0.5536985", "text": "def new\n @rate = Rate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rate }\n end\n end", "title": "" }, { "docid": "4f51a41483730ccce0243eb1ad2961de", "score": "0.5536985", "text": "def new\n @rate = Rate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rate }\n end\n end", "title": "" }, { "docid": "947b0d6a3dcb9e78f5a98285de94faff", "score": "0.5536666", "text": "def create\n @game_rate = GameRate.new(game_rate_params)\n\n respond_to do |format|\n if @game_rate.save\n format.html { redirect_to @game_rate, notice: 'Game rate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game_rate }\n else\n format.html { render action: 'new' }\n format.json { render json: @game_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e24322ef8f04d263f8d99a94a1a14bd", "score": "0.5535281", "text": "def load_fixed_currency_rates\n @@fixed_currency_rates = {}\n yaml = YAML.load_file(File.join(File.dirname(__FILE__), 'numisma', 'fixed_currency_rates.yml'))\n yaml.each do |from, rates|\n @@fixed_currency_rates[from] ||= {}\n rates.each do |to, rate|\n @@fixed_currency_rates[from][to] = rate\n @@fixed_currency_rates[to] ||= {}\n @@fixed_currency_rates[to][from] = 1 / rate\n end\n end\n end", "title": "" }, { "docid": "06ad2b6019682c5c92de1553c5796369", "score": "0.55240667", "text": "def rate_estimates(shipment, options:, debug: false)\n rate_request_xml = SerializeRatingServiceSelectionRequest.call(shipment: shipment, options: options)\n url = base_url + RESOURCES[:rates]\n request = FriendlyShipping::Request.new(\n url: url,\n http_method: \"POST\",\n body: access_request_xml + rate_request_xml,\n readable_body: rate_request_xml,\n debug: debug\n )\n\n client.post(request).bind do |response|\n ParseRateResponse.call(response: response, request: request, shipment: shipment)\n end\n end", "title": "" }, { "docid": "ee109395d967b8ed7a3a99aa846570d0", "score": "0.55133975", "text": "def rate_estimates(shipment, options: RateEstimateOptions.new, debug: false)\n rate_request_xml = SerializeRateRequest.call(shipment: shipment, login: login, options: options)\n request = build_request(api: :rates, xml: rate_request_xml, debug: debug)\n client.post(request).bind do |response|\n ParseRateResponse.call(response: response, request: request, shipment: shipment, options: options)\n end\n end", "title": "" }, { "docid": "978cb7987d158489f5ab3389b69b3ca3", "score": "0.55100363", "text": "def update_rates(straight = false)\n new_rates = exchange_rates(straight)\n\n unless new_rates.is_a?(Array)\n return unless raise_on_failure\n raise ApiError, new_rates\n end\n\n return if new_rates.first.empty?\n\n store.reset!\n rates = new_rates.each do |exchange_rate|\n currency = exchange_rate['target']\n rate = exchange_rate['rate']\n next unless Money::Currency.find(currency)\n add_rate(source, currency, rate)\n add_rate(currency, source, 1.0 / rate)\n end\n add_rate(source, source, 1.0)\n @rates_mem_timestamp = rates_timestamp\n rates\n end", "title": "" }, { "docid": "be04a407ccd9f97ac0af6b731b4b0274", "score": "0.55038995", "text": "def create\n @drop_rate = DropRate.new(drop_rate_params)\n\n respond_to do |format|\n if @drop_rate.save\n format.html { redirect_to @drop_rate, notice: 'Drop rate was successfully created.' }\n format.json { render :show, status: :created, location: @drop_rate }\n else\n format.html { render :new }\n format.json { render json: @drop_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f0baa39b20b77cb90dedb01271b33a9c", "score": "0.55027795", "text": "def rates_update\n @st = params[:st].to_s\n if @tariff and @st.length != 1\n dont_be_so_smart\n redirect_to :root and return false\n end\n access=check_user_id_with_session(@tariff.owner_id)\n return false if !access\n @rates = @tariff.rates_by_st(@st, 0, 10000)\n @rates.each { |rate|\n rate_id = \"id_#{rate.id}\".to_sym\n if params[:rate] and params[:rate][rate_id] and params[:rate][rate_id][:price] and rate.price.to_d != params[:rate][rate_id][:price].to_d\n rate.price = params[:rate][rate_id][:price].to_d\n rate.save\n end\n }\n flash[:status] = _('Sms_rate_updated')\n redirect_to action: 'rates', id: params[:id], st: @st, page: params[:page]\n end", "title": "" }, { "docid": "2813749e19c181db104cd6e5aed1ea62", "score": "0.5500079", "text": "def create\n @daily_exchange_rate = DailyExchangeRate.new(daily_exchange_rate_params)\n\n respond_to do |format|\n if @daily_exchange_rate.save\n format.html { redirect_to @daily_exchange_rate, notice: 'Daily exchange rate was successfully created.' }\n format.json { render :show, status: :created, location: @daily_exchange_rate }\n else\n format.html { render :new }\n format.json { render json: @daily_exchange_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ab1e14518df78ac23507c73aca97289", "score": "0.5496852", "text": "def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to project_action_state_rates_path(project, action_state) }\n format.json { render :show, status: :ok, location: @rate }\n end\n end\n end", "title": "" }, { "docid": "567d7dab5b0a0e7f81e894bac2dc9e44", "score": "0.54933625", "text": "def new\n @shipping_rate = ShippingRate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_rate }\n end\n end", "title": "" }, { "docid": "499282d25666fc4dfc52de4c85c5ed79", "score": "0.5483423", "text": "def rate_change_adjustment\n @rate_change=JSON.parse RestClient.get $api_service+\"/claims/rate_change_claim_no?claim_no=#{params[:claim_no]}\" \n end", "title": "" }, { "docid": "3ecdfd9e1d2efb5fa0f2cb5383306c74", "score": "0.54827964", "text": "def create\n # @review = Review.new(review_params)\n @review = Review.new\n @review.house_id = params[:review][:house_id] \n @review.factor_id = params[:review][:factor_id] \n @review.note = params[:review][:note] \n @review.user_id = current_user.id\n\n @rate = Rate.new\n @rate.text_input = params[:rate][:text_input]\n @rate.integer_input = params[:rate][:integer_input]\n @rate.start_range = params[:rate][:start_range]\n @rate.end_range = params[:rate][:end_range]\n # @rate.float_input= params[:review][:rate][:float_input]\n # :factor_id, :note :house_id, :factor_id, :note\n respond_to do |format|\n if @review.save\n @rate.review_id = @review.id\n if @rate.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review }\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a94eab0a5c2ea75e7dd41fc314ae0eb9", "score": "0.5474208", "text": "def rate_params\n params.permit(:value, :name, :description, :date_begin, :date_end)\n\n end", "title": "" }, { "docid": "92b8e87b8d2bb58ad9f6c72aa9acd3e9", "score": "0.54678214", "text": "def create\n @rate = Rate.new(rate_params)\n origin = District.find_by_name(params[:rate][:district_origin_id].upcase) if params[:rate][:district_origin_id].present? \n target = District.find_by_name(params[:rate][:district_target_id].upcase) if params[:rate][:district_target_id].present? \n @rate.district_origin_id = origin.id\n @rate.district_target_id = target.id\n respond_to do |format|\n if @rate.save\n format.html { redirect_to @rate, flash: { success: 'Rate was successfully created.' } }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { redirect_to rates_new_path }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35f1da03a57210b56251e288d73bc7c5", "score": "0.5465948", "text": "def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to @rate, flash: { success: 'Rate was successfully updated.' } }\n format.json { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2da06d9e23e5e491ca5d895b177ef40", "score": "0.5464614", "text": "def index\n @rates = action_state.rates\n @rate = Rate.new\n end", "title": "" }, { "docid": "a775848f22f2ce7de66438721ccec5be", "score": "0.5463166", "text": "def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to @rate, notice: 'Rate was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
1237407abc9aa53fccf75c648d02e235
GET /todo_app_lists/1 GET /todo_app_lists/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "cab7f9d4b3ba18cddbb38aa8b3ae49d0", "score": "0.7466178", "text": "def index\n @todo_app_lists = current_user.todo_app_lists\n end", "title": "" }, { "docid": "6fe7369c75e040a208c88b665d5254fa", "score": "0.7302523", "text": "def index\n @todo_items = @todo_list.todo_items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_items }\n end\n end", "title": "" }, { "docid": "b8021d02a5fc7484a5ee122b53a7d488", "score": "0.7250799", "text": "def set_todo_app_list\n @todo_app_list = TodoAppList.find(params[:id])\n end", "title": "" }, { "docid": "c2c6c7fb0c49180e9474b8eff2409fd5", "score": "0.7151707", "text": "def lists\n\tget('/lists.json')\nend", "title": "" }, { "docid": "cb75c631ce3a4d7672b681915df24775", "score": "0.7075151", "text": "def list_todo_items(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/users/self/todo\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n end", "title": "" }, { "docid": "9dcb0399314c71bb48687b92de811e0e", "score": "0.7015646", "text": "def todo_list todo_list_id\n TodoList.new Basecampx.request \"projects/#{self.id}/todolists/#{todo_list_id}.json\"\n end", "title": "" }, { "docid": "45d5d9869ce44c871a1891c7b85f4c6e", "score": "0.7014248", "text": "def todo_list\n Todo.list(developer_id: id)\n end", "title": "" }, { "docid": "d8b7ceddd419c979f6cd346d97a57f40", "score": "0.7005266", "text": "def index\n @todoitems = Todoitem.all\n render json: @todoitems\n end", "title": "" }, { "docid": "c8e42d54dca4731ec31c7b1965879885", "score": "0.699883", "text": "def index\n @todos = current_list.todos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todos }\n end\n end", "title": "" }, { "docid": "4af4257a24245dd9a1c96ca1d2ea3f82", "score": "0.6991183", "text": "def show\n @list = List.find(params[:list_id])\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "title": "" }, { "docid": "dbf7420d1f6486097c17882a9049dfa9", "score": "0.69899386", "text": "def create\n @todo_app_list = current_user.todo_app_lists.new(todo_app_list_params)\n\n respond_to do |format|\n if @todo_app_list.save\n format.html { redirect_to @todo_app_list, notice: 'Todo app list was successfully created.' }\n format.json { render :show, status: :created, location: @todo_app_list }\n else\n format.html { render :new }\n format.json { render json: @todo_app_list.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "74c0693f7812856c54a484af8dbc1191", "score": "0.6945779", "text": "def show\n @list = TodoList.find(params[:id])\n \n respond_to do |format|\n format.html\n format.json { render json: {\n success: true, \n data: [@list], \n message: \"TodoList found.\"\n }}\n end\n end", "title": "" }, { "docid": "019c9132fc77c58466ededba3dffc686", "score": "0.69229096", "text": "def todos\n render json: @current_user.todo_list\n end", "title": "" }, { "docid": "3402a78d3db63c4339ee3cefb4fa8c54", "score": "0.6907768", "text": "def index\n\t\t\t\t@api_v1_todoitems = Todoitem.all\n\n\t\t\t\trender json: @api_v1_todoitems\n\t\t\tend", "title": "" }, { "docid": "2b08372bc2ee7fe2fa4ddc9321258956", "score": "0.6888259", "text": "def index\n @todos = Todo.all\n render json: @todos, status: :ok\n end", "title": "" }, { "docid": "02ec141ed80e78e4f273624377539aef", "score": "0.68799764", "text": "def index\n @list = List.find(params[:list_id])\n @todos = @list.todos.paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @list }\n end\n end", "title": "" }, { "docid": "6724a2c5ff37696be6a82779429db316", "score": "0.6870411", "text": "def index\n @todolists = Todolist.all\n end", "title": "" }, { "docid": "6724a2c5ff37696be6a82779429db316", "score": "0.6870411", "text": "def index\n @todolists = Todolist.all\n end", "title": "" }, { "docid": "95f9492988c6caec9878d0d83a76e414", "score": "0.68137527", "text": "def index\n @todo = Todo.new\n @todos = Todo.all\n render json: @todos\n end", "title": "" }, { "docid": "12d2cf136f56b6e722235daeef9004c5", "score": "0.6805601", "text": "def index\n @todos = Todo.all\n # @todos = nil if @todos.empty?\n @todos = @todos.as_json\n @list = { todos: @todos }\n end", "title": "" }, { "docid": "5ec62005d7f88006f497a1abd800ddce", "score": "0.6801289", "text": "def show\n @todo_item = @todo_list.todo_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo_item }\n end\n end", "title": "" }, { "docid": "30a1d978d67f2bd2343aeaecb0ff5625", "score": "0.6799395", "text": "def index\n @todo_items = @todo_list.todo_items\n end", "title": "" }, { "docid": "bfe8e5683d469b61b812536d897dbf8d", "score": "0.6791679", "text": "def show\n @todo = current_list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "title": "" }, { "docid": "c16be5131581e97d99ddb45de4f4414a", "score": "0.67880225", "text": "def index\n @todos = Todo.all\n json_response(@todos)\n end", "title": "" }, { "docid": "6379a7ff48846c5e5a6823ecf20a53b6", "score": "0.6776812", "text": "def show\n @to_do_list = ToDoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @to_do_list }\n end\n end", "title": "" }, { "docid": "ead66adbb4d4ec3306ba22d92324c83f", "score": "0.6737393", "text": "def index\r\n @todolists = Todolist.all\r\n end", "title": "" }, { "docid": "a79e70b3f68d95465ab470c099b0f58d", "score": "0.6736926", "text": "def show\n @todolist = Todolist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todolist }\n end\n end", "title": "" }, { "docid": "a79e70b3f68d95465ab470c099b0f58d", "score": "0.6736926", "text": "def show\n @todolist = Todolist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todolist }\n end\n end", "title": "" }, { "docid": "a50bac106e69a3d8011dcd2ff1bd6b7b", "score": "0.6729696", "text": "def index\n @todos = Todo.all.order(:id)\n render json: @todos\n end", "title": "" }, { "docid": "b7326045547537eb4e1c2cc2ad3fffa2", "score": "0.6725504", "text": "def todolist(todoset, id)\n get(\"/buckets/#{todoset.bucket.id}/todolists/#{id}\")\n end", "title": "" }, { "docid": "2f8ad82902263b0235eac2668577df99", "score": "0.6721248", "text": "def index\n @task_lists = TaskList.all\n render json: @task_lists, status: 200\n end", "title": "" }, { "docid": "5c8d6511416a7eeafb1d51f066295b50", "score": "0.67126596", "text": "def index\n @todo_lists = current_user.todo_lists.all\n end", "title": "" }, { "docid": "568b4b69a8de7488fc18ccefc065d715", "score": "0.66981167", "text": "def index\n base_scope = Todo.with_list_id(list.id).order(:created_at)\n if @view_completed = (params[:view] == 'completed')\n @todos = base_scope.completed\n else\n @todos = base_scope.not_completed + [Todo.new]\n end\n respond_to do |format|\n format.html\n format.json { render json: @todos }\n end\n end", "title": "" }, { "docid": "e0353152d1fc8f78b929d2da2b579fdf", "score": "0.66839296", "text": "def list\n return nil unless list_id\n\n @list ||= TodoableApi::List.find(list_id)\n end", "title": "" }, { "docid": "141d216df2cf553624d864440f09c5a8", "score": "0.66820496", "text": "def new\n @list = List.find(params[:list_id])\n @todo = @list.todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "title": "" }, { "docid": "a9bb6dd1e60084a9fa307e0974557d83", "score": "0.66816455", "text": "def applist\n do_request 'applist'\n end", "title": "" }, { "docid": "41c1ac9a1812e2ef93da638a6f8a4611", "score": "0.6673305", "text": "def index\n @todo_lists = TodoList.order(\"created_at DESC\")\n render json: @todo_lists\n #render component: 'Todo List/Index/Home', props: { todo_lists: @todo_lists.to_json }\n end", "title": "" }, { "docid": "6e80afbe6fadca5ac54ce0941ae22bbb", "score": "0.66599846", "text": "def index\n @user_todo_lists = UserTodoList.all\n end", "title": "" }, { "docid": "621506005d56a187040ed87b0d58a985", "score": "0.66215956", "text": "def index\n \n @tasklists = Tasklist.where(\"user_id = ?\", session[:user_id])\n @todo_tasks = Task.where(\"next_action = ? and user_id = ? \", true,session[:user_id] )\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasklists }\n end\n end", "title": "" }, { "docid": "8c55084420703a4157e096ca3e235d93", "score": "0.6615858", "text": "def index\n @to_do_lists = ToDoList.all\n end", "title": "" }, { "docid": "8426073b95812a246aa48588d84c3416", "score": "0.6606915", "text": "def todolists\n response = client.access_token.get(\"#{client.base_uri}/projects/#{id}/todolists.json\")\n lists = response.parsed.map do |list|\n Basecamp::TodoList.new(list.merge({\n :account_id => account_id,\n :token => token\n }))\n end\n\n rescue OAuth2::Error => ex\n Basecamp::Error.new(ex.message).raise_exception\n end", "title": "" }, { "docid": "fb523172cbfad976b576f76d099f7a6d", "score": "0.6584665", "text": "def show\n\t\t\t\trender json: @api_v1_todoitem\n\t\t\tend", "title": "" }, { "docid": "f79370d6d5a8d284d4b10abddf3bea61", "score": "0.65826845", "text": "def show\n @todo_list= @todo_lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @todo_list}\n format.json { render :json => @todo_list}\n end\n end", "title": "" }, { "docid": "7ccebee0d4839eba8a4a2c3245a09764", "score": "0.6565888", "text": "def index\n @todos = @user.todos\n render json: @todos\n end", "title": "" }, { "docid": "0c3d9f456e57b45b44bab56e4b22a7dc", "score": "0.65619886", "text": "def create\n @todo_list = TodoList.create(todo_list_params)\n render json: @todo_list\n end", "title": "" }, { "docid": "301157182f18a1ac9d7e64999e3988b6", "score": "0.65601385", "text": "def index\n @todos = Todo.where(user_id: session[:user_id])\n render json: @todos\n end", "title": "" }, { "docid": "3d6fd9768b82a2b552ad75e92a29ca6e", "score": "0.65597165", "text": "def todolist(list_id)\n response = client.access_token.get(\"#{client.base_uri}/projects/#{id}/todolists/#{list_id}.json\")\n Basecamp::TodoList.new(response.parsed.merge({\n :account_id => account_id,\n :token => token\n }))\n\n rescue OAuth2::Error => ex\n Basecamp::Error.new(ex.message).raise_exception\n end", "title": "" }, { "docid": "90955ac3dc2159b368868758cfefb3aa", "score": "0.6550757", "text": "def index\n @todo_items = TodoItem.all\n end", "title": "" }, { "docid": "19f3e87014868aecf245f7fbe819daee", "score": "0.654647", "text": "def index\n @todos = Todo.where('user_id = ?', current_user)\n render json: @todos\n end", "title": "" }, { "docid": "700fb0cfcd236239906721e24d897692", "score": "0.65380454", "text": "def index\n @app_lists = AppList.all\n end", "title": "" }, { "docid": "71a6e6aa1e59bdc69cda3caea7ee30e4", "score": "0.6516632", "text": "def index\n @todos = Todo.all\n render json: {status: 'SUCCESS', message: 'todos loaded', data: @todos}, status: :ok\n end", "title": "" }, { "docid": "ca7fc7496759a427a9d1bb65ca420231", "score": "0.6501536", "text": "def index\n @todo_list2s = TodoList2.all\n end", "title": "" }, { "docid": "1bda0c4b73f50b080651f38af25fb5fb", "score": "0.64599", "text": "def task_list(task_list_id)\n response = get \"/tasklists/#{task_list_id}.json\"\n response.body['todo-list']\n end", "title": "" }, { "docid": "0e7ecc249151cb94df8818063d7fbc45", "score": "0.6459132", "text": "def index\n # @todos = Todo.all\n end", "title": "" }, { "docid": "e66dc7e5cffe8e519dcb2c185e50f3c5", "score": "0.64526606", "text": "def list\n return nil unless list_id\n\n @list ||= Todoable::List.get(id: list_id)\n end", "title": "" }, { "docid": "11736078752100fc5b00ae5567d89a94", "score": "0.64489543", "text": "def index\n @todoitems = Todoitem.all\n end", "title": "" }, { "docid": "cdd72f75915663f0c2f12a3b3ccd5214", "score": "0.64484346", "text": "def index\n @tasklists = @project.tasklists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasklists }\n end\n end", "title": "" }, { "docid": "a83e45a2cadeb6feb5270242aa0b9f83", "score": "0.643603", "text": "def index\n @todo_clients = TodoClient.all\n end", "title": "" }, { "docid": "1dc5865084c7aea418a8eae124db6dbd", "score": "0.6434525", "text": "def index\n if params[:user] != nil\n @to_do_items = ToDoItem.where(user: params[:user])\n render json: {data: @to_do_items}\n end\n @to_do_items = ToDoItem.all\n end", "title": "" }, { "docid": "a423bf2c6efc70395a678e7d42cdf400", "score": "0.64322674", "text": "def index\n @todo2_items = Todo2Item.all\n end", "title": "" }, { "docid": "c9f00c6a767befc1256af2ae2163a11e", "score": "0.6425477", "text": "def update\n respond_to do |format|\n if @todo_app_list.update(todo_app_list_params)\n format.html { redirect_to @todo_app_list, notice: 'Todo app list was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo_app_list }\n else\n format.html { render :edit }\n format.json { render json: @todo_app_list.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72428eea7029db105f1b64d2ff7a9377", "score": "0.6418685", "text": "def todos\n @events = Event.all\n render json: @events, status: :ok\nend", "title": "" }, { "docid": "12542439a04f77fa127dade88247ab45", "score": "0.64149207", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @todo_lists }\n format.json { render :json => @todo_lists}\n end\n end", "title": "" }, { "docid": "d9258831f1c8f2d8fbfa408639ee8120", "score": "0.64103353", "text": "def new\n @to_do_list = ToDoList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @to_do_list }\n end\n end", "title": "" }, { "docid": "e2292ee1f37dcf09cddca07051e56c9d", "score": "0.64056677", "text": "def show\n @task_list = current_user.task_lists.find(params[:id])\n\n render json: @task_list\n end", "title": "" }, { "docid": "07cdaf9ef133b6c86349a8729c9f0cfa", "score": "0.6397102", "text": "def todo_app_list_params\n params.require(:todo_app_list).permit(:title, :status, :task)\n end", "title": "" }, { "docid": "3fd7cc8a65f9444f14561be96794dad3", "score": "0.63898706", "text": "def index\n @todo_otems = TodoOtem.all\n end", "title": "" }, { "docid": "f457dae60d9e429eeebf55aad69b2a2b", "score": "0.63849455", "text": "def todosJSON\n render :json => Todo.all\n end", "title": "" }, { "docid": "187b1e4340708c1421c70982e642e511", "score": "0.63767546", "text": "def show\n json_response(@todo)\n end", "title": "" }, { "docid": "20df2e27cdb2b2eeebe8552e87b230ef", "score": "0.6373916", "text": "def show\n @tasklist = Tasklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasklists }\n end\n end", "title": "" }, { "docid": "e26209806ebc11e244460e7504fb058d", "score": "0.6371893", "text": "def index\n @items = Item.where(:list_id => @list.id)\n render json: @items\n end", "title": "" }, { "docid": "505463085c1c37ac924dbd3f466582ec", "score": "0.6367098", "text": "def find_todolist\n @todolist = Todolist.find(params[:id])\n end", "title": "" }, { "docid": "77a1d3e486268772863d6922fb51ab9a", "score": "0.6364901", "text": "def list\n JSON.parse get(\"list/json\")\n end", "title": "" }, { "docid": "438fd5789e6233f6bdd6f3fb02a8f4e9", "score": "0.63532954", "text": "def todo_items\n @todo_items = @tag.get_todo_items.order(title: :asc).page(params[:page])\n render template: \"api/v1/todo_items/index\"\n end", "title": "" }, { "docid": "472771bb98b682f9a7146944f7ead82c", "score": "0.6352299", "text": "def index\n @lists = List.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lists }\n end\n end", "title": "" }, { "docid": "b3b4eaad27fc60a1fbde68766dbd71bd", "score": "0.63433033", "text": "def find(this_id)\n attributes = client.get(path: \"lists/#{this_id}\")\n attributes[\"id\"] = this_id\n TodoableApi::List.new(attributes)\n end", "title": "" }, { "docid": "b08338430b8a272be3e196bae69b2dd5", "score": "0.6338625", "text": "def index\n @todo_statuses = TodoStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_statuses }\n end\n end", "title": "" }, { "docid": "7f94e85e51c726f22594e321cbf0b1b6", "score": "0.63383716", "text": "def show\n render json: @todoitem\n end", "title": "" }, { "docid": "17e8985b66f373acbd0f4744caa188fa", "score": "0.6331634", "text": "def index\n @todos = Todo.get_todos_with_notification(session[:user_id])\n end", "title": "" }, { "docid": "6091b85904bec5767ddc91861a51bd4f", "score": "0.63253886", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todos }\n end\n end", "title": "" }, { "docid": "8f73137ff33b765f8e3f743a13a29465", "score": "0.63245565", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "8f73137ff33b765f8e3f743a13a29465", "score": "0.63245565", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "8f73137ff33b765f8e3f743a13a29465", "score": "0.63245565", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "8f73137ff33b765f8e3f743a13a29465", "score": "0.63245565", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "8f73137ff33b765f8e3f743a13a29465", "score": "0.63245565", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "8f73137ff33b765f8e3f743a13a29465", "score": "0.63245565", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "8f73137ff33b765f8e3f743a13a29465", "score": "0.63245565", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "a15f1fe5c15b65250dce787be5dc9db1", "score": "0.63218665", "text": "def show\n @todo_item = @todo_list.todo_items.find(params[:id])\n end", "title": "" }, { "docid": "d22f3e94af887da72cb4c47ea6cb2f21", "score": "0.6313929", "text": "def index\n @todos = Todo.all\n respond_with(@todos)\n end", "title": "" }, { "docid": "c87a9ed99b0c19cbe1a0b6701a5eda42", "score": "0.6304671", "text": "def refresh_list\n response = client.access_token.get(\"#{client.base_uri}/projects/#{project_id}/todolists/#{id}.json\")\n initialize(response.parsed)\n end", "title": "" }, { "docid": "4c64592b9cc4f9a38c44fa7fedaa4b49", "score": "0.63036275", "text": "def todolists\n active_response = Logan::Client.get \"/projects/#{@id}/todolists.json\"\n lists_array = active_response.parsed_response.map do |h| \n Logan::TodoList.new h.merge({ :project_id => @id })\n end\n end", "title": "" }, { "docid": "2b570d29a09ee5e7c109389c667b9cb9", "score": "0.6296023", "text": "def index\n @applists = current_user.applists\n end", "title": "" }, { "docid": "0e13e3be6c28c7a74c6909a58bdc3555", "score": "0.62811315", "text": "def index\n @todos = current_user.todos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todos }\n end\n end", "title": "" }, { "docid": "475ad79e0ee5d0d5e89d61f09b68d4bc", "score": "0.62773114", "text": "def index\n @todo_assignments = TodoAssignment.all\n render json: @todo_assignments, status: :ok\n end", "title": "" }, { "docid": "e642b25bf1aa0958fee82d5e38c6843c", "score": "0.6266927", "text": "def todolist(list_id)\n response = Logan::Client.get \"/projects/#{@id}/todolists/#{list_id}.json\"\n Logan::TodoList.new response.parsed_response.merge({ :project_id => @id })\n end", "title": "" }, { "docid": "e642b25bf1aa0958fee82d5e38c6843c", "score": "0.6266927", "text": "def todolist(list_id)\n response = Logan::Client.get \"/projects/#{@id}/todolists/#{list_id}.json\"\n Logan::TodoList.new response.parsed_response.merge({ :project_id => @id })\n end", "title": "" }, { "docid": "f6516717d5ccd9a9bd2326e86d4e5c99", "score": "0.6258091", "text": "def app\n @tasks = Task.where(:user_id => current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end", "title": "" }, { "docid": "11ffeaf06908aeef8c35e76d709f270d", "score": "0.62498885", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "11ffeaf06908aeef8c35e76d709f270d", "score": "0.62498885", "text": "def index\n @todos = Todo.all\n end", "title": "" }, { "docid": "85665d37f3e4ac0651bf4d202fd810fa", "score": "0.62459993", "text": "def checklists()\n json_call Net::HTTP::Get.new(\"/checklists.json\")\n end", "title": "" }, { "docid": "fc2a4699d18d108bc7273d5560c7b73e", "score": "0.6243412", "text": "def find_project_todo_lists(project_id)\n BasecampAPI::TodoList.find(\n :all,\n :params => {\n :project_id => project_id,\n :responsible_party => ''\n }\n )\n end", "title": "" } ]
c3ca03c61bbfe985299552174ff8159d
Public calling protected speak method
[ { "docid": "1245b35f983cdbcc7570cccc9d3091c6", "score": "0.8566343", "text": "def calling_speak\n speak\n end", "title": "" } ]
[ { "docid": "e125d8c5da1ab6c3ef2750868bd2c458", "score": "0.83970314", "text": "def speak\n\t\traise 'You must implement this in a subclass'\n\tend", "title": "" }, { "docid": "9e58feb6cdbb23367484ccd71c2a448a", "score": "0.83668256", "text": "def speak\n super(\"Woof\")\n end", "title": "" }, { "docid": "fc7421ba8f6f71069e5abadce46d5c46", "score": "0.8335779", "text": "def speak\n\t raise NotImplementedError.new(\"#{self.class.name}#speak is an abstract method.\")\n end", "title": "" }, { "docid": "d745aedbf534521557a8c519bca03154", "score": "0.81552196", "text": "def implicitly_speak\n speak\n end", "title": "" }, { "docid": "af7af22e55d66cc2f8884060ddc3bbbb", "score": "0.8050176", "text": "def speak\n puts \"WOOF WOOF\"\n end", "title": "" }, { "docid": "58cf5212881bd22fb5492c574773ada1", "score": "0.7832289", "text": "def speak\n puts 'bark bark bark'\n end", "title": "" }, { "docid": "19d4f6e7636c1406faff4ca0f43687ac", "score": "0.77076155", "text": "def speak\n puts \"ho, ho, ho! happy hollandaise!\"\n end", "title": "" }, { "docid": "d09039e208f26089a45a7e2bc9320041", "score": "0.7685656", "text": "def speak\n puts \"I'm a person\"\n end", "title": "" }, { "docid": "3d8bae53593f4d68f6903797f7c28562", "score": "0.76837176", "text": "def speak\n puts \"woof\"\n end", "title": "" }, { "docid": "00b15940b1bc239515fb2048dad0f36a", "score": "0.766268", "text": "def speak \n \"#{self.name} says arf!\"\n end", "title": "" }, { "docid": "fadcb43d4c4a1d7285cfec03ce17541c", "score": "0.76325387", "text": "def speech; end", "title": "" }, { "docid": "4cb23b4c90c3c24efe45198118d95335", "score": "0.75897217", "text": "def speak\r\n \"#{name} say Arf!\"\r\n end", "title": "" }, { "docid": "7b263ff981cca44411fa3145b2aedd32", "score": "0.75880736", "text": "def speak\n \"#{name} says Assalaam alaykum\"\n end", "title": "" }, { "docid": "4cf0d02b3af4ecb61fa6a128d9387219", "score": "0.75689405", "text": "def speak\n \"This animal is silent.\"\n end", "title": "" }, { "docid": "c3a32ef5f33d7da818ff0eef082423f0", "score": "0.75239354", "text": "def speak\n \"#{name} says arf!\"\n end", "title": "" }, { "docid": "fc6ed9f52c16638fe15616d546ae2f79", "score": "0.75014955", "text": "def speak\n \"#{self.name} says arf!\"\n end", "title": "" }, { "docid": "6d028ca87f147ef66b98607dd4dbcd01", "score": "0.7489628", "text": "def speak\n \"#{@name} says Arf!!\"\n end", "title": "" }, { "docid": "467ee77d718d5332a7582fa5617f1a64", "score": "0.7471823", "text": "def speak\n \"#{name} says Arf!\"\n end", "title": "" }, { "docid": "ee9c25cd9e6018c65bba598116ec3966", "score": "0.74561363", "text": "def speak\n # was @name before, but since we are using attr_accessor, we want to call the instance method, instead of the instance variable\n \"#{name} says Arf\"\n end", "title": "" }, { "docid": "66349dc97a276e311931aa8c9decba96", "score": "0.74484086", "text": "def speak\n \"#{name} says wuff!\"\n end", "title": "" }, { "docid": "4e3595aace12e4b42916fec0eb774d18", "score": "0.7442141", "text": "def speak\n \"#{name} says arf!\"\n end", "title": "" }, { "docid": "e236646fbe64b4411bcc23fc61ae17a6", "score": "0.7423242", "text": "def speak\n\t`say 'I am a product.`\nend", "title": "" }, { "docid": "0c207b42027c55b8a7ded9d20245a7b3", "score": "0.740867", "text": "def speak\n \"#{@name} says Arf!\"\n end", "title": "" }, { "docid": "c7e4072c8847cc39cf9683b97459299a", "score": "0.7397658", "text": "def speak\n \"#{@name} says arf!\"\n end", "title": "" }, { "docid": "c7e4072c8847cc39cf9683b97459299a", "score": "0.7397658", "text": "def speak\n \"#{@name} says arf!\"\n end", "title": "" }, { "docid": "701d97aaaf81695ca15054bff4464e0a", "score": "0.7368563", "text": "def speak\n \"#{@name} says Arf!\" # using instance variables in methods\n end", "title": "" }, { "docid": "67b49d446c9118a98abbe30c6741ebb8", "score": "0.7323638", "text": "def speak(msg=\"foo-instance speaking... \")\n msg=\"foo-instance speaking... \"\n msg + (defined?(super) ? super() : \"\")\n end", "title": "" }, { "docid": "b2c47c2755891ea5b3346e82d2398b4c", "score": "0.72322714", "text": "def speak(utterance)\n prints utterance\n end", "title": "" }, { "docid": "b8723dbdc4e91435a73532ad86af91fd", "score": "0.7222369", "text": "def speak\n \"#{name} says arf!\"\nend", "title": "" }, { "docid": "b8723dbdc4e91435a73532ad86af91fd", "score": "0.7222369", "text": "def speak\n \"#{name} says arf!\"\nend", "title": "" }, { "docid": "b8723dbdc4e91435a73532ad86af91fd", "score": "0.7222369", "text": "def speak\n \"#{name} says arf!\"\nend", "title": "" }, { "docid": "faa7d7d9d86ecb7f0daf1fa6565c6955", "score": "0.719589", "text": "def speaker _args\n \"speaker _args;\" \n end", "title": "" }, { "docid": "597051846861ad7af9d4e12ff42539dc", "score": "0.713582", "text": "def speak\n\t\t\"#{name} says ARf!\" #changed #{@name} for name to call the inst. name method as oposed to the \n\t\t#inst. var @name. This only works for the GETTER method. For the setter we need to use self\n\tend", "title": "" }, { "docid": "ac6548b0ccb52177053c8d77fe8b8d57", "score": "0.7038368", "text": "def speak(x)\n\t puts \"Woof!\" * x\n end", "title": "" }, { "docid": "d812308283bc3485f23aea564558a41b", "score": "0.7031012", "text": "def speak\n \"#{@name} says arf!\"\nend", "title": "" }, { "docid": "d812308283bc3485f23aea564558a41b", "score": "0.7031012", "text": "def speak\n \"#{@name} says arf!\"\nend", "title": "" }, { "docid": "d812308283bc3485f23aea564558a41b", "score": "0.7031012", "text": "def speak\n \"#{@name} says arf!\"\nend", "title": "" }, { "docid": "d812308283bc3485f23aea564558a41b", "score": "0.7031012", "text": "def speak\n \"#{@name} says arf!\"\nend", "title": "" }, { "docid": "d812308283bc3485f23aea564558a41b", "score": "0.7031012", "text": "def speak\n \"#{@name} says arf!\"\nend", "title": "" }, { "docid": "d812308283bc3485f23aea564558a41b", "score": "0.7031012", "text": "def speak\n \"#{@name} says arf!\"\nend", "title": "" }, { "docid": "3b8cb516a9aee565edf73f397fa45749", "score": "0.7010095", "text": "def speak\n @arr = 'Shiber Me Timbers You Scurvey Dogs!!'\n @speak_a.push(\"@what\", \"@arr\")\n @speak = speak.a.join(/\\n /)\n end", "title": "" }, { "docid": "272238c86c65649258023caa9c2f4213", "score": "0.69956946", "text": "def speak meaning\n MyLogger.debug \"Player ##{id} speaking #{meaning}\"\n word = lookup(meaning, should_invent?)\n Utterance.new(meaning, word) unless word.nil?\n end", "title": "" }, { "docid": "767b3a16bbf1426111a1619fb354ae32", "score": "0.69904", "text": "def speak2\n puts \"Goodbye world\"\n end", "title": "" }, { "docid": "6e7ec1077d2c7c25d2842f1ee0e283af", "score": "0.6989638", "text": "def speak\n p \"Ho, ho, ho! Haaaappy holidays!\"\n end", "title": "" }, { "docid": "34c60d2988b63f1376f5422d5bb45332", "score": "0.69490594", "text": "def speak\n \"#{name} says arf!\" #changed from this after attr_accessor method established \"#{@name} says arf!\"\n #removing the @ calls this an instance method instead of instance variable\n # now we can use this name method throughout our claass to retrieve the name\n end", "title": "" }, { "docid": "7b5b6f14ecdf45e507ba31cc2cf59020", "score": "0.69052315", "text": "def speak\r\n\t\tputs \"Ho, ho, ho! Merry Christmas and Haaaappy holidays to all!\"\r\n\tend", "title": "" }, { "docid": "093f8a379e0938ffeb1aad23b6eee401", "score": "0.6902751", "text": "def speak\n print \"Ho, ho, ho! Haaaappy holidays!\"\nend", "title": "" }, { "docid": "40dc53fed89c794c68a78b8f4043b0e1", "score": "0.69023085", "text": "def speak\r\n puts \"Ho, ho, ho! Haaappy holidays!\"\r\n end", "title": "" }, { "docid": "a4bea0e38163d9812875e9d8d60868f9", "score": "0.6858719", "text": "def speak\n #useses the name variable that all GoodDog objects are assigned at creation. Different for each instance\n \"#{@name} says Arf!\"\n end", "title": "" }, { "docid": "6591182164361eb0e00ef9c5b18c4258", "score": "0.68405384", "text": "def speak\n #\"#{@name} says arf!\"\n #\"#{name} says arf!\"\n \"#{self.name} says arf!\"\n end", "title": "" }, { "docid": "bc653ac305515c2d8d813e99be78033d", "score": "0.6837044", "text": "def play\n #tho I am sure there is a better way to define a virtual method... just gonna throw something\n raise 'Method play cannot be called directly. It must be overridden in a child class first.'\n end", "title": "" }, { "docid": "f45ca5793d016f5e93b2420fb26e8e89", "score": "0.6830261", "text": "def speak()\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end", "title": "" }, { "docid": "d832bbe02b628c59b7d4de55d7e9cac7", "score": "0.6803754", "text": "def speak\n \tputs \"Ho, Ho, Ho! Haaaaaappy holidays!\"\n end", "title": "" }, { "docid": "f169689e329e058a7358048dd97d26ce", "score": "0.6799078", "text": "def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end", "title": "" }, { "docid": "f169689e329e058a7358048dd97d26ce", "score": "0.6799078", "text": "def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end", "title": "" }, { "docid": "18d5e53c69df82062985e7206f7e3880", "score": "0.674973", "text": "def speak\n # access value referenced by @name with getter method\n \"#{name} says arf!\"\n # instance methods have access to instance variables\n end", "title": "" }, { "docid": "864a09cdefe4da8c667ea87825e4ad5b", "score": "0.67110723", "text": "def speak\n\t\t\tputs \"#{@name} said Ho, ho, ho! Haaaappy holidays!\"\n\t\tend", "title": "" }, { "docid": "1162113a1fdd42ab0dfc59af64e8b0ef", "score": "0.6651225", "text": "def speak\r\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\r\n\tend", "title": "" }, { "docid": "9f63a42a3a57fafeec51d073e36765dd", "score": "0.661881", "text": "def speak\r\n puts \"Ho, ho, ho! Haaaappy holidays!\"\r\n puts \"\"\r\n end", "title": "" }, { "docid": "f0644e674bac650063ec51a15950a7a9", "score": "0.66164047", "text": "def light_the_way\n HisMastersVoice.instance.tell_me(self)\n end", "title": "" }, { "docid": "ed998336cea2f09b791bc52bd60c548b", "score": "0.66104054", "text": "def part_of_speech\n raise NotImplementedError\n end", "title": "" }, { "docid": "6c810c550c228e5427885cc7b2c5c292", "score": "0.65925837", "text": "def talk\n puts \"Hello!\"\n end", "title": "" }, { "docid": "34fb90a09c817f79b3971c7d856eb09d", "score": "0.65882784", "text": "def speak\n\t\tputs \"Meow. My name is #{@name.capitalize}.\"\n\t\tputs \"I am #{@age} years old and I live in #{@location}\"\n\t\tputs \"I am a #{@colour.downcase} #{@breed.downcase}.\"\n\tend", "title": "" }, { "docid": "5fb4f3414bce10014ffd21e0f29300e1", "score": "0.65850776", "text": "def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\tend", "title": "" }, { "docid": "5fb4f3414bce10014ffd21e0f29300e1", "score": "0.65850776", "text": "def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\tend", "title": "" }, { "docid": "5fb4f3414bce10014ffd21e0f29300e1", "score": "0.65850776", "text": "def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\tend", "title": "" }, { "docid": "a05b9be18e42794fee5303cee995c3d4", "score": "0.65640193", "text": "def speak\n puts \"I am #{@name} and I am a #{@job}\"\n end", "title": "" }, { "docid": "5711c453d6386d77f26a3c68fc13018f", "score": "0.6563347", "text": "def speak\n object_instance = object_instances.last\n Liquid::Template.parse(text_to_voice).render(object_instance.try(:attributes))\n end", "title": "" }, { "docid": "af8f657524d9f800ed4772702a5bdb1b", "score": "0.6562594", "text": "def setSpeaker _obj, _args\n \"_obj setSpeaker _args;\" \n end", "title": "" }, { "docid": "cd99dc97fb9ca153bb0ab7e9023bd56f", "score": "0.6554068", "text": "def speak\n puts \"Ho, ho, ho! Haaaaappy holidays! I'm #{@name}!\"\n end", "title": "" }, { "docid": "f1ff9ea7bef0c2a10a489c5249d0a190", "score": "0.6516421", "text": "def setSpeech _obj, _args\n \"_obj setSpeech _args;\" \n end", "title": "" }, { "docid": "ba81b050ba3eb5698643606c75ce0c6b", "score": "0.6514125", "text": "def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\t\tputs \"\"\n\tend", "title": "" }, { "docid": "b5e5693bef94f7d808b9242f419faebc", "score": "0.6499507", "text": "def call\n system(SPEECH_COMMAND)\n end", "title": "" }, { "docid": "55942b1ff2a5752565e7212755e20e50", "score": "0.64841455", "text": "def talk\n puts 'Hello'\nend", "title": "" }, { "docid": "7b0b8dedbd7d1b494bf4c55d3d847dde", "score": "0.6469355", "text": "def talk\n puts \"Hello\"\nend", "title": "" }, { "docid": "494c7164aea175cfc74b6c7202abe292", "score": "0.64607465", "text": "def speak\n\t\tputs \"Haaaappy holidays!! Ho, ho, ho!\"\n\tend", "title": "" }, { "docid": "016d07b817aad508d0a5c8b7c802f9ff", "score": "0.6432271", "text": "def speak\n\t\tputs \"My name is #{@name}. I am a #{@colour} dog. I am #{@age} years old and live in #{@home}\"\n\tend", "title": "" }, { "docid": "4409c17d8f5f848e99426ff1b536b505", "score": "0.6385973", "text": "def speak\n puts \"Ho Ho Ho! Haaaaaappy holidays! from #{@name} Santa\"\n end", "title": "" }, { "docid": "eb62d541b6142978d72c4b0479f499e6", "score": "0.6377792", "text": "def speak(message = '', context = [])\n return @mouth.construct_sentence(message,context)\n end", "title": "" }, { "docid": "3a414e591339f2816e60e6e1dc8daf73", "score": "0.6342604", "text": "def speak(message, options = {})\n send_message(message)\n end", "title": "" }, { "docid": "0e75204fb81c23e13dbef6513a45bbc0", "score": "0.6341127", "text": "def process_ok\n Sound.play_ok\n super\n end", "title": "" }, { "docid": "8725ce237980e9790bb0eff12d0ea945", "score": "0.6328267", "text": "def talk(text, name)\n if @os == 'osx'\n `say \"#{ text }\" -v \"#{ name.strip }\"`\n else\n `echo \"#{ text }\" | espeak`\n end\n end", "title": "" }, { "docid": "f6a2c996a3c8486c82541fb6d6bc4da7", "score": "0.63263506", "text": "def speak\r\n\t\t# Prints holiday greeting\r\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\r\n\tend", "title": "" }, { "docid": "055bbc56885dea9c1e28b4470a7e6061", "score": "0.63194174", "text": "def speak(text=\"Destroy all robots\")\n system(\"say #{text}\")\n end", "title": "" }, { "docid": "9801364d90e15bcce895c53f623c58f6", "score": "0.6311984", "text": "def sound; end", "title": "" }, { "docid": "531a4ec1d8f9757eab920e450a9b7f1e", "score": "0.6311245", "text": "def directSay _obj, _args\n \"_obj directSay _args;\" \n end", "title": "" }, { "docid": "e58862eae8417c9f6ee6627dd9635abf", "score": "0.6286352", "text": "def speak_text(texttospeak)\r\n fixedmessage = texttospeak\r\n fixedmessage = fixedmessage.gsub(\"\\r\", \" \")\r\n fixedmessage = fixedmessage.gsub(\"\\n\", \" \")\r\n fixedmessage = fixedmessage.strip\r\n exec(\"AGI\", \"speak_text.agi|\\\"\" + fixedmessage + \"\\\"\")\r\n\tend", "title": "" }, { "docid": "022311d9c9fe0a1aa2a96e1e06e3a359", "score": "0.6285995", "text": "def talk\r\n puts \"Hi I'm #{@name}\"\r\n self\r\n end", "title": "" }, { "docid": "4a47c84d511d91b9083a5b0a1d9eff85", "score": "0.6258425", "text": "def play; end", "title": "" }, { "docid": "3ba6c3f7edbe4ec1e41206c2949820a2", "score": "0.625016", "text": "def raw_pause\n raise NotImplementedError, _(\"must be implemented in a subclass\")\n end", "title": "" }, { "docid": "d04f1b6b5e3ec261667438ff5f87876b", "score": "0.62384623", "text": "def say(speaker,text,outputList)\n\tif speaker =~ /(.*) : On \\d+\\/\\d+\\/\\d+, at \\d+:\\d+ \\w*, (.*) wrote/\n\t\tspeaker = $1.to_s\n\t\tquotedSpeaker = $2.to_s\n\t\tmessage = quoteAppend(speaker,quotedSpeaker)\n\telse\n\t\tmessage = speechAppend(speaker)\n\tend\n\tvoice = 'Bruce'\n\t#change these to the people in your chat. Won't work with many more people because of the limited number of voices.\n\tif speaker =~ /cody/i\n\t\tvoice = 'Ralph'\n\telsif speaker =~ /kidd/i\n\t\tvoice = 'Bruce'\n\telsif speaker =~ /hamstra/i\n\t\tvoice = 'Kathy'\n\telsif speaker =~ /munsch/i\n\t\tvoice = 'Princess'\n\telsif speaker =~ /schott/i\n\t\tvoice = 'Junior'\n\telsif speaker =~ /hennings/i\n\t\tvoice = 'Agnes'\n\telsif speaker =~ /aguiniga/i\n\t\tvoice = 'Zarvox'\n\telsif speaker =~ /brandon/i\n\t\tvoice = 'Whisper'\n\telsif speaker =~ /shah/i\n\t\tvoice = 'Vicki'\n\telsif speaker =~ /mcdonald/i\n\t\tvoice = 'Victoria'\n\telsif speaker =~ /williams/i\n\t\tvoice = 'Alex'\n\telsif speaker =~ /wadley/i\n\t\tvoice = 'Cellos'\n\tend\n\n\t#speak the text to .aiff files, track the files to later be combined\n\tif $current_speaker != speaker\n\t\t`say -v Fred \"#{message}\" -o recordings/\"#{$audio_file_count}\".aiff`\n\t\toutputList.write(\"file 'recordings/\"+$audio_file_count.to_s+\".aiff'\\n\")\n\t\t$audio_file_count+=1\n\t\t$current_speaker = speaker\n\tend\n\t`say -v #{voice} \"#{text}\" -o recordings/\"#{$audio_file_count}\".aiff`\n\toutputList.write(\"file 'recordings/\"+$audio_file_count.to_s+\".aiff'\\n\")\n\t$audio_file_count+=1\nend", "title": "" }, { "docid": "efd667a993b32864fe5deb5d4e291dbd", "score": "0.62343556", "text": "def sound\n raise NotImplementedError\n end", "title": "" }, { "docid": "4319b663a50df53f1e8454926ee82a7a", "score": "0.6214551", "text": "def play\n puts 'Playing'\n end", "title": "" }, { "docid": "c349db710f0004265968949d3f345604", "score": "0.61958224", "text": "def get_play() \n # \n end", "title": "" }, { "docid": "74297ecc5d7be7640e93bdfd2c980a84", "score": "0.6182361", "text": "def gen_speak_with_define_method(message)\r\n self.class.send(:define_method, :speak) do\r\n @speech_count += 1\r\n message\r\n end\r\n end", "title": "" }, { "docid": "2501cd0b780a4fd94d37ccd09538b4e6", "score": "0.6179298", "text": "def test_student_speak\n # @student.student_speak(\"I can talk!\")\n # assert_equal(\"I can talk!\", @student.student_speak(\"I can talk!\"))\n assert_equal(\"I can talk!\", @student.speak)\n end", "title": "" }, { "docid": "bc5f52009e302a26895da611ec557f21", "score": "0.6172398", "text": "def speak(message, options = {})\n send_message(message, options)\n end", "title": "" }, { "docid": "da113481795475a035aed999f253335e", "score": "0.6169607", "text": "def play\n end", "title": "" }, { "docid": "da113481795475a035aed999f253335e", "score": "0.6169607", "text": "def play\n end", "title": "" }, { "docid": "da113481795475a035aed999f253335e", "score": "0.6169607", "text": "def play\n end", "title": "" } ]
2272d60663764e9946079ccc9ce6fd9f
Shipped in with Sequel!
[ { "docid": "2dab87e3ac1c6fdd8572a80302ebd2f0", "score": "0.0", "text": "def validate\n super\n validates_presence :user\n validates_presence :account\n validates_presence :operation_type\n validates_presence :amount\n validates_presence :created_at\n validates_presence :updated_at\n validates_includes Operation.operation_types, :operation_type\n end", "title": "" } ]
[ { "docid": "ba25c81ca204cc0f50e6adb0314a5d54", "score": "0.60638326", "text": "def save\r\n\t\tpopulate_ships = '\r\n\t\tINSERT INTO ships (name, scan, signature, thrust, hull, armor, point_defense, group_sizes_id, tonnage, special, points, faction) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);' \r\n\t\t\t@db.execute(populate_ships, [@name, @scan, @signature, @thrust, @hull, @armor, @point_defense, @group_size, @tonnage, @special, @points, @faction])\r\n\tend", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.6013503", "text": "def commit; end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.6013503", "text": "def commit; end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.6013503", "text": "def commit; end", "title": "" }, { "docid": "34f510cc81fb4e7236fae7c011d3f12f", "score": "0.6009788", "text": "def flushdb; end", "title": "" }, { "docid": "d2ccf2c03b3072f0fe5a595e20b3d4c5", "score": "0.58448744", "text": "def save()\n # connect to the database\n db = PG.connect({dbname: 'bounty_tracker', host: 'localhost'})\n # write INSERT sql\n sql = \"INSERT INTO bounties (name, species, value, last_location) VALUES ($1, $2, $3, $4) RETURNING id \"\n # create a values array for exec_prepared statement\n values = [@name, @species, @value, @last_location]\n # prepare the statement\n db.prepare(\"save\", sql)\n # run the prepared statement\n @id = db.exec_prepared(\"save\", values)[0][\"id\"].to_i\n # close the db\n db.close()\n end", "title": "" }, { "docid": "34bf1e920f71e1049e815d3f289155fc", "score": "0.58310854", "text": "def sequel\n @db\n end", "title": "" }, { "docid": "f24692ec88dd68929516771749c5fab5", "score": "0.5823981", "text": "def send\n db.execute(@query, @values)\n end", "title": "" }, { "docid": "ee3a1e10d2c2a320e20c55c6de5ad284", "score": "0.580747", "text": "def save()\n db = PG.connect( { dbname: 'pizza_shop', host: 'localhost' })\n sql = \"INSERT INTO pizza_orders (\n first_name,\n last_name,\n quantity,\n topping)\n VALUES ($1, $2, $3, $4)\n RETURNING *\" # $1 etc avoids sql injection, and RETURNING returns that row\n # RETURNING * -- this returns all columns in an array format\n # RETURNING id -- this would return just the IDs in an array\n values = [@first_name, @last_name, @quantity, @topping]\n db.prepare(\"save\", sql) # puts the sql into \"save\"\n @id = db.exec_prepared(\"save\", values)[0][\"id\"].to_i # inserts/runs the values into \"save\" sql\n db.close() # and id is our first hash entry in our returned object, now it is saved\n end", "title": "" }, { "docid": "21bcb4b4b85701ca64b477147578fcea", "score": "0.5682015", "text": "def send_db_to_server\n log\n remote_do do |ssh|\n ssh.sftp.upload!(LOCAL_DB, REMOTE_DB)\n end\n end", "title": "" }, { "docid": "61cdc27a1a3d062d3eb721f8f5c4e1cd", "score": "0.5668638", "text": "def write_to_purchases(charge_local, user_cart_local, db_local)\n\tdb_local.execute(\"INSERT INTO purchases (email, created_at, product_id, amount, description, status, transfer) \n VALUES (?, ?, ?, ?, ?, ?, ?)\", [\"me@janedoe.com\", charge_local[:created], user_cart_local[0], charge_local[:amount], charge_local[:description], charge_local[:status], charge_local[:transfer]])\n\nend", "title": "" }, { "docid": "6c4379e04d84ac2ce5ad1e9850cb3ebd", "score": "0.56581146", "text": "def gcommit; end", "title": "" }, { "docid": "ddd49c18ac7cc5b9e3efc4ef9503f753", "score": "0.5650258", "text": "def save()\n #first connect to the database\n db = PG.connect( {dbname: 'Bounty', host:'localhost'} )\n # prepare an SQL statement in a big string\n sql = \"INSERT INTO Bounty_Tracks\n (\n name,\n species,\n bounty,\n danger_level\n )\n VALUES ($1,$2,$3,$4)\n RETURNING id\n \"\n\n #create a values of array for any prepare statement\n values = [@name, @species, @bounty, @danger_level]\n\n # use pg to run the prepared statement\n db.prepare(\"save\", sql)\n\n #run that prepared statement with pg\n @id = db.exec_prepared(\"save\", values)[0][\"id\"].to_i\n\n #finally, close the db connection\n db.close()\n\n end", "title": "" }, { "docid": "01e4d8265e7250b1ca0750ec9bddd4d3", "score": "0.5647923", "text": "def sequel_before_save\n save\n end", "title": "" }, { "docid": "c3397366676af44687748e749873c1b3", "score": "0.5639055", "text": "def db_addQuestion(pAppID, pQuestion, pAnswer, expires)\n $dbconn.query(\"INSERT INTO QUIZ_TABLE (APP_ID, QUESTION, ANSWER, expires) VALUES ('#{pAppID}', '#{pQuestion}', '#{pAnswer}', to_timestamp(#{expires}));\")\nend", "title": "" }, { "docid": "4f9854886fdb090551381386915c67a9", "score": "0.5625918", "text": "def update()\n db = PG.connect( { dbname:'pizza_shop', host:'localhost' } )\n sql = \"UPDATE pizzas \n SET first_name = '#{ @first_name }',\n last_name = '#{ @last_name }',\n topping = '#{ @topping }',\n quantity = #{ @quantity }\n WHERE id = #{@id}\"\n db.exec( sql )\n db.close()\nend", "title": "" }, { "docid": "f386986f781c32ad443ca3c0b8df478c", "score": "0.56110877", "text": "def remember_success(db, sort)\r\n\tputs \"All of them?\"\r\n\tprint db.execute(\"SELECT date, description FROM success\")\r\n\r\nend", "title": "" }, { "docid": "5cda7e86e817217784485659fef44203", "score": "0.55999255", "text": "def move_faves\n #clear faves tables\n addToNewDb \"truncate faves\"\n with_db(DB[:source]) do |db|\n res = db.query(\"select o,oid,uid,created from tracker\")\n res.each do |r|\n insert_values = []\n atp_columns = []\n #add user id\n atp_columns << \"user_id\"\n insert_values << r[2]\n #add created\n atp_columns << \"created_on\"\n insert_values << r[3]\n #add obj_type\n atp_columns << \"obj_type\"\n insert_values << TRACKER_TYPES[r[0]]\n #add obj_id\n atp_columns << \"obj_id\"\n insert_values << r[1]\n #insert into faves table\n stmt = \"INSERT INTO faves (#{atp_columns.join(\", \")}) VALUES ('#{insert_values.join(\"','\")}')\"\n addToNewDb stmt\n end \n end\nend", "title": "" }, { "docid": "ace6388c28f06cbf1691eb71d9ba9bbe", "score": "0.55863136", "text": "def save\n @data_inicio = Time.now\n sql = \"INSERT INTO packages \\\n (description, date_started, priority_id, pass_phrase, comment, url_source, url_subtitle) \\\n VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id\"\n\n begin\n rst = Banco.instance.db_connect.execute(sql, @nome, StrTime.timestamp(@data_inicio), \\\n @prioridade, @senha, @descricao, @url_fonte, \\\n @legenda)\n rescue Exception => e\n puts \"Erro no resultset. Não foi possível salvar o pacote \\\"#{@nome}\\\".\"\n puts \"#{e.message}\\nBacktrace: #{e.backtrace.join(\"\\n\")}\"\n @id_pacote = nil\n return\n end\n if rst == nil\n puts \"Resultset nulo. Não foi possível salvar o pacote \\\"#{@nome}\\\".\"\n @id_pacote = nil\n return\n end\n \n begin\n @id_pacote = rst.fetch_all[0][0]\n rescue Exception => e\n puts \"Erro no fetch: #{e.message}\\nBacktrace: #{e.backtrace.join(\"\\n\")}\"\n @id_pacote = nil\n end\n rst.finish\n Banco.instance.db_disconnect\n @id_pacote\n end", "title": "" }, { "docid": "0c8208955980205c33b85dde018f71b3", "score": "0.55798966", "text": "def save()\n#below we are assigning our database to a variable.\n db = PG.connect ( {dbname: 'pizza_shop', host: 'localhost'} )\n\n sql = \"INSERT INTO pizza_orders ( topping, quantity, customer_id) VALUES ('#{@topping}', #{@quantity}, #{@customer_id}) returning * ;\"\n @id = db.exec(sql)[0][\"id\"].to_i\n\n#we are pulling in our variables in the values section, and referring to our db in the INSERT INTO section (this part).\n\n # db.exec(sql)\n#want to make sure we close our connection to the database so we don't slow it down by continually running it.\n db.close \n return 'Success...'\n end", "title": "" }, { "docid": "5a9e6c9c3601db0b064f9a5e54c50638", "score": "0.55519235", "text": "def sequel\n owner.in_database.from(sequel_qualified_table_name)\n end", "title": "" }, { "docid": "2ca5c5c9a1c9613c98e77f3882fb1fe6", "score": "0.5537785", "text": "def write_to_database(item)\n puts \"Writing #{item} to database\"\n result = DB.write(item)\n puts 'Write compelete'\n result\nend", "title": "" }, { "docid": "6590c8dbf10071b7a515574a2411484b", "score": "0.5521722", "text": "def store_data\n \"SELECT name, age, score FROM game\"\nend", "title": "" }, { "docid": "c6cce22a91111263d5351267ecb9bc3c", "score": "0.55044276", "text": "def execute()\n\t\t\n\tend", "title": "" }, { "docid": "854b6516f4b581a7a7dad89c7e5ea1d6", "score": "0.5499322", "text": "def prepare_save_and_load_statement(conn)\n conn.prepare('save_statement', \"UPDATE #{namespace} SET marshal = $1 WHERE botname = $2;\")\n conn.prepare('load_statement', \"SELECT marshal FROM #{namespace} WHERE botname = $1;\")\n end", "title": "" }, { "docid": "2140915a011ff549ae7b6e5fbe82058b", "score": "0.5482028", "text": "def add_shelf(db, name)\r\n\tsql_str = \"INSERT INTO shelves (name) VALUES (?)\"\r\n\tdb.execute(sql_str, name)\r\nend", "title": "" }, { "docid": "d153a5341b8e159f7a0d622fb2ba93b7", "score": "0.54725796", "text": "def run_sql(sql) #this is the function to get the database going\n db= PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n return results\nend", "title": "" }, { "docid": "c1ecaac15d2f681cf5e83c2bfa81c692", "score": "0.5471787", "text": "def update()\n #connect to db\n db = PG.connect({dbname: 'bounties', host: 'localhost'})\n #creating sql statement to be prepared\n sql = 'update bounties\n SET(\n name,\n homeworld,\n danger_level,\n bounty_value\n ) =\n (\n $1, $2, $3, $4\n )\n WHERE id = $5\n '\n #creating array to be used to avoid SQL injection attack\n values = [@name, @homeworld, @danger_level, @bounty_value, @id]\n #run the prepared statement\n db.prepare('update', sql)\n #run as exec prepared with values and return the id assigned upon save.\n db.exec_prepared('update', values)\n #closing the connection\n db.close()\n end", "title": "" }, { "docid": "6083b3270475087151b3dc8ea22926fd", "score": "0.54703754", "text": "def sql; end", "title": "" }, { "docid": "6083b3270475087151b3dc8ea22926fd", "score": "0.54703754", "text": "def sql; end", "title": "" }, { "docid": "5c79ade974c4d196227c7c0c1244d08c", "score": "0.545386", "text": "def run(db,name,address,distance)\r\n\tdb.execute(\"INSERT INTO running(name,address,distance) VALUES(?,?,?)\",[name,address,distance])\r\nend", "title": "" }, { "docid": "2696ef16a491028232d0fe41aab10eac", "score": "0.5441064", "text": "def execute\n begin\n case @q[:method]\n when :get\n read\n when :post, :put, :patch\n write\n when :delete\n delete\n end\n rescue Sequel::Error => e\n CitySDKLD.format_sequel_error(e, @q)\n end\n end", "title": "" }, { "docid": "958eb03fb0f41fd891dfbc1d288f0c08", "score": "0.54346323", "text": "def save\n \tCSV.open(\"./db/gossip.csv\", \"a\") do |csv|\n \t csv << [@author, @content, @id]\n \tend\n end", "title": "" }, { "docid": "9ad287eae6e8f78203a455b72f027e82", "score": "0.542267", "text": "def do\n execute flush\n end", "title": "" }, { "docid": "fe663b0f34434512de42707e45bce4ef", "score": "0.5417451", "text": "def run_sql sql\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "title": "" }, { "docid": "fe663b0f34434512de42707e45bce4ef", "score": "0.5417451", "text": "def run_sql sql\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "title": "" }, { "docid": "620038967069d563d0aff314b42feb02", "score": "0.54082596", "text": "def create_products_table\n c = PGconn.new(:host => \"localhost\", :dbname => 'sinatrastore')\n c.exec %q{\n CREATE TABLE products (\n id SERIAL PRIMARY KEY,\n name varchar(255),\n price decimal,\n description text\n );\n }\n c.close\nend", "title": "" }, { "docid": "8bdb270674d26f437a86afd77d4ce06f", "score": "0.53993434", "text": "def save \n return true if DATABASE.execute(\"UPDATE #{table} SET name = '#{name}' WHERE id = #{@id};\")\n end", "title": "" }, { "docid": "03d9e928beade315dac9c0ccc2aa58b8", "score": "0.5399018", "text": "def execute(statement, *args)\n sql = Sequel.fetch(statement, *args).sql\n Mimi::DB.connection.run(sql)\n end", "title": "" }, { "docid": "ea9aef3ccf9cd3dbaab7f436609a86e9", "score": "0.5396187", "text": "def execute; fetch; nil; end", "title": "" }, { "docid": "bb8b7837c6a7df1da2a49a9e0a9a550b", "score": "0.5391154", "text": "def close\n\n @sequel.disconnect\n end", "title": "" }, { "docid": "bb8b7837c6a7df1da2a49a9e0a9a550b", "score": "0.5391154", "text": "def close\n\n @sequel.disconnect\n end", "title": "" }, { "docid": "750b7e79424917aa9007364e5ca6cc5b", "score": "0.5379718", "text": "def db_update_report(file,file_type)\n puts \"Upate the report table: #{file}, #{file_type} \"\n db = Sequel.connect(ENV['DATABASE_URL'])\n reports = db[:reports]\n my_title = \"Domain Portfolio - \" + file_type\n desc = \"Divisional workbooks - \" + file_type + \" Domain Portfolio. \"\n file_name = file.split(\"/\")[-1].split(\".\")[0] + \"-output.xlsx\"\n if reports.where(:division => file_type).count == 0\n reports.insert(title: my_title, division: file_type, department: \"IT\", created_at: Time.now, updated_at: Time.now, \\\n attachment_url: file_name, description: desc, published: true)\n else\n reports.where(:division => file_type).update(updated_at: Time.now, attachment_url: file_name, description: desc, \\\n published: true)\n end\n db.disconnect\n end", "title": "" }, { "docid": "b42c95438033b288c19d6f765c8c3c34", "score": "0.53779405", "text": "def insert_into_shop(name, id) \n shop = \"INSERT INTO petshop (name, id) VALUES ($1, $2)\"\n\n result = @db.exec_params(shop, [name, id])\n result.entries\nend", "title": "" }, { "docid": "2fc100a615785381573e09ca9ab3cab6", "score": "0.5370104", "text": "def flushdb!\n\t\t\t\t\tcall('FLUSHDB')\n\t\t\t\tend", "title": "" }, { "docid": "bf7e575bce73e7eec8f49c6975cfeb80", "score": "0.5368159", "text": "def commit_db_transaction; end", "title": "" }, { "docid": "bf7e575bce73e7eec8f49c6975cfeb80", "score": "0.5368159", "text": "def commit_db_transaction; end", "title": "" }, { "docid": "1a17c4d2c5c2867013b05c144d1d4a25", "score": "0.53659195", "text": "def commit; not_implemented; end", "title": "" }, { "docid": "3332fd71d558cc5ad110609fe675d2da", "score": "0.5365195", "text": "def create_inventory(db, name, quantity)\r\n db.execute(\"INSERT INTO inventory (name, quantity) VALUES (?, ?)\", [name, quantity] )\r\nend", "title": "" }, { "docid": "dde6fbc5f135ab6497d12a25b66500e8", "score": "0.53566223", "text": "def flushdb(options = T.unsafe(nil)); end", "title": "" }, { "docid": "b6b83a6e6aae0a2e9b9c52f21b99fdac", "score": "0.53532493", "text": "def case4()\r\n conn = IBM_DB.connect(\"DATABASE=#{database};HOSTNAME=#{hostname};PORT=#{port};UID=#{user};PWD=#{password}\",'','')\r\n IBM_DB.set_option conn, {IBM_DB::SQL_ATTR_AUTOCOMMIT => IBM_DB::SQL_AUTOCOMMIT_OFF},1\r\n stmt = IBM_DB.exec conn, \"insert into dealloctab(id, name) values (4, 'case4')\"\r\n if( !stmt )\r\n puts \"case 4 insertion failed\"\r\n end\r\n end", "title": "" }, { "docid": "554efc3a7671e269d5ea9f97335bfb61", "score": "0.53472173", "text": "def commit\r\n end", "title": "" }, { "docid": "9694bea789984fc83cb7be092f11b8aa", "score": "0.5343409", "text": "def send_object_to_simpledb\n if RAILS_ENV == \"test\"\n # we do nothing in the test env because we don't want to polute other people tests\n elsif RAILS_ENV == \"prueba\"\n ActiveRecordToSimpledb::Client.create(domain_name, self.attributes)\n else\n Resque.enqueue(ActiveRecordToSimpledb::JobQueue::Create, self.class.name, domain_name , self.id)\n end\n end", "title": "" }, { "docid": "3ffb5d154538614fb6c6b671f3d04f56", "score": "0.53361624", "text": "def save(id)\n CONNECTION.execute(\"UPDATE products SET general_info = '#{@general_info}', technical_specs = '#{@technical_specs}', where_to_buy = '#{@where_to_buy}' WHERE id = #{@id};\")\nend", "title": "" }, { "docid": "6697e6b88df3761b3cf4269c3ed1fbf8", "score": "0.5333987", "text": "def edit_shelf(db, id, name)\r\n\tsql_str = \"UPDATE shelves SET name = ? WHERE id = ?\"\r\n\tdb.execute(sql_str, name, id)\r\nend", "title": "" }, { "docid": "e688e156c47cf180d919af4796d48c07", "score": "0.5331266", "text": "def update()\n# def delete()\n db = PG.connect( { dbname: 'pizza_shop', host: 'localhost' } )\n # sql = \"DELETE FROM pizza_orders\"\n # sql = \"DELETE FROM pizza_orders WHERE id = $1\"\n sql = \"UPDATE pizza_orders SET (first_name, last_name, flavour, amount)= ($1, $2, $3, $4)\n WHERE id = $5\"\n values = [ @id, @first_name, @last_name, @flavour, @amount ]\n # values = [ @id ]\n\n # sql = \"SELECT * FROM pizza_orders\"\n db.prepare( \"update\", sql)\n orders_array_of_hashes = db.exec_prepared(\"update\")\n db.close()\n pizza_orders = orders_array_of_hashes.map {\n |hash_with_order_info| PizzaOrder.new (hash_with_order_info) }\n return pizza_orders\nend", "title": "" }, { "docid": "4304a0ffbfccd7445ca2549a2deb0aca", "score": "0.53243876", "text": "def transaction; end", "title": "" }, { "docid": "4304a0ffbfccd7445ca2549a2deb0aca", "score": "0.53243876", "text": "def transaction; end", "title": "" }, { "docid": "0930ae55a262ff328112582af8e5dad0", "score": "0.53180677", "text": "def caped\n DB.exec(\"DELETE FROM superheroes WHERE has_cape = TRUE;\")\nend", "title": "" }, { "docid": "8673e748ce57cd8dc1325ba6072363fa", "score": "0.53164387", "text": "def save\n \tCSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n \t\tcsv << [@author, @content]\n \tend \n end", "title": "" }, { "docid": "bf2175bac8a5dfbdc009aa76db9db1b1", "score": "0.5307163", "text": "def create_contact (rolodex, name, phone_number, email, mailing_address, comments)\r\n\trolodex.execute(\"INSERT INTO rolodex (name, phone_number, email, mailing_address, comments) VALUES (?, ?, ?, ?, ?)\", [name, phone_number, email, mailing_address, comments])\r\n\tputs \"Here is your updated rolodex\"\r\n\tview_rolodex(rolodex)\r\nend", "title": "" }, { "docid": "e8acbe39a4ade7e51333903a20a65f77", "score": "0.53065425", "text": "def update(host,ip,status)\n alertsdb = SQLite3::Database.new \"alerts.db\"\n alertsdb.execute(\"INSERT into alerts (name,ip,status)\n VALUES (?, ?, ?)\", [host, ip, status])\nend", "title": "" }, { "docid": "5cad5f8ac3c1aa8a2a8f7ba0509fa3af", "score": "0.52949166", "text": "def commit_db_transaction\n sweeper.ping\n result = super\n sweeper.ping\n result\n end", "title": "" }, { "docid": "e9e5de31a1ba18bb75c5df7498a3a391", "score": "0.5293431", "text": "def save\n connection = Sandwich.open_connection\n\n sql = \"INSERT INTO sandwich (title, description) VALUES ('#{self.title}', '#{self.description}')\"\n\n connection.exec(sql)\n end", "title": "" }, { "docid": "f10c0045328ff394e6e391900823e956", "score": "0.52926", "text": "def save\n \t\tCSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n \tcsv << [@author, @content]\n \t\tend\n\tend", "title": "" }, { "docid": "9bcc60a4f1f2f3c4bc2d152052a0c89b", "score": "0.5288075", "text": "def save()\n sql = \"INSERT INTO Items (name) VALUES ('#{ @name }')\"\n SqlRunner.run_sql( sql )\n return last_entry()\n end", "title": "" }, { "docid": "a78631d0d66c55df20a47164c1149866", "score": "0.528799", "text": "def to\n query = \"INSERT INTO #{@table} (#{@dataframe.vectors.to_a.join(',')}\"\\\n \") VALUES (#{(['?']*@dataframe.vectors.size).join(',')})\"\n sth = @dbh.prepare(query)\n @dataframe.each_row { |c| sth.execute(*c.to_a) }\n true\n end", "title": "" }, { "docid": "d75896e14ebf99bf11a034832addf56f", "score": "0.52826", "text": "def get_todos(sql_input)\n db = PG.connect(:dbname => 'to_do_list', :host => 'localhost')\n result = db.exec(sql_input)\n db.close\n result\nend", "title": "" }, { "docid": "ed82f5b7ba1c957c8559b2fb53172a72", "score": "0.5275869", "text": "def run_sql(sql)\n db = PG.connect(:dbname => 'address_book', :host => 'localhost')\n result = db.exec(sql)\n db.close\n result\nend", "title": "" }, { "docid": "36efb73e43bfdde2eecaca51c358ecc8", "score": "0.5274203", "text": "def scheduler(db, name, species, diet, fed)\r\n\tchart.execute(\"INSERT INTO pets (name, species, diet, fed) VALUES (?, ?, ?, ?)\", [name, species, diet, fed])\r\nend", "title": "" }, { "docid": "5cb1988a8cfa67ef895e8a1960635876", "score": "0.52738875", "text": "def db_queue columns, data\n column_sql = columns.join(', ')\n #wrap string data types in single quotes, otherwise let it be (ie Numeric should stay numeric)\n data_quoted = data.collect do |o|\n ret = o\n if o.is_a?(String)\n o = SQLite3::Database.quote(o) #need to escape single quotes, not c-style for sqlite, but two single quotes\n ret = \"'#{o}'\"\n elsif o == nil\n ret = 'NULL'\n end\n ret\n end\n data_sql = data_quoted.join(', ')\n sql = %{INSERT INTO %s ( %s ) VALUES ( %s ) } % [self.class.table_name(), column_sql, data_sql]\n #puts 'queued from detective to ' + @db_queue.size.to_s #@db_queue.to_s\n @db_queue << [sql]\n true\n end", "title": "" }, { "docid": "59d86938f3f6ca6d4ad5efc47225427a", "score": "0.52727884", "text": "def save()\n sql = \"INSERT INTO plastics (type, existence, weight, conversion_factor, recycable) VALUES ($1, $2, $3, $4, $5)\n RETURNING id;\"\n values=[@type, @existence, @weight, @conversion_factor, @recycable]\n results = SqlRunner.run(sql, values)\n @id = results.first()['id'].to_i\nend", "title": "" }, { "docid": "6971befab3900a25218487447fbdb528", "score": "0.52724373", "text": "def return_pair\n\tputs \"What is the id number of the pair of needles you have back in your collection?\"\n\tndl = gets.chomp.to_i\n \t$kdb.execute(\"UPDATE knitndls SET is_available = 'true', where_is_it = '' WHERE id = #{ndl}\")\n\nend", "title": "" }, { "docid": "e986f388b8191934195f33d4d88e6d2e", "score": "0.5271293", "text": "def save()\n\n db = PG.connect({dbname: \"space_cowboys\", host: \"localhost\"})\n\n sql = \"INSERT INTO cowboys (name, bounty_value, homeworld, last_known_location)\n VALUES\n ($1, $2, $3, $4) RETURNING id;\"\n\n values = [@name, @bounty_value, @homeworld, @last_known_location]\n\n db.prepare(\"Save\", sql)\n\n result = db.exec_prepared(\"Save\", values)\n\n db.close()\n\n @id = result[0][\"id\"].to_i\n end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5270743", "text": "def execute; end", "title": "" }, { "docid": "f966fbc6788da659dc7c4010f4a0ec6a", "score": "0.5270385", "text": "def sequel_persist\n record.save_changes(validate: false)\n end", "title": "" }, { "docid": "f966fbc6788da659dc7c4010f4a0ec6a", "score": "0.5270385", "text": "def sequel_persist\n record.save_changes(validate: false)\n end", "title": "" }, { "docid": "dd9366cddcc024a067db7ea4918f2234", "score": "0.5268961", "text": "def add_to_database\n # Tell the user what's going on\n puts \"> Ansluter till databasen\".green\n # Connect to the database\n conn = PG.connect( dbname: DB_DATABASE_NAME, user: DB_USER, password: DB_PASSWORD )\n\n # Tell the user what's going on\n puts \"> Lägger till användaren i databasen\".green\n # Insert the account into the correct table\n conn.exec_params \"INSERT INTO #{DB_ACCOUNTS_TABLE} (userid, password, realname, uid, gid, home, mail)\" +\n \" VALUES ($1, $2, $3, $4, $5, $6, $6)\",\n [$email, $enc_password, $name, $uid, $gid, $user_path] unless $simulate\n\n # Tell the user what's going on\n puts \"> Kopplar från databasen\".green\n # Close the connection\n conn.close\nend", "title": "" }, { "docid": "415f6e71409314de4dec07a7d6ae90eb", "score": "0.52678066", "text": "def save\n CSV.open('./db/gossip.csv', 'ab') do |csv|\n csv << [@author, @content]\n end\n end", "title": "" }, { "docid": "0b5693baf8925262701c779caf4604c9", "score": "0.52662265", "text": "def save\n # Build a String of SQL, that will insert all the attributes into the persons table\n\n # Execute the SQL on the @@db object \n end", "title": "" }, { "docid": "eb2deaca48e040598eac5651d206b145", "score": "0.5265617", "text": "def signup_skaters(db, name, age, stance)\r\n db.execute('INSERT INTO skaters (name, age, stance) VALUES (?,?,?)', [name, age, stance])\r\nend", "title": "" }, { "docid": "a9f80590745898b7ae413688fb42402d", "score": "0.5260149", "text": "def update_sql; end", "title": "" }, { "docid": "11544a1f9052b32d3579d6a041097ad8", "score": "0.52562237", "text": "def commit\n\t\t@connection.commit\n\tend", "title": "" }, { "docid": "4cf11103db14755e705274abccd49c21", "score": "0.52548134", "text": "def query\n commit(:query, nil, {})\n end", "title": "" }, { "docid": "b8f6f4803ece866cba5d07bcf0b3e870", "score": "0.52531713", "text": "def db_update_zone_transferable(portfolio)\n puts \"Upate the zone transferable flag in the domain table. \"\n db = Sequel.connect(ENV['DATABASE_URL'])\n domains = db[:domains]\n tracker=Wmap::DomainTracker.instance\n portfolio.each do |index, record|\n my_domain = record[\"Domain Name\"]\n next if my_domain.nil?\n next if my_domain.empty?\n next if my_domain.strip.empty?\n zone_transfer = tracker.known_internet_domains[my_domain]\n if zone_transfer\n puts \"#{my_domain} is transferable\"\n else\n puts \"#{my_domain} is not transferable\"\n end\n puts \"Update the transferable flag: #{zone_transfer}\"\n domains.where(name: my_domain).update(transferable: zone_transfer)\n end\n tracker=nil\n db.disconnect\n end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.5249855", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.5249855", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.5249855", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.5249855", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "0e543afa5dc2ea53c4909827f6f3958b", "score": "0.5247317", "text": "def create_puppy (db,name,age) \r\n\tdb.execute(\"INSERT INTO puppy (name,age) VALUES (?,?)\", [name,age])\t\r\nend", "title": "" }, { "docid": "7b71b89d5b07a340e6dd252175e8050f", "score": "0.52458787", "text": "def save\n CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n csv << [@author, @content]\n end\n end", "title": "" }, { "docid": "ea0bf024573d32eba392a9439b3660ef", "score": "0.5243339", "text": "def execute()\n\n end", "title": "" }, { "docid": "ea0bf024573d32eba392a9439b3660ef", "score": "0.5243339", "text": "def execute()\n\n end", "title": "" } ]
ca90d281b8d50c0790b6b4cd8dfaca24
, :only => ["new", "create", "email_unique"] GET /users GET /users.json
[ { "docid": "71d26c2dbb2d70e395b69478e8687863", "score": "0.0", "text": "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" } ]
[ { "docid": "6da6e5b8fb2dc1dc1b22a598f08b621b", "score": "0.696927", "text": "def users\n\n end", "title": "" }, { "docid": "6da6e5b8fb2dc1dc1b22a598f08b621b", "score": "0.696927", "text": "def users\n\n end", "title": "" }, { "docid": "b1d149c27ecbdf16afd6c34062cfd2e6", "score": "0.6932544", "text": "def index\n @users = User.all \n respond_to do |format|\n format.json { render json: @users, :only => [:id,:email,:name]}\n end\n end", "title": "" }, { "docid": "e38b2ac61f6b0785dfc1d99415c3b349", "score": "0.6877445", "text": "def get\n\t\tuser = User.find_by_id(params[:id])\n\n\t\tif user\n render json: user.attributes.extract!('email', 'first_name', 'last_name', 'created_at').to_json\n\t\telse\n render status: 204\n\t\tend\n\tend", "title": "" }, { "docid": "6751b411e2035508b7ef9dc8c023e683", "score": "0.6748475", "text": "def users\n end", "title": "" }, { "docid": "c3e144158d5c004dafd4a33863fba089", "score": "0.6649237", "text": "def show\n respond_with(@user, only: [:id, :email, :first_name, :last_name])\n end", "title": "" }, { "docid": "aabad53664886b88d1c7728573026ad0", "score": "0.66321486", "text": "def unique_field\n user = User.where(username: params[:field]).or(User.where(email: params[:field]))\n render json: user.present?, status: :ok\n end", "title": "" }, { "docid": "f3b91bf8b3b4807aab0fe737715cb501", "score": "0.65697426", "text": "def user_create\n\t\trespond_to do |format|\n\t\t\tnew_user = User.new params.require(:user).permit(:username, :email, :password, :password_confirmation)\n\t\t\tif User.where(:email => new_user.email).count > 0\n\t\t\t\tformat.json { render json: { \"error\" => \"Email ID already taken!\" }, status: 400 }\n\t\t\telsif User.where(:username => new_user.username).count > 0\n\t\t\t\tformat.json { render json: { \"error\" => \"Username already taken!\" }, status: 400 }\n\t\t\telsif new_user.password != new_user.password_confirmation\n\t\t\t\tformat.json { render json: { \"error\" => \"Passwords don't match! Check, and try again.\" }, status: 400 }\n\t\t\telsif new_user.save\n\t\t\t\tformat.json { render json: { \"res\" => new_user }, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: { \"error\" => \"Error while creation!\"}, status: 500 }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "79eb34e35cdc60480577ca8e26af9e38", "score": "0.6551597", "text": "def create\n \n #Creating users manually is not allowed\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n \n end", "title": "" }, { "docid": "79eb34e35cdc60480577ca8e26af9e38", "score": "0.6551597", "text": "def create\n \n #Creating users manually is not allowed\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n \n end", "title": "" }, { "docid": "fa7df8e2f3ec4adcac1ab0b90173402f", "score": "0.6493634", "text": "def show \n # retrieve user data from request (params)\n first_name = params[:first_name]\n last_name = params[:last_name]\n email = params[:email]\n\n # query DB for the retieved data\n @user = User.where({:first_name => first_name, :last_name => last_name, :email => email})\n json_response(@user)\n end", "title": "" }, { "docid": "02f8d6a4854fb42fefbbc61a3afb5e86", "score": "0.648432", "text": "def index \n #Show all users \n @users = User.all\n render json: @users.as_json(only: [:id, :first_name, :last_name, :email, :created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at])\n end", "title": "" }, { "docid": "9f7c735ace683c5c2b12c914cc9ad8a8", "score": "0.64778084", "text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end", "title": "" }, { "docid": "7b58cdfa23668d141a97c6a8651e353d", "score": "0.6460702", "text": "def user_by_email\n @user = User.where(email: params[:email])\n json_response(@user)\n end", "title": "" }, { "docid": "d87fcdc6ec775b3d18120038dbc4f376", "score": "0.6451661", "text": "def new_list_users\n\n end", "title": "" }, { "docid": "00d8231377663fadc07eec982d166c0e", "score": "0.64463615", "text": "def unique_field\n user = User.where(username: params[:field]).or(User.where(email: params[:field]))\n render json: user.present?, status: :ok\n end", "title": "" }, { "docid": "8439050a6b1251b042932e44dbf93648", "score": "0.64278716", "text": "def index\n @users = User.all\n render json: @users.as_json(except: [:password_digest]), status: :ok\n end", "title": "" }, { "docid": "b246439d014084c5e8ee13813a60ba49", "score": "0.64253736", "text": "def index\n @users = User.all\n render json: @users, except: [:password_digest]\n end", "title": "" }, { "docid": "942e9267d60d38cde812d4eeb9779a93", "score": "0.64118147", "text": "def index\n users = apply_pagination User.fetch_and_cache\n\n users = users.as_json(only: [:id, :email])\n render json: users\n end", "title": "" }, { "docid": "18390125ca1d8381cc3e2147f8ea033b", "score": "0.64032876", "text": "def create\n email = params[:email]\n password = params[:password]\n first_name = params[:first_name]\n last_name = params[:last_name]\n @user = User.new(email: email, password: password, \n first_name: first_name, last_name: last_name)\n if @user.save\n respond_with(@user, only: [:id, :email])\n else\n render_error(404, request.path, 20001, @user.errors.as_json)\n end\n end", "title": "" }, { "docid": "6bbb4bc1303f9011da8bcc971a27aa25", "score": "0.6394972", "text": "def users\n get '/users'\n end", "title": "" }, { "docid": "789e506cb45cda5c32c853569029df11", "score": "0.63941056", "text": "def user_create(params = {})\n data = { 'createUser' => 1 }\n authorizable_id = search_hash!(params, :authorizable_id, :authorizableId, :authoriziableid, :id, :username)\n password = search_hash!(params, :password)\n\n data['authorizableId'] = authorizable_id\n data['rep:password'] = data['rep:re-password'] = password\n\n ### OPTIONAL PARAMETERS ##\n title = search_hash!(params, :title)\n given_name = search_hash!(params, :given_name, :givenName, :givenname, :first_name, :firstName, :firstname) || 'undefined'\n family_name = search_hash!(params, :family_name, :familyName, :familyname, :last_name, :lastName, :lastname) || 'undefined'\n job_title = search_hash!(params, :job_title, :jobTitle, :jobtitle)\n gender = search_hash!(params, :gender)\n about_me = search_hash!(params, :about_me, :aboutMe, :aboutme, :about)\n\n email = search_hash!(params, :email, :email_address) || 'undefined'\n phone_number = search_hash!(params, :phone_number, :phoneNumber, :phonenumber)\n mobile = search_hash!(params, :mobile, :mobile_phone_number)\n\n street = search_hash!(params, :street, :street_address, :streetAddress, :streetaddress)\n city = search_hash!(params, :city)\n state = search_hash!(params, :state)\n country = search_hash!(params, :country)\n postal_code = search_hash!(params, :postal_code, :postalCode, :postalcode, :zip_code, :zipCode, :zipcode)\n\n data['./profile/givenName'] = given_name #if given_name\n data['./profile/email'] = email #if email\n data['./profile/phoneNumber'] = phone_number #if phone_number\n data['./profile/street'] = street #if street\n data['./profile/city'] = city #if city\n data['./profile/country'] = country #if country\n data['./jcr:title'] = title #if title\n data['./profile/familyName'] = family_name #if family_name\n data['./profile/jobTitle'] = job_title #if job_title\n data['./profile/mobile'] = mobile #if mobile\n data['./profile/postalCode'] = postal_code #if postal_code\n data['./profile/state'] = state #if state\n data['./profile/gender'] = gender #if gender\n data['./profile/aboutMe'] = about_me #if about_me\n\n http_post_form('libs/granite/security/post/authorizables.html', data)\n return true if response.code == '201'\n false\n end", "title": "" }, { "docid": "f69993e4c469fdefd703391a3545299b", "score": "0.6369193", "text": "def show\n @user = User.find_by_sim_serial_number(params[:id])\n .to_json(only: [:id, :sim_serial_number, :notify, :username, :role, :phone_number, :email, :first_name, :last_name, :address, :cached_votes_up, :cached_votes_down])\n\n render json: @user\n end", "title": "" }, { "docid": "51eb4f3cf0d33832d7253df3a172df04", "score": "0.6368284", "text": "def getAll\n @users = User.all\n if (@users.first)\n render json: @users.to_json(only: [:identity, :pubkey_user])\n else\n @status_code = {:status_code => 413}\n render json: @status_code\n end\n end", "title": "" }, { "docid": "c974e5531f2e31031dc66313f9870e21", "score": "0.6361806", "text": "def user\n render json: { user: current_user.email }\n end", "title": "" }, { "docid": "db9549bc1bd1c77553460aab3dd11631", "score": "0.6354433", "text": "def create\n\n if params[:email]\n user = User.where(\"email = ?\", params[:email])\n if user.empty?\n user = User.new(user_params)\n \t\t\t\tif user.save\n \t\t\t\t\trender json: {status: 'SUCCESS', message:'Saved user', data:user},status: :ok\n \t\t\t\telse\n \t\t\t\t\trender json: {status: 'ERROR', message:'User not saved', data:user.erros},status: :unprocessable_entity\n \t\t\t\tend\n else\n render json: {status: 'ERROR', message:'E-mail já esta cadastrado!', data:user},status: :ok\n end\n else\n render json: {status: 'ERROR', message:'Usuário não informado'},status: :unprocessable_entity\n end\n\n\t\t\tend", "title": "" }, { "docid": "1385007dd77ba63969af219140e5e820", "score": "0.63521874", "text": "def all\n Request::Users.list.map { |user| new user }\n end", "title": "" }, { "docid": "a964a25cd3424896d6da09e5e2143252", "score": "0.63495934", "text": "def user_new\n\t\tpayload = JSON.parse request.raw_post\n\t\tuser_name = payload[\"user_name\"]\n\t\tpassword = payload[\"password\"]\n\t\tuser = User.find_by_user_name user_name\n\t\tif user\n\t\t\trender :json => {\"error\" => \"user already exists\"}, :status => :bad_request\n\t\telse\n\t\t\tuser = User.new\n\t\t\tuser.user_name = user_name\n\t\t\tuser.password = password\n\t\t\tuser.save\n\t\t\trender :json => user || {}\n\t\tend\n\tend", "title": "" }, { "docid": "74127f2316cc36a7d217c8a664c4f89a", "score": "0.63416815", "text": "def details\n @user = User.find(params[:id])\n .to_json(only: [:id, :sim_serial_number, :username, :role, :phone_number, :email, :first_name, :last_name, :address, :cached_votes_up, :cached_votes_down])\n\n render json: @user\n end", "title": "" }, { "docid": "512f81425caa499107dbe856c89173f9", "score": "0.63316756", "text": "def users\n @page = 'users'\n respond_to do |format|\n format.html {\n @users = User.find(:all)\n @admins = User.admins_and_creators\n @pending_users = User.pending_users\n }\n format.json {}\n end \n end", "title": "" }, { "docid": "f5c6da9a09803beff3802068e7c33ce1", "score": "0.63315886", "text": "def create_user(data) \n #query for users\n users = self.class.get(\"/users\", @options)[\"users\"]\n #search for user by email\n user = users.find { |e| e['email'] == data[\"email\"].chomp}\n if user\n #found user, let's use it\n return user\n end\n \n #no user found, create one\n options = @options\n options.merge!({ \n :body => { \n :user => data\n }.to_json\n })\n self.class.post(\"/users\", options)[\"user\"]\n end", "title": "" }, { "docid": "136ae12f5b37308660245ab3ded20377", "score": "0.6325387", "text": "def get_user_info\n user = User.select(:email, :created_at).find_by(id: current_user.id)\n render json: user\n end", "title": "" }, { "docid": "6d9de18ae98f17d475ade954902088de", "score": "0.6314735", "text": "def index\n\t\t @users = User.all\n\n\t\t if @users.present?\n\t\t\t render json: @users\n\t\t\t #render json: @users.map{|u| {email: u.email, name: u.name} }\n\t\t\t #render json: @users.map{|category| {:name => category.name, :email => category.email} }\t\n\t\t\telse\n\t\t\t\trender json: {:message => \"Nothing Found\"}\n\t\t\tend\n\n\t\t end", "title": "" }, { "docid": "469694f3d6a2e7593e8b2462ac774546", "score": "0.6311964", "text": "def index\n @users = User.all(:order => \"UPPER(first_name) ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users.to_json(:except => [:hashed_password,:salt, :created_at, :updated_at, :administrator]) }\n end\n end", "title": "" }, { "docid": "1fa340328c780cc7bc2a4bc7079f2724", "score": "0.631093", "text": "def fetch_user_details\n get('users/list')\n end", "title": "" }, { "docid": "d91158c6eb538997c00d10adac9d4651", "score": "0.63026565", "text": "def show\n render json: @user, :except => [:password_digest, :facebook_id], status: :ok\n end", "title": "" }, { "docid": "3329c567e2ea579c191d2c0c825ffa3f", "score": "0.630031", "text": "def new\n @users = User.new\n @all_users = User.all\n end", "title": "" }, { "docid": "c1e91c0e57d93facbe184223575a72c7", "score": "0.6299756", "text": "def create\n if params[:mode] == \"fb\"\n @graph = Koala::Facebook::API.new(params[:fbToken])\n profile = @graph.get_object(\"me\")\n\t\t @user = User.new(user_params_fb(profile)) \n else\n emailcheck = /\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i =~ params[:email]\n if emailcheck.nil?\n print \"Email Wrong Format.\"\n rtn = {\n errormsg: \"Email Wrong Format.\",\n status: \"401\"\n }\n end\n @user = User.new(user_params)\n end\n\t\tif @user.save\n\t\t\t@user = createFilters(@user)\n\t\t\tprint \"Successfully creat a user.\"\n\t\t\trtn = {\n errormsg: \"You succeed!\",\n\t\t \tstatus: \"200\"\n\t\t }\n\t\t\trender :json => rtn\n\t\telse\n\t\t\tif !User.find_by(email: params[:email]).nil?\n \t\t\trtn = {\n errormsg: \"Existing email!\",\n \t\t \tstatus: \"401\"\n \t\t }\n end\n rtn = {\n errormsg: \"Other Faults.\",\n status: \"401\"\n }\n\t\t\trender :json => rtn\n\t\tend\n\tend", "title": "" }, { "docid": "3ae7a999809f729ebe43866357574c3a", "score": "0.6288188", "text": "def index\n # alleen beschikbaar met gebruikersbeheer rechten\n if not @api_user.can_add_users\n render_status :forbidden\n return\n end\n \n @users = ApiUser.where(customer_id: @api_user.customer_id)\n render json: @users, :except => [:password_digest]\n end", "title": "" }, { "docid": "c6c22ff08bd2d7bda8442cd505c6f89d", "score": "0.62797135", "text": "def new\n @users =User.new\n authorize User\n end", "title": "" }, { "docid": "e207204a11515a5ae49c0482b0b8fe1f", "score": "0.62554896", "text": "def user\n render :json => User.find(params[:id]).to_json\n end", "title": "" }, { "docid": "dcf86ae36f0a3794e96c047d7e977a82", "score": "0.62506247", "text": "def create\n @user = User.new(:last_name=>params[:last_name], \n \t:first_name=>params[:first_name],\n \t:email=>params[:email]\n )\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(@user, :notice => 'User was successfully created.') }\n format.json { render :json => { :success => true, :users => [@user], :id=>@user.id } }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => { :success => false} }\n end\n end\n end", "title": "" }, { "docid": "161f0399a893fc58703e0051952ac627", "score": "0.6244955", "text": "def index\n @users = User.order('created_at DESC').select { |u| can? :view, u }\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n format.html\n end\n end", "title": "" }, { "docid": "ce3d054916ec1cff59d05c5427b13821", "score": "0.62425405", "text": "def create\n\t\t\tif get_params().has_key?(\"email\") \n\t\t\t\tuser = User.where email: get_params()[:email]\n\t\t\t\tif user.size > 0\n\t\t\t\t\tuser = user.first\n\t\t\t\t\tuser.password = get_params()[:password]\n\t\t\t\t\tif user.encrypt == user.encrypted_password\n\t\t\t\t\t\tAbility.new user\n\t\t\t\t\t\t@token = user.tokens.last\n\t\t\t\t\t\t@token = user.create_token unless @token\n\t\t\t\t\t\t@user = user\n\t\t\t\t\t\t@current_user = user\n\t\t\t\t\t\tRails.cache.write \"token:#{@token.token}\", @token, expires_in: 30.minutes\n\t\t\t\t\t\trender :template => \"api/#{controller_name}/show\"\n\t\t\t\t\telse\n\t\t\t\t\t\trender(:json => {error: \"Senha incorreta\"}, :status => 403)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender(:json => {error: \"E-mail inválido\"}, :status => 403)\n\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\trender(:json => {error: \"E-mail não foi preenchido\"}, :status => 400)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "543509c6588e2f79a8dbcd1cdcdaf7b9", "score": "0.6233112", "text": "def users\n try_json get('/user')\n end", "title": "" }, { "docid": "017d848c9897540ea7bc67c9d5139cf4", "score": "0.62260103", "text": "def users(opts={})\n get(\"/api/users\", opts)\n end", "title": "" }, { "docid": "f4209785494a96f07d5c97ed400eb26d", "score": "0.6218751", "text": "def index\n\t authorize! :read, User\n\t users = current_user.admin? ? User.all : [current_user]\n\t render json: users, status: :ok\n\tend", "title": "" }, { "docid": "7192ec11ec312baac0d2ac4738bad8a3", "score": "0.6216681", "text": "def index\n authorize! :read, User\n @users = User.all\n\n render json: @users\n end", "title": "" }, { "docid": "7515bbbc2655f3d3be7485e25d0b0659", "score": "0.6212211", "text": "def index\n users = User.select(:id, :firstname, :lastname)\n json_response(users)\n end", "title": "" }, { "docid": "124637186608fa13d4023900b7b53220", "score": "0.6211529", "text": "def index\n #@users = [User.find(current_user.id)]\n @users = User.find(:all, :order => \"email ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "title": "" }, { "docid": "0c6476ef6a283ef342d6514756380eec", "score": "0.6203606", "text": "def edit\n user = User.find(params[:id])\n render json: user, only: [:username, :name, :location, :bio, :resource_request, :skills, :seeking, :preferred_contact], status: 200\n end", "title": "" }, { "docid": "abd08d23c31e290565fe9074a6a6299e", "score": "0.61916065", "text": "def users\n if current_user.admin == true\n @users = User.order(\"email ASC\").paginate(page: params[:page])\n @users.each do |user|\n user.avatar_file_name = URI.join(request.url, user.avatar.url).path\n end\n respond_to do |format|\n format.json { render json: @users }\n format.html { }\n end\n else\n respond_to do |format|\n format.json { render json: {error: 'Permisos insuficientes.'} }\n format.html { redirect_to root_path, notice: 'Permisos insuficientes.' }\n end\n end\n end", "title": "" }, { "docid": "a2b4026fca8594132d53b65449e37431", "score": "0.6187992", "text": "def new\n @users = User.all\n if session[:user_id] != nil # the current user: registered and logged in\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html { redirect_to :controller => \"users\", :action => \"index\" }\n format.json { head :no_content }\n end\n else\n @credential = Credential.new\n respond_to do |format|\n format.html\n format.json { render json: @credential }\n end\n end\n\n end", "title": "" }, { "docid": "ea914d0c5c9b7291850cd10276fd5c8c", "score": "0.61856073", "text": "def create\n user = User.find_by_email(params[:user][:email])\n unless user\n @user = User.new(user_params)\n if @user.save\n render json: {id: @user.id}\n else\n render json: {id: nil}\n end\n else\n render json: {id: user.id}\n end\n \n\n # respond_to do |format|\n # if @user.save\n # format.html { redirect_to @user, notice: 'User was successfully created.' }\n # format.json { render :show, status: :created, location: @user }\n # else\n # format.html { render :new }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "e7baf821d3450ee524198e9dc9a94db6", "score": "0.6183712", "text": "def index\n render json: User.all\n end", "title": "" }, { "docid": "f1d7f4552d07ad519b6ce9870c79691f", "score": "0.61788875", "text": "def new\n\t\temail = params[:email]\n\t\tname = params[:name]\n\n respond_to do |format|\n @user = User.new\n format.html # new.html.erb\n format.json { render json: @user }\n end\n\tend", "title": "" }, { "docid": "3ae67ae60bae98de51d02adb43f3c9cc", "score": "0.61787206", "text": "def index\n # Questions about scope resolution\n # This is going to be the function that logs a user in\n # @user_instance = User.new\n # byebug\n @user = User.authenticate(params[:email], params[:password])\n render json: @user, only: [:token, :email, :id, :phone_number, :business_name, :name]\n\nend", "title": "" }, { "docid": "e2996eb40d1807f5e4272ec610d88f27", "score": "0.6176466", "text": "def get_all_users\n logger.debug(\"the user email you sent is : #{params[:email]}\")\n user = User.find_by(email: params[:email])\n client_application = user.client_application\n client_all_users = client_application.users\n users_details_array = Array.new\n\n client_all_users.each do |u|\n uid = u.id.to_s\n uname = u.name\n uemail = u.email\n ucc = u.cc\n upcp = u.pcp\n user_details = {id: uid, name: uname, email: uemail, cc: ucc, pcp: upcp }\n users_details_array.push(user_details)\n end\n render :json=> {status: :ok, :users_data=> users_details_array }\n\n # resource = User.find_for_database_authentication(:email=>params[:email])\n # return invalid_login_attempt unless resource\n\n # if resource.valid_password?(params[:password])\n # # sign_in(\"user\", resource)\n # user = User.find_by_email(params[:email])\n # render :json=> {status: :ok,message: \"Login Successful\", data: {:user_id=>user.id.to_s, :auth_token => user.api_token}}\n # return\n # end\n\n end", "title": "" }, { "docid": "b93fef4ffd1fb11afbb1c8f438c4e73e", "score": "0.6174682", "text": "def index\n\n @users = User.all\n email_exists = !params[:email].blank?\n if email_exists\n @users = User.where(\n [\"email = ?\", params[:email]]\n )\n else\n @users\n end\n # TODO\n\n end", "title": "" }, { "docid": "03522e969ce392e104dfd0ac6f758066", "score": "0.6171016", "text": "def profile\n render json: { username: @user.username, email: @user.email }\n end", "title": "" }, { "docid": "8c02fb66170675ca87b246f781d8c34c", "score": "0.6170999", "text": "def create\n @user = User.new(user_params)\n\n if authenticated_request?\n return render_admin_only unless logged_in_as_admin?\n elsif not @user.is_a? Customer\n return render_unauthorized\n end\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\trescue ActiveRecord::RecordNotUnique\n\t\trender json: @user.attributes.slice(\"email\"), status: :conflict\n end", "title": "" }, { "docid": "7d4e2bcfeab54d908ff4870ebca59f91", "score": "0.6170377", "text": "def index\n respond_with User.all\n end", "title": "" }, { "docid": "7d4e2bcfeab54d908ff4870ebca59f91", "score": "0.6170377", "text": "def index\n respond_with User.all\n end", "title": "" }, { "docid": "47e58634dc6a1375d758c8a6d4d277ed", "score": "0.6167989", "text": "def users\n\t render json: { users: User.all }\n\t end", "title": "" }, { "docid": "5a2b7963ab17292ecee2f8263f92b100", "score": "0.61668694", "text": "def index\n @users = User.resource[@current_user['id']].get\n render json: @users\n end", "title": "" }, { "docid": "11a1a1f560b80f96e92570d67b197134", "score": "0.61664075", "text": "def index\n @users = User.normal\n render json: @users\n end", "title": "" }, { "docid": "b746f5058142a9f3f3f574b75f2872ef", "score": "0.6165776", "text": "def existingUserName\n user = UsersRecord.all\n render json: user.as_json(only:[:userName]), status: :ok\n end", "title": "" }, { "docid": "184f6e8373fc606ca18ee9d694b1ab43", "score": "0.6164146", "text": "def show\n respond_to do |format|\n if @user.show_name\n format.html\n format.json{render :json => @user, :except => [:passhash, :passsalt, :validation_code]}\n else\n format.html\n format.json{render :json => @user, :except => [:passhash, :passsalt, :validation_code, :first_name, :last_name]}\n end\n end\n end", "title": "" }, { "docid": "ff93a1d9e6676b840fbe4fe28fb6ff76", "score": "0.61589336", "text": "def index\n @users = User.all.order_by( :created_at => 'desc')\n @users = @users.where(email: /#{params[:email]}/) unless params[:email].blank?\n @users = @users.where(username: /#{params[:username]}/) unless params[:username].blank?\n @users = @users.page params[:page]\n end", "title": "" }, { "docid": "d77c9148be7e1b06cbc07b439badc85f", "score": "0.61534876", "text": "def index\n @users = User.all\n @user = User.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" }, { "docid": "7ae4ab8a293bd9f6fa343b9ab125ea51", "score": "0.6150548", "text": "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @users.collect {\n |a| {:name => a.name, :email => a.email, :username => a.username}\n }, status: :ok\n }\n end\n end", "title": "" }, { "docid": "49d85aea93198f69455bda497229bedf", "score": "0.6146342", "text": "def create\n if user_params[:email].nil?\n render json: { error: 'Must provide email'}, status: 400\n elsif User.exists?(:email => user_params[:email])\n render json: { error: 'Email already registered'}, status: 400\n elsif user_params[:firstName].nil?\n render json: { error: 'Must provide firstName'}, status: 400\n elsif user_params[:password].nil?\n render json: { error: 'Must provide password'}, status: 400\n else\n @user = User.new(user_params)\n\n if @user.save\n render json: { token: @user.auth_token }, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end", "title": "" }, { "docid": "70842eedafc3094a858f780ab9706aeb", "score": "0.6145515", "text": "def user_new(options)\n post('users', options)\n end", "title": "" }, { "docid": "3c5e22893d22043de2539eab250264ad", "score": "0.614486", "text": "def index\n uri = \"#{API_BASE_URL}/users.json\"\n rest_resource = RestClient::Resource.new(uri,USERNAME, PASSWORD)\n users = rest_resource.get\n @users = JSON.parse(users, :symbolize_names => true)\n end", "title": "" }, { "docid": "874ba711ea570459dd8a53eae4a5fffd", "score": "0.61404234", "text": "def create\n user = User.find_by(email: auth_params[:email])\n if user.valid_password?(auth_params[:password])\n jwt = Auth.issue(user: user.id)\n user.phone = '' unless user.phone\n render json: { jwt: jwt, name: user.full_name, phone: user.phone, category: user.category, id: user.id }\n else\n render json: auth_params, status: 400\n end\n end", "title": "" }, { "docid": "4fe0caff0353fadde40f888f000f4ca9", "score": "0.6137769", "text": "def index\n\t\t@users = User.all.order(\"created_at DESC\")\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users, status: 200 }\n\t\tend\t\t\n\tend", "title": "" }, { "docid": "7b9987cb149199f37d987d631f7507f1", "score": "0.61348176", "text": "def index\n @users = User.all.select(:username, :id, :created_at, :updated_at)\n render json: @users\n end", "title": "" }, { "docid": "5fe6258068fc868d332c9388c1c073bb", "score": "0.61347", "text": "def index\n render(json: @user.as_json, status: :ok) \n end", "title": "" }, { "docid": "0021ffa3323d5be019b27d9744c08138", "score": "0.61322105", "text": "def index\n @users = User.select(:id, :first_name, :last_name, :login, :age, :gender, :email, :mobile_number, :city, :state, :address, :pincode, :country)\n render json: @users\n end", "title": "" }, { "docid": "0068be8d679d781740a9165129698f38", "score": "0.6131655", "text": "def get_formation_users\n @rest['users/users_formation'].get\n end", "title": "" }, { "docid": "5be1a2b1facfbebe48738361ccbdfec5", "score": "0.6128712", "text": "def users_show(options = {})\n @req.get(\"/1.1/users/show.json\", options)\n end", "title": "" }, { "docid": "fe869828de4aa2ff1d8c33c5fceafe7d", "score": "0.61286557", "text": "def index\n authorize! :manage, :multiple_users\n\n respond_with(users)\n end", "title": "" }, { "docid": "dc9b5abebf0769e437135f77a32740e3", "score": "0.6126349", "text": "def index\n render json: User.all\n end", "title": "" }, { "docid": "dc9b5abebf0769e437135f77a32740e3", "score": "0.6126349", "text": "def index\n render json: User.all\n end", "title": "" }, { "docid": "717d3f7dd8efcb45dce95b40668a6102", "score": "0.61196876", "text": "def basic_signup\n\n first_name = params[:first_name]\n last_name = params[:last_name]\n email = params[:email]\n username = params[:username]\n password = params[:password]\n password_confirmation = params[:password_confirmation]\n\n # only validations currently are unique email and password validations\n user = User.new(\n first_name: first_name,\n last_name: last_name,\n email: email,\n username: username,\n password: password, \n password_confirmation: password_confirmation\n )\n\n if user.valid?\n user.save\n end\n\n respond_to do |format|\n format.json {render json: user }\n end\n\n end", "title": "" }, { "docid": "1619486f0983c9f5b7a8907aeacc38d4", "score": "0.6119686", "text": "def show\n @user = User.find(params[:id])\n\t\n\trespond_to do |format|\n\t\tformat.json { render json: @user.as_json(only: [:id, :name, :email, :blurb])}\n\tend\n end", "title": "" }, { "docid": "6092373544781919e42a7f56772b8bba", "score": "0.61168694", "text": "def show\n # user = User.find(params)\n user = User.all # hardcoding in first user\n render json: user\n end", "title": "" }, { "docid": "1d4a7027453a0dc4f3ba1db369f633d1", "score": "0.6115072", "text": "def create\n Rails.logger.info(params)\n if params.has_key?(:password) && params.has_key?(:email) && params.has_key?(:first_name) && params.has_key?(:last_name)\n unless User.exists?(email: params[:email])\n @user = User.new_user(params[:password], params[:email], params[:first_name], params[:last_name])\n if @user != nil && @user.save\n render json: @user.as_json, status: :created\n return\n end\n else\n render json: {error: 'user exists'}, status: :bad_request\n end\n end\n render json: {error: 'insufficient params'}, status: :bad_request\n end", "title": "" }, { "docid": "849b40b077386137115c21ea321d9fd2", "score": "0.611394", "text": "def create\n @user = User.new(user_params)\n if User.exists?(username: @user.username) || User.exists?(email: @user.email)\n render :template=>\"users/error.json.jbuilder\",locals:{message: \"Username or Email already exists\"},:success => true, :status => :ok ,:formats => [:json]\n else\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n render :template=>\"users/error.json.jbuilder\",locals:{message: \"An error occured\"},:success => true, :status => :ok ,:formats => [:json]\n end\n end\n end\n end", "title": "" }, { "docid": "8110cf69f978358fb10a03aa41fbeb3c", "score": "0.6109401", "text": "def index\n users = User.all\n render json: users, status: :ok\n end", "title": "" }, { "docid": "7333b734e89b452d517883d9348ce961", "score": "0.61064136", "text": "def sign_up\n u = User.new\n u.email = params[:email]\n u.password = params[:password]\n u.name = params[:name]\n u.phonenumber = params[:phonenumber]\n u.authority_bundle_id = AuthorityBundle.where(name:\"Primary User\").first.id\n \n unless User.where(email: params[:email]).first.nil?\n status = 400\n id = nil\n end\n \n unless u.save!\n status = 200\n id = u.id\n else\n status = 400\n id = nil\n end\n render json: {\n User: ['status' => status,'id' => id]\n }\n end", "title": "" }, { "docid": "0aa40ed5dae3cf776f9c6425af089437", "score": "0.6106269", "text": "def create\n user_parameters[:name] = user_parameters[:email].split('@').first.split('.').join(' ') if user_parameters[:name].blank?\n render json: User.create!(user_parameters)\n rescue\n render_errors(user.errors.full_messages, :unprocessable_entity)\n end", "title": "" }, { "docid": "37b1c40c0634214a857f4d86ce922c06", "score": "0.6101382", "text": "def index\n authorize User\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" }, { "docid": "74a4d7b0e32e250e626268d7f0fe7401", "score": "0.61009336", "text": "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),\n :email => (x = opts.delete(:email); x.nil? ? nil : HttpClient::Preconditions.assert_class('email', x, String)),\n :status => (x = opts.delete(:status); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::UserStatus) ? x : ::Io::Flow::V0::Models::UserStatus.apply(x)).value),\n :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),\n :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),\n :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? \"-created_at\" : x), String)\n }.delete_if { |k, v| v.nil? }\n r = @client.request(\"/users\").with_query(query).get\n r.map { |x| ::Io::Flow::V0::Models::User.new(x) }\n end", "title": "" }, { "docid": "74a4d7b0e32e250e626268d7f0fe7401", "score": "0.61009336", "text": "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),\n :email => (x = opts.delete(:email); x.nil? ? nil : HttpClient::Preconditions.assert_class('email', x, String)),\n :status => (x = opts.delete(:status); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::UserStatus) ? x : ::Io::Flow::V0::Models::UserStatus.apply(x)).value),\n :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),\n :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),\n :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? \"-created_at\" : x), String)\n }.delete_if { |k, v| v.nil? }\n r = @client.request(\"/users\").with_query(query).get\n r.map { |x| ::Io::Flow::V0::Models::User.new(x) }\n end", "title": "" }, { "docid": "d12422285c5f2d22f5aa43909fb2b7c3", "score": "0.60986793", "text": "def index\n json_response(@users)\n end", "title": "" }, { "docid": "925a6aca62ff2b55708199cce664064e", "score": "0.6091737", "text": "def index\n @signed_up_users = User.where(signed_up: true)\n render json: UserSerializer.new(@signed_up_users)\n end", "title": "" }, { "docid": "b0e77b05bc2388cacd5860cfdd78bacb", "score": "0.60900265", "text": "def as_json(options={})\n options = options.merge(:only => [:name, :created_at, :phone_hashed])\n options = options.merge(:methods => [:username])\n super(options)\n end", "title": "" }, { "docid": "5e530754b0d5290d804651b5329abff7", "score": "0.60886806", "text": "def index\n @users = User.order(:email) #User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" }, { "docid": "2dea3d6553b501ac2f2f4f910ca9be56", "score": "0.6088629", "text": "def users(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get('users', options)\n response\n end", "title": "" }, { "docid": "d670be7af797ffc96c3f1e4caac8841f", "score": "0.60851943", "text": "def index\r\n get_users \r\n end", "title": "" } ]
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "a2e8d3e802a47aba29c18e409df3986f", "score": "0.0", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SearchMessagesByRecipientAndDateResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "c4ca32683e8ce75eb6a187d63df8fa77", "score": "0.7665963", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DoneResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6f7a7d9be674ad4cf17d6743eb1f7836", "score": "0.764377", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetNextResultsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "ea872306361fc864408e8279b0199bbe", "score": "0.7595193", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "ea872306361fc864408e8279b0199bbe", "score": "0.7595193", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8930e1716b013d16d7b7de258c2d40a6", "score": "0.7572236", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BasicResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75632715", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75632715", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75632715", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75632715", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75632715", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75632715", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75632715", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75610054", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "2af7c3fdbc792c97315016366b268df9", "score": "0.74936795", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9f335c551760f3d4173d3a6cb083a0e2", "score": "0.7488317", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ObjectSetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7450407", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7450407", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7450407", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7450407", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7448878", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7448878", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7448878", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7448878", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7448878", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7448878", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bb4c4c00d82ad064a5082b7afe4c48d2", "score": "0.7448878", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "afe0e8ec443f796166358039fdecdb0d", "score": "0.74486965", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = IteratorHelper2ResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "648c8b0f1dc24c0412d5f7d4e3cea344", "score": "0.7439677", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MultiQueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6b4ba316137428ce500c97e409be2902", "score": "0.7426505", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RunCommandResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "34f15f5a73f216a32c95e6c664949f2d", "score": "0.73901176", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetMetadataResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "1239dac60dfed8a0d5b4d31e8106e390", "score": "0.7385311", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = IteratorHelper1ResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f28ec6dc9cedee6469f71c907f1704ef", "score": "0.73841196", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveSpecificRowsOrColumnsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9fdcd1a770560eb59a2dbe7abd869eaf", "score": "0.7383518", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9fdcd1a770560eb59a2dbe7abd869eaf", "score": "0.7383518", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9fdcd1a770560eb59a2dbe7abd869eaf", "score": "0.7383518", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9fdcd1a770560eb59a2dbe7abd869eaf", "score": "0.7383518", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "855c1fa00591ce07697f8e545054fce7", "score": "0.7379098", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MQLReadResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "a165902ed6748b64b4117b8c8b9abae7", "score": "0.7353526", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = IteratorHelperResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "01a45040460ae3c472e612d6ad45559d", "score": "0.73494476", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CivicResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "543e0f21a9a5617a696a566b984b2262", "score": "0.7336437", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ObjectGetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "d9fc5548c5903ea3474c0673f4d3a9e6", "score": "0.73317623", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BatchResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "b545d160e048eb964734c4364860c054", "score": "0.7313573", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = StructuredQueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "05bac4be2091b0eb847f688449846159", "score": "0.7297744", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SendResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "eb3f4ac33af2cc00b368b83f5b921210", "score": "0.72922456", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = PutResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "4c3a65d523d09d06b46fa6381bd6ae1f", "score": "0.72750163", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FQLResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "2e0d4dea0d6309b1ed6921de241cf809", "score": "0.72740066", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = Step1ResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e", "score": "0.72608525", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e", "score": "0.72608525", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e", "score": "0.72608525", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e", "score": "0.72608525", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e", "score": "0.72565794", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "be102b9c81183d9f8bd4d09a7fdce73a", "score": "0.7252415", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MakeCallResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "ba8fbcad6ce69ca11b25814f5c7d80e7", "score": "0.72434396", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetValuesFromXMLResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "e374c864ae8365e83576224986afc8db", "score": "0.7241114", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RunRightScriptResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "c640cb069c5325833bd1f90f353677cf", "score": "0.7234882", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReplyResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "03e4ddb0fbc8ad7e8fed24e516422ee5", "score": "0.7234409", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = Step2ResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "da581a489c99b7ffa036d73d31deb567", "score": "0.7232065", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RequestResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "afe71b77fbb9b12089a4f05186d7a93f", "score": "0.72060525", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BillResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "02533070f2fee1b7c51ffcfb358467fc", "score": "0.7196314", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RunInstancesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "a527666f0126166571e60612e4c25b27", "score": "0.719439", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9de8750a58a9526fbdee57ac41e90203", "score": "0.71896636", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ParseResponseResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "54f48540754909bc086af097cb2575d7", "score": "0.7185369", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = XLSToXMLResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "973dca0d927cf5e0927d87002d02cb4e", "score": "0.7167806", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CompleteEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "2d80834625bd1cf93415aa6aee3849b8", "score": "0.7156903", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReadProductResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "62cbf9188960f4e3579331a0940c0958", "score": "0.7154343", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetRequestResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "36a3ae9b6c96bb8c08a7ad4cd30ed18c", "score": "0.7154075", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ExecuteViewsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "5dcada835dd4f5661948bcc1afb69b1f", "score": "0.71493345", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReadActionsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "546f796abecb4a53efd4abd86391d9fe", "score": "0.71442544", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ColumnsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "04486efd3eefc68f700419fbb9ac3d1c", "score": "0.7138221", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateActionResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "5a968378a28e150e178cf6c07cbaefd3", "score": "0.71372044", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReadRunsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9b3005154a1b6ab53713f1ddc148f13d", "score": "0.71248627", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetEntityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f3548ebc7ee3a9e55a11c1017d9ae306", "score": "0.71218365", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetStatusResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "d40537899945eadb9ffb703dec94db88", "score": "0.7109886", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateRunResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "070004d2425f03200a0bfaf85b97fbc0", "score": "0.7105971", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetRecordResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "3c4057ad4872f4dc31fb615931da74eb", "score": "0.7105478", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateRequestResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "409fcd9d77023f2d8987b5f8e05def02", "score": "0.7104369", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = PromptResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0c4b8dcec2478b63814035cead2c697f", "score": "0.71038216", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = XMLResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "550802d802281c5bead9f1836a8dd4f3", "score": "0.7098907", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ObjectUpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "33fe7f64c30effa42e552f81862db2fb", "score": "0.7093994", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateWantsToReadResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "ce00867599ac0237408f7c0f396a40ed", "score": "0.7090704", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetInstanceResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f97a7bd13d335a38327ac328f1ea794e", "score": "0.7090422", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BatchHelperVersion9ResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "3d51df9e4ec249f86008ab8460df25f1", "score": "0.7089624", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateWantsToReadResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "89345f402106c25cde12e1484b175b2f", "score": "0.70874333", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ByIDResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "c5ff4261c62823872d930ef8c5d2a4b1", "score": "0.70860684", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveObjectResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f414f475e00c01cab69153edccf57d9b", "score": "0.70813006", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SeriesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "5157f9b8dcc2756d8bc274f2ffca783a", "score": "0.70796335", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "dc572ee0e3ff2c0edde3d0f62a304488", "score": "0.70735216", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListedResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f971bba6c1135825990f5dca6f6e740a", "score": "0.7066532", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = EndItemResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f4f33869b9bf248ee3302246637d8e18", "score": "0.7064668", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = InfluenceResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "77bf542a39db31850ec6ecd794d13113", "score": "0.70633435", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = LeadershipPACsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f12b25229dc0d7f5aeb720aec7dd0fad", "score": "0.7054176", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ShareResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f12b25229dc0d7f5aeb720aec7dd0fad", "score": "0.7054176", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ShareResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0ee572471a295b58d45bfd8ea90c6c19", "score": "0.70535135", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0ee572471a295b58d45bfd8ea90c6c19", "score": "0.70535135", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0ee572471a295b58d45bfd8ea90c6c19", "score": "0.70535135", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0ee572471a295b58d45bfd8ea90c6c19", "score": "0.70535135", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0ee572471a295b58d45bfd8ea90c6c19", "score": "0.70535135", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "e3506f6b0376127238b649b3d7106521", "score": "0.70522565", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetBatchEntitiesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "cbaab2aa9aa5f4134435a7e41c36275e", "score": "0.7050857", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = HereNowResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "e58c7422dbc490d17e70263cdd8227e4", "score": "0.70498145", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrievePlanResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bede436b8562b6553f3d58aed04867c3", "score": "0.7046977", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BooksResultSet.new(resp)\n return results\n end", "title": "" } ]
a53f9dc57beffe6fde4afaf6b0bc7f65
Takes type of action and params: :shutdown:: +params+ nil :create_order:: +params+ order :cancel_order:: +params+ order
[ { "docid": "1d3c8d833236feefc33b76f023f0d1e7", "score": "0.0", "text": "def initialize(type, destination, params=nil)\n @type = type\n @params = params\n @destination = destination\n end", "title": "" } ]
[ { "docid": "17fe686381fcfb04ed07ce6fae851389", "score": "0.63113284", "text": "def when_to_execute_order(type)\n @stock_details = Finance.current_stock_details(params[:stock_id]) or raise ActiveRecord::RecordNotFound\n\n @order_type = type\n\n case params[type][:when]\n when \"At Market\"\n params[type].except!(:when, \"execute_at(1i)\", \"execute_at(2i)\", \"execute_at(3i)\", \"execute_at(4i)\", \"execute_at(5i)\", :measure, :price_target)\n return\n when \"Future\"\n params[type].except!(:when, :measure, :price_target)\n params[type][:order_type] = @order_type\n @order = DateTimeTransaction.new(params[type].merge(user: current_user))\n when \"Stop-Loss\"\n params[type].except!(:when, \"execute_at(1i)\", \"execute_at(2i)\", \"execute_at(3i)\", \"execute_at(4i)\", \"execute_at(5i)\")\n params[type][:order_type] = @order_type\n @order = StopLossTransaction.new(params[type].merge(user: current_user))\n end\n \n if @order\n if@order.place!(@stock_details)\n flash[:notice] = \"Order successfully placed\"\n else\n flash[:alert] = @order.errors.values.join if !@order.errors.blank?\n end\n end\n redirect_to(stock_path(params[:stock_id]))\n end", "title": "" }, { "docid": "6a38258610b0e41e9ed8202d56d58149", "score": "0.58566976", "text": "def shutdown_action\n execute 'Q'\n @shutting_down = true\n end", "title": "" }, { "docid": "d80ad5bcee0b960f0012b86a2d3a32a5", "score": "0.57195926", "text": "def place_order(action_handler, options, machine_spec)\n #\n # Generate an order template to verify/place order later\n # Note:\n # Due to uniquess of ordering bare metal server via SoftLayer API, \n # we have to differentiate order template generation process\n # \n # 1. virtual server and bare metal instance,\n # - Retrieve object options to generate order \n #\n # 2. bare metal server\n # - Query available price/product item ID to generate an order template\n #\n case @instance_type\n when INSTANCE_TYPES[:bare_metal_server][:name]\n order_container = acquireOrderTemplate_bms(options)\n else\n order_container = acquireOrderTemplate(options)\n if (order_container[\"imageTemplateId\"].nil? || order_container[\"imageTemplateId\"].empty?)\n order_container.delete(\"imageTemplateId\")\n end\n end\n\n begin\n @product_order ||= @client[:Product_Order]\n client_order = @product_order.verifyOrder order_container\n Chef::Log.debug \"[softlayer_driver#place_order] Order is verified successfully!\"\n\n if action_handler.should_perform_actions\n client_order = @product_order.placeOrder order_container\n Chef::Log.debug \"[softlayer_driver#place_order] Order is placed successfully!\" \n else\n puts \"Running in why-run mode ... Order is verified and valid !\"\n return nil\n end\n\n rescue => exception\n error_exit \"[softlayer_driver#place_order] Failed with: #{exception}\"\n end\n client_order\n end", "title": "" }, { "docid": "eee245e920b832c97b44248eb155afd0", "score": "0.56895643", "text": "def cancel_order order_id\n private_request 'cancel_order'\n end", "title": "" }, { "docid": "18e23f76aec7e8ba1f89be4af9c07acb", "score": "0.5684173", "text": "def cancel_order(params = {})\n request(:post, '/cancel_order', params)\n end", "title": "" }, { "docid": "7e4c68d3171999dd886b722e02cf5081", "score": "0.56638604", "text": "def trade action\n\n end", "title": "" }, { "docid": "90feca1fe911fbe88b6363d4a3498ad7", "score": "0.5583963", "text": "def destroy\n order = @league_user.orders.find(params[:id])\n if !order.open?\n flash[:alert] = \"Order cancel unsuccessful. This order has already been filled.\"\n elsif order.ready?\n flash[:alert] = \"Order cancel unsuccessful. The conditions for this order have\n already been met. This order will fill shortly.\"\n elsif order\n if order.side == 'buy'\n reserve_coin = @league_user.wallets.find order.quote_currency_id\n else\n reserve_coin = @league_user.wallets.find order.base_currency_id\n end\n reserve_coin.decrement! 'reserve_quantity', order.reserve_size\n if order.destroy\n flash[:notice] = \"Order cancel was successful.\"\n end\n else\n flash[:alert] = \"Order cancel unsuccessful.\"\n end\n redirect_back(fallback_location: root_path)\n end", "title": "" }, { "docid": "264559f2eaf0a1656ec9f2399c392725", "score": "0.55363196", "text": "def soap_action(action, options={})\n if options[:as].present?\n options[:to] ||= action\n action = options[:as]\n end\n\n if action.is_a?(Symbol)\n if soap_config.camelize_wsdl.to_s == 'lower'\n options[:to] ||= action.to_s\n action = action.to_s.camelize(:lower)\n elsif soap_config.camelize_wsdl\n options[:to] ||= action.to_s\n action = action.to_s.camelize\n end\n\n end\n\n default_response_tag = soap_config.camelize_wsdl ? 'Response' : '_response'\n default_response_tag = action+default_response_tag\n\n\n self.soap_actions[action] = options.merge(\n :in => WashOut::Param.parse_def(soap_config, options[:args]),\n :request_tag => options[:as] || action,\n :out => WashOut::Param.parse_def(soap_config, options[:return]),\n :header_out => options[:header_return].present? ? WashOut::Param.parse_def(soap_config, options[:header_return]) : nil,\n :to => options[:to] || action,\n :response_tag => options[:response_tag] || default_response_tag\n )\n end", "title": "" }, { "docid": "f01c8b6294d4203d141a92031d04431e", "score": "0.5534424", "text": "def place_order params\n false if !params.key? 'type'\n private_request 'place_order/GHS/BTC', params\n end", "title": "" }, { "docid": "965b52fa9f4c682af6acd74c3f54a3a5", "score": "0.551755", "text": "def trade action\n\t#price(action) unless @price #memoize\n #bid_ask=action==:buy ? \"bid\":\"ask\"\n bid_ask=action==:buy ? :ask : :bid\n\n opts = {\n pair: 'XXBTZUSD',\n\t type: action.to_s,\n ordertype: 'market',\n\t volume: @options[:volume]\n\t}\n\n interface.add_order(opts)\n\tr_json = JSON.parse(response)\n\n end", "title": "" }, { "docid": "29bfd29071115948846f8c6ff4d210c4", "score": "0.5501914", "text": "def order_submit(order)\n execute 'api/submit',\n build_json({\n order: order\n })\n end", "title": "" }, { "docid": "26e72f114f60af4cfcedef043b942fd3", "score": "0.5496581", "text": "def destroy\n @order = Order.find(params[:id])\n if @order.status == 'awaiting pickup' || @order.status == 'picked up'\n if @order.cancel\n Customer.remove_fresh_cash(@order, true)\n #@order.destroy\n @order.save\n flash[:notice] = 'The selected order was successfully cancelled'\n else\n flash[:error] = 'This order has already been processed and cannot be cancelled'\n end\n else\n flash[:error] = 'This order has already been processed and cannot be cancelled'\n end\n \n if params[:from_admin]\n redirect_to :back\n else\n respond_to do |format|\n format.html { redirect_to customer_orders_path(@order.customer) }\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "37c071940ccda0f11ff83379a45b17e0", "score": "0.54798555", "text": "def order_params\n params.require(:order).permit(:user_id, :amount, :description, :orderable_id, :orderable_type, :action)\n end", "title": "" }, { "docid": "e736be4ff38e2691b82d7cdafa8c6a97", "score": "0.54797196", "text": "def execute_action(action, args)\n action_method = \"oo_#{action.gsub('-', '_')}\"\n request_id = args['--with-request-id'].to_s if args['--with-request-id']\n\n exitcode = 0\n output = action\n exitcode, output, addtl_params = self.send(action_method.to_sym, args)\n\n @logger.debug \"execute_action - action: #{action}, #{JSON.pretty_generate(args)}\"\n return exitcode, output, addtl_params\n end", "title": "" }, { "docid": "ff0d9ddf0d67a990a8ce11bce5496d0f", "score": "0.54450876", "text": "def submit_cancel order_id\n path = \"/v1/order/orders/#{order_id}/submitcancel\"\n request_method = 'POST'\n params = { 'order-id' => order_id }\n perform(path, params, request_method)\n end", "title": "" }, { "docid": "5b088bd4a4ca2aff02231995200491e1", "score": "0.54361445", "text": "def exectute_action(action)\n ACTION_HANDLERS_ORDER.each do |name|\n if (data = action[name])\n instance_exec(data, &ACTION_HANDLERS[name])\n end\n end\n end", "title": "" }, { "docid": "340faa44bc8c562cb4a09bfdb0a374c5", "score": "0.54060376", "text": "def execute_action(action, args)\n action_method = \"oo_#{action.gsub('-', '_')}\"\n\n exitcode = 0\n output = \"\"\n addtl_params = nil\n\n begin\n if self.respond_to?(action_method)\n exitcode, output, addtl_params = self.send(action_method.to_sym, args)\n else\n exitcode = 127\n output = \"Unsupported action: #{action}/#{action_method}\"\n end\n rescue Exception => e\n report_exception(args['--with-reference-id'], args['--with-container-uuid'], e)\n exitcode = 127\n output = \"An internal exception occurred processing action #{action}: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n return exitcode, output, addtl_params\n end", "title": "" }, { "docid": "dbe655c5e0d823e290ddb583e592c55d", "score": "0.54053366", "text": "def order_params\n params.require(:order).permit(:order_date, :user_id, :status, :order_total, :action)\n end", "title": "" }, { "docid": "51e384899ce142788f9185ae498e26c6", "score": "0.54045427", "text": "def chain_cancel_order (id:nil, base:\"cny\")\n #$LOG.debug (self.class.name.to_s+'.'+method(__method__).name) { method(__method__).parameters.map }\n #$LOG.debug (method(__method__).name) { method(__method__).parameters.map { |arg| \"#{arg} = #{eval arg}\" }.join(', ')}\n $LOG.info (method(__method__).name) { {\"parameters\"=>method(__method__).parameters.map { |arg| \"#{arg[1]} = #{eval arg[1].to_s}\" }.join(', ') } }\n if id.nil?\n return\n end\n\n # the API wallet_market_cancel_order is deprecated, so call another method\n chain_cancel_orders ids:[id], base:base\n #response_json = chain_command command:\"wallet_market_cancel_order\", params:[id]\n #result = response_json[\"result\"]\n\nend", "title": "" }, { "docid": "7255fdf9846b3c54bc3fea6158b0b4af", "score": "0.539819", "text": "def cancel\n @order = Order.find_by_uuid params[:uuid]\n\n @order.flow = OrderFlow.new current_user, @order.supplier\n @order.flow.current_step = :done\n\n if !@order.payment_status\n @order.payment_status = :cancelled\n @order.delivery_status = :cancelled\n @order.order_events << OrderEvent.new(:name => :payment_cancelled)\n @order.save!\n session.delete :order\n else\n logger.error \"Order with id #{@order.id} had wrong payment status '#{@order.payment_status}' when trying to cancel it\"\n end\n end", "title": "" }, { "docid": "4a9bf3f9d0bb82c581a80e156b8979f3", "score": "0.5397363", "text": "def ask_cancel\n @pending_order = Order.find(params[:format].to_i)\n PendingOrder.createPendingOrder @pending_order\n Order.delete(@pending_order)\n redirect_to order_my_orders_path\n end", "title": "" }, { "docid": "0f45279c6de94be10c15e5088f0c64f0", "score": "0.53897655", "text": "def soap_action(action, options={})\n exposed_name = if action.is_a?(Symbol)\n WashOut.normalize(action, soap_config) \n else\n action.to_s\n end\n\n self.soap_actions[exposed_name] = options.merge(\n in: WashOut::Param.parse_def(soap_config, options[:args]),\n out: WashOut::Param.parse_def(soap_config, options[:return]),\n to: options[:to] || action.to_s,\n response_tag: options[:response_tag]\n )\n end", "title": "" }, { "docid": "5b56e5cbe08d9b1471b6b404521fb16b", "score": "0.538463", "text": "def trade action\n\tprice(action) unless @price #memoize\n bid_ask=action==:buy ? \"bid\":\"ask\"\n\tvolume = action==:buy ? @options[:volume]*10000000000 : @options[:volume]*100000\n values = CGI::escape(\"nonce=#{Time.now.to_i}\\u0026type=#{bid_ask}\\u0026amount_int=#{volume}\")\n\n sign = hmac_512(values,ENV['ANXPRO_SECRET'])\n headers = {:content_type => \"application/x-www-form-urlencoded\",\n :rest_key => \"\\u003C#{ENV['ANXPRO_KEY']}\\u003E\",\n :rest_sign => \"\\u003C#{sign}\\u003E\"}\n response = RestClient.post \"https://anxpro.com/api/2/BTCUSD/money/order/add/\", values, headers\n r_json = JSON.parse(response)\n\n if (response[\"response\"] == \"success\")\n end\n end", "title": "" }, { "docid": "b0c51f03b2a1e1bc18b89fcf2ac9e074", "score": "0.53572655", "text": "def rpc_exec_workflow(action, *args)\n rpc_exec_workflow_with_object(@openerp_model, action, *args)\n end", "title": "" }, { "docid": "0a3092f942ac488232e6bfa539afdc98", "score": "0.53505325", "text": "def cancel!(order)\n Robot.with_cooldown do\n Robot.log(:debug, \"Finalising #{order.class}##{order.id}\")\n order.cancel!\n Robot.log(:debug, \"Finalised #{order.class}##{order.id}\")\n end\n rescue StandardError => error\n Robot.log(:debug, error)\n nil # just pass, we'll keep on trying until it's not in orders anymore.\n end", "title": "" }, { "docid": "202eb489a08f3e38b55522ef1988f8ce", "score": "0.5346885", "text": "def cancel_order\n order = self.pending_order\n order.destroy\n op_to_cancel = order.order_products\n op_to_cancel.destroy_all\n end", "title": "" }, { "docid": "cb3f31e42564d94ede3a7daa2a00f3c2", "score": "0.5345329", "text": "def cancelorder(args)\n {\n :method => \"CancelOrder\",\n :id => args[:id],\n }.to_json\n end", "title": "" }, { "docid": "4717899a2087abc6fc8cd233ad9e54d5", "score": "0.5343281", "text": "def shutdown(params = {})\n case params[:type]\n when :WORLD\n results = @worlds.select { |world| world.settings[:LABEL] = params[:label] || params[:title] }\n results.each(&:shutdown)\n log \"Shutdown #{results.size} world instance(s)!\"\n when :SERVER\n if @endpoints.include?(params[:sig])\n EventMachine.stop_server(params[:sig])\n log \"Shutdown server with signature: #{params[:sig]}!\"\n else\n err \"Could not locate server with signature: #{params[:sig]}!\"\n end\n else\n begin\n @endpoints.each { |ep| EventMachine.stop_server(ep) }\n @worlds.each(&:shutdown)\n rescue StandardError => e\n puts \"An error occurred during shutdown!\"\n puts e\n puts e.backtrace.join(\"\\n\")\n ensure\n EventMachine.stop\n end\n end\n end", "title": "" }, { "docid": "84e614ab4170e84f801254dd058f7228", "score": "0.5338198", "text": "def cancel_orders(orders, opt={})\n\t\t\treturn batch_operate_orders(orders, :cancel_orders, :cancel_order, opt)\n\t\tend", "title": "" }, { "docid": "b06950b1edaa5c4d769682f635548345", "score": "0.53235507", "text": "def take_action(action)\n if action == :look || action == :status\n print_status\n elsif action == :buy\n buy_unspecific_product\n elsif action.to_s =~ /buy ([A-Z][A-Z][A-Z])/i\n buy_specific_product($1)\n elsif action == :pay\n @customer.pay(@last_product) \n elsif action == :cancel\n cancel_product_sale\n elsif action == :inventory\n Product.list_inventory(@products) \n elsif action == :restock\n Product.restock(@products, Product::DEFAULT_QUANTITY) \n elsif action == :quit\n quit\n end\n end", "title": "" }, { "docid": "3f6d24c05e33766d5c22087ddba70a23", "score": "0.53199756", "text": "def perform(order, previous_state=\"nil\")\n \t@order = order\n \t@previous_state = previous_state\n \tif @previous_state == \"nil\"\n \t\torder_confirmation_send_later(@order)\n \telse\n \t\tstate_changed_send_later(@order, @previous_state)\n \tend\n end", "title": "" }, { "docid": "5c0d4dc6f05373a3ec4960b2fae0257c", "score": "0.530569", "text": "def route_manager_action(action)\n case action\n when 1 then @meals_controller.list\n when 2 then @meals_controller.add\n when 3 then @customers_controller.list\n when 4 then @customers_controller.add\n when 5 then @orders_controller.list_undelivered_orders\n when 6 then @orders_controller.add\n when 0 then destroy_session\n when 9 then stop\n else\n puts \"Please press 1, 2, 3, 4 or 9\"\n end\n end", "title": "" }, { "docid": "c2330f419b5bc694a99a89eaa71811e8", "score": "0.5293758", "text": "def submit_order (order, &cb)\n return if !@is_authenticated\n\n if order.kind_of?(Array)\n packet = order\n elsif order.instance_of?(Models::Order)\n packet = order.to_new_order_packet\n elsif order.kind_of?(Hash)\n packet = Models::Order.new(order).to_new_order_packet\n else\n raise Exception, 'tried to submit order of unkown type'\n end\n\n if !@aff_code.nil?\n unless packet[:meta]\n packet[:meta] = {}\n end\n\n packet[:meta][:aff_code] = @aff_code\n end\n\n @ws.send(JSON.generate([0, 'on', nil, packet]))\n\n if packet.has_key?(:cid) && !cb.nil?\n @pending_blocks[\"order-new-#{packet[:cid]}\"] = cb\n end\n end", "title": "" }, { "docid": "0e0e7128a073d24ebb2621c0443f0b1f", "score": "0.52830964", "text": "def soap_order_action_log!(args={})\n Starapi.log.info \"Calling Soap Order Action Log\"\n\n @wlog_entno, @wlog_action_code, @wlog_entry_date,\n @wlog_comments, @eai_trnno =\n args[:wlog_entno], args[:wlog_action_code], args[:wlog_entry_date],\n args[:wlog_comments], args[:eai_trnno]\n\n @request_xml = construct_xml.to_xml\n Starapi.log.debug \"Request XML:\\n\" + @request_xml\n @last_response = get_target_response soap_service_sp.soap_execute_sp_transaction!(@request_xml)\n end", "title": "" }, { "docid": "9752ea8657d30381786f2f1f8ea89016", "score": "0.5276145", "text": "def set_action_on_service_down(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "65902a292913289d10c28a8a0032cea5", "score": "0.5263476", "text": "def destroy\n Order.destroy params #Not sure what to put in params\n redirect_to waiters_path\n end", "title": "" }, { "docid": "35c96996e2da47bdb0370d860ee0037c", "score": "0.52549416", "text": "def trade action\n\tbid_ask=action==:buy ? :ask : :bid\n\tp = @price[:bid] if @price && @price[:bid] #memoize\n\tp = @price[:ask] if @price && @price[:ask] #memoize\n\tp = price(action) unless p\n bid_ask=action==:buy ? \"buyOrder\":\"sellOrder\"\n\tvolume = @options[:volume]\n\n tonce=DateTime.now.strftime('%Q')\n id = 1\n\tvalues = (\"tonce=#{tonce}&\"+\n \"accesskey=#{ENV['LAKEBTC_ACCESS_KEY']}&\"+\n\t\t \"requestmethod=post&\"+\n\t\t \"id=#{id}&\"+\n\t\t \"method=#{bid_ask}&\"+\n\t\t \"params=#{[p,volume,'USD'].split(',')}\")\n\tsign = hmac_512(values)\n\n\theaders = {'Json-Rpc-Tonce' => tonce,\n\t\t 'Authorization'=> \"Basic #{sign}\"}\n\tresponse = RestClient.post(\"https://www.LakeBTC.com/api_v1\", {params:[p,volume,'USD'],method:\"#{bid_ask}\",id:id}.to_json, headers)\n\n end", "title": "" }, { "docid": "a72f80e55b3c54559969f6aeea66028d", "score": "0.5254323", "text": "def create\n\n logger.info(\"I'm in create!\")\n\n logger.info(params[:order_type]);\n\n if(params[:order_type] == \"MarketOrder\")\n new_order = MarketOrder.new\n new_order.time_filled = DateTime.now;\n new_order.trade_type = params[:trade_type];\n new_order.ticker = params[:ticker];\n\n if(new_order.trade_type == \"buy\")\n new_order.price_executed = YahooFinance::get_standard_quotes(new_order.ticker)[new_order.ticker].ask;\n elsif(new_order.trade_type == \"sell\")\n new_order.price_executed = YahooFinance::get_standard_quotes(new_order.ticker)[new_order.ticker].bid;\n end\n elsif(params[:order_type] == \"StopOrder\")\n new_order = StopOrder.new\n\n new_order.trade_type = params[:trade_type];\n new_order.ticker = params[:ticker];\n new_order.threshold_price = params[:threshold_price];\n new_order.duration_valid = params[:valid_duration];\n new_order.valid_order = true;\n elsif(params[:order_type] == \"LimitOrder\")\n new_order = LimitOrder.new\n\n new_order.trade_type = params[:trade_type];\n new_order.ticker = params[:ticker];\n new_order.threshold_price = params[:threshold_price];\n new_order.duration_valid = params[:valid_duration];\n new_order.valid_order = true;\n else\n flash[:fail] = \"Invalid order type.\"\n redirect_to :back\n return\n end\n\n new_order.quantity = params[:quantity];\n new_order.type = params[:order_type];\n new_order.time_placed = DateTime.now;\n new_order.league_id = params[:league_id];\n new_order.portfolio_id = params[:portfolio_id];\n\n if(new_order.type == \"MarketOrder\")\n if(Portfolio.find(new_order.portfolio_id).capital_cents < new_order.quantity*new_order.price_executed_cents)\n flash[:fail] = \"Not enough funds.\"\n new_order.delete\n redirect_to :back;\n return\n else\n current_portfolio = Portfolio.find(new_order.portfolio_id)\n\n if(new_order.trade_type == \"buy\")\n current_portfolio.capital_cents -= new_order.quantity*new_order.price_executed_cents\n elsif(new_order.trade_type == \"sell\")\n current_portfolio.capital_cents += new_order.quantity*new_order.price_executed_cents\n end\n current_portfolio.save()\n\n day_performance = Performance.where(\"date = ? and portfolio_id = ?\",Date.today, current_portfolio.id).first;\n\n if day_performance.nil?\n day_performance = Performance.new();\n day_performance.portfolio_id = current_portfolio.id;\n day_performance.league_id = new_order.league.id;\n day_performance.date = Date.today;\n end\n\n logger.info(day_performance);\n\n day_performance.closing_capital_cents = current_portfolio.capital_cents;\n\n day_performance.save();\n end\n\n end\n\n new_order.save();\n\n flash[:success] = \"You've successfully placed an order.\"\n redirect_to(league_portfolio_url(new_order.league_id, new_order.portfolio_id))\n end", "title": "" }, { "docid": "bcb81624602b2f1a4cf50a26487e6001", "score": "0.5250275", "text": "def executions order_id, order_type = 'bid' # 'ask'\n res = post('/api/1/generic/private/order/result',\n :order => order_id,\n :type => order_type)\n end", "title": "" }, { "docid": "ee4c976f26fd961d70db1b398e63b582", "score": "0.5241528", "text": "def shutdown args\n\t\tif args.empty?\n\t\t\tputs \"You must specify an instance name\"\n\t\t\texit 1\n\t\tend\n\n\t\tputs \"WARNING! This will permanently destroy '#{args[0]}'.\"\n\t\tprint \"Proceed anyway? (y/n): \"\n\t\tif $stdin.gets[0,1].downcase == \"y\"\n\t\t\t$all_instances.shutdown args[0]\n\t\t\tputs \"\\nShutting down #{args[0]}.\"\n\t\telse\n\t\t\tputs \"\\nPhew... that was close. You canceled the order.\"\n\t\tend\n\tend", "title": "" }, { "docid": "9a7851df27e7a9c9bdb2b6cafaab51c0", "score": "0.5241164", "text": "def destroy\n @order = Order.find(params[:id])\n unless @order.order_list.state == \"ordered\"\n @order.destroy\n else\n # 発注後はキャンセル扱い\n @order.update_attributes!({canceled_at: Time.now})\n end\n\n respond_to do |format|\n if @order_list\n format.html { redirect_to order_list_path(id: @order_list.id) }\n format.json { head :no_content }\n else\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "26efb10b6b1245f778da465d46a8028b", "score": "0.52230036", "text": "def cancel_order (order, &cb)\n return if !@is_authenticated\n\n if order.is_a?(Numeric)\n id = order\n elsif order.is_a?(Array)\n id = order[0]\n elsif order.instance_of?(Models::Order)\n id = order.id\n elsif order.kind_of?(Hash)\n id = order[:id] || order['id']\n else\n raise Exception, 'tried to cancel order with invalid ID'\n end\n\n @ws.send(JSON.generate([0, 'oc', nil, { :id => id }]))\n\n if !cb.nil?\n @pending_blocks[\"order-cancel-#{id}\"] = cb\n end\n end", "title": "" }, { "docid": "fdc954dc6ae98d4c820698f70de65819", "score": "0.52223325", "text": "def cancel_order_qoo10(order)\n @error = \"\"\n @message = \"\"\n @order = order\n muser = Spree::SellerMarketPlace.where(\"seller_id=? AND market_place_id=?\", @order.seller_id, @order.market_place_id).first\n market_place = order.market_place\n uri = URI(market_place.domain_url+'/ClaimAPIService.api/SetCancelProcess')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({'key'=>muser.api_secret_key,'ContrNo'=>@order.market_place_order_no})\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|http.request(req)end\n if res.code == \"200\"\n #res_body = Hash.from_xml(res.body).to_json\n #res_body = JSON.parse(res_body, :symbolize_names=>true)\n seller_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @order.seller_id, @order.market_place_id, @order.products.first.id)\n if !seller_product.nil? && !seller_product.blank?\n # code to add the stock after cancelling the order\n if @order.line_items.present?\n @stock = seller_product.first.product.stock_products.where(\"variant_id=?\", @order.line_items.first.variant.id).first\n @stock.update_attributes(:count_on_hand=> @stock.count_on_hand + @order.line_items.first.quantity) if @stock\n end\n @order.update_attributes!(:market_place_order_status => \"cancel\")\n # call api in FBA to cancel the order\n #@order.cancel_order_on_fba(muser)\n end\n else\n @error = \"failed\"\n end\n @message = \"Order canceled successfully\"\n return @error.empty? ? @message : @error\n end", "title": "" }, { "docid": "ed51c305433d8969d751364eeb110acb", "score": "0.5199697", "text": "def execute_soap_request(action, args)\n original_action_name =\n get_service_registry.get_method_signature(action)[:original_name]\n original_action_name = action if original_action_name.nil?\n response = @client.request(original_action_name) do |soap|\n set_headers(soap, args)\n end\n return response\n end", "title": "" }, { "docid": "026d920b658dc2614f2eef6d820e6ccc", "score": "0.51899314", "text": "def o_order_params\n params.require(:o_order).permit(:OrderId, :Name, :Type, :CreateTime, :CreateUser, :ExecTime, :Execer, :State, :Customer, :Address)\n end", "title": "" }, { "docid": "a1006b30e7eb89f51b0d438908ab3ca1", "score": "0.5179929", "text": "def cancel_order\n\t\t@order = Order.find(params[:order_id])\n\t\t@order.order_lines.each do |product|\n\t\t\tshop_product = ShopProduct.unscoped.where(id: product.shop_product_id).first\n\n\t\t\t# Calling the method add_cancellation_to_inventory_details from Model\n\t\t\tOrder.add_cancellation_to_inventory_details(shop_product, product)\n\t\tend\n\t\t@order.order_state = 'closed'\n\t\tif @order.save\n\t\t\tflash[:success] = 'Order Successfully Cancelled'\n\t\t\tredirect_to orders_path(shop_profile_id: @order.shop_profile_id)\n\t\t\tUserMailer.order_cancellation(User.find(@order.user_id), @order).deliver_now\n\t\telse\n\t\t\tflash[:danger] = \"Order not Cancelled\"\n\t\t\tredirect_to order_path(@order)\n\t\tend\t\n\tend", "title": "" }, { "docid": "91b30c63abe6678c0286e7c607f1b09d", "score": "0.5177752", "text": "def action(a, c = nil)\n if !self.driver.in_driver_context?\n # Called from outside Driver. Send an async message to Driver.\n self.driver.message(:action, [a, c])\n else\n # Called from within Driver.\n case a\n when :start\n call_action(c, :start)\n sleep(self.start_grace + self.grace)\n when :restart\n if self.restart\n call_action(c, :restart)\n else\n action(:stop, c)\n action(:start, c)\n end\n sleep(self.restart_grace + self.grace)\n when :stop\n call_action(c, :stop)\n sleep(self.stop_grace + self.grace)\n end\n end\n\n self\n end", "title": "" }, { "docid": "0a95cf959582f2c56470a370b0c62717", "score": "0.5174955", "text": "def actions_after_shutdown\n ref_call :get_actions_after_shutdown\n end", "title": "" }, { "docid": "61448c5ff58f5bd557db23b3ea239867", "score": "0.5173683", "text": "def termination(action, &b)\n define_action(:termination, action, &b)\n end", "title": "" }, { "docid": "c2089f435ffaf7d8e53f88d2682c47fa", "score": "0.5169447", "text": "def actions\n accept_ids = params[\"accept_ids\"] || []\n shipped_ids = params[\"shipped_ids\"] || []\n archive_ids = params[\"archive_ids\"] || []\n delete_ids = params[\"delete_ids\"] || []\n\n raise NotAuthorized unless ((accept_ids & shipped_ids & archive_ids & delete_ids) - current_user.received_order_ids).empty?\n if not (archive_ids & delete_ids).empty?\n flash[:alert] = 'Choose either archive or delete but not both'\n else\n # Require all actions to complete or else none.\n # An order can be shipped and archived in a single action so ordering of actions important. This is the only combination action permitted.\n # In future, try allowing accept and shipped together. TODO.\n Order.transaction do\n r = Order.where(id: accept_ids).map(&:set_accepted)\n r += Order.where(id: shipped_ids).map(&:set_shipped)\n r += Order.where(id: archive_ids).map(&:set_vendor_archived)\n r += Order.where(id: delete_ids).map(&:set_vendor_deleted)\n if r.include?(false)\n logger.warn(\"failed on at least one action to update order\")\n flash[:alert] = 'There was a problem changing state on one or more orders. No changes were made.'\n raise ActiveRecord::Rollback\n else\n # This is count of actions applied so wording not quite right - shows 2 when one order shipped and archived.\n flash[:notice] = \"Actions were applied to #{r.size} orders.\"\n end\n end\n end\n redirect_to vendor_orders_path(actions_view: true, filter_archived_only: params[:filter_archived_only], filter_paid: params[:filter_paid])\n end", "title": "" }, { "docid": "2ac67a57d25c9545e6fa83dfb259a50a", "score": "0.5168568", "text": "def cancel_order(options)\n request :signed, :delete, :order, options\n end", "title": "" }, { "docid": "188d94cd0d55e16d530fbdafc69fa5ff", "score": "0.51645595", "text": "def destroy\n\n @order_state.stoped_at = DateTime.now\n @order_state.stop_user_id = session[:user_id]\n @order_state.state='N'\n @order_state.save\n\n respond_to do |format|\n format.html { redirect_to order_states_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eccb7895cae091bbd98f1469383368e1", "score": "0.51561135", "text": "def cancel\n @order = Spree::Order.find_by_number(params[:order])\n @message = \"\"\n @error = \"\"\n if @order.update_attributes(:is_cancel=>true)\n begin\n if @order.market_place.code == \"qoo10\"\n @message = cancel_order_qoo10(@order)\n @error = (@message == \"failed\") ? \"Qoo10 order can not be canceled\" : \"\"\n end\n rescue Exception => e\n @error = e.message\n end\n if @error.empty?\n flash[:message] = @message\n else\n @order.update_attributes(:is_cancel=>false)\n flash[:error] = @error\n end\n else\n flash[:error] = \"Order can not be canceled\"\n end\n redirect_to :back\n end", "title": "" }, { "docid": "37bbde67d263c5a025a73ab5e9179438", "score": "0.51491076", "text": "def stop_order_params\n params.require(:stop_order).permit(:routeID, :stopID, :order)\n end", "title": "" }, { "docid": "1fdb166bd029d6b88c1736c9141af0a5", "score": "0.51459616", "text": "def cancel\n @order.order_status = \"cancelled\"\n @order.save\n redirect_to admin_order_path(@order) #test whether this is necessary\n end", "title": "" }, { "docid": "aa568012d1495715483a29b00e7d2ab8", "score": "0.513746", "text": "def route_stop_params\n params.require(:route_stop).permit(:order)\n end", "title": "" }, { "docid": "a22a02917261dc91a04e63886007a666", "score": "0.51352286", "text": "def ezp_submit_order\n # the test_mode flag tells us if we should submit \"real\" orders (when false) to ezprints or simulate the order flow internally (when true)\n if self.test_mode\n # kick off loopback mode for order simulation - the EZPSimulator will\n # call back to simulate the order notification flow as if it was coming from EZPrints\n ZZ::Async::EZPSimulator.simulate_order(self)\n else\n # real order placement\n self.ezp_reference_id = ez.submit_order(self)\n save!\n end\n end", "title": "" }, { "docid": "2dc35afc457fd0388feeaa582aaabcbc", "score": "0.5130018", "text": "def cancel_order(order)\n\n\t\tprevious_state = order.state\n\n\t\torder.state = 'cancelled'\n\t\torder.save\n\n\t\t# send pusher notification for mobi site\n \tPusher.app_id = '37591'\n \tPusher.key = 'be3c39c1555da94702ec'\n \tPusher.secret = 'deae8cae47a1c88942e1'\n \tPusher['order'].trigger('cancel_event', {:user_id => \"#{order.customer.id}\",:message => \"Your order: #{order.number} was cancelled at #{order.store.store_name}. Please contact the store at #{order.store.manager_contact}, for further information.\"})\n\t\t\n StateEvent.create({\n :previous_state => previous_state,\n :next_state => '',\n :name => 'order',\n :user_id => self.id,\n :stateful_id => order.id,\n :stateful_type => 'order'\n })\n\n\t\torder.format_for_web_serivce\n\tend", "title": "" }, { "docid": "5135c89514d57314f3911f030d35fb12", "score": "0.51252735", "text": "def action_stop\n notify_if_service do\n service_resource.run_action(:stop)\n end\n end", "title": "" }, { "docid": "0eae3e3a23439abe8bd909a88aad8a82", "score": "0.512468", "text": "def action_recreate\n action_delete\n action_create\n end", "title": "" }, { "docid": "7e4c879797c010b14a6a75d7992f0009", "score": "0.5114", "text": "def execute\n return unless active\n # Write out proof we were here for unit test\n File.write('/tmp/UserAction', :SECONDARY_USER_ACTION)\n # Trigger the shutdown process\n normal_shutdown\n deactivate(@action)\n end", "title": "" }, { "docid": "86ea6b872336a2410581106acaceeb99", "score": "0.51080215", "text": "def define_wcf_action(action)\n\t\t \tself.class.send(:define_method ,action.name) do |data=nil,*args|\n\t\t\t\tbody = build_body(action, data)\n\n\t\t\t\tres = send_wcf_action(action.soap_action,body,*args)\n\t\t\t\t(@cookies << res.headers[\"Set-Cookie\"]) if @save_cookeis\n\n\t\t\t\tresult = get_wcf_response(res,action.name)\n\t\t\t\tres.singleton_class.send(:define_method,:result) do\n\t\t\t\t\tresult\n\t\t\t\tend\n\t\t\t\tres\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "c4cdc1e6d955023e38677f32f0b2af09", "score": "0.51032835", "text": "def action_orderType(ee, contracts, limit, stop)\n [ if contracts > 0\n case ee\n when :entry\n OA_BUY\n when :exit, :reversal\n OA_COVER_SHORT\n end\n\n elsif contracts < 0\n case ee\n when :entry\n OA_SHORT\n when :exit, :reversal\n OA_SELL\n end\n else\n raise MarketException.new(\"Contract size must not be zero.\")\n end,\n \n if limit > 0 and stop == 0\n OT_LIMIT\n elsif stop > 0 and limit == 0\n OT_STOP\n elsif stop == 0 and limit == 0\n OT_MARKET\n else\n raise MarketException.new(\"Invalid limit/stop parameters\")\n end ]\n end", "title": "" }, { "docid": "507d41065c6a28c4363f04ee9ec28297", "score": "0.50973004", "text": "def create_order\n\n end", "title": "" }, { "docid": "a5d191b8b3c89e53008e599c325ab6e1", "score": "0.5096363", "text": "def execute_action\n execute_action_gen(nil)\n end", "title": "" }, { "docid": "b20440e8fb23206e20cf6c27a7e5f6c3", "score": "0.50907403", "text": "def shutdown\n data = '{\"action_type\": \"SendCtrlAltDel\"}'\n\n @client.put('actions', data)\n\n return cancel unless wait_shutdown\n\n true\n end", "title": "" }, { "docid": "04e91cc1a4d40c89474b6122e142a4ba", "score": "0.5089705", "text": "def destroy\n # @user = current_user\n # @order.destroy\n # respond_to do |format|\n # format.html { redirect_to user_orders_path(@order), notice: 'Order was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n @user = current_user\n # byebug\n\n finishOrder={ name: @order.name, restaurant: @order.restaurant, status: \"cancelled\", avatar: @order.avatar}\n @order.update(finishOrder)\n redirect_to user_orders_path(@user)\n end", "title": "" }, { "docid": "592bc3b9347106c4c7b6b17818455f2a", "score": "0.5085608", "text": "def destroy\n justi = (params[:justificacion].nil?)? \"\" : params[:justificacion]\n \n order=@saucer_order.order\n if order.status==2\n redirect_to pay_path(order)\n else \n Cancellation.create(user_id:current_user.id,justificacion:justi,platillo:@saucer_order.platillo.name,quantity:@saucer_order.quantity,sucursal_id:current_user.sucursal_id)\n @saucer_order.destroy\n respond_to do |format|\n format.html { redirect_to pay_path(order), notice: 'Saucer order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "c08ac3991678c8d795fa62df1266e91c", "score": "0.50773686", "text": "def action(action, server, template, &block)\n ui.msg(ui.color(\"ACTION (#{@name})::#{action} --> #{template}\", :cyan))\n execonf = @mix.mixin.files[template] || {}\n localfile = cook(template, server, overwrite=true)\n run_at = execonf['run-at'] || 'before_chef'\n # Schedule action\n @@execlist[run_at][server.id] ||= []\n @@execlist[run_at][server.id] << [action, execonf, localfile, block]\n [action, execonf, localfile, block]\n end", "title": "" }, { "docid": "6fd1a58bb3fe4d933c69796b44d31b2a", "score": "0.50769424", "text": "def void(options = {})\n post = {}\n\n set_order_id(options)\n add_transaction_parameters(post, nil, options)\n\n commit('cancel', post)\n end", "title": "" }, { "docid": "034c563d624c7d001ad1ffbc7131594e", "score": "0.50762695", "text": "def update\n if params[:order_id].present?\n @order = Order.find(params[:order_id])\n else\n @status_transition = StatusTransition.find(params[:id])\n @order = @status_transition.order\n end\n case params[:status_transition][:event]\n when \"place\"\n @order.place\n render json: {message: \"Order placed\"}, status: 200\n when \"pay\"\n @order.pay\n render json: {message: \"Order payed\"}, status: 200\n when \"cancel\"\n @order.cancel\n render json: {message: \"Order Canceled\"}, status: 200\n end\n end", "title": "" }, { "docid": "b9c526f8ab0fbebd5ab339426142f912", "score": "0.50712776", "text": "def delete_saved_order_info\n broadcast('@type' => 'deleteSavedOrderInfo')\n end", "title": "" }, { "docid": "9dc01fbbc73f5fbfdf40273a3a1cc66d", "score": "0.5065026", "text": "def act(action,params, version='')\n @action_path = File.join(@service_path,version,action.to_s)\n @params = params\n request\n end", "title": "" }, { "docid": "abfef93584642d5afbedbb7e1888fc20", "score": "0.50647694", "text": "def post_order(order_type, volume, price, pair, opt={})\n params = {\n pair: pair,\n type: order_type,\n volume: volume.to_d.round(6).to_f.to_s,\n price: price.to_f.round(2).to_s\n }\n opt.merge!({params: params, method: :post})\n path = '/api/1/postorder'\n authed_request(path, opt)\n end", "title": "" }, { "docid": "d3ac4e21974e970a9e20b2911ad9b42c", "score": "0.5056778", "text": "def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n contract = Contract.find(@order.contract_id)\n contract.status = 1\n contract.save\n MagicMailer.newOrder(@order, User.find(contract.seller_id)).deliver_now\n MagicMailer.newOrder(@order, User.find(contract.buyer_id)).deliver_now\n CloseExpiredOrdersJob.set(wait_until: (contract.meeting_time+3.days)).perform_later(@order)\n format.html { redirect_to @order, notice: 'The contract was confirmed and an order was successfully created.' }\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", "title": "" }, { "docid": "0cfe74f747076b5c47784b0bec605e43", "score": "0.5056345", "text": "def destroy\n authorize! :cancel, @order\n @event = @order.ticket.event\n @order.destroy!\n redirect_to @event\n end", "title": "" }, { "docid": "0ecf2d32ccdf908b74a4a42ea1ebfcc7", "score": "0.505434", "text": "def do_action action, args = []\n return if action.nil?\n ACTIONS[action.downcase.to_sym].call self, args\n end", "title": "" }, { "docid": "1e53cbdf70c94a61670da53ab2fed48f", "score": "0.50520754", "text": "def finish_order\n\n end", "title": "" }, { "docid": "2d3477b3dd72a7c3c5cdc72e3f8aa52e", "score": "0.50506824", "text": "def order_params\n params.require(:order).permit(:user_id, :desc, :status)\n end", "title": "" }, { "docid": "6616b9961cf15812b8df278b8a720b14", "score": "0.5048497", "text": "def destroy\n @order_type = OrderType.find(params[:id])\n # Settea el atributo de desactivación, a él y a sus relacionados\n @order_type.update(is_disabled: Time.now)\n order_type_attributes = @order_type.order_type_attributes\n order_type_detail_attributes = @order_type.order_detail_attributes\n order_type_detail_attributes.each do |detail_attribute|\n detail_attribute.update(is_disabled: Time.now)\n end\n order_type_attributes.each do |attribute|\n attribute.update(is_disabled: Time.now)\n end\n # Redirige a la lista de TipoPedido\n redirect_to order_types_path\n end", "title": "" }, { "docid": "d812c719da2f9b78c614329dd084e9bb", "score": "0.5043876", "text": "def route_manager_action(action)\n case action\n when 1 then @meals_controller.list\n when 2 then @meals_controller.add\n when 3 then @customers_controller.list\n when 4 then @customers_controller.add\n when 9 then destroy_session\n when 0 then stop\n else\n puts \"Please press 1, 2, 3, 4 or 9\"\n end\n end", "title": "" }, { "docid": "cb8f50868754860ea24bd9ff9bd93dce", "score": "0.5042623", "text": "def void_order(order)\n end", "title": "" }, { "docid": "1e6f515023ff789341cef0719e9225d4", "score": "0.5031577", "text": "def execute_soap_request(action, args, extra_namespaces)\n original_action_name =\n get_service_registry.get_method_signature(action)[:original_name]\n original_action_name = action if original_action_name.nil?\n response = @client.request(original_action_name) do |soap, wsdl, http|\n soap.body = args\n header_handler.prepare_request(http, soap)\n soap.namespaces.merge!(extra_namespaces) unless extra_namespaces.nil?\n end\n return response\n end", "title": "" }, { "docid": "874ca519ae7e7d5fef3cdf7e9ddfebd5", "score": "0.5031145", "text": "def delete(action, **args); end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.50310254", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "6e081b3fb62397da71cef2c24cc755dc", "score": "0.5027259", "text": "def action_create\n create_common\n create_service\n end", "title": "" }, { "docid": "9fe9bb928dcb748caae2321c9da5ebff", "score": "0.5023092", "text": "def order_params\n end", "title": "" }, { "docid": "7bfab3a57a971e38d96f4f0a8c1b4b70", "score": "0.5022524", "text": "def order_params\n params.require(:order).permit(:status, :number, :os_date, :hour, :medium, :called, :operator, :sector, :responsible, :contact, :unity, :scope, :address, :route, :vehicle, :ranking, :modality, :cause, :description, :authorization, :priority, :link, :operational, :measure, :request_date, :insertion_routing, :reporting_routing, :deliberation, :temporal_lapse, :order_record, :feedback, :execution_availability, :devolution)\n end", "title": "" }, { "docid": "8d2e10fe9fe732878fbc178a093fd266", "score": "0.5016316", "text": "def destroy\n if session[:user_id] != nil\n if User.find(session[:user_id]).identity == \"administrator\" or session[:user_id] == Order.find(params[:id]).user_id\n @order = Order.find(params[:id])\n @order.after_destroying_the_order\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n else\n redirect_to store_url\n end\n else\n redirect_to store_url\n end\n end", "title": "" }, { "docid": "3f07dec39eb8ff062a4b43fd4fc09c4a", "score": "0.50131446", "text": "def chain_cancel_orders (ids:[], base:\"cny\")\n $LOG.info (method(__method__).name) { {\"parameters\"=>method(__method__).parameters.map { |arg| \"#{arg[1]} = #{eval arg[1].to_s}\" }.join(', ') } }\n if ids.nil? or ids.empty?\n return\n end\n\n response_json = chain_command command:\"wallet_market_cancel_orders\", params:[ids]\n #result = response_json[\"result\"]\n if not response_json[\"error\"].nil?\n $LOG.error (method(__method__).name) { JSON.pretty_generate response_json[\"error\"] }\n end\n\n #return result\nend", "title": "" }, { "docid": "575387a3f143a4e0045e0301b260f129", "score": "0.50120103", "text": "def action_priority(*order_list)\n @action_priority = order_list unless order_list.empty?\n @action_priority\n end", "title": "" }, { "docid": "37cd029d843c7ef2fcde49f1712dd75e", "score": "0.50114685", "text": "def action args = {}\n\t\tend", "title": "" }, { "docid": "3766e68025f6884856eeea254710287f", "score": "0.5009581", "text": "def order_create(order)\n execute 'api/create',\n build_json({\n order: order\n })\n end", "title": "" }, { "docid": "db3807c7f3371e7dcfb3e91579b7044c", "score": "0.50087196", "text": "def order_params\n params.require(:order).permit(:status, :ticket_id, :user_id)\n end", "title": "" }, { "docid": "bed9f5655db353f598f9ad8e629085d1", "score": "0.50044477", "text": "def cancel_order!\n self.locked = nil\n do_receive(false) #don't change prices\n self.save!\n end", "title": "" }, { "docid": "cc6c1aa0433e136e8cfb9ede70f0943e", "score": "0.5004316", "text": "def order_params\n params.require(:order).permit(:user_id, :checked_out)\n end", "title": "" }, { "docid": "74edaac4783b6d4478716a59f2f6dfd0", "score": "0.50020105", "text": "def order_params\n params.require(:order).permit(:serv_offer_title, :serv_offer_id, :offer_user_id, :request_user_id, :status, :connect_time, :bidder, :signature, :lately_chat_content, :serv_catagory)\n end", "title": "" }, { "docid": "6ee6a04ca978d2d3c15b0c74e3f2ac0e", "score": "0.49986804", "text": "def cancel_all(params)\n Client.current.delete('/orders', params)\n end", "title": "" }, { "docid": "95ef02b05c70ecb71e1f6acd3b5dffba", "score": "0.49909177", "text": "def out_order_params\n params.require(:out_order).permit(:Order_id, :GoDown_id, :OutOrderId, :Name, :Type, :CreateTime, :CreateUser, :ExecTime, :Execer, :State)\n end", "title": "" }, { "docid": "b8907b2b22f54040f0308897a0893a4e", "score": "0.4990271", "text": "def destroy\n @order.destroy\n respond_to do |format|\n format.html {redirect_to myorders_path, notice: 'Order was successfully destroyed.'}\n format.json {head :no_content}\n end\n ActionCable.server.broadcast 'orders',\n order: @order.to_json,\n action:'delete'\n end", "title": "" }, { "docid": "a0f17a827784fa7a3f1ae0daf3630eed", "score": "0.49870035", "text": "def place_order(type, price, size)\n\t\trasie \"Unknown type #{type}\" if type != 'buy' && type != 'sell'\n\t\tis_buy = (type == 'buy')\n\t\tneed_to_place = true\n\t\t(is_buy ? @buy_orders : @sell_orders).each do |o|\n\t\t\tputs format_trade(o) if @debug\n\t\t\tif need_to_place && o['p'] == price\n\t\t\t\tneed_to_place = false\n\t\t\telse\n\t\t\t\tcancel_order_async(o)\n\t\t\tend\n\t\tend\n\t\t@pending_orders.each do |client_oid, o|\n\t\t\tputs format_trade(o) if @debug\n\t\t\tnext unless o['T'] == type\n\t\t\tif need_to_place && o['p'] == price\n\t\t\t\tneed_to_place = false\n\t\t\telse\n\t\t\t\tcancel_pending_order_async(o)\n\t\t\tend\n\t\tend\n\t\treturn unless need_to_place\n\t\tsleep 1\n\t\torder = {'pair'=>@pair, 'p'=>price, @size_k=>size, 'T'=>type, 'market'=>@market}\n\t\tplace_order_async(order, 1)\n\t\t# Post only?\n\t\t# place_order_async(order, 1, tif:'PO')\n\tend", "title": "" } ]
1e91bd62d7ec4a902ababfdd12ac711e
Converts from FPDF y coordinates to Prawn y coordinates. FPDFthink is setting a topdown y relative to the edge of the paper; we set up Prawn to use a bottomup system origined at the bottom of the page. If new value is not supplied, returns the current value. Does not change the current value.
[ { "docid": "7410b3bcfc20b9297d99e10333343209", "score": "0.7671776", "text": "def py(new_y=nil)\n if ! new_y then return @cur_y end\n if @unit then new_y = @unit.call(new_y) end\n if new_y >= 0\n @page_height - new_y\n else\n -new_y\n end\n end", "title": "" } ]
[ { "docid": "e3e027fde90aac96788d7745ef3e7a7e", "score": "0.69058526", "text": "def y\n @page_height - mm_to_pt(@padding_top + @mm_y)\n end", "title": "" }, { "docid": "46a8433167c5281a94bd6d4a5748c3b6", "score": "0.68413734", "text": "def fixY(y)\n pageSize.getHeight - y\n end", "title": "" }, { "docid": "e10a157b0c1a00731e9a56d4193d3633", "score": "0.6840381", "text": "def fpdf_y(y, cover=false)\n if @cookbook.template.template_type < 9\n if cover\n return HC_PAGE_HEIGHT - HC_COVER_MARGIN[:bottom] - y\n else\n return HC_PAGE_HEIGHT - HC_PAGE_MARGIN[:bottom] - y\n end\n else\n return y\n end\n end", "title": "" }, { "docid": "61095b53527080741a7e6cf177e33e39", "score": "0.67801243", "text": "def adjust_y(y)\n # Display Y in \"tile values\".\n dy = @display_y / 128.0\n # 15 represents the number of vertical tiles in the screen.\n if loop_vertical?\n # If Map Loops to the Bottom and Character close to Top Edge\n return y - dy + @map.height if y < dy - (height - 15) / 2\n # Top Map Edge Adjustment for Sprites at Bottom Edge of Maps\n t = $game_map.loop_top_offset\n # If Map Loops to the Top and Character close to Bottom Edge\n return y - dy - @map.height if dy < 0 + t and y > dy + (height + 15) / 2\n end\n return y - dy\n end", "title": "" }, { "docid": "4e7a939561ec8cc759c8e0a632bfc7ba", "score": "0.67565185", "text": "def GetY\n @inverse_unit.call(@page_height - @cur_y)\n end", "title": "" }, { "docid": "d27c01fbbbeb8745f8fcb6cc386cd94a", "score": "0.6683452", "text": "def y\n @y = 1 if @y <= 1\n @y = Terminal.height if @y >= Terminal.height\n\n if @y <= top\n @y = top\n\n elsif @y >= bottom\n @y = bottom - 1\n\n else\n @y\n\n end\n end", "title": "" }, { "docid": "809cc38cee588a9962f19e0c2c7b5262", "score": "0.66781145", "text": "def actual_y_position\n return @actual_y + set_adjust[1]\n end", "title": "" }, { "docid": "b32d729670e31c19fa0326be7b41abf8", "score": "0.6646121", "text": "def relative_y(y)\n y_pixel_to_screen(y)\n end", "title": "" }, { "docid": "6e8c66c775ae0e9e35967bdf4c6b823f", "score": "0.6597032", "text": "def adjust_y(y)\n if loop_vertical? && y < @effectus_dref_display_y - @effectus_adjy\n y - @effectus_dref_display_y + @map.height\n else\n y - @effectus_dref_display_y\n end\n end", "title": "" }, { "docid": "6e8c66c775ae0e9e35967bdf4c6b823f", "score": "0.6597032", "text": "def adjust_y(y)\n if loop_vertical? && y < @effectus_dref_display_y - @effectus_adjy\n y - @effectus_dref_display_y + @map.height\n else\n y - @effectus_dref_display_y\n end\n end", "title": "" }, { "docid": "e2aa9c17f117ae6151274c9a9c1a940c", "score": "0.65940106", "text": "def pos_y=(new_y)\n @pos_y = new_y\n dim[:sy] = new_y\n dim[:ey] = new_y + 96\n end", "title": "" }, { "docid": "a1160b2aca8f5824317de8f605678455", "score": "0.6586421", "text": "def y_travel(new_y)\n y_travel = (new_y - y_position).abs\n end", "title": "" }, { "docid": "40fe0356319b22b923f35076b2d8021b", "score": "0.6500158", "text": "def transform_y y\n @origin_y + y * SCREEN_Y_DIRECTION\n end", "title": "" }, { "docid": "35c4b01dcac3145fefdaca083ed587dc", "score": "0.6497179", "text": "def y=(value)\n @y = value\n adjust_y\n end", "title": "" }, { "docid": "a7ed8e95b8f80a968fb4ab079a4e2765", "score": "0.6365841", "text": "def untransform_y y\n @origin_y + y * SCREEN_Y_DIRECTION\n end", "title": "" }, { "docid": "93d2a9d1373ebac3a7a5a0e4e1a3f96a", "score": "0.6355829", "text": "def rel_y\n return y - Graphics.height/2\n end", "title": "" }, { "docid": "634ca27ffcaaf798b877cbc6121d53d5", "score": "0.6256598", "text": "def revert_y(y)\n @canvas_height - y\n end", "title": "" }, { "docid": "4ab94885385eb00d8132d7460a328dfe", "score": "0.6248712", "text": "def y=(value)\n # Returns y or 0 if value is less than 0 or value is\n # greater than TABLE_HEIGHT.\n return y || 0 if value < 0 || value > TABLE_HEIGHT\n # Assigns instance variable with 'value'\n @y = value\n # Closes method definition.\n end", "title": "" }, { "docid": "9f03a8c929881f3d1340964290f7ac63", "score": "0.62449354", "text": "def y\n y_dependencies = [bounds.y, parent.is_a?(Shape) && parent.absolute_y]\n if y_dependencies != @y_dependencies\n # avoid recalculating values\n bounds_y, parent_absolute_y = @y_dependencies = y_dependencies\n y_value = bounds_y\n y_value -= parent_absolute_y if parent.is_a?(Shape)\n @y = y_value\n end\n @y\n end", "title": "" }, { "docid": "959346b13a73a7dbabc270495f85a4e0", "score": "0.61714417", "text": "def basic_y_position\n y = @bank == 0 ? 192 : 124\n y += offset_y\n return y\n end", "title": "" }, { "docid": "96df13df359d36f15254747e0c2477f9", "score": "0.6157467", "text": "def get_y\n if DEBUG_COORDS\n logger.debug \"get_y(), %s %s ## %s\" % [get_class(), get_id(), get_unique_id()]\n end\n y = 0\n if @use_uiautomator\n y = @attributes['bounds'][0][1]\n else\n begin\n if @attributes.has_key?(GET_VISIBILITY_PROPERTY) and @attributes[GET_VISIBILITY_PROPERTY] == 'VISIBLIE'\n top = @attributes[@top_property].to_i\n x += top\n if DEBUG_COORDS\n logger.debug \"get_y(), VISIBLE adding #{top}\"\n end\n end\n end\n end\n if DEBUG_COORDS\n logger.debug \"get_y() return #{y}\"\n end\n return y\n end", "title": "" }, { "docid": "751252e01e8422545c4d21b03d7ed2c4", "score": "0.6114492", "text": "def basic_y_position\n y = @bank == 0 ? 192 : 94\n y += offset_y\n return y\n end", "title": "" }, { "docid": "1b89152904dcdb341afc830adbb5b5da", "score": "0.6098354", "text": "def y\n return @y - @map_data.offset_y\n end", "title": "" }, { "docid": "0da63af8d2487f6079b466877e4bb620", "score": "0.60838985", "text": "def get_calculated_y\n\t\trange = (5..210).to_a + (615..@window.height).to_a\n\t\trange[rand(range.length - 1)]\n\tend", "title": "" }, { "docid": "94ccefe6fbc5c287c533370d1fd51735", "score": "0.6074283", "text": "def y=(y)\r\n @y = y\r\n if @game_area\r\n @y = @game_area.y if @y < @game_area.y\r\n @y = @game_area.height-$window.height if @y > @game_area.height-$window.height\r\n end\r\n end", "title": "" }, { "docid": "c6e73c9d50f54f1b74d4623672e410cd", "score": "0.60460263", "text": "def bottom_y\n y_px + h_px\n end", "title": "" }, { "docid": "11ce4954b7c9f38ea73b70f98fc25779", "score": "0.60350907", "text": "def bottom_y\n self.y - self.oy + self.height;\n end", "title": "" }, { "docid": "aa900a43582d544c152bc3c193236e39", "score": "0.6030745", "text": "def y\n position.y if position?\n end", "title": "" }, { "docid": "9fa9a78b30d3ae5813c5c6f3ae114918", "score": "0.60236925", "text": "def y=(y)\n @y = y.to_f\n end", "title": "" }, { "docid": "011ae353ff522732d2b78c31604f7dbe", "score": "0.6013783", "text": "def y=(y)\n origin.y = coerce_float(y)\n end", "title": "" }, { "docid": "e61abdce16cec5be8a20000e896da546", "score": "0.6005752", "text": "def y\n origin.y\n end", "title": "" }, { "docid": "fa31a20ccf67ad6053280d80e64f7d2a", "score": "0.5981541", "text": "def getY()\r\n\t\treturn @pdf.y\r\n\tend", "title": "" }, { "docid": "fa85082bebb624e97109102b7d545c73", "score": "0.5975038", "text": "def invert_y(value)\n height + (value - (PADDING * PT2PX * 2))\n end", "title": "" }, { "docid": "d55423684d2687b0e57989ce75fc9e0d", "score": "0.5958743", "text": "def y=(y)\n @y = @flip_y = y\n if @flip == :vertical || @flip == :both\n @flip_y = y + @height\n end\n end", "title": "" }, { "docid": "d55423684d2687b0e57989ce75fc9e0d", "score": "0.5958743", "text": "def y=(y)\n @y = @flip_y = y\n if @flip == :vertical || @flip == :both\n @flip_y = y + @height\n end\n end", "title": "" }, { "docid": "aaa266892c709d4fa0d813c9bc0ed8fd", "score": "0.5958153", "text": "def y\n y_value = bounds.y\n y_value -= parent.absolute_y if parent.is_a?(Shape)\n y_value\n end", "title": "" }, { "docid": "0b8467ba31490bab56ea31d1c42e7669", "score": "0.5951922", "text": "def y=(y)\n @y = y.to_f\n end", "title": "" }, { "docid": "4238dbc7fc8e7f36ba33b9e2432d5e14", "score": "0.59430116", "text": "def set_y(y)\n @y = y\n end", "title": "" }, { "docid": "6e34cd5111c9316363b2665cfa3c7464", "score": "0.59388536", "text": "def y_end(y)\n [y - 1, position_y - 1].max\n end", "title": "" }, { "docid": "49783b65b69296e4eee45ecb216a32ff", "score": "0.59303176", "text": "def y_end(y)\n [y_position, y].max\n end", "title": "" }, { "docid": "18e6dd2b32a42bade271a91b9bd88f51", "score": "0.59204257", "text": "def y=(v)\r\n super(v)\r\n v += @window.viewport.rect.y if @window.viewport\r\n @text_viewport.rect.set(nil, v + @oy.to_i)\r\n end", "title": "" }, { "docid": "18e6dd2b32a42bade271a91b9bd88f51", "score": "0.59204257", "text": "def y=(v)\r\n super(v)\r\n v += @window.viewport.rect.y if @window.viewport\r\n @text_viewport.rect.set(nil, v + @oy.to_i)\r\n end", "title": "" }, { "docid": "029ae169243a348d1f11597bca52056d", "score": "0.5909065", "text": "def y=(value)\n @y = value\n reset_y\n end", "title": "" }, { "docid": "18e943143b990e4beae07b5ecc2e82b7", "score": "0.5892689", "text": "def y\n @position.y\n end", "title": "" }, { "docid": "7699a91343050f304e99653960028f62", "score": "0.58857167", "text": "def bottom_draw_y\n @window.height - @left_i.height\n end", "title": "" }, { "docid": "9e475ccb61232686b163a779c6983ab4", "score": "0.5883143", "text": "def y_coordinate=(value)\n @y_coordinate = Plateau.instance.bound_by_length(value)\n end", "title": "" }, { "docid": "3f66e3769325210c548746e89b297fb5", "score": "0.587494", "text": "def y2\n mouse_coordinates.y - gorilla_coordinates.y\n end", "title": "" }, { "docid": "d62936f70112d3c3a6ec5f256cc99733", "score": "0.5873844", "text": "def y\n @y ||= Vedeu::Geometry::GenericCoordinate.new(name: name,\n offset: oy,\n type: :y)\n end", "title": "" }, { "docid": "103d5fbb99aa9279c643e8dc9a31cb6e", "score": "0.5873165", "text": "def toY=(y)\n self[:toY] = self.player == Game::Player::ONE ? y : 7 - y\n end", "title": "" }, { "docid": "c119b01e64e138a0cddea42e59646bd7", "score": "0.58485377", "text": "def ydirection\n return @ydirection if defined?(@ydirection)\n\n if self.p1.y < self.p2.y\n @ydirection = BigDecimal('Infinity')\n elsif self.p1.y == self.p2.y\n @ydirection = 0\n else\n @ydirection = -BigDecimal('Infinity')\n end\n\n @ydirection\n end", "title": "" }, { "docid": "94aad6980881a5812f8a2278b12b3837", "score": "0.58446586", "text": "def y\n y_value = bounds.y\n y_value -= parent.absolute_y if parent.is_a?(Shape) && parent.class != Shape\n y_value\n end", "title": "" }, { "docid": "c0c8c0e4ae5ec25088aac6b81bd69a5a", "score": "0.5841792", "text": "def page_y\n `#{@event}.pageY`\n end", "title": "" }, { "docid": "2e0abc82dd7b67a479f3a67e6175b7f4", "score": "0.5829837", "text": "def upper_y\n self.y - self.oy;\n end", "title": "" }, { "docid": "75b1dc05512156b7c2cdddc98a6a09ad", "score": "0.582873", "text": "def y()\n\t\t#Return stored y value\n\t\t@y_value\n\tend", "title": "" }, { "docid": "e838cd1c65cc38e13a08a035c3122c1a", "score": "0.58264077", "text": "def relative_y(int)\n int-self.y\n end", "title": "" }, { "docid": "4c6ca6d37d8d02bf9d834dd8ac2bcbea", "score": "0.5821709", "text": "def y(lat)\n @height - ((ysheet(lat) - @ty) / (@by - @ty) * @height)\n end", "title": "" }, { "docid": "5b9c0050803674ca3e5086d596c64065", "score": "0.58177364", "text": "def local_y(base = self)\n @coordinates[:y] - base.top_left_region_y * 8\n end", "title": "" }, { "docid": "c02cb6ec87732d1a48f31ccb9494555e", "score": "0.5808323", "text": "def y2\n y + height\n end", "title": "" }, { "docid": "c02cb6ec87732d1a48f31ccb9494555e", "score": "0.5808323", "text": "def y2\n y + height\n end", "title": "" }, { "docid": "a442f89f06fe10236b7bea6582de2cd5", "score": "0.5798159", "text": "def y\n geometry.y\n end", "title": "" }, { "docid": "bf1e8d0bcd31b68cfc3caf99761a772b", "score": "0.57948965", "text": "def virtual_y\n (top...bottom).to_a\n end", "title": "" }, { "docid": "f90ec78c61bb790ee521ffd24f76a7b8", "score": "0.5790881", "text": "def y=(value)\n @y = value\n @background.y = value\n @foreground.y = value + 1\n @mid_bar.y = value + 1\n end", "title": "" }, { "docid": "6f55adb4897e7ddb604bdd5b21988e28", "score": "0.57898736", "text": "def real_y\n (by + y) - oy\n end", "title": "" }, { "docid": "6f55adb4897e7ddb604bdd5b21988e28", "score": "0.57898736", "text": "def real_y\n (by + y) - oy\n end", "title": "" }, { "docid": "6f55adb4897e7ddb604bdd5b21988e28", "score": "0.57898736", "text": "def real_y\n (by + y) - oy\n end", "title": "" }, { "docid": "38433a5273a75ae77d5841f27b41b426", "score": "0.5779932", "text": "def positions_y\n @positions_y ||= equal_distribution(position_range, count)\n end", "title": "" }, { "docid": "dd3970d6a12ee7d6f14b7f40a68374dc", "score": "0.5764258", "text": "def update_y\n @picture.move_y_a_bit @y_speed\n end", "title": "" }, { "docid": "0f32a708996366b3c2ea5c3ca6db617f", "score": "0.57642096", "text": "def get_pe_y\n return ((@battler.screen_y * 8) - (@height * 4))\n end", "title": "" }, { "docid": "6924411412dc7cef42257c9be3c2b090", "score": "0.575795", "text": "def original_y=(n)\n @original_y = [[n, 16].max, (Battle_Screen_Dimension[1] - 16)].min\n end", "title": "" }, { "docid": "722a017002041e63ab90d03dce193197", "score": "0.57578236", "text": "def move_y(delta)\n\n case delta\n when -1 then\n if @y == 0\n return @maxy-1\n else\n return @y-1\n end\n\n when 0 then\n return @y\n\n when 1 then\n if @y == @maxy-1\n return 0\n else\n return @y+1\n end\n else\n raise BadDelta.new(\"Bad delta: #{delta} for Y\")\n end\n end", "title": "" }, { "docid": "9733ccc1565f4d33d865a68e768f4094", "score": "0.5754628", "text": "def y_pixel_to_screen(y)\n @y + y\n end", "title": "" }, { "docid": "717900a4f4e9e134294f9a9b52242b0e", "score": "0.57444143", "text": "def y\n if (@@y.nil?)\n raise \"Cannot determine X coordinate\"\n end\n return @@y\n end", "title": "" }, { "docid": "717900a4f4e9e134294f9a9b52242b0e", "score": "0.57444143", "text": "def y\n if (@@y.nil?)\n raise \"Cannot determine X coordinate\"\n end\n return @@y\n end", "title": "" }, { "docid": "5cdc3852eacdabe976987b06c8eeac05", "score": "0.57340324", "text": "def global_y\n viewport ? viewport.y + y : y\n end", "title": "" }, { "docid": "ac9be753716047077e7a2bf1d8c98b30", "score": "0.57246983", "text": "def update_y\n\t\t\t@y += @y_velocity\n\t\tend", "title": "" }, { "docid": "859ed75a3cef46f55bf69f6cbbdad06f", "score": "0.5724473", "text": "def y=(y)\n\t\t\tself.xy = [ @info[@api_target]['xy'][0], y ]\n\t\tend", "title": "" }, { "docid": "eb776515ce57aa7f58287f57a59a9bab", "score": "0.57219744", "text": "def y=(value)\n super\n \n redraw\n end", "title": "" }, { "docid": "653cc0d0848fd4a00f1e385ac91b71b0", "score": "0.5721803", "text": "def y_offset\n data[:y_offset]\n end", "title": "" }, { "docid": "bb0db452aba59d473286a1f1735504a9", "score": "0.57206696", "text": "def y=(new_y)\n unless @phase_viewport_zoom\n @base_y = new_y\n end\n self.y_mgc_zoom = new_y\n end", "title": "" }, { "docid": "bb0db452aba59d473286a1f1735504a9", "score": "0.57206696", "text": "def y=(new_y)\n unless @phase_viewport_zoom\n @base_y = new_y\n end\n self.y_mgc_zoom = new_y\n end", "title": "" }, { "docid": "bba5f69eab45edd30ee129975d462f19", "score": "0.5715577", "text": "def y_axis_position(num)\n 100.0 * (num - y_min) / (y_max - y_min).to_f\n end", "title": "" }, { "docid": "96126b6599fe33ccd785b32264638413", "score": "0.57123464", "text": "def getY() @y end", "title": "" }, { "docid": "7354d33530a806d74f4113533ba21950", "score": "0.57000136", "text": "def offset_y\n 0\n end", "title": "" }, { "docid": "7354d33530a806d74f4113533ba21950", "score": "0.57000136", "text": "def offset_y\n 0\n end", "title": "" }, { "docid": "7354d33530a806d74f4113533ba21950", "score": "0.57000136", "text": "def offset_y\n 0\n end", "title": "" }, { "docid": "60eb0bb02b570706f311e9f7bc96d188", "score": "0.5693786", "text": "def y\n\t grid.y\n\t end", "title": "" }, { "docid": "ddf651fdc84f148127148a1a83361bbf", "score": "0.56872314", "text": "def screen_y\n y = (@real_y - $game_map.display_y + 5) / 4 + 32 # +3 => +5\n y += @offset_screen_y if @offset_screen_y\n y += @slope_offset_y if @slope_offset_y\n if @jump_count >= @jump_peak\n n = @jump_count - @jump_peak\n else\n n = @jump_peak - @jump_count\n end\n return y - (@jump_peak * @jump_peak - n * n) / 2\n end", "title": "" }, { "docid": "7b2062390c423db3a65dc248b3a97b24", "score": "0.56671494", "text": "def pointsAtY= value\r\n value = value.to_s\r\n @attributes['pointsAtY'] = value\r\n value.to_number\r\n end", "title": "" }, { "docid": "2fb4a3ff737c47096d7bbdf2069a82df", "score": "0.56561273", "text": "def move_past_bottom\n @current_column = (@current_column + 1) % @columns\n @document.y = @y\n if @current_column.zero?\n if @reflow_margins\n @y = @parent.absolute_top\n end\n @document.start_new_page\n end\n end", "title": "" }, { "docid": "8846128e448eaca94a5c754af4c9b7b3", "score": "0.56550056", "text": "def y=(val)\n @point[1] = val\n end", "title": "" }, { "docid": "3f99f3531d82fa30f01e9a34d690e917", "score": "0.56516844", "text": "def y=(val)\n super\n self.body.p.y = val if self.body\n end", "title": "" }, { "docid": "b125293ad498e50004a5561191f9fddf", "score": "0.565161", "text": "def y_overall_diff(y_destination)\n if y_destination - self.y_position > 0\n return y_destination - self.y_position\n else\n return (y_destination - self.y_position) * -1\n end\n end", "title": "" }, { "docid": "4a7fae3ac43346c0818cb0f40a1ead3e", "score": "0.5650349", "text": "def transform_y_ndc coord\n coord.to_f / yspread\n end", "title": "" }, { "docid": "89c406154f981d556773161b955f20cd", "score": "0.56469786", "text": "def screen_y\n unless Layy_Meta.active\n return screen_y_mgc_lm\n else\n return $game_map.adjust_y(@real_y) * 32 + 32 - shift_y\n end\n end", "title": "" }, { "docid": "3154e706eee81daf9cc996ff2fadd6c9", "score": "0.5642783", "text": "def y\r\n return @window.y\r\n end", "title": "" }, { "docid": "3f94d6c78efdf41e084723ebef29a0ca", "score": "0.5639142", "text": "def y\n return @y = 0 if @y <= 0\n\n @y\n end", "title": "" }, { "docid": "794ec2df4fe918c61d402771896331f1", "score": "0.56351113", "text": "def y_num\n return @y_num\n end", "title": "" }, { "docid": "9aa6d874bf53b6c86d38fa8f18d3cde7", "score": "0.5630346", "text": "def p_value(y,n)\n if y > 0.5\n pt(2.0 - y*2.0, n)\n else\n - pt(y*2.0, n)\n end\n end", "title": "" }, { "docid": "92711aab8f92c155e3ed49a9cce1bff2", "score": "0.5623369", "text": "def fromY=(y)\n self[:fromY] = self.player == Game::Player::ONE ? y : 7 - y\n end", "title": "" }, { "docid": "e3cb274e9cf17c613567ccdb7d86f6be", "score": "0.5608664", "text": "def y\n position[1]\n end", "title": "" } ]
54351bcd5d59b1028e173303fae7e45f
Route: /database_updates (GET) Purpose: renders a list of all database updates, newest first
[ { "docid": "c0c400ada2b0e006802c672fdbe6cd55", "score": "0.7654786", "text": "def index\n @updates = DatabaseUpdate.all(:order => \"created_at DESC\")\n end", "title": "" } ]
[ { "docid": "1fbb7fe82b7dcf4b012219d88908f826", "score": "0.72687346", "text": "def index\n @updates = Update.all\n end", "title": "" }, { "docid": "26adca7396325d3bd00d2cb58db5c3bc", "score": "0.6845495", "text": "def index\n @updates = Update.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @updates }\n end\n end", "title": "" }, { "docid": "762a975d6ec65e7c9b8bc801287ddb0a", "score": "0.6797491", "text": "def index\n @updates = Update.page(params[:page]).per(10)\n @page_title = \"Updates\"\n end", "title": "" }, { "docid": "6df22bb3cb26ecb7d8330011a715930a", "score": "0.66164124", "text": "def index\n @project_updates = ProjectUpdate.all\n end", "title": "" }, { "docid": "6df528fbafeb15f6ebd9b3ed5b13b877", "score": "0.65314865", "text": "def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end", "title": "" }, { "docid": "16a817e723dbae65fb10f0ce0033c3b5", "score": "0.6311472", "text": "def refresh\n update_databases()\n render json: {message: \"Information will be updated shortly\"}, status: :ok\n end", "title": "" }, { "docid": "470f5ee80746c61937a93f23b2ef220f", "score": "0.6268972", "text": "def index\n @updates_pagy, @updates = pagy(Update.with_preloads.recent, items: 5)\n respond_to do |format|\n format.html # index.html.erb\n format.xml\n format.rss { render 'index.xml.builder' }\n end\n end", "title": "" }, { "docid": "41c0b99263a08d0b8de48307db270948", "score": "0.62374663", "text": "def render_index(updates)\n @updates = updates\n set_pagination \n haml :\"updates/index\", :layout => show_layout?\n end", "title": "" }, { "docid": "f541bd0985c091122eec6e1c5ccb6930", "score": "0.6223081", "text": "def get_updates(list_id, contact_id)\n get(\"contactLists/#{list_id}/#{contact_id}/updates\")\n end", "title": "" }, { "docid": "5c1941f6b34ec1f3bffff8512c8a8e30", "score": "0.61762047", "text": "def index\n @updates = @vehicle.updates.page(params[:page]).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @updates }\n end\n end", "title": "" }, { "docid": "21cbd7f3eded00e871688515619e9539", "score": "0.6154144", "text": "def index\n @weekly_updates = WeeklyUpdate.all\n end", "title": "" }, { "docid": "5a56515d8884389adee5ff4f662386f9", "score": "0.6109943", "text": "def updates\n display \"Populating updates...\"\n TrelloStandup::Trello.generate_updates\n display \"Completed.\"\n end", "title": "" }, { "docid": "7d992938403c4693275090b972265c98", "score": "0.6094065", "text": "def index\n @boards = Board.order('updated_at DESC')\n\n if stale?(:last_modified => @boards.first.updated_at.utc, :etag => @boards)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end\n end", "title": "" }, { "docid": "da3815520aa4c6e9bb3049b1ae667f9b", "score": "0.6090162", "text": "def db_updates(params_hash = {})\n begin\n raise_error_unless_params_is_a_hash(params_hash)\n request.method = :get\n request.uri = \"_db_updates#{querystring(params_hash)}\"\n Couchdbtools.execute(request)\n rescue Exception => exception\n exception.message\n end\n end", "title": "" }, { "docid": "367b1b30484468d751092ffde9d7bea9", "score": "0.60432863", "text": "def list_updates\n @updates = Server.all\n\n @updates.each do |server|\n server.websites.delete_if do |website|\n puts website.has_update\n true unless website.has_update\n end\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @updates.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end", "title": "" }, { "docid": "c19409e583fb33d90cb2aca964115ab4", "score": "0.6023217", "text": "def index\n @club_updates = ClubUpdate.all\n end", "title": "" }, { "docid": "6453d6f1d1e79035fa996964263c993b", "score": "0.6018444", "text": "def index\n @edits = Version.most_recent_unmoderated\n display @edits\n end", "title": "" }, { "docid": "864f2ecf45c21ca611fb532d209b61c2", "score": "0.59914804", "text": "def get_changes\n CouchRest.get(SERVER.uri << DB.uri << \"/_changes\")\nend", "title": "" }, { "docid": "c3dcbd990d23267f64dae60993173316", "score": "0.5988105", "text": "def index\n @things = Thing.all.order('updated_at DESC')\n end", "title": "" }, { "docid": "7f454890a31fd1eb2036a24e7790c883", "score": "0.5976299", "text": "def list\n @posts = Post.all(:order => 'updated_at DESC')\n render :index\n end", "title": "" }, { "docid": "151159c51cd4dda3d7f9e30edec20765", "score": "0.5973898", "text": "def index\n proposed_changes = authorize StashEngine::ProposedChange # .includes(identifier: :latest_resource)\n .joins(identifier: :latest_resource).where(approved: false, rejected: false)\n .where('stash_engine_identifiers.pub_state != ?', 'withdrawn')\n .select('stash_engine_proposed_changes.*')\n\n if params[:list_search].present?\n proposed_changes = proposed_changes.joins(CONCAT_FOR_SEARCH)\n\n keys = params[:list_search].split(/\\s+/).map(&:strip)\n proposed_changes = proposed_changes.where((['search_table.big_text LIKE ?'] * keys.size).join(' AND '), *keys.map { |key| \"%#{key}%\" })\n end\n\n params[:sort] = 'score' if params[:sort].blank?\n params[:direction] = 'desc' if params[:direction].blank?\n\n ord = helpers.sortable_table_order(whitelist:\n %w[stash_engine_proposed_changes.title publication_name publication_issn publication_doi\n stash_engine_proposed_changes.publication_date authors score])\n\n if request.format.to_s == 'text/csv' # we want all the results to put in csv\n @page = 1\n @page_size = 1_000_000\n end\n\n @proposed_changes = proposed_changes.order(ord).page(@page).per(@page_size)\n return unless @proposed_changes.present?\n\n @resources = StashEngine::Resource.latest_per_dataset.where(identifier_id: @proposed_changes&.map(&:identifier_id))\n\n respond_to do |format|\n format.html\n format.csv do\n headers['Content-Disposition'] = \"attachment; filename=#{Time.new.strftime('%F')}_pub_updater_report.csv\"\n end\n end\n end", "title": "" }, { "docid": "643e77599044e1981a3654940cd3218a", "score": "0.59552103", "text": "def index\n @api_v1_group_updates = Api::V1::GroupUpdate.all\n end", "title": "" }, { "docid": "8eb005445eb812926c291e7872afa0cb", "score": "0.5953917", "text": "def index\n proposed_changes = StashEngine::ProposedChange.includes(identifier: :resources)\n .joins(identifier: :resources).where(approved: false, rejected: false)\n params[:sort] = 'score' if params[:sort].blank?\n params[:direction] = 'desc' if params[:direction].blank?\n @proposed_changes = proposed_changes.order(helpers.sortable_table_order).page(@page).per(@page_size)\n return unless @proposed_changes.present?\n\n @resources = StashEngine::Resource.latest_per_dataset.where(identifier_id: @proposed_changes&.map(&:identifier_id))\n end", "title": "" }, { "docid": "d0958e3d7e3b3e9e7540c85b98313651", "score": "0.5953796", "text": "def index\n \n @databases = Database.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> @databases }\n end\n end", "title": "" }, { "docid": "980890210db897fe148d46622e250450", "score": "0.59416884", "text": "def index\n @title_main = \"Lista de actualizaciones\"\n @soft_updates = SoftUpdate.all\n @soft_update = SoftUpdate.new\n end", "title": "" }, { "docid": "6156792462daa0b87ab31328df23a929", "score": "0.5884762", "text": "def show\n @update = Update.new\n @updates = Update.where(expedient_id: @expedient.id).order(\"updated_at DESC\")\n end", "title": "" }, { "docid": "f3b410d20f350b767b7f1d0a7ed00250", "score": "0.5880106", "text": "def index\n @databases = Database.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @databases }\n end\n end", "title": "" }, { "docid": "e46486c5711f45cf1d7df917f7717ad6", "score": "0.586041", "text": "def index\n @daties = Daty.all.order(updated_at: :desc)\n end", "title": "" }, { "docid": "a29cd7ab2a49707d1b42bb37f01a0c1b", "score": "0.5814838", "text": "def index\n @api_v1_initiative_updates = Api::V1::InitiativeUpdate.all\n end", "title": "" }, { "docid": "42d95e14a07399062870f79cf1ea8d79", "score": "0.5808887", "text": "def index\n @changes = Change.all\n end", "title": "" }, { "docid": "2d9648abc85ce10d7ae91a940ebd2b5f", "score": "0.57864946", "text": "def index\n @feeds = Feed.all.order(\"updated_at DESC\")\n end", "title": "" }, { "docid": "5ad41490de9aea8c0ae90e183df3783d", "score": "0.57722265", "text": "def index\n @last_system_changings = LastSystemChanging.all\n end", "title": "" }, { "docid": "9a61b5c0f54f6a68fa30e308698a5054", "score": "0.5767979", "text": "def index\n @contacts = Contact.all.order('updated_at desc')\n end", "title": "" }, { "docid": "2b8e961f6b0d9d0e7c0623194a169112", "score": "0.57674336", "text": "def index\n @databases = Database.all.order(:name)\n end", "title": "" }, { "docid": "437c17080611b7fe207f04713f0263ec", "score": "0.5751925", "text": "def list\n @posts = Post.all(:order => 'updated_at DESC')\n s=render :index\n\t\ts\n end", "title": "" }, { "docid": "bf936aba51f108311589493b9cd2383f", "score": "0.57461977", "text": "def latest\n @loops = Loop.latest\n render 'list'\n end", "title": "" }, { "docid": "471b7a6afffc54fa2844dc410d564f1f", "score": "0.5735682", "text": "def render_index(updates)\n @updates = updates\n set_pagination\n render :index, :layout => show_layout?\n end", "title": "" }, { "docid": "485bedcda99629bc8e84adb25bdd73f7", "score": "0.5728408", "text": "def index\n @news_updates = NewsUpdate.all.paginate(page: params[:page], per_page: 5).order(\"created_at desc\")\n end", "title": "" }, { "docid": "fb15e334983ca9fcba8485f8bce49041", "score": "0.57243216", "text": "def index\n if params[:view] == \"last\"\n \t@docs = Doc.find_all_by_created_by(current_user.email)\n \tunless @docs.blank?\n \t\t@docs = [@docs.sort{|x,y| x.updated_at <=> y.updated_at}.last]\n \tend\n elsif params[:view] == \"deprecated\"\n \t@docs = Doc.find_all_by_deprecated(true)\n else\n \tparams[:search] ? @docs = Doc.search(params[:search]) : @docs = Doc.all\n end\n @latest_docs = Doc.get_latest_components\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @docs }\n end\n end", "title": "" }, { "docid": "bc1ba36855cf20ce2d80d1d35c432ef6", "score": "0.57009405", "text": "def index\n @upgrades = Upgrade.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @upgrades }\n end\n end", "title": "" }, { "docid": "a685281193e60912d9e043ee9b21ea79", "score": "0.56833357", "text": "def index\n @versions = Version.all\n end", "title": "" }, { "docid": "4cb4478642c877b961b567817aac82b3", "score": "0.56755555", "text": "def changelog\n @system_messages = SystemMessage.changelog_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_messages }\n end\n end", "title": "" }, { "docid": "71ca7a4307d9de3e38aa2ae1f70419ad", "score": "0.5660938", "text": "def index\n redirect_to root_path if !logged_in?\n @dips = Dip.all.order(\"updated_at DESC\")\n end", "title": "" }, { "docid": "a6c150b6f07f6e18bfe6b570f144e35d", "score": "0.56413513", "text": "def index\n @changes = Change.find(:all, :conditions => [\"priority_id = ? or new_priority_id = ?\",@priority.id,@priority.id], :order => \"updated_at desc\").paginate :page => params[:page], :per_page => params[:per_page]\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @changes.to_xml(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @changes.to_json(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) } \n end\n end", "title": "" }, { "docid": "5fac4737b7db6ebc40679a9d787e9b03", "score": "0.5638632", "text": "def index\n @forums = Forum.all.order(:updated_at => :desc)\n @title = \"All Forum Listings\"\n end", "title": "" }, { "docid": "5c668a839e58642b47e26a54c9ebe88c", "score": "0.56134504", "text": "def index\n @client_changes = ClientChange.all\n if params[:client_id]\n authorize! :read, Client.find(params[:client_id])\n @client_changes = @client_changes.where('client_id' => params[:client_id])\n end\n if params[:user_id]\n @client_changes = @client_changes.where('user_id' => params[:user_id])\n end\n @client_changes = @client_changes.desc(:created_at)\n\n if params[:short]\n @client_changes = @client_changes.only(:id, :user, :client, :type, :description, :updated_at)\n end\n\n @client_changes = current_ability.select(@client_changes)\n if params[:limit]\n @client_changes = @client_changes.take(params[:limit].to_i)\n end\n\n respond_to do |format|\n format.json { render json: get_json(@client_changes) }\n end\n end", "title": "" }, { "docid": "43fe12c522c9cebf127054011708b7b1", "score": "0.5599791", "text": "def index\n @list_of_slayders = Slayder.all.order(updated_at: :desc)\n end", "title": "" }, { "docid": "dc945eb9c0c2e92ebb9cbb2755bf0c37", "score": "0.5589312", "text": "def updates_show\n @guest = Guest.new\n\t\t@project = Project.find(params[:id])\n\t\t@npo = Npo.find_by_account_id(@project.account_id)\n\t\t@updates = Update.order(\"created_at\").find_all_by_project_id(@project.id)\n\t\t@twitter = get_twitter(@npo)\n\n\t\trender 'projects/project_updates_show'\n\tend", "title": "" }, { "docid": "94d0ec0815bc9ec758b0cf665f455d67", "score": "0.5578135", "text": "def index\n @shops = Shop.all.order(updated_at: :desc)\n end", "title": "" }, { "docid": "a1b07fc59e609e34bce40358205bacb3", "score": "0.5570219", "text": "def index\n @diffs = Diff.all\n end", "title": "" }, { "docid": "a1b07fc59e609e34bce40358205bacb3", "score": "0.5570219", "text": "def index\n @diffs = Diff.all\n end", "title": "" }, { "docid": "751c75a23686db47c3d42fa3eaa2034b", "score": "0.55586976", "text": "def list\n logger.debug \"Processing the list...\"\n @users = User.all.order('updated_at desc') #where(:status=>1)\n end", "title": "" }, { "docid": "1c3b63e1ed78fb3d3d6d1fd5c9f41189", "score": "0.55515677", "text": "def index\n @package_versions = PackageVersion.all\n end", "title": "" }, { "docid": "30ac9e9d8ec4ab7f3d2a421b5ed39666", "score": "0.55282223", "text": "def index\n @versions = @application.versions.all\n respond_to do |format|\n format.html\n format.json { render json: VersionsDatatable.new(view_context) }\n end\n end", "title": "" }, { "docid": "3cff08ffba588c34fc9590d119bf7edf", "score": "0.55236465", "text": "def index\n @reports = Report.all.order(\"updated_at DESC\").page(params[:page])\n end", "title": "" }, { "docid": "d2a2cbf8a9cf82dc10050b4818f94f69", "score": "0.5499504", "text": "def index\n @posts = Post.order(updated_at: :desc)\n end", "title": "" }, { "docid": "b3cffdf03402491794dfb2d009c650a4", "score": "0.5498823", "text": "def latest\n #rug can only get a list of *all* available packages?\n output = rug \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # rug didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end", "title": "" }, { "docid": "1e2807c0addc5aedc5c20024bef2dd88", "score": "0.5497688", "text": "def index\n error = nil\n content = nil\n\n begin\n content = self.send params[:method]\n rescue\n error = $!.to_s\n end\n\n render :update do |page|\n if error\n page.alert error\n else\n page.replace_html params[:update], content\n end\n end\n end", "title": "" }, { "docid": "ac8cd137854238e08ee8e9d20bbf4fb0", "score": "0.5489856", "text": "def index\n @vers = Ver.all\n end", "title": "" }, { "docid": "95e870bf7cc99653d62482f89adf679d", "score": "0.54850245", "text": "def index\n @updateallorders = Updateallorder.all\n end", "title": "" }, { "docid": "9ca8e1870d3d0d14c057e285d6bcfc0f", "score": "0.5483379", "text": "def index\n @support_requests = SupportRequest.all.order(updated_at: :desc)\n end", "title": "" }, { "docid": "4b163bc40c14196d70a18e40ebe4e9d7", "score": "0.54815763", "text": "def index\n @updated_posts = Post.order(updated_at: :desc)[0..5]\n @newest_posts = Post.order(updated_at: :desc)[0..5]\n end", "title": "" }, { "docid": "807ad2954838fbeb2c3b11f38d51dd8a", "score": "0.5470925", "text": "def changes\n respond_to do |format|\n format.xml do\n raise ::AbstractController::ActionNotFound if params[:interval].blank?\n @changes = Node.all_including_deleted(:conditions => ['updated_at > ?', Time.now - params[:interval].to_i], :order => 'updated_at DESC')\n end\n format.any(:rss, :atom) do\n @nodes = @node.last_changes(:all, { :limit => 25 })\n render :template => '/shared/changes', :layout => false\n end\n end\n end", "title": "" }, { "docid": "7069348cb979d801f5d0091fdfd5aceb", "score": "0.5470319", "text": "def get_recently_updated_datasets(base_url)\n return handle_request(URI.encode(base_url + '/revision_list'))\n end", "title": "" }, { "docid": "2abdeafa6e34929891d64992e199781a", "score": "0.5464719", "text": "def find_updates(options = {})\n options[:type] = DEFALUT_TYPE if options[:type].nil?\n # FIXME: check allowed types\n\n additional_options = {:quiet => true, :get => XML_COMMANDS_GET, :type => options[:type].to_s}\n\n out = xml_run build_command('list-updates', options.merge(additional_options))\n\n convert_output(out.fetch(:stream, {}).fetch(:update_status, {}).fetch(:update_list, {}).fetch(:update, []), options[:type])\n # FIXME: implement filters\n end", "title": "" }, { "docid": "0c4d6393cb430998e29eb64907955eba", "score": "0.5461467", "text": "def company_updates(options={})\n path = \"#{company_path(options)}/updates\"\n get(path, options)\n end", "title": "" }, { "docid": "e8e43219fb728a93bf81604628ae8701", "score": "0.54592735", "text": "def view_database\n table_html = '<a href=\"/admin\"> << back to index</a>'\n table_names = ActiveRecord::Base.connection.tables.delete_if { |x| x == 'schema_migrations' }\n table_names.sort.each do |name|\n table_name = \"#{name.titleize.gsub(' ', '').singularize}\"\n table_data = eval(\"#{table_name}.all\")\n\n table_html << \"<h2 style='border-bottom: solid;background-color: lightBlue;'>#{table_name}<a href='/admin/delete_db_view_data/#{table_name}' class='btn btn-large btn-primary' style='float:right'>Delete All</a></h2>\"\n table_data.each do |row|\n table_html << \"<ul style='border: 3px dotted'>\"\n row.attributes.each do |column_name, column_data|\n table_html << \"<li>#{column_name} : #{column_data}</li>\"\n end\n table_html << \"<li><a href='/admin/delete_db_view_record/#{table_name}_#{row.id}' class='btn btn-large btn-primary' style='font-size:20px;'>[Delete Record]</a></li></ul>\"\n end\n\n end\n render :text => table_html\n end", "title": "" }, { "docid": "7e232e7e221f9a2619aa957cbd0d389e", "score": "0.54555124", "text": "def index\n @teaching_routes = TeachingRoute.all\n @last_updated = TeachingRoute.first ? \"last updated #{TeachingRoute.first.last_update}\" : 'never updated'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teaching_routes }\n end\n end", "title": "" }, { "docid": "5c4198e6273dc64233deaebe1912efb9", "score": "0.545404", "text": "def index\n @old_systems = OldSystem.all\n end", "title": "" }, { "docid": "84d7a9925d390f7948fcbc944ae35d1a", "score": "0.5453638", "text": "def show\n begin\n @update = DatabaseUpdate.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n #flash[:error] = \"Invalid URL.\"\n redirect_to :action => 'index'\n end\n end", "title": "" }, { "docid": "d146c55302f1c8e7cecb607174d0ebe9", "score": "0.54450995", "text": "def floor_updates(options = {})\n get('/floor_updates', options)\n end", "title": "" }, { "docid": "c5f76a88660d51c3d9cae5175b40292b", "score": "0.5436968", "text": "def show\n @updates = Summary.where(number: @summary.number)\n end", "title": "" }, { "docid": "a07eadeacf65553fc23a563cc3d7a204", "score": "0.5433989", "text": "def index\n @latestinfos = Latestinfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @latestinfos }\n end\n end", "title": "" }, { "docid": "e710dba1fd6ba77ef4870a33b8d0750b", "score": "0.54330695", "text": "def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "title": "" }, { "docid": "14f1a9096a806acf308c35a98acda52f", "score": "0.54295033", "text": "def index\n @fud_entries = FudEntry.all.order(\"created_at DESC\")\n end", "title": "" }, { "docid": "5cb7a8cc08056a9e33c448d2789829a7", "score": "0.54270774", "text": "def index\n if is_admin?\n @databases = Database.all :include => :user\n else\n @databases = current_user.databases.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @databases }\n end\n end", "title": "" }, { "docid": "a6d5a17422de7e61ea4039eeb90fea77", "score": "0.54064643", "text": "def index\n date = Date.today - 2.weeks\n @records = []\n [Page, Event, Message, Newsletter, Style, Audio, Video, Document, Form].each do |model|\n @records += model.where(\"updated_at > ?\", date).order(\"updated_at DESC\")\n end\n @records.sort!{|a, b| b.updated_at <=> a.updated_at}\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @audit_logs }\n end\n end", "title": "" }, { "docid": "27a81dbc9015ac26a7190882fb73dd62", "score": "0.54060495", "text": "def view_all_date(db)\n db.execute(\"SELECT * FROM lifts ORDER BY date DESC\")\nend", "title": "" }, { "docid": "6be3c85383f4f331a8c0f300249b05b3", "score": "0.540448", "text": "def index\n @packages = @packages.sort_by {|p| p.name}\n @current_packages = @packages.select {|p| !p.old}\n @old_packages = @packages.select {|p| p.old}\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "f482082ff8f93b7a18a462550b100bd9", "score": "0.5402113", "text": "def render_index(updates)\n @updates = updates\n set_pagination\n render :index, :layout => show_layout?\n end", "title": "" }, { "docid": "e8cb61ea6ad5803b1d607bb0af75836d", "score": "0.54003847", "text": "def index\n #@notifications = Notification.all\n @notifications = Notification.order('updated_at').page(params[:page]).per_page(10)\n end", "title": "" }, { "docid": "e46f752299e4f4d22d0b1fc2a8c6245d", "score": "0.539996", "text": "def index\n @admin_versions = Admin::Version.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_versions }\n end\n end", "title": "" }, { "docid": "8113a24b5f5c99edcf37c72ed4bff27b", "score": "0.5398533", "text": "def index\n @farmer_group_changes = @farmer.farmer_group_changes.all.page(params[:page]).per(20)\n end", "title": "" }, { "docid": "a5f138360c937cffbd5882652bec3b6f", "score": "0.5396422", "text": "def atest_ID_25860_view_updates()\n login_as_user1\n go_to_updates_page\n verify_text \"test_ID_25860_view_updates\", \"Pending Updates\", \"All Updates\"\n end", "title": "" }, { "docid": "26ab357f9e0b2eb3fda9aeef8d65ebde", "score": "0.538783", "text": "def index\n @sequence_databases = SequenceDatabase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sequence_databases }\n end\n end", "title": "" }, { "docid": "39690df3342c14e5fa9dcf2d87653ab1", "score": "0.5384726", "text": "def index\n @estadia = Estadia.all.order(updated_at: :desc)\n end", "title": "" }, { "docid": "161a16a928c3f36867f257dfb03b4848", "score": "0.5381037", "text": "def latest\n @latest = apiQuery(\"items(first:1, order:UPDATED_DESC, include:[PUBLISHED,EMBARGOED]) { nodes { updated } }\").\n dig(\"items\", \"nodes\", 0, \"updated\")\n end", "title": "" }, { "docid": "7fe022207d81a35453cae9de94179bc8", "score": "0.5374947", "text": "def index\n @comites = Comite.all.sort_by(&:updated_at).reverse!\n end", "title": "" }, { "docid": "72db7ad550bab4358f0f8f3c217b4cbd", "score": "0.5367011", "text": "def latest\n @works = Work.latest\n render :index\n end", "title": "" }, { "docid": "e319b6658c82dc0de4ea766825bf8bd3", "score": "0.5363158", "text": "def index\n @projects = Project.all(:order => \"updated_at DESC\") \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "title": "" }, { "docid": "496f1ea0145ec8f07de443bb6561ff66", "score": "0.5353187", "text": "def index\r\n @sprints = Version.find_all_by_project_id(@project.id, :order => 'effective_date DESC')\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @sprints }\r\n end\r\n end", "title": "" }, { "docid": "496f1ea0145ec8f07de443bb6561ff66", "score": "0.5353187", "text": "def index\r\n @sprints = Version.find_all_by_project_id(@project.id, :order => 'effective_date DESC')\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @sprints }\r\n end\r\n end", "title": "" }, { "docid": "4c709ad4d10878677af7b0972fa642a9", "score": "0.5344719", "text": "def update\n respond_to do |format|\n if @database.update(database_params)\n format.html { redirect_to @database, notice: 'Database was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @database }\n else\n format.html { render action: 'edit' }\n format.json { render json: @database.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "113d6ef64334dc179aebdd9bdf9f4e99", "score": "0.5336608", "text": "def index\n @manage_app_versions = Manage::AppVersion.all\n end", "title": "" }, { "docid": "75d28a1ef82b90052d1bef2ad404a96e", "score": "0.5331589", "text": "def index\n @news_updates = NewsUpdate.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_updates }\n end\n end", "title": "" }, { "docid": "ab3d23882cb786d5e25311801498aed9", "score": "0.5326904", "text": "def index\n @api_versions = ApiVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_versions }\n end\n end", "title": "" }, { "docid": "3d0c8f9e778f39ef68dcd31c88d43747", "score": "0.5325713", "text": "def index\n @post_to_databases = PostToDatabase.all\n end", "title": "" }, { "docid": "213133ab007476cc96470d302713ee45", "score": "0.53255504", "text": "def index\n @topics = Topic.order(updated_at: :desc).all\n end", "title": "" }, { "docid": "c271cb733ae66ff5aad0f33384b825b0", "score": "0.53227615", "text": "def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend", "title": "" }, { "docid": "620826f666c629e506a4397f4b6142a2", "score": "0.53224105", "text": "def index\n @galleries = Gallery.all.order(updated_at: :desc)\n end", "title": "" } ]
ea3da1d6e8de57e7aa04ae43d7e2b357
POST /ethnics POST /ethnics.json
[ { "docid": "bbdc16fee10b15ab4967e1f8afcfd805", "score": "0.61727804", "text": "def create\n @ethnic = Ethnic.new(ethnic_params)\n\n respond_to do |format|\n if @ethnic.save\n format.html { redirect_to @ethnic, notice: 'Ethnic was successfully created.' }\n format.json { render :show, status: :created, location: @ethnic }\n else\n format.html { render :new }\n format.json { render json: @ethnic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "15048cf92a039a84e426c411aa8df172", "score": "0.65892327", "text": "def create\n @ethic = Ethic.new(ethic_params)\n\n respond_to do |format|\n if @ethic.save\n format.html { redirect_to @ethic, notice: 'Ethic was successfully created.' }\n format.json { render :show, status: :created, location: @ethic }\n else\n format.html { render :new }\n format.json { render json: @ethic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a1ac8d78d37e336e834e59f654e63cf4", "score": "0.6256302", "text": "def create\n @ethnicity = Ethnicity.new(ethnicity_params)\n\n respond_to do |format|\n if @ethnicity.save\n format.html { redirect_to @ethnicity, notice: 'Ethnicity was successfully created.' }\n format.json { render :show, status: :created, location: @ethnicity }\n else\n format.html { render :new }\n format.json { render json: @ethnicity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53f25e271e444e984867134123070cb5", "score": "0.6137464", "text": "def create\n @ethos = Ethos.new(params[:ethos])\n\n respond_to do |format|\n if @ethos.save\n format.html { redirect_to admin_ethoses_url, notice: 'Ethos was succesesfully created.' }\n format.json { render json: @ethos, status: :created, location: @ethos }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ethos.errors, status: :unprocesesable_entity }\n end\n end\n end", "title": "" }, { "docid": "1bd39e58b365d7cfa6cdc379f9da3547", "score": "0.58820254", "text": "def ethic_params\n params.require(:ethic).permit(:desc)\n end", "title": "" }, { "docid": "06aa32574961d541cc39ca4b7f9167cf", "score": "0.58737737", "text": "def ethnic_params\n params.require(:ethnic).permit(:ethnic_name)\n end", "title": "" }, { "docid": "ff0e7431cc4e94a0c35add655d2a0ac4", "score": "0.575357", "text": "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "title": "" }, { "docid": "15c3e60b0146e4eb44d79adcf0eeb269", "score": "0.56148964", "text": "def create body = {}\n @connection.request(method: :post, path: \"/networks/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "title": "" }, { "docid": "3b3506a5dcbff953c6c807dcabbb1fa0", "score": "0.5575398", "text": "def ethnicity_params\n params.require(:ethnicity).permit(:content)\n end", "title": "" }, { "docid": "5cffe5912a7bff8dc809fbe9a3bd2600", "score": "0.5539044", "text": "def create\n @charity = Charity.new(charity_params)\n uri = URI.parse(\"http://api.reimaginebanking.com/customers?key=ec40a3477234fc9418ca405ec3daa910\")\n\n header = {\"Content-Type\"=> \"application/json;charset=UTF-8\"}\n customer = {\n \"first_name\": @charity.name,\n \"last_name\": \"Trust\",\n \"address\": {\n \"street_number\": \"2820\",\n \"street_name\": \"Avent ferry Road\",\n \"city\": \"Raleigh\",\n \"state\": \"NC\",\n \"zip\": \"27606\"\n }\n }\n\n # Create the HTTP objects\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = customer.to_json\n\n # Send the request\n response = http.request(request)\n parsed_resp = JSON.parse(response.body)\n @charity.cust_id = parsed_resp[\"objectCreated\"][\"_id\"]\n uri = URI.parse(\"http://api.reimaginebanking.com/customers/#{@charity.cust_id}/accounts?key=ec40a3477234fc9418ca405ec3daa910\")\n\n header = {\"Content-Type\"=> \"application/json;charset=UTF-8\"}\n account = {\n \"type\": \"Credit Card\",\n \"nickname\": \"CharityAccount\",\n \"rewards\": 0,\n \"balance\": 0\n }\n\n # Create the HTTP objects\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = account.to_json\n\n # Send the request\n response = http.request(request)\n parsed_resp = JSON.parse(response.body)\n @charity.acc_id = parsed_resp[\"objectCreated\"][\"_id\"]\n @charity.balance = parsed_resp[\"objectCreated\"][\"balance\"]\n respond_to do |format|\n if @charity.save\n format.html { redirect_to @charity, notice: 'Charity was successfully created.' }\n format.json { render :show, status: :created, location: @charity }\n else\n format.html { render :new }\n format.json { render json: @charity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a85494addc900429fb9af7fac23b0f7", "score": "0.5525001", "text": "def create\n @ether = Ether.new(ether_params)\n\n respond_to do |format|\n if @ether.save\n format.html { redirect_to @ether, notice: 'Ether was successfully created.' }\n format.json { render :show, status: :created, location: @ether }\n else\n format.html { render :new }\n format.json { render json: @ether.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dce81da67008c9f9161324c8d57c283e", "score": "0.5466655", "text": "def set_ethic\n @ethic = Ethic.find(params[:id])\n end", "title": "" }, { "docid": "0eed0d531e6570c3545ddf2a0e37c23c", "score": "0.53483397", "text": "def setup_eth_address\n\n service_response = ClientManagement::SetupEthAddress.new(params).perform\n\n render_api_response(service_response)\n\n end", "title": "" }, { "docid": "b8a1f17a8d2025a72c84f2498cb38290", "score": "0.5341913", "text": "def index\n @ethics = Ethic.all\n end", "title": "" }, { "docid": "847900a2431333d7acb645333f7f4ca0", "score": "0.5328258", "text": "def coin_entry_params\n params.require(:coin_entry).permit(:city, :state, :country, :serial_number, :created_at, :description)\n end", "title": "" }, { "docid": "bcdbadb285217f5caf0e216ef40d7b20", "score": "0.53185785", "text": "def create_case(subject, created_at, resolved_at, description, count, external_id, s, e)\n uri = URI('https://yoursite.desk.com/api/v2/cases') # POST URI\n req = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'}) #set Post object (uri and content type header)\n req.basic_auth '<email>', '<password>' #set Post object (auth)\n\n #set Post object body && convert to json (contents of ticket)\n req.body =\n {\n type: \"email\",\n external_id: \"#{external_id}\",\n subject: \"#{subject}\",\n priority: 4,\n status: \"open\",\n labels: [\"archive\"],\n created_at: \"#{created_at}\",\n resolved_at: \"#{resolved_at}\",\n message: {\n direction: \"in\",\n subject: \"#{subject}\",\n body: \"#{description}\",\n to: \"<email>\",\n from: \"<email>\",\n created_at: \"#{created_at}\"\n }\n }.to_json\n\n #send the request\n res = Net::HTTP.start(uri.hostname, uri.port,\n :use_ssl => uri.scheme == 'https') do |http|\n http.request(req)\n end\n if res.is_a?(Net::HTTPSuccess)\n puts \"Case Created!\"\n #success logging\n s.write(\"#{res.body}\\n\")\n return true\n else\n puts \"Oops! Case not created.\"\n #error logging\n e.write(\"#{res.body}\")\n return false\n end\nend", "title": "" }, { "docid": "0f6d643f847e1eb4d48a1933acd81026", "score": "0.5305299", "text": "def create_event\n endpoint = \"#{'https://translate.yandex.net/api/v1.5/tr.json/translate'}\"\n \n request_body = {\n corpo: 1\n }\n \n headers = {\n \"Authorization\" => \"Bearer #{'trnsl.1.1.20191205T130144Z.2a043cc22c2feed9.219129f8bf3cd51f6480bbcbb0af6e4dd1878cc3'}\",\n \"Content-Type\" => \"application/json\"\n }\n \n RestClient.post(endpoint, request_body, headers)\n end", "title": "" }, { "docid": "952dbdda660421a8408a8df37a7d860c", "score": "0.52552015", "text": "def create\n \n \tputs params.inspect\n \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('/days.json')\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\trequest.set_form_data(ActiveSupport::JSON.encode(params))\n#\t\trequest.set_form_data({:day => params['day']})\n\t\treq = ActiveSupport::JSON.encode(params);\n\t\tputs req\n\t\trequest.set_form_data(params)\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 \n=begin\n @day = Day.new(params[:day])\n\n respond_to do |format|\n if @day.save\n format.html { redirect_to @day, notice: 'Day was successfully created.' }\n format.json { render json: @day, status: :created, location: @day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "title": "" }, { "docid": "b369faabb6ca1b3f158bda53217d5423", "score": "0.52318794", "text": "def ethnicities=(params)\n @ethnicities = []\n\n params = params['ethnicity'] if params.is_a?(Hash) && params.key?('ethnicity')\n\n Array.wrap(params).each do |hash|\n @ethnicities << GreatSchools::Ethnicity.new(hash)\n end\n\n @ethnicities\n end", "title": "" }, { "docid": "2402142733e7f3f07ffc1aad48add8cd", "score": "0.52301604", "text": "def index\n @ethnics = Ethnic.all\n end", "title": "" }, { "docid": "706fd2d91ac4c4a903155b0b4a4da49c", "score": "0.5205493", "text": "def test_continents_invalid_format\n data = { 'name' => 'Wandering albatross', 'family' => 'Diomedeidae',\n 'continents' => 'Antarctica', 'added' => '1993-03-15' }\n post '/birds', data.to_json\n assert last_response.status.eql?(400)\n end", "title": "" }, { "docid": "b21e019a83e7fd5baa81aeb08ee75184", "score": "0.5183651", "text": "def network_params\n params.require(:network).permit(:name, :sector, :network, :city, :email, :residence, :phone, :gender, :birthday, :about, :experience, :reference, :terms_of_service)\n end", "title": "" }, { "docid": "cbcf9198857368769e34ee7dfd2a1e36", "score": "0.51733637", "text": "def create\n new_market_params = market_params\n new_market_params[:tenant_id] = Tenant.current\n new_market_params[:published_date] = Date.strptime(market_params[:published_date],\n '%m/%d/%Y %k:%M %p')\n new_market_params[:arbitration_date] = Date.strptime(market_params[:arbitration_date],\n '%m/%d/%Y %k:%M %p')\n\n if new_market_params[:market_type] == \"Yes/No\"\n new_market_params[:contracts_attributes] = []\n new_market_params[:contracts_attributes] << {:name => \"YES\"}\n new_market_params[:contracts_attributes] << {:name => \"NO\"}\n end\n\n logger.debug new_market_params\n new_market_params.permit!\n @market = Market.new(new_market_params)\n @market.save\n respond_to do |format|\n if @market.save\n format.html { redirect_to @market, notice: 'Market was successfully created.' }\n format.json { render :show, status: :created, location: @market }\n else\n format.html { render :new }\n format.json { render json: @market.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4502e219bcee25fdf4559ebd150a5b88", "score": "0.51544595", "text": "def get_test_eth\n\n service_response = ClientManagement::GetTestEth.new(params).perform\n\n render_api_response(service_response)\n\n end", "title": "" }, { "docid": "9e2086604c76edf310ba00c5b1ebd7ba", "score": "0.5154456", "text": "def post(hashbody)\n self.class.post(\"/aldebaran-b2bcontracts/b2bcontracts\", :basic_auth => @auth, :body => hashbody.to_json)\n end", "title": "" }, { "docid": "de0eb11872ca95bf81618efc7c06f77f", "score": "0.51459914", "text": "def create\n @gigabit_ethernet = GigabitEthernet.new(gigabit_ethernet_params)\n\n respond_to do |format|\n if @gigabit_ethernet.save\n format.html { redirect_to @gigabit_ethernet, notice: 'Gigabit ethernet was successfully created.' }\n format.json { render :show, status: :created, location: @gigabit_ethernet }\n else\n format.html { render :new }\n format.json { render json: @gigabit_ethernet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e09b929dda1d4e97bac252b8d570e0a", "score": "0.51259124", "text": "def set_ethnicity\n @ethnicity = Ethnicity.find(params[:id])\n end", "title": "" }, { "docid": "c18a92ac35f5ed7274bc5f9271c62e37", "score": "0.5122715", "text": "def create\n #@attendance = Attendance.new(attendance_params)\n #@contract = Contract.find(params[\"attendances_attributes\"][0][:contract_id])\n #@attendance = @contract.attendances.new(:contract_id => @contract.id)\n @attendance = Attendance.new(attendance_params)\n #@attendance = @contract.attendances.new(attendance_params)\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { render :new }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a538552dea5a8c566128e4ca5a6d8a33", "score": "0.5114038", "text": "def create\n @ethnic_group = EthnicGroup.new(params[:ethnic_group])\n\n respond_to do |format|\n if @ethnic_group.save\n format.html { redirect_to @ethnic_group, notice: 'Ethnic group was successfully created.' }\n format.json { render json: @ethnic_group, status: :created, location: @ethnic_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ethnic_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea50549fc5912ba527882a12591e141d", "score": "0.51113486", "text": "def eth_coinbase\n do_request(:eth_coinbase)\n end", "title": "" }, { "docid": "83fc0a726c88fd4c3462f7dfae3dedb0", "score": "0.5104068", "text": "def create\n @contractee = Contractee.new(contractee_params)\n\n respond_to do |format|\n if @contractee.save\n format.html { redirect_to @contractee, notice: 'Contractee was successfully created.' }\n format.json { render :show, status: :created, location: @contractee }\n else\n format.html { render :new }\n format.json { render json: @contractee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2deab458965ab06351a07fcdfeb8da9", "score": "0.5091316", "text": "def new\n @ethos = Ethos.new\n end", "title": "" }, { "docid": "43fab640748766b122153fdea3cedf31", "score": "0.508809", "text": "def createAcct(custID, json)\n\turl = \"http://api.reimaginebanking.com:80/customers/#{custID}/accounts?key=#{APIkey}\"\n\turi = URI.parse(url)\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\tputs(uri.host)\n\tputs(uri.port)\n\tkey = \"?key=#{APIkey}\"\n\tputs(uri.path+key)\n\tmyHash = JSON.parse(json)\n\tputs(myHash)\n\tputs(Net::HTTP.post_form(uri, myHash))\n#\tgetCustAccts('5516c07ba520e0066c9ac53b')\nend", "title": "" }, { "docid": "adf9ba5684aa12551398a9de31ea36e1", "score": "0.5086269", "text": "def create\n\n @ecn = Ecn.new(params[:ecn])\n @ecn.status = false\n\n respond_to do |format|\n if @ecn.save\n format.html { redirect_to @ecn, notice: 'Ecn was successfully created.' }\n format.json { render json: @ecn, status: :created, location: @ecn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ecn.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45b1018b346bf92011b7d8a9c07ca341", "score": "0.50776505", "text": "def create\n @dht = Dht.new(dht_params)\n\n respond_to do |format|\n if @dht.save\n #Convert telemetries to json format\n telemetries = dht_params.to_json(:methods => :get_created_at)\n Rails.logger.debug \"What does it look like:: #{telemetries} \"\n #send to azure event hub\n if eventHub.send_event(telemetries)\n Rails.logger.info 'Successfully sent payload to azure'\n format.html { redirect_to @dht, notice: 'Successfully created records and sent to AzureEventHub.' }\n format.json { render :show, status: :created, location: @dht }\n else\n format.html { redirect_to @dht, notice: 'Successfully created records but failed to send telemetries to AzureEventHub.' }\n format.json { render :show, status: :created, location: @dht }\n end\n else\n format.html { render :new }\n format.json { render json: @dht.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70bbcc364e7b409f10e4e9511536431f", "score": "0.5050502", "text": "def post(rectype,attribs,http)\r\n endpoint=\"#{URL_PREFIX}/t#{rectype}s.json\"\r\n req = Net::HTTP::Post.new(endpoint,initheader = {'Content-Type' =>'application/json'})\r\n req.body = attribs.to_json\r\n http.request(req)\r\nend", "title": "" }, { "docid": "2f46203e03b81bd29630620bd9a2b222", "score": "0.50373024", "text": "def create_epic(params)\n Endpoints::Epic.new(client).create(id, params)\n end", "title": "" }, { "docid": "b0cd3d97a12a5b27599014d41bd57e4b", "score": "0.5032869", "text": "def post_event(config, event, payload_type, payload)\n url = \"https://hall.com/api/1/services/crashlytics/#{config[:group_token]}\"\n\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post url do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end", "title": "" }, { "docid": "201b7293a5a876c47ee411b902d248c6", "score": "0.50214803", "text": "def tichet_params\n params.require(:tichet).permit(:name, :seat_id, :address, :price_paid)\n end", "title": "" }, { "docid": "37404fd36a2b845413c0138fa621e60a", "score": "0.5012044", "text": "def create(number=\"Default Name\", name=\"9999\", address=\"00\")\n json_req = \"{\\\"device\\\":{ \\\"number\\\":\\\"#{number}\\\",\\\"name\\\":\\\"#{name}\\\",\\\"address\\\":\\\"#{address}\\\"}}\"\n \n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/json\"\n request.body = json_req\n \n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n \n response.body \n end", "title": "" }, { "docid": "6771d6cb02e4f45e99f6d576b30ff9bd", "score": "0.5009896", "text": "def create\n consumer_id = params[:consumer_id]\n if (consumer_id)\n consumer = Consumer.find_or_create_by(crumb_id: consumer_id)\n \n params[:sightings].each do |sighting|\n if sighting[:beacon]\n beacon = Beacon.find(sighting[:beacon][:uuid] + '|' + sighting[:beacon][:major] + '|' + sighting[:beacon][:minor])\n if (beacon)\n crumb = Crumb.create(observed_at: sighting[:observed_at], \n accuracy: sighting[:beacon][:accuracy],\n rssi: sighting[:beacon][:rssi],\n proximity: sighting[:beacon][:proximity])\n consumer.crumbs << crumb\n beacon.crumbs << crumb\n end\n end\n end\n consumer.push_any_eligible_offers_to_passes\n render status:201, nothing: true\n else\n render status:401, nothing: true \n end\n end", "title": "" }, { "docid": "4ef958dd295dc11e913f1bbccf8f2ee0", "score": "0.50070584", "text": "def create\n @chainentry = @chain.chainentry.build(params[:chainentry])\n #@chainentry = Chainentry.new(params[:chainentry])\n\n respond_to do |format|\n if @chainentry.save\n format.html { redirect_to chain_chainentries_url(@chain), :notice => 'Chainentry was successfully created.' }\n format.json { render :json => @chainentry, :status => :created }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @chainentry.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00cbd2340293b82818280a2e1314246b", "score": "0.5001969", "text": "def seed_hospital_data\n hospital_data_string = RestClient.get(\"https://health.data.ny.gov/resource/7xgt-tyms.json\")\n hospital_data_hash = JSON.parse(hospital_data_string)\n hospital_data_hash.each do |key|\n Hospital.create(facility_name: key[\"facility_name\"],\n street: key[\"address1\"], city: key[\"city\"], state: key[\"cooperator_state\"],\n county: key[\"county\"], zip: key[\"fac_zip\"].to_i, phone: key['fac_phone'],\n description:key[\"description\"], latitude: key[\"latitude\"], longitude: key[\"longitude\"] )\n end\nend", "title": "" }, { "docid": "0fc983d0ffa28383158846aaee00867d", "score": "0.4995064", "text": "def create\n @coin = Coin.new(coin_params)\n if @coin.save\n render json: @coin\n else\n render json: {errors: @coin.errors.full_messages}, status: 422\n end\n end", "title": "" }, { "docid": "9c7a66c3501a5d32225efec41879ee58", "score": "0.4970804", "text": "def create\n megam_rest.post_boltdefn(to_hash)\n end", "title": "" }, { "docid": "007942b39856b3598ca541b297cc526c", "score": "0.49658102", "text": "def test_a11y(url)\n data = {\n url: url,\n key: \"YOUR TENON KEY\",\n level: \"AA\"\n }\n\n uri = URI.parse('https://tenon.io/api/')\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.set_form_data(data)\n response = https.request(request) \n\n return JSON.parse(response.body)\n end", "title": "" }, { "docid": "3d7cbbe19ff0020325da92a67326fd04", "score": "0.49553016", "text": "def create\n data = params[:cert].read\n existing = Tinc.find_by_cert_data(data)\n @tinc = Tinc.new(:cert_data => data)\n #Quick-and-dirty: Using lff wlan_mac = mac-address of eth0\n wlan_mac = session[:wlan_mac]\n bat0_mac = session[:bat0_mac]\n @tinc.node = Node.find_by_wlan_mac(wlan_mac) || Node.new(:wlan_mac => wlan_mac)\n @tinc.rip = request.remote_ip\n respond_to do |format|\n if existing || @tinc.save\n format.txt { }\n else\n format.txt { render :text => \"Error processing tinc-submission - \" + @tinc.errors.full_messages.join(\"\\n\") + \"\\n\"}\n end\n end\n end", "title": "" }, { "docid": "9c1816461bad1032ecd0d0cc13918706", "score": "0.49513644", "text": "def create\n params.permit!\n @transaktion = Transaktion.new(params[\"transaktion\"])\n @transaktion.save # see http://stackoverflow.com/a/2618902/948073 \n params[\"entry\"].keys.each do |index|\n entry = params[\"entry\"][index]\n puts entry\n if entry[\"account_id\"]\n\t entry[\"qty\"] = 1 if not entry[\"qty\"]\n\t # price is an integer field, measured in pennies...\n\t is_debit = (index.to_i%2 != 0)\n\t entry[\"is_debit\"] = is_debit\n\t price = (100.0*(entry[\"price\"].to_f)+0.5).to_s\n\t entry[\"price\"] = price\n\t entry[\"transaktion_id\"] = @transaktion.id\n\t Entry.new(entry).save\n end\n end\n\n respond_to do |format|\n if @transaktion.save\n format.html { redirect_to @transaktion, notice: 'Transaktion was successfully created.' }\n format.json { render :show, status: :created, location: @transaktion }\n else\n format.html { render :new }\n format.json { render json: @transaktion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f77d7bc1d2bda6174a43429ee0f1fa9", "score": "0.49418813", "text": "def post(secureNetId, secureKey, body, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend", "title": "" }, { "docid": "5f77d7bc1d2bda6174a43429ee0f1fa9", "score": "0.49418813", "text": "def post(secureNetId, secureKey, body, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend", "title": "" }, { "docid": "b5c1e405cd86e3efa5faad1625999f25", "score": "0.493817", "text": "def create\n @device_interest = DeviceInterest.new(device_interest_params)\n\n respond_to do |format|\n if @device_interest.save\n format.html { redirect_to @device_interest, notice: 'Device interest was successfully created.' }\n format.json { render :show, status: :created, location: @device_interest }\n else\n format.html { render :new }\n format.json { render json: @device_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c55b78cc3d4078c9649d4585d940be2c", "score": "0.49355653", "text": "def create\n @celestial_entity = CelestialEntity.new(params[:celestial_entity])\n\n respond_to do |format|\n if @celestial_entity.save\n format.html { redirect_to @celestial_entity, notice: 'Celestial entity was successfully created.' }\n format.json { render json: @celestial_entity, status: :created, location: @celestial_entity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @celestial_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4616f1100412aad136933467c29ee495", "score": "0.4932657", "text": "def ether_params\n params.require(:ether).permit(:name, :drug_name, :title, :size_mb, :records, :file, :formula, :chemistry, :legal_status, :clinical_data, :cas_number, :side_effects)\n end", "title": "" }, { "docid": "4887f72eed28b73b9e5ae9c9274d8fab", "score": "0.49309573", "text": "def create\n client = Client.create!(\n name: params[:name],\n last_name: params[:last_name],\n email: params[:email],\n cpf: params[:cpf],\n phone: params[:phone],\n birth_date: params[:birth_date],\n sex: params[:sex],\n profession: params[:profession],\n marital_status: params[:marital_status],\n children: params[:children],\n number_children: params[:number_children],\n zip_code: params[:zip_code],\n street: params[:street],\n number: params[:number],\n neighbohood: params[:neighbohood],\n complement: params[:complement],\n city: params[:city],\n state: params[:state],\n name_emergency: params[:name_emergency],\n phone_emergency: params[:phone_emergency],\n doctor: params[:doctor],\n phone_doctor: params[:phone_doctor],\n agreement: params[:agreement],\n number_agreement: params[:number_agreement],\n hospital: params[:hospital]\n )\n render status: :created, json: client\n end", "title": "" }, { "docid": "20dff73a53441fd3929e5bb5ea7075f2", "score": "0.49290502", "text": "def create\n # Only companies can create contracts\n\n if !current_user.is_student\n @contract = Contract.new(contract_params)\n @contract.owner = current_user.id\n current_user.contracts << @contract\n\n #skills\n \n result = params[:skill_tag_name].split(\",\")\n result.each do |k|\n skill = SkillTag.find_by_name(k)\n @contract.skill_tags << skill\n @contract.save!\n end\n respond_to do |format|\n if @contract.save\n format.html { redirect_to @contract, notice: 'Contract was successfully created.' }\n format.json { render :show, status: :created, location: @contract }\n else\n format.html { render :new }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e42d4211c2571a827686489883ab3e4", "score": "0.49269506", "text": "def create\n @net_svc = NetSvc.new(params[:net_svc])\n\n respond_to do |format|\n if @net_svc.save\n format.html { redirect_to @net_svc, notice: 'Net svc was successfully created.' }\n format.json { render json: @net_svc, status: :created, location: @net_svc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @net_svc.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "325075569eae62029cbac5b5a8e70250", "score": "0.49254107", "text": "def create\n unless params[:attendee][:e_city].blank?\n params[:attendee][:attendee_id] = (params[:attendee][:e_city][0].upcase + Array.new(2){[*'0'..'9'].sample}.join + [\"0\", \"2\", \"4\", \"6\", \"8\"].sample)\n while !Attendee.find_by_attendee_id(params[:attendee][:attendee_id]).nil?\n params[:attendee][:attendee_id] = (params[:attendee][:e_city][0].upcase + Array.new(2){[*'0'..'9'].sample}.join + [\"0\", \"2\", \"4\", \"6\", \"8\"].sample)\n end\n end\n params[:attendee][:a_platform] = params[:attendee][:a_platform].join(\";\") unless params[:attendee][:a_platform].nil?\n params[:attendee][:a_market_segment] = params[:attendee][:a_market_segment].join(\";\") unless params[:attendee][:a_market_segment].nil?\n @attendee = Attendee.new(params[:attendee])\n\n respond_to do |format|\n if @attendee.save\n format.html { redirect_to @attendee, notice: t(:successfully_created) }\n format.json { render json: @attendee, status: :created, location: @attendee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82f915c5ffaac4bdbee0ff9cdc27efd5", "score": "0.49231124", "text": "def create\n @technician = Technician.new(technician_params)\n\n respond_to do |format|\n if @technician.save\n format.html { redirect_to edit_contractor_path(@technician.contractor,anchor: \"technicians_tab\"), notice: 'Technician was successfully created.' }\n format.json { render :show, status: :created, location: @technician }\n else\n format.html { render :new }\n format.json { render json: @technician.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02d4caac882842e00b21bdce33f967a8", "score": "0.49136633", "text": "def request_elastics(params)\n elastics.request(elastics_params.merge!(params))\n end", "title": "" }, { "docid": "ad642fc896584ac6843b24128e4e3a0c", "score": "0.49086922", "text": "def create\n authorize! :create, CompetenceTier\n \n @competence_tier = CompetenceTier.new(competence_tier_params)\n\n @competence_tier.save!\n render json: {status: :ok}\n end", "title": "" }, { "docid": "25ea207470ade97b307c47e7eac9fd76", "score": "0.4897764", "text": "def create\n @ethnoidiogloss = Ethnoidiogloss.new(ethnoidiogloss_params)\n\n respond_to do |format|\n if @ethnoidiogloss.save\n format.html { redirect_to @ethnoidiogloss, notice: 'Ethnoidiogloss was successfully created.' }\n format.json { render :show, status: :created, location: @ethnoidiogloss }\n else\n format.html { render :new }\n format.json { render json: @ethnoidiogloss.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6da59822809697df805e56dab54c2531", "score": "0.48949856", "text": "def create\n encounter_id, obs_archetypes = params.require %i[encounter_id observations]\n\n encounter = Encounter.find(encounter_id)\n\n observations = obs_archetypes.collect do |archetype|\n obs, _child_obs = service.create_observation(encounter, archetype.permit!)\n obs\n end\n\n render json: observations, status: :created\n end", "title": "" }, { "docid": "ed63aacb46d38fa88ad8a0d2770cf43b", "score": "0.4884001", "text": "def create\n @realtime_contract = RealtimeContract.new(realtime_contract_params)\n\n respond_to do |format|\n if @realtime_contract.save\n format.html { redirect_to @realtime_contract, notice: 'Realtime contract was successfully created.' }\n format.json { render :show, status: :created, location: @realtime_contract }\n else\n format.html { render :new }\n format.json { render json: @realtime_contract.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0dac5705ece1892e5c0bf853b2b62b10", "score": "0.48775232", "text": "def add_form__netzke_0__netzke_submit_endpoint(params)\n res = component_instance(:add_form__netzke_0).netzke_submit(params)\n\n if res[:set_form_values]\n # successful creation\n on_data_changed\n res[:set_form_values] = nil\n end\n res.to_nifty_json\n end", "title": "" }, { "docid": "161906b921f301d1c017e10e9f4ab9ad", "score": "0.48736736", "text": "def create\n @thc = Thc.new(thc_params)\n\n respond_to do |format|\n if @thc.save\n format.html { redirect_to @thc, notice: 'Thc was successfully created.' }\n format.json { render :show, status: :created, location: @thc }\n else\n format.html { render :new }\n format.json { render json: @thc.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e0e93e43408b623f9ecd01187aa965d3", "score": "0.48729748", "text": "def create\n puts \"crm create entry\"\n puts to_hash\n megam_rest.post_crm(to_hash) \n end", "title": "" }, { "docid": "527a7278139628c360ea1bc1e8d30187", "score": "0.48727697", "text": "def create\n Rails.logger.info \"==========================\"\n Rails.logger.info request.raw_post\n Rails.logger.info \"==========================\"\n data = JSON.parse(request.raw_post).symbolize_keys\n ignore = [\"victims\", \"offenders\", \"attachments\"]\n incident_params = data[:incident]\n incident_params = incident_params.except(*ignore)\n @incident = Incident.new(incident_params)\n @incident.status = \"pending\"\n @incident.offender = \"N/A\"\n if @user\n @incident.user_id = @user.id\n end\n if @incident.save\n data[:incident][\"victims\"].each do |record|\n victim = Victim.new(record)\n victim.incident_id = @incident.id\n victim.save\n end\n data[:incident][\"offenders\"].each do |record|\n offender = Offender.new(record)\n offender.incident_id = @incident.id\n oc = Offendercategory.find_by_id(offender.offendercategory_id)\n if !oc\n Offendercategory.create(name: \"General\",id: offender.offendercategory_id)\n end\n offender.save\n end\n json_response(@incident)\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "576dcea1a7fbd67b878d41025e7f4d97", "score": "0.48689082", "text": "def post(secureNetId, secureKey, body, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\n end", "title": "" }, { "docid": "43a6224e072e062d50f21f090d63a6a8", "score": "0.4860915", "text": "def create\n @epic = Epic.new(params[:epic])\n respond_to do |format|\n if @epic.save\n format.html { redirect_to @epic, notice: 'Epic was successfully created.' }\n format.json { render json: @epic, status: :created, location: @epic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @epic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b9437c1a78c4ba6378be42b04eaec8f", "score": "0.48516873", "text": "def create\n @account = current_user.accounts.new(account_params)\n\n respond_to do |format|\n if @account.save\n\n # Create corresponding entries\n date = (params[:date].blank? ? DateTime.current : DateTime.parse(params[:date]))\n current_user.entries.create(date: date-1.day, directive: :open, arguments: \"#{@account.name} #{@account.currency_list}\")\n if (amount = Amount.new(params[:balance])) && (amount.blank? == false) && (amount.number != 0)\n equity_setup = 'Equity:Setup'\n equity = current_user.accounts.find_or_create_by(name: equity_setup) do |account|\n equity = current_user.entries.create(date: date-1.day, directive: :open, arguments: account.name)\n end\n current_user.entries.new(date: date-1.day, directive: :pad, arguments: \"#{@account.name} #{equity.name}\")\n current_user.entries.new(date: date, directive: :balance, arguments: \"#{@account.name} #{params[:balance]}\")\n end\n\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f937ac7f3634be10425568e04b674b3f", "score": "0.4850525", "text": "def create\n @coincidence = Coincidence.new(coincidence_params)\n\n respond_to do |format|\n if @coincidence.save\n format.html { redirect_to @coincidence, notice: 'Coincidence was successfully created.' }\n format.json { render :show, status: :created, location: @coincidence }\n else\n format.html { render :new }\n format.json { render json: @coincidence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df2c5658e5bea77a61314bfb3ab4277c", "score": "0.4843009", "text": "def index\n @ethnicities = Ethnicity.all\n end", "title": "" }, { "docid": "7149a2c77dc0d1ee38342801887b3650", "score": "0.4842887", "text": "def ethogram_params\n params.require(:ethogram).permit(:name, :structure)\n end", "title": "" }, { "docid": "33e8a5dcff6b22a38f6c34d137440136", "score": "0.48336434", "text": "def terms_and_conditions(request)\n route_terminal_request('POST', '/api/tc', '/api/terminal-tc', request)\n end", "title": "" }, { "docid": "b2bb457b0d2d5e04a3d9f686e79190b0", "score": "0.48332217", "text": "def account_create()\n current_name = ENV[\"NAME\"] || \"XGT0000000000000\"\n wif = ENV[\"WIF\"] || '5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n'\n rpc = Xgt::Ruby::Rpc.new('http://localhost:8751')\n config = rpc.call('database_api.get_config', {})\n address_prefix = config['XGT_ADDRESS_PREFIX']\n chain_id = config[\"XGT_CHAIN_ID\"]\n\n witness_schedule = rpc.call('database_api.get_witness_schedule', {}) || {}\n chain_properties = witness_schedule['median_props']\n\n fee = chain_properties[\"account_creation_fee\"] || {}\n amount = fee['amount'].to_f * 0.001\n creation_fee = \"#{'%0.3f' % amount} XGT\"\n\n # Generate keys\n master = Xgt::Ruby::Auth.random_wif\n recovery_private = Xgt::Ruby::Auth.generate_wif(current_name, master, 'recovery')\n recovery_public = Xgt::Ruby::Auth.wif_to_public_key(recovery_private, address_prefix)\n money_private = Xgt::Ruby::Auth.generate_wif(current_name, master, 'money')\n money_public = Xgt::Ruby::Auth.wif_to_public_key(money_private, address_prefix)\n social_private = Xgt::Ruby::Auth.generate_wif(current_name, master, 'social')\n social_public = Xgt::Ruby::Auth.wif_to_public_key(social_private, address_prefix)\n memo_private = Xgt::Ruby::Auth.generate_wif(current_name, master, 'memo')\n memo_public = Xgt::Ruby::Auth.wif_to_public_key(memo_private, address_prefix)\n\n puts JSON.pretty_generate(recovery_private)\n puts \"\\n\\n\"\n puts JSON.pretty_generate(money_private)\n puts \"\\n\\n\"\n\n txn = {\n 'extensions': [],\n 'operations': [[\n 'account_create',\n {\n 'fee': creation_fee,\n 'creator': current_name,\n 'recovery': {\n 'weight_threshold': 1,\n 'account_auths': [],\n 'key_auths': [[recovery_public, 1]]\n },\n 'money': {\n 'weight_threshold': 1,\n 'account_auths': [],\n 'key_auths': [[money_public, 1]]\n },\n 'social': {\n 'weight_threshold': 1,\n 'account_auths': [],\n 'key_auths': [[social_public, 1]]\n },\n 'memo_key': memo_public,\n 'json_metadata': \"\",\n 'extensions': []\n }\n ]]\n }\n\n puts \"\\e[36mSent:\\n\\e[0m\"\n puts JSON.pretty_generate(txn)\n signed = Xgt::Ruby::Auth.sign_transaction(rpc, txn, [wif], chain_id)\n response = rpc.call('network_broadcast_api.broadcast_transaction_synchronous', [signed])\n puts \"\\e[36m\\nResponse:\\n\\e[0m\"\n puts JSON.pretty_generate(response)\n\n account_names = rpc.call('condenser_api.get_account_names_by_block_num', [response['block_num']]) \n account_name = account_names.first \n \n puts(\"\\nAccount name: #{account_name}\")\n\nend", "title": "" }, { "docid": "933d5ce3229ee3dc5f5138eb2765a343", "score": "0.48302874", "text": "def create\n @petty_cash = PettyCash.new(petty_cash_params)\n\n respond_to do |format|\n if @petty_cash.save\n format.html { redirect_to petty_cashes_path, notice: 'Petty cash was successfully created.' }\n format.json { render :show, status: :created, location: @petty_cash }\n else\n format.html { render :new }\n format.json { render json: @petty_cash.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6dfc8384b7978bdddb613aa02f9b4d4b", "score": "0.48280668", "text": "def create_post_election_contract\n $pst_contract = Ethereum::Contract.create(client: $EthClient, file: $pst_contract_loc)\n $pst_contract_address = $pst_contract.deploy_and_wait\n \n ##saving contract info details\n CSV.open( 'public/files/contracts.csv', 'a+' ,:headers => true, quote_char: \" \") do |writer|\n writer.puts([\"\\\"#{$pst_contract_name}\\\"\", \"\\\"#{$pst_contract_address}\\\"\"])\n end\n \n end", "title": "" }, { "docid": "42b6f678f2ea4aac556e68d7473e2d27", "score": "0.48267764", "text": "def toKitten(**_args)\n bok = {\n \"cloud\" => \"AWS\",\n \"credentials\" => @credentials,\n \"cloud_id\" => @cloud_id,\n \"region\" => @region\n }\n\n if !cloud_desc\n MU.log \"toKitten failed to load a cloud_desc from #{@cloud_id}\", MU::ERR, details: @config\n return nil\n end\n\n # Ignore groups created/managed by AWS\n if cloud_desc.group_name == \"default\" or\n cloud_desc.group_name.match(/^AWS-OpsWorks-/)\n return nil\n end\n\n # XXX identify if we'd be created by the ingress_rules of another\n # resource\n\n bok[\"name\"] = cloud_desc.group_name\n\n if cloud_desc.vpc_id\n bok['vpc'] = MU::Config::Ref.get(\n id: cloud_desc.vpc_id,\n cloud: \"AWS\",\n credentials: @credentials,\n type: \"vpcs\",\n )\n end\n\n if cloud_desc.tags and !cloud_desc.tags.empty?\n bok['tags'] = MU.structToHash(cloud_desc.tags, stringify_keys: true)\n realname = MU::Adoption.tagsToName(bok['tags'])\n bok['name'] = realname if realname\n end\n\n if cloud_desc.ip_permissions\n bok[\"rules\"] ||= []\n bok[\"rules\"].concat(MU::Cloud::AWS::FirewallRule.rulesToBoK(cloud_desc.ip_permissions))\n bok[\"rules\"].concat(MU::Cloud::AWS::FirewallRule.rulesToBoK(cloud_desc.ip_permissions_egress, egress: true))\n end\n\n bok\n end", "title": "" }, { "docid": "5ce35d9331319033786c2c85c67ffc87", "score": "0.4822109", "text": "def destroy\n @ethic.destroy\n respond_to do |format|\n format.html { redirect_to ethics_url, notice: 'Ethic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9e321734dfccc4be0aa2dbb9241ac201", "score": "0.4821817", "text": "def create\n @signatory =@bank_account.signatories.new(signatory_params)\n\n respond_to do |format|\n if @signatory.save\n format.html { redirect_to client_bank_account_signatory_path(@client,@bank_account,@signatory), notice: 'Signatory was successfully created.' }\n format.json { render :show, status: :created, location: @signatory }\n else\n format.html { render :new }\n format.json { render json: @signatory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "826f81b6f838dfc75cb5886c3bd16f61", "score": "0.4819647", "text": "def post_create_from_chain_request(version, data = {}.to_json)\n post :create_from_process_step, params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }\nend", "title": "" }, { "docid": "49b5caeea01cdece740c87de0abccc10", "score": "0.4819502", "text": "def create\n @signal_chain = SignalChain.new(signal_chain_params)\n\n respond_to do |format|\n if @signal_chain.save\n format.html { redirect_to @signal_chain, notice: 'Signal chain was successfully created.' }\n format.json { render action: 'show', status: :created, location: @signal_chain }\n else\n format.html { render action: 'new' }\n format.json { render json: @signal_chain.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4eb35a3ddaa1b4af1dd1e1d8320f66b", "score": "0.48161843", "text": "def create\n @therapy_category = TherapyCategory.new(therapy_category_params)\n \n params[:therapy_category][:therapies].each do |key, value|\n if(value.to_i == 1)\n @therapy_category.therapies << Therapy.find(key)\n end\n end\n\n respond_to do |format|\n if @therapy_category.save\n format.html { redirect_to therapy_categories_path }\n format.json { render :show, status: :created, location: @therapy_category }\n else\n format.html { render :new }\n format.json { render json: @therapy_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fdd04dd7640959386194b4883991e679", "score": "0.48015428", "text": "def create_entity(entity_id, request)\n start.uri('/api/entity')\n .url_segment(entity_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "e5f808db712b5f35cb6ad72be612a890", "score": "0.47977006", "text": "def create\n @market = Market.new(market_params)\n\n respond_to do |format|\n if @market.save\n 24.times do |hour|\n if (10..18).include? hour\n value = 60\n else\n value = 0\n end\n if hour.to_s.length == 1\n zero = \"0\"\n else\n zero = \"\"\n end\n @market.volsofdays.create!(time: \"#{zero}#{hour}:00\", value: value)\n end\n\n 7.times do |day|\n @market.worktime_broadcastings.create!(wday: day, start: \"10:00\", stop: \"20:00\")\n end\n\n format.html { redirect_to @market, notice: 'Market was successfully created.' }\n format.json { render :show, status: :created, location: @market }\n else\n format.html { render :new }\n format.json { render json: @market.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ea905239bb6a65896995f1d2fb8c485", "score": "0.47923455", "text": "def create\n @network = Network.new(network_params.merge({ broker: Broker.first }))\n\n respond_to do |format|\n if @network.save\n @network.users << current_user\n @network.create_homebus_announcer(current_user)\n\n format.html { redirect_to @network, notice: 'Network was successfully created.' }\n format.json { render :show, status: :created, location: @network }\n else\n format.html { render :new }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0785b4e144f990ee084740583f9f330b", "score": "0.47793114", "text": "def create_request\n\t\tTyphoeus::Request.new(\n\t \"https://api.kontakt.io/device\",\n\t method: :get,\n\t #body: xml_body,\n\t headers: {\n\t \"Accept\" => \"application/vnd.com.kontakt+json;version=10\",\n\t \"Api-Key\" => \"#{ENV[\"KONTAKT_API_KEY\"]}\",\n\t \"Content-Type\" => \"application/x-www-form-urlencoded\",\n\t \"User-Agent\" => \"beaconoid/1.0\"\n\t }\n\t )\n\n\tend", "title": "" }, { "docid": "507650fceb9999da6c01a21e88ae4953", "score": "0.47751486", "text": "def create\n @iterative_chain = IterativeChain.new(params[:iterative_chain])\n\n respond_to do |format|\n if @iterative_chain.save\n format.html { redirect_to @iterative_chain, notice: 'Iterative chain was successfully created.' }\n format.json { render json: @iterative_chain, status: :created, location: @iterative_chain }\n else\n format.html { render action: \"new\" }\n format.json { render json: @iterative_chain.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a3268a8f5cd72635ebe67e7277497c5", "score": "0.47743845", "text": "def daycare_params\n params.require(:daycare).permit(:name, :address)\n end", "title": "" }, { "docid": "f0992703afcdd8f8ebc5970d4949dbdb", "score": "0.47729766", "text": "def create\n @contract_term = Bo::ContractTerm.new(contract_term_params)\n authorize @contract_term\n\n respond_to do |format|\n if @contract_term.save\n format.html { redirect_to @contract_term, notice: 'Contract term was successfully created.' }\n format.json { render json: @contract_term, status: :created, location: @contract_term }\n else\n format.html { render :new }\n format.json { render json: @contract_term.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92008bad042579793da1bda239d95223", "score": "0.4764465", "text": "def create\n api.post('', nil, 'application/json')\n end", "title": "" }, { "docid": "1c9e8ad3706b4ece411b2dc1534fb617", "score": "0.4762745", "text": "def create\n @common_interest = CommonInterest.new(common_interest_params)\n\n respond_to do |format|\n if @common_interest.save\n format.html do\n redirect_to @common_interest,\n notice: 'Common interest was successfully created.'\n end\n format.json do\n render :show, status: :created, location: @common_interest\n end\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json do\n render json: @common_interest.errors, status: :unprocessable_entity\n end\n end\n end\n end", "title": "" }, { "docid": "d170dc59fb682ddaf5f9fbbe4da5deef", "score": "0.47626558", "text": "def create\n type_id, patient_id, program_id = params.require(%i[encounter_type_id patient_id program_id])\n\n encounter = encounter_service.create(\n type: EncounterType.find(type_id),\n patient: Patient.find(patient_id),\n program: Program.find(program_id),\n provider: params[:provider_id] ? Person.find(params[:provider_id]) : User.current.person,\n encounter_datetime: TimeUtils.retro_timestamp(params[:encounter_datetime]&.to_time || Time.now)\n )\n\n if encounter.errors.empty?\n render json: encounter, status: :created\n else\n render json: encounter.errors, status: :bad_request\n end\n end", "title": "" }, { "docid": "2375a3aea5f277c5b23446404212b15c", "score": "0.47624674", "text": "def carnet_params\n params.require(:carnet).permit(:earing_sup, :earing_inf, :vacune, :aplication_date, :weight, :cow_id)\n end", "title": "" }, { "docid": "5f9c077f04e58e5d0eb158cdcfe27d78", "score": "0.47609532", "text": "def new\n @ethnic_group = EthnicGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ethnic_group }\n end\n end", "title": "" }, { "docid": "905210f2a9498827ed347d63c08bdcb5", "score": "0.47600576", "text": "def new\n @contract = Contract.new\n #1.times { @contract.product.build }\n 1.times { @contract.sanitations.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contract }\n end\n end", "title": "" }, { "docid": "48215c7096ecfcc3c8a0ad053c4360bf", "score": "0.47579575", "text": "def traineeship_params\n params.require(:traineeship).permit(:ep_name, :tn_type, :home_lc, :lc_comments, :ep_email, :manager_name, :manager_email, :region, :country, :lc, :rate_homelc, :tn_name, :start, :end, :rate_lc, :rate_tn, :tn_comments, :aiesec_comments, :homelc_comments, :visa, :culture)\n end", "title": "" }, { "docid": "4b0f24935bd0fbeacb03806a944343c3", "score": "0.4757846", "text": "def create\n @charity = Charity.new(params[:charity])\n\n respond_to do |format|\n if @charity.save\n format.html { redirect_to @charity, notice: 'Charity was successfully created.' }\n format.json { render json: @charity, status: :created, location: @charity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @charity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc023891f7f37c4c10bf634bdb17d0ed", "score": "0.47565097", "text": "def create\n @contract = Contract.new(params[:contract])\n\n respond_to do |format|\n if @contract.save\n format.html { redirect_to contracts_path, notice: 'Contract was successfully created.' }\n format.json { render json: @contract, status: :created, location: @contract }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85d4479dba507bc84283ea5a176cfdad", "score": "0.47552165", "text": "def create\n @contract = Contract.new(contract_params)\n\n respond_to do |format|\n if @contract.save\n format.html { redirect_to root_path, notice: 'Contract was successfully\n created.' }\n format.json { render action: 'show', status: :created, location:\n @contract }\n else\n format.html { render action: 'new' }\n format.json { render json: @contract.errors, status:\n :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7076473d36f69f9a418515bc317496b", "score": "0.47551727", "text": "def create\n @network = Network.new(network_params)\n\n # Validate societies\n societies = params[:societies]\n valid_societies = []\n if !societies.nil?\n societies_array = societies.split(\",\")\n for i in 0 ... societies_array.size\n societies_chosen = Society.find_by(email: societies_array[i])\n if societies_chosen.nil?\n @network.errors[:base] << \"The email #{societies_array[i]} is not in the database\"\n else\n valid_societies << societies_chosen\n end\n end\n end\n valid_societies.uniq!\n\n\n respond_to do |format|\n if !(@network.errors).empty?\n format.html { render action: 'new' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n else\n if @network.save\n valid_societies.each do |vs|\n SocietyNetwork.create(network_id: @network.id, society_id: vs.id)\n end\n\n format.html { redirect_to @network, notice: 'Network was successfully created.' }\n format.json { render action: 'show', status: :created, location: @network }\n else\n format.html { render action: 'new' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" } ]
ef8fc33f23137f844f91a5a3371474ea
Method to return the Audio Format encoding Set to PCM unsigned
[ { "docid": "c43e65ddfd5dfc8d11e0195d839e3b16", "score": "0.7781548", "text": "def encoding\n @encoding ||= AudioFormat::Encoding::PCM_UNSIGNED\n end", "title": "" } ]
[ { "docid": "f1fa15b8de03e2d5be2998cd63e49753", "score": "0.6543714", "text": "def format\n @format ||= \n AudioFormat.new(encoding, rate, size, channels, 1, rate, false)\n end", "title": "" }, { "docid": "042e7ed31297e566a5b55267ab8dbddc", "score": "0.6388832", "text": "def audio_codec\n p self[:audio_codec], self[:audio_channels]\n @audio_codec ||= begin\n\n codec = case self[:audio_codec]\n when \"ac3\", \"aac\", \"mp3\", \"dca\"\n self[:audio_codec].upcase\n when \"eac3\"\n \"EC3\"\n when \"truehd\"\n \"TrueHD\" \n else\n nil\n end\n ch = self[:audio_channels].present? ? \"#{self[:audio_channels]}ch\" : nil\n [codec,ch].compact.join(\" \")\n end \n end", "title": "" }, { "docid": "3c9c7c503c59d1a3ef108a79d4fddc93", "score": "0.6257212", "text": "def get_audio_codec \n send_cmd(\"get_audio_codec\")\n end", "title": "" }, { "docid": "3c4b71ed985c6cc167c1de82ec082aaa", "score": "0.62422574", "text": "def audio_format\n @descriptive_detail.audio_format\n end", "title": "" }, { "docid": "a499275f41e0e19220a66c315417785a", "score": "0.62138444", "text": "def audio_formats\n @descriptive_detail.audio_formats\n end", "title": "" }, { "docid": "43d94e7b081b86ee38fabe17ec711314", "score": "0.6138976", "text": "def audio_codecs\n Codec.where(:codec_type => 'audio').order(\"id ASC\")\n end", "title": "" }, { "docid": "03dbca3a34d1aace43b1c19d330f21d4", "score": "0.61300147", "text": "def to_wav\n @audio\n end", "title": "" }, { "docid": "9bead7960de0ff5f84dc3a111fcd568f", "score": "0.5853845", "text": "def pcm_samples\n @pcm_samples ||= [].tap do |pcm_samples|\n samples.each { |sample| pcm_samples.push(128 + (127 * sample).round) }\n end\n end", "title": "" }, { "docid": "c6be5f6d420c7f36184aa390294e21db", "score": "0.5836399", "text": "def audio_types\n ldr6 = record.leader[6]\n\n types = []\n\n # Get the 8524* fields\n f8524 = record.fields('852').select{|f| f.indicator1 == '4'}\n\n # RC\n if %w[i j].include?(ldr6) && (bib_format == 'MU') \n @record.fields('007').map{|f| f.value}.each do |f|\n if f[1] == 'd' && f[12] == 'e'\n types << 'RC'\n break\n end\n end\n end\n\n f8524.each do |f|\n if (f['b'].upcase == 'MUSIC') && (f['j'] =~ /\\ACD/i)\n types << 'RC'\n break\n end\n end\n\n # RL\n\n if (bib_format == 'MU') && %w[i j].include?(ldr6) && self['007[1]'].include?('d')\n record.fields('300').each do |f|\n str = f.subfields.collect {|s| s.value}.join(' ')\n if (str =~ /DISC/i) && str =~ /33 1\\/3 RPM/i\n types << 'RL'\n break\n end\n end\n end\n\n\n f8524.each do |f|\n if (f['j'] =~ /\\ALP/i) &&\n ((f['b'].upcase == 'MUSIC') || (f['c'].upcase == 'MUSI'))\n types << 'RL'\n break\n end\n end\n\n # RM\n types << 'RM' if (ldr6 == 'j') && (bib_format == 'MU')\n\n # RS\n types << 'RS' if (ldr6 == 'i') && (bib_format == 'MU')\n\n # RU\n types << 'RU' if %w[i j].include?(ldr6) && (bib_format == 'MU')\n\n types.uniq!\n return types\n end", "title": "" }, { "docid": "f322170435a0779bfcd17b7417e193b9", "score": "0.5820024", "text": "def bit_rate_mode\n mediainfo.audio.bit_rate_mode\n end", "title": "" }, { "docid": "47f76a29987eaacd099904e8bf453913", "score": "0.5810425", "text": "def channels\n mediainfo.audio.channels\n end", "title": "" }, { "docid": "712717b53744c1ec399d1d287b42e79a", "score": "0.574716", "text": "def formatted_audio_bitrate(path)\n formatted_bitrate path, :audio\n end", "title": "" }, { "docid": "21483cd2115c9b1d949cbf4d4625d968", "score": "0.568381", "text": "def format\n string = \"#{mediainfo.audio.format} #{mediainfo.audio.format_profile}\".strip\n\n return nil if string.empty?\n\n string\n end", "title": "" }, { "docid": "9e32c1f706b3d2cd43977ce1c6ecdbb2", "score": "0.56751776", "text": "def compression_mode\n mediainfo.audio.compression_mode\n end", "title": "" }, { "docid": "73d611982c8bba518499b9312bccea39", "score": "0.5671809", "text": "def audio_format(infile)\n format = nil\n cmd = [\"ffprobe\", \"-hide_banner\", infile]\n \n IO.popen(cmd, \"rb\", :err=>[:child, :out]) do |io| \n io.each_line do |line|\n # Stream #0:1: Audio: aac (LC), 22050 Hz, stereo, fltp\n # Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s\n # Stream #0:0: Audio: mp3, 22050 Hz, mono, s16p, 67 kb/s\n # Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 310 kb/s\n if line =~ /Stream.+Audio.+(aac|mp3)/\n format = $1\n break\n end\n end\n end\n\n case format\n when nil\n \"\"\n when \"aac\" \n \"m4a\"\n else\n format\n end\nend", "title": "" }, { "docid": "216e8b7d5daa341d057617fea486c6c0", "score": "0.55704236", "text": "def bit_rate\n mediainfo.audio.bitrate\n end", "title": "" }, { "docid": "655742b7b24dc33d0c6eadb35bc7fe46", "score": "0.55453026", "text": "def check_audio_codec\n if has_sound?\n @audio_codec = (@audio_stream[:codec_name] + @audio_stream[:profile]).upcase!\n @audio_codec_check = if AUDIO_CODEC == @audio_codec\n true\n else\n false\n end\n end\n end", "title": "" }, { "docid": "8f1c1ffea849f4b6b56187327faf0b06", "score": "0.5517651", "text": "def audio_stream\n @audio_stream ||= streams.find do |stream|\n stream.codec_context.codec_type == :AUDIO\n end\n end", "title": "" }, { "docid": "0528e2af6956ea7bc5e1449574506c11", "score": "0.54657304", "text": "def sample_rate\n mediainfo.audio.samplingrate\n end", "title": "" }, { "docid": "ec0edb6c5d0ab8e01ed718681828cf9e", "score": "0.5460785", "text": "def get_audio\n return @audio\n end", "title": "" }, { "docid": "e95ba1bf6755dd59ec8b379b02232166", "score": "0.5457837", "text": "def audio_bitrate(path)\n bitrate path, :audio\n end", "title": "" }, { "docid": "e3385e62443a563d5d7f68e18af2343b", "score": "0.54140496", "text": "def get_audio_input_stream(file) # works on filename, file, inputstream, or url\n file = java.io.File.new(file) if file.is_a?(String)\n #puts \" #{file}: audio file format:\\t #{Snd.AudioSystem.getAudioFileFormat(file)}\"\n stream = Snd.AudioSystem.getAudioInputStream(file)\n puts \" #{file}: format:\\t #{stream.format}\"\n if stream.format.encoding.to_s.match(/PCM/)\n return stream\n else\n target_format = Snd.AudioFormat.new(Snd.AudioFormat::Encoding::PCM_SIGNED,\n stream.format.sample_rate, 16,\n stream.format.channels, stream.format.channels * 2,\n stream.format.sample_rate, false)\n #puts \" conversion: target format:\\t #{target_format}\"\n decoded_stream = Snd.AudioSystem.getAudioInputStream(target_format, stream)\n fail \"pas un PropertiesContainer javazoom\" unless decoded_stream.is_a? Java.javazoom.spi.PropertiesContainer\n return decoded_stream\n # TODO: stream.close et decoded_stream.close\n # (mais ne pas fermer stream avant de lire decoded_stream sinon ogg marche plus)\n end\n end", "title": "" }, { "docid": "618e2e600eb384f2e393ef6a9656e4af", "score": "0.5342123", "text": "def type\n @av_codec_context[:codec_type]\n end", "title": "" }, { "docid": "5baba115a435bca6c12a2875b05acb10", "score": "0.53075796", "text": "def codec_id\n @av_stream[:codec][:codec_id]\n end", "title": "" }, { "docid": "a75da30dd33cb9da3ee69e6ad458894b", "score": "0.5304464", "text": "def to_midi\n pc.to_i + (oct + 1) * 12\n end", "title": "" }, { "docid": "bee489ad217c8fe61eef3b90a376c606", "score": "0.52821666", "text": "def bit_depth\n mediainfo.audio.bitdepth\n end", "title": "" }, { "docid": "70658dc29fa985e945c8a3400828587f", "score": "0.52587414", "text": "def audio\n first_stream_of :audio\n end", "title": "" }, { "docid": "2d0946e9c2b1099861fe4271dcff1048", "score": "0.5238084", "text": "def codec_name\n @av_stream[:codec][:codec_name]\n end", "title": "" }, { "docid": "b356bc3cd7f3faba6d3782c736cbd7f9", "score": "0.5207982", "text": "def audio\n @streams.select { |stream| stream.is_a? AudioStream }\n end", "title": "" }, { "docid": "a382e9a9e6fab0660360cd1cb5f739ca", "score": "0.52016836", "text": "def get_audio_bitrate \n send_cmd(\"get_audio_bitrate\")\n end", "title": "" }, { "docid": "eaf3be70f0118409ca01a0c0d4baa895", "score": "0.519591", "text": "def to_wave(amplitude=1.0)\n\t\treturn Mantra::Wave.new(self.to_bytes, amplitude)\n\tend", "title": "" }, { "docid": "4cdc7f69754877b70ef8cbfa70a5c3b5", "score": "0.5187386", "text": "def audio?\n codec_type == 'audio'\n end", "title": "" }, { "docid": "529f941570e8506d9c383c01e53dda8c", "score": "0.5158622", "text": "def create\n @audio_encoding = AudioEncoding.find_audio_to_encode\n \n # Quit unless there's an audio encoding\n unless @audio_encoding\n respond_to { |format| format.json {render :json => ''} }\n return\n end\n \n respond_to do |format|\n if @audio_encoding.encode_mp3_and_video\n format.json { render :json => @audio_encoding, :status => :created, :location => @audio_encoding }\n else\n format.json { render :json => @audio_encoding.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f571901e4299e7a9aafb7aab7578ae8f", "score": "0.5119501", "text": "def bits_per_sample\n @format.bits_per_sample\n end", "title": "" }, { "docid": "2badcf92dfa5e692f7dce42977d10646", "score": "0.50886554", "text": "def audio; end", "title": "" }, { "docid": "d8d884f21b8b4a0a9d868ad57a56b8a6", "score": "0.5075623", "text": "def midi_encoder(bytes)\n raise \"Invalid data length #{bytes.size}\" unless bytes.size % 7 == 0\n result = []\n (0...bytes.size).step(7).each do |start|\n chunk = bytes[start, 7]\n msbits = 0\n chunk.each_with_index do |b, i|\n msbits |= (b & 0x80) >> (7 - i)\n end\n result << msbits\n result += chunk.map{|b| b & 0x7F}\n end\n result\nend", "title": "" }, { "docid": "4c9665fd3a66894d44f0f36a5baf81ed", "score": "0.507543", "text": "def codec\n \"-acodec libmp3lame -y\"\n end", "title": "" }, { "docid": "746e57e01fb6dde2acbb68d59ca65d1c", "score": "0.5047912", "text": "def new_input_set()\n return GetAudioInputSet.new()\n end", "title": "" }, { "docid": "0a23a9acb3c71ed4d4d1c80e8d7f420f", "score": "0.5010639", "text": "def encode_mp3_from_wav(original_path, mp3_path, options={})\n logger.info \"encode_mp3_from_wav: #{original_path}, #{mp3_path}, #{options.inspect}\"\n\n check_local_file(original_path)\n\n options.to_options!\n # parse the wave to see what values to use if not overridden by the options\n wf = WaveFile.parse(original_path)\n fmt = wf.chunks[:fmt]\n\n input_path = '-'\n\n mp3_sample_rate = if MP3_SAMPLE_RATES.include?(options[:sample_rate].to_s)\n options[:sample_rate].to_s\n elsif MP3_SAMPLE_RATES.include?(fmt.sample_rate.to_s)\n logger.debug \"sample_rate: fmt.sample_rate = #{fmt.sample_rate}\"\n fmt.sample_rate.to_s\n else\n '44100'\n end\n logger.debug \"mp3_sample_rate: #{options[:sample_rate]}, #{fmt.sample_rate}\"\n\n mode = if LAME_MODES.include?(options[:channel_mode])\n options[:channel_mode] #use the channel mode from the options if specified\n elsif fmt.number_of_channels <= 1\n 'm' # default to monoaural for 1 channel input\n else\n 'j' # default to joint stereo for 2 channel input\n end\n channel_mode = \"-m #{mode}\"\n\n # if mono selected, but input is in stereo, need to specify downmix to 1 channel for sox\n downmix = (mode == 'm' && fmt.number_of_channels > 1) ? '-c 1' : ''\n\n # if sample rate different, change that as well in sox before piping to lame\n resample = (mp3_sample_rate.to_i != fmt.sample_rate.to_i) ? \"-r #{mp3_sample_rate} \" : ''\n logger.debug \"resample: #{resample} from comparing #{mp3_sample_rate} #{fmt.sample_rate}\"\n\n # output to wav (-t wav) has a warning\n # '/usr/local/bin/sox wav: Length in output .wav header will be wrong since can't seek to fix it'\n # that messsage can safely be ignored, wa output is easier/safer for lame to recognize, so worth ignoring this message\n prefix_command = \"#{bin(:sox)} '#{original_path}' -t wav #{resample} #{downmix} - | \"\n\n kbps = if options[:per_channel_bit_rate]\n options[:per_channel_bit_rate].to_i * ((mode == 'm') ? 1 : 2)\n elsif options[:bit_rate]\n options[:bit_rate].to_i\n else\n 0\n end\n\n kbps = if MP3_BITRATES.include?(kbps)\n kbps\n elsif mode == 'm'\n 128 # default for monoaural is 128 kbps\n else\n 256 # default for stereo/dual channel is 256 kbps\n end\n bit_rate = \"--cbr -b #{kbps}\"\n\n ##\n # execute the command\n ##\n output_options = \"#{channel_mode} #{bit_rate}\"\n\n command = \"#{prefix_command} #{bin(:lame)} -S #{output_options} #{input_path} '#{mp3_path}'\"\n\n out, err = run_command(command)\n\n unless out.split(\"\\n\")[-1] =~ LAME_SUCCESS_RE\n raise \"encode_mp3_from_wav - lame completion unsuccessful: #{out}\"\n end\n\n err.split(\"\\n\").each do |l|\n if l =~ LAME_ERROR_RE\n raise \"encode_mp3_from_wav - lame response had fatal error: #{l}\"\n end\n end\n logger.debug \"encode_mp3_from_wav: end!\"\n\n check_local_file(mp3_path)\n\n true\n end", "title": "" }, { "docid": "0f856248697ff673c933ba2c72c78b0c", "score": "0.49996018", "text": "def convert_header_file_audio\n self.convert_header_file_audio_or_video('audio')\n end", "title": "" }, { "docid": "74bdb728304af8887a4500bc7653609e", "score": "0.49915195", "text": "def sample_type(sample_type_byte)\n ((sample_type_byte & 0b1000) >> 3).zero? ? 8 : 16\n end", "title": "" }, { "docid": "f8ca111e7b89a70b9a3ee645d0ee03aa", "score": "0.4984713", "text": "def audio?\n not audio_formats.empty?\n end", "title": "" }, { "docid": "4f118b8b87e203e0985eeaadf5f33d5c", "score": "0.49608997", "text": "def media_quality_list\n return @media_quality_list\n end", "title": "" }, { "docid": "e166e55e783d941b0869e91ea2b27f99", "score": "0.49494606", "text": "def encodings; end", "title": "" }, { "docid": "459c6a1c256252efc92f172226c0d633", "score": "0.4947799", "text": "def set_maudio\n @maudio = Maudio.find(params[:id])\n end", "title": "" }, { "docid": "0f399828885279ce22cea6d719d06681", "score": "0.49156535", "text": "def create_audio!(enc, manifest, s3_input, s3_output)\n\n # Create or load the Audio Config\n #audio_config = Bitmovin::Encoding::CodecConfigurations::AacConfiguration.find(\"<EXISTING_AAC_CONFIG_ID>\")\n audio_config = Bitmovin::Encoding::CodecConfigurations::AacConfiguration.new({\n name: \"AAC_PROFILE_128k\",\n bitrate: 128000,\n rate: 48000\n })\n audio_config.save!\n #\n # Adding Audio Stream to Encoding\n stream_aac = enc.streams.build(name: 'audio stream')\n stream_aac.codec_configuration = audio_config\n stream_aac.build_input_stream(input_path: INPUT_FILE_PATH, input_id: s3_input.id, selection_mode: 'AUTO')\n stream_aac.conditions = {\n type: \"CONDITION\",\n attribute: \"INPUTSTREAM\",\n operator: \"==\",\n value: \"TRUE\"\n }\n puts stream_aac.conditions.to_json\n stream_aac.save!\n\n # Audio Muxing\n audio_muxing = enc.muxings.fmp4.build(name: 'audio-muxing', segment_length: 4)\n audio_muxing.build_output({\n output_id: s3_output.id,\n output_path: File.join(OUTPUT_PATH, \"audio/aac\")\n })\n audio_muxing.build_output({\n output_id: s3_output.id,\n output_path: File.join(OUTPUT_PATH, \"audio/aac\"),\n acl: [{\n permission: \"PUBLIC_READ\"\n }]\n })\n audio_muxing.streams << stream_aac.id\n audio_muxing.save!\n\n # Adding Audio Stream to HLS Manifest\n audio_stream_medium = manifest.build_audio_medium({\n name: \"HLS Audio Media\",\n group_id: \"audio_group\",\n segment_path: \"audio/aac\",\n encoding_id: enc.id,\n stream_id: stream_aac.id,\n muxing_id: audio_muxing.id,\n language: \"en\",\n uri: \"audio_media.m3u8\"\n })\n audio_stream_medium.save!\nend", "title": "" }, { "docid": "b3ab0a9c6b4c705e4288dacdd938ccde", "score": "0.4885881", "text": "def exhaustively_test\n [:mono, :stereo, :tri].each do |channels|\n Format::SUPPORTED_BITS_PER_SAMPLE[:pcm].each do |bits_per_sample|\n yield(channels, bits_per_sample)\n end\n end\n end", "title": "" }, { "docid": "a44eaaec689b3d128f675aeb7e676761", "score": "0.48809227", "text": "def scribe\n raise 'bork' unless ARGV.any?\n\n name, type = ARGV.first.split('.')\n name_bits = name.to_s.ljust(64, ' ').to_bits\n type_bits = type.to_s.ljust(5, ' ').to_bits\n data_bits = File.open(ARGV.first) { |file| file.read }.to_bits\n size = data_bits.count / 8\n size_bits = (\"%032b\" % size).split('').map(&:to_i)\n prelude_bits = SYNC.map { |byte| \"%08b\" % byte }.join.split('').map(&:to_i)\n\n sample \"#{ name }.wav\", prelude_bits + name_bits + type_bits + size_bits + data_bits\nend", "title": "" }, { "docid": "bb32088ba352d37d1c07ebe4ffe325ca", "score": "0.4876787", "text": "def encode_mp2_from_wav(original_path, mp2_path, options={})\n check_local_file(original_path)\n\n options.to_options!\n # parse the wave to see what values to use if not overridden by the options\n wf = WaveFile.parse(original_path)\n fmt = wf.chunks[:fmt]\n\n wav_sample_size = fmt.sample_bits\n\n # twolame can only handle up to 16 for floating point (seems to convert to 16 internaly anyway)\n # \"Note: the 32-bit samples are currently scaled down to 16-bit samples internally.\"\n # libtwolame.h twolame_encode_buffer_float32 http://www.twolame.org/doc/twolame_8h.html#8e77eb0f22479f8ec1bd4f1b042f9cd9\n if (fmt.compression_code.to_i == PCM_FLOATING_COMPRESSION && fmt.sample_bits > 32)\n wav_sample_size = 16\n end\n\n # input options\n prefix_command = ''\n raw_input = ''\n sample_rate = \"--samplerate #{fmt.sample_rate}\"\n sample_bits = \"--samplesize #{wav_sample_size}\"\n channels = \"--channels #{fmt.number_of_channels}\"\n input_path = \"'#{original_path}'\"\n\n # output options\n mp2_sample_rate = if MP2_SAMPLE_RATES.include?(options[:sample_rate].to_s)\n options[:sample_rate]\n elsif MP2_SAMPLE_RATES.include?(fmt.sample_rate.to_s)\n fmt.sample_rate.to_s\n else\n '44100'\n end\n\n if mp2_sample_rate.to_i != fmt.sample_rate.to_i\n prefix_command = \"#{bin(:sox)} '#{original_path}' -t raw -r #{mp2_sample_rate} - | \"\n input_path = '-'\n raw_input = '--raw-input'\n end\n\n mode = if TWOLAME_MODES.include?(options[:channel_mode])\n options[:channel_mode] #use the channel mode from the options if specified\n elsif fmt.number_of_channels <= 1\n 'm' # default to monoaural for 1 channel input\n else\n 's' # default to joint stereo for 2 channel input\n end\n channel_mode = \"--mode #{mode}\"\n\n kbps = if options[:per_channel_bit_rate]\n options[:per_channel_bit_rate].to_i * ((mode == 'm') ? 1 : 2)\n elsif options[:bit_rate]\n options[:bit_rate].to_i\n else\n 0\n end\n\n kbps = if MP2_BITRATES.include?(kbps)\n kbps\n elsif mode == 'm' || (mode =='a' && fmt.number_of_channels <= 1)\n 128 # default for monoaural is 128 kbps\n else\n 256 # default for stereo/dual channel is 256 kbps\n end\n bit_rate = \"--bitrate #{kbps}\"\n\n downmix = (mode == 'm' && fmt.number_of_channels > 1) ? '--downmix' : ''\n\n # default these headers when options not present\n protect = (options.key?(:protect) && !options[:protect] ) ? '' : '--protect'\n copyright = (options.key?(:copyright) && !options[:copyright] ) ? '' : '--copyright'\n original = (options.key?(:original) && !options[:original] ) ? '--non-original' : '--original'\n emphasis = (options.key?(:emphasis)) ? \"--deemphasis #{options[:emphasis]}\" : '--deemphasis n'\n\n ##\n # execute the command\n ##\n input_options = \"#{raw_input} #{sample_rate} #{sample_bits} #{channels}\"\n output_options = \"#{channel_mode} #{bit_rate} #{downmix} #{protect} #{copyright} #{original} #{emphasis}\"\n\n command = \"#{prefix_command} #{bin(:twolame)} -t 0 #{input_options} #{output_options} #{input_path} '#{mp2_path}'\"\n out, err = run_command(command)\n unless out.split(\"\\n\").last =~ TWOLAME_SUCCESS_RE\n raise \"encode_mp2_from_wav - twolame response on transcoding was not recognized as a success, #{out}, #{err}\"\n end\n\n # make sure there is a file at the end of this\n check_local_file(mp2_path)\n\n true\n end", "title": "" }, { "docid": "2aab5ad1651e8cfbc0a83836edaec6e3", "score": "0.48706958", "text": "def to_m4a(options={})\n options[:quality] ||= 320\n options[:output] ||= self.basename_with_path + '.m4a'\n cmd = \"afconvert -v \\\"#{self.path}\\\" -o \\\"#{options[:output]}\\\" -f m4af -d aac -b #{options[:quality]}000 -s 0\"\n system(cmd)\n end", "title": "" }, { "docid": "4fd3f736a68635ce4c03be239a2ac7e8", "score": "0.4858647", "text": "def audio?\n self.sti_type == AUDIO_TYPE\n end", "title": "" }, { "docid": "a906e3a2bf966c9d521de40aba642580", "score": "0.48503438", "text": "def new\n @audio_encoding = AudioEncoding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @audio_encoding }\n end\n end", "title": "" }, { "docid": "e40cb6f72d26df45a2f40f5a132173a5", "score": "0.48428324", "text": "def short\n quality + number.to_s \n end", "title": "" }, { "docid": "27d70f231d7f2f11290f20622d184859", "score": "0.4839079", "text": "def convert_audio_to_aac(stream, index)\n disposition = (index == 0) ? 'default' : 'none'\n return [ \"-map 0:a:#{stream[:index]}\",\n \"-metadata:s:a:#{index} title='Stereo Track'\",\n \"-metadata:s:a:#{index} language=#{stream[:language]}\",\n \"-disposition:a:#{index} #{disposition}\",\n \"-codec:a:#{index} aac\",\n \"-ar:a:#{index} 48k\",\n \"-ab:a:#{index} 160k\",\n \"-ac:a:#{index} 2\" ]\nend", "title": "" }, { "docid": "17b29fea97c1ccdff4fb4d5cb1f02781", "score": "0.483488", "text": "def decode_audio(buffer)\n Internal::check Internal::rawmedia_decode_audio(@decoder, buffer)\n end", "title": "" }, { "docid": "6fa3fa22e0ea9f1fce5022da397af799", "score": "0.48279813", "text": "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "title": "" }, { "docid": "54fce772c5e0d9dffe010f62f4133681", "score": "0.47861728", "text": "def in samples\n # CoreAudio range of -32767..32767 makes easy conversion to -1.0..1.0\n if @input_channels == 1\n @input_buf.read(samples)[@input[0],true].to_f.div!(32767)\n else\n b = @input_buf.read samples\n c_out = NArray.scomplex samples\n c_out[0..-1] = b[@input[0],true].to_f.div!(32767)\n c_out.imag = b[@input[1],true].to_f.div!(32767)\n c_out\n end\n end", "title": "" }, { "docid": "50d6458f418807f9846f5673ec316d90", "score": "0.4784475", "text": "def copy_audio(stream, index)\n disposition = (index == 0) ? 'default' : 'none'\n title = (stream[:channels] > 2) ? 'Surround Track' : 'Stereo Track'\n return [ \"-map 0:a:#{stream[:index]}\",\n \"-metadata:s:a:#{index} title='#{title}'\",\n \"-metadata:s:a:#{index} language=#{stream[:language]}\",\n \"-disposition:a:#{index} #{disposition}\",\n \"-codec:a:#{index} copy\" ]\nend", "title": "" }, { "docid": "ae2cd5514272445580f29d8a67f37968", "score": "0.4775695", "text": "def show\n @audio_encoding = AudioEncoding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @audio_encoding }\n end\n end", "title": "" }, { "docid": "41d7298ce9adc0a5e394574775b89c65", "score": "0.47536045", "text": "def toutf16; Kconv.toutf16(self) end", "title": "" }, { "docid": "49de09eb038661d213708ca364642aca", "score": "0.4753582", "text": "def to_microgram(**options) = convert_to('microgram', **options)", "title": "" }, { "docid": "51b19bfbda1d15cbfe9ca2ba2de49643", "score": "0.47488526", "text": "def to_usmf status\n\n\t\tlogger.fatal('The method to_usmf in Converter must be implemented')\n\t\traise 'This method must be implemented'\n\n\tend", "title": "" }, { "docid": "a59ca29a2097e0e1106b1e474721d1b7", "score": "0.47362065", "text": "def index\n @audio_encodings = AudioEncoding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @audio_encodings }\n end\n end", "title": "" }, { "docid": "1e11dda75f35f81e7c972c38600b3bf0", "score": "0.47296822", "text": "def output_format=(output_format)\n validator = EnumAttributeValidator.new('String', [\"wav\", \"mp3\"])\n unless validator.valid?(output_format)\n fail ArgumentError, \"invalid value for 'output_format', must be one of #{validator.allowable_values}.\"\n end\n @output_format = output_format\n end", "title": "" }, { "docid": "451fffdfd326d8b6153f3b117cf9a020", "score": "0.47275993", "text": "def to_mega\n big_self / MEGA\n end", "title": "" }, { "docid": "b347eae739c2019e02e40aebb3ee90c7", "score": "0.47108707", "text": "def url_to_audio(source, options = T.unsafe(nil)); end", "title": "" }, { "docid": "613303aab9ce07cbb46cc9b103f39587", "score": "0.4707625", "text": "def path_to_audio(source, options = T.unsafe(nil)); end", "title": "" }, { "docid": "3e70fdbe501df4ea28a7acad529b2000", "score": "0.47063792", "text": "def encoding()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "baf3d1379969ad5d424c4dac43515966", "score": "0.47044683", "text": "def get_audio_samples \n send_cmd(\"get_audio_samples\")\n end", "title": "" }, { "docid": "24e5723697e92c71b88d5f7c5911d3fb", "score": "0.4704271", "text": "def load_audio audio_settings\n return Audio.new audio_settings\n end", "title": "" }, { "docid": "efd667a993b32864fe5deb5d4e291dbd", "score": "0.4703466", "text": "def sound\n raise NotImplementedError\n end", "title": "" }, { "docid": "1fc35cb37121cac8ddb98ebbddbbd308", "score": "0.4700649", "text": "def audio?\n if mime_type == 'application/mxf'\n !ffprobe.codec_type.any? {|type| type == 'video'}\n else\n super\n end\n end", "title": "" }, { "docid": "69d3c3be5f31ac712aa4dde869006b56", "score": "0.46987176", "text": "def create_sound_get_flags(flags)\n return (flags | FMOD::MODE::OPENMEMORY | FMOD::MODE::CREATESTREAM) if flags\n return (FMOD::MODE::LOOP_NORMAL | FMOD::MODE::FMOD_2D | FMOD::MODE::OPENMEMORY | FMOD::MODE::CREATESTREAM)\n end", "title": "" }, { "docid": "167c6697f16443e4f72b285e5f2f492d", "score": "0.46919042", "text": "def wav\n @wav ||= @info_file.sub(/txt$/, 'wav')\n end", "title": "" }, { "docid": "b00038fff814ffe48a5ad18930541691", "score": "0.4690413", "text": "def audiotype(audio)\n if audio == \"n\"\n return \"Non-directive Audio\"\n elsif audio == \"d\"\n return \"Directive Audio\"\n else\n return \"invalid type\"\n end \n end", "title": "" }, { "docid": "ee7399feaee469e9fca84630e7dc6ac2", "score": "0.46886683", "text": "def bit_rate\n @av_stream.bit_rate\n end", "title": "" }, { "docid": "7f41d69df0a25280c344a9f5810c9ea5", "score": "0.4687611", "text": "def audio_info(source)\n # based on how harvester gets file hash.\n generated_file_hash = \"SHA256::#{generate_hash(source).hexdigest}\"\n\n # integrity\n integrity_check = @audio.integrity_check(source)\n\n # get file info using ffmpeg\n info = @audio.info(source)\n\n {\n file: source,\n extension: File.extname(source).delete('.'),\n errors: integrity_check[:errors],\n file_hash: generated_file_hash,\n media_type: info[:media_type],\n sample_rate_hertz: info[:sample_rate].to_i,\n duration_seconds: info[:duration_seconds].to_f.round(3),\n bit_rate_bps: info[:bit_rate_bps],\n data_length_bytes: info[:data_length_bytes],\n channels: info[:channels]\n }\n end", "title": "" }, { "docid": "6dcc4d35e31ffb4304b7776e24bb0b8b", "score": "0.46858072", "text": "def get_video_codec \n send_cmd(\"get_video_codec\")\n end", "title": "" }, { "docid": "6f8737871b4d595388dff4c5fca7b1ae", "score": "0.46829006", "text": "def encoder; end", "title": "" }, { "docid": "6f8737871b4d595388dff4c5fca7b1ae", "score": "0.46829006", "text": "def encoder; end", "title": "" }, { "docid": "20536f478df25d6dd78596a6677495b0", "score": "0.4672471", "text": "def to_media_type(options)\n as_media_type(options).to_json\n end", "title": "" }, { "docid": "20536f478df25d6dd78596a6677495b0", "score": "0.4672471", "text": "def to_media_type(options)\n as_media_type(options).to_json\n end", "title": "" }, { "docid": "121dc27522fcf8804b5c327e60e41bec", "score": "0.4662638", "text": "def ex1\n WaveFile::Reader.new(\n File.expand_path('../440Hz,441samples.wav', File.dirname(__FILE__))\n ) do |reader|\n samples = reader.read(441).samples.to_a\n #puts samples.map(&:inspect).join(\",\")\n samples_to_graph!(samples, '440constant')\n embiggen_and_imgcat!('440constant')\n end\nend", "title": "" }, { "docid": "27c3e269c1a94e793aa7dcc898a46aa5", "score": "0.46618417", "text": "def pack_format\n self.class.get_pack_format\n end", "title": "" }, { "docid": "775ee8e2fd98e9e64945830527330d70", "score": "0.46604228", "text": "def audios\n unless @audios\n @audios = {:es => [], :eu => [], :en => [], :all => []}\n\n return @audios if self.multimedia_path.blank?\n\n # Lista de todos los audios en <dir>/*.mp3\n list_of_audios = Dir.glob(full_multimedia_path + \"*.mp3\")\n list_of_audios = list_of_audios.collect {|a| Pathname.new(a).relative_path_from(Pathname.new(class_multimedia_path)).to_s}\n\n Document::LANGUAGES.each do |l|\n # Meto en cada idioma solo los que acaban en \"_<idioma>.mp3\"\n @audios[l.to_sym] = list_of_audios.select {|a| a.match(\"_#{l}.mp3\")}\n list_of_audios = list_of_audios - @audios[l.to_sym]\n end\n\n Document::LANGUAGES.each do |l|\n @audios[l.to_sym] = @audios[l.to_sym] + list_of_audios\n end\n @audios[:all] = @audios.values.flatten.uniq\n end\n return @audios\n end", "title": "" }, { "docid": "4bd75218523651abeeb604b6b5d03a7a", "score": "0.46598327", "text": "def codec_3gp\n \"-ar 22050 -ab 32 -sameq -an -y\"\n end", "title": "" }, { "docid": "844819f8fdd99b06ae083a75923a1f9f", "score": "0.46529636", "text": "def to_s\n\t\t\treturn self.each_byte.to_a.pack( 'C*' )\n\t\tend", "title": "" }, { "docid": "7822140baf9e401802dd1807760d9c5d", "score": "0.4647377", "text": "def to_r\n\t\traw = ''\n\n\t\tself.each() { |tlv|\n\t\t\traw << tlv.to_r\n\t\t}\n\n\t\treturn [raw.length + 8, self.type].pack(\"NN\") + raw\n\tend", "title": "" }, { "docid": "7822140baf9e401802dd1807760d9c5d", "score": "0.4647377", "text": "def to_r\n\t\traw = ''\n\n\t\tself.each() { |tlv|\n\t\t\traw << tlv.to_r\n\t\t}\n\n\t\treturn [raw.length + 8, self.type].pack(\"NN\") + raw\n\tend", "title": "" }, { "docid": "d25b663935ff309e98fca938fe03635c", "score": "0.4642403", "text": "def mediatype; end", "title": "" }, { "docid": "c9e326c61e582a82cba8df198dc2a689", "score": "0.46398333", "text": "def wp_get_audio_extensions\n # Filters the list of supported audio formats.\n apply_filters('wp_audio_extensions', ['mp3', 'ogg', 'flac', 'm4a', 'wav'])\n end", "title": "" }, { "docid": "e7d8184c2187b17e433cb36bf32e7137", "score": "0.46362814", "text": "def quality\n return self.sendcmd(\"modem.get_quality\")\n end", "title": "" }, { "docid": "068d969304bbe2d2eb3871271de46ea8", "score": "0.46220088", "text": "def audiences\n return @audiences\n end", "title": "" }, { "docid": "040314903dba3ab1eb31c08b5eeccaf8", "score": "0.46216762", "text": "def extract_audio_details\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3|\n\t self.title = mp3.tag.title \n\t self.album = mp3.tag.album\n\t self.artist = mp3.tag.artist\n\t self.track = mp3.tag.tracknum\n end\nend", "title": "" }, { "docid": "b4eb2fb7ff750c4e3ae55481fde5df05", "score": "0.46199444", "text": "def encode_uint8(int); [int].pack(PACK_FORMAT_UINT8); end", "title": "" }, { "docid": "27b276ce2cd9c41af7eb78aafa27cad1", "score": "0.4619813", "text": "def audio_regex\n @attributes[:audio_regex]\n end", "title": "" }, { "docid": "9ff82030fd5713dd645db2206a3f8da9", "score": "0.46078867", "text": "def audio_tracks\n tracks.select { |t| t.audio? }\n end", "title": "" }, { "docid": "9ff82030fd5713dd645db2206a3f8da9", "score": "0.46078867", "text": "def audio_tracks\n tracks.select { |t| t.audio? }\n end", "title": "" }, { "docid": "a1efbcb776f59472720da4aaa7b2cedd", "score": "0.46059072", "text": "def so_encoding(feature)\n if hash = @data[feature]\n if hash[\"encoding\"]\n return hash[\"encoding\"]\n end\n end\n end", "title": "" }, { "docid": "81bcca774d879aef35927ef520d0237a", "score": "0.46055162", "text": "def pulse_code\n # 64 is just the max number of entries which maybe in there times two\n length = usb_get_pulse_code_length(dataIn:1).unpack('C').first # find out the length of the currently loaded pulse code\n usb_get_pulse_code(dataIn: length * 2).unpack('v*')\n end", "title": "" } ]
532245fb6b23d242195413af928a67ce
End Method: Edit Method: Update
[ { "docid": "e025aa6f10edb239c222bc8f7905f5b2", "score": "0.0", "text": "def update\n\n\t\t@organizationtype = Organizationtype.find(params[:id])\n\t\t@organizationtype.modified_by = 1\n\n\t\tif @organizationtype.update_attributes(params[:organizationtype])\n\t\t\tflash[:notice] = 'Organization Type Updated Sucessfully.'\n\t\t\tredirect_to :action => 'show', :id => @organizationtype\n\t\telse\n\t\t\trender :action => 'edit'\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "28209ee0aa3e250a92993c5783dadeb1", "score": "0.83812183", "text": "def update\n end", "title": "" }, { "docid": "cb3f5312c0ad8a8187f54e4563389018", "score": "0.8283151", "text": "def update\r\n\r\n end", "title": "" }, { "docid": "394370bce628d740ab5baa628df14724", "score": "0.8224477", "text": "def edit\n update\n end", "title": "" }, { "docid": "394370bce628d740ab5baa628df14724", "score": "0.8224477", "text": "def edit\n update\n end", "title": "" }, { "docid": "f402bec0b71f321ed7b77af1bf7e1a2e", "score": "0.8224266", "text": "def update\n end", "title": "" }, { "docid": "f402bec0b71f321ed7b77af1bf7e1a2e", "score": "0.8224266", "text": "def update\n end", "title": "" }, { "docid": "9558da2982f98df7dcd3e05fc8afff28", "score": "0.8202018", "text": "def update\n\n end", "title": "" }, { "docid": "9558da2982f98df7dcd3e05fc8afff28", "score": "0.8202018", "text": "def update\n\n end", "title": "" }, { "docid": "f6b6d3e59c6aad17cd04ba98a381d2cb", "score": "0.8180464", "text": "def update\n\n \n\n \t\tend", "title": "" }, { "docid": "6f73c9f2f91312101766646c892f121b", "score": "0.81464565", "text": "def update\r\n\r\n end", "title": "" }, { "docid": "92dde335f270ae3c4f4d3ceaa8026b9d", "score": "0.81241983", "text": "def update\n\n\tend", "title": "" }, { "docid": "92dde335f270ae3c4f4d3ceaa8026b9d", "score": "0.81241983", "text": "def update\n\n\tend", "title": "" }, { "docid": "92dde335f270ae3c4f4d3ceaa8026b9d", "score": "0.81241983", "text": "def update\n\n\tend", "title": "" }, { "docid": "92dde335f270ae3c4f4d3ceaa8026b9d", "score": "0.81241983", "text": "def update\n\n\tend", "title": "" }, { "docid": "92dde335f270ae3c4f4d3ceaa8026b9d", "score": "0.81241983", "text": "def update\n\n\tend", "title": "" }, { "docid": "e00f5b1e7161f0ee78127b56103dada7", "score": "0.81061345", "text": "def update\n\n end", "title": "" }, { "docid": "e00f5b1e7161f0ee78127b56103dada7", "score": "0.81061345", "text": "def update\n\n end", "title": "" }, { "docid": "e00f5b1e7161f0ee78127b56103dada7", "score": "0.81061345", "text": "def update\n\n end", "title": "" }, { "docid": "e00f5b1e7161f0ee78127b56103dada7", "score": "0.81061345", "text": "def update\n\n end", "title": "" }, { "docid": "e00f5b1e7161f0ee78127b56103dada7", "score": "0.81061345", "text": "def update\n\n end", "title": "" }, { "docid": "e00f5b1e7161f0ee78127b56103dada7", "score": "0.81061345", "text": "def update\n\n end", "title": "" }, { "docid": "c92b836366addefa3304aa00c2cf8fc7", "score": "0.80876315", "text": "def update\n #\n end", "title": "" }, { "docid": "da63345424fc9aecef032928485bd149", "score": "0.806888", "text": "def update\n \n end", "title": "" }, { "docid": "93e91c2952dd29f0d82148b31bbe642e", "score": "0.8064411", "text": "def update\n #TODO\n end", "title": "" }, { "docid": "e9b9e2deae413413be391b9097d1daa7", "score": "0.80557865", "text": "def update \r\n end", "title": "" }, { "docid": "033111e01353cfb424a9530d19da6fd2", "score": "0.8041027", "text": "def update\r\n end", "title": "" }, { "docid": "033111e01353cfb424a9530d19da6fd2", "score": "0.8041027", "text": "def update\r\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "baf7f1aea52eb05f53acf3207dd7e4f2", "score": "0.8035939", "text": "def update\n\n end", "title": "" }, { "docid": "60ff559c6f0b3b5421a6ec758424efdd", "score": "0.80285865", "text": "def update\n end", "title": "" }, { "docid": "43ff379d800ab559b63c362e16557bea", "score": "0.80273724", "text": "def update\n\t\t\n\tend", "title": "" }, { "docid": "43ff379d800ab559b63c362e16557bea", "score": "0.80273724", "text": "def update\n\t\t\n\tend", "title": "" }, { "docid": "43ff379d800ab559b63c362e16557bea", "score": "0.80273724", "text": "def update\n\t\t\n\tend", "title": "" }, { "docid": "43ff379d800ab559b63c362e16557bea", "score": "0.80273724", "text": "def update\n\t\t\n\tend", "title": "" }, { "docid": "43ff379d800ab559b63c362e16557bea", "score": "0.80273724", "text": "def update\n\t\t\n\tend", "title": "" }, { "docid": "43ff379d800ab559b63c362e16557bea", "score": "0.80273724", "text": "def update\n\t\t\n\tend", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.8025661", "text": "def update\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "58ee9f60f668eb67248149d9b5907819", "score": "0.0", "text": "def following_params\n params.require(:to_id)\n params.permit(:from_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
38ad64c2091fa32e23f90dba2c638695
POST /item_vendas POST /item_vendas.json
[ { "docid": "96df38fa3661b47956f2631fcdd09d55", "score": "0.71466094", "text": "def create\n #@item_venda = ItemVenda.new(item_venda_params)\n @venda = Venda.order(\"created_at\").last\n @item_venda = @venda.item_vendas.create(item_venda_params)\n @venda.valor_total += @item_venda.produto.preco_venda * @item_venda.quantidade\n @item_venda.venda_id = @venda.id\n @venda.save\n respond_to do |format|\n if @item_venda.save\n format.html {redirect_to new_item_venda_path}\n #format.html { redirect_to @item_venda, notice: 'Item venda was successfully created.' }\n format.json { render :show, status: :created, location: @item_venda }\n else\n format.html { render :new }\n format.json { render json: @item_venda.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "9abc2f61e1605f03f90037ac6045e98b", "score": "0.67233217", "text": "def item_venda_params\n params.require(:item_venda).permit(:produto_id, :venda_id, :quantidade)\n end", "title": "" }, { "docid": "a24cdf900d75097ac56efa66ad9daab7", "score": "0.64869237", "text": "def create\n\tif(params[:numero][:item].length <= 0)\n\t\tproblema = 'É necessário definir uma quantidade para a compra.'\n\t\tredirect_to vende_new_path, notice: problema\n\t\treturn\n\tend\n\t@vende = Vende.new(vende_params)\n\t@vende.fornecedor = @fornecedores[params[:selecao][:fornecedor].to_i]\n\t@vende.item = @item[params[:selecao][:item].to_i]\n\t\n\trespond_to do |format|\n\t if @vende.save\n @vende.item.quantidade += params[:numero][:item].to_i\n\t\t@vende.item.save\n\t\tformat.html { redirect_to item_index_path, notice: 'A compra foi registrada com sucesso.' }\n format.json { render :show, status: :created, location: @vende }\n else\n format.html { render :new }\n format.json { render json: @vende.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "992511968b0520263e18788a978183e0", "score": "0.6322353", "text": "def create\n @votable_item = VotableItem.new(votable_item_params)\n\n respond_to do |format|\n if @votable_item.save\n format.html { redirect_to @votable_item, notice: 'Votable item was successfully created.' }\n format.json { render :show, status: :created, location: @votable_item }\n else\n format.html { render :new }\n format.json { render json: @votable_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98932ab54cc6b4426a25e5e2d4211f0e", "score": "0.63152426", "text": "def vende_params\n params.require(:vende).permit(:idFornecedor, :idItem, :data, :valor)\n\tend", "title": "" }, { "docid": "e6eb021d54f43c73ee39bb11c47f770c", "score": "0.6232066", "text": "def set_item_venda\n @item_venda = ItemVenda.find(params[:id])\n end", "title": "" }, { "docid": "7686073ed911e9b6d2b8421cb60009b9", "score": "0.61476517", "text": "def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2124b735b974700572915316a9bf8853", "score": "0.6127556", "text": "def create\n @apiv1_item = Item.new(apiv1_item_params)\n\n respond_to do |format|\n if @apiv1_item.save\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @apiv1_item }\n else\n format.html { render :new }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d30fb3ba74148c50fda7d98c82ecbb62", "score": "0.60915273", "text": "def create\n @api_v1_item = Item.new(api_v1_item_params)\n\n if @api_v1_item.save\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "title": "" }, { "docid": "13c196a8e428eea00eaf7b700acea567", "score": "0.60442334", "text": "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "title": "" }, { "docid": "3b81036ebdbd62edc07d86de5c4f881c", "score": "0.5958799", "text": "def create\r\n @tipo_item_variado = ItemVariado.new(tipo_item_variado_params)\r\n\r\n respond_to do |format|\r\n if @tipo_item_variado.save\r\n format.html { redirect_to tipo_item_variado_path(@tipo_item_variado), notice: 'ItemVariado criada com sucesso.' }\r\n format.json { render :show, status: :created, location: @tipo_item_variado }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @tipo_item_variado.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "44aa4548c527e58d5d98dad48ff60610", "score": "0.59147096", "text": "def create\n @orden_item = OrdenItem.new(orden_item_params)\n @orden_item.orden_id = @orden_item.id_orden\n @orden_item.item_id = @orden_item.id_item\n @orden_item.item_name = @orden_item.item.item_name\n @orden_item.item_image = @orden_item.item.item_image\n @orden_item.item_type = @orden_item.item.item_type\n\n respond_to do |format|\n if @orden_item.save\n format.html { redirect_to @orden_item, notice: 'Orden item was successfully created.' }\n format.json { render :show, status: :created, location: @orden_item }\n else\n format.html { render :new }\n format.json { render json: @orden_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa7306e93a7b4696688e723b1bd46b1e", "score": "0.5874233", "text": "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0ae0f2c28db8743ed2c7d87fa59fce76", "score": "0.58575845", "text": "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "title": "" }, { "docid": "e957958f71e9b312e95410d258cf45b1", "score": "0.58221614", "text": "def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3a124118153b409663a100dac17d27b4", "score": "0.5797083", "text": "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "title": "" }, { "docid": "aefc7af740cc7552e31a0bc1faf09775", "score": "0.5778908", "text": "def new\n @venda = Venda.new\n #Produto.count.times { @venda.items.build }\n Produto.count.times { @venda.items.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venda }\n end\n end", "title": "" }, { "docid": "569febf9d59e7b7608cf5ed639d1d853", "score": "0.57694745", "text": "def create\n\n @item = Item.new(item_params)\n #まだView設定がまだのため仮の登録データ、あとでViewからのデータをitem_paramsで定義します。\n atai = 1\n watasi = \"hoge\"\n\n @item.status = atai\n @item.upper_category = watasi\n @item.middle_category = watasi\n @item.lower_category = watasi\n @item.seller = watasi\n @item.size_type = watasi\n \n \n @item.save\n redirect_to root_path\n # respond_to do |format|\n # if @item.save\n # format.html { redirect_to @item, notice: 'Item was successfully created.' }\n # format.json { render :show, status: :created, location: @item }\n # else\n # format.html { render :new }\n # format.json { render json: @item.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "49cf1d25ae99c8905f7e89a02b80c453", "score": "0.57651067", "text": "def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "title": "" }, { "docid": "2f80597a24a1767e2975552a54aeb0c6", "score": "0.5749848", "text": "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "title": "" }, { "docid": "da0d12e4978b885ead3ba582a09dc67a", "score": "0.5748854", "text": "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5418e5471fa1db4ffde684a29d295d6c", "score": "0.57409835", "text": "def create\n @inventory_item = InventoryItem.new(inventory_item_params)\n puts(params)\n\n respond_to do |format|\n if @inventory_item.save\n format.html { redirect_to backoffice_inventory_list_path, notice: 'Bem de patrimônio criado com sucesso.' }\n format.json { render :show, status: :created, location: @inventory_item }\n else\n format.html { render :new, notice: 'Algo de errado aconteceu.' }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a487998596d0972e7df6e0671c3de96", "score": "0.57277274", "text": "def item_params\n params.require(:item).permit(:pedido_id, :modelo_id, :cantidad)\n end", "title": "" }, { "docid": "cbf2a02a8b9dff2fa8c3403a930d9a7a", "score": "0.5708591", "text": "def create\n @inventoryitem = Inventoryitem.new(params[:inventoryitem])\n\n respond_to do |format|\n if @inventoryitem.save\n format.html { redirect_to @inventoryitem, notice: 'Item was successfully created.' }\n format.json { render json: @inventoryitem, status: :created, location: @inventoryitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventoryitem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2e37b42e1c472d3f447278b56923b4a", "score": "0.5705415", "text": "def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "23dd1dc5c67217e16da560601cdc1a3d", "score": "0.5700412", "text": "def create\n @item_de_despesa = ItemDeDespesa.new(item_de_despesa_params)\n\n respond_to do |format|\n if @item_de_despesa.save\n addlog(\"Item de despesa criado\")\n format.html { redirect_to @item_de_despesa, notice: 'Item de despesa criado com sucesso.' }\n format.json { render :show, status: :created, location: @item_de_despesa }\n else\n format.html { render :new }\n format.json { render json: @item_de_despesa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a10803c2f3b33bee9b00e46aa6d54ff", "score": "0.5696108", "text": "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6f44e4ccf8593915ff3598003772e00", "score": "0.5693349", "text": "def vendamesa_params\n params.require(:vendamesa).permit(:total, :dinheiro, :cartao, :cheque, :nota, :mesa_id, :estabelecimento_id, :funcionario_id, :troco)\n end", "title": "" }, { "docid": "745e07cbe58267a4910e7cb6e51aab8a", "score": "0.56882215", "text": "def venda_params\n params.require(:venda).permit(:pedido_id, :produto_id, :vendedor_id, :modalidade_id, :quantidade, :valortotal, :valortarifa, :valoreceber, :valorcomissao)\n end", "title": "" }, { "docid": "a3e6052af25f04f8975eae9239de0958", "score": "0.5684355", "text": "def create\n @curriculum_vitae = findable_curriculum_vitaes.new(curriculum_vitae_params)\n\n respond_to do |format|\n if @curriculum_vitae.save\n format.html { redirect_to @curriculum_vitae, notice: I18n.t('controllers.curriculum_vitaes.create.success') }\n format.json { render :show, status: :created, location: @curriculum_vitae }\n else\n format.html { render :new }\n format.json { render json: @curriculum_vitae.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b902436544ad5df38a1b0193f347e24d", "score": "0.56839615", "text": "def create\n @admin_item = Admin::Item.new(params[:admin_item])\n @admin_item.agency_id = @current_agency.id\n fields = params[:item][:field]\n\n respond_to do |format|\n if @admin_item.save\n \n fields.each do |key, value|\n Admin::FieldValue.create(:item_id => @admin_item.id, :field_id => key, :value => value)\n end\n \n format.html { redirect_to edit_admin_item_path(@admin_item), notice: 'Item was successfully created.' }\n format.json { render json: @admin_item, status: :created, location: @admin_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72d83b23ae188627da30d1aa07209ec3", "score": "0.56810254", "text": "def create\n @invt = Invt.new(invt_params)\n\n respond_to do |format|\n if @invt.save\n format.html { redirect_to @invt, notice: 'El producto fue almacenado exitosamented.' }\n format.json { render :show, status: :created, location: @invt }\n else\n format.html { render :new }\n format.json { render json: @invt.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50f2aa044ec56fb3751b3d236845210a", "score": "0.5678534", "text": "def create\n @curriculumID = Curriculum.find(params[:curriculum_id])\n @item = @curriculumID.items.build(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to @curriculumID, notice: \"Lehrplaninhalt #{@item.title} wurde erfolgreich angelegt.\" }\n format.json { render action: 'show', status: :created, location: @item } \n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1cd5d3be1fab3ddeaaf50484f7546c45", "score": "0.5662601", "text": "def create\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.new(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to suitability_item_path(@item), notice: 'Suitability Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff22c4643b3335fefeb9394a3df898e7", "score": "0.5654841", "text": "def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end", "title": "" }, { "docid": "a5d844a823ad1ae30b95fd70b3e2553f", "score": "0.5653315", "text": "def create\n @part_types = Constants::PART_TYPES\n @item = Item.new(item_params.merge(user_id: current_user.id))\n \n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c22cbc03d0e3448833d217e5a2661e46", "score": "0.56432855", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to :items, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @slot }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "202342479bf1420e3a5dcb06f8bfa7f0", "score": "0.5641833", "text": "def create\n @item_proveedor = ItemProveedor.new(item_proveedor_params)\n\n respond_to do |format|\n if @item_proveedor.save\n format.html { redirect_to @item_proveedor, notice: 'Item proveedor was successfully created.' }\n format.json { render :show, status: :created, location: @item_proveedor }\n else\n format.html { render :new }\n format.json { render json: @item_proveedor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4426b76706f6d40624ccb15d9af15ba", "score": "0.56389374", "text": "def update\n respond_to do |format|\n if @item_venda.update(item_venda_params)\n format.html { redirect_to @item_venda, notice: 'Item venda was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_venda }\n else\n format.html { render :edit }\n format.json { render json: @item_venda.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f6b1456bee2af35911a611a49fda9e2", "score": "0.5632154", "text": "def add_item_value_twenty_four\n response_search = Partay.get('http://shoponline.tescolotus.com/api/v1/search/products?query=Sugar&page=1&sortBy=Relevance', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token})\n puts search_result=JSON(response_search['productItems'][0])\n puts productid =JSON(search_result)[\"product\"][\"id\"]\n items_json_responses = {'items' => [{'id'=>'6071448594','oldValue'=>0.0,'oldUnitChoice'=>'pcs','newUnitChoice'=>'pcs','newValue'=>24.0}]}.to_json\n puts items_json_responses\n response = Partay.put('http://shoponline.tescolotus.com/api/v1/trolley/items/', :headers => {'Content-Type' => 'application/json', 'language' => 'en-GB', 'region' => 'TH', 'userId' => access_token}, :body => items_json_responses)\n puts response\n end", "title": "" }, { "docid": "ca01f10cce996b295ce3219139911a8b", "score": "0.5628726", "text": "def create\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @item_producto = @producto.item_productos.find(params[:item_producto_id])\n @videos_producto = @item_producto.videos_productos.create(videos_productosparams)\n respond_to do |format|\n if @videos_producto.save\n format.html { redirect_to empresa_producto_item_producto_videos_productos_path(@empresa,@producto,@item_producto,@videos_producto), notice: 'Videos producto was successfully created.' }\n format.json { render :show, status: :created, location: @videos_producto }\n else\n format.html { render :new }\n format.json { render json: @videos_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5bd4d9f16b8b67f8e46c5d1d55a93d20", "score": "0.5609188", "text": "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end", "title": "" }, { "docid": "0bdbfd1f76b373bde78cab6ff1203599", "score": "0.5607682", "text": "def create\n @release_item = ReleaseItem.new(release_item_params)\n\n respond_to do |format|\n if @release_item.save\n format.html { redirect_to @release_item, notice: 'Release item was successfully created.' }\n format.json { render :show, status: :created, location: @release_item }\n else\n format.html { render :new }\n format.json { render json: @release_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09b69e8d093ef6c1158f09be35ec3419", "score": "0.55962276", "text": "def create\n @item_inventory = ItemInventory.new(item_inventory_params)\n\n respond_to do |format|\n if @item_inventory.save\n format.html { redirect_to @item_inventory, notice: 'Item inventory was successfully created.' }\n format.json { render :show, status: :created, location: @item_inventory }\n else\n format.html { render :new }\n format.json { render json: @item_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f0718ebfd0564ac53c92666a29d00853", "score": "0.55919576", "text": "def create\n @status_item = StatusItem.new(status_item_params)\n\n respond_to do |format|\n if @status_item.save\n format.html { redirect_to status_items_path, notice: 'El estatus del artículo fue creado correctamente.' }\n format.json { render :show, status: :created, location: @status_item }\n else\n format.html { render :new }\n format.json { render json: @status_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd057394ec9a02acb98d616e4ae99e3b", "score": "0.5591828", "text": "def create\n @inventory_item = InventoryItem.new(inventory_item_params)\n\n respond_to do |format|\n if @inventory_item.save\n flash[:success] = \"Inventory item was successfully created.\"\n format.html { redirect_to @inventory_item }\n format.json { render :show, status: :created, location: @inventory_item }\n else\n format.html { render :new }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ea203573dc27219de09053b955f6d98", "score": "0.55915284", "text": "def create\n vaga = Vaga.new(vaga_params)\n if vaga.save\n render json: {status: 'SUCCESSO', message:'Vaga adicionada com sucesso!', data:vaga},status: :ok\n else\n render json: {status: 'ERRO', message:'Houve um erro ao adicionar a vaga.', data:vaga.errors},status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "fc5811c80efcf2dfee3d6fac65b6c79a", "score": "0.5590452", "text": "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "title": "" }, { "docid": "2c807e567d014376f1c13d546b9121b3", "score": "0.5585134", "text": "def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end", "title": "" }, { "docid": "bd00403aa5e1f5cee3b3eddc8758e39e", "score": "0.5579003", "text": "def create\n @assembly_item = AssemblyItem.new(params[:assembly_item])\n\n respond_to do |format|\n if @assembly_item.save\n format.html { redirect_to @assembly_item.assembly, :notice => 'Ítem adicionado com sucesso!' }\n format.json { render :json => @assembly_item, :status => :created, :location => @assembly_item }\n else\n format.html { redirect_to @assembly_item.assembly, :notice => 'Cadastro do ítem inválido!' }\n format.json { render :json => @assembly_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84fc2b84a5b9044c76ae968efd97f7fe", "score": "0.5577182", "text": "def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend", "title": "" }, { "docid": "49649eeb2ba0f453279e54a7e8cbce51", "score": "0.5565243", "text": "def create\n @vrsta_inventara = VrstaInventara.new(vrsta_inventara_params)\n\n respond_to do |format|\n if @vrsta_inventara.save\n format.html { redirect_to vrsta_inventaras_url, notice: 'Vrsta inventara je uspješno stvorena.' }\n format.json { render :show, status: :created, location: @vrsta_inventara }\n else\n format.html { render :new }\n format.json { render json: @vrsta_inventara.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c16c57866e5bc50a6782095c65cef0fd", "score": "0.5557003", "text": "def new\n @deal = Deal.find(params[:deal_id]) \n\n token_pipedrive = \"api_token=57f839e9a500cf2ef6b9dc8b156bce2c09a0905d\"\n uri_pipedrive_prod = \"http://api.pipedrive.com/v1/deals/#{@deal.pipedrive_id}/products?start=0&#{token_pipedrive}\"\n\n respprod = Net::HTTP.get_response(URI.parse(uri_pipedrive_prod))\n parsedprod = JSON.parse(respprod.body)\n\n parsedprod[\"data\"].each do |registro|\n @item = @deal.items.build\n @item.unique_id = registro[\"id\"]\n @item.pipe_deal_id = registro[\"deal_id\"]\n @item.order_nr = registro[\"order_nr\"]\n @item.product_id = registro[\"product_id\"]\n @item.item_price = registro[\"item_price\"]\n @item.sum = registro[\"sum\"]\n @item.currency = registro[\"currency\"]\n @item.name = registro[\"name\"]\n @item.quantity = registro[\"quantity\"]\n\n uritpprod = \"http://api.pipedrive.com/v1/products/#{registro[\"product_id\"]}?#{token_pipedrive}\"\n resptpprod = Net::HTTP.get_response(URI.parse(uritpprod))\n parsedtpprod = JSON.parse(resptpprod.body)\n \n @item.product_code = parsedtpprod[\"data\"][\"code\"]\n @item.save\n end\n\n redirect_to :action => :index\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @item }\n #end\n end", "title": "" }, { "docid": "8c4a984f1e49f965e43ae5cdb549f03a", "score": "0.55517906", "text": "def create\n @tipo_item = TipoItem.new(params[:tipo_item])\n\n respond_to do |format|\n if @tipo_item.save\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully created.' }\n format.json { render json: @tipo_item, status: :created, location: @tipo_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "747586a4bacae4ed865468e2558c7201", "score": "0.5550233", "text": "def venda_params\n params.require(:venda).permit(:produto_id, :cliente_id, :quantidade)\n end", "title": "" }, { "docid": "78d4fbbc3f7762ae9bad3262935f0c59", "score": "0.5538733", "text": "def item_create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_index_path, notice: 'O item foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :item_new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8cebefec6cf45679f77501e88bc13ace", "score": "0.5523794", "text": "def create\n @tag_item = TagItem.new(tag_item_params)\n\n if @tag_item.save\n render :show, status: :created, location: @tag_item\n else\n render json: @tag_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d24e364d01e6597684c986bc153bccf7", "score": "0.5522439", "text": "def create\n @servico_item = ServicoItem.new(servico_item_params)\n @servico_item.recalcula_total\n\n respond_to do |format|\n if @servico_item.save\n format.html { redirect_to @servico_item, notice: 'Servico item was successfully created.' }\n format.json { render :show, status: :created, location: @servico_item }\n else\n format.html { render :new }\n format.json { render json: @servico_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9276c9ea1b562d120f1cc3f64827a014", "score": "0.55180925", "text": "def create\n @pedido = Pedido.new(pedido_params)\n @pedido.pedido_hash = get_pedido_hash\n @pedido.estado_actual = PEDIDO_SOLICITADO\n\n #redirect_to '/pedidos'\n respond_to do |format|\n if @pedido.save\n\n params[:item_cantidad].each do |a, b|\n newitem_pedido = ItemPedido.new\n newitem_pedido.cantidad = b\n newitem_pedido.item_id = a\n item = Item.find(a)\n newitem_pedido.nombre = item.nombre\n newitem_pedido.valor = ItemProveedor.find_by_item_id_and_proveedor_id(item.id,Categorium.find(item.categorium_id).proveedor_id).precio\n newitem_pedido.pedido_id = @pedido.id\n newitem_pedido.estado_actual = ITEM_SOLICITADO\n newitem_pedido.proveedor_id = Categorium.find(item.categorium_id).proveedor_id\n newitem_pedido.disponible = true\n newitem_pedido.save\n\n end\n format.html { redirect_to @pedido, notice: 'Pedido was successfully created.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67452f280e425e1bc9e5b3f59dadd73d", "score": "0.55099857", "text": "def create\n item_exists = false\n item_id = params[:detalle_ot_presupuesto][:repuesto_servicio_id].to_i\n @orden_trabajo_presupuesto.detalle_ot_presupuestos.each do |detail|\n if detail.repuesto_servicio_id == item_id\n # Ya existe el item en la factura, agregar cantidad\n item_exists = true\n @detalle_ot_presupuesto = detail\n @saved_sale_detail = detail.id\n break\n end\n end\n if item_exists\n @detalle_ot_presupuesto.cantidad += params[:detalle_ot_presupuesto][:cantidad].to_i\n @detalle_ot_presupuesto.precio_venta= params[:detalle_ot_presupuesto][:precio_venta].to_f\n @detalle_ot_presupuesto.save!\n else\n detalle_ot_presupuesto = DetalleOtPresupuesto.new(detalle_ot_presupuesto_params)\n @orden_trabajo_presupuesto.detalle_ot_presupuestos << detalle_ot_presupuesto\n end\n\n respond_to do |format|\n \n if @orden_trabajo_presupuesto.save\n format.html {redirect_to @orden_trabajo_presupuesto, notice: 'El detalle se agregó correctamente.'}\n format.json {render :show, status: :created, location: @detalle_compra}\n else\n format.html {render :new}\n format.json {render json: @detalle_ot_presupuesto.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "f17b54b38484380b64b7910099f21326", "score": "0.5500379", "text": "def create\n @rentable_item = RentableItem.new(rentable_item_params)\n @rentable_item.save\n end", "title": "" }, { "docid": "b020b8cc6831a99a70f00c22480482bb", "score": "0.5497947", "text": "def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc092b205c1e397ed836d5d9ea7be6ce", "score": "0.5496846", "text": "def create\n code = params[:item][:event_id] \n params[:item].delete :event_id\n index = params[:item][:index]\n params[:item].delete :index\n\n @item = Item.new(params[:item])\n @item.ranked_position = index if index\n event = Event.find(Event.id_from_code(code))\n @item.event = event\n @item.save\n\n respond_to do |format| \n format.html { redirect_to @item, notice: 'item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n end\n end", "title": "" }, { "docid": "285e289935de223175f6e0d1e4c76385", "score": "0.54904854", "text": "def create\n @item_acompanhamento = ItemAcompanhamento.new(item_acompanhamento_params)\n\n respond_to do |format|\n if @item_acompanhamento.save\n format.html { redirect_to @item_acompanhamento, notice: 'Item acompanhamento was successfully created.' }\n format.json { render :show, status: :created, location: @item_acompanhamento }\n else\n format.html { render :new }\n format.json { render json: @item_acompanhamento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf4105c09eb97ee6e44bd770067b7772", "score": "0.5490364", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e15c7cfc42d9015c5c3c4614953cceb", "score": "0.5488842", "text": "def api_v1_item_params\n params.require(:item).permit(:plate, :status, :menu_id)\n end", "title": "" }, { "docid": "6d2a86c3ad6054a737fef331438dc85c", "score": "0.54812336", "text": "def create\n cart_uuid = params[:cart_id]\n @item = Item.new(item_params.merge(cart_uuid: cart_uuid))\n if @item.save\n render json: @item, status: 201\n else\n render_errors 400, @item.errors.full_messages\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d15f5a47b4c77d49c8148d1fcccc36", "score": "0.54790366", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a11e57d6e3e3223208e290340b78853", "score": "0.54787594", "text": "def create\n\n @item = Item.new(params[:item])\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/main', :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67fa85526a509c3c9fe21fac1fb9d218", "score": "0.5476854", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c209ddbbe2857480824fc5ca53125be", "score": "0.5473993", "text": "def create\n @inventory_item = InventoryItem.new(params[:inventory_item])\n @binder = Binder.find(@inventory_item.binder_id)\n \n authorize! :create, @binder\n\n respond_to do |format|\n if @inventory_item.save\n @inventory_items = InventoryItem.where(:binder_id => @inventory_item.binder_id).order(\"name\")\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully created.' }\n format.json { render json: @inventory_item, status: :created, location: @inventory_item }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "title": "" }, { "docid": "b916dfe22278ade8e74a0f231df61e1a", "score": "0.5472224", "text": "def votable_item_params\n params.require(:votable_item).permit(:upvotes, :downvotes, :sumvotes, :imageurl, :name, :description, :worth, :creator_id)\n end", "title": "" }, { "docid": "b32ccb75fe705b271fc82cbf70600c71", "score": "0.546899", "text": "def create\n @inventory_item = InventoryItem.new(inventory_item_params)\n @inventory_item.serial_numbers = Array.new\n @inventory_item.on_hand_quantity = 0\n @inventory_item.loaned_out_quantity = 0\n @inventory_item.in_use_quantity = 0\n\n respond_to do |format|\n if @inventory_item.save\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_item }\n format.js {\n index\n render :create\n }\n else\n format.html { render :new }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n format.js {\n index\n render :create\n }\n end\n end\n end", "title": "" }, { "docid": "cd7b89217c5e817a67c8f65da306b781", "score": "0.5468735", "text": "def index\n @item_vendas = ItemVenda.all\n @produtos = Produto.all\n end", "title": "" }, { "docid": "8c604e2a5ef517a97ec80931d31982fe", "score": "0.54686964", "text": "def create\n @food_item_add_on = FoodItemAddOn.new(food_item_add_on_params)\n\n\n\n#Todo: can select multiple items for a sinfle addons\n respond_to do |format|\n if @food_item_add_on.save\n format.html { redirect_to :controller => 'home', :action => 'dashboard' }\n format.json { render :show, status: :created, location: @food_item_add_on }\n else\n format.html { render :new }\n format.json { render json: @food_item_add_on.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5462188", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5462188", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5462188", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5462188", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5462188", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5462188", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5462188", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ffb12963a9d5663be543cdbca6d01a4", "score": "0.5462088", "text": "def vig_params\n params.require(:vig).permit(:name, :date, :test_ids=>[])\n end", "title": "" }, { "docid": "ab41022904d78547071832f026715dec", "score": "0.5461799", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c10df8ca70a3351dcc33543cfcba2bcc", "score": "0.545897", "text": "def create\n @product_item = @brand.items.new(product_item_params)\n\n if @product_item.save\n render :show, status: :created, location: [:partner, @brand, @product_item]\n else\n render json: @product_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "44569a4876185ad8f3d19942f9fd3e74", "score": "0.54571116", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
0e8393404173240140613abc8afe8ca7
% empty? : () > Boolean
[ { "docid": "04dd7178145f15ca458df4a6732f5e5b", "score": "0.85072577", "text": "def empty?() end", "title": "" } ]
[ { "docid": "5d4c878723231ffdfb112689c93c96a6", "score": "0.830969", "text": "def empty?\n none? { true }\n end", "title": "" }, { "docid": "f8f8300b940aab1641733eef42d1d19d", "score": "0.82299376", "text": "def empty?; false; end", "title": "" }, { "docid": "f8f8300b940aab1641733eef42d1d19d", "score": "0.82299376", "text": "def empty?; false; end", "title": "" }, { "docid": "e971bb39f69c2de57cd4163442ba14a4", "score": "0.8193696", "text": "def empty?\n end", "title": "" }, { "docid": "e971bb39f69c2de57cd4163442ba14a4", "score": "0.8193696", "text": "def empty?\n end", "title": "" }, { "docid": "e971bb39f69c2de57cd4163442ba14a4", "score": "0.8193696", "text": "def empty?\n end", "title": "" }, { "docid": "4d8b1fb79b1ba630e63ad9594d0dedb1", "score": "0.8110226", "text": "def empty?\n empty\n end", "title": "" }, { "docid": "bdced372a045b0ae4de5039c558e061a", "score": "0.8083255", "text": "def empty?\n end", "title": "" }, { "docid": "bdced372a045b0ae4de5039c558e061a", "score": "0.8083255", "text": "def empty?\n end", "title": "" }, { "docid": "bdced372a045b0ae4de5039c558e061a", "score": "0.8083255", "text": "def empty?\n end", "title": "" }, { "docid": "bdced372a045b0ae4de5039c558e061a", "score": "0.8083255", "text": "def empty?\n end", "title": "" }, { "docid": "16d839a5ad9b17eadc13ecdcea43f1df", "score": "0.7980252", "text": "def none_empty?\n !any_empty?\n end", "title": "" }, { "docid": "16d839a5ad9b17eadc13ecdcea43f1df", "score": "0.7980252", "text": "def none_empty?\n !any_empty?\n end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "4c04911a988a328b6df02093f999afba", "score": "0.79723924", "text": "def empty?; end", "title": "" }, { "docid": "9edc0bf7ce984ef89983c6fb5574c45e", "score": "0.7965218", "text": "def is_empty?\n end", "title": "" }, { "docid": "2061f201cfcc29bcb3108668256d867a", "score": "0.7958271", "text": "def empty?\n\n\n\n end", "title": "" }, { "docid": "5f22781b1d88671ffcd6baf86fc95987", "score": "0.7953268", "text": "def empty?\n `return self.length == 0 ? Qtrue : Qfalse;`\n end", "title": "" }, { "docid": "5f22781b1d88671ffcd6baf86fc95987", "score": "0.7953268", "text": "def empty?\n `return self.length == 0 ? Qtrue : Qfalse;`\n end", "title": "" }, { "docid": "779eb4267355e04d35f0219395f0986d", "score": "0.794749", "text": "def empty?\n false\n end", "title": "" }, { "docid": "6c8fa02ac679b55b01aacefb2401eec3", "score": "0.7919737", "text": "def empty?\n false\n end", "title": "" }, { "docid": "6c8fa02ac679b55b01aacefb2401eec3", "score": "0.7919737", "text": "def empty?\n false\n end", "title": "" }, { "docid": "57cdeafbae2e3323c479f8429b0a7949", "score": "0.7910471", "text": "def is_empty()\n \n end", "title": "" }, { "docid": "3702ed802cdd453bec0ec7a15d8323e8", "score": "0.7863967", "text": "def empty?\n true\n end", "title": "" }, { "docid": "3702ed802cdd453bec0ec7a15d8323e8", "score": "0.7863967", "text": "def empty?\n true\n end", "title": "" }, { "docid": "2b9939fde49ce3f8803814bc5e787c06", "score": "0.78630686", "text": "def empty?\n false\n end", "title": "" }, { "docid": "52d8c06bfae96d07d6086f22b261d774", "score": "0.78041804", "text": "def empty?\n true\n end", "title": "" }, { "docid": "52d8c06bfae96d07d6086f22b261d774", "score": "0.78041804", "text": "def empty?\n true\n end", "title": "" }, { "docid": "d809d24fb05921cc6c0caf0ef6adca14", "score": "0.77209306", "text": "def empty?\n !value\n end", "title": "" }, { "docid": "fe5845750e220996443088e80496eaab", "score": "0.77196836", "text": "def empty?\n\t\t\t\t\tfalse\n\t\t\t\tend", "title": "" }, { "docid": "081190af04509102e7e9da42bcfd96e5", "score": "0.76959586", "text": "def empty?\n `self.length === 0`\n end", "title": "" }, { "docid": "2c065e5f7079a0f5a8bc570072a9ec58", "score": "0.76875716", "text": "def empty?\n return false\n end", "title": "" }, { "docid": "a925de53d64c875b4869c655a8925f24", "score": "0.76043063", "text": "def isEmpty?\n end", "title": "" }, { "docid": "15eca873535be1251977717d7e6ec4a3", "score": "0.7594585", "text": "def empty?\r\n return @value == nil\r\n end", "title": "" }, { "docid": "2b5a42e1d22211a7a03315c02692331a", "score": "0.75884956", "text": "def empty?(*args, **_arg1, &block); end", "title": "" }, { "docid": "6998cac748fd9419e9f48f3b08733715", "score": "0.75542253", "text": "def empty?\n @type == EMPTY_TYPE\n end", "title": "" }, { "docid": "f7e7881c7fe5df985ed91758585db27e", "score": "0.75436664", "text": "def empty?\n\t\treturn [ self.one_of, self.all_of, self.none_of ].all?( &:empty? )\n\tend", "title": "" }, { "docid": "4ffaf8fb24d193ea5c6117a09e758331", "score": "0.7502379", "text": "def __empty?\n all?(&:__empty?)\n end", "title": "" }, { "docid": "da9cc8c59c23229eb232d09533aaf8d0", "score": "0.74867463", "text": "def empty?() \n\t\t\ta = to_ary\n\t\t\ta[0] == 0 && a[1] == 0 \n\t\tend", "title": "" }, { "docid": "c562b64f98eca072799af7c1cb21a940", "score": "0.747989", "text": "def empty?\n length == 0\n end", "title": "" }, { "docid": "e92788ce3500633f46726b5dcd9befe7", "score": "0.74786514", "text": "def empty?(&block)\n block ? !any?(&block) : !any?\n end", "title": "" }, { "docid": "fe0c30a8e57671c8249b6d2e113903c3", "score": "0.7474857", "text": "def empty?\n @is_empty\n end", "title": "" }, { "docid": "447f2f21e447a7d8026f635d2754b238", "score": "0.7465532", "text": "def empty?\r\n @length == 0\r\n end", "title": "" }, { "docid": "dd0e1e240f1da81b904a576f5b41c2b5", "score": "0.7464008", "text": "def empty?\n raise NotImplementedError\n end", "title": "" }, { "docid": "8a02c210fe877a724f86deff59184170", "score": "0.7458224", "text": "def empty?\n @length == 0\n end", "title": "" }, { "docid": "fb535e0cd27f535aa9929c1bbf03909a", "score": "0.7451785", "text": "def empty?\r\n @length == 0\r\n end", "title": "" }, { "docid": "fb535e0cd27f535aa9929c1bbf03909a", "score": "0.7451785", "text": "def empty?\r\n @length == 0\r\n end", "title": "" }, { "docid": "fb535e0cd27f535aa9929c1bbf03909a", "score": "0.7451785", "text": "def empty?\r\n @length == 0\r\n end", "title": "" }, { "docid": "fb535e0cd27f535aa9929c1bbf03909a", "score": "0.7451785", "text": "def empty?\r\n @length == 0\r\n end", "title": "" }, { "docid": "88f4eddb79f60ebbf4db89edb7c5be86", "score": "0.7430934", "text": "def empty?\n raise NotImplementedError, \"Method not implemented yet...\"\n end", "title": "" }, { "docid": "f0f451a277f97de27c2887a07113eedb", "score": "0.74218875", "text": "def empty?\n raise NotImplementedError\n end", "title": "" }, { "docid": "176bb6b9832ce8850c46e2d5483a7c5d", "score": "0.7415256", "text": "def any?\n ! empty?\n end", "title": "" }, { "docid": "72451b0714c9205cf69287e6557ac251", "score": "0.74110365", "text": "def empty?\n @val == 0\n end", "title": "" }, { "docid": "12c0611182883bb3333d689f1bb18eee", "score": "0.74080104", "text": "def empty?\n @length == 0\n end", "title": "" }, { "docid": "0ff710492b14f775e5e5c59db1566ac6", "score": "0.74018246", "text": "def empty?\n @val==nil\n end", "title": "" }, { "docid": "3b3903f7f52163887be2de857fbb1bd5", "score": "0.73972565", "text": "def blank?\n respond_to?(:empty?) ? !!empty? : !self\n end", "title": "" }, { "docid": "e02fdd02919e53b444537fb9a7d27613", "score": "0.73754877", "text": "def empty?\n\t\t@length == 0\n\tend", "title": "" }, { "docid": "8427ab85df1eee0db96551c7571f20cd", "score": "0.737475", "text": "def any?\n `self.length > 0`\n end", "title": "" }, { "docid": "5d647dd63872279ec48493ae2f5b13e9", "score": "0.73706776", "text": "def empty?\n value.empty?\n end", "title": "" }, { "docid": "edf1bdfaa566b44d94006ae9ed0bbcf5", "score": "0.7365821", "text": "def empty?()\r\n\t\t@bottles.zero?\r\n\tend", "title": "" }, { "docid": "98078385e641e708a255ec5dbed884c6", "score": "0.7345898", "text": "def empty?\n length == 0\n end", "title": "" }, { "docid": "98078385e641e708a255ec5dbed884c6", "score": "0.7345898", "text": "def empty?\n length == 0\n end", "title": "" }, { "docid": "98078385e641e708a255ec5dbed884c6", "score": "0.7345898", "text": "def empty?\n length == 0\n end", "title": "" }, { "docid": "fc69001bf22754c03f88f142d36335d0", "score": "0.73170114", "text": "def empty?\n @tvar.value == EMPTY\n end", "title": "" }, { "docid": "4c16416afaed7516749ea0dafaa54a2b", "score": "0.73021585", "text": "def blank?\n respond_to?(:empty?) ? empty? : !self\n end", "title": "" }, { "docid": "959fbb162dd958e466b6e7fcab8144b5", "score": "0.7278722", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "959fbb162dd958e466b6e7fcab8144b5", "score": "0.7278722", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "17f950543f9a0c473e216628660a1e52", "score": "0.7277601", "text": "def safe_empty(thing)\n thing.class.method_defined?(:empty?) && thing.empty?\n end", "title": "" }, { "docid": "824c7ac447e07f9e796800a4a2b29f9b", "score": "0.7272853", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "824c7ac447e07f9e796800a4a2b29f9b", "score": "0.7272853", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "137d8669b111261d736fb8951a54af21", "score": "0.7268414", "text": "def blank?\r\n nil? || (respond_to?(:empty?) && empty?)\r\n end", "title": "" }, { "docid": "00a9f2d76c02787ce0035289fe71cb3b", "score": "0.7266115", "text": "def empty?; size == 0 end", "title": "" }, { "docid": "f6a53fb98c3a5250d244c72c21d618b1", "score": "0.7264118", "text": "def blank?\n empty?\n end", "title": "" }, { "docid": "875e224ae4cff3c774db8266b37d489d", "score": "0.7260205", "text": "def empty?\n first.nil?\n end", "title": "" }, { "docid": "a7c4a87528ae7141773279cac99b7662", "score": "0.7259983", "text": "def empty?\n length.zero?\n end", "title": "" }, { "docid": "7f7fa30a6e520f31e16a353ba6a09bb1", "score": "0.72555935", "text": "def nil?\n\t\t\tempty?\n\t\tend", "title": "" }, { "docid": "5aa109cee1a236496793c52ee292d069", "score": "0.72535354", "text": "def empty?\n @f == @b\n end", "title": "" }, { "docid": "c773cecf45fb835ce0b354fbc2e686d6", "score": "0.7252809", "text": "def empty?()\n return @length == 0\n end", "title": "" }, { "docid": "19b3638319a0ac4cddbe493169248410", "score": "0.72478014", "text": "def is_empty?()\n (@head == nil) ? true : false\n end", "title": "" }, { "docid": "2e28d303995beccc770310f896003a12", "score": "0.72449565", "text": "def any?\n !empty?\n end", "title": "" }, { "docid": "2e28d303995beccc770310f896003a12", "score": "0.72449565", "text": "def any?\n !empty?\n end", "title": "" }, { "docid": "c2c9160264153ee3e90b7251172eba7d", "score": "0.72376066", "text": "def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end", "title": "" }, { "docid": "e830e2457f08403c782ecbe0ae85fff8", "score": "0.72367704", "text": "def empty?\n return @size == 0\n end", "title": "" }, { "docid": "c2c9160264153ee3e90b7251172eba7d", "score": "0.7236655", "text": "def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end", "title": "" }, { "docid": "c2c9160264153ee3e90b7251172eba7d", "score": "0.7236655", "text": "def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end", "title": "" }, { "docid": "0020201d184171576cce95fd3de0bd8b", "score": "0.72352684", "text": "def empty?()\n return @first.nil?\n end", "title": "" }, { "docid": "2ad10e8401c0d360a80ddffca9ebff04", "score": "0.7230661", "text": "def empty?\n value.empty?\n end", "title": "" }, { "docid": "b2339b6d2080926ba6412e0209c60eaa", "score": "0.7227944", "text": "def empty?\n all.empty?\n end", "title": "" } ]
470fe8bae42a08355f88ee85fa0aad84
Purpose: A noop method for overriding, intended to process all records assinged to a Batch Process Params: None Response: Returns True if batch is processed successfully
[ { "docid": "e5cebed9356b3f88e9e613c930080392", "score": "0.77918977", "text": "def process_batch!\n # no-op, can be overwritten\n end", "title": "" } ]
[ { "docid": "28ca9c7c7788b4cea34c1c66ce37a9f1", "score": "0.73327553", "text": "def process_batch(batch)\n ret = call([], :process_batch, batch.__calls)\n BatchContext::Return.from_calls_and_return(batch.__calls, ret)\n end", "title": "" }, { "docid": "87a5cce89e240b6e645930fedda6fb75", "score": "0.71048903", "text": "def process *args, &block\n raise \"override the process method in your implementation: it should process each record.\"\n end", "title": "" }, { "docid": "87767f9da6e2b93867f4a368a1a74abd", "score": "0.68279827", "text": "def process_batch\n batch = find_or_create_batch(@batch_id)\n \t metadata = CSV.read(@batch_file)\n \n collection_title = metadata.shift.first.titleize\n\t creator = metadata.shift.first\n\t if (0 == User.where(login: creator).count)\n\t creator = User.batchuser.login\n\t end\n\n\t @collection = find_or_create_collection(collection_title, creator)\n @created_on = metadata.shift.first\n @administrative_collection = metadata.shift.first\n\n set_creation_date(@created_on)\n\n # Ignore the blank line\n metadata.shift.first\n\t process_files(metadata, batch)\n end", "title": "" }, { "docid": "dd5f0adfcdbaf2bae719e12609890546", "score": "0.6789273", "text": "def post_process(_records)\n end", "title": "" }, { "docid": "e39d78205d19d0309a489905e2750982", "score": "0.67353237", "text": "def process_batch(&block)\n Log.logger.info(\"Batch procession started.\")\n unless block_given?\n Log.logger.error(\"Please specify a block to use this function.\")\n exit 1\n end\n @batch=true\n yield\n send_batch\n @batch=false\n end", "title": "" }, { "docid": "c1a91aff6014f5f766c0953dac6a2b4f", "score": "0.6734112", "text": "def make_run_batch_call\n return false if @batch.nil? or @batch.size == 0\n\n # The nitro API returns a differently formatted result if called with\n # only one action. Thus, they need to be handled differently.\n if @batch.size == 1\n handle_batch_single_action\n else\n handle_batch_multiple_actions\n end\n end", "title": "" }, { "docid": "4715a6d04eb83fbf8d0fe7823a1c4fe0", "score": "0.6632648", "text": "def bulk_process\n end", "title": "" }, { "docid": "54c195a60213820f95045712141909e3", "score": "0.66124", "text": "def process_job\n process_batch(size: 1)\n end", "title": "" }, { "docid": "74b6bed18ba0b78ffb606d585a455d3a", "score": "0.64607674", "text": "def create_batch!(_records)\n # no-op, can be overwritten\n end", "title": "" }, { "docid": "d4060f42728cf2869badaebe7c0158b9", "score": "0.6421236", "text": "def process!\n\n return if @request_items.empty?\n\n opts = { :request_items => @request_items }\n\n begin\n\n response = client.batch_write_item(opts)\n\n unprocessed = response.data['UnprocessedItems']\n\n opts[:request_items] = convert_unprocessed_items(unprocessed)\n\n end while opts[:request_items]\n\n @request_items = {}\n nil\n\n end", "title": "" }, { "docid": "a2a2b9bcfcaa6c0e025e17ef2f3a5ef6", "score": "0.6321105", "text": "def batch_records\n @records = Record.where(:import_batch_id => params[:id]).paginate(:page => import_batch_params[:page])\n end", "title": "" }, { "docid": "b0abff7c33f540eeb5f9215d65949ab2", "score": "0.6266861", "text": "def process_batch_ids(batch_ids, batch_ids_for_supplemental_output)\n puts \"Batches #{batch_ids.join(',')} qualify for output generation\"\n if supplemental_output_type && supplemental_output_type.include?(\"Operation Log\")\n generate_operation_log(batch_ids_for_supplemental_output)\n end\n if supplemental_output_type && supplemental_output_type.include?(\"Indexed Image O/P\")\n generate_indexed_image_file(batch_ids_for_supplemental_output)\n convert_tiff_to_jpeg if @insurance_eob_output_config.details[:convert_tiff_to_jpeg]\n end\n begin\n if insurance_eob_output_config\n Batch.where(\"id in (?)\", batch_ids).update_all(:status => BatchStatus::OUTPUT_GENERATING)\nRails.logger.info \"============== batch updated to OUTPUT_GENERATING\"\n ins_pay_grouping = insurance_eob_output_config.grouping\n pat_pay_grouping = patient_eob_output_config.grouping if patient_eob_output_config\n @facility_output_group = ins_pay_grouping.upcase\nRails.logger.info \"============== After pat_pay_grouping\"\n first_batch = Batch.find(batch_ids.first)\n groupings = [\"SITE SPECIFIC\",\"SINGLE DAILY MERGED CUT\",\"SEQUENCE CUT\"]\n if groupings.include?(ins_pay_grouping.upcase)\n if ins_pay_grouping.upcase == \"SINGLE DAILY MERGED CUT\"\n batches = Batch.find(:all,:conditions => {:date => first_batch.date, :facility_id => first_batch.facility_id, :status => BatchStatus::OUTPUT_READY})\n batch_ids = batches.collect(&:id).join(\",\")\n end\n if ins_pay_grouping.upcase == \"SEQUENCE CUT\"\n batches = Batch.find(:all,:conditions => {:date => first_batch.date, :cut => first_batch.cut, :facility_id => first_batch.facility_id, :status => BatchStatus::OUTPUT_READY})\n batch_ids = batches.collect(&:id).join(\",\")\n end\nRails.logger.info \"============== After groupings\" \n @eob_segregator = EobSegregator.new(ins_pay_grouping, pat_pay_grouping)\nRails.logger.info \"============== After EobSegregator.new\" \n eobs = InsurancePaymentEob.by_eob(batch_ids)\nRails.logger.info \"============== After InsurancePaymentEob.by_eob\"\n check_eob_groups = @eob_segregator.segregate(batch_ids,eobs)\nRails.logger.info \"============== After @eob_segregator.segregate\"\n puts \"Grouping successful, returned #{check_eob_groups.length} distinct group/s\"\n Output835.log.info \"Grouping successful, returned #{check_eob_groups.length} distinct group/s\"\n check = eobs.first.check_information\n batch = check.batch\n job = check.job\n check_payer = check.payer\n @batch_date = batch.date.strftime(\"%d%m%Y\")\n @batch_id = batch.batchid\n if check_payer\n @payer = check_payer.payer\n @output_config = (job.payer_group == 'PatPay' &&\n !@insurance_eob_output_config.payment_corres_patpay_in_one_file &&\n !@insurance_eob_output_config.payment_patpay_in_one_corres_in_separate_file) ?\n @patient_eob_output_config : @insurance_eob_output_config\n end\n check_eob_groups.each do |key, value|\n check_eob_hash = value\n checks = CheckInformation.find(:all,:conditions=>[\"id in (?)\",check_eob_hash.keys])\n @client_id = facility.sitecode\n @lockbox_number = facility.lockbox_number\n puts \"Generating Output..\"\n Output835.log.info \"Generating Output..\"\n @key = key\n generate_output(@key,checks,check_eob_hash)\n end\n \n else\nRails.logger.info \"============== B4 CheckSegregator.new\" \n @check_segregator = CheckSegregator.new(ins_pay_grouping, pat_pay_grouping)\nRails.logger.info \"============== after CheckSegregator.new\" \n puts \"Applying '#{first_batch.widest_grouping(\"Output\")}' grouping on batches..\"\n if @client.upcase == \"GOODMAN CAMPBELL\"\n check_groups = @check_segregator.segregate_gcbs_checks(batch_ids)\n else\n check_groups = @check_segregator.segregate(batch_ids)\n end\nRails.logger.info \"============== after check_segregator.segregate\" \n checks = CheckInformation.by_batch(batch_ids)\n @type = checks.collect(&:batch).collect(&:correspondence).uniq\n puts \"Grouping successful, returned #{check_groups.length} distinct group/s\"\n Output835.log.info \"Grouping successful, returned #{check_groups.length} distinct group/s\"\nRails.logger.info \"============== before check_groups.each\" \n check_groups.each do |group, checks|\n @nextgen = group.include?(\"goodman_nextgen\")\n first_index = 0\n array_length = 10\n @file_index = 0\n @batch_date = checks.first.batch.date.strftime(\"%d%m%Y\")\n @client_id = facility.sitecode\n @batch_id = checks.first.batch.batchid\n @lockbox_number = facility.lockbox_number\n payer = checks.first.payer\n job = checks.first.job\n if payer\n @payer = payer.payer\n @output_config = (job.payer_group == 'PatPay' &&\n !@insurance_eob_output_config.payment_corres_patpay_in_one_file &&\n !@insurance_eob_output_config.payment_patpay_in_one_corres_in_separate_file) ?\n @patient_eob_output_config : @insurance_eob_output_config\n end\nRails.logger.info \"============== before Generating Output..\" \n puts \"Generating Output..\"\n Output835.log.info \"Generating Output..\"\n if @client.upcase == \"GOODMAN CAMPBELL\" && !group.include?(\"notapplicable\")\n check_length = checks.length\n remaining_checks = check_length % array_length\n total_number_of_files = (remaining_checks==0)? (check_length / array_length):((check_length / array_length)+1)\n file_number=0\n while(file_number < total_number_of_files)\n checks_new = checks[first_index,array_length]\n unless checks_new.blank?\n file_number += 1\n first_index = array_length*file_number\nRails.logger.info \"============== before if generate_output\" \n generate_output(group, checks_new)\nRails.logger.info \"============== after if generate_output\" \n @file_index += 1\n end\n end\n else\nRails.logger.info \"============== before else generate_output\" \n generate_output(group, checks)\nRails.logger.info \"============== after else generate_output\" \n end\n end\n end\n \n else\n puts \"Cannot generate output without Output Configuration\"\n Output835.log.info \"Cannot generate output without Output Configuration\"\n puts \"Please create Output Configuration for #{facility}\"\n Output835.log.info \"Please create Output Configuration for #{facility}\"\n end\n Batch.update_all([\"output_835_posting_time = ?\", Time.now ], \" id in (#{batch_ids.join(\",\")})\") if batch_ids.present?\n rescue Exception => e\n Batch.update_all([\"status = ?\", BatchStatus::OUTPUT_EXCEPTION], \" id in (#{batch_ids.join(\",\")})\") if batch_ids.present?\n Batch.update_all([\"status = ?\", BatchStatus::OUTPUT_EXCEPTION], \" id in (#{batch_ids_for_supplemental_output.join(\",\")})\") if batch_ids_for_supplemental_output.present?\n puts e.message\n Output835.log.error e.message\n else\n Batch.where(\"id in (?)\", batch_ids).update_all({:status => BatchStatus::OUTPUT_GENERATED, :output_835_generated_time => Time.now})\n end\n \n end", "title": "" }, { "docid": "08bb0bb5b22ea7a701bf59425bcf1090", "score": "0.62303936", "text": "def batch_finished\n end", "title": "" }, { "docid": "976432e1e0a5734123e6d142dbd561e8", "score": "0.62238514", "text": "def batch(&block)\n self.begin_batch\n block.call\n self.commit_batch\n end", "title": "" }, { "docid": "680819fd77f062d35344312796806082", "score": "0.61759824", "text": "def execute!\n raise BatchValidationError.new(@errors), @errors unless execute\n true\n end", "title": "" }, { "docid": "96f129213dc786010eb412201a579e8a", "score": "0.61482584", "text": "def process_batch!\n batch_processing!\n\n priority_end_product_sync_queue.each do |record|\n record.status_processing!\n epe = record.end_product_establishment\n\n begin\n epe.sync!\n epe.reload\n\n if epe.vbms_ext_claim.nil?\n fail Caseflow::Error::PriorityEndProductSyncError, \"Claim ID: #{epe.reference_id} not In VBMS_EXT_CLAIM.\"\n elsif epe.synced_status != epe.vbms_ext_claim&.level_status_code\n fail Caseflow::Error::PriorityEndProductSyncError, \"EPE ID: #{epe&.id}. EPE synced_status of\"\\\n \" #{epe.synced_status} does not match the VBMS_EXT_CLAIM level_status_code of\"\\\n \" #{epe.vbms_ext_claim&.level_status_code}.\"\n end\n rescue StandardError => error\n error_out_record!(record, error)\n next\n end\n\n record.status_sync!\n increment_completed\n end\n\n batch_complete!\n end", "title": "" }, { "docid": "408bcd518623bdb53863a4b313aaa976", "score": "0.61177534", "text": "def prepare_batch\n index_batch_id = find_batchid\n if @version == 'BANK_OF_AMERICA'\n unless index_batch_id == @last_bat_index\n batchid = InputBatch.get_batchid\n else\n batchid = @prev_batchid\n end\n else\n batchid = get_batchid_general(index_batch_id)\n end\n bat = Batch.find(:first, :conditions => {:batchid => batchid, :facility_id => facility.id})\n @batch_condition = bat.nil? && @prev_batchid != batchid\n if @batch_condition && @corresp_flag\n @corresp_flag = false if (@version == 'BANK_OF_AMERICA' && type == 'CORRESP')\n @bat = Batch.new\n @job_index = 0\n InputBatch::Log.write_log \"Preparing batch #{batchid}\"\n InputBatch::Log.write_log type\n parse_values(\"BATCH\", @bat)\n @bat = update_batch @bat\n @bat.batchid = batchid\n @bat.file_meta_hash = file_meta_hash\n else\n if @prev_batchid != batchid && @corresp_flag\n InputBatch::Log.write_log \"Batch #{batchid} already loaded\"\n @bat = nil\n end\n end\n @last_bat_index = index_batch_id\n @prev_batchid = batchid\n end", "title": "" }, { "docid": "9f3aac6c6c37e0fe612c5c064faa7da2", "score": "0.6117488", "text": "def batch\n @batch = true\n yield(self)\n ensure\n @batch = false\n end", "title": "" }, { "docid": "654518fa18df7bd5bf8174a656dc7713", "score": "0.610547", "text": "def process\n Karafka.monitor.notice(self.class, params_batch)\n perform\n end", "title": "" }, { "docid": "9c255363a4c7e6729f25ad8d26f64e43", "score": "0.6083886", "text": "def batch_process(spark)\n @output = @batch.process(base_opts(), @firehose, spark)\n end", "title": "" }, { "docid": "cd3fc8fa112d5cd309007f7551bfa3ae", "score": "0.60806596", "text": "def prepare_batch\n index_batchid = parse(cnf['BATCH']['index_batch_number']).to_s\n if @current_batchid != index_batchid\n @current_batchid = index_batchid\n @new_batch_flag = 1\n end\n batchid = find_batchid\n batch = Batch.find(:first, :conditions => {:batchid => batchid, :facility_id =>\\\n facility.id})\n @batch_condition = batch.nil? and @batchid != batchid\n if @batch_condition && @corresp_flag\n @corresp_flag = false if (@version == 'BANK_OF_AMERICA' && type == 'CORRESP')\n @batch = Batch.new\n @job_index = 0\n InputBatch::Log.write_log \"Preparing batch #{batchid}\"\n InputBatch::Log.write_log type\n parse_values(\"BATCH\", @batch)\n @@batch_date = @batch.date if !@batch.date.blank?\n @batch = update_batch @batch\n @batch.batchid = batchid\n @batch.file_meta_hash = file_meta_hash\n else\n if @batchid != batchid && @corresp_flag\n InputBatch::Log.write_log \"Batch #{batchid} already loaded\"\n @batch = nil\n end\n end\n @batchid = batchid\n end", "title": "" }, { "docid": "ad1235a103ea65e5f38052e915a2e841", "score": "0.6065315", "text": "def run_batch!\n # Delete records that OAI has marked for deletion\n delete_deletables!\n transform_and_load!\n end", "title": "" }, { "docid": "e9557ff3936bcd9e5e03f9ace29bca33", "score": "0.6044214", "text": "def save_records\n @new_batch_flag = 0\n micr = nil\n prepare_batch\n if @batch\n if @inbound_file_information\n @batch.inbound_file_information = @inbound_file_information\n @batch.arrival_time = @inbound_file_information.arrival_time\n end\n @job_condition = job_condition\n if @job_condition\n @img_count = 1\n do_bank_logics if type == 'PAYMENT' #Applying bank specific logic\n end\n images = prepare_image\n images.each{|image| @batch.images_for_jobs << image} unless images.blank?\n\n prepare_job\n @batch.jobs << @job if @job_condition\n images.each{|image| @job.images_for_jobs << image} unless images.blank?\n \n if @job_condition\n check = prepare_cheque\n if type == 'PAYMENT'\n micr = prepare_micr\n if micr\n payer = micr.payer\n check.payer_id = micr.payer_id if micr.payer_id\n if !facility.payer_ids_to_exclude.blank?\n @job.job_status = JobStatus::EXCLUDED if payer && payer.excluded?(facility)\n elsif !facility.payer_ids_to_include.blank?\n @job.job_status = JobStatus::EXCLUDED if !facility.included_payers.include?(payer)\n end\n micr.check_informations << check\n end\n end\n @job.check_informations << check\n @job.initial_image_name = @initial_image_name\n end\n end\n\n\n\n if @batch.save\n @batch.update_attributes(:status => BatchStatus::NEW)\n if @job.save\n @job.save_payer_group(micr) unless micr.blank?\n unless images.blank?\n \n images.each do |image|\n if image.save\n if image.image_file_name.upcase == @check_image.to_s.upcase\n save_image_types(\"CHK\",image)\n elsif ((image.image_file_name.upcase == @envelop_image.to_s.upcase) and (@job.job_status != JobStatus::EXCLUDED))\n save_image_types(\"ENV\",image)\n elsif ((@job.job_status == JobStatus::EXCLUDED) and (image.image_file_name.upcase != @check_image.to_s.upcase))\n save_image_types(\"OTH\",image)\n end\n total_number_of_images = number_of_pages(@job)\n check_number = check.check_number if !check.blank?\n estimated_eob = @job.estimated_no_of_eobs(total_number_of_images, micr, check_number)\n @job.update_attributes(:estimated_eob => estimated_eob, :pages_to => total_number_of_images)\n\n puts \"Image #{image.image_file_name} successfully loaded\" if !image.size.blank?\n else\n raise \"Error on line #{@row_index} : Cannot load image #{image.image_file_name}\"\n end\n end\n end\n end\n else\n raise \"Error on line #{@row_index} : Cannot save batch\"\n end\n \"#{@batch.date.strftime(\"%Y%m%d\")}_#{@batch.batchid}_SUPPLEMENTAL_OUTPUT\" rescue nil\n end", "title": "" }, { "docid": "7a2cb0bd619f2f949fe71c9a854f1e62", "score": "0.6034499", "text": "def batch\n yield if block_given?\n end", "title": "" }, { "docid": "2e3238328a8bd84e8bc234a6b53a8b81", "score": "0.6032379", "text": "def batch(options = {})\n return unless block_given?\n raise FacebookError.new(951, 'Batch already started') if pending_batch \n\n self.batch_queue = []\n self.pending_batch = true\n options[:raise_errors] = true if options[:raise_errors].nil?\n\n yield self\n\n self.pending_batch = false\n results = call('batch.run', \n :method_feed => self.batch_queue, \n :serial_only => true)\n self.batch_queue = nil\n\n #Batch results are an array of JSON strings, parse each\n results.map! { |json| Yajl::Parser.parse(json) }\n\n results.each do |data|\n if data.is_a?(Hash) && data['error_msg']\n raise FacebookError.new(data['error_code'], data['error_msg'])\n end\n end if options[:raise_errors]\n\n results\n end", "title": "" }, { "docid": "886319e2105a56d299fb469b5a5f395e", "score": "0.59941393", "text": "def process!\n @records.each_with_index do |record, index|\n log index: index, message: \"processing #{record.class.name}: #{record_id(record)}\"\n yield record\n success!(record)\n rescue StandardError => e\n failure!(record: record, error: e)\n end\n stats\n end", "title": "" }, { "docid": "7c08064878c3367840f67c30eca218ab", "score": "0.5987996", "text": "def batch(&block)\n session.batch(&block)\n end", "title": "" }, { "docid": "b21f3924ec35f0c351c48d546cb7c089", "score": "0.59862274", "text": "def flush_batch\n if @batching && @batch_queue.size > 0\n flush_batch_queue()\n end\n end", "title": "" }, { "docid": "85e03e5260337cebb16bf5d590003a4c", "score": "0.59760815", "text": "def batch\n @batch ||= (params.batch.nil?) ? Batch.new : params.batch\n end", "title": "" }, { "docid": "298fa8b8d8450985187c1e94d24ac26c", "score": "0.59742594", "text": "def process_next_batch_params(next_batch_params, job_id, async = true, transform = true)\n next_batch_params.each do |next_batch_param|\n processed_batch = ImportBatch.where(import_job_id: job_id, batch_param: next_batch_param, processed: true).take\n if processed_batch.nil?\n if (async)\n ImportBatchesWorker.perform_async(job_id, next_batch_param, true, transform)\n else\n ImportBatchesWorker.new.perform(job_id, next_batch_param, false, transform)\n end\n end\n end\n end", "title": "" }, { "docid": "d8a19f45d70f6857354f3571c3b1bc7d", "score": "0.597371", "text": "def perform(batch_entry)\n # Validation checking that it is okay to ingest this batch entry\n if batch_entry.media_object_pid.present? && MediaObject.exists?(batch_entry.media_object_pid)\n mo = MediaObject.find(batch_entry.media_object_pid)\n if mo.published?\n published_error(batch_entry)\n return\n end\n end\n\n\n entry = Avalon::Batch::Entry.from_json(batch_entry.payload)\n if entry.valid?\n # Set to process status on the BatchEntries\n update_status(batch_entry, \"Processing\")\n # Start processing\n entry.process!\n # Success handling\n process_success(batch_entry, entry)\n else\n # Report error\n invalid_error(batch_entry, entry)\n end\n # TODO any post processing to update status?\n\n rescue StandardError => e\n process_error(batch_entry, e)\n end", "title": "" }, { "docid": "545d9420f73330cf6419dedc05b04c74", "score": "0.59553933", "text": "def process\n @record = determine_record if respond_to?(:determine_record)\n run_steps\n end", "title": "" }, { "docid": "b60f68adc9ac24c1223ddac57425b553", "score": "0.5951912", "text": "def begin_batch\n raise ActiveRecord::ActiveRecordError.new(\"Batch already started. Finish it before start new batch\") \\\n if batch_started\n\n @batch_started = true\n end", "title": "" }, { "docid": "d3a15bbb0faa64d228807146b235537e", "score": "0.59513193", "text": "def process_all_records\n @total_count.times { |index| process_record index }\n end", "title": "" }, { "docid": "f91bba222332eef60ff88557efeed440", "score": "0.59348655", "text": "def flush\n return true if @batch.empty?\n @cs.documents_batch @batch\n @batch.clear\n end", "title": "" }, { "docid": "7a908340c94ad316d6345df39455531a", "score": "0.59303284", "text": "def batch_request()\n @batching = true\n @batch_queue = []\n yield\n @batching = false\n flush_batch_queue();\n end", "title": "" }, { "docid": "a26b58e2dd365a366929727b84283e81", "score": "0.5925637", "text": "def process_in_batches(records)\n records.each_slice(@max_events_per_send).each { |batch| \n payload = { \"records\" => batch }\n log.debug \"Sending batch of #{batch.size()} records to EventHub...\"\n @sender.send_w_properties(payload, @message_properties)\n }\n end", "title": "" }, { "docid": "74e8f34d9a16e6edd3530850f1a6662c", "score": "0.5922575", "text": "def validate!(batch)\n # by default we want strict behavior so that we don't get extraneous \n # keys in the batch that aren't getting used. \n unless batch.to_h.empty?\n raise ETL::BatchError, \"Invalid batch #{batch.to_h} specified; expected empty\"\n end\n batch\n end", "title": "" }, { "docid": "cace980ef31c76a0f9a447345f93a2a4", "score": "0.5913406", "text": "def create\n @batch = Batch.new(params[:batch])\n\n respond_to do |format|\n if @batch.save\n @batch.process_asynchronously\n flash[:notice] = 'Batch was successfully created.'\n format.html { redirect_to(@batch) }\n format.xml { render :xml => @batch, :status => :created, :location => @batch }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @batch.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34b799a84a0ec1af6da6951ecaba0d61", "score": "0.59094036", "text": "def batch?\n @batch\n end", "title": "" }, { "docid": "fb98d31cf53d6ec2610d9cdabc8ddc28", "score": "0.58933485", "text": "def process_batch(batch, options)\n batch.each_cec do |cec|\n review_cec(cec)\n end\n end", "title": "" }, { "docid": "cca105b78309530f2add83cf97609f32", "score": "0.58860815", "text": "def process_all\n process_batch(size: incoming.size) while !incoming.empty?\n end", "title": "" }, { "docid": "d2a97c49384772759000f7616ff995fd", "score": "0.58798534", "text": "def batch_one\n @batch_one ||= begin\n response = client.search.call(operation, message: query)\n records = response_records(response, response_type)\n @records_found = response_return(response, response_type)[:records_found].to_i\n @records_retrieved = records.count\n @query_id = response_return(response, response_type)[:query_id].to_i\n records\n end\n end", "title": "" }, { "docid": "5c9d8fa04ce2067f225a0c0ecb3828fc", "score": "0.5863148", "text": "def save_records\n if type\n prepare_batch\n\n if @bat\n @img_count = 1 if @job_condition\n if @inbound_file_information\n @bat.inbound_file_information = @inbound_file_information\n @bat.arrival_time = @inbound_file_information.arrival_time\n end\n images,@initial_image_name = prepare_image\n images.each{|image| @bat.images_for_jobs << image}\n\n prepare_job\n @bat.jobs << @job if @job_condition\n images.each{|image| @job.images_for_jobs << image}\n\n if @job_condition\n chk = prepare_cheque\n @job.check_informations << chk\n @job.initial_image_name = @initial_image_name\n if type == 'PAYMENT'\n mic = prepare_micr\n @job.check_informations << chk\n if mic\n if mic.payer_id\n payer = mic.payer\n chk.payer_id = mic.payer_id\n if InputBatch.is_exclude_payer( facility, chk.payer_id)\n @job.delete\n @type = nil\n @flag = 1\n end\n if !facility.payer_ids_to_exclude.blank?\n @job.job_status = JobStatus::EXCLUDED if payer && payer.excluded?(facility)\n elsif !facility.payer_ids_to_include.blank?\n @job.job_status = JobStatus::EXCLUDED if !facility.included_payers.include?(payer)\n end\n end\n mic.check_informations << chk\n end\n end\n end\n\n if @flag == 0\n if @bat.save\n if @job.save\n images.each do |image|\n save_image(image)\n end\n\n total_number_of_images = number_of_pages(@job)\n check_number = chk.check_number if !chk.blank?\n estimated_eob = @job.estimated_no_of_eobs(total_number_of_images, mic, check_number)\n @job.update_attributes(:estimated_eob => estimated_eob, :pages_to => total_number_of_images)\n \n if @job_condition and chk.save\n InputBatch::Log.status_log.info \"Check id #{chk.id}, check_number #{chk.check_number}, Job id #{chk.job.id}, batch id #{chk.job.batch.id} successfully loaded\"\n if mic and mic.save\n InputBatch::Log.status_log.info \"Check #{chk.id} associated to micr #{chk.micr_line_information.id}\"\n @job.save_payer_group(mic)\n end\n end\n else\n raise \"Error on line #{@row_index} : Cannot save job for batch #{@bat.batchid}\"\n end\n else\n raise \"Error on line #{@row_index} : Cannot save batch\"\n end\n end\n @flag = 0\n end\n end\n end", "title": "" }, { "docid": "f9ab977b95b80140829d10357f4908c3", "score": "0.58623224", "text": "def batch_new\n\tend", "title": "" }, { "docid": "41a32c3ac0da3325ba0463bfbf657cac", "score": "0.58502674", "text": "def create\n\n @samples = Array.new()\n\n saved = true\n Batch.transaction do\n @batch = Batch.new(batch_params)\n\n samples_hash = params[:samples]\n\n samples_hash.keys.each do |id|\n\n sample = Sample.find(id)\n\n @batch.samples << sample\n @samples << sample\n sample.preparing = true\n if !sample.update_attributes(samples_hash[id])\n saved = false\n end\n end\n\n if !@batch.save\n saved = false\n end\n\n if !saved\n raise ActiveRecord::Rollback, \"Prepping failed!\"\n end\n end\n\n if saved\n flash[:notice] = 'Batch was successfully created.'\n redirect_to(non_ph_batches_preparations_path)\n else\n render action: \"new\"\n end\n\n end", "title": "" }, { "docid": "b1e861ececd994e303edd64dfaee5a9f", "score": "0.58431834", "text": "def create_batch!(records)\n new_batch = PriorityEpSyncBatchProcess.create!(batch_type: name,\n state: Constants.BATCH_PROCESS.pre_processing,\n records_attempted: records.count)\n\n new_batch.assign_batch_to_queued_records!(records)\n new_batch\n end", "title": "" }, { "docid": "c4123327b8a25593b781cd94c6d0e921", "score": "0.583059", "text": "def batch\n if @batch_ops\n yield\n else\n batch_start\n yield\n batch_end\n end\n end", "title": "" }, { "docid": "5b58c7acc447389f2bbff9fd7ca947a5", "score": "0.58256847", "text": "def run_internal\n rows_processed = @client.upsert_rows(reader, @table_schemas_lookup, @transformer, @validator, @copy_options)\n msg = \"Processed #{rows_processed} input rows\"\n ::ETL::Job::Result.success(rows_processed, msg)\n end", "title": "" }, { "docid": "70fd228a3ad1e4a39177ef0279dda83b", "score": "0.58038425", "text": "def handle_batch_multiple_actions\n # TODO: improve handling of errors in the batch response\n actions = []\n @batch.each do |action|\n actions << to_query(action[:params])\n end\n\n results = really_make_call({'method' => 'batch.run','methodFeed' => JSON.dump(actions)}, :post)\n @batch = nil\n extract_session_key results\n results\n end", "title": "" }, { "docid": "d2fcf3498e21cf83eb3a9607229d8d3d", "score": "0.5794326", "text": "def create_batch\n # create the new batch\n job_type = JobType.find(params[:type_id])\n ocr_engine = OcrEngine.find(params[:engine_id])\n font = Font.find_by(font_id: params[:font_id])\n language_model = LanguageModel.find_by(id: params[:language_model_id])\n glyph_substitution_model = GlyphSubstitutionModel.find_by(id: params[:glyph_substitution_model_id])\n job_status_id = JobStatus.not_started.id\n batch_job_params = {\n name: params[:name],\n parameters: params[:params],\n notes: params[:notes],\n job_type: job_type,\n ocr_engine: ocr_engine,\n font: font,\n language_model: language_model,\n glyph_substitution_model: glyph_substitution_model,\n font_training_result_batch_job_id: params[:font_training_result_batch_job_id],\n }\n batch = BatchJob.create!(batch_job_params)\n batch_id = batch.id\n\n job_queue_columns = [\n :batch_id,\n :page_id,\n :job_status_id,\n :work_id\n ]\n\n # get the work id payload. If it is ALL, generate a\n # query to get all of the work IDs based on the current\n # filter settings\n json_payload = ActiveSupport::JSON.decode(params[:json])\n if json_payload['works'] == 'all'\n works = Work.ransack(ActiveSupport::JSON.decode(params[:q])).result\n\n jobs = []\n works.find_each do |work|\n work_id = work.id\n work.pages.find_each do |page|\n job = [batch_id, page.id, job_status_id, work_id]\n jobs << job\n end\n\n logger.debug \"Write #{jobs.size} jobs...\"\n JobQueue.import job_queue_columns, jobs, validate: false\n jobs = []\n end\n else\n # populate it with pages from the selected works\n jobs = []\n work_ids = json_payload['works']\n pages = Page.where(pg_work_id: work_ids)\n pages.find_each do | page |\n job = job = [batch_id, page.id, job_status_id, page.work.id]\n jobs << job\n end\n logger.debug \"Write #{jobs.size} jobs...\"\n JobQueue.import job_queue_columns, jobs, validate: false\n end\n\n # get a new summary for the job queue\n status = JobQueue.status_summary\n render json: ActiveSupport::JSON.encode(status), status: :ok\n rescue => e\n logger.error(\"DashboardController#create_batch error: #{e.message}\")\n render text: e.message, status: :error\n end", "title": "" }, { "docid": "8ee8249405b5b3060d28ae65a75f559f", "score": "0.5784746", "text": "def records_in_batches(table_name)\n raise \"implement in subclass\"\n end", "title": "" }, { "docid": "a77a01d74b334b579fc1da344a1c0b06", "score": "0.5782507", "text": "def batch\n @batch = []\n yield\n @client.Log(@batch)\n ensure\n @batch = nil\n end", "title": "" }, { "docid": "c03a5137fa99f648e131b2b6db016538", "score": "0.57753485", "text": "def perform_bulk(*args, **kwargs); end", "title": "" }, { "docid": "c03a5137fa99f648e131b2b6db016538", "score": "0.57753485", "text": "def perform_bulk(*args, **kwargs); end", "title": "" }, { "docid": "f76f31e87d49c69dd6b4365fcc920f48", "score": "0.5768771", "text": "def batch(&block)\n @db.batch(&block)\n end", "title": "" }, { "docid": "eed54ca0279ce9b7d4b86216e36afa4a", "score": "0.5748231", "text": "def perform_bulk(body)\n response = bulk.perform(body)\n yield response if block_given?\n Chewy.wait_for_status\n @errors.concat(response)\n response.blank?\n end", "title": "" }, { "docid": "8ead8e81ffb50af940e61c9b75ad05e4", "score": "0.5737059", "text": "def batch(&block)\n Batch.new(self, &block).run!\n end", "title": "" }, { "docid": "42548456a2acd05e5eecf06fd4522b68", "score": "0.57358706", "text": "def start_batch\n raise \"Cannot call start_batch on a batch!\"\n end", "title": "" }, { "docid": "d1d8c730426432067b8e6e94dfc426c4", "score": "0.5731345", "text": "def batch_import\n batch_result = nil\n run_callback(:before_batch_import)\n batch_added = to_be_added\n batch_headers = prepare_headers\n ActiveRecord::Base.connection.reconnect!\n batch_result = @resource.import(batch_headers, batch_added, import_options)\n raise ActiveRecord::Rollback if import_options[:batch_transaction] && batch_result.failed_instances.any?\n batch_result\n end", "title": "" }, { "docid": "bbd3d21166e8ee7d2593dfb05e5e6935", "score": "0.5720633", "text": "def reset\n @batch_iteration = 0\n @records_retrieved = batch_one.count\n end", "title": "" }, { "docid": "b16de026a6679ef08aa2be344b3358cc", "score": "0.57174057", "text": "def batch\n yield self\n flush(sync: true)\n end", "title": "" }, { "docid": "0487e3614adf1ba8f5d7c49df6404cbd", "score": "0.5713576", "text": "def processing?\n return false if self.batch.blank?\n return false if !self.batch.methods.include? :status\n return (!self.batch.status.empty?) && (self.batch.status.count == 1) && (self.batch.status[0] == \"processing\")\n end", "title": "" }, { "docid": "f960f0ccf0a818218547c34715b4ba45", "score": "0.57037765", "text": "def flush\n if not @batching\n throw \"Batching is not enabled\"\n end\n send_request \"batch&requestArray=#{JSON.generate @waiting}\"\n end", "title": "" }, { "docid": "74ab1e121117adc129edadb548ade111", "score": "0.56846744", "text": "def execute!\n @batch_file.close\n cmd = File.join(Handle::HOME, 'bin', 'hdl-genericbatch')\n output = `#{cmd} #{@batch_file.path} 2>/dev/null`\n results = output.lines.select { |line| line =~ /^=+>/ }\n results.each do |rs|\n if message = ErrorParser.failure_message(rs)\n raise Handle::HandleError.new(message).tap { |exception|\n exception.set_backtrace(caller[3..-1])\n }\n end\n end\n return true\n end", "title": "" }, { "docid": "0d5b48c57a1541b97676112bf3859414", "score": "0.5678357", "text": "def process output_record\n raise NotImplementedError.new(\"Define the #{self.class}#process method to handle output records from the dataflow\")\n end", "title": "" }, { "docid": "f82b11b823765cd4319190a761333d6c", "score": "0.56783074", "text": "def process!\n return false if processed? || user.nil?\n generate_transaction if product?\n self.processed! # marked processed\n rescue ActiveRecord::RecordInvalid\n self.failed!\n raise # re-raise original exception\n end", "title": "" }, { "docid": "31d228f14e4ba8aa50ba976580c819a4", "score": "0.5673586", "text": "def perform\n\n r = validate\n return r unless r.success?\n\n fetch_records\n\n api_response\n\n end", "title": "" }, { "docid": "471f038a5f6e24723eae01a6f0c5f618", "score": "0.5668253", "text": "def set_record_batch\n @record_batch = RecordBatch.find(params[:id])\n end", "title": "" }, { "docid": "8f20da2b7f432713c258e7e68a42adbe", "score": "0.5663396", "text": "def batch_params\n\t\t\tparams[:batch].each { |key, value| value.strip! }\n\t\t\tparams.require(:batch).permit!\n\t\tend", "title": "" }, { "docid": "ea8c30d936d0055a52ebf85adb19153a", "score": "0.5654972", "text": "def batch_create\n if @loan_items = ObservationMatrixRowItem.batch_create(batch_params)\n render :index\n else\n render json: {success: false}\n end \n end", "title": "" }, { "docid": "2c146ace6f0bbdac0ebd63a59d10254c", "score": "0.5647409", "text": "def batch?\n !current_batch.nil?\n end", "title": "" }, { "docid": "3e134f38c67c7a07dce39728273fbef7", "score": "0.5644262", "text": "def process_topic_batch\n messages = retrieve_messages\n return false if messages.empty?\n\n batch_size = messages.size\n compacted_messages = compact_messages(messages)\n log_messages(compacted_messages)\n Deimos.instrument('db_producer.produce', topic: @current_topic, messages: compacted_messages) do\n begin\n produce_messages(compacted_messages.map(&:phobos_message))\n rescue Kafka::BufferOverflow, Kafka::MessageSizeTooLarge, Kafka::RecordListTooLarge => e\n delete_messages(messages)\n @logger.error('Message batch too large, deleting...')\n begin\n @logger.error(Deimos::KafkaMessage.decoded(messages))\n rescue StandardError => logging_exception # rubocop:disable Naming/RescuedExceptionsVariableName\n @logger.error(\"Large message details logging failure: #{logging_exception.message}\")\n ensure\n raise e\n end\n end\n end\n delete_messages(messages)\n Deimos.config.metrics&.increment(\n 'db_producer.process',\n tags: %W(topic:#{@current_topic}),\n by: messages.size\n )\n return false if batch_size < BATCH_SIZE\n\n KafkaTopicInfo.heartbeat(@current_topic, @id) # keep alive\n send_pending_metrics\n true\n end", "title": "" }, { "docid": "9b0a8c46cd21dbd092febab291aaab2d", "score": "0.56355006", "text": "def batch\n return nil\n \n if not self.batch_id\n nil\n else\n Batch.find(self.batch_id)\n end\n end", "title": "" }, { "docid": "079e15c8cde65b5ff5d9b10a54d72ce9", "score": "0.56320965", "text": "def assign_batch_to_queued_records!(records)\n records.each do |pepsq_record|\n pepsq_record.update!(batch_id: batch_id,\n status: Constants.PRIORITY_EP_SYNC.pre_processing,\n last_batched_at: Time.zone.now)\n end\n end", "title": "" }, { "docid": "6f9c8bc22c1d5952c752a48b66ab160e", "score": "0.56249064", "text": "def after_batch(&proc)\n Hooks.register_after_batch(proc)\n end", "title": "" }, { "docid": "ffa718878fc357b7aa12181bda511a9f", "score": "0.5622827", "text": "def batch_action\n action = params[:batch_process][:action]\n items = params[:batch_process][:items]\n\n authorize! \"batch_process_#{action}\".to_sym, resource_class\n\n if items\n if batch_process_map.key?(action.to_sym)\n # Store the batched item ids so they can be highlighted later\n flash[:highlight_ids] = items.keys\n\n # If the batch action returns false, it is because it has implemented\n # its own redirect. Therefore we return wihout redirecting.\n return unless self.send(\"batch_process_#{action}\", resource_class.find(items.keys))\n end\n end\n\n redirect_to :back\n end", "title": "" }, { "docid": "3606ba49996412d302d3cd2e7bb7bdc3", "score": "0.56192976", "text": "def each(&block)\n @batch.each(&block)\n end", "title": "" }, { "docid": "3606ba49996412d302d3cd2e7bb7bdc3", "score": "0.56192976", "text": "def each(&block)\n @batch.each(&block)\n end", "title": "" }, { "docid": "7caf4400bd24736f4459718cd8de02a5", "score": "0.5615372", "text": "def run_batches(&blk)\n all_relation.in_batches(of: batch_size, start: start, finish: finish) do |batch| # rubocop: disable Cop/InBatches\n range = batch.first.id..batch.last.id\n failures = run_batch_for(batch)\n\n yield(range, failures)\n end\n end", "title": "" }, { "docid": "d7e1905093b4e480f75e9d3b68e5e37a", "score": "0.56132334", "text": "def batch_params\n params.fetch(:batch, {})\n end", "title": "" }, { "docid": "5a849d067e5e7bbaaa24cc769aafcbb2", "score": "0.56062573", "text": "def flush_batch\n add_documents(batcher.end_current)\n end", "title": "" }, { "docid": "6a9de467e1ca434afa8c7dc5b380faf9", "score": "0.56052667", "text": "def batch_processors\n self.class.send :batch_processors\n end", "title": "" }, { "docid": "2db378243ea36d1ae0ff498ba4f37be9", "score": "0.5602118", "text": "def process_job_class(klass)\n batch_fact = klass.batch_factory_class.new\n batch_fact.each do |batch|\n process_job(klass.new(batch))\n end\n end", "title": "" }, { "docid": "7855391eaeac73f653d12e065f6eec3a", "score": "0.5599601", "text": "def next_batch\n return batch_one if @batch_one.nil?\n return if records_retrieved?\n\n retrieve_batch\n end", "title": "" }, { "docid": "6de1d4d6f6a657e8c6f674fe78fce768", "score": "0.5575217", "text": "def call(params)\n prepare params\n process\n\n successful_outcome\n rescue UseCase::Error => e\n failure_outcome e\n end", "title": "" }, { "docid": "244b4774a8ca6f538efa26dd034691ed", "score": "0.5575203", "text": "def perform_save(batch_client)\n if new_record?\n self.class.perform_create(client, batch_client, attributes)\n end\n end", "title": "" }, { "docid": "b79d3a2e0a86e80969cef48a44351416", "score": "0.5571733", "text": "def update\n \n \n @batch_execute_record = BatchExecuteRecord.find(params[:id])\n skipMassAssign :batch_execute_record\n if params[:batch_execute_record][:resource]\n params[:batch_execute_record].delete(:resource)\n end\n\n respond_to do |format|\n if @batch_execute_record.update_attributes(params[:batch_execute_record])\n format.html { redirect_to @batch_execute_record, :notice => 'Batch execute record was successfully updated.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @batch_execute_record.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @batch_execute_record.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5925179d48b0701bc4aa3b5f0ffcf10f", "score": "0.5564285", "text": "def batch_destroy\n @success_ids = []\n @failure_ids = []\n\n if (ids = params[:ids])\n ids.each do |id|\n begin\n if (deleted_record = self.class.batch_opts[:model].destroy(id))\n @success_ids << deleted_record.id\n end\n rescue\n @failure_ids << id\n end\n end\n end\n\n render 'layouts/batch_actions/batch_destroy'\n end", "title": "" }, { "docid": "0a575fc5a54217faf1957ea9aa104324", "score": "0.5562292", "text": "def process(record)\n fail NotImplementedError\n end", "title": "" }, { "docid": "0a575fc5a54217faf1957ea9aa104324", "score": "0.5562292", "text": "def process(record)\n fail NotImplementedError\n end", "title": "" }, { "docid": "cd55d5766e95d0b9cac92272966154f3", "score": "0.5558661", "text": "def process(arel, direct_batch)\n direct_batch.count = arel.count unless @loader.class.name == 'External::XPDM::MissingImagesLoader'\n @batch = External::BatchLoader.execute_in_batch(direct_batch, @loader.transformer_class) do |engine|\n @loader.transform(engine, arel)\n end\n end", "title": "" }, { "docid": "af29ef19b4db211e231c5f495e7a6d2c", "score": "0.55571425", "text": "def commit\n begin\n responses = @service.batch_write @operations.map(&:write)\n parse_results responses\n rescue StandardError => e\n raise BulkCommitBatchError, e\n end\n end", "title": "" }, { "docid": "b0eedbd03dda10977b5a314e2bb98572", "score": "0.5549599", "text": "def batch(options = {})\n old_batch = get_batch\n new_batch = Batch.new(self, options)\n set_batch(new_batch)\n yield\n new_batch.apply\n ensure\n set_batch(old_batch)\n end", "title": "" }, { "docid": "e2331610d88e28542a747b820166651f", "score": "0.5542387", "text": "def process_batch\n unpacker.each do |cmd|\n if cmd[0] == \"run\"\n @cmd_list.each { |c| execute_cmd c }\n @cmd_list.clear\n else\n @cmd_list << cmd\n end\n msg = cmd.to_msgpack\n writer.write(msg)\n writer.flush\n end\n end", "title": "" }, { "docid": "2f24eb602bd06e574d24cd3c4ae0202c", "score": "0.55416954", "text": "def polygonbatch\n\t\tif params.size > 2 then # set up batch process\n\t\t\t@batch = AccessorsPolygonbatch.new\n\t\t\t@batch.host = request.host\n\t\t\tValidate.polygonbatch(params, request, @batch)\n\t\t\tPolygonbatch.get_poly_ids(@batch) if @batch.errors == []\n\t\t\tif @batch.errors == [] then\n\t\t\t\tif @responseForm == \"ResponseDocument\" or @batch.polygonsHash.keys.size > 30 then #add to the batch queue\n\t\t\t\t\tPolygonbatch.queue(@batch)\n\t\t\t\t\trender :file => @batch.statusFilename, :content_type => \"text/xml\", :layout => false \n\t\t\t\telse # run immediately\n\t\t\t\t\tPolygonbatch.calc_ratings(@batch)\n\t\t\t\t\trender\"polygonbatch_small\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trender \"polygonbatch_error\"\n\t\t\tend\n\t\telse # display usage instructions\n\t\t\t@processHash = YAML.load_file(\"#{Rails.root.to_s}/config/services/wps/processes/lsrs.yml\")\n\t\t\t@lang=\"en\"\n\t\t\trender \"polygonbatch_DescribeProcess_response\"\n\t\tend\n\tend", "title": "" }, { "docid": "9571b6753e367960b72e77dddf063517", "score": "0.55351186", "text": "def convert_batch_params( params )\n return unless params\n if params[:batch]\n batch_sets = []\n params[:batch].each do |set|\n batch_sets << Zappos::Request.encode_params( set )\n end\n params[:batch] = batch_sets\n end\n end", "title": "" }, { "docid": "5193ff9297795dc59fcf6d3f6a7a01e8", "score": "0.5534503", "text": "def run_batches(&blk)\n relation.in_batches(of: batch_size, start: start, finish: finish) do |relation| # rubocop: disable Cop/InBatches\n range = relation.first.id..relation.last.id\n failures = run_batch(relation)\n\n yield(range, failures)\n end\n end", "title": "" }, { "docid": "1c1cb41e7c751d82b9607facea7a9a95", "score": "0.55290526", "text": "def process_marked_records!(&block)\n raise 'already set has_processed_unmarked_records' unless @has_processed_unmarked_records\n\n log('process_marked_records! starting...')\n block.call(@marked_ids)\n log('process_marked_records! done.')\n @marked_ids.size\n end", "title": "" }, { "docid": "d55e9f315c00e34a5907a487decc6cb7", "score": "0.5524317", "text": "def create\n @batch = Batch.new(params[:batch])\n\n respond_to do |format|\n if @batch.save\n @batch.delay.process\n format.html { redirect_to '/', notice: 'Batch was successfully created and has been scheduled for processing.' }\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
368d73cd2ee38534538b773f65dcc6e1
GET /admin/students GET /admin/students.json
[ { "docid": "aa5edec61ad83543d474c2f4e449b1f5", "score": "0.68222296", "text": "def index\n @students = Student.order(:stu_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @students }\n end\n end", "title": "" } ]
[ { "docid": "808860a584dc3bc32b26760cee06ae56", "score": "0.77352077", "text": "def students\n if usernames\n data = {}\n usernames.each {|u| data[u.username] = u.students}\n render json: data and return\n elsif current_user\n render json: {status: \"success\", response: current_user.students} and return\n else\n render json: {status: StatusCode::FAILURE, reason: \"no data provided\"}\n end\n end", "title": "" }, { "docid": "b1cb9620bdaa2d999de9616349e9564d", "score": "0.76621145", "text": "def index\n @students = Student.all\n json_response({success: true, data: @students}, :ok)\n end", "title": "" }, { "docid": "5afa8751df7b881b2d90d8b09dcc5ddd", "score": "0.7609694", "text": "def get_student(parameters)\n json_post('students/api.json', parameters)\n end", "title": "" }, { "docid": "fdd1a2404285c2b12cebc23ca64b6f7b", "score": "0.758879", "text": "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "title": "" }, { "docid": "b8ef111e01d7e2aed0204ee3af28cc4a", "score": "0.75726426", "text": "def view_students\n requires({'role'=>'admin'})\n @students = User.find_all_by_role_and_deleted_at(:student, nil)\n end", "title": "" }, { "docid": "efb8686e40c6214c3abd9d050a0469d4", "score": "0.745296", "text": "def index\n @admin_students = Student.all\n end", "title": "" }, { "docid": "922db7f563586831d2c74b9ddffa8606", "score": "0.7443618", "text": "def index\n @students = Student.all\n render json: @students #status:\n end", "title": "" }, { "docid": "4098363713e363765b9aa3e4e4d81aa2", "score": "0.73905665", "text": "def getAllStudents\n\t\t@allStudents = @tutorial.users.where(:role => 0)\n\t\trender json: @allStudents\n\tend", "title": "" }, { "docid": "9d3b628b2bd8ff76b888a1feea764ee6", "score": "0.73718476", "text": "def students\n @teacher = Teacher.find(params[:teacher_id])\n @students = Student.find_all_by_teacher_id(params[:teacher_id])\n\n respond_to do |format|\n format.html # students.html.erb\n format.json { render json: @students }\n end\n end", "title": "" }, { "docid": "638d2841b6b11e54557b24f1bfa9ce33", "score": "0.7309192", "text": "def index\n @students = Student.all\n render json: {students: @students}\n end", "title": "" }, { "docid": "529859f56ed6e702befe3ad049815e83", "score": "0.7279165", "text": "def show\n @student = @organisation.students.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "d0c968a9343e0637fda145f8a376cf5b", "score": "0.72335035", "text": "def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "title": "" }, { "docid": "d0c968a9343e0637fda145f8a376cf5b", "score": "0.72335035", "text": "def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "title": "" }, { "docid": "5bf4e8949f38afe1b66fa156e54bc6a2", "score": "0.7128273", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "58521d5e25f0028599b320cc36da84f2", "score": "0.7107469", "text": "def index\n @student = get_student\n end", "title": "" }, { "docid": "9d2a9a518e734396ba8e3ede986df061", "score": "0.70914596", "text": "def get_group_students\n @course = Course.find(params[:course_id])\n @group = Group.find(params[:group_id])\n render json: @group.students\n end", "title": "" }, { "docid": "d88882d75961a256203cd96ed819fa24", "score": "0.70680374", "text": "def show\n render json: student\n end", "title": "" }, { "docid": "2e7c6c776002f58fe16e70ccf4c107cd", "score": "0.70621675", "text": "def getCourseStudents\n @course_of_study = CourseOfStudy.find(params[:course_of_study_id])\n @course = Course.find(params[:course_id])\n @students = @course.students\n render json: @students\n end", "title": "" }, { "docid": "162cb4908bdea7866a81118bc45e8788", "score": "0.7054385", "text": "def list_students\n if current_user.is_admin?\n @course = Course.find(params[:id])\n else\n @course = current_user.courses.find(params[:id])\n end\n @users = @course.users\n @students = Array.new\n @users.each do |x|\n if !x.is_teacher?\n @students << x\n end\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "title": "" }, { "docid": "0f8fb57b1f94ca26b0f1ea9ffb691a4b", "score": "0.7038773", "text": "def students\n @students\n end", "title": "" }, { "docid": "ab17a1a089032eab834cbcaee3cfc934", "score": "0.7033904", "text": "def students\n @students\nend", "title": "" }, { "docid": "ab17a1a089032eab834cbcaee3cfc934", "score": "0.7033904", "text": "def students\n @students\nend", "title": "" }, { "docid": "ab17a1a089032eab834cbcaee3cfc934", "score": "0.7033904", "text": "def students\n @students\nend", "title": "" }, { "docid": "27b5141b179420eebf384f2e03730a81", "score": "0.7005535", "text": "def show\n render json: {student: @student}\n end", "title": "" }, { "docid": "3bbd95bfe4a9423d3ecdee807d5dd9e5", "score": "0.69981176", "text": "def get_students(opts = {})\n data, _status_code, _headers = get_students_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "b6895bfe4f9bf7c3d9c5f31311f71df6", "score": "0.6995237", "text": "def index\n @students = Student.all\n setStatus\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @students }\n end\n end", "title": "" }, { "docid": "410fcc6ef0bc0c470240854edd92edff", "score": "0.697906", "text": "def index\n @students = Student.all\n #respond_to do |format|\n # format.json { render json: @students, status: :ok }\n #end\n #render json: @students, status: :ok\n respond_with @students\n end", "title": "" }, { "docid": "d4c3ff4a5cefc1c7dc1e3af5c3afff21", "score": "0.6976603", "text": "def index\n @students = @group.students\n end", "title": "" }, { "docid": "b0937c54b55fab9c58b0e2b29ccab558", "score": "0.69746083", "text": "def good_students\n @students = Student.good_students\n respond_to do |format|\n format.json { render :json => @students }\n end\n end", "title": "" }, { "docid": "b8b98c4d21b0dc4b934f2a2961ba188a", "score": "0.69602543", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render :json => @student}\n end\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "305ddfd64a072e92b3f5555898c7800a", "score": "0.69585246", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "a9663f08b012f7e564b67f6c5a4d64fb", "score": "0.695831", "text": "def index\n # schüler wurden nach aufsteigendem nachnamen gespeichert\n @students = Student.order :id\n respond_to do |format|\n format.html\n # json ausgabe für die speicherung in einer text datei, sodass man die schüler bei db-absturz aus der json einlesen kann\n format.json { render json: JSON.pretty_generate(JSON.parse(Student.all.to_json(except: [:id, :created_at, :updated_at]))) }\n end\n end", "title": "" }, { "docid": "a40c9df9c9bd42179d0bde348e34cda5", "score": "0.69509053", "text": "def index\n @students = Student.all # create instance variable to present all students\n end", "title": "" }, { "docid": "7e08026b650e3a2fbce25bdce75ec5f8", "score": "0.6950243", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "7e08026b650e3a2fbce25bdce75ec5f8", "score": "0.6950243", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "7e5ffd1608699c8bae53d86377be5ee1", "score": "0.6945084", "text": "def users_students course_id\n call_path = \"users/students\"\n request = {\"courseID\": course_id}\n data = build_post_data(request.to_json)\n perform_post(build_url(call_path), data)\n end", "title": "" }, { "docid": "d42db1d8aa6fff6eee0ec87eca591591", "score": "0.6936677", "text": "def index\n\t\t@students = Student.all\n\tend", "title": "" }, { "docid": "9e4df151b2d0836339bb70ba964dd658", "score": "0.6932635", "text": "def index\n # this page should only be accesible by admins.\n # Other students should not be able to see a entire list of students\n @students = Student.all\n end", "title": "" }, { "docid": "eca51334995f1f0ed7a9f12f32da7bca", "score": "0.6931033", "text": "def show_students\n self.students\n end", "title": "" }, { "docid": "c7f7229c29a6868fd39922544a624f27", "score": "0.6903843", "text": "def show\n @student = @group.users.find(params[:id])\n\n authorize! :read, @student\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "ef813b5be43bf82c83ca26f170bb9d07", "score": "0.6900448", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "ef813b5be43bf82c83ca26f170bb9d07", "score": "0.6900448", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "ef813b5be43bf82c83ca26f170bb9d07", "score": "0.6900448", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "ef813b5be43bf82c83ca26f170bb9d07", "score": "0.6900448", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "ef813b5be43bf82c83ca26f170bb9d07", "score": "0.6900448", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "ef813b5be43bf82c83ca26f170bb9d07", "score": "0.6900448", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "ef813b5be43bf82c83ca26f170bb9d07", "score": "0.6900448", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "1af55a4dbac79824579de2b81b0bf0ee", "score": "0.6897407", "text": "def index\n get_current_user\n if @current_user.isAdmin\n @students = Student.all\n elsif @current_user.isTeacher\n teacher = Teacher.where(\"user_id = ?\", @current_user.id)\n @students = teacher.students\n elsif @current_user.isStudent\n @students = Student.where(\"user_id = ?\", @current_user.id)\n end\n @students.each{ |student| student.retrieve_virtual_attributes} unless @students.nil?\n respond_to do |format|\n format.json { render json: @students }\n end\n end", "title": "" }, { "docid": "dfdd1232bb6d86acad307471a580ff6d", "score": "0.68951994", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "49101526bcc3e4fda21eef708fb80c9c", "score": "0.68776906", "text": "def show\n @student_list = StudentList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_list }\n end\n end", "title": "" }, { "docid": "94d48299d18aeefcb3a9c4bd481035da", "score": "0.68688077", "text": "def index\n \n @studm = Student.all\n authorize! :index, @studm\n \n end", "title": "" }, { "docid": "2631fed5efab2469ce0c04c2f2674884", "score": "0.68663055", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "2631fed5efab2469ce0c04c2f2674884", "score": "0.68663055", "text": "def index\n @students = Student.all\n end", "title": "" }, { "docid": "429ed19eacd1f6067940e19c9f19a6c8", "score": "0.6853753", "text": "def show\n if @student.empty?()\n json_response({success: false, message: Message.not_found('Student record')}, :unprocessable_entity)\n else\n json_response({success: true, data: @student[0]}, :ok)\n end\n end", "title": "" }, { "docid": "16b9a5589e50a0cc2b3b65dde0822f2e", "score": "0.68496424", "text": "def index\n if current_user.admin?\n @studentcourses = Studentcourse.all\n render json: @studentcourses\n else\n @studentcourses= Studentcourse.where(\"user_id = ?\", current_user)\n render json: @studentcourses\n end\n end", "title": "" }, { "docid": "0c7413a1476988547b8c7398ea4dcfe7", "score": "0.6845167", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "0c7413a1476988547b8c7398ea4dcfe7", "score": "0.6845167", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "0c7413a1476988547b8c7398ea4dcfe7", "score": "0.6845167", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "0c7413a1476988547b8c7398ea4dcfe7", "score": "0.6845167", "text": "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "cccce602d768317fce66789acc5b05be", "score": "0.6832415", "text": "def index\n @students = get_collections\nend", "title": "" }, { "docid": "c0e51b370a39a9dfbdd5bdc1c07f58a0", "score": "0.6822823", "text": "def index \n @students = Student.all\n end", "title": "" }, { "docid": "102c6845a376b33db654ab22392ba1c0", "score": "0.68217963", "text": "def index\n @students = Student.all\nend", "title": "" }, { "docid": "55ec3794ff80621965a7da0203fd0e55", "score": "0.68165773", "text": "def index\n @students = Student.all\n\n respond_to do |format|\n format.json\n format.js\n format.html\n end\n end", "title": "" }, { "docid": "02cd35f8ecd3ae9838826d46a7298b95", "score": "0.68154293", "text": "def index\n @students_infos = StudentsInfo.all # 获取所以学生信息内容\n end", "title": "" }, { "docid": "025993d6a51fa5fc5f031a6f4857148b", "score": "0.68144757", "text": "def show\n student = Student.find(params[:id])\n render json: {status: 'SUCCESS', message:'Loaded student', data:student},status: :ok\n end", "title": "" } ]
a56685175024d2cb1bca3a78081483c7
GET /image_uploads/1 GET /image_uploads/1.xml
[ { "docid": "818a7895d47981495e28db0dc7927059", "score": "0.66249806", "text": "def show\n @image_upload = ImageUpload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_upload }\n end\n end", "title": "" } ]
[ { "docid": "6ae970456f0561628b443df6e12d6b1a", "score": "0.66202277", "text": "def index\n @images = Image.find_images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "29ada3d32df43225ca8e222fe5066a63", "score": "0.65073246", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @flat_images }\n end\n end", "title": "" }, { "docid": "495049618b13c60a5c170c102f002c37", "score": "0.65062237", "text": "def full_upload_get_api_paths\n @id = params[:id]\n respond_to do |format|\n format.xml \n end\n\n end", "title": "" }, { "docid": "c4cfbe91db3c1466ef46e49a40daed78", "score": "0.6502773", "text": "def index\r\n @uploads = Upload.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @uploads }\r\n end\r\n end", "title": "" }, { "docid": "8891e1f691e4d8c014a6504e4cd25159", "score": "0.6484307", "text": "def index\n @images = @site.images.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "06bd6a763f09e9167501bb005cd03406", "score": "0.64119476", "text": "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "06bd6a763f09e9167501bb005cd03406", "score": "0.64119476", "text": "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "06bd6a763f09e9167501bb005cd03406", "score": "0.64119476", "text": "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "06bd6a763f09e9167501bb005cd03406", "score": "0.64119476", "text": "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "cffa98e826607b616c9f13ae43816ffd", "score": "0.6361232", "text": "def index\n\n @images = @post.images.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "5d88c9da2c1583e11a311869aa4cb617", "score": "0.635122", "text": "def index\n @uploads = Upload.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uploads }\n format.json { render :json => @uploads }\n end\n end", "title": "" }, { "docid": "d025213e83e4bce8025c738ce734ac17", "score": "0.63388246", "text": "def upload id\n get_request \"uploads/#{id}\"\n end", "title": "" }, { "docid": "0d3af6b538275fd93a5da0dccd003808", "score": "0.63019854", "text": "def show\n respond_to do |format|\n format.html { render :action => :index }\n format.xml { @image_set = ImageSet.find(params[:id]); render :xml => @image_set }\n end\n end", "title": "" }, { "docid": "9db487a6d1eb999362fdc33feb3dc28d", "score": "0.6274678", "text": "def index\n get_current_date\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uploads }\n end\n end", "title": "" }, { "docid": "282574bf9c65e3f88de721d51c8eb657", "score": "0.6273658", "text": "def index\n @uploaded_files = UploadedFile.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uploaded_files }\n end\n end", "title": "" }, { "docid": "f16b39ecdab8a7dfcd6421c61924fe40", "score": "0.6255722", "text": "def show\n @image = @site.images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "0fba12218d08aa2f4ee42bb67c06e2d4", "score": "0.6251116", "text": "def index\n @uploads = @uploadable.nil? ? Upload.paginate(:page => params[:page]) : @uploadable.uploads.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uploads }\n end\n end", "title": "" }, { "docid": "69ba9fdf69cfbe1b9623a8a15bb44ea8", "score": "0.6210656", "text": "def images\n @heading = \"Popular Images\"\n @stories = Story.find_all_by_media(\"image\")\n\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.xml { render :xml => @stories }\n end\n end", "title": "" }, { "docid": "62c41299f3dd7071176edde163ba7818", "score": "0.6203689", "text": "def list_floor_plans \n get(\"/files.json/floorplan/images\")\nend", "title": "" }, { "docid": "caeb48812ba3b15bce749e20ef0cd9f6", "score": "0.618501", "text": "def index\n @imagems = Imagem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @imagems }\n end\n end", "title": "" }, { "docid": "1566709668ebf4d5dabd86690fd250d6", "score": "0.617356", "text": "def show\n @images = @post.images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "5355bc97594c5ac9add55f23caeb29bd", "score": "0.6152093", "text": "def index\n @images = Image.paginate :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "b1a005d476068c315d9654a2db28a425", "score": "0.6145726", "text": "def show\n @image = current_account.images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "b48b56172d94b39a5fb0e0e7b5d299e8", "score": "0.61390674", "text": "def show\n @counter_images_set = CounterImagesSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @counter_images_set }\n end\n end", "title": "" }, { "docid": "5e305d9a1b5c09eb9944530978ad0b4e", "score": "0.61246353", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3747e24a47b9b3ae9593b31682af3f28", "score": "0.6109849", "text": "def show\n @image = Image.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @image.to_xml }\n end\n end", "title": "" }, { "docid": "b4f6852925b6d2a7733787a6bd7270cf", "score": "0.60954434", "text": "def show\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @image.to_xml }\n end\n end", "title": "" }, { "docid": "b0f2cb6ce352ca72d6eb9468995a9ae4", "score": "0.6078269", "text": "def peek_uploads(base, cookie)\r\n\t\tres = send_request_raw({\r\n\t\t\t'method' => 'GET',\r\n\t\t\t'uri' => \"#{base}mods/documents/uploads/\",\r\n\t\t\t'cookie' => cookie\r\n\t\t})\r\n\r\n\t\treturn res\r\n\tend", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "3e585565797ad01822603333971cf243", "score": "0.60775864", "text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "1802c1a0b909fca5b191c7d0b011810c", "score": "0.60725003", "text": "def index\n @photos = Photo.find_all_by_status(1)\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @photos }\n format.png\n end\n end", "title": "" }, { "docid": "3902600aea4c2a1763cf78c03e2ccd07", "score": "0.60693103", "text": "def index\n @imagens = Imagen.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @imagens }\n end\n end", "title": "" }, { "docid": "b98e66869cf5270df101e35b31c34049", "score": "0.60547674", "text": "def show\n @picture = Image.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @picture }\n end\n end", "title": "" }, { "docid": "8214e05a2cf82ed2306026b2ece404be", "score": "0.6052405", "text": "def show\n @upload = Upload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @upload }\n end\n end", "title": "" }, { "docid": "8214e05a2cf82ed2306026b2ece404be", "score": "0.6052405", "text": "def show\n @upload = Upload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @upload }\n end\n end", "title": "" }, { "docid": "c436c432f048dff63ef8c6c31d11ad4c", "score": "0.60497844", "text": "def index\n @gallery_images = GalleryImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @gallery_images }\n end\n end", "title": "" }, { "docid": "ae2fefc013872fbd6c55b6f483245fcb", "score": "0.60431206", "text": "def index\n @embedded_pictures = EmbeddedPicture.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @embedded_pictures }\n end\n end", "title": "" }, { "docid": "52eccc0fb66088e9e4c8f3f700060b16", "score": "0.6040698", "text": "def show\n @uploaded_file = UploadedFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @uploaded_file }\n end\n end", "title": "" }, { "docid": "2e340d3681e26c6be5969ad008434ff0", "score": "0.60203296", "text": "def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pictures.collect { |p| p.to_jq_upload }.to_json }\n format.xml { render :xml => @pictures.collect { |p| p.to_jq_upload }.to_xml }\n end\n end", "title": "" }, { "docid": "a64ae8a8ef41c27e85544f464986978e", "score": "0.6015544", "text": "def show\n @uploadedfile = Uploadedfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @uploadedfile }\n end\n end", "title": "" }, { "docid": "4e1920a7972f2c512530be9b3d8b05e6", "score": "0.60043293", "text": "def index\n @image_tests = ImageTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_tests }\n end\n end", "title": "" }, { "docid": "95aa6d5323051fa009b271539bab146f", "score": "0.59636647", "text": "def new\n @image_upload = ImageUpload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_upload }\n end\n end", "title": "" }, { "docid": "95aa6d5323051fa009b271539bab146f", "score": "0.59636647", "text": "def new\n @image_upload = ImageUpload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_upload }\n end\n end", "title": "" }, { "docid": "1ef52e3eb174176e4c45439340c5feaf", "score": "0.59427017", "text": "def index\n @uploads = Upload.paginate :page => params[:page], :per_page => 25, :order => 'comid DESC'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uploads }\n end\n end", "title": "" }, { "docid": "fd466f7a6185aee5cb0e0c623edf6889", "score": "0.5940951", "text": "def show\r\n @upload = Upload.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @upload }\r\n end\r\n end", "title": "" }, { "docid": "ebc4c5eeb7c886c8052c658d9e10cccf", "score": "0.59319115", "text": "def index\n @fotos = Foto.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fotos }\n end\n end", "title": "" }, { "docid": "4ed8b0d788c24261ae2d317c3034887f", "score": "0.5930049", "text": "def show_images\n doc = document\n index=1\n doc.images.each do |l|\n puts \"image: name: #{l.name}\"\n puts \" id: #{l.invoke(\"id\")}\"\n puts \" src: #{l.src}\"\n puts \" index: #{index}\"\n index+=1\n end\n end", "title": "" }, { "docid": "0160fb463f3008a94daba0ef053c3d36", "score": "0.5924879", "text": "def get_image(op_num)\n data = show do\n title \"Upload the imaging file for this well\"\n upload var: :my_uploads\n end\n return data[:my_uploads]\n end", "title": "" }, { "docid": "b14e586e34b6466854f77fe5a9f1581e", "score": "0.5918897", "text": "def index\n @shared_images = SharedImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shared_images }\n end\n end", "title": "" }, { "docid": "988e7d288ed5280c6c9356ab7e33d9fe", "score": "0.59165066", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @flat_image }\n end\n end", "title": "" }, { "docid": "ca2540fcad13e4d025eb7887ea051b92", "score": "0.59146446", "text": "def show_images\n doc = document\n index = 1\n doc.images.each do |l|\n puts \"image: name: #{l.name}\"\n puts \" id: #{l.invoke(\"id\")}\"\n puts \" src: #{l.src}\"\n puts \" index: #{index}\"\n index += 1\n end\n end", "title": "" }, { "docid": "3ea0503074926ab0c5f1c3e7d8a24a78", "score": "0.5898434", "text": "def index\n @picture_galleries = PictureGallery.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @picture_galleries.to_xml }\n end\n end", "title": "" }, { "docid": "5adc41d688929cc5b2fc63bf2ca29d4a", "score": "0.5895566", "text": "def show\n #debugger\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @image.to_xml }\n end\n end", "title": "" }, { "docid": "a190b7be19ceb310ecfddc91cbd991d1", "score": "0.5890508", "text": "def show\n @batch_image = BatchImage.find(params[:id])\n @title = \"Batch upload of microarray images\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @batch_image }\n end\n end", "title": "" }, { "docid": "fbb15a8743a75f27d4ab3fb86aa97736", "score": "0.5883309", "text": "def index\n @user = current_user\n @uploads = current_user.uploads\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uploads }\n end\n end", "title": "" }, { "docid": "0029caa05984a52c909f9a28d2952266", "score": "0.5882499", "text": "def new\n @upload = current_user.uploads.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @upload }\n end\n end", "title": "" }, { "docid": "4630ae69308b374c0abf685f1cbcbfd2", "score": "0.5864555", "text": "def index\n @attachedfiles = @attachment.attachedfiles.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @attachedfiles.to_xml }\n end\n end", "title": "" }, { "docid": "c17a3b5e603caacf0039cc05314a814d", "score": "0.58639514", "text": "def show\n @image_test = ImageTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_test }\n end\n end", "title": "" }, { "docid": "5bd84be1063c600fc684d02b1d1d8588", "score": "0.5859597", "text": "def show\n @upload = Upload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @upload }\n end\n end", "title": "" }, { "docid": "4548d4f1b001842aa2a1f241aaa668bc", "score": "0.58559614", "text": "def show\n @gallery_image = GalleryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gallery_image }\n end\n end", "title": "" }, { "docid": "4548d4f1b001842aa2a1f241aaa668bc", "score": "0.58559614", "text": "def show\n @gallery_image = GalleryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gallery_image }\n end\n end", "title": "" }, { "docid": "e4f9dd891543494c62c450c9b33e4915", "score": "0.58489203", "text": "def index\n @pictures = Picture.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pictures }\n end\n end", "title": "" }, { "docid": "8b5e3c6afd970fbcdbe653d1e2643f8b", "score": "0.58338964", "text": "def index\n @images = Image.parents.paginate(:page => params[:page])\n @reorder_url = reorder_images_url\n flash[:notice] = \"Images found (#{@images.size}).\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "265937347592500676c55d16f54eed27", "score": "0.58306015", "text": "def get_images()\n\t\t\tget_document(@tag_type[1])\n\t\tend", "title": "" }, { "docid": "4ed70082b013ba0655d582a80f474a5b", "score": "0.58282024", "text": "def show\n @upload = Upload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @upload }\n format.json { render :json => @upload }\n end\n end", "title": "" }, { "docid": "eeda8adf0fa71ef4b1d2dc7e58a8936c", "score": "0.5818136", "text": "def index\n @photos = Photo.fullsize_images(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.atom # index.atom.builder\n format.xml { render :xml => @photos }\n end\n end", "title": "" }, { "docid": "dad41cc923a2376c916c8a37c28236cd", "score": "0.5817016", "text": "def index\r\n @page_images = PageImage.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @page_images }\r\n end\r\n end", "title": "" }, { "docid": "c1a22380ec6673c4ed8349f8de39038b", "score": "0.5816812", "text": "def index\n @photos = Photo.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "title": "" }, { "docid": "214a775e760af4b5dae3c2cf16419d5c", "score": "0.58163667", "text": "def index\n @photos = Photo.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @photos.to_xml }\n end\n end", "title": "" }, { "docid": "83eeb31271988afd60178f126a3bc4cd", "score": "0.58147895", "text": "def show\n @imageupload = Imageupload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imageupload }\n end\n end", "title": "" }, { "docid": "dd237774e1f7d4f99e503d234c3b022a", "score": "0.58117104", "text": "def index\n @image_sets = ImageSet.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @image_sets.inject({}) { |image_sets, (k,v)| image_sets[k.to_s] = v; image_sets } }\n end\n end", "title": "" }, { "docid": "98a74f4269211d581098d18c3025fadf", "score": "0.581156", "text": "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "title": "" }, { "docid": "98a74f4269211d581098d18c3025fadf", "score": "0.581156", "text": "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "title": "" }, { "docid": "98a74f4269211d581098d18c3025fadf", "score": "0.581156", "text": "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "title": "" }, { "docid": "98a74f4269211d581098d18c3025fadf", "score": "0.581156", "text": "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "title": "" }, { "docid": "f5b2d2b1230ee0b0d7de82190d564164", "score": "0.58080274", "text": "def show\n @scrap_photo = ScrapPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scrap_photo }\n end\n end", "title": "" }, { "docid": "a830ab57c6055538be9c6c825680b7c1", "score": "0.5807391", "text": "def list params = {}\n @connection.get(build_path(\"/images/json\", params)) \n end", "title": "" }, { "docid": "25d35a41027c573b0bed813688d765fa", "score": "0.58059293", "text": "def show\n @fileupload = Fileupload.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fileupload }\n end\n end", "title": "" }, { "docid": "eaf17d8753a562db16fac1fba7fb2d67", "score": "0.5803168", "text": "def index\n @image_files = ImageFile.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_files }\n end\n end", "title": "" }, { "docid": "ed8eece10f2467d067e1005434142158", "score": "0.57962346", "text": "def index\n @albums = Album.all\n if params[:album]\n @images = Album.find(params[:album]).images\n else\n @images = Image.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "506a582bbad21025f265b5f06379dbe5", "score": "0.5796058", "text": "def index\n @file_lists = UploadedFileList.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @file_lists }\n end\n end", "title": "" }, { "docid": "45d2be1ebc8e52ff4344fb59261c8be0", "score": "0.57943106", "text": "def show\n @image = Image.find_by_slug(params[:id])\n @images = image_range(@image)\n\n @image.viewed!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "title": "" }, { "docid": "975cadb257d72b0b98f433fe9f0e9305", "score": "0.5793213", "text": "def index\n @image_files = ImageFile.all\n end", "title": "" }, { "docid": "ff16c9857fe83e600d81404040360623", "score": "0.57916486", "text": "def show\n respond_with(params[:id]) do |format|\n format.any {\n send_a_file(\"/images/#{params[:id]}.jpg\")\n }\n end\n end", "title": "" }, { "docid": "636de81c0b0e4621cd9cda328735873e", "score": "0.57873595", "text": "def show\n @listing_image = ListingImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listing_image }\n end\n end", "title": "" }, { "docid": "334f08371cfeb0333a2a1d32452e1b98", "score": "0.5781358", "text": "def show\n @photos = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @photos }\n end\n end", "title": "" }, { "docid": "4095dadf1c307876d2e4140ad26e8c35", "score": "0.57775086", "text": "def index\n @images = @current_account.images.all\n respond_with @images\n end", "title": "" }, { "docid": "540603dec8b622e6df145dd2fd6c3d5c", "score": "0.5774143", "text": "def index\n @imagefiles = Imagefile.all\n end", "title": "" }, { "docid": "8ba267a7412f67d61de50150f0b6ea8c", "score": "0.5772195", "text": "def show\n @masterimage = Masterimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @masterimage }\n end\n end", "title": "" }, { "docid": "d64cfdb32496b4e20a77201750a5838b", "score": "0.57681966", "text": "def index\n @image_types = ImageType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_types }\n end\n end", "title": "" }, { "docid": "f0d59a689097613736bc4adc838a075b", "score": "0.5755484", "text": "def index\n @flickr_photos = FlickrPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @flickr_photos }\n end\n end", "title": "" }, { "docid": "e9971adee2c2bd927be0b187fd783ad9", "score": "0.5754164", "text": "def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imagem }\n end\n end", "title": "" } ]
14eb4931bc6a46e20afaa44b6ebe4c82
Locates the `permissions` service.
[ { "docid": "5a4a731ce263e347758ca5bc39332c34", "score": "0.7822945", "text": "def permissions_service\n @permissions_service ||= SystemPermissionsService.new(self, 'permissions')\n end", "title": "" } ]
[ { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75750613", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "a5d275ea3771f90bc01b2cd79d1e0e71", "score": "0.6835834", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a5d275ea3771f90bc01b2cd79d1e0e71", "score": "0.6835185", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a5d275ea3771f90bc01b2cd79d1e0e71", "score": "0.6835185", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a5d275ea3771f90bc01b2cd79d1e0e71", "score": "0.6835185", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a5d275ea3771f90bc01b2cd79d1e0e71", "score": "0.6835185", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a5d275ea3771f90bc01b2cd79d1e0e71", "score": "0.6835185", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "cadace0a06439a105f1b49696029dd5e", "score": "0.64090306", "text": "def permission_service(id)\n PermissionService.new(self, id)\n end", "title": "" }, { "docid": "cadace0a06439a105f1b49696029dd5e", "score": "0.64090306", "text": "def permission_service(id)\n PermissionService.new(self, id)\n end", "title": "" }, { "docid": "7812267a29576fb8f94eded6827fa08f", "score": "0.6300119", "text": "def permissions(opts = {})\n find_collection(\"permissions\", opts)\n end", "title": "" }, { "docid": "c9b694e53bdae6041fa4be8e1a016f3f", "score": "0.60214835", "text": "def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_instance_permissions path, permissions\n grpc.permissions\n end", "title": "" }, { "docid": "6eafb1fe237520aee9a02765f45c4af9", "score": "0.6017575", "text": "def test_permissions *permissions\n permissions = Array(permissions).flatten\n ensure_service!\n gapi = service.test_permissions project_id, permissions\n gapi.permissions\n end", "title": "" }, { "docid": "82c5e8ecd99d6dab22c3f77718239383", "score": "0.594536", "text": "def permissions\n api.get(:permissions)\n end", "title": "" }, { "docid": "e3ff2990a8d922432d35824062cef139", "score": "0.5896578", "text": "def add_permissions(permissions, options = {})\n permissions = Array(permissions)\n search = options.delete(:search)\n\n collection = Permission.where(:name => permissions).all\n raise ArgumentError, 'some permissions were not found' if collection.size != permissions.size\n\n collection.group_by(&:resource_type).each do |resource_type, grouped_permissions|\n filter = self.filters.build(:search => search)\n filter.role ||= self\n\n grouped_permissions.each do |permission|\n filtering = filter.filterings.build\n filtering.filter = filter\n filtering.permission = permission\n end\n end\n end", "title": "" }, { "docid": "2aa8cce4dabfd56be23746ca68e1b25d", "score": "0.58940977", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'quotaclusterlimits'\n return quota_cluster_limits_service\n end\n if path.start_with?('quotaclusterlimits/')\n return quota_cluster_limits_service.service(path[19..-1])\n end\n if path == 'quotastoragelimits'\n return quota_storage_limits_service\n end\n if path.start_with?('quotastoragelimits/')\n return quota_storage_limits_service.service(path[19..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "e7fa55c996c89a154f6ff748543f9ee3", "score": "0.5819142", "text": "def define_permissions\n end", "title": "" }, { "docid": "de46ae4d3072fe60a3424d3fc69d56a7", "score": "0.58150953", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'roles'\n return roles_service\n end\n if path.start_with?('roles/')\n return roles_service.service(path[6..-1])\n end\n if path == 'tags'\n return tags_service\n end\n if path.start_with?('tags/')\n return tags_service.service(path[5..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a0c2c4ad1527f43890875fbfdb0c208c", "score": "0.5795596", "text": "def list_permissions(options={}) path = \"/api/v2/definitions/permissions\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "d6697a951d4704e749e64f4a07787ab7", "score": "0.57898426", "text": "def add_permissions!(service, resource, identities)\n permissions[service.to_s] ||= {}\n permissions[service.to_s][resource.to_s] ||= []\n permissions[service.to_s][resource.to_s].concat(identities)\n self\n end", "title": "" }, { "docid": "f04bea107dda66676cce40b765d9fd43", "score": "0.57866246", "text": "def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_backup_permissions instance_id, cluster_id, backup_id, permissions.flatten\n grpc.permissions.to_a\n end", "title": "" }, { "docid": "d494cdff39be5bfa8a1eb5788041efd4", "score": "0.5779811", "text": "def discovery_permissions\n @discovery_permissions ||= %w[edit read]\n end", "title": "" }, { "docid": "e8e44624200bade29c9d28ebedcce8ce", "score": "0.57678664", "text": "def permissions=(value)\n @permissions = value\n end", "title": "" }, { "docid": "e8e44624200bade29c9d28ebedcce8ce", "score": "0.57678664", "text": "def permissions=(value)\n @permissions = value\n end", "title": "" }, { "docid": "807cce442487b4bd94dad88ebe4fc4b2", "score": "0.5758808", "text": "def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_instance_permissions instance_id, permissions.flatten\n grpc.permissions.to_a\n end", "title": "" }, { "docid": "0fc5e224ceab972602052d21140a792c", "score": "0.574074", "text": "def test_permissions *permissions\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_subscription_permissions name, permissions\n grpc.permissions\n end", "title": "" }, { "docid": "6146be367767fc3ba3a294dbc369b0ef", "score": "0.57175434", "text": "def load_permissions\n authorize! :manage, :all\n end", "title": "" }, { "docid": "6146be367767fc3ba3a294dbc369b0ef", "score": "0.57175434", "text": "def load_permissions\n authorize! :manage, :all\n end", "title": "" }, { "docid": "6146be367767fc3ba3a294dbc369b0ef", "score": "0.57175434", "text": "def load_permissions\n authorize! :manage, :all\n end", "title": "" }, { "docid": "f5794cd4d573ce58763dff2c46afdaa2", "score": "0.5697773", "text": "def discovery_permissions\n @discovery_permissions ||= %w(discover read)\n end", "title": "" }, { "docid": "ff82a715c4ef2f3c0b392e097315e019", "score": "0.5679849", "text": "def discovery_permissions\n [\"edit\",\"discover\",\"read\"]\n end", "title": "" }, { "docid": "271b8af49739bdad8453a33c6e9eb5ef", "score": "0.56681234", "text": "def discovery_permissions\n @discovery_permissions ||= [\"edit\",\"discover\",\"read\"]\n end", "title": "" }, { "docid": "2c1ea088950ce1f97302e37077c2216f", "score": "0.56471497", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "2c1ea088950ce1f97302e37077c2216f", "score": "0.56471497", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "2c1ea088950ce1f97302e37077c2216f", "score": "0.56471497", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "650ca426b920fe5b2e4d65c5861a4658", "score": "0.5643349", "text": "def get_permissions_for(type,id,target = nil)\n self.class.get(\"#{@url}/api/filesystem/#{type}s/#{id}/permission/#{target}\", basic_auth: @auth)\n end", "title": "" }, { "docid": "0aeed1285d2f073b505015a1705d276b", "score": "0.562292", "text": "def permissions\n @permissions ||= @client.permissions if (@client and @client.current_user.id == id)\n end", "title": "" }, { "docid": "f564dfac255e827b5d87e0f5fb102038", "score": "0.5613978", "text": "def load_permissions\n @current_permissions = current_user.permissions_for_project(@project)\n end", "title": "" }, { "docid": "54833b2bbbfb9b389399e7e77c39d8cd", "score": "0.5544278", "text": "def permissions\n @permissions ||= Permisi.config.cache_store.fetch(\"#{cache_key}-p\") { aggregate_permissions }\n end", "title": "" }, { "docid": "cdc11dd84e34297d5a5e1237eb7dce51", "score": "0.5517125", "text": "def member_permission_service_ids\n return nil if admin? || !services_member_permission\n permitted_service_ids = services_member_permission.try(:service_ids) || []\n permitted_service_ids & existing_service_ids\n end", "title": "" }, { "docid": "77e82402739d854a49967918cacdaf8b", "score": "0.55067164", "text": "def permissions\n response = request(:get, '/permissions.json')\n response.collect { |perm| perm['permission'] }\n end", "title": "" }, { "docid": "77e82402739d854a49967918cacdaf8b", "score": "0.55067164", "text": "def permissions\n response = request(:get, '/permissions.json')\n response.collect { |perm| perm['permission'] }\n end", "title": "" }, { "docid": "62aa120d5ee42375ca4228567ac4e74f", "score": "0.550392", "text": "def check_permissions_by_api(permissions)\n response = HTTParty.get(Rds::Permissions::Config.api_endpoint, \n body: { authentication_token: params[:authentication_token], \n permissions: [permissions].flatten } )\n\n response.parsed_response[\"authorized\"] || false\n end", "title": "" }, { "docid": "c56279cdba42c5333b589f0f609865e1", "score": "0.5500939", "text": "def permissions\n\t\t\t@permissions ||= {}\n\t\tend", "title": "" }, { "docid": "c6411c1b3e11b862b1f55671bfde3e07", "score": "0.5477519", "text": "def all_permissions\n @permissions_file ||= load_permissions_file\n @permissions_file.has_key?(self.to_s) ? @permissions_file : no_permissions\n end", "title": "" }, { "docid": "1ed0a1f5c305e3e94b8d99871d3838d2", "score": "0.54736996", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return permission_service(path)\n end\n return permission_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "1ed0a1f5c305e3e94b8d99871d3838d2", "score": "0.54736996", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return permission_service(path)\n end\n return permission_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "d2eb28dda8eb846a2b1d5d9f1dc3a9c5", "score": "0.54650915", "text": "def test_permissions *permissions\n permissions = Array(permissions).flatten\n ensure_service!\n gapi = service.test_bucket_permissions name, permissions,\n user_project: user_project\n gapi.permissions\n end", "title": "" }, { "docid": "e78052ae5de71fb88f5b0fd0492b63dd", "score": "0.54648423", "text": "def discovery_permissions\n [\"edit\"]\n end", "title": "" }, { "docid": "e78052ae5de71fb88f5b0fd0492b63dd", "score": "0.54648423", "text": "def discovery_permissions\n [\"edit\"]\n end", "title": "" }, { "docid": "e78052ae5de71fb88f5b0fd0492b63dd", "score": "0.54648423", "text": "def discovery_permissions\n [\"edit\"]\n end", "title": "" }, { "docid": "c95469fb51dce2824a62e59c48f3e8f9", "score": "0.54298806", "text": "def system_permissions\n\t\t\t\t@system_permissions ||=\n\t\t\t\t\tProc.new {\n\t\t\t\t\t\tpermissions = []\n\t\t\t\t\t\tsystem_groups.each do |system_group|\n\n\t\t\t\t\t\t\tpermissions.concat system_group.permissions.map{ |permission| permission.id }\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\tpermissions\n\t\t\t\t\t}.call\n\t\t\tend", "title": "" }, { "docid": "e37297f7d4b6627e42f81b92611d49ac", "score": "0.5424456", "text": "def service_object\n # No pasamos Scope al Action dispatcher porque no lo necesita\n # Pasamos el contexto de aplicacion directamente\n PermissionsActionDispatcher.new(application_context)\n end", "title": "" }, { "docid": "1faa8faa89e7d57f7db83551a6aea272", "score": "0.5420971", "text": "def get_method_namespace_permissions(config_namespace)\n path = self.api_root + \"/api/methods/#{config_namespace}/permissions\"\n process_firecloud_request(:get, path)\n end", "title": "" }, { "docid": "16dc7e01a417e78463b305845cbd7c83", "score": "0.542093", "text": "def set_permissions\n @permissions = Permission.all\n @role_permission = @role.try(:permission_ids) || []\n end", "title": "" }, { "docid": "dcf9a85567c621f1876fc822e66edc11", "score": "0.54168123", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "7e8d12edbc4490e559fa3455c1a8ae88", "score": "0.5416561", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "7e8d12edbc4490e559fa3455c1a8ae88", "score": "0.5416561", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "7e8d12edbc4490e559fa3455c1a8ae88", "score": "0.5416561", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "7e8d12edbc4490e559fa3455c1a8ae88", "score": "0.5416561", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "7e8d12edbc4490e559fa3455c1a8ae88", "score": "0.5416561", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "7e8d12edbc4490e559fa3455c1a8ae88", "score": "0.5416561", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "7e8d12edbc4490e559fa3455c1a8ae88", "score": "0.5416561", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "title": "" }, { "docid": "d405fa2a13442eae0dcb1e81f8654b0e", "score": "0.54103357", "text": "def setup_permissions\n # merge_permissions_attributes\n merge_visibility\n end", "title": "" }, { "docid": "ba6cf1ceb385a949ac9e450bf76aab21", "score": "0.54038733", "text": "def load_permissions\n @current_permissions = nil\n begin\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n rescue\n end\n end", "title": "" }, { "docid": "8e0602f11e4fc5c329bc44db352a2620", "score": "0.5376575", "text": "def get_permissions\n if @role.type_role==\"system\"\n\t\t\t@permissions = Permission.find(:all, :order => 'name ASC')\n\t else\n @permissions = Permission.type_of(@role.type_role)\n end\n end", "title": "" }, { "docid": "ea908fa618ac667176011f57c3860b42", "score": "0.5361732", "text": "def set_permissions(permission)\n args = {\n :uri => \"https://www.googleapis.com/drive/v2/files/#{self.id}/permissions\",\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Bearer #{self.token}\"\n },\n :method => 'post',\n :data => permission.post_args\n }\n GoogleFT.get_and_parse_response(args)\n end", "title": "" }, { "docid": "03dbbb64f2d84cf3cf5a4d1943f65b35", "score": "0.5361544", "text": "def user_permissions(uid)\n Rails.cache.fetch(\"permissions_#{uid}_#{id}\", expires_in: 10.minutes) do\n Group::LDAP.get_user_permissions(uid, id, User::LDAP)\n end\n end", "title": "" }, { "docid": "2485a9f5630b90eb908f80aecc2c36aa", "score": "0.53461456", "text": "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} unless current_user.nil?\n end", "title": "" }, { "docid": "9414be29752fb67f99b3187e2c835691", "score": "0.5335651", "text": "def custom_permissions\n end", "title": "" }, { "docid": "9414be29752fb67f99b3187e2c835691", "score": "0.5335651", "text": "def custom_permissions\n end", "title": "" }, { "docid": "0e47fefdc34840480999bca0de2905ac", "score": "0.53267187", "text": "def has_permissions(permissions=nil)\n if permissions.class == Set && block_given?\n return @j_del.java_method(:hasPermissions, [Java::JavaUtil::Set.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::JavaUtil::LinkedHashSet.new(permissions.map { |element| element }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))\n end\n raise ArgumentError, \"Invalid arguments when calling has_permissions(permissions)\"\n end", "title": "" }, { "docid": "a48dbe58b1009308eac498a63fa955f2", "score": "0.52963454", "text": "def permissions\n User.do_find_permissions :session_id => kb_session_id\n end", "title": "" }, { "docid": "79f679a44140ca2fb4b57e38e71c249b", "score": "0.52881044", "text": "def get_permissions(user_id)\n raise NotImplementedError, \"Repository.get_permissions: Not yet implemented\"\n end", "title": "" }, { "docid": "debe56cace7f07e7fe8176a027bbbbb7", "score": "0.5286775", "text": "def current_permissions\n @current_permissions ||= ::Permissions.new(current_user)\n end", "title": "" }, { "docid": "40fcff520da8f8aa030931b554cf3830", "score": "0.528256", "text": "def permissions\n end", "title": "" }, { "docid": "0e6f75f739ecc072dfe2f0d448e17cf9", "score": "0.5278668", "text": "def add_permissions(permissions=nil)\n if permissions.class == Set && !block_given?\n @j_del.java_method(:addPermissions, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(permissions.map { |element| element }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling add_permissions(permissions)\"\n end", "title": "" }, { "docid": "0e6f75f739ecc072dfe2f0d448e17cf9", "score": "0.5278668", "text": "def add_permissions(permissions=nil)\n if permissions.class == Set && !block_given?\n @j_del.java_method(:addPermissions, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(permissions.map { |element| element }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling add_permissions(permissions)\"\n end", "title": "" }, { "docid": "fdcd363b0dfc2c2492d4cbb30eded23c", "score": "0.52655977", "text": "def custom_permissions\n\n end", "title": "" }, { "docid": "fbbbd9f58a45c7597d9689b86f702389", "score": "0.5228741", "text": "def reload_permissions!\n reset_permissions!\n permissions_hash\n end", "title": "" }, { "docid": "fbbbd9f58a45c7597d9689b86f702389", "score": "0.5228741", "text": "def reload_permissions!\n reset_permissions!\n permissions_hash\n end", "title": "" }, { "docid": "54488534fee839b4ef5e51811d9c20e5", "score": "0.5223228", "text": "def get_api_permissions(account_href)\n @permissions[account_href] || []\n end", "title": "" } ]
16ab759d0d2af85e5c93043937d128d1
POST /bus_seat_types POST /bus_seat_types.json
[ { "docid": "54af026b82cc8d7f6402fc34aa29d08c", "score": "0.7339704", "text": "def create\n @bus_seat_type = BusSeatType.new(params[:bus_seat_type])\n\n respond_to do |format|\n if @bus_seat_type.save\n format.html { redirect_to @bus_seat_type, notice: 'Bus seat type was successfully created.' }\n format.json { render json: @bus_seat_type, status: :created, location: @bus_seat_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bus_seat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "75b7edd0c25a1705fe583678b81af7fe", "score": "0.6499199", "text": "def new\n @bus_seat_type = BusSeatType.new\n @seat_types=SeatType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bus_seat_type }\n end\n end", "title": "" }, { "docid": "83ee65ed0cc376bada473a80647e0519", "score": "0.602274", "text": "def create\n @businesstype = Businesstype.new(businesstype_params)\n\n respond_to do |format|\n if @businesstype.save\n format.html { redirect_to @businesstype, notice: 'Businesstype was successfully created.' }\n format.json { render :show, status: :created, location: @businesstype }\n else\n format.html { render :new }\n format.json { render json: @businesstype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eeeef9356ef0638ae97e2caa472cbfac", "score": "0.59495705", "text": "def create\n @bus_type = BusType.new(bus_type_params)\n\n respond_to do |format|\n if @bus_type.save\n format.html { redirect_to bus_type_path(@bus_type.slug), notice: \"#{_('Bus type')} #{_('was successfully')} #{_('created')}.\" }\n format.json { render :show, status: :created, location: @bus_type }\n else\n format.html {\n add_breadcrumb :new, new_bus_type_path\n render :new\n }\n format.json { render json: @bus_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5360adbf66446e0f258dc7e5a9a12263", "score": "0.58500165", "text": "def bus_type_params\n params.require(:bus_type).permit(:name, :capacity, :left, :right, :facility => [])\n end", "title": "" }, { "docid": "ccda3830eb0bc5ec3b635d79bcb2f9ff", "score": "0.57706255", "text": "def show\n @bus_seat_type = BusSeatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bus_seat_type }\n end\n end", "title": "" }, { "docid": "a12a935f9fb3077eb009d2dc3f62433a", "score": "0.57407755", "text": "def create\n @boat_type = BoatType.new(boat_type_params)\n respond_to do |format|\n if @boat_type.save\n format.html { redirect_to edit_boat_type_path(@boat_type)}\n format.json { render json: @boat_type.hash_view('control'), status: :created, location: @boat_type }\n else\n format.html { render :new }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf791b84830a2d1582081f4b2094012d", "score": "0.57343155", "text": "def create\n @bs_type = BsType.new(bs_type_params)\n\n respond_to do |format|\n if @bs_type.save\n format.html { redirect_to @bs_type, notice: 'Bs type was successfully created.' }\n format.json { render :show, status: :created, location: @bs_type }\n else\n format.html { render :new }\n format.json { render json: @bs_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be242ad4c52607f852860f3b187ac2ac", "score": "0.5688246", "text": "def create\n @seat = Seat.new(params[:seat])\n\n respond_to do |format|\n if @seat.save\n format.html { redirect_to @seat, notice: 'Seat was successfully created.' }\n format.json { render json: @seat, status: :created, location: @seat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1669ef8b2b098632c0ced86c2b93f354", "score": "0.56863767", "text": "def create\n @seat = Seat.new(params[:seat])\n\n respond_to do |format|\n if @seat.save\n format.html { redirect_to locations_url, notice: 'Seat was successfully created.' }\n format.json { render json: @seat, status: :created, location: @seat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f45d050bf2f35db252da3cfd5b77171c", "score": "0.5660747", "text": "def businesstype_params\n params.require(:businesstype).permit(:name)\n end", "title": "" }, { "docid": "9dd543304fccdcb160da760f6877dab5", "score": "0.5635656", "text": "def create\n @business_type = BusinessType.new(params[:business_type])\n\n respond_to do |format|\n if @business_type.save\n format.html { redirect_to @business_type, notice: 'Business type was successfully created.' }\n format.json { render json: @business_type, status: :created, location: @business_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @business_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0ca3b93d35da74538fbdb204ce54928", "score": "0.56208235", "text": "def create\n @seat = Seat.new(seat_params)\n\n random_digits = rand(9999999999).to_s.center(10, rand(9).to_s)\n\n unless Ticket.find_by(:code => random_digits).nil?\n random_digits = rand(9999999999).to_s.center(10, rand(9).to_s)\n end\n\n @ticket = Ticket.new(seat: @seat, code: random_digits, given_away: seat_params[:given_away], ticket_type_id: seat_params[:ticket_type])\n\n respond_to do |format|\n if @seat.valid? && @ticket.valid?\n @seat.save\n @ticket.save\n format.html { redirect_to admin_seat_path(@seat), notice: 'Seat was successfully created.' }\n format.json { render :show, status: :created, location: @seat }\n else\n format.html { render :new }\n format.json { render json: @seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e56ba63148d48a7f4ab5750a634b3a6e", "score": "0.56186324", "text": "def create\n @seat = Seat.new(seat_params)\n\n respond_to do |format|\n if @seat.save\n format.html { redirect_to @seat, notice: 'Seat was successfully created.' }\n format.json { render :show, status: :created, location: @seat }\n else\n format.html { render :new }\n format.json { render json: @seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e56ba63148d48a7f4ab5750a634b3a6e", "score": "0.56186324", "text": "def create\n @seat = Seat.new(seat_params)\n\n respond_to do |format|\n if @seat.save\n format.html { redirect_to @seat, notice: 'Seat was successfully created.' }\n format.json { render :show, status: :created, location: @seat }\n else\n format.html { render :new }\n format.json { render json: @seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2eb0cd1a15813160d35f73811426f6e3", "score": "0.55805707", "text": "def rec_new\n @beer_types_to_try = BeerType.limit(6).map{|type| [type.id, type.name]}\n render json: @beer_types_to_try\n end", "title": "" }, { "docid": "f3c36b12694f7590971a0e0bcb12fd5e", "score": "0.5535267", "text": "def seat_params\n params.require(:seat).permit(:table, :seat, :x, :y, :angle, :code, :given_away, :ticket_type)\n end", "title": "" }, { "docid": "6d1037bd4a7acfe11bda29ffbde24c95", "score": "0.5534708", "text": "def arrivaltype_params\n params.require(:arrivaltype).permit(:arrivalTypes)\n end", "title": "" }, { "docid": "a02c546fbe98ed2cf55ad11f1ed54333", "score": "0.55323267", "text": "def update\n @bus_seat_type = BusSeatType.find(params[:id])\n\n respond_to do |format|\n if @bus_seat_type.update_attributes(params[:bus_seat_type])\n format.html { redirect_to @bus_seat_type, notice: 'Bus seat type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus_seat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d3c93cce594770db55eb6f981bfe94d", "score": "0.5481346", "text": "def create\n respond_to do |format|\n if @seat.save\n format.html { redirect_to flights_path(@flight), notice: 'Seat was successfully created.' }\n format.json { render :show, status: :created, location: @seat }\n else\n format.html { render :new }\n format.json { render json: @seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd6c293c9175db603ef2d0fb2f30462f", "score": "0.54687595", "text": "def seat_params\n params.require(:seat).permit(:row, :column, :is_taken, :flight_id)\n end", "title": "" }, { "docid": "65de6e4eb8e7d5da560b396fb6b06146", "score": "0.54595345", "text": "def destroy\n @bus_seat_type = BusSeatType.find(params[:id])\n @bus_seat_type.destroy\n\n respond_to do |format|\n format.html { redirect_to bus_seat_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2a955fd4119cc203a9f14b1d97174be7", "score": "0.54333985", "text": "def index\n @businesstypes = Businesstype.all\n end", "title": "" }, { "docid": "ecada131d287e3f710f446a26e33033f", "score": "0.54310066", "text": "def set_businesstype\n @businesstype = Businesstype.find(params[:id])\n end", "title": "" }, { "docid": "8e3d21ae28d8e39599e35187833cd4e6", "score": "0.54112196", "text": "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2198e52b17ae4c03014e117b8384da44", "score": "0.54111457", "text": "def create\n @drug_test = DrugTest.new(params[:drug_test])\n @test_types = params[:test_types]\n @test_types_all = []\n @test_types.each do |id| \n @test_types_all +=[TestType.find_by_id(id)]\n end\n @drug_test.test_types=@test_types_all\n respond_to do |format|\n \n if @drug_test.save\n format.html { redirect_to @drug_test, notice: 'Teste de droga foi criado com sucesso.' }\n format.json { render json: @drug_test, status: :created, location: @drug_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drug_test.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "515ad6f726e765187af259ff5f88f8c8", "score": "0.54056937", "text": "def set_bus_type\n begin\n @bus_type = BusType.where(['id = ? OR slug = ?', params[:id].to_i, params[:id]]).first!\n rescue\n respond_to do |format|\n format.html { redirect_to bus_types_url, notice: \"#{_('Bus type')} #{_('was not found')}.\" }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "cc8ea9a448f71234a3da29c2404c44b7", "score": "0.54035676", "text": "def create\n @kind_of_boat = KindOfBoat.new(kind_of_boat_params)\n\n respond_to do |format|\n if @kind_of_boat.save\n format.html { redirect_to @kind_of_boat, notice: 'Kind of boat was successfully created.' }\n format.json { render :show, status: :created, location: @kind_of_boat }\n else\n format.html { render :new }\n format.json { render json: @kind_of_boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8e7ffc35612ba3d919fe09984de6148", "score": "0.5398044", "text": "def create\n @disaster_type = DisasterType.new(params[:disaster_type])\n\n respond_to do |format|\n if @disaster_type.save\n format.html { redirect_to @disaster_type, notice: 'Disaster type was successfully created.' }\n format.json { render json: @disaster_type, status: :created, location: @disaster_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @disaster_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bdb1fe05fab553b77424c943ddae77c2", "score": "0.5392317", "text": "def create\n @bagtype = Bagtype.new(params[:bagtype])\n\n respond_to do |format|\n if @bagtype.save\n format.html { redirect_to @bagtype, notice: 'Bagtype was successfully created.' }\n format.json { render json: @bagtype, status: :created, location: @bagtype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bagtype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d1a229ac0e89173df9cc4bedf316f89", "score": "0.5383107", "text": "def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @flight }\n else\n format.html { render action: 'new' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n\n airplane = Airplane.find(@flight.airplane_id)\n\n rows_array = (1..airplane.row.to_i).to_a\n column_array = (1..airplane.column.to_i).to_a\n \n\n rows_array.each do |row_name|\n column_array.each do |column_name|\n seat_name = row_name.to_s + \"-\" + column_name.to_s \n seat = Seat.create(:column_row => seat_name, :flight_id => @flight.id, :available => true)\n end\n end\n\n end", "title": "" }, { "docid": "a0e1fe131832e181fbc4196c0f8cb24a", "score": "0.53549814", "text": "def types\n [\n { value: 'bus', name: 'Bus' },\n { value: 'coach', name: 'Coach' },\n { value: 'hgv', name: 'Heavy goods vehicle' },\n { value: 'van', name: 'Van' },\n { value: 'minibus', name: 'Minibus' },\n { value: 'private_car', name: 'Car' },\n { value: 'motorcycle', name: 'Motorcycle' }\n ]\n end", "title": "" }, { "docid": "8c947a362d50aa4a2ac1c122bdb6c980", "score": "0.5331252", "text": "def create\n @seatclass = Seatclass.new(seatclass_params)\n\n respond_to do |format|\n if @seatclass.save\n format.html { redirect_to @seatclass, notice: 'Seatclass was successfully created.' }\n format.json { render :show, status: :created, location: @seatclass }\n else\n format.html { render :new }\n format.json { render json: @seatclass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5dc2ce6a1cd9f286051a901ce344a058", "score": "0.53307927", "text": "def seat_params\n params.require(:seat).permit(:class_id, :first_id, :spnr, :class_pnr, :seatno)\n end", "title": "" }, { "docid": "380dd573743099baf865789ea08ebdb5", "score": "0.53305584", "text": "def create\n sr = SeatReservation.reserve_seat(@customer, params[:seat_id])\n\n # NJS - what to return back? just a success msg?\n respond_to do |format|\n format.json { render json: {reservation_id: sr.id}} \n end\n end", "title": "" }, { "docid": "6616502affdcdfb4b20d98479d36ab08", "score": "0.5330237", "text": "def create\n @typebourse = Typebourse.new(typebourse_params)\n\n respond_to do |format|\n if @typebourse.save\n format.html { redirect_to @typebourse, notice: 'Typebourse was successfully created.' }\n format.json { render :show, status: :created, location: @typebourse }\n else\n format.html { render :new }\n format.json { render json: @typebourse.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13c90617bf144c94c0f09388922500df", "score": "0.5322534", "text": "def business_params\n params.require(:business).permit(:seat, :row, :price, :emergency)\n end", "title": "" }, { "docid": "ccd88852cbbd14b5b10410dd657b2813", "score": "0.5321554", "text": "def create\n @type_bond = TypeBond.new(type_bond_params)\n\n respond_to do |format|\n if @type_bond.save\n format.html { redirect_to @type_bond, notice: 'Type bond was successfully created.' }\n format.json { render :show, status: :created, location: @type_bond }\n else\n format.html { render :new }\n format.json { render json: @type_bond.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "929cd075570611ea266feaf4ae604d63", "score": "0.5317779", "text": "def seat_booking_params\n params.require(:seat_booking).permit(:booking_id, :seat_id, :ticket_type, :price)\n end", "title": "" }, { "docid": "320fb83bee3b361a6746be1082b4dd74", "score": "0.53165317", "text": "def class_seat_params\n params.require(:class_seat).permit(:class_name, :price, :food_service, :Seat_type, :leg_room)\n end", "title": "" }, { "docid": "5f36eb6b02d9dcc7360c64aa9fe799a2", "score": "0.53154165", "text": "def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "title": "" }, { "docid": "278c8cd06fa8a1342c54b1072ff34780", "score": "0.53092724", "text": "def create\n @ipc_seat = IpcSeat.new(ipc_seat_params)\n\n respond_to do |format|\n if @ipc_seat.save\n format.html { redirect_to @ipc_seat, notice: 'Ipc seat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ipc_seat }\n else\n format.html { render action: 'new' }\n format.json { render json: @ipc_seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3253c95264513fa7e0e5688f6b570fee", "score": "0.5308044", "text": "def seat_params\n params.require(:seat\n ).permit(:name)\n end", "title": "" }, { "docid": "17fa74409de2979c063f5c2d91be73be", "score": "0.5293833", "text": "def boat_type_params\n params.require(:boat_type).permit(:ru_name, :en_name, :design_category, :copy_params_table_from_id, :boat_series_id, :body_type, :ru_description, :en_description, :ru_slogan, :en_slogan, :cnf_data_file_url, :base_cost, :is_deprecated, :is_active, :trademark_id, :use_on_ru, :use_on_en)\n end", "title": "" }, { "docid": "37ea68324a6d0f84f55625149f01ab64", "score": "0.5289149", "text": "def create\n respond_to do |format|\n if @seat_manufacturer.save\n format.html { redirect_to @seat_manufacturer, notice: 'Seat manufacturer was successfully created.' }\n format.json { render json: @seat_manufacturer, status: :created, location: @seat_manufacturer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seat_manufacturer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9ba47eea2410e3edb44b205909c3476", "score": "0.5275861", "text": "def create\n @incident_type = IncidentType.new(params[:incident_type])\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully created.' }\n format.json { render json: @incident_type, status: :created, location: @incident_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7acda0f94333420fbdf7062f17b521b1", "score": "0.5272417", "text": "def create\n @brake_type = BrakeType.new(brake_type_params)\n\n respond_to do |format|\n if @brake_type.save\n format.html { redirect_to brake_types_path, notice: 'Brake type was successfully created.' }\n format.json { render :show, status: :created, location: @brake_type }\n else\n format.html { render :new }\n format.json { render json: @brake_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aeb9880bd12c2ce0aa3efb18fdfdcbd5", "score": "0.52714324", "text": "def driver_trip_seat_params\n params.require(:driver_trip_seat).permit(:from, :to, :seatsoccupied)\n end", "title": "" }, { "docid": "1b36b44eef50d9d54221fab3f0ee8420", "score": "0.5259486", "text": "def create\n @ride_type = RideType.new(ride_type_params)\n\n respond_to do |format|\n if @ride_type.save\n format.html { redirect_to @ride_type, notice: 'Ride type was successfully created.' }\n format.json { render :show, status: :created, location: @ride_type }\n else\n format.html { render :new }\n format.json { render json: @ride_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fefacbca7a3ab0f882012f60c743f78f", "score": "0.5255086", "text": "def create\n @event = Event.new(params[:event])\n @client = Client.find(params[:event][:client_id])\n @event_type = EventType.find(params[:selected])\n if @event_type.node == false\n @event.event_type_id = params[:selected]\n end\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Ereignis wurde erfolgreich angelegt' }\n format.json { render json: @event, status: :created, location: @event }\n else\n @root = EventType.find(2)\n\n #sämtliche EventTypen die dem Klienten zur Auswahl stehen\n @event_type_amount = Array.new\n @client.event_types.each do |node|\n node.descendants.each do |descendant|\n @event_type_amount << descendant\n end\n node.ancestors.each do |ancestor|\n @event_type_amount << ancestor\n end\n @event_type_amount << node\n end\n @event_type_amount = @event_type_amount.uniq\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4adc7109d64af4980abe7872672c9790", "score": "0.5249595", "text": "def create\n @segment_type = SegmentType.new(params[:segment_type])\n\n respond_to do |format|\n if @segment_type.save\n format.html { redirect_to @segment_type, notice: 'Segment type was successfully created.' }\n format.json { render json: @segment_type, status: :created, location: @segment_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @segment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a2e592726d926799ed9f2698e6c752e", "score": "0.5243283", "text": "def create\n @discipline_type = DisciplineType.new(params[:discipline_type])\n\n respond_to do |format|\n if @discipline_type.save\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina criado com sucesso.' }\n format.json { render :json => @discipline_type, :status => :created, :location => @discipline_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @discipline_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71aadaf8ae7121a5946c5d342a8474c6", "score": "0.52272314", "text": "def create\n @devicetype = Devicetype.new(devicetype_params)\n\n respond_to do |format|\n if @devicetype.save\n format.html { redirect_to @devicetype, notice: 'Devicetype was successfully created.' }\n format.json { render :show, status: :created, location: @devicetype }\n else\n format.html { render :new }\n format.json { render json: @devicetype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6aeaba094e3914f2ba3907946d99656a", "score": "0.52217734", "text": "def create\n @registry_therapy_type = Registry::TherapyType.new(registry_therapy_type_params)\n\n respond_to do |format|\n if @registry_therapy_type.save\n format.html { redirect_to @registry_therapy_type, notice: 'Tipo de terapia fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @registry_therapy_type }\n else\n format.html { render :new }\n format.json { render json: @registry_therapy_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c15671afb5de8f07bea493a011bce14", "score": "0.52211297", "text": "def create\n @bed_type = BedType.new(bed_type_params)\n\n respond_to do |format|\n if @bed_type.save\n format.html { redirect_to @bed_type, notice: 'Bed type was successfully created.' }\n format.json { render :show, status: :created, location: @bed_type }\n else\n format.html { render :new }\n format.json { render json: @bed_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8702bac98a0a7d5980ee1b1e173ecde4", "score": "0.52185977", "text": "def create\n @class_seat = ClassSeat.new(class_seat_params)\n\n respond_to do |format|\n if @class_seat.save\n format.html { redirect_to @class_seat, notice: 'Class seat was successfully created.' }\n format.json { render :show, status: :created, location: @class_seat }\n else\n format.html { render :new }\n format.json { render json: @class_seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d24be4e13179926b4ed7d950fbfa732", "score": "0.52178276", "text": "def typeconge_params\n params.require(:typeconge).permit(:typeconge)\n end", "title": "" }, { "docid": "143a685c2cbe8d8a786b4099642656b0", "score": "0.5217421", "text": "def create\n @crate_type = CrateType.new(params[:crate_type])\n\n respond_to do |format|\n if @crate_type.save\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully created.' }\n format.json { render :json => @crate_type, :status => :created, :location => @crate_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c55e9328a242fec0f45d3142a23713b1", "score": "0.52132833", "text": "def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ad45f8a7af6c6045c1cf36c126121cc", "score": "0.5209947", "text": "def create\n @seat_configuration = SeatConfiguration.new(seat_configuration_params)\n\n respond_to do |format|\n if @seat_configuration.save\n format.html { redirect_to @seat_configuration, notice: 'Seat configuration was successfully created.' }\n format.json { render :show, status: :created, location: @seat_configuration }\n else\n format.html { render :new }\n format.json { render json: @seat_configuration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4545310b0f4b1d63375296d2657272e4", "score": "0.52048886", "text": "def booking_params\n params.permit(:show_id, seats: [])\n end", "title": "" }, { "docid": "030ddf6dd68be70751a49c21ee691898", "score": "0.5198209", "text": "def create\n @os_type = OsType.new(params[:os_type])\n\n respond_to do |format|\n if @os_type.save\n format.html { redirect_to @os_type, notice: 'Os type was successfully created.' }\n format.json { render json: @os_type, status: :created, location: @os_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99b9ab05055f67944be89dd072dab36e", "score": "0.51881886", "text": "def create\n @seat = Seat.new(params[:seat])\n\n respond_to do |format|\n if @seat.save\n format.html { redirect_to(@seat, :notice => 'Seat was successfully created.') }\n format.xml { render :xml => @seat, :status => :created, :location => @seat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @seat.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f52ccaff8c99b150a4f551738b574e2a", "score": "0.5187117", "text": "def booking_type=(value)\n @booking_type = value\n end", "title": "" }, { "docid": "9fd9962dc8537858255a5c3c05fdd62c", "score": "0.5184202", "text": "def create\n @types_of_apprenticeship = TypesOfApprenticeship.new(params[:types_of_apprenticeship])\n\n respond_to do |format|\n if @types_of_apprenticeship.save\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully created.' }\n format.json { render json: @types_of_apprenticeship, status: :created, location: @types_of_apprenticeship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a54d23288d0241ee844f17b6a2e8b888", "score": "0.5178791", "text": "def create\n @wedding = Wedding.new(params[:wedding])\n if (!params[:wedding][:service_type_ids])\n params[:wedding][:service_type_ids] = params[:wedding][:service_type_ids].split(';')\n end\n params[:wedding][:service_type_ids] ||= []\n ServiceType.all.each do |service_type|\n @wedding.service_types_weddings << ServiceTypesWedding.create(:service_type_id => service_type.id, \n :wedding_id => @wedding.id,\n :activated => params[:wedding][:service_type_ids].include?(service_type.id.to_s))\n end\n\n respond_to do |format|\n if @wedding.save\n format.html { redirect_to @wedding, notice: 'Wedding was successfully created.' }\n format.json { render json: @wedding, status: :created, location: @wedding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wedding.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cdb56094d2773a34eb59abd1e03f6cdb", "score": "0.5176197", "text": "def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end", "title": "" }, { "docid": "ba1d924fba103615cb495ae25e432b36", "score": "0.51713336", "text": "def create\n @observation_type = ObservationType.new(params[:observation_type])\n\n respond_to do |format|\n if @observation_type.save\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully created.' }\n format.json { render json: @observation_type, status: :created, location: @observation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b76dc2c288ff232c6c24af9cabff3f88", "score": "0.51692563", "text": "def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end", "title": "" }, { "docid": "4edd19c42e7b32aaf30aa50f261f5af2", "score": "0.5169248", "text": "def create_types\n\t\t[]\n\tend", "title": "" }, { "docid": "4edd19c42e7b32aaf30aa50f261f5af2", "score": "0.5169248", "text": "def create_types\n\t\t[]\n\tend", "title": "" }, { "docid": "03f8ea4bd4482170a1d5555c13d8a847", "score": "0.51565", "text": "def create\n @driver_trip_seat = DriverTripSeat.new(driver_trip_seat_params)\n\n respond_to do |format|\n if @driver_trip_seat.save\n format.html { redirect_to @driver_trip_seat, notice: 'Driver trip seat was successfully created.' }\n format.json { render :show, status: :created, location: @driver_trip_seat }\n else\n format.html { render :new }\n format.json { render json: @driver_trip_seat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d80422bca19078efb882e37cbca6b4f4", "score": "0.51442635", "text": "def seatclass_params\n params.require(:seatclass).permit(:class_name, :price, :food_sertvice, :seat_type, :leg_room)\n end", "title": "" }, { "docid": "4c177aa70f107f430971f96b48d07347", "score": "0.5143687", "text": "def create\n @bike_type = BikeType.new(bike_type_params)\n\n if @bike_type.save\n audit(@bike_type, current_user)\n render json: @bike_type, status: :created\n else\n render json: @bike_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c13e1584a6e32a5f83c38e6ce5e8e9d2", "score": "0.51406765", "text": "def create\n @segment_type = SegmentType.new(segment_type_params)\n\n respond_to do |format|\n if @segment_type.save\n format.html { redirect_to @segment_type, notice: 'Segment type was successfully created.' }\n format.json { render :show, status: :created, location: @segment_type }\n else\n format.html { render :new }\n format.json { render json: @segment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5fd2655278dd2b707b7a02e0add6fca4", "score": "0.513982", "text": "def create\n @bet_type = Bet::Type.new(bet_type_params)\n\n respond_to do |format|\n if @bet_type.save\n format.html { redirect_to @bet_type, notice: 'Type was successfully created.' }\n format.json { render :show, status: :created, location: @bet_type }\n else\n format.html { render :new }\n format.json { render json: @bet_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b045834a9adaad38d4ea6a902e477876", "score": "0.51382583", "text": "def create\n @register_animal_type = Register::AnimalType.new(register_animal_type_params)\n\n respond_to do |format|\n if @register_animal_type.save\n format.html { redirect_to register_animal_types_path, success: 'O tipo de animal foi criado com sucesso.' }\n format.json { render :index, status: :created, location: @register_animal_type }\n else\n format.html { render :new }\n format.json { render json: @register_animal_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f9cb65479328c7f7a3e50a34005d40c", "score": "0.5133532", "text": "def create\n @agency_type = AgencyType.new(params[:agency_type])\n\n respond_to do |format|\n if @agency_type.save\n format.html { redirect_to @agency_type, notice: 'Agency type was successfully created.' }\n format.json { render json: @agency_type, status: :created, location: @agency_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agency_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2627206ad5b362b322e4a06c8fa451b1", "score": "0.512618", "text": "def create_types\n\t[]\nend", "title": "" }, { "docid": "2627206ad5b362b322e4a06c8fa451b1", "score": "0.512618", "text": "def create_types\n\t[]\nend", "title": "" }, { "docid": "9af71719c9b0be2a630e8a52570844e5", "score": "0.5109083", "text": "def fuel_type_params\n params.require(:fuel_type).permit(:name)\n end", "title": "" }, { "docid": "0d1a814644609d84966bc83ac63e02dc", "score": "0.5103364", "text": "def create\n @intervention_type = InterventionType.new(intervention_type_params)\n\n respond_to do |format|\n if @intervention_type.save\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi criado.' }\n format.json { render :show, status: :created, location: @intervention_type }\n else\n format.html { render :new }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "206f7095ad49b44a6a1a2fe53769d596", "score": "0.51021475", "text": "def create\n @student_type = StudentType.new(student_type_params)\n\n if @student_type.save\n render json: @student_type, status: :created, location: @student_type\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b46dfec463f2dced334b52ec922df19a", "score": "0.50991565", "text": "def create\n @state_type = StateType.new(state_type_params)\n\n respond_to do |format|\n if @state_type.save\n format.html { redirect_to @state_type, notice: 'State type was successfully created.' }\n format.json { render :show, status: :created, location: @state_type }\n else\n format.html { render :new }\n format.json { render json: @state_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "033bc93ae83da8f73ecea4d9065f1744", "score": "0.5096273", "text": "def devicetype_params\n params.require(:devicetype).permit(:type)\n end", "title": "" }, { "docid": "472cd25f89913bdb10df3e3d1b334234", "score": "0.5094515", "text": "def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end", "title": "" }, { "docid": "ecf6bb099e0319a8eb6227b693cb1edd", "score": "0.5090779", "text": "def create\n @insurance_type = InsuranceType.new(params[:insurance_type])\n\n respond_to do |format|\n if @insurance_type.save\n flash[:success] = \"Тип успешно добавлен.\"\n format.html { redirect_to @insurance_type }\n format.json { render json: @insurance_type, status: :created, location: @insurance_type }\n else\n flash.now[:error] = \"Тип с таким названием не может быть добавлен!\"\n format.html { render action: \"new\" }\n format.json { render json: @insurance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a59f087f4ed3987403d59c9ee70d3097", "score": "0.50902766", "text": "def create\n # TODO: why change from new to create makes it so I can access the @flight.id\n @flight = Flight.create(flight_params)\n\n # when a flight is created, create all the associated seats\n @airplane = Airplane.find @flight.airplane_id\n # find the number of rows/columns that the aeroplane has, create a range from 1 to that number, then split that into an array.\n # this will allow us to loop through and create a seat for each value below\n @rows = (1..@airplane.rows).to_a\n @columns = (1..@airplane.columns).to_a\n # create a seat for each row and column and associate it with this flight.\n @rows.each do |row|\n @columns.each do |col|\n seat = Seat.create :row => row, :column => col, :is_taken => false\n @flight.seats << seat\n end\n end\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68cb235033c4833dd3d122dd92294703", "score": "0.50899", "text": "def create\n @type_of_cleaning_and_washing = TypeOfCleaningAndWashing.new(params[:type_of_cleaning_and_washing])\n\n respond_to do |format|\n if @type_of_cleaning_and_washing.save\n format.html { redirect_to type_of_cleaning_and_washings_path, notice: 'Type of cleaning and washing was successfully created.' }\n format.json { render json: @type_of_cleaning_and_washing, status: :created, location: @type_of_cleaning_and_washing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type_of_cleaning_and_washing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e47777578270fc4dfa0bb8b58d031486", "score": "0.50864166", "text": "def bed_type_params\n params.permit(:name)\n end", "title": "" }, { "docid": "60a23850d638f5f1aa10bd40ea0a248f", "score": "0.50859755", "text": "def create\n @client_type = ClientType.new(params[:client_type])\n\n respond_to do |format|\n if @client_type.save\n format.html { redirect_to @client_type, notice: 'Client type was successfully created.' }\n format.json { render json: @client_type, status: :created, location: @client_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a559dcc492323393a3ed8e923f21d9b", "score": "0.50811744", "text": "def create\n @agenda_type = AgendaType.new(params[:agenda_type])\n\n respond_to do |format|\n if @agenda_type.save\n format.html { redirect_to @agenda_type, :notice => 'Agenda type was successfully created.' }\n format.json { render :json => @agenda_type, :status => :created, :location => @agenda_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @agenda_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5ec6f1c1f70962bafd81f41c995824c", "score": "0.50757486", "text": "def create\n @downtime_type = DowntimeType.new(downtime_type_params)\n\n respond_to do |format|\n if @downtime_type.save\n format.html { redirect_to downtime_types_url, notice: '成功添加.' }\n format.json { render :show, status: :created, location: @downtime_type }\n else\n format.html { render :new }\n format.json { render json: @downtime_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a1b5248789d1e0a47c3182e1bea5e892", "score": "0.50729305", "text": "def create\n @structure_type = StructureType.new(params[:structure_type])\n\n respond_to do |format|\n if @structure_type.save\n format.html { redirect_to @structure_type, notice: 'Structure type was successfully created.' }\n format.json { render json: @structure_type, status: :created, location: @structure_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @structure_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c0d23e541a2c5854a1cfad423091ee4d", "score": "0.50696903", "text": "def create\n @sale_type = SaleType.new(sale_type_params)\n\n respond_to do |format|\n if @sale_type.save\n format.html { redirect_to @sale_type, notice: \"Sale type was successfully created.\" }\n format.json { render :show, status: :created, location: @sale_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sale_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "622f2be1611c630e212b1b3091864cca", "score": "0.50677305", "text": "def create\n @os_type = OsType.new(os_type_params)\n\n respond_to do |format|\n if @os_type.save\n format.html { redirect_to @os_type, notice: 'Os type was successfully created.' }\n format.json { render :show, status: :created, location: @os_type }\n else\n format.html { render :new }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28aa90621e32fc502c18f91afc128967", "score": "0.5067693", "text": "def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end", "title": "" }, { "docid": "d7e5f75663d7e2f03f2cdb55b7167d1e", "score": "0.5066546", "text": "def create\n @fueltype = Fueltype.new(params[:fueltype])\n\n respond_to do |format|\n if @fueltype.save\n format.html { redirect_to @fueltype, notice: 'Fueltype was successfully created.' }\n format.json { render json: @fueltype, status: :created, location: @fueltype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fueltype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea8b9950cc73beddbd9e6f33818f3a2a", "score": "0.5064532", "text": "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "title": "" }, { "docid": "8f1fcfbe913fb991fb2d3b109bd7efe6", "score": "0.5064363", "text": "def create\n event = Event.find(params[:event_id])\n @bus = event.buses.build(bus_params)\n respond_to do |format|\n if @bus.save\n format.html { redirect_to event_path(@bus.event), notice: 'Bus was successfully created.' }\n format.json { render :show, status: :created, location: @bus }\n else\n format.html { render :new }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2d7877ac346af141e1cf351fcfbc8f9", "score": "0.50637984", "text": "def departuretype_params\n params.require(:departuretype).permit(:departureTypes)\n end", "title": "" } ]
68fa028535cde6c911eb3e57dd96d2fc
Public: initialize for object Hash with params: where key is parameter name and value is value of this parameter
[ { "docid": "4267109d1cd01d15c881c4412237fba6", "score": "0.74452865", "text": "def initialize(params)\n AVAILABLE_PARAMETERS.each do |param|\n send(sprintf(\"%s=\", param), params[param])\n end\n end", "title": "" } ]
[ { "docid": "0e295835322a4d2b16c518c7619b230d", "score": "0.8335762", "text": "def initialize params={}\n params.each do |key, value|\n self.instance_variable_set to_instance_variable_symbol(key), value\n end\n end", "title": "" }, { "docid": "498446e414e335472c1bf22ed36203e7", "score": "0.82768893", "text": "def initialize params={}\n params.each do |k,v|\n meffod = :\"#{k}=\"\n send(meffod, v) #if respond_to?(meffod)\n end\n end", "title": "" }, { "docid": "3a39bb471e8781c88f7ea6e0e0459116", "score": "0.8017812", "text": "def initialize(hash = {})\n \t\t\t @params = hash.select { |_k, v| v }\n \t\t\t @params['v'] = 1\n \t\tend", "title": "" }, { "docid": "a40aaa629cfbc164527ce8169aefb081", "score": "0.79833007", "text": "def initialize(params={})\n params.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end", "title": "" }, { "docid": "5b14e55fe8b55275dad8ba2d6f9786e4", "score": "0.78935724", "text": "def init(params)\n params.each_key do |k|\n # code below translates to\n # self.k = params[k]\n # with k = any of the keys in params (name, address, email, notes)\n self.send(\"#{k}=\", params[k])\n\n # NOTE: we didn't do self.send(\"#{k}='#{params[k]}'\")\n # so we can maintain the type of object passed instead of interpolated string\n end\n end", "title": "" }, { "docid": "63d6edb674819280edb7a5fb90c07810", "score": "0.77810174", "text": "def initialize(params)\n\t\tself.class.attributes.each do |key|\n\t\t\tinstance_variable_set(\"@#{key.to_sym}\", params[key])\n\t\tend\n\tend", "title": "" }, { "docid": "025a0eb775647406e33a14e23531436c", "score": "0.7780777", "text": "def initialize(params={})\n params.each do |k, v|\n self.instance_variable_set(\"@#{k}\", v)\n end\n end", "title": "" }, { "docid": "025a0eb775647406e33a14e23531436c", "score": "0.7780777", "text": "def initialize(params={})\n params.each do |k, v|\n self.instance_variable_set(\"@#{k}\", v)\n end\n end", "title": "" }, { "docid": "76afcc969adc418596d50e015fe872e3", "score": "0.76850796", "text": "def initialize(klass, params)\n @hash = params\n @internal_parameters = {}\n @extra_parameters = {}\n\n # partition parameters into known and extra parameters\n @hash.each do |k,v|\n k = k.to_sym\n if v.nil?\n raise ArgumentError, \"parameter :#{k} has nil value in #{klass}\"\n end\n\n if klass.internal_parameters.include?(k)\n @internal_parameters[k] = v\n else\n @extra_parameters[k] = v\n end\n end\n end", "title": "" }, { "docid": "bc38c217ef059b69573550c079b11f09", "score": "0.7535765", "text": "def initialize(*params)\n params[0] = params[0].each_with_object({}){|(k,v), hash|\n hash[k.to_s.underscore] = v\n } if params[0].is_a?(Hash)\n super\n end", "title": "" }, { "docid": "ece1b3c58e6b5c6d9fecdccede22bda8", "score": "0.7524625", "text": "def initialize(params={})\n params.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n end", "title": "" }, { "docid": "fb4b62efd9b21a4252a9e700c3f0c208", "score": "0.75197786", "text": "def initialize(params = {})\n params.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n end", "title": "" }, { "docid": "375fb73c2d77c93a6e903ac8f52e4aa0", "score": "0.7496967", "text": "def initialize(params = {})\n params.each do |k, v|\n instance_variable_set(\"@#{k}\", v) unless v.nil?\n end\n end", "title": "" }, { "docid": "b09e1c6ef886cacb53fb27b1ffb17bf1", "score": "0.7443501", "text": "def initialize(params = {})\n params.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end \n end", "title": "" }, { "docid": "8fdc4763a623c3c098998117363beb6c", "score": "0.7414702", "text": "def initialize(params) # constructor method accepts flexible parameters\n params.each do |key, value|\n instance_variable_set(\"@#{key}\", value) # sets instance variables\n end\n end", "title": "" }, { "docid": "f7a1008cfd525b9df520c1b3d1ad8480", "score": "0.73449683", "text": "def initialize(params = nil)\n return if params.nil? or params.empty?\n params.each{ |k,v| self.send(\"#{k}=\", v) }\n end", "title": "" }, { "docid": "951e23727716ee870b776d3c4bb263a0", "score": "0.73449636", "text": "def initialize(params)\n\t\t\t\t@params = params.transform_keys { |key| key.to_sym rescue key }\n\t\t\t\tvalidate! @params\n\t\t\tend", "title": "" }, { "docid": "91ff02ca3c6955d1736362070d03fe3b", "score": "0.7332221", "text": "def initialize(hash = {})\n end", "title": "" }, { "docid": "5b383dc14b68574608cb1d7e1b833398", "score": "0.7319113", "text": "def initialize(**params)\n @params = params\n\n @params.each do |key, value|\n self.class.send(:define_method, key) { value } unless respond_to?(key)\n end\n end", "title": "" }, { "docid": "f35f56886c48e8af8b79514d6f071280", "score": "0.7269219", "text": "def initialize(optHash)\r\n @optHash=optHash\r\n setParameters()\r\nend", "title": "" }, { "docid": "f35f56886c48e8af8b79514d6f071280", "score": "0.7269219", "text": "def initialize(optHash)\r\n @optHash=optHash\r\n setParameters()\r\nend", "title": "" }, { "docid": "30c9d7bd22e49bf009e8846aa064d930", "score": "0.72674316", "text": "def initialize(**params)\n @params = params\n end", "title": "" }, { "docid": "fbb9f3d380a0c5c808032a4b81e39d3f", "score": "0.72618544", "text": "def params=(hash); end", "title": "" }, { "docid": "fbb9f3d380a0c5c808032a4b81e39d3f", "score": "0.72618544", "text": "def params=(hash); end", "title": "" }, { "docid": "fbb9f3d380a0c5c808032a4b81e39d3f", "score": "0.72618544", "text": "def params=(hash); end", "title": "" }, { "docid": "50309b34949c09c08e1158d24ab00ee6", "score": "0.725412", "text": "def initialize(params)\n fail ArgumentError, 'String is expected as :key' unless params[:key].is_a?(String)\n fail ArgumentError, 'String is expected as :secret' unless params[:secret].is_a?(String)\n @key = params[:key]\n @secret = params[:secret]\n @params = params.dup\n end", "title": "" }, { "docid": "85f5843e102838e41578f93db75096fe", "score": "0.722375", "text": "def initialize(params = {})\n end", "title": "" }, { "docid": "aefe16a618f211408b8e95c457b239ee", "score": "0.7223456", "text": "def initialize(params={})\n end", "title": "" }, { "docid": "aefe16a618f211408b8e95c457b239ee", "score": "0.7223456", "text": "def initialize(params={})\n end", "title": "" }, { "docid": "04322ba62a406751a03ae8bd4682ca3c", "score": "0.72138846", "text": "def initialize(*args)\n if args.last.is_a?(Hash)\n args.last.each do |k,v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\".to_sym)\n end\n end\n end", "title": "" }, { "docid": "8a15e8a88e51d6f24e9c8fe8d31ea8cb", "score": "0.72050226", "text": "def initialize(params)\r\n MetamodelBuilder::ConstantOrderHelper.enumCreated(self)\r\n\t \tif params.is_a?(Array)\r\n\t\t @literals = params\r\n\t \t\t@name = \"anonymous\"\r\n\t \telsif params.is_a?(Hash)\r\n\t \t\traise StandardError.new(\"Hash entry :literals is missing\") unless params[:literals]\r\n\t \t\t@literals = params[:literals]\r\n\t \t\t@name = params[:name] || \"anonymous\"\r\n\t \telse\r\n\t \t\traise StandardError.new(\"Pass an Array or a Hash\")\r\n\t \tend\r\n\t end", "title": "" }, { "docid": "141a5fa1879f15a3c254f6f43be23532", "score": "0.7201893", "text": "def initialize(params)\n\t params.each do |key, value| \n\t instance_variable_set(\"@#{key}\", value) if Filing.instance_methods.include? key\n\t end\n\t end", "title": "" }, { "docid": "2d71f8a4d8e136a0038099b8c05c39d9", "score": "0.7193591", "text": "def initialize_params(values={})\n if self.class.included_modules.include?(Parameters)\n self.class.each_param do |param|\n self.params[param.name] = param.to_instance(self)\n end\n end\n\n self.params = values if values.kind_of?(Hash)\n end", "title": "" }, { "docid": "eb649982a98561be90daf86008ec5061", "score": "0.71763366", "text": "def initialize(params)\n @params = {:role => \"reader\"}\n for name, value in params\n if !name.is_a?(Symbol)\n raise(ArgumentError, \"Key must be Symbol, but is %p\" % name)\n elsif !PARAM_NAMES.include?(name)\n raise(ArgumentError, \"Invalid key: %p\" % name)\n end\n @params[name] = value\n end\n end", "title": "" }, { "docid": "438dde20ded70e00a2d26f6da59a7787", "score": "0.7168107", "text": "def initialize(params=[])\n @result = {}\n params.each { |key, value| parse(key, value) }\n end", "title": "" }, { "docid": "077f4b5a6e48b3bc90951e23a7448126", "score": "0.71680045", "text": "def initialize(parameters = {}, path_components = nil)\n @parameters = {}\n parameters.each {|k,v| send(:\"#{k}=\", v)}\n end", "title": "" }, { "docid": "fd80a9f5cdea3696798d81f0f08cfee5", "score": "0.7165606", "text": "def initialize(params)\n\t params.each do |key, value| \n\t instance_variable_set(\"@#{key}\", value) if Lobbyist.instance_methods.include? key\n\t end\n\t end", "title": "" }, { "docid": "b0ea398f263c100621838cfa4bb41565", "score": "0.7115765", "text": "def initialize params={}\n @records = []\n @mapped = false\n params.each do |k,v|\n send(\"#{k}=\", v)\n end\n end", "title": "" }, { "docid": "a3b09e4a7c6871c35b9ff2f10a4f830f", "score": "0.7102959", "text": "def initialize(hash={})\n hash.each {|k,v| instance_variable_set(\"@#{k}\".to_sym, v) }\n end", "title": "" }, { "docid": "0fe107ee7f5f1cdc0ff4efb0c61383f9", "score": "0.70951843", "text": "def initialize(params)\n\t params.each do |key, value| \n\t instance_variable_set(\"@#{key}\", value) if Legislator.instance_methods.include? key\n\t end\n\t end", "title": "" }, { "docid": "16442ab6f8c6615558f8b5ee6930f991", "score": "0.7077363", "text": "def initialize(hash={})\n hash.each_pair do |key,value|\n send(\"#{key}=\".to_sym,value) if DESIRED_FIELDS.include?(key)\n end\n end", "title": "" }, { "docid": "9e13eeb0bfe517852a954e2e8d597234", "score": "0.707366", "text": "def initialize(*h)\n\t if h.length == 1 && h.first.kind_of?(Hash)\n\t h.first.each { |k,v| send(\"#{k}=\",v) }\n\t end\n\tend", "title": "" }, { "docid": "aa3ff84d51e13f91d5fc6151300b07e6", "score": "0.7056793", "text": "def initialize(hash = nil)\n if hash\n hash.each_pair do |key, value|\n self.send(\"#{key}=\", value)\n end\n end\n end", "title": "" }, { "docid": "7d1803f33e1a433e0f9f0455d34e9a0c", "score": "0.70542765", "text": "def initialize(hash = {})\n @hash = hash\n end", "title": "" }, { "docid": "4a46555b99775024eaf3e57a4151d675", "score": "0.7053036", "text": "def initialize(hash = {})\n hash.each do |k,v|\n instance_variable_set(\"@#{k}\",v)\n end\n end", "title": "" }, { "docid": "f412917917ab3e0e95b2b5ae0c90ed76", "score": "0.70335543", "text": "def initialize(*args)\n args.first.each do |key, value|\n send(:\"#{key}=\", value)\n end\n end", "title": "" }, { "docid": "19756ae18bb971b9ff6cbbbc8b089267", "score": "0.7007811", "text": "def initialize(params = {})\n @params = params\n @data = {}\n end", "title": "" }, { "docid": "3d05b5490ae0b97800541421e873993b", "score": "0.69879997", "text": "def initialize(hash={})\n @hash = hash\n end", "title": "" }, { "docid": "753c654a12d8c314e5dab67b65a10398", "score": "0.6985902", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "753c654a12d8c314e5dab67b65a10398", "score": "0.6985902", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "e7134ca5c13a6b93c58d4bd46ed5f69c", "score": "0.698362", "text": "def initialize(name, age:, occupation:, hobby: nil, birthplace: \"Sleepy Creek\") #We replace the hash parameter with keyword and default value\n self.name = name\n self.age = age #we use parameter names instead of hash keys\n self.occupation = occupation\n self.hobby = hobby\n self.birthplace = birthplace\n end", "title": "" }, { "docid": "65dff1f1d61a989af2d17ec62a30f13d", "score": "0.69813293", "text": "def initialize(key,hash)\n @key = key\n @value = hash\n self.put(key,hash)\n end", "title": "" }, { "docid": "88835912e5108870e8fc59ac5442c341", "score": "0.69740504", "text": "def initialize(**keyword_args)\n\t\t\tKEYS.each { |key|\n\t\t\t\tval=keyword_args[key]\n\t\t\t\tself[key]=val\n\t\t\t\tinstance_variable_set(\"@#{key}\", val)\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "2662ce99f8f673098ee75a72498d3350", "score": "0.6970606", "text": "def initialize(params = { })\n @params = params\n end", "title": "" }, { "docid": "8332c3cb95373ba9fcbc2caab8b99175", "score": "0.69456744", "text": "def initialize(params= {})\n params.each { |k, v| instance_variable_set(\"@#{k.underscore}\", v) if ATTRS.include?(k.to_sym) }\n\n end", "title": "" }, { "docid": "88dfe6f150b6be42e97e012494f46d41", "score": "0.6945024", "text": "def initialize(params = {}, required_keys = nil)\n super\n end", "title": "" }, { "docid": "869c19da61a375d30bb32b064ca47746", "score": "0.6944208", "text": "def initialize(key,hash)\n super()\n @name = key\n merge! hash\n self\n end", "title": "" }, { "docid": "fd64e8c60b6f8c31b7286a31a881e91c", "score": "0.6931226", "text": "def initialize(key); end", "title": "" }, { "docid": "16a0925931b42cb784c934a599ea7750", "score": "0.69264024", "text": "def initialize(params, config)\n if params.respond_to?(:permit!)\n santitized_params = params.permit!\n else\n santitized_params = params\n end\n @params = HashWithIndifferentAccess.new(prepare_params(santitized_params))\n @config = config\n end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.69248074", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.69248074", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.69248074", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "2ee4b96083a56f0ffba1b3fd37f6c41f", "score": "0.69248074", "text": "def initialize(params)\n @params = params\n end", "title": "" }, { "docid": "3300aede968c337edd8907b85fd16fb6", "score": "0.6915057", "text": "def initialize(args)\n args.each do |k, v|\n instance_variable_set \"@#{k}\", v if self.class.props.member?(k)\n end if args.is_a? Hash\n end", "title": "" }, { "docid": "f01551d7243d790b3a99598786bdea3e", "score": "0.6900295", "text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[parameters parameterTypes parameterNames parameterValues line module includeAll hex]\n end", "title": "" }, { "docid": "deb85ade9840c82e64283a75277d4bc1", "score": "0.689968", "text": "def initialize(search_params_hash)\n raise_invalid_argument_type_error unless search_params_hash.is_a?(Hash)\n raise_unknown_filter_error if search_params_hash.empty?\n raise_ambiguous_filter_error if search_params_hash.size > 1\n\n @type = search_params_hash.keys.first\n @value = search_params_hash.values.first\n\n raise_unknown_filter_error unless supported_filter?\n raise_invalid_value_error unless valid_value?\n end", "title": "" }, { "docid": "a3da6659112ca8b0bff06444e6dea6f3", "score": "0.6898418", "text": "def initialize(hash)\n\t\t\tset_from_hash(hash)\n\t\tend", "title": "" }, { "docid": "ef17daa8c5a5c6c25e4a21dbe618b701", "score": "0.6886771", "text": "def initialize(params)\n\n @parameters = params\n\n end", "title": "" }, { "docid": "244f009317b02ef6d228876f8d7c5710", "score": "0.688279", "text": "def initialize(*h)\n if h.length == 1 && h.first.kind_of?(Hash)\n h.first.each { |k, v| send(\"#{k}=\", v) if public_methods.include?(\"#{k}=\".to_sym) }\n end\n end", "title": "" }, { "docid": "74b30ee448b76aded03a09e80f97b723", "score": "0.6876747", "text": "def initialize(params = {})\n params.each do |k, v|\n key = k.to_sym\n raise \"unknown attribute '#{k}'\" unless self.class.columns.include?(key)\n key = (key.to_s + '=').to_sym\n #uses the key value to call a setter method for that attribute\n self.send(key, v)\n end\n end", "title": "" }, { "docid": "6c6d3bcf6d60bfedafa8c3e168cabb82", "score": "0.6873763", "text": "def initialize obj, params\n @obj = obj\n @params = params\n\n end", "title": "" }, { "docid": "0d496e1887126b69b6d6aa4045da4f61", "score": "0.6873299", "text": "def init(params)\n end", "title": "" }, { "docid": "e2226d59fc661c90960b7919b761d425", "score": "0.6871565", "text": "def initialize(hash={})\n @hash = hash\n end", "title": "" }, { "docid": "0b869573665808916e90b739ed0ce801", "score": "0.6859182", "text": "def set_params(param_hash={})\n # {{{\n param_hash.each_pair { |k,v|\n @params[k.to_sym] = v\n }\n end", "title": "" }, { "docid": "4d32cf3a9ca9e4092c4ab0f70b47adba", "score": "0.68573934", "text": "def initialize(args = {})\n @parameters = {}\n\n args.each { |param,value|\n self[param] = value\n }\n if @namevar == :_prominator_name\n self['_prominator_name'] = self['name']\n end\n end", "title": "" }, { "docid": "0fec335cd467143241dba9bae7114592", "score": "0.68525314", "text": "def initialize(params)\n validate_params!(params)\n @params = params\n end", "title": "" }, { "docid": "519f94b5a80860ecf69292b8c735bc1d", "score": "0.6849134", "text": "def initialize(params={})\n params.each_pair do |attr, value|\n send(\"#{attr}=\", value) if respond_to?(\"#{attr}=\", true)\n end unless params.blank?\n end", "title": "" }, { "docid": "7edd400a3d068783e8d8333427a4672e", "score": "0.6841904", "text": "def initialize(attrs={})\n from_hash(attrs)\n end", "title": "" }, { "docid": "7edd400a3d068783e8d8333427a4672e", "score": "0.6841904", "text": "def initialize(attrs={})\n from_hash(attrs)\n end", "title": "" }, { "docid": "c5cb324fffb4923e458aec3522ad5d5a", "score": "0.6839487", "text": "def initialize( name, params )\n super( Param.build( params )) ## note: build/wrap into struct from simple/plain array\n @name = name\n end", "title": "" }, { "docid": "486304933ff3cc945973cfbd9b6c61f9", "score": "0.6828715", "text": "def initialize( name, params )\n super( Param.build( params)) ## note: build/wrap into struct from simple/plain array\n @name = name\n end", "title": "" }, { "docid": "8dbdfd1c4e2c6d6857b9afb906649790", "score": "0.6823661", "text": "def initialize\n @parameterList = Hash.new\t\t\t# Create empty hash\n super\t\t\t\t\t# Call superclass\n end", "title": "" }, { "docid": "085149673bcb4304fc7254a56ad19166", "score": "0.68069214", "text": "def initialize (x = {:f => nil, :c => nil})\n @myHash = x\nend", "title": "" }, { "docid": "1cfd1d09261e2716dd2b6b3721617542", "score": "0.68004006", "text": "def initialize(args)\n assign_from_hash(args)\n end", "title": "" }, { "docid": "d70bddff72d9787a1ac2cb70e41d4f5d", "score": "0.67948455", "text": "def initialize(hash = nil)\n end", "title": "" }, { "docid": "8fb4989df0b1b036ce4942da036d195e", "score": "0.67692846", "text": "def init_params(params)\n super\n end", "title": "" }, { "docid": "8fb4989df0b1b036ce4942da036d195e", "score": "0.67692846", "text": "def init_params(params)\n super\n end", "title": "" }, { "docid": "dc1d191ba7659c4aa08a0a7633c704a2", "score": "0.6761873", "text": "def initialize(params = {})\n super(params)\n params_with_symbol_keys = normalize_keys(params)\n @trusona_id = params_with_symbol_keys[:trusona_id]\n @id = @trusona_id\n @email = params_with_symbol_keys[:email]\n @status = determine_status(params_with_symbol_keys[:status])\n @first_name = params_with_symbol_keys[:first_name]\n @last_name = params_with_symbol_keys[:last_name]\n @nickname = params_with_symbol_keys[:nickname]\n @handle = params_with_symbol_keys[:handle]\n @emails = parse_emails(params_with_symbol_keys[:emails])\n @max_level = parse_max_level(params_with_symbol_keys[:metadata])\n\n @params = params_with_symbol_keys\n end", "title": "" }, { "docid": "ff2d4a81dcd2d31cd80eebfe5d17cb8b", "score": "0.6755104", "text": "def initialize(params)\n @name = params[:name]\n @age = params[:age]\n @weight = params[:weight]\n end", "title": "" }, { "docid": "9ff4030268ad6cb4da43036a8c8d0387", "score": "0.67544204", "text": "def initialize(params)\n @params = {:role => \"reader\"}\n for name, value in params\n if !PARAM_NAMES.include?(name)\n raise(ArgumentError, \"Invalid key: %p\" % name)\n end\n @params[name] = value\n end\n end", "title": "" }, { "docid": "3eb3997b7dbda87e7e77677fd194afd6", "score": "0.6750002", "text": "def initialize(key, arg)\n self.key = key\n self.arg = arg\n end", "title": "" }, { "docid": "085dbf256476a7b0cf90f6fb7ed4a9f0", "score": "0.67492473", "text": "def initialize(name, params)\n super self \n @name = name\n @params = params\n end", "title": "" }, { "docid": "eb873d60a44beba1d4fd3ce50ef92c66", "score": "0.67438096", "text": "def initialize(user_name:, name:, age:, location:) #gets the user_name, name, age and location keys from the hash you pass in\n @user_name = user_name\n @name = name\n @location = location\n @age = age\n end", "title": "" }, { "docid": "9f27e76ffd27aa9b997ebdffe3c933fb", "score": "0.6737847", "text": "def initialize(**hash_args)\n yield self if block_given?\n hash_args.keys.each do |key|\n send \"#{key}=\", hash_args[key]\n end\n end", "title": "" }, { "docid": "a703e686a2987d4388d4f28d16abe546", "score": "0.6737149", "text": "def initialize(params = {})\n\t\t\t@aws_key_id = self.class.config_params[:aws_key_id]\n\t\t\t@aws_associate_id = self.class.config_params[:aws_associate_id]\n\t\t\t@aws_default_operation = self.class.config_params[:aws_default_operation]\n\t\t\t@aws_default_category = self.class.config_params[:aws_default_category]\n\t\t\t@call_params = params\n\t\tend", "title": "" }, { "docid": "89553a307e73fd3e3768f02ff6b70008", "score": "0.6720282", "text": "def initialize(name: nil, key: nil)\n @name = name\n @key = key\n end", "title": "" }, { "docid": "1b5c27538841a18c18c9251ee353d906", "score": "0.6717481", "text": "def initialize( hash=nil )\n\t\t\thash ||= {}\n\t\t\t@hash = symbolify_keys( hash )\n\t\t\t@dirty = false\n\t\tend", "title": "" }, { "docid": "f0bb893426182e27653f506327a04d15", "score": "0.6712347", "text": "def initialize(params)\n params = params.stringify_keys\n @short_name = params['shortname']\n @first_name = params['firstname']\n @last_name = params['lastname']\n @public_key = params['publickey'] || params['public_key']\n @user_id = params['id'] || params['user_id']\n @share = params['ispublic']\n @birthdate = Time.at(params['birthdate']) if params['birthdate']\n @gender = params['gender'] == 0 ? :male : params['gender'] == 1 ? :female : nil\n @fat_method = params['fatmethod']\n end", "title": "" }, { "docid": "679ef9b3cc9da53abaf7a4d689986889", "score": "0.6703573", "text": "def initialize(params=nil)\n if params\n @name = params['name']\n end\n end", "title": "" }, { "docid": "71d0cf3b4335cc6db652f5c505e015b4", "score": "0.67034227", "text": "def initialize(key, data)\n @value = data\n @key = key\n end", "title": "" } ]
66e21a458b23cce0f48c359b9d8b7d7d
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
[ { "docid": "e3061c29e5b1c24792771045ed903e06", "score": "0.0", "text": "def context; end", "title": "" } ]
[ { "docid": "d1758edd04b6374162470ca44c3f1250", "score": "0.6871894", "text": "def context\n unless @instance_context\n @instance_context = AuthTokenPromotionContext.new(@version )\n end\n @instance_context\n end", "title": "" }, { "docid": "fcc8d61ebc1b17de32c67ea1c1957759", "score": "0.68632644", "text": "def context\n unless @instance_context\n @instance_context = AnnotationContext.new(@version , @params['call_sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "2445273ba68a741137a17120388e6476", "score": "0.6829915", "text": "def context\n unless @instance_context\n @instance_context = PaymentContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "5720fc377e95040adf525c63a86bddc5", "score": "0.68152946", "text": "def context\n unless @instance_context\n @instance_context = PaymentContext.new(\n @version,\n @params['account_sid'],\n @params['call_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end", "title": "" }, { "docid": "5720fc377e95040adf525c63a86bddc5", "score": "0.68152946", "text": "def context\n unless @instance_context\n @instance_context = PaymentContext.new(\n @version,\n @params['account_sid'],\n @params['call_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end", "title": "" }, { "docid": "c240e207bef26e8e8e95b6ac0776d4ae", "score": "0.6812421", "text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'],)\n end\n @instance_context\n end", "title": "" }, { "docid": "c240e207bef26e8e8e95b6ac0776d4ae", "score": "0.6812421", "text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'],)\n end\n @instance_context\n end", "title": "" }, { "docid": "581b620e95c9f928470f26296226dafe", "score": "0.68051505", "text": "def context\n unless @instance_context\n @instance_context = AddressContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "00769245de1e519e86322abe163d7082", "score": "0.68051076", "text": "def context\n unless @instance_context\n @instance_context = InteractionContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "85d278cf22dd4c8c9d6b4cdbe963ea62", "score": "0.6789391", "text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "85d278cf22dd4c8c9d6b4cdbe963ea62", "score": "0.6789391", "text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "2d7f6b813bd8949cecb0f0ceeb7339e3", "score": "0.67869204", "text": "def context\n unless @instance_context\n @instance_context = AnnotationContext.new(@version, @params['call_sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "dc2dc1b5adbaabb7d7a493527c267322", "score": "0.6786812", "text": "def context\n unless @instance_context\n @instance_context = AddressContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end", "title": "" }, { "docid": "c4c69a584ea5c39267e29996ebb5ba36", "score": "0.6768594", "text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "cf9055a818811a49657f2e0650199480", "score": "0.676732", "text": "def context\n unless @instance_context\n @instance_context = UsageContext.new(@version , @params['sim_sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "c056295e67397fe07982a9654ff37dda", "score": "0.67370147", "text": "def context\n unless @instance_context\n @instance_context = DefaultsContext.new(@version , @params['assistant_sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "33b3cf48e7386aa4e2d41052e1295428", "score": "0.6721106", "text": "def context\n unless @instance_context\n @instance_context = BusinessContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "7a0ea2c7b2174bfdcc58ab9ba4d85bec", "score": "0.6712639", "text": "def context\n unless @instance_context\n @instance_context = TriggerContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "02a67fbcca126532f5180946119737d1", "score": "0.67101777", "text": "def context\n unless @instance_context\n @instance_context = ArchivedCallContext.new(@version , @params['date'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "578c079cb3a8b285f7e41c10ef8a4bee", "score": "0.6683156", "text": "def context\n self.class.new(self)\n end", "title": "" }, { "docid": "b87b17ded93e686370efbafc4d9090b1", "score": "0.66719323", "text": "def context\n unless @instance_context\n @instance_context = CallContext.new(@version, @params['account_sid'], @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "b8b99dd2fc7250138c9a0b7d7bfc51d3", "score": "0.66641396", "text": "def context\n unless @instance_context\n @instance_context = BindingContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "00c2e08b0bb33203cb2772bc8178ad13", "score": "0.6640503", "text": "def context\n unless @instance_context\n @instance_context = CurrentCallContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "4ac1b38a2bd5fb6a381531ac78b0db49", "score": "0.661058", "text": "def context\n unless @instance_context\n @instance_context = InsightsSessionContext.new(@version )\n end\n @instance_context\n end", "title": "" }, { "docid": "34285599f02aa86edf5ea97c0772156d", "score": "0.6598061", "text": "def context\n unless @instance_context\n @instance_context = VerificationContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "903034f7f61bb203e67b8597412ff376", "score": "0.6583486", "text": "def context\n unless @instance_context\n @instance_context = SessionContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "131e24ce83d82272d969c80474876829", "score": "0.65720963", "text": "def context\n unless @instance_context\n @instance_context = AddressConfigurationContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "3088cdfc98ea1d0578658d808d351412", "score": "0.6570465", "text": "def build_context\n InterceptionContext.new(@interceptors)\n end", "title": "" }, { "docid": "e09d899413ef55488ab67dff6536e964", "score": "0.6568277", "text": "def context\n unless @instance_context\n @instance_context = FlowRevisionContext.new(@version , @params['sid'], @params['revision'])\n end\n @instance_context\n end", "title": "" }, { "docid": "8e24d595c9f1589400f46ea71239f6fe", "score": "0.65678656", "text": "def context\n unless @instance_context\n @instance_context = CompositionHookContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "9af871686ca12996803b30d65f00cba2", "score": "0.65605766", "text": "def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version )\n end\n @instance_context\n end", "title": "" }, { "docid": "c220f208ac606837fe07211d6d12ba89", "score": "0.65598965", "text": "def context\n unless @instance_context\n @instance_context = OpenidDiscoveryContext.new(@version )\n end\n @instance_context\n end", "title": "" }, { "docid": "d99c99033983aa98cb0d6164c4ebd1bb", "score": "0.65575325", "text": "def context\n unless @instance_context\n @instance_context = SchemaContext.new(@version , @params['id'])\n end\n @instance_context\n end", "title": "" }, { "docid": "cc5f98b99bcde4453416f11c018824c7", "score": "0.6547554", "text": "def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "cc5f98b99bcde4453416f11c018824c7", "score": "0.6547554", "text": "def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "0f0c25021a49e9ae47d32e5f03d027fa", "score": "0.65415525", "text": "def context\n unless @instance_context\n @instance_context = UserInfoContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "15a735aba07c6128d769098c18bf609e", "score": "0.6540118", "text": "def in_context(*args, &blk)\n context.instance_exec(*args, &blk)\n end", "title": "" }, { "docid": "608cd0811ab01a8105acfcdd2478cb49", "score": "0.65385884", "text": "def context\n unless @instance_context\n @instance_context = OpenidDiscoveryContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "dd5a2ff5b0629944c83e706c23c19589", "score": "0.6533809", "text": "def context\n unless @instance_context\n @instance_context = AccountContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "83c8ca6b6ae353d3f0986c63fa0099ff", "score": "0.6530725", "text": "def context\n unless @instance_context\n @instance_context = VerificationContext.new(@version, @params['service_sid'], @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "83c8ca6b6ae353d3f0986c63fa0099ff", "score": "0.6530725", "text": "def context\n unless @instance_context\n @instance_context = VerificationContext.new(@version, @params['service_sid'], @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "43fc25be3834f897b57dbd9586cdeee3", "score": "0.6529874", "text": "def context\n unless @instance_context\n @instance_context = UserContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "43fc25be3834f897b57dbd9586cdeee3", "score": "0.6529874", "text": "def context\n unless @instance_context\n @instance_context = UserContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "64758baea60be81584b27fc4b4232fdd", "score": "0.64991", "text": "def context\n unless @instance_context\n @instance_context = UserContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "48d66bbc3993fbc9203839b0095c7346", "score": "0.6480533", "text": "def context\n unless @instance_context\n @instance_context = EngagementContextContext.new(\n @version,\n @params['flow_sid'],\n @params['engagement_sid'],\n )\n end\n @instance_context\n end", "title": "" }, { "docid": "a6a28eceb83f842cfdb47fb859dcd2ea", "score": "0.6469857", "text": "def context\n unless @instance_context\n @instance_context = FlexFlowContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "b41e5f14fc36a0de53c06b7203915550", "score": "0.6457765", "text": "def context\n unless @instance_context\n @instance_context = VerificationAttemptContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "bfc2da9ae4d8ca9dadcca48005b3a54d", "score": "0.6454473", "text": "def context\n unless @instance_context\n @instance_context = AssessmentsContext.new(@version, @params['assessment_id'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "d5c43c14da62f029d7656f29c7fbacd7", "score": "0.6450809", "text": "def context\n unless @instance_context\n @instance_context = ContentContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "649e4b17ee907276135ec1c7565eb283", "score": "0.6448604", "text": "def context\n unless @instance_context\n @instance_context = MessageContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "ef3c00c5b2cff11ac25e0c5ae83190b9", "score": "0.6436881", "text": "def context\n unless @instance_context\n @instance_context = FlowTestUserContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "47e3b37a0a36a0fd9122ffd2b1af8767", "score": "0.6429388", "text": "def context\n unless @instance_context\n @instance_context = ImpressionsRateContext.new(@version, @params['business_sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "0d5e07595aece640a960555df93ca04f", "score": "0.63745755", "text": "def context\n unless @instance_context\n @instance_context = UsAppToPersonContext.new(@version , @params['messaging_service_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "45af4642648adf031b1daec173210b5b", "score": "0.63652766", "text": "def context\n unless @instance_context\n @instance_context = DeploymentContext.new(@version , @params['fleet_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "50e376d8169750729d667844e83fb5df", "score": "0.6359984", "text": "def context\n unless @instance_context\n @instance_context = CompositionContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "8175ea272187ea174e767da5f2fffa3e", "score": "0.63521093", "text": "def initialize context\n @context = context\n end", "title": "" }, { "docid": "46273cf4bdbaa5e7a602e7c7fe2707c9", "score": "0.63508445", "text": "def Context(object); end", "title": "" }, { "docid": "241a1d72fd5c22e3a14c7902d2642560", "score": "0.6348875", "text": "def context\n unless @instance_context\n @instance_context = ChallengeContext.new(@version , @params['service_sid'], @params['identity'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "d77d9f7a42a584323bc0279a1ceb13f7", "score": "0.6348709", "text": "def context\n unless @instance_context\n @instance_context = ApprovalFetchContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "c4fd7d27abf2f69158c949d6d7c9c27e", "score": "0.6335909", "text": "def context(entity)\n @context_factory.new(entity,@distance,self)\n end", "title": "" }, { "docid": "2aea04d4971256233b697837f7472c17", "score": "0.6328754", "text": "def initialize context\n @context = context\n end", "title": "" }, { "docid": "de99a84ed76c706ad4e54648d774a47f", "score": "0.6323376", "text": "def context\n unless @instance_context\n @instance_context = WebhookContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "3ba0f913fd4cbf8e4bb78e2606de5520", "score": "0.6322338", "text": "def context\n unless @instance_context\n @instance_context = BuildStatusContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "45f3f48bff38aedc381356f174490bb2", "score": "0.6320355", "text": "def context\n unless @instance_context\n @instance_context = WebhookContext.new(@version )\n end\n @instance_context\n end", "title": "" }, { "docid": "92e2bfcc91c6b49ce9b1563752573af8", "score": "0.6305338", "text": "def context\n unless @instance_context\n @instance_context = ChallengeContext.new(\n @version,\n @params['service_sid'],\n @params['identity'],\n @params['factor_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end", "title": "" }, { "docid": "02cab14eba99becc2af252db0a57529c", "score": "0.63042486", "text": "def context\n unless @instance_context\n @instance_context = AssessmentsContext.new(@version , @params['assessment_sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "6da27fdafa225afd23e30b36581969e5", "score": "0.6302663", "text": "def context\n return @target if @target.is_a?(Module) and not @options[:class_methods]\n\n class << @target\n self\n end\n end", "title": "" }, { "docid": "6da27fdafa225afd23e30b36581969e5", "score": "0.6302663", "text": "def context\n return @target if @target.is_a?(Module) and not @options[:class_methods]\n\n class << @target\n self\n end\n end", "title": "" }, { "docid": "7de3d6a6480a685752a08089857fe236", "score": "0.629561", "text": "def context\n unless @instance_context\n @instance_context = FunctionVersionContentContext.new(@version , @params['service_sid'], @params['function_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "66fee58f5205058224159cd0cb3232b4", "score": "0.6270371", "text": "def context\n @context ||= InitialContext.new( properties )\n end", "title": "" }, { "docid": "22b649bbceefa94b6d70a51474e392e2", "score": "0.6269818", "text": "def context\n @context ||= create_context\n end", "title": "" }, { "docid": "0ef613ead2e95021a4fc43e752869f60", "score": "0.6263613", "text": "def context\n unless @instance_context\n @instance_context = NumberContext.new(@version , @params['destination_number'])\n end\n @instance_context\n end", "title": "" }, { "docid": "5d292ebd43b1ccb17e576233caa8620d", "score": "0.62575567", "text": "def context\n @context ||= Context.new(self)\n end", "title": "" }, { "docid": "d71f61c2041d12695e7b72ad7402d98e", "score": "0.62555313", "text": "def context\n unless @instance_context\n @instance_context = BrandContext.new(@version, @params['business_sid'], @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "baba9df4d5a5f598f56fad39b43d5ff5", "score": "0.6248972", "text": "def context\n unless @instance_context\n @instance_context = ExportContext.new(@version , @params['resource_type'])\n end\n @instance_context\n end", "title": "" }, { "docid": "c5a84eb678b10de70961ab4b36669309", "score": "0.6245866", "text": "def method_missing(method, *args, &block)\n @context.public_send(method, *args, &block)\n end", "title": "" }, { "docid": "80140937adaf7605229391e5b5f5869c", "score": "0.62382895", "text": "def context\n unless @instance_context\n @instance_context = AccessTokenContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "9674e4a36210c9a378b746a4ac70e401", "score": "0.6237742", "text": "def context\n unless @instance_context\n @instance_context = HostedNumberOrderContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "b9260c3a292f7c62186c1bd45a86979f", "score": "0.6236172", "text": "def context\n unless @instance_context\n @instance_context = NumberContext.new(@version , @params['number'])\n end\n @instance_context\n end", "title": "" }, { "docid": "a96c9d530f6e47d7b200f5fe3deca275", "score": "0.6233493", "text": "def context\n unless @instance_context\n @instance_context = SafelistContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end", "title": "" }, { "docid": "eed4a945503e79452f822d0616145ba6", "score": "0.6209724", "text": "def context\n unless @instance_context\n @instance_context = InsightsUserRolesContext.new(@version )\n end\n @instance_context\n end", "title": "" }, { "docid": "82d9d128252b846a3d3d3ce1fefc7c6a", "score": "0.6201323", "text": "def context\n unless @instance_context\n @instance_context = DeactivationsContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "9ef00fdf1d0781f3732e0bb79acd7e24", "score": "0.6197985", "text": "def context\n unless @instance_context\n @instance_context = CallSummaryContext.new(@version, @params['call_sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "a11b4951823ec11fc676569ee161a582", "score": "0.61971056", "text": "def context\n unless @instance_context\n @instance_context = FormContext.new(@version, @params['form_type'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "ba7918d297ea67f1d536c93ce6595c30", "score": "0.6186394", "text": "def context\n @context ||= Context.new(self)\n end", "title": "" }, { "docid": "ba7918d297ea67f1d536c93ce6595c30", "score": "0.6186394", "text": "def context\n @context ||= Context.new(self)\n end", "title": "" }, { "docid": "ba7918d297ea67f1d536c93ce6595c30", "score": "0.6186394", "text": "def context\n @context ||= Context.new(self)\n end", "title": "" }, { "docid": "77ba6358cff02603c0658e61c808df16", "score": "0.6185342", "text": "def context\n unless @instance_context\n @instance_context = JobContext.new(@version , @params['job_sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "73257a418f1c8cf5bb446836ca678840", "score": "0.61847216", "text": "def context\n unless @instance_context\n @instance_context = MediaProcessorContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "1366d218a7f9809533d248a88876974d", "score": "0.61723137", "text": "def context\n extract_ids\n apply_builders\n @ctx\n end", "title": "" }, { "docid": "810495a9282a5056ae8427d9178abe60", "score": "0.61683565", "text": "def initialize(context, options = {})\n @context = context\n @context << self\n @options = options\n setup\n end", "title": "" }, { "docid": "ed5fc4f6b8abf10f5ea1dd50d08630dc", "score": "0.61618596", "text": "def context\n unless @instance_context\n @instance_context = DomainConfigContext.new(@version , @params['domain_sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "c22d5c9ef51f1d7d1250a9757e6f1253", "score": "0.6160789", "text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end", "title": "" }, { "docid": "33fbe17ec7b4c5023e8bcb38ea7685e9", "score": "0.61597556", "text": "def context\n unless @instance_context\n @instance_context = OauthContext.new(@version, )\n end\n @instance_context\n end", "title": "" }, { "docid": "414f54e4fb99a862617f49daf0f7766e", "score": "0.61488277", "text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version, @params['phone_number'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "414f54e4fb99a862617f49daf0f7766e", "score": "0.61488277", "text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version, @params['phone_number'], )\n end\n @instance_context\n end", "title": "" }, { "docid": "2f38ce8c0986f8a6f04234aa08d80f93", "score": "0.61426234", "text": "def context\n unless @instance_context\n @instance_context = TollfreeVerificationContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "56028d01fd3212f95d0a406cad6dcba2", "score": "0.61424047", "text": "def context\n self.class.context\n end", "title": "" }, { "docid": "14b53b35f6d7ef9a21f1edfdfcb1b7f5", "score": "0.6136024", "text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version, @params['phone_number'],)\n end\n @instance_context\n end", "title": "" }, { "docid": "adcf99ccfd064a0e96428363c9ccc1ed", "score": "0.6119371", "text": "def context\n unless @instance_context\n @instance_context = FormContext.new(@version , @params['form_type'])\n end\n @instance_context\n end", "title": "" }, { "docid": "8f73bd0f7b871759dea732b538d4caa8", "score": "0.61156446", "text": "def context\n unless @instance_context\n @instance_context = WorkflowStatisticsContext.new(@version , @params['workspace_sid'], @params['workflow_sid'])\n end\n @instance_context\n end", "title": "" } ]
579acd7b20411c38b4489ef60e09af77
Checks if a user hasn't passed two steps of registration
[ { "docid": "48a1945c5593461ecdf2329ab52fca7f", "score": "0.0", "text": "def passed_profile_steps?\n [profile_name, slug, cost].all?(&:present?)\n end", "title": "" } ]
[ { "docid": "79c7920f7a40bce14319d11f9a24ff6f", "score": "0.7298032", "text": "def registered?\n not user.nil?\n end", "title": "" }, { "docid": "58502f272febe13be0a413a7da85e8a2", "score": "0.7244451", "text": "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if current_user or not current_order.user.anonymous?\n redirect_to checkout_registration_path\n end", "title": "" }, { "docid": "ff138bf377c36846148a4b9c02805a86", "score": "0.7177002", "text": "def registration_complete?\n person.try(:persisted?) && person.user.try(:persisted?)\n end", "title": "" }, { "docid": "788fcc63ab4c3b844dde85dd89e5124b", "score": "0.7153809", "text": "def completed_registration?\n current_user.mobile_verified? && current_user.docs_uploaded? && current_user.address_entered?\n end", "title": "" }, { "docid": "5f19a5cd65601f1630805e2a6015e947", "score": "0.7128432", "text": "def check_new_registration_allowed?\n redirect_to root_path unless Control.first.registrations_enabled\n end", "title": "" }, { "docid": "df54a4779bd5a77578385d27175cf3f4", "score": "0.71231955", "text": "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if Spree::Config[:allow_guest_checkout] and current_order.email.present?\n return if current_user or not current_order.user.anonymous?\n redirect_to checkout_registration_path\n end", "title": "" }, { "docid": "136995a5edc5996f98c6fe764c43a2d2", "score": "0.7118135", "text": "def can_signup? roster\n !already_signed_up?(roster)\n end", "title": "" }, { "docid": "8e44c5c5c17e8d154906c67803b73825", "score": "0.7078596", "text": "def registration_complete?\r\n attempted_record && attempted_record.valid?\r\n end", "title": "" }, { "docid": "4a137f0181f2cbbcfd0a1e059c06a4d5", "score": "0.707193", "text": "def registration_complete?\n\t\t\t\tattempted_record && attempted_record.valid?\n\t\t\tend", "title": "" }, { "docid": "c50d33ac979575d756810bcacbff063d", "score": "0.70675486", "text": "def registration_done?\n propose_done? && registered_on_uc? && registered_on_vc?\n end", "title": "" }, { "docid": "be4ea56cc50f040c4481349b2698ff56", "score": "0.7064671", "text": "def check_registration\n return unless ::Refinery::Setting.find_or_set(:registration_step, true)\n return if spree_current_user or current_order.email\n redirect_to spree.checkout_registration_path\n end", "title": "" }, { "docid": "daaaeb631769688fe45ede7e6d3142a0", "score": "0.7053401", "text": "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if current_user or current_order.email\n store_location\n redirect_to checkout_registration_path\n end", "title": "" }, { "docid": "daaaeb631769688fe45ede7e6d3142a0", "score": "0.7053401", "text": "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if current_user or current_order.email\n store_location\n redirect_to checkout_registration_path\n end", "title": "" }, { "docid": "423f1836ed05e0cb0261df7b4f353fc8", "score": "0.6986898", "text": "def registration_required\n if current_user.joined_on.blank?\n # A user without an birth_date is a telltale sign of someone who hasn't yet\n # registered with PoT. So we'll collect the needed metadata from\n # them before returning them to original destination URL.\n store_location\n redirect_to setup_users_url\n end\n end", "title": "" }, { "docid": "61435adbc0df0a26f035c48cf3db69df", "score": "0.6950868", "text": "def verify_register_conclusion\n if !@user.is_completed?\n flash[:notice] = \"Conclua sua inscrição para acessar todas as funções do sistema\"\n \tredirect_to cadastro_completar_path\n end\n end", "title": "" }, { "docid": "04916826961d78029548b72ec490263c", "score": "0.6948991", "text": "def check_user_signup_allowed\n redirect_to root_path unless Rails.configuration.allow_user_signup\n end", "title": "" }, { "docid": "2afb241ed3c7fed40b8c9a93765b8cbe", "score": "0.69348264", "text": "def check_signup_complete!\n if current_user && current_user.account && !current_user.account.free_plan?\n unless @user.account.signup_complete == true\n sign_out :user \n redirect_to \"/\"\n end\n end\n end", "title": "" }, { "docid": "5fad4e71a78a00d10bfc0eeb8890020d", "score": "0.69186413", "text": "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if spree_current_user or current_order.email\n store_location\n redirect_to spree.checkout_registration_path\n end", "title": "" }, { "docid": "d974edc8dd2cd5ea6aabcdea58ad6337", "score": "0.68920153", "text": "def check_signup_allowed\n if Setting.signup == false\n flash[:error] = t(:signup_disabled)\n redirect_back_or_default(root_path)\n end\n end", "title": "" }, { "docid": "11802da42a08439a197120b4f8731a01", "score": "0.6884488", "text": "def verify_user_steps!\n return if devise_controller?\n return unless user_signed_in?\n return if current_user.terms\n redirect_to after_signup_path(:terms),notice: 'You most accept Terms and conditions.'\n end", "title": "" }, { "docid": "543c4d411e46bb4d5343fdaaafcf6817", "score": "0.6867956", "text": "def check_registration\n logger.debug \"overriding check_registration to not allow through without spree_current user (previously was allowing if order had email but we want to force them to login)\"\n return unless Spree::Auth::Config[:registration_step]\n if Spree::Config[:allow_guest_checkout]\n return if spree_current_user or current_order.email\n else\n return if spree_current_user #or current_order.email\n end\n store_location\n redirect_to spree.checkout_registration_path\n end", "title": "" }, { "docid": "2c899fba2569624031819b766d4d9db6", "score": "0.68340594", "text": "def check_new_registration_allowed?\n return true if Setting.allow_signup?\n\n redirect_to root_path\n flash[:alert] = 'New pilot registration is currently disabled'\n end", "title": "" }, { "docid": "07e43e4529639885f2f97bb327b48c0a", "score": "0.678739", "text": "def registered?\n begin\n self.get_registration\n true\n rescue => e\n # any error should be treated as the user not being registered\n false\n end\n end", "title": "" }, { "docid": "6989be9cb8adc3f0e439413536dd4c09", "score": "0.6780053", "text": "def check_signup\n redirect_to new_user_session_path unless APP_CONFIG.enabled?(\"signup\")\n end", "title": "" }, { "docid": "4d07f3c1d23d35bd48522e3798bb6170", "score": "0.67790806", "text": "def redirects_to_signup?\n !@profile_id.nil?\n end", "title": "" }, { "docid": "37906f6da7378ece3a9a842a68a3b3c3", "score": "0.676489", "text": "def registration_done?\n send(\"#{GlobalConstant::ClientToken.propose_done_setup_step}?\") &&\n send(\"#{GlobalConstant::ClientToken.registered_on_uc_setup_step}?\") &&\n send(\"#{GlobalConstant::ClientToken.registered_on_vc_setup_step}?\") &&\n send(\"#{GlobalConstant::ClientToken.setup_complete_step}?\")\n end", "title": "" }, { "docid": "a32519460a88f220d613bd02cc90d044", "score": "0.6751087", "text": "def verify_config\n if User.count.zero?\n redirect_to admin_signup_url\n else\n true\n end\n end", "title": "" }, { "docid": "a32519460a88f220d613bd02cc90d044", "score": "0.6751087", "text": "def verify_config\n if User.count.zero?\n redirect_to admin_signup_url\n else\n true\n end\n end", "title": "" }, { "docid": "e7e10a7014e6a8c031c52b46353e9223", "score": "0.67448497", "text": "def ensure_signup_complete\n # Ensure we don't go into an infinite loop\n return if action_name == 'finish_signup'\n return if current_user.class == Saler\n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n if current_user && !current_user.email_verified?\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "0713325ca38149a84fea2fa4c4071e0d", "score": "0.67395777", "text": "def encourages_registration?(user)\n accepts_registration? and\n\tuser.enrollments.find(:all, :joins=>:registration_role, :conditions=>{:registration_roles=>{:event_id=>self.id}} ).blank? and\n\tuser.registrations.find(:all, :joins=>:registration_role, :conditions=>{:registration_roles=>{:event_id=>self.id}} ).blank?\n end", "title": "" }, { "docid": "be50b1a4fcfc40e5991e0966ca7ac8f6", "score": "0.67267185", "text": "def check_signup\n redirect_to(user_path(current_user)) if signed_in?\n end", "title": "" }, { "docid": "dc7ac8a2b1e74bdae402cdad814ffc0d", "score": "0.6711666", "text": "def redirects_to_signup?\n false\n end", "title": "" }, { "docid": "f58d3306e8c822d9bef3e1eb5eccd5e0", "score": "0.6701977", "text": "def check_registration\n #return unless Spree::Auth::Config[:registration_step]\n #return if current_user or current_order.email\n #store_location\n #redirect_to checkout_registration_path\n end", "title": "" }, { "docid": "6c1cf5d9517504e9005b71bbdfa25618", "score": "0.6688977", "text": "def user_registered? user\n user.present? && registrations.where(user_id: user.id).count > 0\n end", "title": "" }, { "docid": "31c1c9e815c9aeb22ee629b7d2801361", "score": "0.6657041", "text": "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if current_user or current_order.email\n store_location\n if @order.virtual?\n redirect_to virtual_checkout_registration_path(:virtual)\n else\n redirect_to checkout_registration_path()\n end\n end", "title": "" }, { "docid": "73ffe1dea8920ec91ebf810994c34c6e", "score": "0.66560763", "text": "def check_student_registration\n if user_signed_in?\n if current_user.student.nil? && !current_user.is_admin? && !current_user.is_professor?\n redirect_to new_student_path\n end\n end\n end", "title": "" }, { "docid": "7838f0c6ceecd0bafc694d3af5d0320d", "score": "0.66420835", "text": "def check_signup\n\t\t@user = current_user\n\t\tif current_user.roles.present?\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "title": "" }, { "docid": "9475e9207b37e5a01342235a6313816a", "score": "0.6586907", "text": "def user_must_exist\n return if self.user_id.nil?\n errors.add(:user_id, \"must be a registered user\") if User.find(self.user_id).nil?\n end", "title": "" }, { "docid": "72f0f201aece27263f3b18bd66d8bb50", "score": "0.6577159", "text": "def check_if_registered\n @user ||= User.find_by_andrewid(params[:user][:andrewid])\n unless @user\n flash[:error] = \"User \\\"\" + params[:user][:andrewid] + \"\\\" is not registered.\"\n redirect_to sessions_url\n end\n end", "title": "" }, { "docid": "a2dcad421c53ee7b49035cb9fd26aea3", "score": "0.6575271", "text": "def check_firecloud_registration\n if user_signed_in?\n if current_user.registered_for_firecloud?\n true # do nothing as we're ok\n else\n if user_fire_cloud_client(current_user).registered?\n current_user.update(registered_for_firecloud: true)\n true\n else\n redirect_to profile_path, notice: 'You must register before using Unity - please fill out the profile form and submit.' and return\n end\n end\n end\n end", "title": "" }, { "docid": "1887b2442501f74268d330369f80b497", "score": "0.65714943", "text": "def isThisMyRecord?\n # edit if it is your own registration\n if !(@user==current_user)\n error= \"#{current_user.email} is not authorized to view the profile of another user.\"\n redirect_to user_path(current_user), alert:error\n end\n end", "title": "" }, { "docid": "94c85c8edbdc435026c999a73905be46", "score": "0.6563303", "text": "def from_registered_user?\n !user_id.nil?\n end", "title": "" }, { "docid": "da0ee93cf8b0d52c1aaf9131072e389a", "score": "0.65630996", "text": "def dont_validate_password?\n impulse_signup || omniauth_signup\n end", "title": "" }, { "docid": "71561ff7e913d4b54568958b8c7e9c22", "score": "0.65596426", "text": "def one_user_registered?\n if User.count == 1\n if user_signed_in?\n redirect_to root_path\n else\n redirect_to new_user_session_path\n end\n end \n end", "title": "" }, { "docid": "6e1d7afca5ed1567a17f0a036cf1fadd", "score": "0.6556884", "text": "def check_registration\r\n # return unless Spree::Auth::Config[:registration_step]\r\n # return if current_user\r\n # if !params[:confirmation_token].blank? and params[:confirmation_token] == current_order.user.confirmation_token\r\n # current_order.user.confirm!\r\n # flash[:notice] = 'Your email has been validated.'\r\n # end\r\n # # allow guest to move to cart for 20 minutes\r\n # return if !current_order.user.blank? and current_order.user.confirmed_at and current_order.user.confirmed_at > DateTime.now - 20.minutes and !current_order.email.nil?\r\n # store_location\r\n # redirect_to spree.checkout_registration_path\r\n end", "title": "" }, { "docid": "fe06bf2735712d40f1134a021619f7ca", "score": "0.6550993", "text": "def check_user_registered1\n if (LadderUser.find_by username: player1).blank?\n errors.add(:player1, \"Player 1 is not registered\")\n end\n end", "title": "" }, { "docid": "225c7d09e41fc19b946d13abecf40690", "score": "0.65393764", "text": "def complete\n @user = current_user || current_registering_user\n redirect_to new_user_path unless @user\n end", "title": "" }, { "docid": "1d0754262a95d6cca0b00703757c219f", "score": "0.65343046", "text": "def allow_sign_up?\n @allow_sign_up\n end", "title": "" }, { "docid": "0bb765e21fb7a873521608c3d728c82e", "score": "0.65228045", "text": "def check_dealer_registration\n # Always want registration so comment out config\n #return unless Spree::Auth::Config[:registration_step]\n return if spree_current_user\n store_location\n redirect_to spree.dealer_registration_path\n end", "title": "" }, { "docid": "566d351c3b338b40a891c80ae5f1c4ae", "score": "0.65211433", "text": "def ensure_signup_complete\n # Ensure we don't go into an infinite loop\n return if action_name == 'finish_signup'\n\n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n if current_user && !current_user.email_verified?\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "566d351c3b338b40a891c80ae5f1c4ae", "score": "0.65211433", "text": "def ensure_signup_complete\n # Ensure we don't go into an infinite loop\n return if action_name == 'finish_signup'\n\n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n if current_user && !current_user.email_verified?\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "566d351c3b338b40a891c80ae5f1c4ae", "score": "0.65211433", "text": "def ensure_signup_complete\n # Ensure we don't go into an infinite loop\n return if action_name == 'finish_signup'\n\n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n if current_user && !current_user.email_verified?\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "566d351c3b338b40a891c80ae5f1c4ae", "score": "0.6520667", "text": "def ensure_signup_complete\n # Ensure we don't go into an infinite loop\n return if action_name == 'finish_signup'\n\n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n if current_user && !current_user.email_verified?\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "b2bf0850d156501e4e886d413fa93cf2", "score": "0.6513203", "text": "def login_required\n if authorized? \n current_account.complete? ? true : unfinished_registration \n else \n access_denied\n end\n end", "title": "" }, { "docid": "23f3079f10e0bef56cfc220cbcb8a144", "score": "0.6496735", "text": "def open_for_registration?\n return false if completed?\n return false unless registration_date_passed?\n return false unless space_available?\n true\n end", "title": "" }, { "docid": "ad86bb008aaab3c2b28b2ea8ecd99efb", "score": "0.6490564", "text": "def user_needs_password(user)\n !user.google_sign_in && user.enable_account_token.nil? && !user.created_with_invitation?\n end", "title": "" }, { "docid": "4c2e2a8ce9d97f99980f5ebd1feac7a4", "score": "0.64842016", "text": "def ensure_signup_complete\n # Ensure we don't go into an infinite loop\n \n return if action_name == 'finish_signup'\n \n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n \n # if the current user is current and is not verified\n if current_user && !current_user.email_verified? # change the redirect to:\n # # redirect to '/profiles/4/edit' after signing up first time\n # if user allready exist redirect to '/upcoming'\n\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "620c6857b05fde224d7c1074c8833031", "score": "0.64838505", "text": "def ensure_signup_complete\n return if devise_controller?\n # Ensure we don't go into an infinite loop\n return if action_name == 'finish_signup'\n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n if current_user && !current_user.email_verified?\n flash[:notice] = 'Please confirm your email address before continuing'\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "6a3e1b76b1a8387834a49fab7918300b", "score": "0.64759594", "text": "def authenticate_user_or_signup!\n unless current_user\n redirect_to new_user_registration_path\n false\n end\n\n true\n end", "title": "" }, { "docid": "718e18560895c289e73f304ff97e37ae", "score": "0.64731586", "text": "def ensure_signup_complete\n # Ensure we don't go into an infinite loop\n return if !user_signed_in? || action_name == 'finish_signup'\n\n # Redirect to the 'finish_signup' page if the user\n # email hasn't been verified yet\n if current_user && !current_user.email_verified?\n redirect_to finish_signup_path(current_user)\n end\n end", "title": "" }, { "docid": "6fd23eab5a47b1772875db508d38052b", "score": "0.64533705", "text": "def creatable_by? (user)\n user.has_permission?(Permission.register_user)\n end", "title": "" }, { "docid": "f23796025d46f4cc25eb4f101d22474a", "score": "0.64462394", "text": "def check_new_user\n if current_user.name.nil?\n redirect_to my_account_user_path(current_user.id), notice: \"Fill in Details.\"\n end\n end", "title": "" }, { "docid": "eeeb796433ba0cc5213d01feaf930758", "score": "0.644472", "text": "def requires_registration\n redirect_to :root unless current_registration\n end", "title": "" }, { "docid": "948667009a242efcfa012b470c3affe6", "score": "0.6441603", "text": "def user_registered?\n if session[:id] != nil\n true\n else\n false\n end\n end", "title": "" }, { "docid": "3f4b6f09b1c51f35c5cadcd96935d68a", "score": "0.644146", "text": "def registered?\n !!@nick && !!@email && !!@real_name\n end", "title": "" }, { "docid": "121cfd9f9078752c02bd1a9c32ef7365", "score": "0.644009", "text": "def new_registration?\r\n new_registration || !new_registration.nil?\r\n end", "title": "" }, { "docid": "4fd78761a479258081a580ea9e11a3ed", "score": "0.6440038", "text": "def registration_allowed\n if !app_settings.allow_new_registration\n flash[:error] = \"Registration is currently offline, please check back later.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "821b2feede4c6731e467fc92f33e404a", "score": "0.64353645", "text": "def already_set_up\n \tredirect_to root_path and return if User.count > 0\n end", "title": "" }, { "docid": "e06bcff89515a2c371be7eeb63d55097", "score": "0.64329517", "text": "def check_user_qualifications\n redirect_to edit_account_activation_url(@user.perishable_token) and return unless @user.account\n end", "title": "" }, { "docid": "8b56675d23a062a0b25218f6df333860", "score": "0.64325476", "text": "def new?\n #debugger\n if !user.nil?\n if(user.role == \"Admin\") \n #debugger\n true\n else \n #debugger\n false\n end\n end\n #true #if nothing worked up\n #if its false nobody can sign up\n #debugger\n #its coming to this method now we just need to \n end", "title": "" }, { "docid": "d6e024152b403f2134c07721e73783d1", "score": "0.6430869", "text": "def registration_closed?\n reg_closed && !authorized_laptop && !late_registrant?\n end", "title": "" }, { "docid": "55dfc387e15c612e70f9ed9e4eadc4a6", "score": "0.6430854", "text": "def user_required\n\t\treturn true if true\n\tend", "title": "" }, { "docid": "d69f838c53fe985895682e9bf338f65b", "score": "0.6427843", "text": "def new_user_verification?\n true\n end", "title": "" }, { "docid": "bb484cbaef5d48e190ef968066b79da2", "score": "0.6426447", "text": "def user_was_created_but_not_confirmed?\n user && !user.confirmed?\n end", "title": "" }, { "docid": "1ae8639abfd2667cb2ea1ce6c7aaa1d7", "score": "0.6416765", "text": "def email_required?\n registration?\n end", "title": "" }, { "docid": "1ae8639abfd2667cb2ea1ce6c7aaa1d7", "score": "0.6416765", "text": "def email_required?\n registration?\n end", "title": "" }, { "docid": "3b47af4c4490d4f7064244f179dafb2a", "score": "0.6415939", "text": "def signup_complete?\n self.signup_complete\n end", "title": "" }, { "docid": "55c11bed7eac8cec91c748429316ae4c", "score": "0.6401118", "text": "def ensure_signup_complete\n\t # Ensure we don't go into an infinite loop\n\t return if action_name == 'finish_signup'\n\t \n\t # Redirect user to home page if he's not signed in\n\t unless signed_in?\n\t \tredirect_to root_path\n\t \treturn;\n\t end\n\n\t # Redirect to the 'finish_signup' page if the user email is blank\n\t if current_user.email.nil? || current_user.email.empty?\n\t\t\tredirect_to finish_signup_user_path(current_user)\n\t\tend\n\tend", "title": "" }, { "docid": "6c4292609c79e3ed4497c0eba6f7684f", "score": "0.6398424", "text": "def check_user_qualifications\n redirect_to edit_user_activation_url(@user.perishable_token) and return if @user.account\n end", "title": "" }, { "docid": "3037ed068f984d872dfa803f5d5ebcb3", "score": "0.638751", "text": "def check_initializer\n return unless current_user\n #get required account\n required_user_accounts = ApplicationHelper::USER_ACCOUTNS.dup.reject{|ua| \n [\n ['MailGun邮箱账户', 'mailgun_name'],\n ['MailGun邮箱密码', 'mailgun_password'],\n ['Google邮箱账户', 'gmail_name'],\n ['Google邮箱密码', 'gmail_password']\n ].include?(ua)}\n \n # if params[:controller] != 'user_accounts' &&\n # current_user.sites.any? &&\n # current_user.user_accounts.size < required_user_accounts.size\n \n # redirect_to user_accounts_url, :alert => \"请在做其他操作前,在这里将账户信息完善了。账户信息绑定到每个应用的功能。\" and return\n # end\n end", "title": "" }, { "docid": "56d96362e9d6c5ae8dc41df495d9e87a", "score": "0.6383675", "text": "def registered?\n @current_account && @current_account.role != \"guest\"\n end", "title": "" }, { "docid": "432935476c0f44bdbac6279f8150fc2f", "score": "0.63738585", "text": "def dont_allow_user_self_registration\n if ['devise/registrations','devise_invitable/registrations'].include?(params[:controller]) && ['new','create'].include?(params[:action])\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "aa0f363fa4255924e0bcc7cc98e25e11", "score": "0.63560784", "text": "def registration_allowed\n return if !defined?(registration_allowed?) or registration_allowed?\n flash[:alert] = 'Rejestracja nowych użytkowników jest obecnie wyłączona'\n redirect_to SimplyAuthenticate::Settings.default_logged_out_redirect_to\n end", "title": "" }, { "docid": "a44334675d1fe1a154178d99f1122e58", "score": "0.63543767", "text": "def is_registration_required\n return @is_registration_required\n end", "title": "" }, { "docid": "6f66495a606b3e37c54703cfc0b105a6", "score": "0.63537043", "text": "def user_exists_but_force_password_reset?\n return true if id && confirmed_at.present? && reset_password_token.present? \\\n && last_sign_in_at.blank? && last_sign_in_ip.blank?\n false\n end", "title": "" }, { "docid": "875bda579c6ad0ef1bd31cabbc68fbb3", "score": "0.63345087", "text": "def register?\n false\n end", "title": "" }, { "docid": "9fabab0fd3c51c203e74b9b73db1d605", "score": "0.63311654", "text": "def create?\n user.admin? || user.is_valid?\n end", "title": "" }, { "docid": "9fabab0fd3c51c203e74b9b73db1d605", "score": "0.63311654", "text": "def create?\n user.admin? || user.is_valid?\n end", "title": "" }, { "docid": "739b36a4b1e3239602b69bcc4da37764", "score": "0.630121", "text": "def check_for_accountant_create_user\n if session[:usertype] == \"accountant\" and session[:acc_user_create] != 2\n dont_be_so_smart\n redirect_to(:controller => \"callc\", :action => \"main\") and return false\n end\n end", "title": "" }, { "docid": "823bd2258a25f1a18d84a9e0a0c460b5", "score": "0.6300739", "text": "def valid_non_user\n #puts \"VALID USER - USER DEVICE TOKENS #{@device_tokens} #{@first_name} #{@phone_number} #{@last_name} \"\n return (!@phone_number.nil? && !@phone_number.empty? && !@first_name.nil? && !@first_name.empty? && !@last_name.nil? && !@last_name.empty? )\n\n end", "title": "" }, { "docid": "ef5c7010d21348594d410e697bb7bc50", "score": "0.6290409", "text": "def new_registration?\n\t\t\t\tnew_registration || !new_registration.nil?\n\t\t\tend", "title": "" }, { "docid": "dc8918f1c3f7496241b59085f170df05", "score": "0.6280132", "text": "def sign_up_finished_but_email_not_confirmed?\n @identity.update(identity_params) && !@identity.confirmed?\n end", "title": "" }, { "docid": "f7f447c821b8c58512b50196dbb9e099", "score": "0.6277752", "text": "def creatable_by? (user)\n user.has_permission? Permission.register_device\n end", "title": "" }, { "docid": "b45d1082b483c99e413866f170282eb0", "score": "0.62756664", "text": "def require_no_fb_user\n # If this user has already registered via facebook, redirect to member page\n begin\n if params[:user] && params[:user][:facebook_id] && !params[:user][:facebook_id].blank?\n if Member.from_facebook(params[:user][:facebook_id])\n flash[:notice] = \"Your Facebook account is already connected to an Eternos account. If you would like to create a new Eternos account, remove the Eternos application from your Facebook settings first then try again.\"\n redirect_to logout_url and return false\n end\n end\n rescue\n true # Allow them to continue\n end\n end", "title": "" }, { "docid": "7e76a0c19d79845cfcbe429802d89f83", "score": "0.6273242", "text": "def password_required?\n return false if @skip_password\n accounts.empty? and super\n end", "title": "" }, { "docid": "e243f395aeebfd8a45ffafb38f02263b", "score": "0.62731713", "text": "def verificationUserNotRepit(user)\n userp = searchUserByUsername(user)\n if !userp.nil?\n user.errors.add(:username,\"The user is repeated, please introdeced other\")\n end\n end", "title": "" }, { "docid": "099562882f89245b37651814063c26fb", "score": "0.62694144", "text": "def is_registration_open?\n return Register.form rescue false\n end", "title": "" }, { "docid": "41bc31f456036aa943a61d131d9088c2", "score": "0.6268771", "text": "def require_user\n unless get_user\n redirect_to(Person, :alert => \"Please sign in.\")\n return false\n end\n true\n end", "title": "" }, { "docid": "3f33c14ddbc882b03a3728dfb30a80d0", "score": "0.6267739", "text": "def redirect_to_account_page!\n unless current_user.user_information.is_registered?\n flash[:error] = \"Kindly complete your registration first.\".html_safe\n redirect_to account_url\n end\n end", "title": "" }, { "docid": "a0d60e9b970f92255ee41ec3c636fa8b", "score": "0.6260507", "text": "def check_for_user\n redirect_to new_user_path unless @current_user.present?\n end", "title": "" }, { "docid": "4ff9601f015b5f9ecdf719151c8d4466", "score": "0.62585026", "text": "def test_post_register_with_registration_on\n with_settings :self_registration => '3' do\n assert_difference 'User.count' do\n post :register, :user => {\n :login => 'register',\n :password => 'secret123',\n :password_confirmation => 'secret123',\n :firstname => 'John',\n :lastname => 'Doe',\n :mail => 'register@example.com'\n }\n assert_redirected_to '/my/account'\n end\n user = User.first(:order => 'id DESC')\n assert_equal 'register', user.login\n assert_equal 'John', user.firstname\n assert_equal 'Doe', user.lastname\n assert_equal 'register@example.com', user.mail\n assert user.check_password?('secret123')\n assert user.active?\n end\n end", "title": "" } ]
799b91518f36c4d03bdc391e0fcbdb85
Test when guest is added to full room
[ { "docid": "4e3e2c641cff322b2605b8e231e19652", "score": "0.7576641", "text": "def test_check_entry_full\n @room.add_guest(@guest1)\n @room.add_guest(@guest2)\n @room.add_guest(@guest3)\n assert_equal(\"Room full!\",@room.check_entry_and_add_guest(@guest1))\n end", "title": "" } ]
[ { "docid": "0289297342b2f25f814437e04aeef6a1", "score": "0.76355004", "text": "def test_try_add_guest_to_room\n @room1.add_guest_to_room(@guest1)\n assert_equal(1,@room1.guest_count)\n end", "title": "" }, { "docid": "4769b7138771a5d5c6d7324fc46b2c32", "score": "0.7609797", "text": "def test_add_guest__exist_in_room()\n @room1.add_guest(@guest1)\n @room1.add_guest(@guest1)\n assert_equal(1,@room1.guests.count())\n end", "title": "" }, { "docid": "7b924ce4f2f3144e1cdd3c59e1bb9daf", "score": "0.752639", "text": "def test_add_guest()\n @room1.add_guest(@guest3)\n assert_equal(3, @room1.guests.length())\n end", "title": "" }, { "docid": "a0e4021e617de39bd20d62c18da5d93f", "score": "0.75211716", "text": "def test_add_guest_to_room\n @room.add_guest_to_room(@guest1)\n assert_equal(1, @room.number_of_guests())\n end", "title": "" }, { "docid": "80b9f775e2c60f70ac3075a7ac2ca772", "score": "0.749685", "text": "def test_full_room()\n @room2.guest_enter(@guest)\n @room2.guest_enter(@guest)\n assert_equal(true, @room2.full_room)\n end", "title": "" }, { "docid": "41bc29d99f462a311f8c9cd1a9f587cf", "score": "0.74712414", "text": "def test_can_check_room_is_full_and_enter()\n @room1.guest_enter(@guest)\n @guest.venue_fee(10)\n assert_equal(1, @room1.guest.length)\n assert_equal(0, @guest.money)\n end", "title": "" }, { "docid": "3ce187b2a683f164e169e00f315fa0b7", "score": "0.74261165", "text": "def test_room_at_capacity__return_false_you_may_enter\n @room.add_guest_to_room(@guest1)\n assert_equal(\"Come on in\", @room.room_at_capacity())\n end", "title": "" }, { "docid": "5adb3ddf611ab1f227c7a850f8914e31", "score": "0.7340957", "text": "def check_in_guest(guest)\n if @guest.count < @capacity\n @guest.push(guest)\n else\n return \"fail no availability try another room\"\n end\n end", "title": "" }, { "docid": "18e230571e06f9a5114b3805a1b7fc7a", "score": "0.7339733", "text": "def test_check_entry_full\n @room.add_guest(@guest1)\n @room.add_guest(@guest3)\n @room.check_entry_and_add_guest(@guest1)\n assert_equal(3,@room.guests.count)\n end", "title": "" }, { "docid": "c13463170829f2d044c4f2551ef776c6", "score": "0.72890353", "text": "def test_room_starts_empty_of_guests()\n assert_equal(0, @room1.guest_count())\n end", "title": "" }, { "docid": "1cb519be79b7c2a3321dbe184d44f0a2", "score": "0.7274386", "text": "def check_in_guest(guest)\n check_room_under_capacity ? @guests << guest : @full_message\n end", "title": "" }, { "docid": "29c01b1c970840b6b1f853f7d81e1bd2", "score": "0.7262862", "text": "def test_room_at_capacity__return_true_no_entry\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n assert_equal(\"Sorry, this room is full\", @room.room_at_capacity())\n end", "title": "" }, { "docid": "11fd30b1fe465b35c006f53704f26792", "score": "0.72098213", "text": "def test_guest_check_in__over_capacity()\n @room1.add_guest(@guest3)\n #@room1.add_guest(@guest4)\n assert_equal(\"Woah Nelly, there's too many people here!\", @room1.check_guest_in(@guest4))\n end", "title": "" }, { "docid": "fee2301c1247414237506f24ecccc341", "score": "0.7209007", "text": "def check_in(guest)\n if can_afford_entry(guest) && can_fit_room(guest)\n @guests_in_room.push(guest)\n end\n end", "title": "" }, { "docid": "b4e0dc457075ec875cd525c2a8857940", "score": "0.72078407", "text": "def test_can_enter_room_if_at_capacity\n room = Room.new(1, 1)\n room.enter(@guest1)\n\n assert_equal(false, room.enter(@guest2))\n end", "title": "" }, { "docid": "d1d87d7aa5fca09a85bbbe52a89f8417", "score": "0.7136217", "text": "def test_guest_check_in__under_capacity()\n @room1.check_guest_in(@guest4)\n assert_equal(3, @room1.guests.length())\n end", "title": "" }, { "docid": "c97f0f6848003f8d100086b3bd151920", "score": "0.7031776", "text": "def test_add_guest__no_more_seats()\n @room1.add_guest(@guest1)\n @room1.add_guest(@guest2)\n assert_equal(2,@room1.guests.count())\n end", "title": "" }, { "docid": "ab15a35d13e433c32c4bf9c4b925e0c7", "score": "0.70140433", "text": "def check_in(guest, room)\n if guest_can_afford_room(guest, room) && room_has_space(room)\n room.add_guest(guest)\n deduct_money(guest, room.price)\n end\n end", "title": "" }, { "docid": "91db4cda345a808d101d4cd744543c53", "score": "0.700138", "text": "def check_guest_into_room(guest)\n if @guests.length < @capacity\n @guests.push(guest)\n # if this was in the bar class would call allocate_excess_guests method at this point\n end\n end", "title": "" }, { "docid": "905fd25e90941cbfd83363cfcf7acff1", "score": "0.699602", "text": "def test_for_add_guest\n assert_equal(0,@venue.guests.length)#assert 0 guests\n @venue.add_guest(@gina)#push /shovel guest\n assert_equal(1,@venue.guests.length)#check guest list increased\n end", "title": "" }, { "docid": "e3e7116a1ae3abecfb26c3f1bfd7add5", "score": "0.6993993", "text": "def remove_guest_from_room()\n @room.remove_guest_from_room\n assert_equal(2, @room.count_occupants)\n end", "title": "" }, { "docid": "3154589ad63051080db6e390afb8df04", "score": "0.697602", "text": "def test_guests_checked_into_room\n @room1.guest_check_in(@guest1)\n assert_equal(1, @room1.guests_number())\n end", "title": "" }, { "docid": "4d2a852227d3fbcbb0a169463d0112b8", "score": "0.69157815", "text": "def test_room_can_check_in_guest__sufficient_capacity\n @room1.check_in_guest(@guest2)\n @room1.check_in_guest(@guest3)\n assert_equal(2, @room1.count_occupants())\n end", "title": "" }, { "docid": "4c1ff83fcf42fef510138c6a38a66436", "score": "0.68217576", "text": "def test_add_guest__pay_failed()\n dr_poor = Guest.new(\"Dr poor\",5,5.0)\n @room1.add_guest(dr_poor)\n assert_equal(0,@room1.guests.count)\n end", "title": "" }, { "docid": "d3eb24d3d064db8ce0bd18d860545996", "score": "0.6756643", "text": "def check_in(guest1, room)\n if room.length <= 4\n p \"welcome, #{guest1}\" && room << guest1\n else room.length >= 5\n p \"no room, #{guest1}\"\n end\nend", "title": "" }, { "docid": "988abd3b3cc4cdc31c828caa4244dadb", "score": "0.667725", "text": "def test_check_in_guest()\n assert_equal(0, @room_1.check_in_count()) #check blank array\n @room_1.check_in_guest(@guest_1) #check one guest in should return 1\n assert_equal(1, @room_1.check_in_count()) #check guest has been added\n @room_1.check_in_guest(@guest_2) #check guest 2 in should return 2\n assert_equal(2, @room_1.check_in_count()) #check second guest can be added\n end", "title": "" }, { "docid": "1b5eccb4ba931621eaa755f4ce46841b", "score": "0.6671695", "text": "def test_remove_guest_from_room\n @room.add_guest_to_room(@guest1)\n @room.remove_guest_from_room(@guest1)\n assert_equal(0, @room.number_of_guests())\n end", "title": "" }, { "docid": "9ee3950c330ab90deee2c58aacf29e26", "score": "0.6662652", "text": "def test_check_in()\n @new_guest = Guest.new(\"Bill\", 20, \"Regulate\", \"Good Juice\")\n assert_equal(@new_guest.name(), @room.check_in(@new_guest))\n assert(@guests.length() > 3)\n end", "title": "" }, { "docid": "7e3ed0267fd29a4e898b3be729d769c3", "score": "0.6609839", "text": "def test_get_guests\n @room.add_guest(@guest1)\n @room.add_guest(@guest2)\n assert_equal([\"Kylie\",\"Janis\"],@room.get_guests)\n end", "title": "" }, { "docid": "ce6e373fd9c90f19224772a6684f9475", "score": "0.6562969", "text": "def test_remove_guest_from_room\n @room.add_guest(@guest1)\n @room.add_guest(@guest2)\n @room.remove_guest(@guest1)\n assert_equal(1,@room.guests.count)\n end", "title": "" }, { "docid": "8652055542e4c4b028c02a5615d3a574", "score": "0.64560896", "text": "def test_remove_guest()\n @room1.remove_guest(@guest2)\n assert_equal(1, @room1.guests.length())\n end", "title": "" }, { "docid": "9cb06cbab7dc496b7eddbd8b1fe48ca9", "score": "0.6437838", "text": "def test_check_in\n assert_equal(true, @room1.check_in(@guest1))\n end", "title": "" }, { "docid": "ab76334e7ca3d179a148a4c37691cf92", "score": "0.63874483", "text": "def test_count_guests_in_room\n assert_equal(0, @room1.count_guests_in_room)\n end", "title": "" }, { "docid": "5d9e7e6c6952c7732adf098e3abe5ad3", "score": "0.63791823", "text": "def test_check_entry_money\n @room.add_guest(@guest1)\n assert_equal(\"not enough money\", @room.check_entry_and_add_guest(@guest2))\n end", "title": "" }, { "docid": "5c590aecafc609e49a6bd49be89dcfc5", "score": "0.6371464", "text": "def test_enter_the_room\n enter_the_room(\"test_name\")\n end", "title": "" }, { "docid": "4de6e048f4604d3d0a9de7640874d834", "score": "0.6318221", "text": "def test_number_of_guests_in_room\n assert_equal(0, @room1.number_of_guests_in_room)\n end", "title": "" }, { "docid": "04e17a4654b097a840861ed46a80ea81", "score": "0.63118154", "text": "def test_too_many_guests_in_room__true()\n @room_1.check_in_guest(@guest_1)\n @room_1.check_in_guest(@guest_2)\n @room_1.check_in_guest(@guest_3)\n @room_1.check_in_guest(@guest_4)\n @room_1.check_in_guest(@guest_5)\n @room_1.check_in_guest(@guest_6)\n @room_1.check_in_guest(@guest_7)\n assert_equal(true, @room_1.too_many_guests_in_room)\n # @room_1.check_out_guest(@guest_7)\n # assert_equal(false, @room_1.too_many_guests_in_room)\n end", "title": "" }, { "docid": "bc14262b0c9dc9d54759f0c5a9bb8c27", "score": "0.6280598", "text": "def too_may_guests_in_room__true()\n if @guests.check_in_count() > @capacity\n return true\n end\n return false\n end", "title": "" }, { "docid": "b6e72512b81999d457bbc886c8218c2c", "score": "0.6271529", "text": "def check_guest_in\n\n end", "title": "" }, { "docid": "0eed555bbf903596d90ec6c289703dbf", "score": "0.6250362", "text": "def check_in(person, room)\n if room_exists?(room)\n if @rooms[room].add_occupant(person)\n p @rooms[room]\n p 'check in successful'\n else\n p 'sorry, room is full'\n end\n else \n p 'sorry, room does not exist'\n end\n end", "title": "" }, { "docid": "8064ae540aa0b3622c0aabd1acc49348", "score": "0.6250159", "text": "def create_guest?\r\n admin? or streamer?\r\n end", "title": "" }, { "docid": "7860a758013f639543e251db47b92e00", "score": "0.6237869", "text": "def check_in_guest(guest) #unknown guest\n if @guests.include? guest #guests array includes guest in parameter\n return #exit out of function\n end\n @guests << guest #else add parameter guest to guests array\n end", "title": "" }, { "docid": "8899803ab5e449d43e8df17bc2220ba5", "score": "0.6235559", "text": "def test_check_out_guest()\n @room_1.check_in_guest(@guest_1) #add 1 guest\n @room_1.check_in_guest(@guest_2) # add 2nd guest to total 2\n @room_1.check_out_guest(@guest_1) #remove one guest to total 1\n assert_equal(1, @room_1.check_in_count()) #output shoudl be 1\n @room_1.check_out_guest(@guest_3) #checkout guest 3 who is not checked in so should still return 1\n assert_equal(1, @room_1.check_in_count()) #returns 1\n @room_1.check_out_guest(@guest_2) #check out guest 2 who is checked in\n assert_equal(0, @room_1.check_in_count()) #room should now be empty\n end", "title": "" }, { "docid": "4262d889310441d910e08f3174057e44", "score": "0.62188065", "text": "def test_check_in__fail\n assert_equal(false, @room2.check_in(@guest1))\n end", "title": "" }, { "docid": "a2c4743b86cbe31dc37d20758dc11a63", "score": "0.6200041", "text": "def test_guests_checked_out_of_room\n @room1.guest_check_in(@guest1)\n @room1.guest_check_in(@guest2)\n @room1.guest_check_out(@guest2)\n assert_equal(1, @room1.guests_number())\n end", "title": "" }, { "docid": "b88da747a85ee271b49eb72ff28e9bd7", "score": "0.6193342", "text": "def test_room_guest_count\n assert_equal(0,@room2.guest_count)\n end", "title": "" }, { "docid": "5bfc45cd9cc66b203031f607ea6c17bc", "score": "0.6189001", "text": "def test_charge_guest_for_entry\n \tassert_equal(30, @room1.charge_guest_for_entry(@guest1))\n end", "title": "" }, { "docid": "5ac362fa8208d022151e92e7c4e7943c", "score": "0.6118029", "text": "def test_check_in_two_guests\n @room1.guest_check_in(@guest1)\n @room1.guest_check_in(@guest2)\n assert_equal(2, @room1.guests_number())\n end", "title": "" }, { "docid": "61b6d9a16f9674082772f0fb46ca4e54", "score": "0.61061025", "text": "def test_check_out\n @double_room.check_in(@guest2)\n assert_equal(@guest2, @double_room.current_guest)\n end", "title": "" }, { "docid": "072b7e4593fdabddaa36519c87fa7c8a", "score": "0.6073525", "text": "def room_starts_empty()\n return @guest.length()\n end", "title": "" }, { "docid": "0c93843738f55da31459a5a79ae0409b", "score": "0.60446", "text": "def add_as_client \n Event.create( \n :event_type => 'invitation',\n :detail_i1 => guest.id,\n :user_id => self.case.author.id\n ) \n self.case.author.add_client(guest) || true\n end", "title": "" }, { "docid": "d8e95e5cea2ac1b8b3f660e0020f198e", "score": "0.60406977", "text": "def check_capacity(room, guests)\n if guests <= room.capacity\n return \"You can sing!\"\n else\n return \"Room is not available!\"\n end\n end", "title": "" }, { "docid": "6e3a1a3ef42f042680a6959247ca2493", "score": "0.603997", "text": "def guest?\n false\n end", "title": "" }, { "docid": "f6b6fe8039ae19dd44a772ba4cb10ea2", "score": "0.5995229", "text": "def test_007_check_out_of_room\n @guest1.check_out(@occupied_room)\n assert_equal(0,@occupied_room.get_tab)\n assert_equal(10,@occupied_room.get_earnings)\n refute(@occupied_room.room_status)\n end", "title": "" }, { "docid": "32ba7a7cafbb1afc780bb4b06278bf0d", "score": "0.5974924", "text": "def check_guest_in(guest)\n for person in guest\n @guest << person\n end\n # p guest\n end", "title": "" }, { "docid": "bd31dca987547b67e07cef3dcc78ba46", "score": "0.59742016", "text": "def add_guest(guest_to_be_added)\n @guests << guest_to_be_added\n end", "title": "" }, { "docid": "2291bae80ac631bbc7fe750d8bbbc2d7", "score": "0.59623384", "text": "def test_check_out__fail\n assert_equal(false, @room1.check_out(@guest2))\n end", "title": "" }, { "docid": "e51f7faa6bf9d73fe04604afe6d42904", "score": "0.59456354", "text": "def test_check_in_guest_already_checked_in()\n @room_1.check_in_guest(@guest_1) #check guest 1 in should return 1\n @room_1.check_in_guest(@guest_1) # check same guest 1 in and should still return 1\n assert_equal(1, @room_1.check_in_count()) #1 should be output\n end", "title": "" }, { "docid": "be7bf65b89309d14fb2ecadfda637719", "score": "0.59435725", "text": "def create_reservation(guest, room, party_size)\n if (!is_room_available?(room, party_size)) || (!guest.can_afford_to_pay?(@booking_fee))\n return nil\n end\n guest.pay(@booking_fee)\n @till += @booking_fee\n new_reservation = Reservation.new(guest, room, party_size)\n @reservations << new_reservation\n return \"Thanks, your reservation is held under #{new_reservation.guest.name}\"\n end", "title": "" }, { "docid": "b7b0a576d2203e9b7540af82640a4803", "score": "0.59426755", "text": "def add_guests_to_room(guest)\n for person in guest\n guests.push(person)\n end\n end", "title": "" }, { "docid": "8ea79f1d18776f0168134fb220d410bd", "score": "0.5935465", "text": "def guest?\n new_record?\n end", "title": "" }, { "docid": "d4f24cb6c018e95bcf09e7d5e4337f0e", "score": "0.58689857", "text": "def guest\n\tend", "title": "" }, { "docid": "526a18f29e715d14a64bf28b7d0f0a1e", "score": "0.5859155", "text": "def admit_customer(guest, room)\n if room.space? && room.can_afford?(guest)\n return room.add_guest(guest)\n else\n return \"No admittance\"\n end\n end", "title": "" }, { "docid": "5d0959f9249ef4a5b4bc701a4266ea2c", "score": "0.5857866", "text": "def registered?\n !guest?\n end", "title": "" }, { "docid": "e65e92c10525a65ec3cb17bf0899073e", "score": "0.58538646", "text": "def room\n end", "title": "" }, { "docid": "c9f1b9d3b066ec962399c4269ef85e60", "score": "0.58462", "text": "def can_add_room\n return @room_name\n end", "title": "" }, { "docid": "5ca9a3be98a7a2a46ca4c6083a407a5e", "score": "0.5831384", "text": "def check_guest_in_to_room(input)\n puts \"Please enter name of Guest\"\n customer_name = gets.chomp\n guest = Guest.new(customer_name, Tab.new)\n puts @rooms[input-1].put_guest_in_room(guest)\n gets.chomp\n room_selection_menu()\n end", "title": "" }, { "docid": "36d5905fc7a0155a64c89954c9141869", "score": "0.5829093", "text": "def checking_in_procedure(person, room, event)\n occupy_room(room)\n set_room_is_dirty(room)\n # notify_staff(event, room, person)\n end", "title": "" }, { "docid": "606711f0d956896efcbb2924babab404", "score": "0.58205247", "text": "def test_check_room_is_big_enough\n group_size = @group2.people() \n @room.room_big_enough(group_size, @room.capacity)\n assert_equal(true, result)\n end", "title": "" }, { "docid": "a0e5a5923966af1e31452c5b56079cfe", "score": "0.5818989", "text": "def is_guest?\n return @guest_of\n end", "title": "" }, { "docid": "d8fcf16756dc47f766001bef6ea52b98", "score": "0.58157486", "text": "def test_karaoke_room_is_empty()\n assert_equal(0, @room.karaoke_room_occupied())\n end", "title": "" }, { "docid": "9330e8ee81c4021de0632bc01e0a84e2", "score": "0.58002186", "text": "def add_to_host\n raise \"Unknown guest host! You must set current_host_id before creating\" unless current_host_id > 0\n user = User.find(current_host_id) # Raise error if not found\n user.add_guest(self, @circle)\n self.is_emergency_contact_for(user) if @emergency_contact\n true\n end", "title": "" }, { "docid": "7b5957c4573c2a358e5f5b6259b54a83", "score": "0.57996005", "text": "def add_room room_name\n @@available_rooms.push room_name unless @@available_rooms.include? room_name\n @rooms_list.append do\n flow :margin => 5 do\n # _why assures me the :checked style will work in the next release\n joined = check :checked => @@joined_rooms.include?(room_name) do |chk|\n @@joined_rooms.push(room_name) and @@room_data[room_name].merge! Chat.join(room_name) if chk.checked?\n Chat.leave(room_name) and @@joined_rooms.delete(room_name) unless chk.checked?\n end\n \n para room_name, :underline => (@room == room_name ? :one : false)\n \n click do\n visit(\"/room/#{room_name}\")\n end unless @room == room_name\n end\n end\n end", "title": "" }, { "docid": "34ce10022132088f68f7705d0941b07d", "score": "0.5787693", "text": "def room; end", "title": "" }, { "docid": "41686d8b6d7175a2b9a11dcc6925107a", "score": "0.5785615", "text": "def test_room_has_room_number()\n assert_equal(1, @room.room_number())\n end", "title": "" }, { "docid": "b8ffc9d713c6ed4047f55c81647423c2", "score": "0.576866", "text": "def check_for_room_owner\n unless whoami_owns_room?(ChatRoom.find(params[:id]))\n flash[:notice] = \"You do not have permissions to modify this room\"\n redirect_to chat_rooms_url\n end\n end", "title": "" }, { "docid": "1bd86fee4143bc0187628138ea89aaa3", "score": "0.5768342", "text": "def eds_guest?\n current_or_guest_user.guest\n end", "title": "" }, { "docid": "8c8ed670f302c086b7368eba68b83012", "score": "0.576364", "text": "def test_guests_react_to_their_favourite_song_being_queued\n @office.check_guest_in(@room1, @guest1)\n assert_equal(\"Elizabeth says 'Choon!'\", @room1.queue_song(@song1))\n end", "title": "" }, { "docid": "ac5de7e6b674091c6d3695cdebab57bc", "score": "0.5755351", "text": "def test_check_in_group_to_room()\n @room.check_in(@group2)\n assert_equal(1, @room.karaoke_room_occupied())\n end", "title": "" }, { "docid": "ae05fabc22224cb06277c7732cd478f8", "score": "0.5723649", "text": "def add_guest(actor_id)\n @max_battle_member_count += 1 if battle_members.size >= max_battle_members\n fix_actor(actor_id)\n end", "title": "" }, { "docid": "96c8ebfdb6edc0920c22b2041f2f7609", "score": "0.5707666", "text": "def no_own_reservations\n if guest == listing.host\n errors.add(:guest, \"Please select a listing that is not your own\")\n end\n end", "title": "" }, { "docid": "3b2bb3eccf9e71fc3460005a92e0d587", "score": "0.5696585", "text": "def on_guest_list?\n on_guest_list || false\n end", "title": "" }, { "docid": "cb0f3cec643c5f6cda1938990540c3e6", "score": "0.5693442", "text": "def block_room\n\t\tself.room.set_occupied\n\tend", "title": "" }, { "docid": "fd70afb8f5f9c441f47c6957887ccc38", "score": "0.56770056", "text": "def test_check_in_guest_to_room__cash__capacity__tune\n room = Room.new(\"Pop-Punk Paradise\", 5)\n guest = Guest.new(\"Ed\", 100, \"Blink 182 - Anthem Part 2\")\n song = Song.new(\"Blink 182 - Anthem Part 2\")\n room.add_song_to_room(song)\n result = @bar.check_in_guest_to_room(guest, room)\n result_till = @bar.till\n result_cash = guest.cash\n result_guests = room.count_guests()\n result_songs = room.count_songs()\n assert_equal(\"Ahhhh, tuuuuuuune!\", result)\n assert_equal(15, result_till)\n assert_equal(85, result_cash)\n assert_equal(1, result_guests)\n assert_equal(1, result_songs)\n end", "title": "" }, { "docid": "79420ceaa9b453d5fa99440fecac849c", "score": "0.5667742", "text": "def create\n if current_receptionist\n @guest = current_receptionist.guests.new(guest_params)\n\n if @guest.in_time <= @guest.out_time\n respond_to do |format|\n if @guest.save\n format.html { redirect_to @guest, notice: 'Guest was successfully created.' }\n format.json { render :show, status: :created, location: @guest }\n else\n format.html { render :new }\n format.json { render json: @guest.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:error] = 'Out-time should be greater than In-time'\n end\n end\n end", "title": "" }, { "docid": "204a70451ad2331883bd8f3172dd3dab", "score": "0.56660116", "text": "def add_tenant(new_tenant)\n if @bedrooms < @tenants.count\n @tenants.push(new_tenant)\n\n elsif @bedrooms >= @tenants.count\n \"No more tenants can be added\"\n end\n end", "title": "" }, { "docid": "611b0f6848652cc4ae4e9cb4b784684e", "score": "0.56547296", "text": "def check_room_user\n set_room\n if current_user.id != @room.user.id\n redirect_to bookings_path, notice: \"Cannot Accept/Decline a booking of a room belonging to another user.\"\n end\n end", "title": "" }, { "docid": "53f14b687aaabec7def4f80c6ecc38f1", "score": "0.5631552", "text": "def add_guest(guest, circle = guest.circle) \n # Adds authorization plugin role: 'guest' of user\n # guests can identify their hosts with:\n # guest.is_guest_of_what => Array of Members\n # and member can identify their guests with:\n # member.has_guests? => true/false\n # member.has_guests => Array of Guests\n #\n # Things to watch out for:\n # g.has_role? 'guest' => false\n # g.has_role? 'guest, member => ArgumentError\n guest.is_guest_of self\n \n # Adds relationship: guest + circle\n relationships.create!(:guest => guest, :circle => circle)\n end", "title": "" }, { "docid": "dbc9939658381c8c10da544428a616e2", "score": "0.56214434", "text": "def create\n if (params[:user][:email] == \"guest@example.com\")\n prep_guest\n end\n super\n end", "title": "" }, { "docid": "c8d338b46833164bcffca277e61b71f9", "score": "0.5617172", "text": "def test_count_occupants_array\n @room2.check_in_guest(@guest2)\n @room2.check_in_guest(@guest3)\n assert_equal(2, @room2.count_occupants())\n end", "title": "" }, { "docid": "7c36f88be88e128a16fe5d7fc8ce1d30", "score": "0.56038487", "text": "def is_guest?\n return @is_guest\n end", "title": "" }, { "docid": "8d59dbde54c798bcd036cdcb0532bfa0", "score": "0.5603357", "text": "def expire_guest?\r\n admin? or own? or invited?\r\n end", "title": "" }, { "docid": "60172f3d1d7013af64c8907419ed503c", "score": "0.55823594", "text": "def test_count_occupants_room_at_start_is_empty\n assert_equal(0, @room1.count_occupants())\n end", "title": "" }, { "docid": "6a6938bc487947561a4ece1508af678e", "score": "0.55803305", "text": "def test_room_name\n assert_equal(\"Pop\", @room2.room_name)\n end", "title": "" }, { "docid": "c87495bc733386d42d2793b07ee99431", "score": "0.55778337", "text": "def someone_left_room(&block)\n presence(:from => Regexp.new(\"^\"+Blather::JID.new(room_jid).to_s+\".*\"), :type => :unavailable, &block)\n end", "title": "" }, { "docid": "40025b9435e0c718c1af91e8ea095507", "score": "0.5557766", "text": "def occupy_room(room)\n room.occupied = 1\n end", "title": "" }, { "docid": "9a63a339bc0d0193579a499acca7695e", "score": "0.5556349", "text": "def add_multile_people_to_room(guests_to_add)\n\n # for guest in guests_to_add\n # # check_in_guests(guest)\n # @guests.push(guest)\n # end\n\n guests_to_add.each { |guest| @guests.push(guest) }\nend", "title": "" }, { "docid": "77015a1c41971a7f5891c938071b3094", "score": "0.55487835", "text": "def check_in(guest)\n found_reservation = find_reservation_by_name(guest.name)\n if found_reservation == nil\n return \"Sorry, we couldn't find your reservation.\"\n end\n @checked_in_guests << found_reservation\n return \"Thanks, you are now checked in under #{guest.name}!\"\n end", "title": "" }, { "docid": "d67f22e800800aac0e609b632212952b", "score": "0.55486643", "text": "def invited?\r\n key.guest && user.id == key.created_by\r\n end", "title": "" }, { "docid": "14054460193ed66ef40854af67a6480a", "score": "0.5540354", "text": "def tempguest\r\n end", "title": "" } ]
1fb1716b407b1528c57d2987bde7b650
Finds and invokes a handler by name or by status code.
[ { "docid": "2f906728d67515cfba790bd8682de810", "score": "0.643793", "text": "def handle!(name_or_code, from_logic = false)\n @sets.each { |set|\n if h = set[1].handle(name_or_code)\n Pakyow.app.response.status = h[1]\n from_logic ? throw(:fns, h[2]) : self.trampoline(h[2])\n break\n end\n }\n end", "title": "" } ]
[ { "docid": "de79c53a0439e67c62588445435ba95d", "score": "0.6711083", "text": "def handle_status code\n handler = error_handler_for(code)\n instance_exec(&handler) if handler\n end", "title": "" }, { "docid": "cc3c6e48439d46b7019de464cbde8889", "score": "0.67018694", "text": "def status_handler_for( status_code )\n\t\tself.log.debug \"[:errors] Looking for a status handler for %d responses\" % [ status_code ]\n\t\thandlers = self.class.status_handlers\n\t\tranges = handlers.keys\n\n\t\tranges.each do |range|\n\t\t\treturn handlers[ range ] if range.include?( status_code )\n\t\tend\n\n\t\treturn nil\n\tend", "title": "" }, { "docid": "035a4ac4d6d94955496e56ffbff649b0", "score": "0.65713394", "text": "def call_handler(handler_name, *args)\n check_handler_name handler_name\n\n @handlers[handler_name].(*args) if has_handler? handler_name\n end", "title": "" }, { "docid": "491167546cb28f2d5d8cfa602aec3bd0", "score": "0.63601625", "text": "def trigger(name_or_code)\n code = Rack::Utils.status_code(name_or_code)\n response.status = code\n trigger_for_code(code)\n end", "title": "" }, { "docid": "638d85927eb987334af6d98b371ed04b", "score": "0.6324454", "text": "def find(name)\n if action = @action[name]\n Handler.new(action)\n end\n end", "title": "" }, { "docid": "14b0786ce6b6bbbc8f03e2a39c30a89c", "score": "0.61959946", "text": "def process(code)\n name = code.class.name.split(\"::\").last\n # Invoke a specific handler\n on_handler = :\"on_#{name}\"\n if respond_to? on_handler\n return send on_handler, code\n else\n raise \"No handler on_#{name}(code) #{code.inspect}\"\n end\n end", "title": "" }, { "docid": "764f35c80e029853bf2e3412f0571631", "score": "0.6034477", "text": "def method_missing(mth, *args, &block)\n if mth.to_s =~ /http_(\\d+)\\?/\n status_code == $1.to_i\n else\n @parsed_body.send(mth)\n end\n end", "title": "" }, { "docid": "1929f292cdc9c9aa3a7dbaac4911676c", "score": "0.58900726", "text": "def dispatch(name, opts = {})\n # The full handler name is the method we call given it exists.\n full_handler_name = :\"handle_#{name.to_s.underscore}\"\n # First, dispatch locally if the method is defined.\n if self.respond_to?(full_handler_name)\n self.send(full_handler_name, opts)\n end\n # Iterate through all of the registered handlers,\n # If there is a method named handle_<event_name>\n # defined we sent that otherwise we call the handle\n # method on the handler. Note that the handle method\n # is the only required aspect of a handler. An improved\n # version of this would likely cache the respond_to?\n # call.\n self.handlers.each do |handler|\n if handler.respond_to?(full_handler_name)\n handler.send(full_handler_name, opts)\n else\n handler.handle name, opts\n end\n end\n # If we get the HaltHandlerProcessing exception, we\n # catch it and continue on our way. In essence, we\n # stop the dispatch of events to the next set of the\n # handlers.\n rescue HaltHandlerProcessing => e\n Marvin::Logger.info \"Halting processing chain\"\n rescue Exception => e\n Marvin::ExceptionTracker.log(e)\n end", "title": "" }, { "docid": "3cbcd29dcdf0b7a4267b6a07978fdf2c", "score": "0.5834685", "text": "def find_handler(handlers, group, method_name)\n handler = nil\n if !handlers[group].nil? && handlers[group].respond_to?(method_name)\n handler = handlers[group]\n end\n\n handler\n end", "title": "" }, { "docid": "29a57233272be8816396c98f5339c823", "score": "0.57278043", "text": "def call_handler(symbol)\n @handler[symbol].each {|method| method.call } if handle?(symbol)\n end", "title": "" }, { "docid": "0996a42e2dbadd61c184606d88126cd0", "score": "0.5625929", "text": "def handle_status_response( request, status_info )\n\t\tstatus = status_info[:status]\n\n\t\t# If we can't find a custom handler for this status, re-throw\n\t\t# to the default handler instead\n\t\thandler = self.status_handler_for( status ) or\n\t\t\tthrow( :finish, status_info )\n\t\tself.log.debug \"Custom %d handler: %p\" % [ status, handler ]\n\n\t\t# Set up the request's response with the right status code\n\t\trequest.notes[:status_info] = status_info\n\t\tresponse = request.response\n\t\tresponse.status = status\n\n\t\t# The handler is an UnboundMethod, so bind it to the app instance\n\t\t# and call it\n\t\treturn handler.bind( self ).call( response, status_info )\n\tend", "title": "" }, { "docid": "b669175cbf8c8a4d7e43837bcc5dffe1", "score": "0.5614824", "text": "def call_ok_handler\n call_handler(:ok)\n end", "title": "" }, { "docid": "b669175cbf8c8a4d7e43837bcc5dffe1", "score": "0.5614824", "text": "def call_ok_handler\n call_handler(:ok)\n end", "title": "" }, { "docid": "e52e4a4ac6ae291c0cb4540a3c502da4", "score": "0.5608723", "text": "def call_handler\n @handler.call if @handler\n end", "title": "" }, { "docid": "0588cd101d453b719dfc23db0315c703", "score": "0.5592825", "text": "def call(name, *parameters)\n raise(ArgumentError, 'Argument `name` must be a valid method identifier string.') unless name.is_a?(String) && name[/^[\\w\\.]+$/]\n @request_handler.send({\n :name => name,\n :parameters => parameters\n })\n end", "title": "" }, { "docid": "d9f75efe5bbd2e68b29653eca6f443d5", "score": "0.5557103", "text": "def handle(message)\n debug(\"received #{message.inspect}\")\n\n @handlers.\n fetch(message.method_name, default_handler).\n call(@client, message)\n rescue => e\n fatal(\"got unexpected error #{e.inspect}\")\n debug(e.backtrace.join(\"\\n\"))\n end", "title": "" }, { "docid": "51aac3f774358a4097d42cc5a093a665", "score": "0.5480515", "text": "def handle_success(result)\n if (handler = @handlers[:ok])\n @caller.instance_exec(result.value, &handler)\n elsif (handler = @handlers[:fallback])\n @caller.instance_exec(result, &handler)\n else\n raise ArgumentError, \"No success handler or fallback defined\"\n end\n end", "title": "" }, { "docid": "b08da84628cfe5da0322541f89263059", "score": "0.54775655", "text": "def handler_executed(handler); end", "title": "" }, { "docid": "b08da84628cfe5da0322541f89263059", "score": "0.54775655", "text": "def handler_executed(handler); end", "title": "" }, { "docid": "3d07102ae745f433c40e3cc74e3c7c70", "score": "0.54709184", "text": "def handler_method(command)\n \"handle_#{command.gsub('-', '_')}\".to_sym\n end", "title": "" }, { "docid": "29126380ff7c5cadfb5df62064e1f7c0", "score": "0.54376113", "text": "def get_handler(preferred_handler_name = nil)\n servers = %w(puma mongrel thin webrick)\n servers.unshift(preferred_handler_name) if preferred_handler_name\n\n handler, server_name = detect_valid_handler(servers)\n\n if preferred_handler_name && server_name != preferred_handler_name\n puts \"Handler '#{preferred_handler_name}' not found, using fallback ('#{handler.inspect}').\"\n end\n handler\n end", "title": "" }, { "docid": "55cbf5b6d5405f86644bb17521ead3b3", "score": "0.5392293", "text": "def method_missing(sym, *args)\n raise \"Unknown method #{sym.id2name}\" if sym.id2name.start_with? 'parse'\n parts = sym.id2name.match /^(.+?)_(.+)_(.+?)_(.+?)$/ # [action]_[commandname]_from_[namespace]\n if (parts.nil?)\n parts = sym.id2name.split('_', 2)\n end\n\n if (parts.nil? || !([:status,:get,:post,:critical,:async, :set].include? parts[0].to_sym))\n # handle undefined commands\n if ([:status, :get, :post, :critical, :async].include? args[0])\n command = EVENT_LOOKUP_RPCS[sym] || sym.to_s\n self.send_command(command, *args)\n else\n # assume post\n command = EVENT_LOOKUP_RPCS[sym] || sym.to_s\n self.send_command(command, :post, *args)\n end\n else\n method = parts[0].to_sym\n name = parts[1].to_sym\n if (method == :set)\n method = :post\n name = ('set_'+name.to_s).to_sym\n end\n command = EVENT_LOOKUP_RPCS[name] || name.to_s\n namespace = 0 #ignore namespace lookup for now: namespace = if (parts.length > 2) then parts[3] else 0 end\n self.send_command(command, method, *args)\n end\n end", "title": "" }, { "docid": "8ad61801d1f49e1e7cc75e017c2ee55f", "score": "0.5379136", "text": "def method_missing( sym, req, *args )\n\t\tif MethodMap.key?( sym )\n\t\t\tstage = MethodMap[ sym ]\n\t\t\treq.server.log_error \"StageLogger {%d}>> in %s %s(%p, %p)\" % [\n\t\t\t\tProcess.pid,\n\t\t\t\tstage,\n\t\t\t\tsym,\n\t\t\t\treq,\n\t\t\t\targs\n\t\t\t ]\n\t\telse\n\t\t\treq.server.log_error \"StageLogger {%d}>> unknown handler: %s(%p, %p)\" % [\n\t\t\t\tProcess.pid,\n\t\t\t\tsym,\n\t\t\t\treq,\n\t\t\t\targs\n\t\t\t ]\n\t\tend\n\n\t\treturn Apache::DECLINED\n\tend", "title": "" }, { "docid": "134dd32bfbc9d66c08daaec2b96401b0", "score": "0.5347762", "text": "def method_missing name\n @status.send name\n end", "title": "" }, { "docid": "6f5f086827afbb9871fdba1211ce3e4e", "score": "0.5342165", "text": "def get_handler(preferred_handler_name = nil)\n servers = %w[puma mongrel thin webrick]\n servers.unshift(preferred_handler_name) if preferred_handler_name\n \n handler = nil\n while((server_name = servers.shift) && handler === nil) do \n begin\n handler = ::Rack::Handler.get(server_name)\n rescue LoadError\n rescue NameError\n end\n end\n \n if preferred_handler_name && server_name != preferred_handler_name\n puts \"Handler '#{preferred_handler_name}' not found, using fallback ('#{server_name}').\"\n end\n handler\n end", "title": "" }, { "docid": "7af101579c7266bb6067ce0fb0e1c724", "score": "0.53267837", "text": "def handle rumor, options = {}\n handle = self.class.handlers[rumor.event.to_sym]\n # Only execute the handle when one is found.\n # Do not error here, because a channel does\n # not necessarely have to implement all event handlers.\n self.instance_exec rumor, &handle if handle\n end", "title": "" }, { "docid": "7e418fc4506efba117d508b0a99705f6", "score": "0.5320807", "text": "def _roda_after_20__status_handler(result)\n if result && (meth, arity = opts[:status_handler][result[0]]; meth) && (v = result[2]).is_a?(Array) && v.empty?\n res = @_response\n res.headers.clear\n res.status = result[0]\n result.replace(_roda_handle_route{arity == 1 ? send(meth, @_request) : send(meth)})\n end\n end", "title": "" }, { "docid": "e7007382559970a02df6782ece32fa91", "score": "0.53177106", "text": "def process(message)\n if handler = @handlers[message.type]\n Pantry.logger.debug(\"[#{@server_or_client.identity}] Running handler on #{message.inspect}\")\n handler.call(message)\n else\n Pantry.logger.warn(\n \"[#{@server_or_client.identity}] No known handler for message type #{message.type}\"\n )\n nil\n end\n end", "title": "" }, { "docid": "bd2a83e152f22ca9d9156296ba522ac4", "score": "0.5297077", "text": "def method_missing(id, *args)\n # if command named by id registered, then execute it\n if @commands.key?(id.id2name)\n return @commands[id.id2name].e(*args)\n else\n # otherwise, exception\n super\n end\n end", "title": "" }, { "docid": "846eff43ea445cdb5777614ddf02eb41", "score": "0.5293283", "text": "def method_missing(name, args)\n if name.to_s =~ /send_response_(.*)/\n args[0].create_response($1.to_i).send\n elsif name.to_s =~ /is_(.*)\\?/\n args[0].get_method == $1\n else\n super\n end\n end", "title": "" }, { "docid": "68d00664715909fe5dfe09554add7415", "score": "0.5289361", "text": "def invoke_action(name)\n self.send(name.to_sym)\n render unless @already_built_response\n end", "title": "" }, { "docid": "f14ba3a67177779ad62953e145155888", "score": "0.52888626", "text": "def handle_status_or_return_result\n status = response.response_header.status\n case status\n when 200\n pioneer.processing(self)\n else\n @error = \"This #{url} returns this http status: #{status}\"\n pioneer.logger.error(@error)\n if pioneer.respond_to? \"if_status_#{status}\".to_sym\n pioneer.send(\"if_status_#{status}\", self)\n elsif pioneer.respond_to? :if_status_not_200\n pioneer.if_status_not_200(self)\n else\n nil # nothing?\n end\n end\n end", "title": "" }, { "docid": "e6803512b49c5171ff3c909fcc46de44", "score": "0.5285593", "text": "def readHandler(key, value)\n (warn(\"invalid key: #{key}\"); return nil) \\\n unless [:name, :socket, :thread].contains?(keytpe)\n @handlers.each { |handler| return handler if handler[key] == value }\n warn(\"no handler matching key: #{key}, value: #{value}\")\n return nil\n end", "title": "" }, { "docid": "b4f92450557e30e60c14633bdaef466e", "score": "0.52700216", "text": "def handler\n exception_handler do\n self.send params[:api_command]\n end\n end", "title": "" }, { "docid": "053009da22db6f841329d115012f3118", "score": "0.5267084", "text": "def find_http_status_code(actual)\n if @setup.http_status_method.present?\n actual.send(@setup.http_status_method)\n else\n actual\n end\n end", "title": "" }, { "docid": "ea86815833b4feaae2921bba0fafec9b", "score": "0.52495134", "text": "def method_missing name, *args\n @rack_response.send name, *args\n end", "title": "" }, { "docid": "9b7356f74be45ad0c8db76fbcce0d454", "score": "0.52386826", "text": "def []( name )\n _handlers[name]\n end", "title": "" }, { "docid": "c5233850cd89f4ce253af45a38d089e4", "score": "0.522018", "text": "def handler_for(command)\n # User might be tempted to just pass in the message, or pdu,\n # if so, just pluck the command off of it.\n if command.kind_of?(Message)\n command = command.pdu.command\n elsif command.kind_of?(PDU)\n command = command.command\n end\n\n case command\n when Constants::SNMP_MSG_GET\n get_handler\n when Constants::SNMP_MSG_GETNEXT\n get_next_handler\n when Constants::SNMP_MSG_GETBULK\n get_bulk_handler\n when Constants::SNMP_MSG_SET\n set_handler\n else\n raise \"Invalid command type: #{command}\"\n end\n end", "title": "" }, { "docid": "0541101677b1c2d7b5ad022022c37255", "score": "0.52003026", "text": "def method_missing(id, *args) \n request(@binding).call(id.id2name, args[0])\n end", "title": "" }, { "docid": "8f43d74906b0f0f648a7e80bee0bfd36", "score": "0.518458", "text": "def fire(name)\n handlers[name.to_sym].each(&:call)\n end", "title": "" }, { "docid": "b4172e6064bf9d682e0451b590572b1a", "score": "0.5180758", "text": "def try(handlers:, tape:, **args)\n\n handlers.each do |handler|\n warn \"-- #{self.name}: Trying #{handler}\" if DEBUG_TRACING\n\n result = handler.process(tape: tape, **args)\n\n return result if result.succeeded\n end\n\n fail(\"No handler in #{handlers} succeeded in parsing\", tape: tape)\n end", "title": "" }, { "docid": "382d42cca55cad32ad12f277186c8e5a", "score": "0.51646626", "text": "def _safe_invoke(handler, **args)\n __send__(handler, **args)\n rescue StandardError => error\n log_failure error: error, message: args.fetch(:message),\n logger: bot.public_method(:log)\n nil\n end", "title": "" }, { "docid": "65a9769cad8b053dfe17e6e217691968", "score": "0.51628363", "text": "def run( cmd )\n puts \"Dispatcher receieved command with key #{cmd.key}\"\n if @cmd_keys[cmd.key] != nil\n call = \"Handler.#{@cmd_keys[cmd.key]}\"\n puts \"Dispatcher would be calling #{call}\"\n retval = eval(\"#{call}\")\n else\n puts \"Dispatcher ERROR: #{cmd.key} was not found in lookup\"\n end\n end", "title": "" }, { "docid": "ad1ff44f8f58a9143746ac37457efdf6", "score": "0.51437604", "text": "def handle_failure(result)\n return handle_exception(result) if result.code == :exception\n\n if (handler = @handlers[:error][result.code])\n @caller.instance_exec(result.payload, &handler)\n elsif (handler = @handlers[:error][:fallback])\n @caller.instance_exec(result.code, result.payload, &handler)\n elsif (handler = @handlers[:fallback])\n @caller.instance_exec(result, &handler)\n else\n raise ArgumentError, \"No failure handler or fallback defined for #{result.code}\"\n end\n end", "title": "" }, { "docid": "1a1f0885900e20ae62b1d68fddc1eb2a", "score": "0.5142681", "text": "def method_missing_internal(name, *args)\n @client.job.send(name, *args)\n rescue NoMethodError => e\n # Try a get prefix.\n begin\n @client.job.send(\"get_#{name}\".to_sym, *args)\n rescue NoMethodError\n raise e # Still no luck, raise original error.\n end\n end", "title": "" }, { "docid": "1a1f0885900e20ae62b1d68fddc1eb2a", "score": "0.5142681", "text": "def method_missing_internal(name, *args)\n @client.job.send(name, *args)\n rescue NoMethodError => e\n # Try a get prefix.\n begin\n @client.job.send(\"get_#{name}\".to_sym, *args)\n rescue NoMethodError\n raise e # Still no luck, raise original error.\n end\n end", "title": "" }, { "docid": "42af3c62a064959a1b97517efd05a0ab", "score": "0.5128886", "text": "def do_handle( driver, id, handle )\n @requests.delete( id ).do_handle( handle )\n end", "title": "" }, { "docid": "2a4c2d4a49b957ac24678a54c7b91531", "score": "0.5128", "text": "def determine_handler\n @handler = @arguments.shift.capitalize\n while !@arguments.empty? && !is_handler(@handler) do\n @handler << '_' + @arguments.shift.capitalize\n end\n end", "title": "" }, { "docid": "1429218881578868d4baefad7fafa545", "score": "0.51232684", "text": "def handler_executed(handler)\n puts_line \"- #{handler.class.name}\"\n end", "title": "" }, { "docid": "c4b45c897c57abfd02264053ce58c291", "score": "0.51230544", "text": "def register_status_handler &block\n raise NotImplementedError\n end", "title": "" }, { "docid": "18d11bdd768900408e6c1d6a586d70ff", "score": "0.51184744", "text": "def run\n handlers.each do |info, handler|\n matches = matches_options?(info[:type], info[:regexp])\n break if matches && handler.call(options)\n end\n end", "title": "" }, { "docid": "f2fca1124b44d55b03f72483e0be9cc3", "score": "0.5106622", "text": "def method_missing(id, *args, &block)\n result = _process_method id, *args, &block\n method_missing_return id, result, *args\n end", "title": "" }, { "docid": "906c506017e428bfc022d545db344005", "score": "0.5103976", "text": "def call_handler_for(request)\n Log.debug \"Calling #{request[:command].capitalize} handler with [#{request[:params]}] as a parameter\"\n IpcAuthpipe::Handler.const_get(request[:command].capitalize).process(request[:params])\n end", "title": "" }, { "docid": "c5b3e21a07a80de4ffc769ee5a0fe632", "score": "0.51000094", "text": "def dispatch(args)\n result = @handler.service(convert_args(args))\n result_key = RequestDispatcher.exit_after_current_dispatch ? :last_result : :result\n [result_key, result]\n rescue Exception => e\n if e.instance_of?(SystemExit)\n exit\n elsif RequestDispatcher.exception_handler\n begin\n RequestDispatcher.exception_handler.call(e)\n rescue Exception => e2\n [:error, e2.message + \"\\n\\n\" + e2.backtrace.join(\"\\n\")]\n end\n else\n [:error, e.message + \"\\n\\n\" + e.backtrace.join(\"\\n\")]\n end\n end", "title": "" }, { "docid": "e7fed1068fbb34599ac7f7b15057bb07", "score": "0.5096617", "text": "def execute_handler\n abort 'Invalid command.' if !is_handler(@handler)\n eval(\"Drupal::#{@handler}.new.run(@arguments)\")\n end", "title": "" }, { "docid": "d20d190778ff4d801a72133d736e9c61", "score": "0.5096198", "text": "def do_status( code, message, language )\n raise StatusException.new( code, message, language ) unless code == FX_OK\n @callback[ Status.new( code, message, language ) ]\n end", "title": "" }, { "docid": "c396dcf99ccfedefcce1942d8adcbd7e", "score": "0.50952506", "text": "def method_missing(method_name, *args, &block)\n if respond_to_missing?(method_name)\n api_call(method_name, args.first)\n else\n super\n end\n end", "title": "" }, { "docid": "d56c7fc65eb504830ccd6ad5d5a5afff", "score": "0.50852853", "text": "def answer(path)\n puts \"- Requested URL: #{path}\"\n puts \"- Answering the call: #{self.class.routes[path] || '(404)'}\"\n\n method = self.class.routes[path]\n if method.nil?\n @response.status = 404\n else\n send(self.class.routes[path])\n end\n end", "title": "" }, { "docid": "e5c11f7c34283c16a37fa972aa1f783a", "score": "0.50839067", "text": "def execute(name, object)\n begin\n if (@register[name])\n rc = @register[name].call(object)\n {return: rc}\n else\n {error: 'notfound'}\n end\n rescue Exception => e\n {error: e}\n end\n end", "title": "" }, { "docid": "38e8e759da35038165316d2c3ec3de76", "score": "0.50814074", "text": "def method_missing(name, *args)\n execute name.to_sym, *args\n end", "title": "" }, { "docid": "100e01a1eabcf8e0eebbd257bd80adf0", "score": "0.5075068", "text": "def dispatch(handler)\n controller_name,action = handler.to_s.split('.')\n unless controller_name and action\n return(error \"cannot parse handler '%s'\" % handler)\n end\n\n name = controller_name.to_sym \n ctrl = controller[name]\n unless ctrl\n puts controller.inspect\n return(error \"no controller '%s' defined\" % controller_name.camelize)\n end\n \n unless ctrl.respond_to? action\n return(error \"controller '%s' does not have a method '%s'\" % [ctrl.class, action])\n end\n \n method = ctrl.method(action)\n end", "title": "" }, { "docid": "f4872ce3cfdc7db94d4c4b2231c5278c", "score": "0.50704867", "text": "def run(req, res)\n matched_route = self.match(req)\n matched_route.nil? ? res.status = 404 : matched_route.run(req, res) \n end", "title": "" }, { "docid": "7245393256970b1de575f7c560cf0ca9", "score": "0.50554985", "text": "def method_missing(*args, &block)\n # try to hand back an item\n try_find = Pathfinder::Item.all(:name.like => args[0])[0]\n return try_find if try_find\n\n # otherwise, it really is missing (derp)\n raise NoMethodError.new(\"Could not find that method or an item with that name\", args[0].to_s)\n end", "title": "" }, { "docid": "7fda7b38130ce684396ffd86e7839bc8", "score": "0.5050229", "text": "def handler_executed(handler)\n end", "title": "" }, { "docid": "c7ac8d4673cddd8e69e922eb4c485abd", "score": "0.50492084", "text": "def invoke(name, *args)\n fn = @functions[name]\n raise \"function not imported: #{name}\" if fn.nil?\n result = fn.call(*args)\n unless result == FMOD_OK or result == FMOD_ERR_CHANNEL_STOLEN or\n result == FMOD_ERR_FILE_NOT_FOUND\n raise \"FMOD Ex returned error #{result}\"\n end\n return result\n end", "title": "" }, { "docid": "c7ac8d4673cddd8e69e922eb4c485abd", "score": "0.50492084", "text": "def invoke(name, *args)\n fn = @functions[name]\n raise \"function not imported: #{name}\" if fn.nil?\n result = fn.call(*args)\n unless result == FMOD_OK or result == FMOD_ERR_CHANNEL_STOLEN or\n result == FMOD_ERR_FILE_NOT_FOUND\n raise \"FMOD Ex returned error #{result}\"\n end\n return result\n end", "title": "" }, { "docid": "ba690d9e090f4e996051a10c980bd395", "score": "0.50303835", "text": "def invoke_action(name)\n send(name)\n unless already_built_response?\n render name\n end\n end", "title": "" }, { "docid": "45776b74e0ddd93dfe0a353fb38f9a79", "score": "0.5029077", "text": "def handle\n @codes[5]\n end", "title": "" }, { "docid": "45776b74e0ddd93dfe0a353fb38f9a79", "score": "0.5029077", "text": "def handle\n @codes[5]\n end", "title": "" }, { "docid": "20f64e4ac6a8dd1a00128804aaed468f", "score": "0.5024834", "text": "def perform_action(type, route, params={})\n type = type.downcase\n action = @requests[type.to_sym]\n return redirect(404) unless action[route]\n response(type, params) + action[route].call(params)\n end", "title": "" }, { "docid": "57e28e99286fb7819ec017b81ee283ae", "score": "0.5024736", "text": "def exec_response_handler(handler, *args)\n ensure_response!(self.instance_exec(*args, &handler))\n end", "title": "" }, { "docid": "44a9a30792416c298fcca574651467e8", "score": "0.5023877", "text": "def method_missing(sym, *args)\n called_callback(sym.to_s[HANDLE_PREFIX.size..-1].to_sym) if sym.to_s.starts_with?(HANDLE_PREFIX)\n end", "title": "" }, { "docid": "c8956ddbeeca20c2f662a81b981e07ea", "score": "0.50228196", "text": "def handle\n node_sig = \"#{@rjr_node_id}(#{@rjr_node_type})\"\n method_sig = \"#{@rjr_method}(#{@rjr_method_args.join(',')})\"\n\n RJR::Logger.info \"#{node_sig}->#{method_sig}\"\n\n # TODO option to compare arity of handler to number\n # of method_args passed in ?\n retval = instance_exec(*@rjr_method_args, &@rjr_handler)\n\n RJR::Logger.info \\\n \"#{node_sig}<-#{method_sig}<-#{retval.nil? ? \"nil\" : retval}\"\n\n return retval\n end", "title": "" }, { "docid": "84949ce9c875169dcfceacbb817fa2de", "score": "0.50205576", "text": "def invoke_action(name)\n send(name)\n render(name.to_s) unless already_built_response?\n end", "title": "" }, { "docid": "5a47f6b7281d76ad1caa7cc4b4ee7ab3", "score": "0.5019459", "text": "def deleteHandler(name)\n @handlers.each do |handler|\n if handler[:name] == name\n handler[:socket].close\n if !handler[:thread].nil? && handler[:thread].alive?\n handler[:thread].running = false\n handler[:thread].join\n end\n @handler.delete(handler)\n return 0\n end\n end\n return -1\n end", "title": "" }, { "docid": "46f4debf3b0bf941e4d878c6dc33e17f", "score": "0.5018341", "text": "def method_missing(name, *args, &block)\n ::Callback.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{name}(*args, &block) # def success(*args, &block)\n if block # if block\n @callbacks[:#{name}] = block # @callbacks[:success] = block\n else # else\n callback = @callbacks[:#{name}] # callback = @callbacks[:success]\n if callback # if callback\n callback.call(*args) # callback.call(*args)\n elsif @raise_on_missing # elsif @raise_on_missing\n ::Kernel.raise ::NoMethodError, \"undefined callback: #{name}\" # ::Kernel.raise ::NoMethodError, \"undefined callback: success\"\n end # end\n end # end\n end # end\n RUBY\n # Now that the method is defined, we simply call it\n __send__(name, *args, &block)\n end", "title": "" }, { "docid": "8a58b47ffe3815a69317bf88bbe00f27", "score": "0.50015044", "text": "def method_missing(symbol, *args)\n\t\t\t\tif(args == nil or args.length == 0)\n\t\t\t\t\treturn lookup(symbol.id2name)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tsuper.method(symbol).call(args)\n\t\t\tend", "title": "" }, { "docid": "1acdd0a129725dc24c8d218d7d7d1c94", "score": "0.49906045", "text": "def cmd_generic_handler(*args)\n cmd = __callee__.to_s.gsub(/^cmd_/,'')\n @@generic_opts.parse(args) { |opt, idx, val|\n case opt\n when \"-h\"\n cmd_generic_handler_help(cmd)\n return true\n end\n }\n if not has_required_args(cmd, args)\n print_error(\"Not all required arguments were used. See command help (-h)\")\n return true\n end\n res = client.custom_methods.send_request(cmd, args, @custom_methods)\n print_status(res[\"status\"]) if res.key? \"status\"\n print_status(res[\"value\"]) if res.key? \"value\"\n end", "title": "" }, { "docid": "cdfcf6640c9781bfb920d20def6289db", "score": "0.4988669", "text": "def dispatch env\n #req = Rack::Request.new(env)\n uri = (URI.parse env['REQUEST_URI'])\n if func = (match uri)\n func.call uri, env\n else\n puts \" !! no handler for: #{req.fullpath} -- #{@mounts.keys.inspect}\"\n [404, {\"Content-Type\"=>\"text/plain\"}, [\"Not Found\"]]\n end\n rescue => e\n puts \" ## #{e}\\n -> #{e.backtrace.join \"\\n \"}\"\n [500, {\"Content-Type\"=>\"text/plain\"}, [e]]\n end", "title": "" }, { "docid": "76eae85867e51a0ce9122a51e8d86904", "score": "0.49855968", "text": "def dispatch_action(klass, action_name, status=200)\n @env[\"merb.status\"] = status\n @env[\"merb.action_name\"] = action_name\n\n if Dispatcher.use_mutex\n @@mutex.synchronize { klass.call(env) }\n else\n klass.call(env)\n end\n end", "title": "" }, { "docid": "43d40a555a97de00e140a5ac7c88976a", "score": "0.49846935", "text": "def method_missing(method, *args, &block)\n if method.to_s.last == '?'\n status == method.to_s[0..-2].to_sym\n else\n super\n end\n end", "title": "" }, { "docid": "be6f6db6b843968b1fe62c5a57a30925", "score": "0.4981796", "text": "def handler(name)\n config = generate_config(name, \"handler\")\n generate_templates(config)\n post_messages(config)\n end", "title": "" }, { "docid": "5217494a5ef7bd2eb096ef7263b9af77", "score": "0.4974073", "text": "def dispatch(type, message)\n handlers[type].each {|handler| handler.dispatch(message) }\n end", "title": "" }, { "docid": "a3fee2f8521fd83c0f159906dc48b391", "score": "0.4971965", "text": "def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n nil\n end", "title": "" }, { "docid": "fc971b323ef54bcd4528a04b510e949b", "score": "0.4968449", "text": "def call_handler(handler_input=nil)\n if not @handler.nil? and @handler.respond_to?(\"call\")\n @handler.call (handler_input)\n end\n true\n rescue => e\n logger.info \"Job #{@name} encountered exception raised from handler call: #{e.message}\"\n @exception = e unless not @exception.nil? # Don't overwrite previous exception\n @state=\"handler_exception\"\n ensure\n @state \n end", "title": "" }, { "docid": "88a18bbeb8beba2be2e6234e21b56d81", "score": "0.4964918", "text": "def run\n check\n rescue StatusError => e\n rescue => e\n e = StatusError.new(:unknown, ([e.to_s, nil] + e.backtrace).join(\"\\n\"))\n else\n e = StatusError.new(:unknown, 'no status method was called')\n ensure\n puts [service, e.to_s].join(' ')\n exit e.to_i\n end", "title": "" }, { "docid": "14f65dbb7dce9fafadcdc4750dedf6fe", "score": "0.4964616", "text": "def invoke_action(name)\n #use send to call the passed in action\n self.send(name)\n render(name) unless responsed?\n\n nil\n end", "title": "" }, { "docid": "b2c8a8a06aa615f70cc54c6623ee9111", "score": "0.49634734", "text": "def invoke_action(name)\n end", "title": "" }, { "docid": "b2c8a8a06aa615f70cc54c6623ee9111", "score": "0.49634734", "text": "def invoke_action(name)\n end", "title": "" }, { "docid": "b2c8a8a06aa615f70cc54c6623ee9111", "score": "0.49634734", "text": "def invoke_action(name)\n end", "title": "" }, { "docid": "b2c8a8a06aa615f70cc54c6623ee9111", "score": "0.49634734", "text": "def invoke_action(name)\n end", "title": "" }, { "docid": "b2c8a8a06aa615f70cc54c6623ee9111", "score": "0.49634734", "text": "def invoke_action(name)\n end", "title": "" }, { "docid": "b2c8a8a06aa615f70cc54c6623ee9111", "score": "0.49634734", "text": "def invoke_action(name)\n end", "title": "" }, { "docid": "b2c8a8a06aa615f70cc54c6623ee9111", "score": "0.49634734", "text": "def invoke_action(name)\n end", "title": "" }, { "docid": "b43b034e6d9ce43018c64e6edfeb83cd", "score": "0.49578452", "text": "def method_missing(name, *_args, &_block)\n raise 'Invalid Method Name' if name.to_path.empty?\n api_request(name)\n end", "title": "" }, { "docid": "67d64dd0b8b193332e859fed973045de", "score": "0.4957302", "text": "def invoke_action(name)\n debugger\n self.send(name)\n render(name) unless already_built_response?\n end", "title": "" }, { "docid": "a86747c5594bc08d34fe7f97a907aa02", "score": "0.495554", "text": "def method_missing(method_name, *args, &block)\n begin\n response = @heroku.__send__(method_name.to_sym, *args, &block)\n response.body\n rescue Heroku::API::Errors::ErrorWithResponse => error\n message = error.response.status == 404 ? \"#{Helper.yellow(args[0])} does not exists\" : JSON.parse(error.response.body)[\"error\"]\n status = error.response.headers[\"Status\"]\n\n raise <<-OUTPUT\n #{Helper.red(error.class)}:\n Status: #{status}\n Message: #{message}\n OUTPUT\n end\n end", "title": "" }, { "docid": "00fe2523d33cdf8554482a52cf7233a2", "score": "0.4951926", "text": "def invoke_action(name)\n send(name)\n end", "title": "" }, { "docid": "1f92dd3eecd55b20cb7e5e4703bb4cae", "score": "0.49496713", "text": "def run(req, res)\n route = match(req)\n if route\n route.run(req, res)\n else\n res.status = \"404\"\n end\n end", "title": "" }, { "docid": "8c0cda16abc5c4bc373d526f7500ddd5", "score": "0.494112", "text": "def run(req, res)\n route = match(req)\n if route\n route.run(req, res)\n else\n res.status = 404\n end\n end", "title": "" } ]
d30b12b8874b7236d562ea82ae7193c8
_unpack_externsheet() Unpack the EXTERNSHEET recordfor easier comparison.
[ { "docid": "4ecfdc4b203d8ed2d4a506d4ce5fdeb6", "score": "0.7245539", "text": "def _unpack_externsheet(data)\n externsheet = Hash.new\n\n externsheet['record'] = data[0, 2].unpack('v')[0]\n data[0, 2] = ''\n externsheet['length'] = data[0, 2].unpack('v')[0]\n data[0, 2] = ''\n externsheet['count'] = data[0, 2].unpack('v')[0]\n data[0, 2] = ''\n externsheet['array'] = [];\n\n externsheet['count'].times do\n externsheet['array'] << data[0, 6].unpack('vvv')\n data[0, 6] = ''\n end\n externsheet\n end", "title": "" } ]
[ { "docid": "ecfceb4510b86b44924720cfdc1872b2", "score": "0.6093262", "text": "def store_externsheet # :nodoc:\n record = 0x0017 # Record identifier\n\n # Get the external refs\n\n ext = @ext_refs.keys.sort {|a, b| @ext_refs[a].to_i <=> @ext_refs[b].to_i}\n\n # Change the external refs from stringified \"1:1\" to [1, 1]\n ext.map! {|e| e.split(/:/).map! {|v| v.to_i} }\n\n cxti = ext.size # Number of Excel XTI structures\n rgxti = '' # Array of XTI structures\n\n # Write the XTI structs\n ext.each do |e|\n rgxti += [0, e[0], e[1]].pack(\"vvv\")\n end\n\n data = [cxti].pack(\"v\") + rgxti\n header = [record, data.bytesize].pack(\"vv\")\n\n append(header, data)\n end", "title": "" }, { "docid": "f3e5fc1d40f5b8c4dab08d8b56b4dad4", "score": "0.6025138", "text": "def store_externsheet\n record = 0x0017 # Record identifier\n\n # Get the external refs\n ext_refs = @ext_refs\n ext = ext_refs.keys.sort\n\n # Change the external refs from stringified \"1:1\" to [1, 1]\n ext.map! {|e| e.split(/:/).map! {|e| e.to_i} }\n\n cxti = ext.size # Number of Excel XTI structures\n rgxti = '' # Array of XTI structures\n\n # Write the XTI structs\n ext.each do |e|\n rgxti = rgxti + [0, e[0], e[1]].pack(\"vvv\")\n end\n\n data = [cxti].pack(\"v\") + rgxti\n header = [record, data.length].pack(\"vv\")\n\n append(header, data)\n end", "title": "" }, { "docid": "1bcffae55004a62cd2248dd6aac92320", "score": "0.5430998", "text": "def calculate_extern_sizes\n ext_refs = @parser.get_ext_sheets\n ext_ref_count = ext_refs.keys.size\n length = 0\n index = 0\n\n @worksheets.each do |worksheet|\n\n rowmin = worksheet.title_rowmin\n colmin = worksheet.title_colmin\n filter = worksheet.filter_count\n key = \"#{index}:#{index}\"\n index += 1\n\n # Add area NAME records\n #\n if !worksheet.print_rowmin.nil? && worksheet.print_rowmin != 0\n if ext_ref[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n length += 31\n end\n\n # Add title NAME records\n #\n if rowmin and colmin\n if ext_ref[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n\n length += 46\n elsif rowmin or colmin\n if ext_ref[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n length += 31\n else\n # TODO, may need this later.\n end\n\n # Add Autofilter NAME records\n #\n if filter != 0\n if ext_refs[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n length += 31\n end\n end\n\n # Update the ref counts.\n @ext_ref_count = ext_ref_count\n @ext_refs = ext_refs\n\n # If there are no external refs then we don't write, SUPBOOK, EXTERNSHEET\n # and NAME. Therefore the length is 0.\n\n return length = 0 if ext_ref_count == 0\n\n # The SUPBOOK record is 8 bytes\n length += 8\n\n # The EXTERNSHEET record is 6 bytes + 6 bytes for each external ref\n length += 6 * (1 + ext_ref_count)\n\n return length\n end", "title": "" }, { "docid": "2a455cbe45ca99175c48be4a1c50e4cb", "score": "0.54200935", "text": "def calculate_extern_sizes # :nodoc:\n ext_refs = @parser.get_ext_sheets\n length = 0\n index = 0\n\n unless defined_names.empty?\n index = 0\n key = \"#{index}:#{index}\"\n\n add_ext_refs(ext_refs, key) unless ext_refs.has_key?(key)\n end\n\n defined_names.each do |defined_name|\n length += 19 + defined_name[:name].bytesize + defined_name[:formula].bytesize\n end\n\n @worksheets.each do |worksheet|\n key = \"#{index}:#{index}\"\n index += 1\n\n # Add area NAME records\n #\n if worksheet.print_range.row_min\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 31\n end\n\n # Add title NAME records\n #\n if worksheet.title_range.row_min && worksheet.title_range.col_min\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 46\n elsif worksheet.title_range.row_min || worksheet.title_range.col_min\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 31\n else\n # TODO, may need this later.\n end\n\n # Add Autofilter NAME records\n #\n unless worksheet.filter_count == 0\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 31\n end\n end\n\n # Update the ref counts.\n ext_ref_count = ext_refs.keys.size\n @ext_refs = ext_refs\n\n # If there are no external refs then we don't write, SUPBOOK, EXTERNSHEET\n # and NAME. Therefore the length is 0.\n\n return length = 0 if ext_ref_count == 0\n\n # The SUPBOOK record is 8 bytes\n length += 8\n\n # The EXTERNSHEET record is 6 bytes + 6 bytes for each external ref\n length += 6 * (1 + ext_ref_count)\n\n length\n end", "title": "" }, { "docid": "43f883cf535524eb5cf8d3e0bda6d3ab", "score": "0.519792", "text": "def store_externsheet(sheetname) #:nodoc:\n record = 0x0017 # Record identifier\n # length; # Number of bytes to follow\n\n # cch # Length of sheet name\n # rgch # Filename encoding\n\n # References to the current sheet are encoded differently to references to\n # external sheets.\n #\n if @name == sheetname\n sheetname = ''\n length = 0x02 # The following 2 bytes\n cch = 1 # The following byte\n rgch = 0x02 # Self reference\n else\n length = 0x02 + sheetname.bytesize\n cch = sheetname.bytesize\n rgch = 0x03 # Reference to a sheet in the current workbook\n end\n\n header = [record, length].pack('vv')\n data = [cch, rgch].pack('CC')\n\n prepend(header, data, sheetname)\n end", "title": "" }, { "docid": "5cb42b1f8fb8b1afa07dc8e1a24537c6", "score": "0.5187889", "text": "def import_sheetcells\n column_info_lookup = @header_info_lookup.values # a nested array [[columnr, column_id, datatype_id], ...]\n counter = 0\n sheetcells_in_queue = []\n\n 1.upto(raw_data_sheet.row_count - 1).each do |rownr|\n raw_data_sheet.row(rownr).each_with_index do |cell, columnnr|\n cell = convert_to_string(cell)\n next if cell.blank? || !column_info_lookup.assoc(columnnr) # Skip columns with blank headers\n\n sheetcells_in_queue << [column_info_lookup.assoc(columnnr)[1], cell, rownr + 1, column_info_lookup.assoc(columnnr)[2]]\n counter += 1\n end\n\n next unless counter >= 1000\n\n save_data_into_database(sheetcells_in_queue, rownr)\n counter = 0\n sheetcells_in_queue.clear\n end\n save_data_into_database(sheetcells_in_queue, raw_data_sheet.row_count - 1)\n end", "title": "" }, { "docid": "c95414b8803531814929842ef01b07ad", "score": "0.5106807", "text": "def extract_sheet_at_index(tmpdir, idx)\n Roo::ZipFile.open(@filename) do |zip|\n Roo::ZipFile.open(@filename) do |zf|\n zf.entries.each do |entry|\n next unless entry.to_s.downcase =~ /sheet([#{idx+1}]+).xml$/\n file_name = \"roo_sheet#{idx}\"\n open(tmpdir+'/'+file_name,'wb') {|f| f << zip.read(entry) }\n return File.join(tmpdir, file_name)\n end\n end\n end\n end", "title": "" }, { "docid": "407863a73d3e10340990cdf9a736feec", "score": "0.50062424", "text": "def unpack identifier_hash\n data = identifier_hash_for identifier_hash #returns latest version identifier_hash if given ckan_identifier or just returns if given an identifier_hash\n zip_name = \"#{data[:identifier]}-#{data[:version]}.zip\"\n msg \"Unpacking #{zip_name}\"\n unpacked_cfg_paths = []\n Zip::ZipFile.open(File.join([@dir, @mod_dir, zip_name])) do |zip| \n zip.each do |entry| \n if entry && entry.name.match(/.cfg$/)\n path = entry.name\n path = File.join([\"GameData\", path]) unless path.match(/^GameData/) \n path = File.join([@dir, path])\n unpacked_cfg_paths << path\n FileUtils.mkpath File.dirname(path)\n if File.exists?(path)\n File.delete(path)\n log_error \"WARNING; replacing file - '#{path}'\" if @verbose\n end\n entry.extract(path)\n end\n end\n end\n unpacked_cfg_paths #return array of paths to the unpacked .cfg files\n end", "title": "" }, { "docid": "537bab44cb4462bd5f473ab91bcb1c72", "score": "0.4961803", "text": "def get_ext_sheets\n @ext_refs\n end", "title": "" }, { "docid": "b529cee89089873d0bf58835c373b557", "score": "0.49044588", "text": "def r_boundsheet8\n @serial = true\n\n lb_ply_pos, attrs, dt = @bytes.read(6).unpack('VCC')\n hs_state = Unxls::BitOps.new(attrs).value_at(0..1)\n\n visibility = {\n 0 => :visible,\n 1 => :hidden,\n 2 => :very_hidden # The sheet is hidden and cannot be displayed using the user interface.\n }[hs_state]\n\n # This is very similar to BOF.dt values table but still different\n type = {\n 0 => :dialog_or_work_sheet, # The sheet substream that starts with the BOF record specified in lbPlyPos MUST contain one WsBool record. If the fDialog field in that WsBool is 1 then the sheet is dialog sheet. Otherwise, the sheet is a worksheet.\n 1 => :macro,\n 2 => :chart,\n 6 => :vb_module\n }[dt]\n\n {\n lbPlyPos: lb_ply_pos, # lbPlyPos (4 bytes): A FilePointer as specified in [MS-OSHARED] section 2.2.1.5 that specifies the stream position of the start of the BOF record for the sheet.\n hsState: hs_state, # A - hsState (2 bits): An unsigned integer that specifies the hidden state of the sheet.\n hsState_d: visibility,\n # unused (6 bits): Undefined and MUST be ignored.\n dt: dt, # dt (8 bits): An unsigned integer that specifies the sheet type.\n dt_d: type,\n stName: Unxls::Biff8::Structure.shortxlunicodestring(@bytes) # stName (variable): A ShortXLUnicodeString structure that specifies the unique case-insensitive name of the sheet.\n }\n end", "title": "" }, { "docid": "c442ddaaa02797ce91912481fbd881a0", "score": "0.48795536", "text": "def calc_sheet_offsets #:nodoc:\n offset = @datasize\n\n # Add the length of the COUNTRY record\n offset += 8\n\n # Add the length of the SST and associated CONTINUEs\n offset += calculate_shared_string_sizes\n\n # Add the length of the EXTSST record.\n offset += calculate_extsst_size(@shared_string_table.str_unique)\n\n # Add the length of the SUPBOOK, EXTERNSHEET and NAME records\n offset += calculate_extern_sizes\n\n # Add the length of the MSODRAWINGGROUP records including an extra 4 bytes\n # for any CONTINUE headers. See add_mso_drawing_group_continue().\n mso_size = @mso_size\n mso_size += 4 * Integer((mso_size -1) / Float(@limit))\n offset += mso_size\n\n @worksheets.each do |sheet|\n offset += BOF + sheet.name.bytesize\n end\n\n offset += EOF\n @worksheets.each do |sheet|\n sheet.offset = offset\n sheet.close\n offset += sheet.datasize\n end\n\n @biffsize = offset\n end", "title": "" }, { "docid": "93a3ee613508dc3138a894b834080965", "score": "0.48512885", "text": "def sheet_to_arr(sheet_name)\n xl = Roo::Spreadsheet.open('src.xlsx')\n sheet = xl.sheet(sheet_name)\n headers = sheet.row(3) #headers are on row 3\n headers_hash = {}\n headers.each do |h| headers_hash[h] = h if h.is_a? String end\n\n def actual_cell(hash)\n (hash['Level']!= nil || hash['Top Constraint']!= nil) &&\n hash['Level'] != 'Level' && \n hash['Top Constraint'] != 'Top Constraint' \n end\n\n arr = []\n sheet.each(headers_hash) do |hash|\n hash['sheet_name'] = sheet_name\n arr << hash if actual_cell(hash)\n end\n arr\nend", "title": "" }, { "docid": "91078599b26a5bbfddea1a22f76c9296", "score": "0.48182783", "text": "def unpack\n return @unpacked_file\n end", "title": "" }, { "docid": "9e3e22b8825ab97b9ec1e993d394bb89", "score": "0.4817796", "text": "def pack_ext_ref(ext_ref)\n ext_ref.sub!(/^'/,'') # Remove leading ' if any.\n ext_ref.sub!(/'$/,'') # Remove trailing ' if any.\n\n # Check if there is a sheet range eg., Sheet1:Sheet2.\n if (ext_ref =~ /:/)\n sheet1, sheet2 = ext_ref.split(':')\n\n sheet1 = get_sheet_index(sheet1)\n sheet2 = get_sheet_index(sheet2)\n\n # Reverse max and min sheet numbers if necessary\n if (sheet1 > sheet2)\n sheet1, sheet2 = [sheet2, sheet1]\n end\n else\n # Single sheet name only.\n sheet1, sheet2 = [ext_ref, ext_ref]\n\n sheet1 = get_sheet_index(sheet1)\n sheet2 = sheet1\n end\n\n key = \"#{sheet1}:#{sheet2}\"\n\n if @ext_refs[key].nil?\n index = get_ext_ref_count\n @ext_refs[key] = index\n @ext_ref_count += 1\n else\n index = @ext_refs[key]\n end\n\n [index].pack(\"v\")\n end", "title": "" }, { "docid": "ae656d2904bd0166580928b2c7533cb7", "score": "0.47772455", "text": "def import_spreadsheet\n RoNonAvailability.import_ro_non_availability(self)\n CoNonAvailability.import_co_non_availability(self)\n Allocation.import_allocation(self)\n end", "title": "" }, { "docid": "3f1041014e0be121baa2f0efb4ab80a1", "score": "0.4760045", "text": "def prepare_spreadsheet(filename)\n # open the file with RubyXL\n xls = RubyXL::Parser.parse(filename)\n data = {}\n xls.worksheets.each do |sheet|\n title = sheet.sheet_name\n # if the sheet is called microcopy, copy or ends with copy, we assume\n # the first column contains keys and the second contains values.\n # Like tarbell.\n if %w(microcopy copy).include?(title.downcase) ||\n title.downcase =~ /[ -_]copy$/\n data[title] = load_microcopy(sheet.extract_data)\n else\n # otherwise parse the sheet into a hash\n data[title] = load_table(sheet.extract_data)\n end\n end\n return data\n end", "title": "" }, { "docid": "6967dfe37da2d058f5b11068da07d0f2", "score": "0.4758285", "text": "def prepare_spreadsheet(filename)\n # open the file with RubyXL\n xls = RubyXL::Parser.parse(filename)\n data = {}\n xls.worksheets.each do |sheet|\n title = sheet.sheet_name\n # if the sheet is called microcopy, copy or ends with copy, we assume\n # the first column contains keys and the second contains values.\n # Like tarbell.\n if %w(microcopy copy).include?(title.downcase) ||\n title.downcase =~ /[ -_]copy$/\n data[title] = load_microcopy(sheet.extract_data)\n else\n # otherwise parse the sheet into a hash\n data[title] = load_table(sheet.extract_data)\n end\n end\n data\n end", "title": "" }, { "docid": "80956135c737c05c4eec3235802d93b1", "score": "0.47361943", "text": "def extract_aged_receivables\n real_estate_property_id = RealEstateProperty.find_by_id(@options[:real_estate_id]).id\n # real_estate_property_id wants to be loaded here\n head = OpenStruct.new\n @base_cells.each do |rip|\n unless rip[1][\"sheet\"][\"name\"].include?(\"TASK\")\n #~ book.default_sheet = rip\n 1.upto find_last_base_cell(rip[0]) do |roww|\n if read_via_numeral(roww, 1,rip[0]) == 'bldg - lease #'\n 1.upto find_last_column(rip[0]) do |coll|\n case read_via_numeral(roww, coll,rip[0])\n when 'tenant'; head.tenant = coll\n when 'Amount'; head.amount = coll\n when 'Current'; head.current = coll\n when '30 Days'; head.days_30 = coll\n when '60 Days'; head.days_60 = coll\n when '90 Days'; head.days_90 = coll\n when '120 Days'; head.days_120 = coll\n end\n end\n head.start = roww\n break;\n end\n end\n break;\n end\n end\n @base_cells.each do |rip|\n if !rip[1][\"sheet\"][\"name\"].include?('TASK') # sheet title must contain 'AR' else not extracted\n sheet_date = read_via_numeral(3,1,rip[0]).nil? ? OpenStruct.new({:year=>nil, :month=>nil}) : (read_via_numeral(3,1,rip[0]).split(' ').last.to_date rescue read_via_numeral(3,1,rip[0]).split(' ').last.gsub('/','-').to_date) # Finding the month and year from excel\n year = sheet_date.year\n month = sheet_date.month\n ActiveRecord::Base.connection.execute(\"delete t1 from property_suites as t0, property_aged_receivables as t1 where t0.real_estate_property_id = #{real_estate_property_id} and t1.property_suite_id = t0.id and t1.month = #{month} and t1.year = #{year};\") unless month.nil? and year.nil?\n head.start.next.upto find_last_base_cell(rip[0]) do |row|\n next if read_via_numeral(row, head.tenant,rip[0]).nil? || read_via_numeral(row, head.tenant,rip[0]).empty?\n break if (read_via_numeral(row, head.tenant,rip[0]) == \"grand total:\" || read_via_numeral(row, head.tenant,rip[0]) == \"grand total\") # exits when see the grand total in excel.\n suite_id = read_via_numeral_abs(row, 1,rip[0]).nil? ? nil : read_via_numeral_abs(row, 1,rip[0]).to_s.gsub('.0', '')#.split(' ').last\n prop_suite = suite_id.nil? ? {'id' => nil} : PropertySuite.find_or_create_by_real_estate_property_id_and_suite_number(real_estate_property_id, suite_id)\n prop_aged_rec = PropertyAgedReceivable.new\n prop_aged_rec.property_suite_id = prop_suite['id']\n prop_aged_rec.tenant = read_via_numeral(row,head.tenant,rip[0])\n prop_aged_rec.amount = read_via_numeral(row,head.amount,rip[0])\n prop_aged_rec.paid_amount = read_via_numeral(row, head.current,rip[0])\n prop_aged_rec.over_30days = read_via_numeral(row, head.days_30,rip[0])\n prop_aged_rec.over_60days = read_via_numeral(row, head.days_60,rip[0])\n prop_aged_rec.over_90days = read_via_numeral(row, head.days_90,rip[0])\n prop_aged_rec.over_120days = read_via_numeral(row, head.days_120,rip[0])\n prop_aged_rec.month = month\n prop_aged_rec.year = year\n prop_aged_rec.save\n end unless month.nil? and year.nil?\n end\n end\n end", "title": "" }, { "docid": "93b8e94bff66d49b91489a5c48aee8f0", "score": "0.46851343", "text": "def unpack_archive\n raise NotImplementedError\n end", "title": "" }, { "docid": "5bfde659a1f8b57529e4c41b223cfbc0", "score": "0.46840975", "text": "def excel_init(path_to_excel_file)\n Spreadsheet.client_encoding = 'UTF-8'\n # open the excel file for reading\n timetable = Spreadsheet.open path_to_excel_file\n # open the target excel tab 'course assignment'\n @assignment = timetable.worksheet 0\n # identify the sheet information\n dim = @assignment.dimensions\n @first_row = dim[0]\n @last_row = dim[1]\n @first_col = dim[2]\n @last_col = dim[3]\n \n # index of the columns that have specific information\n # and column sign which can help us to recognize them \n @subject_col = 0; subject_text = 'SUBJECT'\n @lec_col = 0; lec_text = 'LECTURES'\n @tut_col = 0; tut_text = 'TUTORIAL'\n @lab_col = 0; lab_text = 'LABORATORY'\n @subject_row = 0;\n @indexes = 4\n \n catch \"FoundRealFirstRow\" do\n @first_row.upto(@last_row) do |rid|\n @first_col.upto(@last_col) do |cid|\n if !(@assignment.cell(rid, cid).nil?)\n @first_row = rid\n throw \"FoundRealFirstRow\"\n end\n end\n end\n end\n catch \"FoundRealLastRow\" do\n @last_row.downto(@first_row) do |rid|\n @first_col.upto(@last_col) do |cid|\n if !(@assignment.cell(rid, cid).nil?)\n @last_row = rid\n throw \"FoundRealLastRow\"\n end\n end\n end\n end\n # need to identify the indexes first\n count_col = 0\n catch \"FoundAllHeaders\" do\n @first_row.upto(@last_row) do |rid|\n @first_col.upto(@last_col) do |cid|\n # is_found: the content of the cell is match with the header\n is_found = true\n case @assignment.cell(rid, cid)\n when subject_text then\n @subject_col = cid\n @subject_row = rid\n when lec_text then @lec_col = cid\n when tut_text then @tut_col = cid\n when lab_text then @lab_col = cid\n else is_found = false\n end\n if (is_found) \n count_col = count_col + 1\n end\n # break the loop if we found all the indexes\n throw \"FoundAllHeaders\" if (count_col == @indexes)\n end\n end\n end\n\nif (@lec_col == 0 )\nif (@tut_col == 0 )\nif (@lab_col == 0 )\n\t(@first_row+3).upto(@last_row) do |rid|\n\t\tstaff_exist=Staff.find_by_sql(\"Select * from staffs where staffName='#{@assignment.cell(rid, 0)}'\")\n\t\tif staff_exist.length>0\n\t\telse\n\t\tstaff = Staff.new\n\t\tstaff.staffName=@assignment.cell(rid, 0)\n\t\tstaff.designation=@assignment.cell(rid, 3)\n\t\tstaff.division=@assignment.cell(rid, 1)\n\t\tstaff.school=@assignment.cell(rid, 2)\n\t\tstaff.email=@assignment.cell(rid, 6)\n\t\tstaff.roomNo=@assignment.cell(rid, 4)\n\t\tstaff.extNo=@assignment.cell(rid, 5)\n\t\tstaff.subjectAssigned=@assignment.cell(rid, 7)\n\t\tstaff.remarks=@assignment.cell(rid, 8)\n\t\tstaff.save\n\t\tend\n\tend\t\t\t\t \nend\nend\nend\n\n end", "title": "" }, { "docid": "b9f3b541486ff7e6528b7e52c849977e", "score": "0.46688595", "text": "def unpack\n @unpack ||= mapped\n end", "title": "" }, { "docid": "0f2ef944955a11f5c0b0a966fb0862fc", "score": "0.46476656", "text": "def sheets_info\n if @info[:default_sheet]\n @info[:default_sheet] = verify_sheet_name(@info[:default_sheet])\n @info[:sheets].merge!(sheet_info(@info[:default_sheet]))\n else\n @info[:sheets_name].each { |name| @info[:sheets].merge!(sheet_info(name)) }\n @workbook.default_sheet = @info[:sheet_current]\n end\n end", "title": "" }, { "docid": "fb3bfe3deb5ae9decb23c72028731754", "score": "0.45977354", "text": "def r_xfext\n @serial = true\n\n result = { frtHeader: Unxls::Biff8::Structure.frtheader(@bytes.read(12)) }\n result.merge(Unxls::Biff8::Structure._xfext(@bytes))\n end", "title": "" }, { "docid": "83e900f978b2d1d9f7585f6b8419efbd", "score": "0.4597316", "text": "def parts\n parts = [\n { entry: \"xl/#{STYLES_PN}\", doc: workbook.styles, schema: SML_XSD },\n { entry: CORE_PN, doc: @core, schema: CORE_XSD },\n { entry: APP_PN, doc: @app, schema: APP_XSD },\n { entry: WORKBOOK_RELS_PN, doc: workbook.relationships, schema: RELS_XSD },\n { entry: WORKBOOK_PN, doc: workbook, schema: SML_XSD }\n ]\n\n workbook.drawings.each do |drawing|\n parts << { entry: \"xl/#{drawing.rels_pn}\", doc: drawing.relationships, schema: RELS_XSD }\n parts << { entry: \"xl/#{drawing.pn}\", doc: drawing, schema: DRAWING_XSD }\n end\n\n workbook.tables.each do |table|\n parts << { entry: \"xl/#{table.pn}\", doc: table, schema: SML_XSD }\n end\n workbook.pivot_tables.each do |pivot_table|\n cache_definition = pivot_table.cache_definition\n parts << { entry: \"xl/#{pivot_table.rels_pn}\", doc: pivot_table.relationships, schema: RELS_XSD }\n parts << { entry: \"xl/#{pivot_table.pn}\", doc: pivot_table } # , :schema => SML_XSD}\n parts << { entry: \"xl/#{cache_definition.pn}\", doc: cache_definition } # , :schema => SML_XSD}\n end\n\n workbook.comments.each do |comment|\n unless comment.empty?\n parts << { entry: \"xl/#{comment.pn}\", doc: comment, schema: SML_XSD }\n parts << { entry: \"xl/#{comment.vml_drawing.pn}\", doc: comment.vml_drawing, schema: nil }\n end\n end\n\n workbook.charts.each do |chart|\n parts << { entry: \"xl/#{chart.pn}\", doc: chart, schema: DRAWING_XSD }\n end\n\n workbook.images.each do |image|\n parts << { entry: \"xl/#{image.pn}\", path: image.image_src } unless image.remote?\n end\n\n if use_shared_strings\n parts << { entry: \"xl/#{SHARED_STRINGS_PN}\", doc: workbook.shared_strings, schema: SML_XSD }\n end\n\n workbook.worksheets.each do |sheet|\n parts << { entry: \"xl/#{sheet.rels_pn}\", doc: sheet.relationships, schema: RELS_XSD }\n parts << { entry: \"xl/#{sheet.pn}\", doc: sheet, schema: SML_XSD }\n end\n\n # Sort parts for correct MIME detection\n [\n { entry: CONTENT_TYPES_PN, doc: content_types, schema: CONTENT_TYPES_XSD },\n { entry: RELS_PN, doc: relationships, schema: RELS_XSD },\n *parts.sort_by { |part| part[:entry] }.reverse\n ]\n end", "title": "" }, { "docid": "ef17e9d1da694c01cf12d0828c9d6632", "score": "0.45700967", "text": "def unpack dir = nil\r\n Zip::File.open @file do |zip|\r\n zip.each_entry do |e|\r\n path = dir.nil? ? e.name : \"#{dir}/#{e.name}\"\r\n e.extract path unless e.name == @warning_file\r\n end\r\n end\r\n end", "title": "" }, { "docid": "4ddab7bb525b3c458a7ed17c38e9c711", "score": "0.45606664", "text": "def test_Spreadhseet_002_parse_spreadsheet\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Spreadhseet_002_parse_spreadsheet\")\n puts2(\"#######################\")\n\n #$VERBOSE = true\n\n sDataDir = \"data\"\n\n aWorkbookFiles = [\"Book1.xls\", \"Book1.xlsx\", \"Book1.ods\"]\n\n sSpreadsheet = nil\n #sSpreadsheet = \"Employees\"\n\n # true = read only to the first blank row\n # false = Read whole sheet\n bStopatBlankRow = true\n\n # Loop through workbook types\n aWorkbookFiles.each do | sWorkbookFile |\n\n aSpreadsheetContents_byRow = parse_spreadsheet(sWorkbookFile, sSpreadsheet, sDataDir, bStopatBlankRow)\n\n aSpreadsheetContents_byRow.each do | sRowData |\n puts2(sRowData)\n end\n\n puts2(\"\\n\")\n\n end # Loop through workbook types\n\n\n\n\n end", "title": "" }, { "docid": "6b636b85614f30f8b48f4d68fdfd79f9", "score": "0.45578605", "text": "def test_Spreadhseet_003_parse_workbook\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Spreadhseet_003_parse_workbook\")\n puts2(\"#######################\")\n\n #$VERBOSE = true\n\n sDataDir = \"data\"\n aSpreadsheetContents_byRow = []\n\n aWorkbookFiles = [\"Book1.xls\", \"Book1.xlsx\", \"Book1.ods\"]\n\n aSpreadsheets = [\"Employees\", \"Sheet2\", \"Sheet3\"]\n #aSpreadsheets = [nil, \"Sheet2\", \"Sheet3\"]\n\n # Loop through workbook types\n aWorkbookFiles.each do | sWorkbookFile |\n\n puts2(\"Data read from Workbook File: \" + sWorkbookFile)\n hSpreadsheetData = parse_workbook(sWorkbookFile, aSpreadsheets, sDataDir, true)\n\n hSpreadsheetData.sort.each do |sSpreadsheet, aSpreadsheetContents_byRow|\n\n puts2(\"Data read from Spreadsheet: \" + sSpreadsheet.to_s)\n\n aSpreadsheetContents_byRow.each do | sRowData |\n puts2(sRowData)\n puts2(\"\")\n end\n end\n\n puts2(\"\\n\")\n\n end # Loop through workbook types\n end", "title": "" }, { "docid": "d2f6e0352f15b0a5cbdc31b662264150", "score": "0.450402", "text": "def get_data(sheet, version)\n result = []\n start = version == 2 ? 4 : 2\n (start..sheet.last_row).each do |i|\n row = sheet.row(i)\n \n if row_is_wrong(row) then next end\n\n result << {\n name: row[0],\n huge: row[1] || 0,\n big: row[2] || 0,\n medium: row[3] || 0,\n small: row[4] || 0}\n end\n result\n end", "title": "" }, { "docid": "a5051311c4de639efb04b0be1d7e1598", "score": "0.45017868", "text": "def data_excel_hash (data_sheet)\n workbook = RubyXL::Parser.parse data_default_directory+'/'+excel_file\n sheet = workbook[data_sheet]\n header_row = sheet.sheet_data[0]\n @data_excel = sheet.get_table(header_row)\n end", "title": "" }, { "docid": "bb794dc88d5b6a1c695739163ace55ee", "score": "0.4489754", "text": "def readXls(ws,xml)\n package = Array.new\n i = 4\n j = 0\n while ws.rows[i]\n # pp ws.rows[i]\n if ws.rows[i] == nil\n break\n end\n if ws.rows[i][1] == $catalog_current\n package[j] = ws.rows[i]\n j = j + 1\n i = i +1\n else\n sendPackage(package,xml)\n $catalog_current = ws.rows[i][1]\n j = 0\n package.clear\n end\n end\nend", "title": "" }, { "docid": "6a5cf90d20bec1d17e0603d9f04ff231", "score": "0.44748506", "text": "def read_extern(record, cursor)\n return nil if not extern?(record)\n cursor.name(type.name) { type.reader.read_extern(cursor) }\n end", "title": "" }, { "docid": "1e6cd6689ea6450915c2260dd644680d", "score": "0.44655612", "text": "def extract_ije_records(sheet, first_data_row, record_count)\n\n # Data starts on row N (0 based); each row contains position (offset), length (we use this to determine the\n # amount of padding), description (ignored), IJE field name (ignored), data for N records (one column each)\n\n rows = sheet.rows.to_a\n row_number = first_data_row\n ije_records = Array.new(record_count) { '' } # Array of strings\n while row = rows[row_number] do\n row_values = row.to_a.map(&:last) # Convert from hash of cell name to value\n offset = row_values[0].to_i - 1 # Make offset 0 based\n length = row_values[1].to_i\n values = row_values[4, record_count]\n # If there's a linefeed in a value, take everything before the linefeed\n values.map! { |v| v.to_s.split(\"\\n\").first.to_s.strip }\n # There appears to be a special character for blank\n values.map! { |v| v == '␢' ? '' : v }\n # puts \"#{length} #{values.join(',')}\"\n record_count.times do |record_number|\n # Truncate data if needed (and inform user)\n data = values[record_number]\n if data.length > length\n puts \"Note: Record #{ije_records[record_number][0,12]} contains an overlong data field #{row_values[3]}\"\n data = data[0,length]\n end\n # Append data, padded with correct amount of space before (based on offset) and after (based on length)\n require 'byebug' ; debugger if (offset - ije_records[record_number].length) < 0\n ije_records[record_number] += ' ' * (offset - ije_records[record_number].length)\n ije_records[record_number] << \"%-#{length}s\" % data\n end\n row_number += 1\n end\n\n # Pad each record to 5000 characters and return the result\n ije_records.map { |record| record += ' ' * (5000 - record.length) }\nend", "title": "" }, { "docid": "7cc90745b6e2d97c7427d8e17a7c1bf4", "score": "0.4464191", "text": "def import_patch_ports (spreadsheet, header)\n \n \n return\n \n row = Hash[[header, spreadsheet.row(2)].transpose]\n binding.pry\n \nend", "title": "" }, { "docid": "6594eff1dc0533d9ec5d130a9b491762", "score": "0.44489014", "text": "def process_sheet(key, models)\nlogger.debug \"process_sheet(#{key}, #{models.inspect})\"\n # set the default sheet\n @ss.default_sheet = cur_sheet_name\n # get the header as an array\n header = get_header()\nlogger.debug \"raw header: #{header}\"\n # get all model(s) columns and category values defined for attributes\n models_columns = []\n models.each do |model|\n h = {}\n h[:model] = model\n h[:allowed_cols] = model.column_names - [\"updated_by\", \"created_at\", \"updated_at\"]\n content_cols = model.content_columns.map {|cc| cc.name}\n special_cols = model.column_names - content_cols\n # regular content columns for this model\n #content_cols = content_cols - [\"updated_by\", \"created_at\", \"updated_at\"]\n # foreign key columns\n h[:fk_cols] = special_cols - [\"id\"]\n h[:allowed_values] = allowed_values(model)\n h[:mapped_values] = mapped_values(model)\n h[:fk_finders] = {} # place to put fk finders mao\n h[:headers] = [] # place to put verified header names\n h[:dups] = {} # place to put dup indexes\n#logger.debug \"models_columns for model: #{model.name}: #{h}\"\n models_columns << h\n end\n\n resolve_amgiguous_headers(models_columns, header)\n#logger.debug \"models_columns[0][:dups]: #{models_columns[0][:dups]}\"\n#logger.debug \"models_columns[1][:dups]: #{models_columns[1][:dups]}\"\n\n return false if !verify_header_names(key, models_columns, header)\n \n # prepare each row for saving\n got_error = false\n (2..@ss.last_row).each do |rn|\n if !process_row(key, models_columns, get_row(rn), rn)\n got_error = true\n # keep processing to get as many errors as possible, if it is a dry run\n return false unless @dry_run\n end\n end\n\n return false if got_error\n return true\n end", "title": "" }, { "docid": "202263042b78ff976380be81d91c8ac6", "score": "0.44447738", "text": "def setup_lookup_sheet(workbook)\n @lookups = {}\n end", "title": "" }, { "docid": "2df52c859b69e07888c542a92f7f6590", "score": "0.44311026", "text": "def initialize(filename, default_formats = {})\n super()\n @filename = filename\n @default_formats = default_formats\n @parser = Formula.new(@byte_order)\n @tempdir = nil\n @date_1904 = false\n @sheet = \n\n @activesheet = 0\n @firstsheet = 0\n @selected = 0\n @xf_index = 0\n @fileclosed = false\n @biffsize = 0\n @sheetname = \"Sheet\"\n @url_format = ''\n @codepage = 0x04E4\n @worksheets = []\n @sheetnames = []\n @formats = []\n @palette = []\n @biff_only = 0\n\n @internal_fh = 0\n @fh_out = \"\"\n\n @str_total = 0\n @str_unique = 0\n @str_table = {}\n @str_array = []\n @str_block_sizes = []\n @extsst_offsets = []\n @extsst_buckets = 0\n @extsst_bucket_size = 0\n\n @ext_ref_count = 0\n @ext_refs = {}\n\n @mso_clusters = []\n @mso_size = 0\n\n @hideobj = 0\n @compatibility = 0\n\n @add_doc_properties = 0\n @localtime = Time.now\n\n # Add the in-built style formats and the default cell format.\n add_format(:type => 1) # 0 Normal\n add_format(:type => 1) # 1 RowLevel 1\n add_format(:type => 1) # 2 RowLevel 2\n add_format(:type => 1) # 3 RowLevel 3\n add_format(:type => 1) # 4 RowLevel 4\n add_format(:type => 1) # 5 RowLevel 5\n add_format(:type => 1) # 6 RowLevel 6\n add_format(:type => 1) # 7 RowLevel 7\n add_format(:type => 1) # 8 ColLevel 1\n add_format(:type => 1) # 9 ColLevel 2\n add_format(:type => 1) # 10 ColLevel 3\n add_format(:type => 1) # 11 ColLevel 4\n add_format(:type => 1) # 12 ColLevel 5\n add_format(:type => 1) # 13 ColLevel 6\n add_format(:type => 1) # 14 ColLevel 7\n add_format(default_formats) # 15 Cell XF\n add_format(:type => 1, :num_format => 0x2B) # 16 Comma\n add_format(:type => 1, :num_format => 0x29) # 17 Comma[0]\n add_format(:type => 1, :num_format => 0x2C) # 18 Currency\n add_format(:type => 1, :num_format => 0x2A) # 19 Currency[0]\n add_format(:type => 1, :num_format => 0x09) # 20 Percent\n\n # Add the default format for hyperlinks\n @url_format = add_format(:color => 'blue', :underline => 1)\n\n # Convert the filename to a filehandle to pass to the OLE writer when the\n # file is closed. If the filename is a reference it is assumed that it is\n # a valid filehandle.\n #\n if filename.kind_of?(String) && filename != ''\n @fh_out = open(filename, \"wb\")\n @internal_fh = 1\n else\n print \"Workbook#new - filename required.\"\n exit\n end\n\n # Set colour palette.\n set_palette_xl97\n\n get_checksum_method\n end", "title": "" }, { "docid": "3da93ecfa89e079cd1549313a0044344", "score": "0.4426264", "text": "def parse_sheet\n\t\ttimeline = TimeLineBuilder.new(write_directory: '../data', worksheet: sheet)\n\t\ttimeline.read\n\t\t@qual_data = timeline.user_timeline\n\tend", "title": "" }, { "docid": "d18c5206272ef700fe24c8a8e16f60bc", "score": "0.4421831", "text": "def unpacked\n @unpacked ||= lead_in.unpack(\"a4VVQQ\")\n end", "title": "" }, { "docid": "98449616475b6320edaea8b0086d8aad", "score": "0.4418279", "text": "def load_workbook(filename)\n wb = Xl::Workbook.new\n\n Xl::Zip.new(filename) do |archive|\n wb.properties = read_properties_core(archive.core)\n wb.worksheets = []\n sheet_names = read_sheets_titles(archive.app)\n string_table = archive.has_shared_strings? ? read_string_table(archive.shared_strings) : {}\n style_table = read_style_table(archive.style)\n sheet_names.each_with_index do |sheet_name, i|\n ws = read_worksheet(archive.worksheet(\"sheet#{i+1}\"), wb, sheet_name, string_table, style_table)\n wb.add_sheet(ws, i)\n end\n wb.named_ranges = read_named_ranges(archive.workbook, wb)\n end\n\n wb\n end", "title": "" }, { "docid": "a29efe43299d18bd570c2f767b7c4026", "score": "0.44136718", "text": "def unpack\n if @unpack\n @h[:box]\n else\n @h\n end\n end", "title": "" }, { "docid": "b01ded4ca42156615d77636cbe369233", "score": "0.44111723", "text": "def _unpack_object( store_pack )\n package_class = store_pack.class \n if package_class == String\n store_pack\n elsif package_class == Array \n _unpack_array( store_pack ) \n else # package_class == Hash -or- Mash\n if store_pack['class']\n # Constantize the objects class\n obj_class = store_pack['class'].constantize rescue nil\n \n # build from initialization \n init = _unpack_initialization( store_pack )\n return_object = if init\n obj_class == Aqua::Stub ? init : obj_class.aqua_init( init )\n end\n \n # Build uninitialized object\n if return_object.nil?\n if obj_class\n return_object = obj_class.new\n else \n # should log an error internally\n return_object = OpenStruct.new\n end\n end\n \n # add the ivars\n if ivars = store_pack['ivars'] \n ivars.delete('@table') if obj_class.ancestors.include?( OpenStruct )\n _unpack_ivars( return_object, ivars )\n end\n \n return_object \n else # not a packaged object, just a hash, so unpack\n _unpack_hash( hash )\n end \n end \n \n end", "title": "" }, { "docid": "b7c2b0f176aae43e4dca0fae865bbe85", "score": "0.44100726", "text": "def raw_data_sheet\n @book.worksheet(WBF[:data_sheet])\n end", "title": "" }, { "docid": "6e18cc5142eada22a2a414793148fc7f", "score": "0.44098902", "text": "def get_sheet\n\tsheet = Array.new\n\ti = 1\n\tj = 0\n\twhile i < RC_AP.num_rows\n\t\tif RC_AP.rows[i][5] != 'Admin' && RC_AP.rows[i][5] != 'other' && RC_AP.rows[i][RC_AP.num_cols - 2] != 'Excused'\n\t\t\tsheet[j] = Array.new\n\t\t\tsheet[j][0] = RC_AP.rows[i][2]\n\t\t\tsheet[j][1] = RC_AP.rows[i][5]\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\tend\n\treturn sheet\nend", "title": "" }, { "docid": "b253c228a93f6ec307489e5bcfbdf799", "score": "0.44028825", "text": "def import_xlsx(file = @import_file)\n\t\ts = Roo::Excelx.new(file)\n\n\t\tall = {}\n\t\ts.sheets.each do |locale|\n\t\t\tall[locale] ||= {}\n\t\t\ts.sheet(locale).each_with_index do |row, i|\n\t\t\t\tnext if i == 0\n\t\t\t\tall[locale].deep_merge!(Hash[row[0], row[1]])\n\t\t\tend\n\t\tend \n\n\t\tfor_locale(translations: all, template: []) do |template, translations, locale|\n\t\t\twrite_translations(locale, translations)\n\t\tend\n\t\ttrue\n\tend", "title": "" }, { "docid": "5a66917074ca4d9502a1a1e2f65c2acb", "score": "0.4393412", "text": "def read_sheet(sheet_file, shared_strings)\n xlsx_parser = SheetSaxParser.new(shared_strings)\n parser = Nokogiri::XML::SAX::Parser.new(xlsx_parser)\n parser.parse(File.read(sheet_file))\n xlsx_parser.doc\n end", "title": "" }, { "docid": "deeedbfd2311f2f42b61e4f6807743c9", "score": "0.43927053", "text": "def extract_sheets_in_order(entries, sheet_ids, sheets, tmpdir)\n (sheet_ids & sheets.keys).each_with_index do |id, i|\n name = sheets[id]\n entry = entries.find { |e| \"/#{e.name}\" =~ /#{name}$/ }\n path = \"#{tmpdir}/roo_sheet#{i + 1}\"\n sheet_files << path\n @sheet_files << path\n entry.extract(path)\n end\n end", "title": "" }, { "docid": "5d44a1f4785865f73cba8cbef9b1a217", "score": "0.43909273", "text": "def get_sheet(file)\r\n filter = -> (row) { row[1] == \"LIN\" && (row[2] == \"400 kV\" || row[2] == \"220 kV\") }\r\n try! do\r\n file.\r\n ᐅ(~:sheets).\r\n ᐅ(~:first).\r\n ᐅ(~:rows).\r\n ᐅ(~:drop, 5).\r\n ᐅ(~:keep_if, &filter)\r\n end\r\n end", "title": "" }, { "docid": "41b591b2145314e0fd10392e0163fb0d", "score": "0.4387721", "text": "def load_spreadsheet\n @sheets = nil\n @spreadsheet = @service.get_spreadsheet(@key)\n @properties = @spreadsheet.properties.to_h\n end", "title": "" }, { "docid": "18eb7926cbe2dc36de7debb6dd02d576", "score": "0.43826973", "text": "def parse_extern\n # extern package are always paresed with the default parser \n local_parser = DefaultParser.new(parser)\n @rbind_pkgs.each do |pkg|\n path = Rbind.rbind_pkg_path(pkg)\n config = YAML.load(File.open(File.join(path,\"config.rbind\")).read)\n path = File.join(path,\"extern.rbind\")\n ::Rbind.log.info \"parsing extern rbind file #{path}\"\n local_parser.parse(File.open(path).read,config.ruby_module_name)\n end\n self\n end", "title": "" }, { "docid": "ed4b839ba4419c55263553d14fcc131c", "score": "0.4376898", "text": "def access_export(filename,protocols)\n \n file_path = \"protocols.yml\"\n File.open(file_path, \"w\") { |file| YAML.dump(protocols, file) }\n \n ex_ranges = ExcelExporter::DF_EX_RANGES\n book = @excel.WorkBooks.Open(filename)\n sheet = book.Worksheets(1)\n sheet.select\n \n report = protocols.last\n \n # protocol head\n #==========================================\n @excel.Range('g2')['Value'] = report.betonwerk\n @excel.Range('d4')['Value'] = report.auftraggebende_nl\n @excel.Range('d5')['Value'] = report.baustellenbezeichnung\n @excel.Range('i5')['Value'] = report.protokollnummer\n #==========================================\n # end protocol head\n \n \n \n korr = Helper.toDouble(report.korr_fakt)\n \n protocols.each_with_index do |cube,count|\n unless count.eql?(ex_ranges.size)\n # use some helper stuff\n #p \"#{cube.laenge},#{cube.breite},#{cube.hoehe}\"\n volumen = Helper.volume(cube.laenge,cube.breite,cube.hoehe)\n rohdichte = Helper.rohdichte(cube.masse, volumen)\n #puts \"#{cube.laenge_i}, #{cube.breite_i}, #{cube.bruchlast}\"\n druckfest = Helper.druckfestigkeit(cube.laenge, cube.breite, cube.bruchlast)\n #puts \"druckfest is: #{druckfest}\"\n #p druckfest \n \n #p cube.soll_pruefalter\n \n druckfest_korr = Helper.round(druckfest * korr,0.5)\n #write data to excel here\n @excel.Range(\"#{ex_ranges[count]}7\")['Value'] = cube.pk\n #@excel.Range(ex_ranges[count].to_s<<'8')['Value'] = xml.festkl.to_s\n #@excel.Range('d8')['Value'] = xml.festkl\n @excel.Range(\"#{ex_ranges[count]}8\")['Value'] = cube.betonfestigkeitsklasse\n @excel.Range(\"#{ex_ranges[count]}9\")['Value'] = cube.betonsorte\n @excel.Range(\"#{ex_ranges[count]}10\")['Value'] = cube.lieferschein_nr\n @excel.Range(\"#{ex_ranges[count]}11\")['Value'] = cube.herstell_datum\n exrange_insert(ex_ranges,count,12,cube.bauteil)\n #@excel.Range(ex_ranges[count].to_s<<'12')['Value'] = x.bauteil\n exrange_insert(ex_ranges,count,15,cube.soll_pruefalter)\n exrange_insert(ex_ranges,count,16,cube.lufttemperatur)\n exrange_insert(ex_ranges,count,17,cube.frischbetontemperatur)\n exrange_insert(ex_ranges,count,18,cube.ausbreit)\n exrange_insert(ex_ranges,count,31,cube.pruefnummer)\n exrange_insert(ex_ranges,count,32,cube.pruefbuch_nummer)\n exrange_insert(ex_ranges,count,34,cube.kurzzeichen)\n exrange_insert(ex_ranges,count,33,cube.einlieferungs_datum)\n exrange_insert(ex_ranges,count,35,cube.lagerung_in_wasser)\n exrange_insert(ex_ranges,count,36,cube.lagerung_in_luft_labor)\n exrange_insert(ex_ranges,count,37,cube.prfdatum)\n exrange_insert(ex_ranges,count,38,cube.ist_alter)\n exrange_insert(ex_ranges,count,39,cube.aeussere_beschaffenheit)\n exrange_insert(ex_ranges,count,40,cube.laenge)\n exrange_insert(ex_ranges,count,41,cube.breite)\n exrange_insert(ex_ranges,count,42,cube.hoehe)\n exrange_insert(ex_ranges,count,43,cube.masse)\n exrange_insert(ex_ranges,count,44,volumen)\n exrange_insert(ex_ranges,count,45,rohdichte)\n exrange_insert(ex_ranges,count,46,cube.bruchlast)\n exrange_insert(ex_ranges,count,47,druckfest)\n exrange_insert(ex_ranges,count,48,druckfest_korr)\n else\n break\n end\n end\n \n @excel.visible = true\n end", "title": "" }, { "docid": "c2f16b2549098fda29fa32c3ba8617fd", "score": "0.43681818", "text": "def sheets\n \n puts \"[PartList.sheets] Showing sheet parts...\" if $cutlister_debug\n\n part_array = []\n \n @parts.each { |p|\n \n if p.is_sheet\n \n part_array << p\n \n end\n \n }\n \n part_array.empty? ? nil : to_hash(part_array)\n\n end", "title": "" }, { "docid": "19ce72ba8a0a5f4ed92fd8847c988368", "score": "0.43670174", "text": "def split_away_extinfo(hash)\n\thash['_extinfo'] = {}\n\thash.keys.each{ |key|\n\t\tif key[0, 8] == 'extinfo-'\n\t\t\thash['_extinfo'][ key[8, key.length-8] ] = hash[key]\n\t\t\thash.delete(key);\n\t\tend\n\t}\nend", "title": "" }, { "docid": "9a16d532bf471691fbae4b0f70246e29", "score": "0.4365592", "text": "def import_presence_from_excell\n error_nik = \"\"\n error_nik_count = 0\n sheet_path = self.csv.path\n book = Spreadsheet.open sheet_path\n sheet = book.worksheet 0\n if (sheet.row(0)[0].strip.upcase==\"NIK\") && (sheet.row(0)[1].strip.upcase==\"NAMA\") && (sheet.row(0)[2].strip.upcase==\"IN\") && (sheet.row(0)[3].strip.upcase==\"OUT\") && (sheet.row(0)[4].strip.upcase==\"DATE\")\n data = get_data_absent(sheet) #konversi data excel menjadi data array\n for i in 1..(sheet.row_count-1)\n error_nik_count = import_presence(data,i) #memasukan data array ke dalam db presence dan presence_detail\n unless error_nik_count.blank? or error_nik_count.nil?\n error_nik = error_nik + error_nik_count\n end\n end\n if error_nik.nil? or error_nik.blank?\n return \"Import Data Absen Berhasil\"\n else\n return \"Import Data Absen Berhasil, namun ada NIK yang belum terdaftar yaitu = #{error_nik} \"\n end \n else\n return \"Data Absen gagal diimport. silahkan download contoh format\"\n end\n end", "title": "" }, { "docid": "dd389c68b4eb5ee86406ef57694fb0a6", "score": "0.43644643", "text": "def process_xls_file(xls, cols)\n result = []\n xls.each_with_pagename do |_, sheet|\n sheet.drop(1).each do |row|\n object = {}\n cols.each_with_index { |key, index| object[key] = row[index] }\n result << object\n end\n end\n result\n end", "title": "" }, { "docid": "4f6dbef70e3fc8c9cf610cd56dc0fceb", "score": "0.43607458", "text": "def sheet2hash(sheet)\n headers = sheet.headers.map(&:to_sym)\n sheet.data.map do |row|\n Hash[headers.zip(row)]\n end\nend", "title": "" }, { "docid": "20de52df680131075643bb92b53353ab", "score": "0.43589932", "text": "def close #:nodoc:\n ################################################\n # Prepend in reverse order!!\n #\n\n # Prepend the sheet dimensions\n store_dimensions\n\n # Prepend the autofilter filters.\n store_autofilters\n\n # Prepend the sheet autofilter info.\n store_autofilterinfo\n\n # Prepend the sheet filtermode record.\n store_filtermode\n\n # Prepend the COLINFO records if they exist\n @colinfo.reverse.each do |colinfo|\n store_colinfo(colinfo)\n end\n\n # Prepend the DEFCOLWIDTH record\n store_defcol\n\n # Prepend the sheet password\n store_password\n\n # Prepend the sheet protection\n store_protect\n store_obj_protect\n\n # Prepend the page setup\n store_setup\n\n # Prepend the bottom margin\n store_margin_bottom\n\n # Prepend the top margin\n store_margin_top\n\n # Prepend the right margin\n store_margin_right\n\n # Prepend the left margin\n store_margin_left\n\n # Prepend the page vertical centering\n store_vcenter\n\n # Prepend the page horizontal centering\n store_hcenter\n\n # Prepend the page footer\n store_footer\n\n # Prepend the page header\n store_header\n\n # Prepend the vertical page breaks\n store_vbreak\n\n # Prepend the horizontal page breaks\n store_hbreak\n\n # Prepend WSBOOL\n store_wsbool\n\n # Prepend the default row height.\n store_defrow\n\n # Prepend GUTS\n store_guts\n\n # Prepend GRIDSET\n store_gridset\n\n # Prepend PRINTGRIDLINES\n store_print_gridlines\n\n # Prepend PRINTHEADERS\n store_print_headers\n\n #\n # End of prepend. Read upwards from here.\n ################################################\n # Append\n store_table\n store_images\n store_charts\n store_filters\n store_comments\n store_window2\n store_page_view\n store_zoom\n store_panes(*@panes) if @panes && !@panes.empty?\n store_selection(*@selection)\n store_validation_count\n store_validations\n store_tab_color\n store_eof\n\n # Prepend the BOF and INDEX records\n store_index\n store_bof(0x0010)\n end", "title": "" }, { "docid": "a51c2148cd9e517ef28c9d226fcd55ef", "score": "0.43426654", "text": "def excel_init(path_to_excel_file)\n\t\tSpreadsheet.client_encoding = 'UTF-8'\n\t\t# open the excel file for reading\n\t\ttimetable = Spreadsheet.open path_to_excel_file\n\t\t# open the target excel tab 'course assignment'\n\t\t@assignment = timetable.worksheet 0\n\t\t# identify the sheet information\n\t\tdim = @assignment.dimensions\n\t\t@first_row = dim[0]\n\t\t@last_row = dim[1]\n\t\t@first_col = dim[2]\n\t\t@last_col = dim[3]\n\t\tlogger.info \"#{@first_row}-#{@last_row}-#{@first_col}-#{@last_col}\"\n\t\t# index of the columns that have specific information\n\t\t# and column sign which can help us to recognize them\t\n\t\t@subject_col = 0;\tsubject_text = 'SUBJECT'\n\t\t@lec_col = 0;\t\tlec_text = 'LECTURE'\n\t\t@tut_col = 0;\t\ttut_text = 'TUTORIAL'\n\t\t@lab_col = 0;\t\tlab_text = 'LABORATORY'\n\t\t@subject_row = 0;\n\t\t@indexes = 4\n\t\t\n\t\tcatch \"FoundRealFirstRow\" do\n\t\t\t@first_row.upto(@last_row) do |rid|\n\t\t\t\t@first_col.upto(@last_col) do |cid|\n\t\t\t\t\tif !(@assignment.cell(rid, cid).nil?)\n\t\t\t\t\t\t@first_row = rid\n\t\t\t\t\t\tthrow \"FoundRealFirstRow\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tcatch \"FoundRealLastRow\" do\n\t\t\t@last_row.downto(@first_row) do |rid|\n\t\t\t\t@first_col.upto(@last_col) do |cid|\n\t\t\t\t\tif !(@assignment.cell(rid, cid).nil?)\n\t\t\t\t\t\t@last_row = rid\n\t\t\t\t\t\tthrow \"FoundRealLastRow\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# need to identify the indexes first\n\t\tcount_col = 0\n\t\tcatch \"FoundAllHeaders\" do\n\t\t\t@first_row.upto(@last_row) do |rid|\n\t\t\t\t@first_col.upto(@last_col) do |cid|\n\t\t\t\t\t# is_found: the content of the cell is match with the header\n\t\t\t\t\tis_found = true\n\t\t\t\t\tcase @assignment.cell(rid, cid)\n\t\t\t\t\t\twhen subject_text then\n\t\t\t\t\t\t\t @subject_col = cid\n\t\t\t\t\t\t\t @subject_row = rid\n\t\t\t\t\t\twhen lec_text then @lec_col = cid\n\t\t\t\t\t\twhen tut_text then @tut_col = cid\n\t\t\t\t\t\twhen lab_text then @lab_col = cid\n\t\t\t\t\t\telse is_found = false\n\t\t\t\t\tend\n\t\t\t\t\tif (is_found) \n\t\t\t\t\t\tcount_col = count_col + 1\n\t\t\t\t\tend\n\t\t\t\t\t# break the loop if we found all the indexes\n\t\t\t\t\tthrow \"FoundAllHeaders\" if (count_col == @indexes)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "5f955d00e55c065ccac97bd22247e88f", "score": "0.43392017", "text": "def read_cells(sheet = nil)\n sheet ||= @default_sheet\n validate_sheet!(sheet)\n return if @cells_read[sheet]\n sheet_found = false\n\n @doc.xpath(\"/#{@namespace}:Workbook/#{@namespace}:Worksheet[@#{@namespace}:Name='#{sheet}']\").each do |ws|\n sheet_found = true\n column_styles = {}\n\n # Column Styles\n col = 1\n ws.xpath(\"./#{@namespace}:Table/#{@namespace}:Column\").each do |c|\n skip_to_col = c[\"#{@namespace}:Index\"].to_i\n col = skip_to_col if skip_to_col > 0\n col_style_name = c[\"#{@namespace}:StyleID\"]\n column_styles[col] = col_style_name unless col_style_name.nil?\n col += 1\n end\n\n # Rows\n row = 1\n ws.xpath(\"./#{@namespace}:Table/#{@namespace}:Row\").each do |r|\n skip_to_row = r[\"#{@namespace}:Index\"].to_i\n row = skip_to_row if skip_to_row > 0\n\n # Excel uses a 'Span' attribute on a 'Row' to indicate the presence of\n # empty rows to skip.\n skip_next_rows = r[\"#{@namespace}:Span\"].to_i\n\n row_style_name = r[\"#{@namespace}:StyleID\"]\n\n # Cells\n col = 1\n r.xpath(\"./#{@namespace}:Cell\").each do |c|\n skip_to_col = c[\"#{@namespace}:Index\"].to_i\n col = skip_to_col if skip_to_col > 0\n\n skip_next_cols = c[\"#{@namespace}:MergeAcross\"].to_i\n\n cell_style_name = c[\"#{@namespace}:StyleID\"]\n style_name = cell_style_name || row_style_name || column_styles[col]\n\n # Cell Data\n c.xpath(\"./#{@namespace}:Data\").each do |cell|\n formula = cell['Formula']\n value_type = cell[\"#{@namespace}:Type\"].downcase.to_sym\n v = cell.content\n str_v = v\n case value_type\n when :number\n v = v.to_f\n value_type = :float\n when :datetime\n if v =~ /^1899-12-31T(\\d{2}:\\d{2}:\\d{2})/\n v = Regexp.last_match[1]\n value_type = :time\n elsif v =~ /([^T]+)T00:00:00.000/\n v = Regexp.last_match[1]\n value_type = :date\n end\n when :boolean\n v = cell['boolean-value']\n end\n set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)\n end\n col += (skip_next_cols + 1)\n end\n row += (skip_next_rows + 1)\n end\n end\n unless sheet_found\n raise RangeError, \"Unable to find sheet #{sheet} for reading\"\n end\n @cells_read[sheet] = true\n end", "title": "" }, { "docid": "11ec011b316cf4288069ba36dfc12b2a", "score": "0.4335889", "text": "def parse_data(workbook, header_search=[]) #{{{2\n worksheet = workbook[0]\n raw_data = worksheet.extract_data\n if raw_data.length==0\n @listOf_errors << \"Workbook might be empty.\"\n @data = []\n else\n @data = _transform_data(raw_data, header_search)\n end\n\n @headers = @data[0]\n @data = @data[1..-1]\n\n return @headers, @data\n end", "title": "" }, { "docid": "a7e9fbf00cd699c4c77b86103a11b780", "score": "0.43324482", "text": "def data_sheet\n attachments.for('data_sheet')\n end", "title": "" }, { "docid": "e81dfb9e6d244bc190584e665e6c919d", "score": "0.43311423", "text": "def extract_composition_information_from(sheet)\n composition_hash = {\n included_skus: [],\n excluded_skus: [],\n categories: []\n }\n\n sheet.rows.each.with_index do |row, index|\n next if index < ROW_SKIP_COUNT\n next if row[0].nil?\n\n # Rows can be one of three formats:\n key = case row[0..2].select(&:nil?).size\n # 1. A row includes SKU, Product name and inclusion information\n when 0\n if row[2] == 'Yes'\n :included_skus\n else\n :excluded_skus\n end\n # 2. A row just includes SKU and Product Name\n when 1\n :included_skus\n # 3. The row includes a single element which is inferred to be a category name\n when 2\n :categories\n end\n\n composition_hash[key] << row[0].strip\n end\n\n composition_hash\n end", "title": "" }, { "docid": "93ec27f073e7a5b7f700030a02dfe06d", "score": "0.43295914", "text": "def unpack\n pack_files = Dir[File.join(PACK_DIR, '*')].reject do |pack|\n pack.start_with?(File.join(PACK_DIR, BASE_PACK))\n end\n return if pack_files.empty?\n\n pack_files.each do |pack|\n unless pack.end_with?('.pack')\n FileUtils.rm(pack)\n next\n end\n\n File.open(pack, 'rb') do |open_pack|\n File.unlink(pack)\n abort unless system(*GIT, 'unpack-objects', in: open_pack)\n end\n end\nend", "title": "" }, { "docid": "e2e73b526926f74c0fbdba5ace146b78", "score": "0.43266502", "text": "def set_sheet(sheet)\n if @file_type == \"xls\"\n @excel_sheet = @excel_book.worksheet sheet\n elsif @file_type == \"xlsx\"\n @xlsx_sheet = @xlsx_book.worksheets[sheet].extract_data\n else\n raise RuntimeError, \"File #{@file_name} is not an xls or xlsx file, so cannot change sheet\" \n end\n end", "title": "" }, { "docid": "7e29969d1508bc0d7511abe23c46d555", "score": "0.4325134", "text": "def datasheet_xls\n\t\tSpreadsheet.client_encoding = 'UTF-8'\n\n\t book = Spreadsheet::Workbook.new\n\t sheet1 = book.create_worksheet :name => \"#{name} Data\"\n\n\t sheet1[0,1] = \"Company Profile\"\n\t \tsheet1[1,1] = \"Name:\"\n\t \tsheet1[2,1] = \"Entity:\"\n\t \tsheet1[3,1] = \"Ownership:\"\n\t \tsheet1[4,1] = \"SIC code:\"\n\t \tsheet1[5,1] = \"Country:\"\n\t \tsheet1[6,1] = \"Region:\"\n\n\t \tsheet1[1,2] = name\n\t \tsheet1[2,2] = Company.combination(combination)\n\t \tsheet1[3,2] = Company.ownership(ownership)\n\t \tsheet1[4,2] = \"#{sic} #{SIC.description(sic)}\"\n\t \tsheet1[5,2] = Company.country(country)\n\t \tsheet1[6,2] = Company.region(region)\n\n\t \tsheet1[8,0] = \"Company Data\"\n\t \tsheet1[9,0] = \"\"\n\t \tsheet1[10,0] = \"Fiscal Year End:\"\n\t \tsheet1[11,0] = \"Historical Data Quality:\"\n\t \tsheet1[12,0] = \"Reporting Scale:\"\n\t \tsheet1[13,0] = \"--Accounts--\"\n\t \tsheet1[14,0] = \"Assets:\"\n\t \tsheet1[15,0] = \"Revenue:\"\n\t \tsheet1[16,0] = \"Gross Profit:\"\n\t \tsheet1[17,0] = \"Operating Profit:\"\n\t \tsheet1[18,0] = \"EBITDA:\"\n\t \tsheet1[19,0] = \"--Valuation--\"\n\t \tsheet1[20,0] = \"EBITDA Multiple:\"\n\t \tsheet1[21,0] = \"Sales Multiple:\"\n\t \tsheet1[22,0] = \"Funded Debt Multiple:\"\n\t \tsheet1[23,0] = \"Stock Price:\"\n\n\t\tsecure_now= SecureStat.find(self.secure_now)\n\t\tsecure_cy = SecureStat.find(self.secure_cy)\n \tsecure_2y = SecureStat.find(self.secure_2y)\n \tsecure_3y = SecureStat.find(self.secure_3y)\n \tsecure_4y = SecureStat.find(self.secure_4y)\n \tsecure_5y = SecureStat.find(self.secure_5y)\n\n\t \tsheet1[9,1] = \"NOW\"\n\t \tsheet1[10,1] = secure_now.fye == nil ? \"\" : \"#{secure_now.fye.month}/#{secure_now.fye.year}\"\n\t \tsheet1[11,1] = \"My Estimate\"\n\t \tsheet1[12,1] = SecureStat.reporting_scale(secure_now.reporting_scale)\n\t \tsheet1[13,1] = \"\"\n\t \tsheet1[14,1] = \"#{secure_now.assets}\"\n\t \tsheet1[15,1] = \"#{secure_now.gross_sales}\"\n\t \tsheet1[16,1] = \"#{secure_now.gross_profit}\"\n\t \tsheet1[17,1] = \"#{secure_now.operating_profit}\"\n\t \tsheet1[18,1] = \"#{secure_now.ebitda}\"\n\t \tsheet1[19,1] = \"\"\n\t \tsheet1[20,1] = \"#{secure_now.ebitda_multiple}\"\n\t \tsheet1[21,1] = \"#{secure_now.sales_multiple}\"\n\t \tsheet1[22,1] = \"#{secure_now.debt_multiple}\"\n\t \tsheet1[23,1] = \"#{secure_now.stock_price}\"\n\n\t \tsheet1[9,2] = \"CY\"\n\t \tsheet1[10,2] = secure_cy.fye == nil ? \"\" : \"#{secure_cy.fye.month}/#{secure_cy.fye.year}\"\n\t \tsheet1[11,2] = SecureStat.quality(secure_cy.quality)\n\t \tsheet1[12,2] = SecureStat.reporting_scale(secure_cy.reporting_scale)\n\t \tsheet1[13,2] = \"\"\n\t \tsheet1[14,2] = \"#{secure_cy.assets}\"\n\t \tsheet1[15,2] = \"#{secure_cy.gross_sales}\"\n\t \tsheet1[16,2] = \"#{secure_cy.gross_profit}\"\n\t \tsheet1[17,2] = \"#{secure_cy.operating_profit}\"\n\t \tsheet1[18,2] = \"#{secure_cy.ebitda}\"\n\t \tsheet1[19,2] = \"\"\n\t \tsheet1[20,2] = \"#{secure_cy.ebitda_multiple}\"\n\t \tsheet1[21,2] = \"#{secure_cy.sales_multiple}\"\n\t \tsheet1[22,2] = \"#{secure_cy.debt_multiple}\"\n\t \tsheet1[23,2] = \"#{secure_cy.stock_price}\"\n\n\t \tsheet1[9,3] = \"2Y\"\n\t \tsheet1[10,3] = secure_2y.fye == nil ? \"\" : \"#{secure_2y.fye.month}/#{secure_2y.fye.year}\"\n\t \tsheet1[11,3] = SecureStat.quality(secure_2y.quality)\n\t \tsheet1[12,3] = SecureStat.reporting_scale(secure_2y.reporting_scale)\n\t \tsheet1[13,3] = \"\"\n\t \tsheet1[14,3] = \"#{secure_2y.assets}\"\n\t \tsheet1[15,3] = \"#{secure_2y.gross_sales}\"\n\t \tsheet1[16,3] = \"#{secure_2y.gross_profit}\"\n\t \tsheet1[17,3] = \"#{secure_2y.operating_profit}\"\n\t \tsheet1[18,3] = \"#{secure_2y.ebitda}\"\n\t \tsheet1[19,3] = \"\"\n\t \tsheet1[20,3] = \"#{secure_2y.ebitda_multiple}\"\n\t \tsheet1[21,3] = \"#{secure_2y.sales_multiple}\"\n\t \tsheet1[22,3] = \"#{secure_2y.debt_multiple}\"\n\t \tsheet1[23,3] = \"#{secure_2y.stock_price}\"\n\n\t \tsheet1[9,4] = \"3Y\"\n\t \tsheet1[10,4] = secure_3y.fye == nil ? \"\" : \"#{secure_3y.fye.month}/#{secure_3y.fye.year}\"\n\t \tsheet1[11,4] = SecureStat.quality(secure_3y.quality)\n\t \tsheet1[12,4] = SecureStat.reporting_scale(secure_3y.reporting_scale)\n\t \tsheet1[13,4] = \"\"\n\t \tsheet1[14,4] = \"#{secure_3y.assets}\"\n\t \tsheet1[15,4] = \"#{secure_3y.gross_sales}\"\n\t \tsheet1[16,4] = \"#{secure_3y.gross_profit}\"\n\t \tsheet1[17,4] = \"#{secure_3y.operating_profit}\"\n\t \tsheet1[18,4] = \"#{secure_3y.ebitda}\"\n\t \tsheet1[19,4] = \"\"\n\t \tsheet1[20,4] = \"#{secure_3y.ebitda_multiple}\"\n\t \tsheet1[21,4] = \"#{secure_3y.sales_multiple}\"\n\t \tsheet1[22,4] = \"#{secure_3y.debt_multiple}\"\n\t \tsheet1[23,4] = \"#{secure_3y.stock_price}\"\n\n\t \tsheet1[9,5] = \"4Y\"\n\t \tsheet1[10,5] = secure_4y.fye == nil ? \"\" : \"#{secure_4y.fye.month}/#{secure_4y.fye.year}\"\n\t \tsheet1[11,5] = SecureStat.quality(secure_4y.quality)\n\t \tsheet1[12,5] = SecureStat.reporting_scale(secure_4y.reporting_scale)\n\t \tsheet1[13,5] = \"\"\n\t \tsheet1[14,5] = \"#{secure_4y.assets}\"\n\t \tsheet1[15,5] = \"#{secure_4y.gross_sales}\"\n\t \tsheet1[16,5] = \"#{secure_4y.gross_profit}\"\n\t \tsheet1[17,5] = \"#{secure_4y.operating_profit}\"\n\t \tsheet1[18,5] = \"#{secure_4y.ebitda}\"\n\t \tsheet1[19,5] = \"\"\n\t \tsheet1[20,5] = \"#{secure_4y.ebitda_multiple}\"\n\t \tsheet1[21,5] = \"#{secure_4y.sales_multiple}\"\n\t \tsheet1[22,5] = \"#{secure_4y.debt_multiple}\"\n\t \tsheet1[23,5] = \"#{secure_4y.stock_price}\"\n\n\t \tsheet1[9,6] = \"5Y\"\n\t \tsheet1[10,6] = secure_5y.fye == nil ? \"\" : \"#{secure_5y.fye.month}/#{secure_5y.fye.year}\"\n\t \tsheet1[11,6] = SecureStat.quality(secure_5y.quality)\n\t \tsheet1[12,6] = SecureStat.reporting_scale(secure_5y.reporting_scale)\n\t \tsheet1[13,6] = \"\"\n\t \tsheet1[14,6] = \"#{secure_5y.assets}\"\n\t \tsheet1[15,6] = \"#{secure_5y.gross_sales}\"\n\t \tsheet1[16,6] = \"#{secure_5y.gross_profit}\"\n\t \tsheet1[17,6] = \"#{secure_5y.operating_profit}\"\n\t \tsheet1[18,6] = \"#{secure_5y.ebitda}\"\n\t \tsheet1[19,6] = \"\"\n\t \tsheet1[20,6] = \"#{secure_5y.ebitda_multiple}\"\n\t \tsheet1[21,6] = \"#{secure_5y.sales_multiple}\"\n\t \tsheet1[22,6] = \"#{secure_5y.debt_multiple}\"\n\t \tsheet1[23,6] = \"#{secure_5y.stock_price}\"\n\n\t \ttrade_now= TradeStat.find(self.trade_now)\n \ttrade_cy = TradeStat.find(self.trade_cy)\n \ttrade_2y = TradeStat.find(self.trade_2y)\n \ttrade_3y = TradeStat.find(self.trade_3y)\n \ttrade_4y = TradeStat.find(self.trade_4y)\n \ttrade_5y = TradeStat.find(self.trade_5y)\n\n \tsheet1[25,0] = \"Company Statistics (Stat Trade)\"\n\t \tsheet1[26,0] = \"\"\n\t \tsheet1[27,0] = \"--Accounts--\"\n\t \tsheet1[28,0] = \"Asset Category:\"\n\t \tsheet1[29,0] = \"Revenue Category:\"\n\t \tsheet1[30,0] = \"Sales/Revenue Growth:\"\n\t \tsheet1[31,0] = \"Gross Profit Margin:\"\n\t \tsheet1[32,0] = \"Operating Profit Margin:\"\n\t \tsheet1[33,0] = \"EBITDA %:\"\n\t \tsheet1[34,0] = \"--Valuation--\"\n\t \tsheet1[35,0] = \"EBITDA Multiple:\"\n\t \tsheet1[36,0] = \"Sales Multiple:\"\n\t \tsheet1[37,0] = \"Funded Debt Multiple:\"\n\n\t \tsheet1[26,1] = \"NOW\"\n\t \tsheet1[27,1] = \"\"\n\t \tsheet1[28,1] = \"#{trade_now.asset_category}\"\n\t \tsheet1[29,1] = \"#{trade_now.revenue_category}\"\n\t \tsheet1[30,1] = \"#{trade_now.sales_growth}\"\n\t \tsheet1[31,1] = \"#{trade_now.gross_profit_margin}\"\n\t \tsheet1[32,1] = \"#{trade_now.operating_profit_margin}\"\n\t \tsheet1[33,1] = \"#{trade_now.ebitda_percent}\"\n\t \tsheet1[34,1] = \"\"\n\t \tsheet1[35,1] = \"#{trade_now.ebitda_multiple}\"\n\t \tsheet1[36,1] = \"#{trade_now.sales_multiple}\"\n\t \tsheet1[37,1] = \"#{trade_now.debt_multiple}\"\n\n\t \tsheet1[26,2] = \"CY\"\n\t \tsheet1[27,2] = \"\"\n\t \tsheet1[28,2] = \"#{trade_cy.asset_category}\"\n\t \tsheet1[29,2] = \"#{trade_cy.revenue_category}\"\n\t \tsheet1[30,2] = \"#{trade_cy.sales_growth}\"\n\t \tsheet1[31,2] = \"#{trade_cy.gross_profit_margin}\"\n\t \tsheet1[32,2] = \"#{trade_cy.operating_profit_margin}\"\n\t \tsheet1[33,2] = \"#{trade_cy.ebitda_percent}\"\n\t \tsheet1[34,2] = \"\"\n\t \tsheet1[35,2] = \"#{trade_cy.ebitda_multiple}\"\n\t \tsheet1[36,2] = \"#{trade_cy.sales_multiple}\"\n\t \tsheet1[37,2] = \"#{trade_cy.debt_multiple}\"\n\n\t \tsheet1[26,3] = \"2Y\"\n\t \tsheet1[27,3] = \"\"\n\t \tsheet1[28,3] = \"#{trade_2y.asset_category}\"\n\t \tsheet1[29,3] = \"#{trade_2y.revenue_category}\"\n\t \tsheet1[30,3] = \"#{trade_2y.sales_growth}\"\n\t \tsheet1[31,3] = \"#{trade_2y.gross_profit_margin}\"\n\t \tsheet1[32,3] = \"#{trade_2y.operating_profit_margin}\"\n\t \tsheet1[33,3] = \"#{trade_2y.ebitda_percent}\"\n\t \tsheet1[34,3] = \"\"\n\t \tsheet1[35,3] = \"#{trade_2y.ebitda_multiple}\"\n\t \tsheet1[36,3] = \"#{trade_2y.sales_multiple}\"\n\t \tsheet1[37,3] = \"#{trade_2y.debt_multiple}\"\n\n\t \tsheet1[26,4] = \"3Y\"\n\t \tsheet1[27,4] = \"\"\n\t \tsheet1[28,4] = \"#{trade_3y.asset_category}\"\n\t \tsheet1[29,4] = \"#{trade_3y.revenue_category}\"\n\t \tsheet1[30,4] = \"#{trade_3y.sales_growth}\"\n\t \tsheet1[31,4] = \"#{trade_3y.gross_profit_margin}\"\n\t \tsheet1[32,4] = \"#{trade_3y.operating_profit_margin}\"\n\t \tsheet1[33,4] = \"#{trade_3y.ebitda_percent}\"\n\t \tsheet1[34,4] = \"\"\n\t \tsheet1[35,4] = \"#{trade_3y.ebitda_multiple}\"\n\t \tsheet1[36,4] = \"#{trade_3y.sales_multiple}\"\n\t \tsheet1[37,4] = \"#{trade_3y.debt_multiple}\"\n\n\t \tsheet1[26,5] = \"4Y\"\n\t \tsheet1[27,5] = \"\"\n\t \tsheet1[28,5] = \"#{trade_4y.asset_category}\"\n\t \tsheet1[29,5] = \"#{trade_4y.revenue_category}\"\n\t \tsheet1[30,5] = \"#{trade_4y.sales_growth}\"\n\t \tsheet1[31,5] = \"#{trade_4y.gross_profit_margin}\"\n\t \tsheet1[32,5] = \"#{trade_4y.operating_profit_margin}\"\n\t \tsheet1[33,5] = \"#{trade_4y.ebitda_percent}\"\n\t \tsheet1[34,5] = \"\"\n\t \tsheet1[35,5] = \"#{trade_4y.ebitda_multiple}\"\n\t \tsheet1[36,5] = \"#{trade_4y.sales_multiple}\"\n\t \tsheet1[37,5] = \"#{trade_4y.debt_multiple}\"\n\n\t \tsheet1[26,6] = \"5Y\"\n\t \tsheet1[27,6] = \"\"\n\t \tsheet1[28,6] = \"#{trade_5y.asset_category}\"\n\t \tsheet1[29,6] = \"#{trade_5y.revenue_category}\"\n\t \tsheet1[30,6] = \"#{trade_5y.sales_growth}\"\n\t \tsheet1[31,6] = \"#{trade_5y.gross_profit_margin}\"\n\t \tsheet1[32,6] = \"#{trade_5y.operating_profit_margin}\"\n\t \tsheet1[33,6] = \"#{trade_5y.ebitda_percent}\"\n\t \tsheet1[34,6] = \"\"\n\t \tsheet1[35,6] = \"#{trade_5y.ebitda_multiple}\"\n\t \tsheet1[36,6] = \"#{trade_5y.sales_multiple}\"\n\t \tsheet1[37,6] = \"#{trade_5y.debt_multiple}\"\n\n\n\t spreadsheet = StringIO.new \n\t\tbook.write spreadsheet \n\t\tspreadsheet\n\tend", "title": "" }, { "docid": "e4a291d77c58452ad17d3100b4592d98", "score": "0.4322507", "text": "def extern?(record)\n record[:header][:field_externs][position]\n end", "title": "" }, { "docid": "55c6ef5975b60f0560822512ceba9d4c", "score": "0.43190384", "text": "def unpack!\r\n unless defined?(@folder) && @folder\r\n raise IOError, 'no temporary folder created'\r\n end\r\n \r\n # Find the first working strategy and keep it\r\n if ! @@unpack_strategies.first.call(@jarfile, @folder)\r\n warn(\"Dropping unpacker for #{@jarfile}. Install 7zip or unzip!\")\r\n @@unpack_strategies.delete_at(0)\r\n if @@unpack_strategies.empty?\r\n raise 'no suitable unpack strategy found'\r\n end\r\n unpack!\r\n end\r\n end", "title": "" }, { "docid": "b925e5695c9ce57c6bcc6315438d4451", "score": "0.43024144", "text": "def parse_extern\n # extern package are always paresed with the default parser\n local_parser = DefaultParser.new(parser)\n paths = Rbind.rbind_pkg_paths(@pkg_config)\n paths.each do |pkg|\n config = YAML.load(File.open(File.join(pkg,\"config.rbind\")).read)\n path = File.join(pkg,\"extern.rbind\")\n ::Rbind.log.info \"parsing extern rbind pkg file #{path}\"\n raise \"no module name found\" if !config.ruby_module_name || config.ruby_module_name.empty?\n local_parser.parse(File.open(path).read,config.ruby_module_name)\n end\n @gems.each do |gem|\n path = Rbind.gem_path(gem)\n config = YAML.load(File.open(File.join(path,\"config.rbind\")).read)\n path = File.join(path,\"extern.rbind\")\n ::Rbind.log.info \"parsing extern gem file #{path}\"\n local_parser.parse(File.open(path).read,config.ruby_module_name)\n end\n self\n end", "title": "" }, { "docid": "3e8fd3336cc7ada4eb54b2fe5f865278", "score": "0.4301053", "text": "def load_contents\n @contents = []\n temp_file = open(INFO_FILE)\n ::Zip::File.open(temp_file.path) do |zip_file|\n zip_file.glob('*.dat').each do |entry|\n filename = Dir::Tmpname.make_tmpname \"/tmp/#{entry.name}\", nil\n entry.extract(filename)\n @contents << {\n name: entry.name,\n content: File.open(filename, encoding: 'windows-1251').read\n }\n File.unlink filename\n end\n end\n temp_file.close\n temp_file.unlink\n @contents\n end", "title": "" }, { "docid": "3ed2c8fd038e450ceb6c014d84b931d1", "score": "0.429079", "text": "def _unpack\n if init = _unpack_initialization( _store )\n replace( init ) \n end\n if ivars = _store[:ivars]\n _unpack_ivars( self, ivars )\n end \n end", "title": "" }, { "docid": "55e28ad68f2ac09634db9df035be998c", "score": "0.429047", "text": "def get_XLS(xls)\n # File Check\n unless File.readable?(xls)\n $ERROR_CNT += 1\n printf \"@E:Could not read #{xls}. please file path for file name\\n\"\n Common.print_summary\n exit 1\n end\n # Analyze\n xls_data = Hash.new\n book = Spreadsheet.open(xls, 'rb')\n sheet = book.worksheet(0)\n body = false\n header = nil\n sheet.each_with_index do |line,i|\n if line[0] == \"No\"\n # Header\n header = line\n body = true\n elsif body\n # Body\n data = Hash.new\n line.each_with_index do |n,i|\n data[NUM2COLUMN[i]] = n.to_s\n end\n xls_data[data[NUM2COLUMN[CELL::get_column(\"Instance Name\")]]] = CELL::make_Data(data)\n end\n end\n # Summary Portion\n sheet = book.worksheet(1)\n sheet.each do |line|\n xls_data[line[1]] = line[2]\n end\n xls_data\n end", "title": "" }, { "docid": "4a5f0497f872a7db98f6694c45cacea2", "score": "0.4289041", "text": "def load_skm_employee_package(workbook,company,employees)\r\n package_sheet = workbook.worksheet(\"EmployeePackage\")\r\n heads = [SalaryHead.code_for_rent,SalaryHead.code_for_da,SalaryHead.code_for_adhoc,SalaryHead.code_for_conveyance]\r\n package_sheet.each(1) do |row|\r\n attrs = {}\r\n attrs[:company] = company\r\n attrs[:employee] = employees[row.at(0)]\r\n attrs[:employee_package] = EmployeePackage.find_by_employee_id(employees[row.at(0)],:conditions=>['start_date = ?',row.at(5)])\r\n (0..3).each do |i|\r\n attrs[:salary_head] = heads[i]\r\n attrs[:amount] = row.at(i+1).to_f\r\n attrs[:leave_dependent] = true\r\n EmployeePackageHead.create(attrs)\r\n end\r\n end\r\nend", "title": "" }, { "docid": "9fb42edbbb1aa59496c5d3930d584027", "score": "0.4287836", "text": "def show_versions(sheet)\n fetch_sheet(\"http://#{cheat_uri}/h/#{sheet}/\", false)\n end", "title": "" }, { "docid": "b3c25fd5b4c6fa1de8fd4aeda7a0cc73", "score": "0.42865", "text": "def extern(proto)\n\tfunc,ret,args = parse_cproto(proto)\n\treturn import(func, ret, args)\n end", "title": "" }, { "docid": "7cbfde1abd4d05024ff3c1c00bbe18d7", "score": "0.4282017", "text": "def unpack\n\t\t\t# stay on the same object?\n\t\t\tif updated?\n\t\t\t\t@physical_object.bin = nil\n\t\t\t\t@physical_object.box = nil\n\t\t\t\t@physical_object.save\n\t\t\tend\n\t\t\t# @physical_object = @next_physical_object\n\t\t\t# surrounding_physical_objects\n\t\tend", "title": "" }, { "docid": "fbfd377ad7fc7e8ffd17d0d7f7b16404", "score": "0.42804864", "text": "def download\n unless File.exists?(\"complete_files\")\n Dir.mkdir(\"complete_files\");\n end\n\n etis = RubyXL::Workbook.new\n etis_worksheet = etis[0]\n etis_worksheet.sheet_name = 'Uniqs'\n etis_worksheet.add_cell(0, 0, \"ID #\")\n etis_worksheet.add_cell(0, 1, \"Uniq\")\n\n cvhs = RubyXL::Workbook.new\n cvhs_worksheet = cvhs[0]\n cvhs_worksheet.sheet_name = 'Assignments'\n cvhs_worksheet.add_cell(0, 0, \"Last Name\")\n cvhs_worksheet.add_cell(0, 1, \"First Name\")\n cvhs_worksheet.add_cell(0, 2, \"ID #\")\n cvhs_worksheet.add_cell(0, 3, \"Building #\")\n cvhs_worksheet.add_cell(0, 4, \"Locker #\")\n cvhs_worksheet.change_column_width(0, 20)\n cvhs_worksheet.change_column_width(1, 10)\n\n\n etis_counter = 1\n cvhs_counter = 1\n\n CvhsLocker.all.each do |locker|\n etis_worksheet.add_cell(etis_counter, 0, locker.studentID1)\n etis_worksheet.add_cell(etis_counter, 1, locker.locker_unique)\n etis_counter += 1\n\n cvhs_worksheet.add_cell(cvhs_counter, 0, locker.lastName1)\n cvhs_worksheet.add_cell(cvhs_counter, 1, locker.name1)\n cvhs_worksheet.add_cell(cvhs_counter, 2, locker.studentID1)\n cvhs_worksheet.add_cell(cvhs_counter, 3, locker.buildingNum)\n cvhs_worksheet.add_cell(cvhs_counter, 4, locker.lockerNum)\n cvhs_counter += 1\n if locker.name2 != \"\"\n etis_worksheet.add_cell(etis_counter, 0, locker.studentID2)\n etis_worksheet.add_cell(etis_counter, 1, locker.locker_unique)\n etis_counter += 1\n\n cvhs_worksheet.add_cell(cvhs_counter, 0, locker.lastName2)\n cvhs_worksheet.add_cell(cvhs_counter, 1, locker.name2)\n cvhs_worksheet.add_cell(cvhs_counter, 2, locker.studentID2)\n cvhs_worksheet.add_cell(cvhs_counter, 3, locker.buildingNum)\n cvhs_worksheet.add_cell(cvhs_counter, 4, locker.lockerNum)\n cvhs_counter += 1\n end\n end\n\n\n etis.write(\"complete_files/ETIS Locker Sheet.xlsx\")\n cvhs.write(\"complete_files/CVHS Locker Sheet.xlsx\")\n\n compress(File.join(Rails.root, \"complete_files\"))\n send_file File.join(Rails.root, \"complete_files\" , \"complete_files.zip\")\n end", "title": "" }, { "docid": "989bb3070a331fdfb8b107d931bf569d", "score": "0.42775372", "text": "def b7_2Parse(events, bandsArraywDates)\n mvDirB7_2()\n\n # COLLECTS FILE(S) WITH .XLSX FORMAT (SHOULD ONLY BE ONE) IN ORDER TO PARSE IT\n fileNamesArray = []\n fileNamesArray = Dir[\"./*.xlsx\"]\n \n i = 0\n bandNum = 0\n while i < events\n workbookB7first = RubyXL::Parser.parse(\"#{fileNamesArray[0]}\")\n # DEFINES WORKBOOK AS WORKSHEET (DONT DELETE)\n worksheet = workbookB7first[0]\n # ASSIGNS BAND OBJECT FROM ARRAY\n band = bandsArraywDates[i]\n # GETTING COUNT OF ADMIN NUMBS IN SPREADSHEET TO ME SUBTRACTED FROM TOTAL NRU COUNTS IN PARSERB72 (MIGHT BE NO ADMINS IN B7_2, THIS IS JUST FOR EDGE CASE POTENTIALLY)\n adminNumbArray = adminCounterB72(band, worksheet)\n parserb72(band, worksheet, adminNumbArray)\n resultsB7_2(band.eventName, band, worksheet)\n i += 1 \n end\nend", "title": "" }, { "docid": "487541ba5d419590a2021537d22e16cd", "score": "0.42725885", "text": "def r_cfex\n @serial = true\n\n result = {\n frtRefHeaderU: Unxls::Biff8::Structure.frtrefheaderu(@bytes) # frtRefHeaderU (12 bytes): An FrtRefHeaderU structure.\n }\n\n f_is_cf12, n_id = @bytes.read(6).unpack('Vv')\n # fIsCF12 (4 bytes): A Boolean (section 2.5.14) that specifies what type of rule this record extends. MUST be one of the following values:\n # 0x00000000 – This record extends a rule specified by a CF record and MUST NOT be followed by a CF12 record.\n # 0x00000001 – This record extends a rule specified by a CF12 record and MUST be followed by the CF12 record it extends.\n result[:fIsCF12] = f_is_cf12\n result[:nID] = n_id # nID (2 bytes): An unsigned integer that specifies which CondFmt record is being extended. It MUST be equal to the nID field of one of the CondFmt records in the Worksheet substream.\n\n if f_is_cf12.zero?\n result[:rgbContent] = Unxls::Biff8::Structure.cfexnoncf12(@bytes) # rgbContent (variable): A CFExNonCF12 structure that specifies the extensions to an existing CF record. MUST be omitted when fIsCF12 is not equal to 0x00.\n end\n\n result\n end", "title": "" }, { "docid": "da4c6b8458454d86ca79b8925684a60a", "score": "0.42565298", "text": "def r_mergecells\n @serial = true\n\n result = {\n cmcs: @bytes.read(2).unpack('v').first, # cmcs (2 bytes): An unsigned integer that specifies the count of Ref8 structures. MUST be less than or equal to 1026.\n rgref: []\n }\n\n result[:cmcs].times do\n result[:rgref] << Unxls::Biff8::Structure.ref8(@bytes.read(8)) # rgref (variable): An array of Ref8 structures. Each array element specifies a range of cells that are merged into a single merged cell. These ranges MUST NOT overlap. MUST contain the number of elements specified by cmcs.\n end\n\n result\n end", "title": "" }, { "docid": "bf48490b46256d46fae82d9481651d0b", "score": "0.425233", "text": "def export_parse(export,resourcetype)\n cleanexport = Array.new()\n export.each do |resource|\n # Delete the id's, since these are installation specific\n resource.delete(\"id\")\n\n # Delete the hosts to which the some of these resources are assigned to, since these might not exist elsewhere\n if resourcetype == \"servicecheck\" || resourcetype == \"hosttemplate\" || resourcetype == \"hostcheckcommand\"\n resource.delete(\"hosts\")\n end\n\n # Remove hosttemplates from servicechecks\n if resourcetype == \"servicecheck\"\n resource.delete(\"hosttemplates\")\n end\n\n if resourcetype == \"host\"\n # Don't save if this is an EC2 host instance, those should be generated automatically and we don't need to version control them\n unless resource[\"hosttemplates\"].nil?\n next if resource[\"hosttemplates\"].find { |h| h['name'] == 'ec2instance' }\n end\n # Remove id's from the host attributes since they are auto-generated\n unless resource[\"hostattributes\"].nil?\n resource[\"hostattributes\"].each { |attr| attr.delete(\"id\") }\n end\n end\n\n # Don't save this if this is one of the default timeperiods\n if resourcetype == \"timeperiod\"\n next if [\"workhours\",\"nonworkhours\",\"none\",\"24x7\"].include? resource[\"name\"]\n end\n\n # Save\n cleanexport << resource.sort_by_key(true)\n end\n return cleanexport\n end", "title": "" }, { "docid": "4904bd4215045757203239e9b3197b47", "score": "0.42425323", "text": "def initialize(filename_or_stream, options = {})\n packed = options[:packed]\n file_warning = options.fetch(:file_warning, :error)\n cell_max = options.delete(:cell_max)\n sheet_options = {}\n sheet_options[:expand_merged_ranges] = (options[:expand_merged_ranges] || false)\n sheet_options[:no_hyperlinks] = (options[:no_hyperlinks] || false)\n sheet_options[:empty_cell] = (options[:empty_cell] || false)\n shared_options = {}\n\n shared_options[:disable_html_wrapper] = (options[:disable_html_wrapper] || false)\n unless is_stream?(filename_or_stream)\n file_type_check(filename_or_stream, %w[.xlsx .xlsm], 'an Excel 2007', file_warning, packed)\n basename = find_basename(filename_or_stream)\n end\n\n # NOTE: Create temp directory and allow Ruby to cleanup the temp directory\n # when the object is garbage collected. Initially, the finalizer was\n # created in the Roo::Tempdir module, but that led to a segfault\n # when testing in Ruby 2.4.0.\n @tmpdir = self.class.make_tempdir(self, basename, options[:tmpdir_root])\n ObjectSpace.define_finalizer(self, self.class.finalize(object_id))\n\n @shared = Shared.new(@tmpdir, shared_options)\n @filename = local_filename(filename_or_stream, @tmpdir, packed)\n process_zipfile(@filename || filename_or_stream)\n\n @sheet_names = []\n @sheets = []\n @sheets_by_name = {}\n\n workbook.sheets.each_with_index do |sheet, index|\n next if options[:only_visible_sheets] && sheet['state'] == 'hidden'\n\n sheet_name = sheet['name']\n @sheet_names << sheet_name\n @sheets_by_name[sheet_name] = @sheets[index] = Sheet.new(sheet_name, @shared, index, sheet_options)\n end\n\n if cell_max\n cell_count = ::Roo::Utils.num_cells_in_range(sheet_for(options.delete(:sheet)).dimensions)\n raise ExceedsMaxError.new(\"Excel file exceeds cell maximum: #{cell_count} > #{cell_max}\") if cell_count > cell_max\n end\n\n super\n rescue\n self.class.finalize_tempdirs(object_id)\n raise\n end", "title": "" }, { "docid": "02558e11f52f5f9544523139652ca0e6", "score": "0.42103857", "text": "def store_supbook\n record = 0x01AE # Record identifier\n length = 0x0004 # Number of bytes to follow\n\n ctabs = @worksheets.size # Number of worksheets\n stVirtPath = 0x0401 # Encoded workbook filename\n\n header = [record, length].pack(\"vv\")\n data = [ctabs, stVirtPath].pack(\"vv\")\n\n append(header, data)\n end", "title": "" }, { "docid": "3be1938077af78e0a9c6ee854d81fa31", "score": "0.42085826", "text": "def sheet; end", "title": "" }, { "docid": "0f69498317cea0c800aaf08cd80bf166", "score": "0.420271", "text": "def initialize(filename, packed = nil, file_warning = :error)\n super()\n @file_warning = file_warning\n @tmpdir = \"oo_\"+$$.to_s\n @tmpdir = File.join(ENV['ROO_TMP'], @tmpdir) if ENV['ROO_TMP'] \n unless File.exists?(@tmpdir)\n FileUtils::mkdir(@tmpdir)\n end\n filename = open_from_uri(filename) if filename[0,7] == \"http://\"\n filename = open_from_stream(filename[7..-1]) if filename[0,7] == \"stream:\"\n filename = unzip(filename) if packed and packed == :zip\n begin\n file_type_check(filename,'.xls','an Excel')\n @filename = filename\n unless File.file?(@filename)\n raise IOError, \"file #{@filename} does not exist\"\n end\n @workbook = Spreadsheet.open(filename)\n @default_sheet = nil\n # no need to set default_sheet if there is only one sheet in the document\n if self.sheets.size == 1\n @default_sheet = self.sheets.first\n end\n ensure\n #if ENV[\"roo_local\"] != \"thomas-p\"\n FileUtils::rm_r(@tmpdir)\n #end\n end\n @cell = Hash.new\n @cell_type = Hash.new\n @formula = Hash.new\n @first_row = Hash.new\n @last_row = Hash.new\n @first_column = Hash.new\n @last_column = Hash.new\n @header_line = 1\n @cells_read = Hash.new\n @fonts = Hash.new\n end", "title": "" }, { "docid": "f26169882dfc67f47c3be498ce33e2eb", "score": "0.419639", "text": "def discover_tests\n # List of interior cells, per plugin name\n # Hash< String, Array<String> >\n interior_cells = {}\n @game.xedit.run_script('DumpInfo', only_once: true)\n @game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|\n esp_name, record_type = row[0..1]\n if record_type.downcase == 'cell'\n cell_type, cell_name = row[3..4]\n if cell_type == 'coc'\n esp_name.downcase!\n interior_cells[esp_name] = [] unless interior_cells.key?(esp_name)\n interior_cells[esp_name] << cell_name\n end\n end\n end\n # Test only interior cells that have been changed by mods\n vanilla_esps = @game.game_esps\n vanilla_interior_cells = vanilla_esps.map { |esp_name| interior_cells[esp_name] || [] }.flatten.sort.uniq\n interior_cells.\n map { |esp_name, esp_cells| vanilla_esps.include?(esp_name) ? [] : vanilla_interior_cells & esp_cells }.\n flatten.\n sort.\n uniq.\n map do |cell_name|\n [\n cell_name,\n {\n name: \"Load cell #{cell_name}\"\n }\n ]\n end.to_h\n end", "title": "" }, { "docid": "563839c66019394e427c2f7604f068df", "score": "0.41906804", "text": "def excel_data_collection()\n info = excel_info\n filters = excel_filter\n chart = excel_chart\n headers = excel_header_data\n datas = excel_data\n# footers = excel_fotter_data\n\n info + filters + chart + headers + datas #+ footers\n end", "title": "" }, { "docid": "2ecd75aa851c901fb27cdbc1c6e60b3b", "score": "0.4190207", "text": "def unpack_emails_and_metadata emails\n mails_with_metadata = []\n emails.each do |e|\n mail_data = Hash.new\n mail_data[:mail] = Mail.new(e[ATTR][RFC822])\n mail_data[:uid] = e[ATTR][UID]\n mail_data[:thrid] = e[ATTR][GM_THRID]\n mail_data[:labels] = e[ATTR][GM_LABEL]\n mails_with_metadata << mail_data\n end\n mails_with_metadata\n end", "title": "" }, { "docid": "2e9e2730023fa38458e590c7c11250df", "score": "0.4183667", "text": "def read_wb(wb)\r\n data = {'header' => {}, 'rows' => []}\r\n ws = wb.getSheetAt(0)\r\n # Get instructions from named ranges in workbook\r\n instructions = get_instructions(wb)\r\n # Header\r\n for instruction in instructions['r']['header']\r\n name = instruction['name']\r\n row = ws.getRow(instruction['row'])\r\n columns = instruction['columns']\r\n # Read cell values\r\n values = []\r\n for j in columns\r\n cell = row.getCell(j)\r\n values << get_cell_value(cell)\r\n end\r\n # If there is only one columns, convert back to single value\r\n if values.length == 1\r\n values = values[0]\r\n end\r\n data['header'][name] = values\r\n end\r\n # Rows\r\n first_row = get_first_row(wb)\r\n last_row = ws.getLastRowNum()\r\n for i in (first_row..last_row)\r\n row = ws.getRow(i)\r\n row_data = {}\r\n for instruction in instructions['r']['rows']\r\n name = instruction['name']\r\n columns = instruction['columns']\r\n # Read cells values\r\n # Note: the \"formula r\" instruction is equivalent to \"data r\"\r\n values = []\r\n for j in columns\r\n cell = row.getCell(j)\r\n values << get_cell_value(cell)\r\n end\r\n if values.length == 1\r\n values = values[0]\r\n end\r\n row_data[name] = values\r\n end\r\n data['rows'] << row_data\r\n end\r\n data\r\n end", "title": "" }, { "docid": "60ef464a1b45d541fe9a5d9c7101fa3a", "score": "0.4172961", "text": "def parse_input_file\n begin\n case @input_type\n when 'xls' then\n case @protocol\n when 'BN' then\n titles = Array.new\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(@input_file)\n ws = wb.Worksheets(1)\n data = ws.UsedRange.Value\n for i in 1..data.size-1\n data_id = data[i][2].split('_')[0]\n data_label = @dataID2string[data_id]\n object_id = data[i][1]\n mm_index = 1\n if data[i][2].split('_').size > 2\n mm_index = data[i][2].split('_')[2]\n end\n hierarchy = data[i][2].split('_')[1]\n titles << \"#{@protocol} - #{data_id} - #{data_label} - #{object_id}-#{mm_index}-#{hierarchy}\"\n end\n return titles\n when 'MB' then\n titles = Array.new\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(@input_file)\n ws = wb.Worksheets(1)\n data = ws.UsedRange.Value\n for i in 1..data.size-1\n data_label = data[i][2].split('(')[0].strip # Strip Multi-module index from label to lookup data id\n data_id = @dataID2string.index(data_label)\n register = data[i][1].split('(')[0]\n size = data[i][1].split('(')[1].sub(')','')\n data_label = data[i][2] # Put the index back into the label\n units = data[i][3]\n scale = data[i][4]\n access = data[i][5]\n title = \"#{@protocol} - #{data_id} - #{register}(#{size}) - #{data_label} - #{units} - #{scale} - #{access}\"\n title.gsub!(' - - - ','')\n title.gsub!('- -','')\n titles << title\n end\n titles\n when 'SP' #TODO\n puts \"Sorry, this feature has not yet been implemented.\"\n return nil\n when 'WB' then\n puts \"Sorry, this feature has not yet been implemented.\"\n return nil\n else\n end\n when 'xml' then\n puts \"Sorry, this feature has not yet been implemented.\"\n return nil\n when 'web' then\n puts \"Sorry, this feature has not yet been implemented.\"\n return nil\n else puts \"#{@input_type} not supported\"; raise \"Invalid input\";\n end\n rescue\n end\nend", "title": "" }, { "docid": "21784056a2a4325b9f837e7dfd1ae933", "score": "0.4170257", "text": "def data_sheet=(_arg0); end", "title": "" }, { "docid": "5ff978417aef08c4dde345a0ebc315db", "score": "0.41628417", "text": "def data_responsible_person_sheet\n @book.worksheet(WBF[:people_sheet])\n end", "title": "" }, { "docid": "1284abef5f7053019d4549b796867bdd", "score": "0.4157217", "text": "def unpack!\n @applicable = @applicable.container\n end", "title": "" }, { "docid": "45e2fc0e6e0a45c1db35c92338462685", "score": "0.4153197", "text": "def unzip\n\t\treturn Zlib::Inflate.inflate(self)\t\n\tend", "title": "" }, { "docid": "14843572a25dfac839d01bf4ba6df404", "score": "0.41530222", "text": "def load_imported_items(file)\n @items = []\n spreadsheet = open_spreadsheet file\n (2..spreadsheet.last_row).each do |i|\n # items << Hash[[header, spreadsheet.sheet(1).row(i)].transpose]\n @items << { 'patient_id' => spreadsheet.sheet(1).row(i)[1] }\n # 'Nat_Id' => spreadsheet.sheet(1).row(i)[0],\n # 'artreg_date' => spreadsheet.sheet(1).row(i)[2].strftime('%d-%b-%y'),\n # 'age' => spreadsheet.sheet(1).row(i)[3],\n # 'gender' => spreadsheet.sheet(1).row(i)[5] }\n end\nend", "title": "" }, { "docid": "d2ac91527b4ca81a85790d76e100b35e", "score": "0.41520295", "text": "def sheet\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 11)\n ref = nil\n sheet_ref_name = nil\n sheet_ref_int = nil\n sheet_ref_quote = nil\n\n begin\n # at line 331:5: (sheet_ref_name= NAME | sheet_ref_int= INT_CONST | sheet_ref_quote= QUOTENAME )\n alt_19 = 3\n case look_19 = @input.peek(1)\n when NAME then alt_19 = 1\n when INT_CONST then alt_19 = 2\n when QUOTENAME then alt_19 = 3\n else\n nvae = NoViableAlternative(\"\", 19, 0)\n raise nvae\n end\n case alt_19\n when 1\n # at line 331:7: sheet_ref_name= NAME\n sheet_ref_name = match(NAME, TOKENS_FOLLOWING_NAME_IN_sheet_1768)\n # --> action\n ref = sheet_ref_name.text \n # <-- action\n\n when 2\n # at line 333:7: sheet_ref_int= INT_CONST\n sheet_ref_int = match(INT_CONST, TOKENS_FOLLOWING_INT_CONST_IN_sheet_1788)\n # --> action\n ref = sheet_ref_int.text \n # <-- action\n\n when 3\n # at line 335:7: sheet_ref_quote= QUOTENAME\n sheet_ref_quote = match(QUOTENAME, TOKENS_FOLLOWING_QUOTENAME_IN_sheet_1808)\n # --> action\n ref = sheet_ref_quote.text[1, len(sheet_ref_quote.text) - 1].replace(\"''\", \"'\") \n # <-- action\n\n end\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__, 11)\n\n end\n \n return ref\n end", "title": "" }, { "docid": "fe19f2490f012f094d62be243eefc201", "score": "0.41477922", "text": "def data_description_sheet\n @book.worksheet(WBF[:columns_sheet])\n end", "title": "" }, { "docid": "bd3dce20c03f4b3bc2a54b5a8adec26e", "score": "0.41447073", "text": "def excel_data\n if @excel_data.nil?\n require 'excel/excel_data'\n @excel_data = Automation::Excel::Data.new\n end\n\n @excel_data\n end", "title": "" }, { "docid": "3edf0059bddd4729febb8cc4bc34502b", "score": "0.4142172", "text": "def copy_unencrypted_parts(decrypted_stream)\n @stream.rewind\n\n until @stream.eof?\n pos = @stream.pos\n id, size = read_record_header\n @stream.seek(pos)\n header = @stream.read(Unxls::Biff8::Record::HEADER_SIZE)\n data = @stream.read(size)\n\n decrypted_stream.seek(pos)\n case Unxls::Biff8::Record.name_by_id(id)\n when :BOF, :FilePass, :UsrExcl, :FileLock, :InterfaceHdr, :RRDInfo, :RRDHead\n decrypted_stream.write(header << data)\n when :BoundSheet8\n lb_ply_pos = data[0..3]\n decrypted_stream.write(header << lb_ply_pos)\n else\n decrypted_stream.write(header)\n end\n end\n\n decrypted_stream.rewind\n decrypted_stream\n end", "title": "" }, { "docid": "4f5c85f83a62339b4c35b0e1639893a0", "score": "0.4134837", "text": "def extern(cursor, record)\n return nil if not extern?(record)\n cursor.name(@name) { read_extern(cursor) }\n end", "title": "" }, { "docid": "2c02d3c6be51d8d5e8d9cb4b99b668b9", "score": "0.4132591", "text": "def extractEmails\n\t\txlsx = Roo::Spreadsheet.open(params[:mail][:excelData])\n\t\temails = []\n\n\t\txlsx.each_with_index do |v, k|\n\t\t next if k == 0\n\t\t emails << v[0]\n\t\tend\n\n\t\temails\n\tend", "title": "" } ]
e070fa87cc8e66d7965f681cec978fa6
GET /user_places GET /user_places.json
[ { "docid": "0f4237ff086fc09dbfdebc1075826758", "score": "0.7134218", "text": "def index\n @user_places = UserPlace.all\n end", "title": "" } ]
[ { "docid": "9cd9398efc9984c5282f40d8a5d31d61", "score": "0.7122159", "text": "def index\n render json: @places\n end", "title": "" }, { "docid": "f93ebf6374e8ead0e2bb83f477dc6bbe", "score": "0.6941213", "text": "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "title": "" }, { "docid": "96c3b3df406299602381a247c801f951", "score": "0.6933091", "text": "def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end", "title": "" }, { "docid": "e25991df71038fe60cffa87895f416e6", "score": "0.6867539", "text": "def index\n @places = Place.order(\"place_type_id\").order(\"town_id\").order(\"name\").page(params[:page]).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "title": "" }, { "docid": "0d34e1d25f77fc8882f4f4a88471e0cd", "score": "0.6854606", "text": "def show\n @place = Place.find(params[:id])\n render json: @place\n end", "title": "" }, { "docid": "b77689c79af3893c84287aac63eda8bd", "score": "0.6797025", "text": "def show\n place = Place.find(params[:id])\n\n render json: place\n end", "title": "" }, { "docid": "a09c7b19b792c2797121742523494570", "score": "0.6774488", "text": "def places_user\n username = params[\"username\"] || ''\n if authorized(username)\n params[\"user_id\"] = session[:current_user_id]\n result = Search.user_places(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n else\n # Either not logged in or not visible to the logged in user\n render status: 401, json: nil\n end\n end", "title": "" }, { "docid": "d6118056cea6093b8f424aba5c4226b5", "score": "0.67306197", "text": "def get_address_and_loc\n id = params[:place_id].to_i\n place = Place.find(id)\n render json: { address: place.address, loc: place.neighborhood }\n end", "title": "" }, { "docid": "74441a0ee834dbb039295489d71a619e", "score": "0.66701955", "text": "def locations(place)\n get :loc => place\n end", "title": "" }, { "docid": "b936b8cea6317239c8819eca54aeae27", "score": "0.66662365", "text": "def show\n render json: @place\n end", "title": "" }, { "docid": "039d345350b2bcc830f91706a4352cd4", "score": "0.66639954", "text": "def google_places\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_KEY'])\n @results = @client.spots(params[:latitude], params[:longitude], :name => 'bar', :types => ['bar', 'night_club'], :radius => 10000)\n @spots = @results.map do |spot|\n spot.place_id = spot.id\n spot\n end\n render json: @spots\n end", "title": "" }, { "docid": "a681c2f55966d3760f107fd09b4671ef", "score": "0.66572696", "text": "def index\n @places = Place.all\n render json: @places , status: 403\n end", "title": "" }, { "docid": "177aa101b0536611d3ae72fbf717738c", "score": "0.66534823", "text": "def show\n render json: @place\n end", "title": "" }, { "docid": "b28e655ffe347627ecfac0fb5e611dbf", "score": "0.662128", "text": "def index\n redirect_to(root_url) unless current_user\n\n @user = current_user\n @places = Place.where(user_id: @user).order(\"created_at DESC\")\n end", "title": "" }, { "docid": "c3e584ddcf1a5fba3034732ede5e9641", "score": "0.65775543", "text": "def index\n # @places = Place.get_nearby_places(params[:lat], params[:lon]).paginate(:page => get_page)\n @places = Kaminari.paginate_array(Place.get_close_places(params[:lat], params[:lon], params[:radius])).page(get_page)\n render :json => \n { \n :places => @places.as_json(:lean_list => true),\n :page_info => \n { \n :page => get_page,\n :per_page => Place.per_page,\n :total_entries => @places.total_count \n }\n }\n end", "title": "" }, { "docid": "339730638cd8f0378c0ca6a2d66012b4", "score": "0.6558151", "text": "def show\n @places = @client.places.page params[:place_page]\n end", "title": "" }, { "docid": "d0161fc03ae9575cad1e396940a65af2", "score": "0.6530618", "text": "def index\n respond_to do |format|\n format.html {\n @places = Place.paginate(page: params[:page])\n }\n format.json {\n @places = Place.all\n }\n end\n end", "title": "" }, { "docid": "f7dc8634f792a8488b91bc4d6ff2dc64", "score": "0.6515282", "text": "def index\n @places = Place.all\n render json: { places: @places }, methods: [:reviews, :visit_ids, :image_url_large]\n # render json: @places, methods: :reviews # return a place object not a places object as above\n end", "title": "" }, { "docid": "e89d896e46daf7cdb6dc681c8003be3b", "score": "0.65125364", "text": "def show\n respond_to do |format|\n format.html\n format.json { render json: @place }\n end\n end", "title": "" }, { "docid": "251ae43698ee4f93784e7de08fced277", "score": "0.6508509", "text": "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "title": "" }, { "docid": "251ae43698ee4f93784e7de08fced277", "score": "0.6508509", "text": "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "title": "" }, { "docid": "251ae43698ee4f93784e7de08fced277", "score": "0.6508509", "text": "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "title": "" }, { "docid": "0cfa1a910bfdf4b47b7dd51318f678e1", "score": "0.65016896", "text": "def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend", "title": "" }, { "docid": "c4f273a3ebe7f357e17d5b1a9f55d8de", "score": "0.6496635", "text": "def places_kinds\n render json: Place.places_kinds\n end", "title": "" }, { "docid": "64dafb9ac630db103ea3dc7760cbb7aa", "score": "0.6475659", "text": "def find\n render json: format_places(closest(params[:latitude], params[:longitude]).take(3))\n end", "title": "" }, { "docid": "1df083894113f81e3e30db31496cab8a", "score": "0.6388903", "text": "def places\n body['places'].map { |p| Place.new(p, name) }\n end", "title": "" }, { "docid": "1c5a582803b2e1791d863c52082c100b", "score": "0.6375875", "text": "def index\n authorize Place\n @places = Place.order(name: :asc).page params[:page]\n end", "title": "" }, { "docid": "38766da6b34ddc59ffcb6551a59a5eeb", "score": "0.63617927", "text": "def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end", "title": "" }, { "docid": "bbebe75a084237d2756293ffb5d32f44", "score": "0.63136154", "text": "def index\n respond_to do |format|\n format.html { @places = Place.order(:name) }\n format.json { @places = Place.order(:name) }\n end\n end", "title": "" }, { "docid": "e6b3a6fb4021a54e602109792bd3fb2c", "score": "0.6311814", "text": "def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end", "title": "" }, { "docid": "b0c28f19adb7894abf06b4632b084e46", "score": "0.631069", "text": "def search\n @places = FoursquarePlace.places_near_coordinates(@coordinates, query: params[:search_terms])\n render json: { data: @places }\n end", "title": "" }, { "docid": "e9b584cefe845dec4d930d4f6aed4aec", "score": "0.62961775", "text": "def index\n @place_visits = PlaceVisit.all\n render json: { place_visits: @place_visits }\n end", "title": "" }, { "docid": "dca13b56946afedb9be985f89ab86050", "score": "0.6294137", "text": "def index\n @places = Place.page(params[:page]).per(10).all\n end", "title": "" }, { "docid": "79f15450202f7f81c967bb467b1deeea", "score": "0.62792003", "text": "def index\n @api_vi_places = Api::Vi::Place.all\n end", "title": "" }, { "docid": "99fd7d7a3a71e47c00dec41949405a7b", "score": "0.6266082", "text": "def places_fields\n render json: Search.getPlacesFieldInfo()\n end", "title": "" }, { "docid": "7747f38cb5c4f0f39ded6d96cbfa0e0c", "score": "0.6258086", "text": "def show\n # binding.pry\n @place = Place.find(params[:id])\n @place_json = Place.find(params[:id]).as_json({ :properties => :all })\n @json = Place.find(params[:id]).to_gmaps4rails\n @comments = @place.comments\n @rates = @place.rates\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:place_info => @place_json, :comments => @comments, :rating => @place.average_rating} }\n end\n end", "title": "" }, { "docid": "0a28bda510c8b21fce17051ceb08fb0d", "score": "0.6253318", "text": "def show\n user = User.find(params[:id])\n render json: user.address\n end", "title": "" }, { "docid": "cf79a8f9367fefeed67c8a10c247bf57", "score": "0.6246176", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "cf79a8f9367fefeed67c8a10c247bf57", "score": "0.6246176", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "cf79a8f9367fefeed67c8a10c247bf57", "score": "0.6246176", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "cf79a8f9367fefeed67c8a10c247bf57", "score": "0.6246176", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "cf79a8f9367fefeed67c8a10c247bf57", "score": "0.6246176", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "cf79a8f9367fefeed67c8a10c247bf57", "score": "0.6246176", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "3c4b99f2873dead446322f757045b643", "score": "0.6243473", "text": "def get_places(opts = {})\n @search_fields = [\n :id, :title, :city_id, :size_sqf, :size_sqm, :reviews_overall, :photos, \n :currency, :num_bedrooms, :num_bathrooms, :favorited, \n :price_per_month_usd, :price_per_month\n ]\n @user_fields = [:id, :first_name, :last_name, :avatar_file_name, :role]\n @place_type_fields = [:id,:name]\n\n if opts[:search_type] == \"recently_added\"\n search_params = self.query.merge({\"date_from\" => self.delivered_at})\n elsif opts[:search_type] == \"new_results\"\n search_params = self.query.merge({\"exclude_ids\" => self.results})\n else\n search_params = self.query\n end\n\n place_search = PlaceSearch.new(self.user, search_params)\n if !place_search.all_results.blank?\n filtered_places = filter_fields(place_search.all_results, @search_fields, { :additional_fields => {\n :user => @user_fields,\n :place_type => @place_type_fields },\n :currency => self.query['currency']\n })\n return filtered_places\n else\n return nil\n end\n end", "title": "" }, { "docid": "42df678a7eca4e184a3e8669275fa6d1", "score": "0.6239599", "text": "def place_search\n @places = []\n area = params[:area_id].blank? ? nil : Place.find(params[:area_id])\n if area.present? && area.area > 0\n search_text = Riddle::Query.escape(help.strip_links(params[:search]))\n results = Place.search(search_text, :field_weights => { :name => 10 })\n\n results.each do |place|\n @places << place if place.areas.include?(area)\n end\n end\n \n respond_to do |format|\n format.json\n end\n end", "title": "" }, { "docid": "1b178df6f827e986f200ada1a7cb1d02", "score": "0.62066704", "text": "def show\n render json: @place_visit\n end", "title": "" }, { "docid": "4c414db81bc267d44aa23b55a9d910cc", "score": "0.61986786", "text": "def index\n\n #this for auto-complete search for places\n @places = (params[:q].blank?)? Place.all : Place.where(\"name ilike ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n #format.html #index.html.erb\n format.json { render json: @places }\n format.xml { render :xml => @places }\n end\n end", "title": "" }, { "docid": "93bf45ee67bfbee6821d0c36dcc0f507", "score": "0.619683", "text": "def index\n places = Place.active\n q = params[:q]\n if q\n # Sanitize the q param and find in 'tags' table, and then all matching places\n # tag = Tag.find_by(name: to_tag(q))\n places = Place.active.joins(:tags).where(tags: { name: to_tag(q) })\n end\n\n if params.key?(:open_now)\n now = Time.now.utc + (params[:tz_offset] || 0).to_i # This creates a UTC timezone that is adjusted to the local clock\n places = places.select { |p| open_now?(p.opening_hours, now, now) || open_now?(p.opening_hours, now, now - 1.day) }\n end\n render json: { 'places': places.map(&:short_data) }\n end", "title": "" }, { "docid": "278e71be3711cae2d185e4ceb781f955", "score": "0.617747", "text": "def get_places(lat, lon, options={})\n options[:category] = category_query_string(options[:category]) unless options[:category].nil?\n geojson_hash = get Endpoint.places(lat, lon, options)\n HashUtils.recursively_symbolize_keys geojson_hash\n end", "title": "" }, { "docid": "a86cf0b94fe7b00fd8a915175f22ae9b", "score": "0.6165401", "text": "def index\n @places = Place.all\n\n end", "title": "" }, { "docid": "e94306e85e88deca08cda541d1056feb", "score": "0.61528236", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "e94306e85e88deca08cda541d1056feb", "score": "0.61528236", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "e94306e85e88deca08cda541d1056feb", "score": "0.61528236", "text": "def index\n @places = Place.all\n end", "title": "" }, { "docid": "2f7a3e67ec483908cfed24f83bef99cd", "score": "0.6132993", "text": "def show\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n redirect_to(:action=>'index')\n #sess = Patron::Session.new\n # sess.base_url = \"https://maps.googleapis.com/\"\n # res = sess.get \"maps/api/place/textsearch/json?query=#{params[:text]}&sensor=true&key=AIzaSyAXRfKe3awvT9mFVx5J2ppYaMeWZ3KMkc4\"\n # value = res.body\n #@place= JSON.parse(value)[\"results\"] \n #render :layout=>false \n\n\n end", "title": "" }, { "docid": "a80670396294f7f2977a91038d8cc5c4", "score": "0.61036015", "text": "def geo(place_id)\n get \"/geo/id/#{place_id}.json\"\n end", "title": "" }, { "docid": "7eafbb178a4528411e59381a096eb23a", "score": "0.61034447", "text": "def ice_cream_places(location, radius)\n places_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/place/nearbysearch/json\",\n :query_values => {:key => \"AIzaSyC3od3aEKzgeEb8H3_6b29HX3qHXWIB248\",\n :location => location,\n :radius => radius,\n :sensor => false,\n :keyword => \"ice cream\"}\n ).to_s\n\n response = JSON.parse(RestClient.get(places_url))[\"results\"]\n all_locations = {}\n response.each do |place|\n name = place[\"name\"]\n location = place[\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\n all_locations[name] = location_string\n end\n all_locations\nend", "title": "" }, { "docid": "cc467ef7e27f818f6613e4a56f4da740", "score": "0.6102036", "text": "def show\n if params[:distancia]\n distancia = params[:distancia]\n else\n distancia = 100\n end\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@place.latitude},#{@place.longitude}&radius=#{distancia}&type=#{params[:tipo]}&key=#{Rails.application.secrets.google_places_key}\"\n uri = URI(url)\n http_call = Net::HTTP.get(uri)\n response = JSON.parse(http_call, {:symbolize_names => true})\n @locations = response[:results]\n @hash = Gmaps4rails.build_markers(@place) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow place[:name]\n end\n end", "title": "" }, { "docid": "5ae318a21312cb38fb1726819345a258", "score": "0.60942346", "text": "def show\n @workplace = Workplace.find_by_user_id(params[:id])\n if @workplace == nil\n @workplace = Workplace.find(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workplace }\n end\n end", "title": "" }, { "docid": "5d11de22802537e11381740ed251feed", "score": "0.60913754", "text": "def show\n @place = Place.find(params[:id])\n @comment = Comment.new(place_id: @place.id)\n @json = Place.find(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "title": "" }, { "docid": "e989571b79626b51aaceebba2b99182b", "score": "0.60888356", "text": "def nearby\n if params[:latitude].present? && params[:longitude].present?\n places = Place.near([params[:latitude].to_f, params[:longitude].to_f], 50, units: :km).limit(@limit).offset(@offset)\n if places.present?\n respond_with places, status: :ok, location: places_path\n else\n render json: {error: 'Could not find any resources nearby stated location.'}, status: :not_found\n end\n else\n render json: {error: 'Could not find any resources. Check if you are using the required parameters.'}, status: :bad_request\n end\n end", "title": "" }, { "docid": "95722fa7098aeaa1f5ccc98c9e3e4d1a", "score": "0.6079401", "text": "def index\n\t\t@places = Place.paginate(:page => params[:page], :per_page => 5)\n\n\tend", "title": "" }, { "docid": "687bb5c09b84c7afa8b4b0193cb48372", "score": "0.607683", "text": "def show\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "title": "" }, { "docid": "11457b59b792bdd030cd6db1e90406f3", "score": "0.60537773", "text": "def show\n @place = Place.find(params[:id])\n #debugger\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "title": "" }, { "docid": "d57f2b6b75c904d6eb764a79409ab6a2", "score": "0.60267556", "text": "def create\n @user_place = UserPlace.new(user_place_params)\n\n respond_to do |format|\n if @user_place.save\n format.html { redirect_to @user_place, notice: 'User place was successfully created.' }\n format.json { render json: @user_place }\n else\n format.html { render :new }\n format.json { render json: @user_place.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a3b223d4c84261e0436c3238ca3626b", "score": "0.60255", "text": "def favourite_places_for_user(user_id)\n where(:user_id => user_id).map(&:place_id)\n end", "title": "" }, { "docid": "28b334087a945e025d0c602fb1833e76", "score": "0.6020159", "text": "def index\n @places = Place.all.page(params[:page]).per(4)\n end", "title": "" }, { "docid": "84f00f124ba7ddac49524e7379544c77", "score": "0.6014637", "text": "def index\n if params[:creator_id].present?\n @creator = Creator.find(params[:creator_id])\n places = @creator.places.limit(@limit).offset(@offset).latest\n else if params[:tag_id].present?\n @tag = Tag.find(params[:tag_id])\n places = @tag.places.limit(@limit).offset(@offset).latest\n else\n places = Place.limit(@limit).offset(@offset).latest\n end\n end\n if places.present?\n respond_with places, status: :ok\n else\n render json: {error: 'Could not find any resources at all. Check if you are using the required parameters.'}, status: :not_found\n end\n end", "title": "" }, { "docid": "1611e67234963a37a4186b3c1d61dc49", "score": "0.60071206", "text": "def show \n @place = Place.find(params[:id]) \n render json: {status:'SUCCESS',message:'Louded place',data:@place},status: :ok\n\n\n end", "title": "" }, { "docid": "fc9cc44d7839c47806dcc0e5854aa43b", "score": "0.60056204", "text": "def show\n @place = Place.find(params[:id])\n @locals = Local.all\n @ticket_type_groups = TicketTypeGroup.order(:value)\n @statuses = Status.order(:value)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @place }\n end\n end", "title": "" }, { "docid": "8f7c82b04123d01c60f39fd7594ca3b7", "score": "0.5977781", "text": "def search_place\n @radius = @params[:radius] if @params[:radius].present?\n @type = @params[:type] if @params[:type].present?\n if @params[:filters].present?\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&name=\"+@params[:filters]+\"&radius=#{@radius}&type=#{@type}\")\n else\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&radius=#{@radius}&type=#{@type}\")\n end\n places[\"results\"] \n end", "title": "" }, { "docid": "597fe667abde8f89a0cea667eb9ad5ef", "score": "0.5958303", "text": "def show\n respond_with @place, status: :ok, location: places_path(@place)\n end", "title": "" }, { "docid": "9823b0b9e0929b955ac3a0dfe3724adf", "score": "0.5957707", "text": "def get_place\n @spot = ((GooglePlaces::Client.new(ENV['GOOGLE_CLIENT_ID'])).spots_by_query(\"Food near #{@user.location}\"))\n @place = @spot[rand(20)]\n @url = @place.photos[0].fetch_url(800)\n end", "title": "" }, { "docid": "e30908f929d9b9e3dd300051953e0bbd", "score": "0.5944356", "text": "def get_nearby_places_bytypes(lat, lng, type, options={})\n get_info_fromjson = GetInfoFromJson.new\n\n url_params = { :location => \"#{lat},#{lng}\", :types => type, :key => @api_key, :rankby => \"distance\", :language => \"ja\" }\n url = set_params(@base_url, url_params)\n \n res = http_get(url)\n\n places = get_info_fromjson.get_places_info(res, 3)\n\n return places\n end", "title": "" }, { "docid": "093bc03af102b5626149873f0ad89a47", "score": "0.5943379", "text": "def user_place_params\n params.require(:user_place).permit(:user_id, :place, :desc)\n end", "title": "" }, { "docid": "e7d8add63688ad0d1b6b12c27bc154c5", "score": "0.59238", "text": "def index\n\t\t@places = Place.all\n\t\t@places = Place.paginate(:page => params[:page], :order => 'created_at DESC', :per_page => 4)\n\tend", "title": "" }, { "docid": "c346dd8b658f9e314d9d1e2adfbf26bc", "score": "0.5920592", "text": "def index\n @assign_group_places = AssignGroupPlace.all\n render json: @assign_group_places\n end", "title": "" }, { "docid": "9f5d180eca43e1da1b626b4253cf32cb", "score": "0.5913074", "text": "def index\n @places = Place.all\n #@places = Place.paginate(page: params[:page], per_page: 5)\n end", "title": "" }, { "docid": "317ae2854328e0ef9f9fd467c48070e5", "score": "0.5898694", "text": "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place.to_xml(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n format.json { render :json => @place.to_json(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n end\n end", "title": "" }, { "docid": "41e0a1efa82d94c5a1c37aa8472f3cdb", "score": "0.58947223", "text": "def get(geo_place)\n url = \"http://geocode-maps.yandex.ru/1.x/?format=json&geocode=#{URI.escape( geo_place )}&key=#{@api_key}\" \n #url = \"http://geocode-maps.yandex.ru/1.x/?format=json\" \n @json = open(url).read\n end", "title": "" }, { "docid": "0add7d6f89dd5f0fd3b59dbcbc2bf3c8", "score": "0.5892447", "text": "def index\n authenticate\n @places = Place.where(approved: true)\n end", "title": "" }, { "docid": "c586630b9bc8aa356cfeff7042e4ea66", "score": "0.58923954", "text": "def recommend_a_place\n # 1- Find the person we are giving the recommendation to (determined by the user_id)\n # 2- Calculate the total VALUE that each place has for that given user (algorithm)\n # 3- Sort by value the array of recommended places\n # 4- Return the data for the user and the array of recommended places in the specified format \n if params[:user_id]\n @person = User.find(params[:user_id])\n else \n wrong_user_id = true\n end\n \n unless wrong_user_id\n # The algorithm to calculate the total VALUE of each place returns an array of arrays, where the 1st element is the value\n # of the place which is in the 2nd element.\n array_values_places = calculate_value_of_places(@person)\n @sorted_array_values_places = array_values_places.sort_by { |e| e[0] }.reverse\n\n respond_to do |format|\n if wrong_user_id\n format.json { render :json => { :status => \"Error\", :response => {} }}\n else\n format.json { render :file => \"places/recommend_a_place.json.erb\", :content_type => 'application/json' }\n end\n end\n end \n \n end", "title": "" }, { "docid": "b76f69b06bfdca756425d3b3249227f1", "score": "0.5881389", "text": "def create\n redirect_to(root_url) unless current_user\n\n @place = current_user.places.build(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1740b6c9d7e3a296df16c9f3da1279ec", "score": "0.5864583", "text": "def show\n @trip = Trip.find(params[:id])\n @places = @trip.places\n end", "title": "" }, { "docid": "41ad7726ae7625b8ecb4fde9794ba9eb", "score": "0.5855352", "text": "def index\n @places = Place\n .all\n .includes(:words)\n .order(:name)\n .paginate(page: params[:page], per_page: 50)\n .load\n\n # Set @map_places to a hash with data for the map with all places\n @map_places = map_places\n end", "title": "" }, { "docid": "a4b271e81114644435a9103ec602559e", "score": "0.5850987", "text": "def create\n @place = Place.new(place_params)\n\n @place.user_id = current_user.id\n\n add_tags\n \n if @place.save\n @place.update(place_params)\n render json: @place\n else\n render json: @place.errors\n end\n end", "title": "" }, { "docid": "36849589ef896b3744f070ffdf5adbe4", "score": "0.5804172", "text": "def get_place(query)\n url = URI(\"https://rapidapi.p.rapidapi.com/apiservices/autosuggest/v1.0/US/USD/en-US/?query=#{query}\")\n\n response_hash = access_api(url)\n if response_hash == nil || response_hash[\"Places\"] == nil || response_hash[\"Places\"][0] == nil\n return nil\n end\n response_hash[\"Places\"][0][\"PlaceId\"]\nend", "title": "" }, { "docid": "21484f40a93e2aa231d4504e21b7b85b", "score": "0.5800473", "text": "def index\n @admin_places = Admin::Place.all\n end", "title": "" }, { "docid": "97d3778219f797a5e6cba0cd0bee46ed", "score": "0.58002335", "text": "def index\n @places = @places.page params[:page]\n\n @feed_link = places_url(:format => :atom)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n format.atom { render :layout => false }\n end\n end", "title": "" }, { "docid": "d05e699719704074203ddcb08d9ca424", "score": "0.5785185", "text": "def show\n @place = Place.find(params[:id])\n respond_with(@place)\n end", "title": "" }, { "docid": "2ed9b87fc1627ac771ce9af79af2c4ae", "score": "0.57837635", "text": "def show\n @place = Place.find(params[:id])\n end", "title": "" }, { "docid": "c40ffd8d0da4e5b233ed6c7a8ccabcee", "score": "0.5777436", "text": "def index\n @user_place_categories = UserPlaceCategory.all\n end", "title": "" }, { "docid": "408f2d8c25a05869f82d5a11bf41c6e1", "score": "0.5772859", "text": "def show\n @place = Place.find_by(:id=> params[\"id\"])\n end", "title": "" }, { "docid": "faaf04e147423b96d3526c2447a272d0", "score": "0.575648", "text": "def show\n #@location = Location.find(params[:id])\n @user=User.find_by_id(params[:user_id])\n @location = Location.find_by_id(params[:id])\n a = @location.address \n \n \n @array_rest = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_amusementpark_camp= Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_shopping = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n\n @json = @array_rest.to_json\n #@json = array_rest.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n \n end \n \n end", "title": "" }, { "docid": "f79c3f29eec6286078903f6379539aa9", "score": "0.57510275", "text": "def show\n @placemark = Placemark.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @placemark }\n end\n end", "title": "" }, { "docid": "ea9bf7680ee52f8f5ceed69fb86f364f", "score": "0.57386225", "text": "def show\n redirect_to(root_url) unless current_user.id == @place.user.id\n\n @user = current_user\n @place = Place.find(params[:id])\n @comments = Comment.where(place_id: @place).order(\"created_at DESC\")\n end", "title": "" }, { "docid": "10629b54346faf963909489f9685a3f3", "score": "0.5732287", "text": "def index\n @places = Place.search(params[:query]).filter(params).paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html \n format.js \n end \n end", "title": "" }, { "docid": "a96ed9ce8e0cd7ca5addf9d4c34b0573", "score": "0.5722682", "text": "def get_name_and_location\n @top_ten.each do |user|\n user_details = self.class.get(\"/users/#{user[0]}\").parsed_response\n user << user_details[\"name\"]\n user << user_details[\"location\"]\n end\n end", "title": "" }, { "docid": "6c71ec421d5da8f0380ad83f978786c5", "score": "0.57176065", "text": "def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "6c71ec421d5da8f0380ad83f978786c5", "score": "0.57176065", "text": "def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "c8f2bdeb493dfcb58f073c199c09b454", "score": "0.5714778", "text": "def index\n nearby_places_finder = NearbyPlaces.new(nearby_places_params)\n\n expose nearby_places_finder.call,\n each_serializer: NearbyRestaurantSerializer\n end", "title": "" } ]